# Comments/tips on a (non Latex) pdf including mathematical formulas

My goal : I correct copies from students that I scan to pdf. I wish I could make the annotations on the scanned copies rather than on the physical paper. Today, I have to scan the copies again to have my annotations transferable to students by email. Since most of the annotations are similar, I wish to have a stock of annotations I could transfer on the copies.

I went through a lot of technologies, including many "StackExchange Questions" here. I considered pdfcomment, cooltips, fancytooltips, the OCG family (ocgx, ocgp, ocg2, ...), etc. Two tracks attracted more specifically my attention :

• pdfcomments : I like the mouseover to see the comment, the capabillity to move the annotation around so I can have a stock on a pdf and I can copy it onto the scanned copies. This would be my choice if there was not a main drawback : it accepts only plain text when I need to use mathematical notations. (It needs selected pdf readers). Because you can move comments, you can put them on any pdf, even if it is not compiled from Latex or if you don't have the source.
• fancytooltips : I like the mouseover to see the comment, and the capability to use LaTeX mathematical formulas and images. Drawbacks : I can't move the annotation from a pdf document to the copies. (It works with very few pdf readers.) . I am not sure whether I can put tips on non Latex pdfs.

Is there a way to have pdfcomment have images/Latex mathematical formulas (or references to formulas that can show with a mouseover) ? Or is there a way to transfer fancytooltips to a non Latex pdf ? Or are there other techniques to achieve the goal ?

• Something like this: tex.stackexchange.com/questions/119988/…, perhaps? – user31729 Mar 28 '16 at 8:56
• I know of this question but : * Is it working on a non latex pdf (scanned paper for instance) ? (I guess so since it is based on pdfcomment) *does it work with maths formulas ? – user1771398 Mar 28 '16 at 9:02
• Well, AlexG said so, yes, about three years ago. The scanned image is included, as far as I know, you can make an overlay with TikZ etc. which has your pdfcomment stuff, for example – user31729 Mar 28 '16 at 9:05
• Then I must try harder in this direction. You seemed to ask for the very same problem (except the non Latex pdf constraint). Did you manage to enforce the proposed solution ? – user1771398 Mar 28 '16 at 9:14
• How do move annotations from one pdf to the other? Through the export/import of an fdf? – Ulrike Fischer Mar 28 '16 at 14:21

It is to some extend possible to add unicode chars (including math symbols) to pdfcomment if you compile with lualatex (^^^^2200 etc can be replaced by the real unicode input ∀) but annotation will imho never be able to show complex equations:

\documentclass{article}
\PassOptionsToPackage{unicode}{hyperref}
\usepackage{pdfcomment}
\begin{document}
text\pdfcomment{^^^^2200 ^^^^221a a=b^^^^00b2 öäüß }
\end{document}


If you want complex equations you could probably use stamps (or however they are called in the english version of the reader), but they have no mouse up (perhaps it could be added with javascript).

• It happens that I use luaLaTeX for calculations. I can also do subscripts with this unicode solution. Thanks for this bypass that helps ! – user1771398 Mar 28 '16 at 19:30
• Together with a web site such as vikhyat.net/projects/latex_to_unicode, it is easy to transform a Latex phrase such as "\forall\epsilon>0\exists\alpha\in\mathbb{R}^{*+}|x-x_0|<\alpha\Rightarrow|f(x)-f(x_0)|<\epsilon" into the plain text "∀∊>0∃α∈ℝ*⁺|x-x₀|<α⇒|f(x)-f(x₀)|<∊" which is already useful. This transformation can probably be internalized with luaLatex code. Of course, as soon as you need to place text somewhere around such as in a fraction, in a limit, in a ∑, it is less convincing ; example : \frac{1}{x+1} gives (1/x+1). – user1771398 Mar 30 '16 at 1:39

Here is a solution.

Note: This is not about using fancytooltips but how adding elements to a non latex pdf file, named here mytest.pdf and included implicitly with mtpage environment. (if i understand)

Note the example use \usepackage[filename=tooltipy,movetips,mouseover]{fancytooltips} from fancytooltips documentation examples.

The environment mtpage include the page of number (its argument) using tikzpicture inside it you can add stuff using \mtadd command.

The command \mtadd[options passed to tikz node]{(x,y)}{stuff}.

\documentclass{article}
\usepackage[filename=tooltipy,movetips,mouseover]{fancytooltips}% from fancytooltips examples directory
\usepackage{tikz}

\iftrue % comment for final
%\iffalse % uncomment this line for final
\newenvironment{mtpage}[1]{% #1 included page's number,
% one can do this with stepcounter
\newpage
\begin{tikzpicture}[overlay,remember picture]
\pgfmathtruncatemacro\xmaxstep{\paperwidth/.5cm}%
\pgfmathtruncatemacro\ymaxstep{\paperheight/.5cm}%
\node[anchor=south west] at
(current page.south west) {\includegraphics[page=#1] {mytest.pdf}};
\draw[blue!20!white, thin, shift={(current page.south west)}]
(current page.south west) grid [ystep=.5cm,xstep=.5cm] (current page.north east);
\foreach \step [evaluate=\step as \x using \step*.5] in {1,2,...,\xmaxstep} {
\node[xshift=\step cm, yshift=1cm] at (current page.south west) {\step};};
\foreach \step [evaluate=\step as \y using \step*.5] in {2,...,\ymaxstep} {
\node[yshift=\step cm, xshift=1cm] at (current page.south west) {\step};};}{%
\end{tikzpicture}}
\else
\newenvironment{mtpage}[1]{%
\newpage
\begin{tikzpicture}[overlay,remember picture]
\node[anchor=south west] at
(current page.south west) {\includegraphics[page=#1] {mytest.pdf}};}{%
\end{tikzpicture}}
\fi
\newcommand{\mtadd}[3][text=red]{\draw[shift={(current page.south west)}] #2 node[#1] {#3};}

\begin{document}
\begin{mtpage}{1}%this is page 1
\mtadd[text=blue,fill=red!20, anchor= south west]{(6,23)}{Some text just for \tooltip{test}{1}.}