Counters in lists etc.

When using enumerated lists, you can change the value of the counter to something else, for example, if you have a list that’s broken up by text, or some such. To do this, use the addcounter command:

\begin{enumerate}\addtocounter{enumi}{9}
  \item blah blah
  \item wibble wibble
\end{enumerate}

Assuming the counter started at 1, adding 9 to it means the next enumerated list will start at 10.

The style of the counter can be changed as well, for example, to use Roman numerals, Arabic numbers and so on. This can be done in enumerate environments by changing the enumi, enumii etc. counters:

\renewcommand{\labelenumi}{II--\alph{enumi}}
\begin{enumerate}
  \item first item in list
  \item second item in list
  \item third item in list
  \item fourth item in list
\end{enumerate}

This will produce a counter II–a, II–b etc.

You may need to remember to put the counter back as it was if this is only a temporary change.

\renewcommand{\labelenumi}{\arabic{enumi}}

The same effect can be achieved in the list environment without changing the built-in counters by setting up a new counter as follows:

\newcounter{newC}
\begin{list}{II--\alph{newC}}{\usecounter{newC}} \item first item in list \item second item in list \item third item in list \item fourth item in list end{list}

Note the curly brackets around the \usecounter command. Using settings like the margin width for indentation purposes can be set inside those curly brackets. Also note that references to labelled items will not work as expected here.

Put this all in one file, and you get the following:

\documentclass[a4paper,12pt]{article}

\begin{document}

\begin{enumerate}\addtocounter{enumi}{9}
  \item blah blah
  \item wibble wibble
\end{enumerate}

\renewcommand{\labelenumi}{II--\alph{enumi}}
\begin{enumerate}
  \item first item in list
  \item second item in list
  \item third item in list
  \item fourth item in list
\end{enumerate}
\renewcommand{\labelenumi}{\arabic{enumi}}

\newcounter{newC}
\begin{list}{II--\alph{newC}}{\usecounter{newC}}
  \item first item in list
  \item second item in list
  \item third item in list
  \item fourth item in list
\end{list}

\end{document}

See also Help on LaTeX Counters for more information.

Add a comment?

This site uses Akismet to reduce spam. Learn how your comment data is processed.