# Display text as tooltip with pdfcomment - how to ignore complex formatting commands?

I have a large document which has to be edited "heavily", so there is a lot of text content which has to be removed for the final version, but I would like to keep it in sight during editing also in the PDF.

So generally said I have to replace e. g. a large paragraph with one or two short sentences and I'd like to still be able to see the original version in the PDF.

I tried to do that with the pdfcomment package and the pdftooltip command, as it does not consume significant space on the page (it is important for me to see how the final document will look) and in general that works well with simple text, but if there is more complex formatting (e. g. an environment), I get error messages.

I tried to build a minimal example:

\documentclass{scrbook}
\usepackage{color, url}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{pdfcomment}
\newcommand{\weg}[1]{\pdftooltip{\textcolor{red}{\bfseries{}W}}{#1}}

\newcommand{\mycommand}[1]{abc--#1--def}

\begin{document}

test of my command: \mycommand{helloworld}

This is my example text. Here comes the tooltip: \weg{This is the tooltip text. \cite{Author2011} \mycommand{helloworld} $y_1 = x^3 +1$  }

here it fails: \weg{\begin{center} centered text \end{center}}

\end{document}


The custom command \mycommand which outputs only "text" does not pose a problem, the \cite commands seem to be more problematic, an equation gets "simplified" and some commands just fail.

my questions:

• how could I change my command \weg{} to print all the latex source code verbatim in the tooltip

• which type of LaTeX code will likely cause problems with the tooltip?

-
Have you tried/considered fancytooltips or cooltooltips? Both these packages allow for more advanced constructs in the PDF tooltip, including formatting. –  Werner Dec 14 '11 at 23:36
@Werner: no, I did not know about those 2 alternatives. I'll test them and see if it works better. –  MostlyHarmless Dec 14 '11 at 23:51
The fancytooltips and cooltooltips packages provide more advanced constructs in the PDF tooltip, including formatting.
Here is a screenshot from the fancytooltips package documentation: