3

I have a macro incrementing a custom counters in it. When this macro is used with overlays (class beamer), the counter is incremented for every overlay (as the macro appears to be called for every overlay)

Macro:

\def\test{\stepcounter{mycounter}}

Main code:

\begin{frame}
\test\\
\onslide<1->{One}
\onslide<2->{Two}
\end{frame}

Here the counter is not supposed to increase on every overlay command, just when calling the test macro. How can it be prevented that the counter increments?

3
  • Why do you want to change the section counter even inside the same section? To change the section (and its counter), use \section{} outside a frame.
    – Sigur
    Oct 10 '19 at 13:23
  • It is just an example. Using a custom counter results in the same problem.
    – funnyguy
    Oct 10 '19 at 14:04
  • I cannot add an answer to the question, because it is flagged as lacking details (which IMHO, does not). The solution to this problem is to use \resetcounteronoverlays{mycounter} in the preamble. Nov 18 '20 at 8:30

Your Answer

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

Browse other questions tagged or ask your own question.