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

0

1 Answer 1

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

3
  • OK, you say: there is no simple solution that fits to all cases. Thank you.
    – Tobias
    Jul 27, 2016 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, 2016 at 22:12
  • i believe \pdfmargincomment uses a \tikzmark while \marginpar doesn't. OTOH, there are places you cannot use \marginpar either. Jul 27, 2016 at 22:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .