Math & ScienceNumbering Theorems

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
dward1996
Posts: 16
Joined: Thu Nov 25, 2010 2:32 pm

Numbering Theorems

Post by dward1996 »

I am currently working on a final year undergraduate project, and am in the process of writing up my report. I have defined a number of environments

Code: Select all

\documentclass{report}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{property}[theorem]{(}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\begin{document}

\end{document}
With the above code, the first theorem/proposition etc. in chapter 3 say, is numbered Theorem 3.1. However, in a couple of my chapters I would like to have the theorems numbered by section rather than chapter. I am sure that this can be done using the \renewcommand command, but cannot seem to work out exactly what I need to do. Any help would be greatly appreciated.
Last edited by dward1996 on Mon Mar 14, 2011 10:06 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: Numbering Theorems

Post by gmedina »

When you say "by section" do you mean including the section counter and removing the chapter counter, or simply the chapter counter followed by the section number and then by the corresponding theorem number?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
dward1996
Posts: 16
Joined: Thu Nov 25, 2010 2:32 pm

Numbering Theorems

Post by dward1996 »

gmedina wrote:When you say "by section" do you mean including the section counter and removing the chapter counter, or simply the chapter counter followed by the section number and then by the corresponding theorem number?
Sorry I hadn't realised how ambiguous I had been. Basically in some chapters, I want to number things as Theorem 3.1.2 say for the second theorem in section 1 of chapter 2.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Numbering Theorems

Post by gmedina »

All you need to do is to redefine the \thetheorem command (if you want this same behaviour to apply to your properties, definitions, etc. you'll have to redefine \theproperty, \thedefinition, etc.):

Code: Select all

\documentclass{report}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{property}[theorem]{(}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\begin{document}
\chapter{test chapter one}
\section{test section one one}
\begin{theorem}
a=b
\end{theorem}

% section with theorem counter changed (chapter.section.theorem)
\section{test section one two}
\renewcommand\thetheorem{\thesection.\arabic{theorem}}
\begin{theorem}
a=b
\end{theorem}

% section with theorem counter restored
\section{test section one three}
\renewcommand\thetheorem{\thechapter.\arabic{theorem}}
\begin{theorem}
a=b
\end{theorem}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
dward1996
Posts: 16
Joined: Thu Nov 25, 2010 2:32 pm

Re: Numbering Theorems

Post by dward1996 »

Thanks for that gmedina. It works a treat!
Post Reply