# pdfcomment and breqn

I'm trying to use \pdfmarkupcomment from pdfcomment inside a dmath environment from breqn, but they appear to be incompatible.

Here is a simple example where it fails:

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath,amssymb,amsfonts,dsfont}
\usepackage{breqn}
\usepackage{pdfcomment}

\begin{document}
\pagestyle{empty}

% this works
$$\pdfmarkupcomment{ab}{F}$$

% this fails:
\begin{dmath}
\pdfmarkupcomment{cd}{G}
\end{dmath}

\end{document}


The error I get from pdflatex is:

LaTeX Warning: Reference pdfcomment:zref@2' on page 1 undefined on input line
18.

! Undefined control sequence.
{\vbox to\z@ {\vss \@mn@marg...
l.18 \pdfmarkupcomment{cd}{G}

?

LaTeX Warning: Reference pdfcomment:zref@3' on page 1 undefined on input line
18.

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux
* soulpos - computing points - it may take a few seconds * (./test.upa))

LaTeX Warning: There were undefined references.

LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.


I'm compiling in (k)ubuntu 15.04.

• Welcome to TeX - LaTeX! I suggest you load breqn after pdfcomment to alleviate one warning message. But that doesn't solve your main problem. – Andrew Swann Sep 2 '15 at 12:56

For some reason, breqn redefines in certain situations \vadjust to be \eq@vadjust without giving any meaning to this command, and this is the reason why you get the puzzling error message.

My suggestion would be to drop breqn altogether: I don't think it's useful to improve typography; it possibly can help in case where automatic breaking is desired because we can't control it (say mass compilation of documents whose output quality is not a concern).

If you add a default meaning to \eq@vadjust the document compiles, but I can't check if this has adverse effects.

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath,amssymb,amsfonts,dsfont}
\usepackage{pdfcomment}
\usepackage{breqn}

\makeatletter
\makeatother

\begin{document}
\pagestyle{empty}

$$\pdfmarkupcomment[markup=Underline]{ab}{F}$$

\begin{dmath}
\pdfmarkupcomment[markup=Underline]{cd}{G}
\end{dmath}

\end{document}


• Unfortunately I cannot drop breqn. It is used to break some long equations which are automatically generated by another program. Your suggestion does appear to make it work. So far I have not spotted any visible issues. Thank you! – João Leal Sep 2 '15 at 13:49