Many LaTeX classes (including the standard book class) number things per chapter; so figures in chapter 1 are numbered 1.1, 1.2, and so on. Sometimes this is not appropriate for the user’s needs.
Short of rewriting the whole class, one may use the chngcntr
package, which provides commands \counterwithin
(which
establishes this nested numbering relationship) and
\counterwithout
(which undoes it).
So if you have figures numbered by chapter as 1.1, 1.2, 2.1, …, the command
will convert them to figures 1, 2, 3, …. (Note that the command has also removed the chapter number from the counter’s definition.)\counterwithout{figure}{chapter}
More elaborate use could change things numbered per section to things numbered per chapter:
(assuming there was a class that did such a thing in the first place...)\counterwithout{equation}{section} \counterwithin{equation}{chapter}
The chngcntr approach doesn’t involve much programming, and
the enthusiastic LaTeX programmer might choose to try the technique
that we had to use before the advent of chngcntr. Each of
the packages removefr and remreset defines a
\@removefromreset
command, and having included the package one
writes something like:
and the automatic renumbering stops. You may then need to redefine the way in which the figure number (in this case) is printed:\makeatletter \@removefromreset{figure}{chapter} \makeatother
(remember to do the whole job, for every counter you want to manipulate, within\makeatletter \renewcommand{\thefigure}{\@arabic\c@figure} \makeatother
\makeatletter
… \makeatother
).
This technique, too, may be used to change where in a multilevel structure a counter is reset. Suppose your class numbers figures as ‹chapter›.‹section›.‹figure›, and you want figures numbered per chapter, try:
(the command\makeatletter \@removefromreset{figure}{section} \@addtoreset{figure}{chapter} \renewcommand{\thefigure}{\thechapter.\@arabic\c@figure} \makeatother
\@addtoreset
is a part of LaTeX itself).
\input
{removefr}
)
This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=running-nos