\newcounter{foo}. We can increment the value of the counter
by \addtocounter{foo}{1}, but that’s pretty clunky for an
operation that happens so often … so there’s a command
\stepcounter{foo} that does this special case of
increasing-by-one.
There’s an internal LaTeX variable, the “current label”, that
remembers the last ‘labellable’ thing that LaTeX has processed.
You could (if you were to insist) set that value by the relevant
TeX command (having taken the necessary precautions to ensure that
the internal command worked) — but it’s not necessary. If, instead
of either of the stepping methods above, you say
\refstepcounter{foo}, the internal variable is set to the
new value, and (until something else comes along), \label will
refer to the counter.
Go to previous question, or next question
Go to FAQ home.
URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=labelctr
Comments, suggestions, or error reports? - see “how to improve the FAQ”.
This is FAQ version 3.27, released on 2013-06-07.