TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A counter created via \newcounter{<counter>} is stored internally as \c@<counter>, just like a reference made using \label{<label>} is stored internally using \r@<label>. What's the use of \cl@<counter> and \p@<counter>? The macros associated with their use include (from latex.ltx):

\def\@definecounter#1{\expandafter\newcount\csname c@#1\endcsname
     \global\expandafter\let\csname cl@#1\endcsname\@empty
     \global\expandafter\let\csname p@#1\endcsname\@empty
     \gdef\csname the#1\expandafter\endcsname\expandafter
          {\expandafter\@arabic\csname c@#1\endcsname}}
       {\csname p@#1\endcsname\csname the#1\endcsname}%
    \csname cl@#1\endcsname
\def\@addtoreset#1#2{\expandafter\@cons\csname cl@#2\endcsname {{#1}}}
share|improve this question
up vote 12 down vote accepted

The answer is given by the LaTeX source documentation:

\p@foo Macro that expands to a printed ‘reference prefix’ of counter foo. Any \ref to a value created by counter foo will produce the expansion of \p@foo\thefoo when the \label command is executed. See file ltxref.dtx for an extension of this mechanism.

\cl@foo List of counters to be reset when foo stepped. Has format \@elt{countera}\@elt{counterb}\@elt{counterc}.

For instance,




and this is defined as


So the counter subsection is automatically reset when \subsubsection is called, hence \cl@subsubsection contains \@elt{subsection}.

As the documentation says, the p@ feature can be used to "extend" the label of a counter. For instance, article.cls contains


with the effect that

\item foo 
  \item bar
    \item\label{itembaz} baz





will result in

p@ example

and not just "i".

share|improve this answer
@lockstep that was copied verbatim from article.cls ;-) – Stephan Lehmke Sep 29 '12 at 7:35
Nobody ever claimed that class was perfect. ;-) – lockstep Sep 29 '12 at 7:38
This mechanism is slightly broken by default in latex. See here: tex.ac.uk/cgi-bin/texfaq2html?label=labelformat Also, you must have had a bug in your grep commandline because I see that this feature is used in various babel language files (eg, hebrew.ldf) also in the ams classes (amsart et al) and many others. – Lev Bishop Sep 29 '12 at 7:40
@LevBishop Thank you for pointing that out! As I said, I just grepped for " p@" (note the space), so it is more than likely I overlooked something. The string "p@", though, is so frequent (think of "strip@", "skip@" or simply \p@) that it is futile to grep everywhere for it :-) My conclusion was that I can't give examples. If you can, please do! (Anyway, I'll try to find something based on your hints and incorporate that in my answer). – Stephan Lehmke Sep 29 '12 at 8:21
The \p@ mechanism is mainly used for nested lists, see article.cls \renewcommand\p@enumii{\theenumi} – David Carlisle Sep 29 '12 at 8:44

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.