Home > documentation, LaTeX > Numbering exercises/problems using chapter numbers

## Numbering exercises/problems using chapter numbers

To typeset a list of exercises or problems in $\LaTeX$, you could use the enumerate environment. By default, this would only produce numbers of the form n. where n is a positive integer. You could number an exercise using the chapter number to produce numbering of the form c.n. where c is the chapter number. Put the following macro definition in your preamble to get the chapter number to appear.

%% For listing problem sets. Each problem is numbered according to the
%% format
%%
%% chapterNumber.problemNumber.
\newcounter{problemcounter}
\newenvironment{problem}{%
\setcounter{problemcounter}{1}
\begin{list}
{\thechapter.\arabic{problemcounter}.}
{\usecounter{problemcounter}}
\let\olditem\item}{%
\end{list}
}

This could easily be customized to insert the section number instead of the chapter number.