I noticed recently that if I'm using pdfcomment package together with makeidx in one document, highlighted comments are not added to the PDF output. for example, you may run the following with LaTeX:
\documentclass[a4paper,12pt,oneside,titlepage]{report}
\usepackage[x11names,table]{xcolor}
\usepackage{makeidx}
\usepackage{pdfcomment}
\makeindex
\begin{document}
\pdfmarkupcomment[author={Oleksandr},subject={test},color=green!25]{I will}{or, maybe not} put here some text, formulas, tables, comments, and some other things.
Here comes a \index{formula} formula.
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Index}
\printindex
\end{document}
and see that in the output no comments are added. However, if you comment out lines
\usepackage{makeidx}
and
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Index}
\printindex
and re-run the typeset, you will see that comment is now added. Workaround is obvious - first, run the document without makeidx package, and then add it in the end, but it is not very good.
Why is there such behavior of the pdfcomment package and how to fix it?
Edited:
I accept answer of egreg, however, I see some strange behavior of imakeidx in my computer. To illustrate it, I put a picture there, so you can see that sub-entry of the index is not formatted properly.


makeidx; just a\clearpagecommand suffices. – egreg Feb 18 '14 at 20:38soulpos.sty(only used bypdfmarkupcomment- it works e.g. withpdftooltip). Under certain circumstancessoulpos.styonly produces itsupafiles but noupb(with the positions) files, see: http://tex.stackexchange.com/questions/132973/pdfmarkupcomment-does-not-highlight-what-it-is-supposed-to and https://bitbucket.org/kleberj/pdfcomment/issue/13/pdfmarkupcomment-not-visible-when-using. I contacted Javier Bezos but unfortunately never got a reply. – Josef Feb 18 '14 at 21:06pdfcomment: \documentclass{report} \usepackage{soulpos} \usepackage[rgb]{xcolor} \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} \ulflag{TestTestTest} \clearpage \end{document} – Josef Feb 18 '14 at 21:27\clearpage. Once theupbfile is created bysoulpos.sty,pdfcommentcan place the comments! – Josef Feb 18 '14 at 22:01