(click anywhere to close)

[LaTeX] Counters

category: Writing | course: LaTeX | difficulty:

As you’ve seen in last chapter, LaTeX automatically keeps separate counters for every type of section. But, what’s really good about this, is that it also does the same for nearly everything – tables, figures, table of contents, and so on. Because this concept of counters keeps popping up all over LaTeX, I wanted to do a chapter on it here that explains how you can customize them, and add your own counters.

Setting & Getting Counters

To set an existing counter, use


To get the current value of a certain counter, as text, use


The value is: \thesection

If you don't want it as text, but as a number to use in calculations, use \value{counter}.

Changing Counters

To increment an existing counter by a certain amount, use


This value can be negative, if you want to decrement it.

To create a new counter, use


If you supply the optional argument counter, which must be an existing counter, this new counter is reset every time counter is changed.

Changing the Numbering System

It’s possible to display your counters using a different system than the regular Arabic numbers you’re used to.





Prints counter using lowercase alphabetic characters

a, b, c, …


Prints counter using uppercase alphabetic characters

A, B, C, …


Prints counter using regular numbers. Default.

1, 2, 3, …


Prints counter using lowercase roman numbers

i, ii, iii, …


Prints counter using uppercase roman numbers

I, II, III, …


\section*{\Roman{mysections} A Section Numbered Differently}
Lorem Ipsum...

Useful Counters to Remember

By default, the table of contents only registers sections to a maximum of three levels deep. To set this to something else, change the counter tocdepth.

By default, all sections are numbered to a depth of 2 – so, for example, sections and subsections are numbered, but subsubsections aren’t. To change this, use the counter secnumdepth.



All other counters are accessed by simply typing its name, as we've already seen with section.

Use \pagenumbering{numbering system} if you just want to change the numbering system of the current page.

Do you like my tutorials?
To keep this site running, donate some motivational food!
Chocolate Milk