Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

\documentclass[11pt]{article}
\usepackage[square,sort,comma,numbers]{natbib}
%pdfcomment stuff below:
\usepackage[opacity=1.0,version=1]{pdfcomment}
\usepackage{tikz}
\usetikzlibrary{calc}
\pdfcommentsetup{color=yellow,opacity=1.0}
%pdfcomment stuff above
\author{John Doe} \title{Sample Document}
\begin{document}

\maketitle

\section{Introduction}

According to a handbook \pdfmarkupcomment[color=yellow,opacity=1.0,markup=Highlight]{
   {\citep{texbook}}  %commenting this line out works
Blah
}{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"
\end{document}

and the corresponding mwe.bib

@BOOK{texbook,
   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

share|improve this question
    
Would you please add a minimal working example (MWE)? –  egreg Mar 7 '13 at 23:04
    
@egreg I attempted to do that - see the edit –  Fuhrmanator Mar 8 '13 at 6:18
1  
I could have edited this question to make it more clear, but I decide to reformulate it here tex.stackexchange.com/q/111419/1871 –  alfC Apr 29 '13 at 19:58
add comment

1 Answer 1

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.

share|improve this answer
    
It seems there are some things to do, at least when it is \cite –  Fuhrmanator Aug 10 '13 at 20:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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