1

If you use a pdf-viewer to add comments to a pdf document, you do not modify the typesetting - of course.

I would like to have the same behaviour using a command of the pdfcomment package (or other package).

My problem is, that pdfcomment in some cases adds vertical space in the text.

\documentclass{article}
\usepackage{pdfcomment}
\begin{document}
    \section{Section 1 Title}
    \pdfmargincomment{This leads to additional  vertical space :-(}
    \begin{itemize}
        \item additional vertical space above :-(
    \end{itemize}

        \section{Section 2 Title}

        \begin{itemize}
            \item normal vertical space above :-)
        \end{itemize}
\end{document}

MWE

3

Macro \pdfmargincomment takes up no space when it is placed beside something, but itemize does not like to be beside anything. In fact it adds \par if it doesn't start in vertical mode.

If you put the itemize inside a minipage, then one can put the \pdfmargincomment beside the minipage.

\documentclass{article}
\usepackage{pdfcomment}
\begin{document}
    \section{Section 1 Title}
    \pdfmargincomment{This leads to additional  vertical space :-(}%
    \begin{minipage}[t]{\textwidth}
    \begin{itemize}
        \item additional vertical space above :-(
    \end{itemize}
    \end{minipage}

        \section{Section 2 Title}

        \begin{itemize}
            \item normal vertical space above :-)
        \end{itemize}
\end{document}

demo

| improve this answer | |
  • OK, you say: there is no simple solution that fits to all cases. Thank you. – Tobias Jul 27 '16 at 21:31
  • \marginpar{\pdfcomment{Hello}} seems to be more robust than \pdfmargincomment{Hello} if you place it between \section{test1} and \subsection{test2} e.g. – Tobias Jul 27 '16 at 22:12
  • i believe \pdfmargincomment uses a \tikzmark while \marginpar doesn't. OTOH, there are places you cannot use \marginpar either. – John Kormylo Jul 27 '16 at 22:28

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.