My sections are numbered with a dot after counter. I get it like this
\renewcommand{\thesection}{\arabic{section}.}
I also need the equations to be numbered within sections and I try to do it like this
\numberwithin{equation}{section}
The result is that I get numbers of equations with an extra dot, e.g. (1..1)
instead of (1.1)
.
How can I fix this?
Best Answer
If you add a closing dot the the definition of
\thesection
, you should also remove the "middle" dot from definitions using\thesection
, especially\theequation
and\thesubsection
. (Note that your redefinition of\thesection
will also produce a closing dot in the table of contents, the header/footer, and cross references.)EDIT: In response to Frank Mittelbach, here's an alternative that changes the
\@seccntformat
macro so that it adds a dot if the new\@seccntdot
conditional is true. Theetoolbox
package is used to set this conditional to true before\section
and to false after every equal/lower-level sectioning command.Output for both examples: