When I try to mark-up text that contains a citation, I have trouble. Here's an attempt at a minimal working example called mwe-pdfcomment.tex

%pdfcomment stuff below:
%pdfcomment stuff above
\author{John Doe} \title{Sample Document}



According to a handbook \pdfmarkupcomment[color=yellow,opacity=1.0,markup=Highlight]{
   {\citep{texbook}}  %commenting this line out works
}{Why do you think this citation is important?},
this paragraph---and certainly this
section---should be longer than one sentence.

\bibliographystyle{plain}   % (uses file "plain.bst")
\bibliography{mwe}      % expects file "mwe.bib"

and the corresponding mwe.bib

   author = "Donald E. Knuth",
   title= "The {{\TeX}book}",
   publisher = "Addison-Wesley",
   year = 1984

Initially, I got the error

! Argument of \@citex has an extra }.

which is why I put an extra set of {} around the \citep stuff. However, that leads to the following error:

! Package soul Error: Reconstruction failed.

Does \pdfcomment allow for citations inside the markup? If so, how?

There are related questions Problem when using pdfcomment in figure captions and then referencing and possibly Conflict between amsmath and pdfcomment


The error here is coming from the soul package, which is being used by pdfcomment to do the highlighting. If you read the soul docs, you'll find that there are cases where it can't operate successfully. I suspect what you are seeing here is the case of a hyphenation point inside a group. What you do find is that if you keep going past the error, run BibTeX then run LaTeX again twice, on the final run everything is OK. That's presumably because the \citep now produces text that soul can handle.

I'm not sure there is much you can do about this: it's a known limitation of soul and you'll just have to put up with it.

  • It seems there are some things to do, at least when it is \cite – Fuhrmanator Aug 10 '13 at 20:10

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.