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

I would like to have problems be consecutively numbered throughout a book, irrespective of the chapters and sections where they appear.


Chapter 1
1. Some problem
Section 1
2. Some problem
Section 2
3. Some problem

What's the easiest way to do this?

share|improve this question
Assuming you will want to typeset solutions as well, you can combine @Werner's solution with code from the answers package: ctan.org/pkg/answers – cmhughes Sep 12 '11 at 4:26
Also of interest (without the "counter within" part), might be: Create odd-numbered answers, or all answers – Werner Sep 12 '11 at 4:47
up vote 5 down vote accepted

You could make your own environment that works on a counter. It allows you freedom to manage the formatting of the problem typesetting as well. Here's an example:

\usepackage{lipsum}% http://ctan.org/pkg/lipsum
  \refstepcounter{problem}% For correct referencing


\chapter{First chapter} \lipsum[1]
\section{first section} \lipsum[2]
Here is a very interesting problem that you can do. \label{problem1}
\section{Second section} \lipsum[4]
Wow, have you seen this problem? \label{problem2}
\section{Last section} \lipsum[5]
This is the final problem of the book. It is actually much harder than
Problems~\ref{problem1} and~\ref{problem2} combined.


The lipsum package provides dummy text used to fill the "book". In the above example, the problem is typeset as a paragraph in the form:

Problem 1. blah blah blah


Problem 2. blah blah blah


Since the counter is not tied to any other counter, it runs through the book without resetting. Referencing is also possible using labels in the traditional way.


share|improve this answer
Thanks, this is exactly what I was looking for. – Ornik Sep 14 '11 at 3:54

A lot depends on how you are defining the problem environment. If you are creating your own environment, then define the relevant counter to not depend on anything.

If your problem environment is being created by, e.g. on of the theorem packages (such as amsthm) you can usually specify the relations among the counters when you define the theorem type.

Finally, if you are using a package that defines its own problem environment that automatically determines the counter dependencies, you can use the chngcntr package to easily control the numbering relations among existing counters.

share|improve this answer

Use the enumitem package with which you can easily resume a list.


\chapter{Chapter One}
  \item Some Problem
\section{Section One}
Some Text
  \item Some Problem
\section{Section Two}
  \item Some Problem
share|improve this answer
This isn't an ideal way to do things, since you may need other enumerations in the document. It's better to have a specific problem environment. – Alan Munn Sep 12 '11 at 4:43
Duh!!! Thanks Alan. I have adapted the previous solution so that you can still use other enumerations which won't effect this list. – Peter Grill Sep 12 '11 at 5:08

There are at least three packages -- theorem, ntheorem, and amsthm -- that can create numbered environments with various styles for the fonts of the headers and the body of the environment, various amounts of vertical skip before and after the environment, etc. While these packages were originally created for writers who need environments for theorems, corollaries, and the like, their code is really applicable to a wide range of situations. The MWE below uses the ntheorem package. Happy TeXing!

\section{First section}
\begin{problem}[Apollo 13]\label{prob:houston}
Houston, we have a problem.
\section{Next section}
\begin{problem}[Cool Terminator] \label{prob:term}
No problemo.
\section{Still another section}
As might be noted from Problems \ref{prob:houston} 
and \ref{prob:term}, \ldots
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.