1

I am trying to improve the pdfpcnotes package, that extracts notes in beamer into an external file for pdfpc. The main idea is that we have a counter (\lastframenumber), that checks if we stepped to the next frame and when this happens it does things once. My problem is, that somehow in this setup, if we are in an animated frame (i.e. beamer generates multiple pages for a single frame) \lastframenumber gets reset to the previous frame for each step of the animation, thus instead of doing things once, it happens for each animation step, which is an unwanted situation, but I don't understand why this is happening. Any ideas? Here's the code that doesn't work. The pnote command would be used inside the frame.

\def\lastframenumber{0}
    \newcommand<>{\pnote}[2][]{%
        \show\lastframenumber
        \ifdim\theframenumber pt >\lastframenumber pt
            \edef\lastframenumber{\theframenumber}
        \fi
  • I guess you are talking about overlay specification but not animate. If you want to export the header only when there is a new frame, you should use something like \only<1>. Or, more directly, hack \frametitle and \framesubtitle – Symbol 1 Nov 17 '15 at 9:26
  • Yes, sorry, it is the overlay I'm talking about. But my issue is not with the overlay itself. My issue probably just plain LaTeX: when the \ifdim clause fires \lastframenumber is set (at least that is what I'm trying to achieve) to the value of \theframenumber or the actual frame, to be more specific. The initial problem with this (why \let doesn't work is), is that \theframenumber is \@arabic\c@framenumber, the other one being that as done above \lastframenumber gets changed outside the \ifdim \fi thus triggering it again and again. – fbence Nov 17 '15 at 9:51
  • 1
    I am away from my computer so l am not sure... But did you try \global? – Symbol 1 Nov 17 '15 at 9:54
  • Cool, \global did the trick! It seems I have no idea about scope in LaTeX :) – fbence Nov 17 '15 at 10:37
  • Would you care writing that up as an answer so or you're not out hunting points?:D – fbence Nov 18 '15 at 15:43
0

The solutions is basically due to Symbol 1: in the original setup \lastframenumber only 'lived' for each call to \pnote. It seems that for a frame with overlay, that for each page generated the whole frame is read again, calling \pnote for each page, thus triggering the \ifdim for every page of the frame. Prepending \global to the definitions keeps the variable 'alive' outside of the command call thus making it actually keep the last frame number:

\global\def\lastframenumber{0}
\newcommand<>{\pnote}[2][]{%
    \ifdim\theframenumber pt >\lastframenumber pt
        \global\edef\lastframenumber{\theframenumber}
    \fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.