I have recently learned about the pdfcomment package which, as the name suggests, inserts comments into pdf files. So LaTeX does understand some of that.

I also know about synctex: LaTeX also knows which part of a pdf file corresponds to which part of the source file.

So, I wondered whether there is any way to find comments in a pdf file which has been annotated with comments (from some other source, maybe a reviewer) and integrate them into the source file. This does not have to be perfect in terms of replacing text, for example; but something along this lines:

% preamble
% text
\pdfcommentimported{NameOfReviewer suggested to add: "some text to add"}
\pdfcommentimported{NameOfReviewer suggested to replace "some text to remove" by "some text to add"}

This would greatly simplify revising a LaTeX document after having the pdf reviewed by others. Is that possible?

2 Answers 2


Package pdfcomment gives you or an teacher or professor to add comments into the LaTeX source file. Theese comments are then displayed in the compiled pdf file, for example in balloons.

The other way to insert comments into pdf files depends on the used viewer. LaTeX is not able to recognize these comments.

The synctex mechanismn is to locate a special letter in the pdf file and to allow the editor to show that code. To do what you want this mechanimn has to be programmed to recognize these viewer inserted comments and point to the place they were added. As far as I know is that not implementeted.

So I think today the answer is: no, today it is not possible.

At last a remark: would it really usefull to copy (at last without explicite looking on each comment) all received comments into your document?

I think not!

Comments are a remark like: you can do this in another way, the year of birth of Einstein is not 1965 or simular. I had never the situation that all of correcting or other remarks had to be integrated in the checked document.

Better is to open the tex code and the pdf file side by side and then check each remark in the pdf file. If the check is positive add the comment into your tex code by rephrasing your text or copying it (don't forget to cite, if neccessary!). If the check is negative, go on to the next comment.

If the comments are added with pdfcomment you can easy find the comment and the place you have to rework with the search button of your editor.

  • I don't think this is how the synctex mechanism works. At least, that's not how I understand it. Do you have a source for that explanation?
    – cfr
    Commented Sep 30, 2015 at 1:08

As I understand it, this is how the synctex mechanism works:

  • There is no direct association between anything in the PDF and anything in the source.

  • When you use the --synctex=1 option, the engine (e.g. pdfTeX) writes an additional file (.synctex.gz) linking locations in the PDF with locations in the source.

  • A suitable PDF viewer takes the location of a position in the PDF and passes it to the editor. For example, I have Okular configured to use the command kile --line %l, with Kile as the editor.

  • If the editor supports the feature, it uses the file written during compilation to lookup that location and the corresponding location in the source.

  • The editor then moves to the source location which it has looked up. (Or opens the file and moves to the location.)

Without the lookup file, there's no connection between the PDF content and the source content.

Here's an example .synctex.gz file for a simple 'Hello.' document:

SyncTeX Version:1
Input:1:<path to tex file>
Input:4:<path to aux file>
X Offset:0
Y Offset:0
Input:5:<path to aux file>
Post scriptum:

If I click on the 'Hello.' in the output, Okular passes my location to Kile, which looks that up in the .synctex.gz and finds out that it corresponds to line 13 in the source, so it displays line 13 in the .tex file.

[I say 'roughly' because obviously there are issues of which file, which page etc., as well. But the above gives the general idea.]

If the PDF has been annotated as-is, so that the locations in the PDF still correspond sufficiently well to the locations in the source, then you can use the location of content near an added annotation to move to the corresponding location in the source. However, if the PDF has had, say, a cover page added or the content itself has been altered, then this would not work very well.

However, pax allows you to extract and reinsert PDF annotations. This may be a more promising avenue of enquiry than a mechanism which relies on a possibly stale .synctex.gz.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .