Technical Support
Forums and Mailing Lists
Search Mackichan Web

SWP & SW
Version 5/5.5

Installation
Word Processing
Computations
Typesetting
File Issues
Graphics
Exam Builder
Style Editor
Other
Free Updates
Technical Articles

Scientific Notebook
Support Information
Troubleshooting

TeXnology
BibDB
TeXnology links

Document 247

Theorem number counter doesn't reset correctly between sections

Version: 3.x, 4.x, 5.x - Scientific WorkPlace & Scientific Word

Problem

A TeX command has been added to a document to make the theorem numbers in the document reflect not only the chapter but also the section in which the theorem occurs, as in Theorem 3.5.1 (the first theorem in section 5 of chapter 3). However, the theorem number counter doesn't reset to 1 from section to section.

Explanation

When you insert the following TeX command in the preamble of your document

\renewcommand{\thetheorem}{\thesection.\arabic{theorem}}

you expect to have theorem numbers that reflect both the chapter and the section number in which they occur and that reset to 1 at the beginning of each new section. For example, suppose the first and second theorems occur in Chapter 3, Section 2, and the third occurs in Chapter 3, Section 5. You expect the theorem numbers to occur in this sequence:

Theorem 3.2.1, Theorem 3.2.2, Theorem 3.5.....

However, the theorem numbers that actually occur are the following:

Theorem 3.2.1, Theorem 3.2.2, Theorem 3.5.3....

Preferred solutions

Use a form of the \newtheorem statement that will automatically count the theorem objects based on a division (chapter or section) object, usually section counter for article documents or the chapter counter for book and report documents.

Theorems numbered with section + theorem number

In an article, to number theorem objects with section + theorem number, replace the \newtheorem statements in the document preamble with statements like this:

\newtheorem{theorem}{Theorem}[section]

\newtheorem{acknowledgement}{Acknowledgement}[section]

\newtheorem{algorithm}{Algorithm}[section]

\newtheorem{axiom}{Axiom}[section]

\newtheorem{case}{Case}[section]

\newtheorem{claim}{Claim}[section]

\newtheorem{conclusion}{Conclusion}[section]

:

\newtheorem{solution}{Solution}[section]

\newtheorem{summary}{Summary}[section]

The replacement yields numbering such as

Theorem 2.1, Theorem 2.2, Corollary 2.1, Theorem 3.1, Theorem 3.2....

where the first digit is the section number and the second digit is the number of the object inside the section. The theorem number is reset to 1 at the beginning of each section.

Theorems numbered with chapter + section + theorem number

In a book or report, to number theorem objects with chapter + section + theorem number, replace the \newtheorem statements in the preamble with the above group of \newtheorem statements.

The replacement yields numbering such as

Theorem 1.2.1

where the first 1 is the chapter number, the 2 is the section number, and the second 1 is the theorem number within the section. The theorem number is reset to 1 at the beginning of each section.

Theorems numbered with chapter + theorem number

In a book or report, to number theorem objects with chapter + theorem number, replace the \newtheorem statements in the document preamble with statements like this:

\newtheorem{theorem}{Theorem}[chapter]

\newtheorem{acknowledgement}{Acknowledgement}[chapter]

\newtheorem{algorithm}{Algorithm}[chapter]

\newtheorem{axiom}{Axiom}[chapter]

\newtheorem{case}{Case}[chapter]

\newtheorem{claim}{Claim}[chapter]

\newtheorem{conclusion}{Conclusion}[chapter]

:

\newtheorem{solution}{Solution}[chapter]

\newtheorem{summary}{Summary}[chapter]

The replacement yields numbering such as

Theorem 2.1

where the 2 is the chapter number and the 1 is the theorem number within the chapter. The theorem number is reset to 1 at the beginning of each chapter.

Alternate solution

Insert TeX commands in the preamble of your document, in place of the \renewcommand statement shown in the Explanation above, according to these instructions:

  1. From the Typeset menu, choose Preamble.

  2. In the input box, enter \makeatletter and press Return.

  3. Enter \renewcommand{\thetheorem}{\thesection.\arabic{theorem}} and press Return.

  4. Enter \@addtoreset{theoremname}{section} where theoremname is the counter for the theorem-like environment you want to reset and section is the name of the document part where you want the reset to occur.

  5. Press Return.

  6. Repeat steps 3 - 5 for each theorem-like environment for which you want to reset the counter.

  7. Enter \makeatother .

  8. Choose OK.

  9. Save your document.

For example, if you want to reset the numbering of theorems each time you change sections and you want to reset the numbering of notes each time you change chapters, the preamble would contain these lines:

\makeatletter

\renewcommand{\thetheorem}{\thesection.\arabic{theorem}}

\@addtoreset{theorem}{section}

\renewcommand{\thenote}{\thesection.\arabic{theorem}}

\@addtoreset{note}{chapter}

\makeatother

See also

Last revised 07/12/06

This document was created with Scientific WorkPlace.



MacKichan Software, Inc. 19689 7th Avenue NE, Suite 183 #238 Poulsbo, WA 98370
Phone: 360-394-6033 Toll-free: 877-724-9673 Fax: 360-394-6039

Please email comments and suggestions regarding this site to webmaster@mackichan.com.
© Copyright 1998 - MacKichan Software, Inc. All rights reserved.