I cannot manage to get the following command to work. I have a beamer
presentation with several slides on a frame. Then I want to use the pdfcomment
package to show some comments on the slides. Usually this works fine, but on frames with multiple steps, it's annoying, because the comments appear on each slide (and they are visible on each slide, even if the respective text has not appeared yet!). So my solution is the following:
I calculate the slide number on the frame and the use the \only
command to show the comment only of the last slide of the frame. In my example, this is the fifth slide on the frame. The command works like this:
\only<5>{\pdfcomment[style=note,author=name]{comment...}}
However, as it is quite annoying to find the last slide on the frame by hand, I tried to define a command, which reads:
\newcommand{\pdfnote}[2]{%
\setcounter{slidenum}{\insertpagenumber}
\addtocounter{slidenum}{1}
\addtocounter{slidenum}{-\insertframestartpage}
\only<\value{slidenum}>{\pdfcomment[style=note,author=#1]{#2}}%
}
Basically it uses the counter slidenum
, which contains the last slide on the frame, e.g. 2. The routine works, except that the pdfcomment
is visible on all slides! It's kind of weird, because when I simply replace \value{slidenum}
with 2, it works. And I just added the line \arabic{slidenum}
just before the \only
command so check if the counter is correct. Furthermore I replaced the \pdfcomment
by a simple text. That's working as well.
By the way: \only
does work, \onslide
does not work at all for pdfcomment
. I really don't understand. Do you have any ideas? Below you find a complete example.
\documentclass{beamer}
\usepackage[draft,author=admin]{pdfcomment}
\definestyle{note}{icon=Comment,color=white,open=true}
\definestyle{warning}{icon=Comment,color=red,open=true}
\newcounter{slidenum}
\newcommand{\pdfnote}[2]{%
\setcounter{slidenum}{\insertpagenumber}
\addtocounter{slidenum}{1}
\addtocounter{slidenum}{-\insertframestartpage}
%\arabic{slidenum}
\only<\value{slidenum}>{\pdfcomment[style=note,author=#1]{#2}}%
}
\begin{document}
\begin{frame}
test\\ \pause
next line
\pdfnote{me}{my comment}
\end{frame}
\end{document}