1

I find that \pdfmarkupcomment(from package pdfcomment) works well in main text body, but does not work in page header. What causes this problem and how to make it work in header?

Here is the MWE:

\documentclass{article}
\usepackage{fancyhdr,xcolor}
\usepackage[pdfstartview=FitH]{hyperref}
\usepackage{pdfcomment}
\usepackage{lastpage}

\begin{document}
\pagestyle{fancy}
\fancyhf{}
\lhead{%
\pdfmarkupcomment
[markup=Squiggly,color=red!1,author=author]
{\protect\color{magenta}author}
{Tel: 12345678}
}

In main body...
\pdfmarkupcomment
[markup=Squiggly,color=red!1,author=author]
{\protect\color{magenta}author}
{Tel: 12345678}
...some text
\end{document}
1

To long for a comment:

you can find other questions on this side reporting problems you have, for example this question and have a look to the answer I linked to.

After running your given MWE mwe.tex with current MiKTeX I get the two files mwe.upa

\ulp@Ga\z@ {%
\ulp@Pa0{1}{14461112}{43234099}%
\ulp@Pa0{2}{16356200}{43234099}%
}%

and mwe.upb

\ulp@Gb{%
\ulp@Pb{1}{{1895088}00}%
}%

As you can see the second entry is missing in the second file. Therefore you can not see the added pdfcomment.

As you can read in the linked answer above the culprit is package soulpos, which shows the following version number in my log file:

soulpos.sty    2012/02/25 v1.1 Fancy underlining.

It seems the bug is not solved in package soulpos

Please make a bug report to the author of pdfcomment and soulpos!

My used TeX distribution is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.6960 64-bit).

To answer your last comment "Are there other ways to get the same effect which can be used also in page header/footer?": As far as I know there is no other way for the same effect. The culprit is here, that this effects a heavy viewer dependent, some viewer shows it, most of them not. And the problem is that you can not know which pdf viewer a reader of your pdf is using. I do not think it is worth the time you have to invest to get that solved ... Sorry for bad news ;-)

  • Many thanks for your detail description and useful info!! – lyl Mar 4 at 12:08
  • And is there a way to get multilines of annotation like this: \pdfmarkupcomment[markup=Squiggly,author=author]{Tel:12345\\email:123@xxx} ? – lyl Mar 9 at 2:22

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.