Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

It seems that there are different ways of accessing counters. I have been using \theMyCount as in this post about Using counters or macros, but noticed that the arrayjobx package uses \the\value{MyCount}.

This post about LaTeX programming comparison operators uses just \value{MyCount} but that does not seem to compile for me.

Are there any differences between these different methods of accessing counters?




MyCount = \theMyCount

MyCount = \the\value{MyCount}

%MyCount = \value{MyCount}% Does not compile for me.
share|improve this question
Related question: whether or not I have to use \the –  Peter Grill Jul 17 '11 at 21:25

2 Answers 2

up vote 18 down vote accepted

\the\value{MyCounter} is just a slightly faster way to say \arabic{MyCounter}, as the former expands successively to

\the\csname c@MyCounter\endcsname

and the latter to

\expandafter\@arabic\csname c@MyCounter\endcsname

TeX rules say that \the is essentially equivalent to \number. I don't think that the difference in execution time can be significant in a normal document. It's usually better to stick to "official" macros, when they exist, in order to be sure that the result will be stable over time.

Usage of \theMyCount may be improper when we are not sure what kind of representation is associated to the counter MyCount.

On the other hand, \theMyCount should not be used in contexts when we are interested in the "abstract" value stored in the counter, so putting in a macro


is correct, while


is dangerous, because the user might have changed the representation of MyCounter when the macro is used.

share|improve this answer

You should use \theMyCounter if you want to output the value in Arabic numerals, Roman numerals, symbols or other format. You can restyle \theMyCounter by

\renewcommand\theMyCounter{\roman{MyCounter}} % lowercase Roman numerals

You should use \value{MyCounter} if it is used in an expression. For example

\ifnum\value{MyCounter}>5 ... \else ...\fi
\ifthenelse{\value{MyCounter}<4}{...}{...} % ifthen package

You can use \the\value{MyCounter} the same as \arabic{MyCounter}. But it is a mixed syntax. You'd better always use \arabic{MyCounter} in LaTeX; and if you want to pry, it is the same as \the\c@MyCounter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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