Hi Guys,
I am trying to use the counter with an animated slideshow using the beamer class.
The below code works eventually (meaning it does what I wanted) creating node by node and numbering it in increasing order.
But, it does not compile well, it says the counter cnt is already defined:
! LaTeX Error: Command \c@cnt already defined.
Or name \end... illegal, see p.192 of the manual.
I looked every where and cant find a solution, How can I avoid this problem?
Please Help ...
\documentclass[brown]{beamer}
\mode<presentation>
{
\usetheme{Warsaw}
}
%%%%% My included packages %%%%%%%%%%%%%
\usepackage{tikz} %To use tikzpicture
\usetikzlibrary{calc}
\beamerdefaultoverlayspecification{<+->}
\begin{document}
\begin{frame}
\newcounter{cnt}
\setcounter{cnt}{1}
\resetcounteronoverlays{cnt}
\begin{tikzpicture}
\foreach \x in {(1,2),(2,4),(5,5)}{
\node [draw, circle ,fill=green!50,inner sep=0pt, minimum size = 6mm] at \x (p$\thecnt$){$\thecnt$};
\stepcounter{cnt}
\pause
}
\end{tikzpicture}
\end{frame}
\end{document}
Graphics, Figures & Tables ⇒ Beamer: Counters with overlays
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Beamer: Counters with overlays
Just rename the counter »cnt«.
Best regards and welcome to the board
Thorsten
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Beamer: Counters with overlays
Hi
Thanks for the replay.
Renaming the counter does not solve the problem. (You can try the code I posted)
This is since I am using overlays. The counter is redefined every time (and every slide) (what ever it is called) I need some kind of way to define it from outside or to let it know not to redefine it.
Thanks
Roi
Thanks for the replay.
Renaming the counter does not solve the problem. (You can try the code I posted)
This is since I am using overlays. The counter is redefined every time (and every slide) (what ever it is called) I need some kind of way to define it from outside or to let it know not to redefine it.
Thanks
Roi