W3cubDocs

/LaTeX

\value

Synopsis:

\value{counter}

Expands to the value of the counter counter. (Note that the name of a counter does not begin with a backslash.)

This example outputs ‘Test counter is 6. Other counter is 5.’.

\newcounter{test} \setcounter{test}{5}
\newcounter{other} \setcounter{other}{\value{test}}
\addtocounter{test}{1}

Test counter is \arabic{test}.
Other counter is \arabic{other}.

The \value command is not used for typesetting the value of the counter. For that, see \alph \Alph \arabic \roman \Roman \fnsymbol.

It is often used in \setcounter or \addtocounter but \value can be used anywhere that LaTeX expects a number, such as in \hspace{\value{foo}\parindent}. It must not be preceded by \protect (see \protect).

This example inserts \hspace{4\parindent}.

\setcounter{myctr}{3} \addtocounter{myctr}{1}
\hspace{\value{myctr}\parindent}

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/_005cvalue.html