2

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
\newcommand\pdfcommentimported[1]{}
...
% 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

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 Sep 30 '15 at 1:08
1

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:2:/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Input:3:/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo
Input:4:<path to aux file>
Output:pdf
Magnification:1000
Unit:1
X Offset:0
Y Offset:0
Content:
!309
{1
[1,15:4736286,46220574:26673152,41484288,0
[1,15:8799518,46220574:22609920,40435712,0
[1,15:8799518,6571294:22609920,786432,0
h1,15:8799518,6571294:22609920,0,0
]
[1,15:8799518,44254494:22609920,36044800,0
(1,14:8799518,8865054:22609920,455111,0
h1,13:8799518,8865054:983040,0,0
x1,13:11439166,8865054
k1,14:31409438,8865054:19970272
g1,14:31409438,8865054
)
]
(1,15:8799518,46220574:22609920,422343,0
k1,15:19940638,46220574:11141120
x1,15:20268319,46220574
k1,15:31409438,46220574:11141119
)
]
]
!506
}1
Input:5:<path to aux file>
!50
Postamble:
Count:19
!24
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.