PDF and LaTeX
How PDFs show up
Every PDF in an upload gets a page of its own next to it: paper/main.pdf shows at paper/main.pdf.html, and Markdown links to the PDF lead there. The pages are drawn as you scroll, so long documents stay quick, and the text can be selected. Links in the PDF open in a new tab. The PDF itself can still be downloaded from the top of the page.
Margent reads the text of every PDF when it arrives and scans it for passwords and keys, like any other file. A PDF with more than 300 pages, more text than fits, or one that can’t be read shows only its download link.
Comment on a PDF
- Select a few words on a page. The panel names the page, for example “Page 3”.
- Write your comment and choose Comment. For a remark about the whole document, use Comment on the whole page.
When a new version moves the text, for example because a page was added before it, the comment follows it to its new page. When the text is gone, the comment stays under Not in the document with the page it was last on.
Publish a LaTeX document
Margent never compiles TeX: your document needs its own fonts, packages and files, which only your build knows. Build the PDF in the publish workflow, the same way you build it anywhere else, and upload it.
- Build with SyncTeX, for example
latexmk -pdf -synctex=1 main.tex. SyncTeX records which line of which.texfile produced each piece of the PDF. - Copy the PDF and its
.synctex.gzinto the upload folder next to the sources, for example_margent/paper/. Upload the.texfiles too. - Name them in manifest.json at the root of the folder:
{"path": "paper/main.pdf", "kind": "pdf", "source_file": "paper/main.tex", "synctex": "paper/main.synctex.gz"}.source_fileis the main.texfile, as a path in the repository. Files it pulls in with\inputor\includeare found from there.
The setup guide has a complete workflow step to copy.
What your agent gets
For a comment on a PDF, your agent gets the page and the quoted text. With SyncTeX it also gets the .tex file and the lines, so it can go straight to the spot.
Those lines can be a little off. TeX reads some text in one go before it sets it, such as a macro’s argument, a box, or a table row, and SyncTeX then gives all of it the line where it ends. When the .tex file is in the upload, Margent looks up the passage in it and narrows the lines down. So there is no need to restructure your macros for it.
Running heads and footers, for example the document title and “4 of 14” on every page, are left out of the text your agent reads.
Good to know
- Page numbers count the PDF’s pages from the first one, cover included. They can differ from the numbers printed on the pages.
- A PDF without SyncTeX, or one that wasn’t made with LaTeX, takes comments just the same. Your agent then gets the page, not a line.
- Tapping a paragraph or marking an area of a page, such as a figure, doesn’t work in PDFs yet. Select text on it instead, or comment on the whole page.