# \pdfmarkupcomment does not highlight what it is supposed to

Basically I have the same problem as in the closed thread \pdfmarkupcomment works in MWE, but doesn't work in my thesis.

Simple MWE, even longer files work fine, the text gets highlighted as it is supposed to.

My main paper consists out of several .tex-files (in different subdirectories) that get included (or not) depending on boolean variables. Wheras other pdfcomment-commands work fine, the pdfmarkupcomment does not work at all.

Anybody seen something similar?

I can reproduce the problem. There seems to be a bug in soulpos.sty, which is used in \pdfmarkupcomment. When used in included files soulpos.sty only produces a .upa file but no .upb file. Therefore there are no positions to place the PDF annotation.

soulpos.tex

\documentclass{report}
\usepackage{soulpos}
\usepackage[rgb]{xcolor}
%\newcommand\myinclude[1]{\clearpage\input{#1}}
\ulposdef{\ulflag}{%
\mbox{%
\color{red}\rule[-.85ex]{.25\ulwidth}{1.5pt}%
\color{yellow}\rule[-.85ex]{.5\ulwidth}{1.5pt}%
\color{red}\rule[-.85ex]{.25\ulwidth}{1.5pt}}}
\begin{document}
\include{./subdir/test}
\end{document}

test.tex

foo \ulflag{Test} bar

I already filed a bug report to Javier Bezos. Hopefully, he will be able to fix it asap.

As a workaround, which might break other features the usage of \myinclude instead of \include will work:

\newcommand\myinclude[1]{\clearpage\input{#1}}
• Is there by chance any update on this? I was able to reproduce this issue in my thesis where I structured several sections across multiple files, included with \input. I don't really want to change all of the occurences... – ChrisK Dec 12 '16 at 14:54

I had a similar problem without using include files, but using some combination of packages (including, among many others, lastpage). I was able to fix the problem of the missing upb file by changing the following line in soulpos.sty

\write\@auxout{\string\ulp@afterend}%

to

\immediate\write\@auxout{\string\ulp@afterend}%

(I've also suggested this as a bugfix to Javier Bezos, the author of soulpos.sty).

• Welcome to TeX.SX! Changing a distributed file is not really recommended. – egreg Jan 5 '18 at 16:02
• @egreg You're right - the author of soulpos.sty needs to change it, because it's a bug :-) As a workaround, add to the preamble of your own file(s) \makeatletter \AtEndDocument{\immediate\write\@auxout{\string\ulp@afterend}} \makeatother (where \ulp@afterend is defined by soulpos.sty) – ThV Jan 5 '18 at 16:39
• Coming back to this, I had another case where the upa file was never written: using revtex4-1 together with pdfcomments did not work. This time, the fix was to include \AtBeginDocument{\immediate\openout\ulp@out=\jobname.upa\relax}. – ThV May 4 '18 at 12:04