How do you number equations, definitions, theorems etc within chapters?

Like every def, theorem, equation in chapter 2 for example would start with 2.1, 2.2 etc...

Printable View

- March 7th 2010, 09:29 AMDeadstarNumbering within chapters
How do you number equations, definitions, theorems etc within chapters?

Like every def, theorem, equation in chapter 2 for example would start with 2.1, 2.2 etc... - March 7th 2010, 09:51 AMFocus
- March 7th 2010, 11:06 AMDeadstar
Hmm that didn't work...

I already have this in my report which defines styles of all theorems, lemmas, definitions, etc...

\newtheorem{lemma}{Lemma}

\newtheorem{theorem}[lemma]{Theorem}

\newtheorem{corollary}[lemma]{Corollary}

\theoremstyle{definition}

\newtheorem{definition}[lemma]{Definition}

\newtheorem{example}[lemma]{Example}

Remember EVERY definition, theorem, corollary and lemma is numbered. I would like it so they are numbered according to what chapter they are in. - March 7th 2010, 03:32 PMFocus
- March 7th 2010, 04:35 PMDeadstar
Perfect thanks a lot.

I've just given myself another problem in that some of my sections are numbered the same as my theorems... Like I have a section numbered 2.1 and an equation numbered 2.1 lol...

Also doing it the first way [section] works fine for the first two chapters but after that it goes in a mess and ends up with 9.0.50 as my last definition instead of 9.0.6... This is why I don't really like Latex that much, so hard to style it!

Might just not number the sections... - March 7th 2010, 04:39 PMFocus
- March 7th 2010, 05:16 PMDeadstar
Not really sure what I'll do to be honest! I really like the chapter numbering way you showed me above (not so keen on the 1.2.3 style numbering). But It means that it looks odd when you number sections as they will have the same numbering as some formulas...

I think I need to go get a book or two and take note of how they number their parts. Then maybe come back for more advice...

Just for future reference, say I wanted to number all my corollarys (for example) by section what would I do?

Would it be

\newtheorem{corollary}[lemma]{Corollary}[section]

or ustj

\newtheorem{corollary}{Corollary}[section] - March 7th 2010, 05:35 PMFocus
If you want equations numbered you use this format;

\numberwithin{equation}{section}

\renewcommand{\theequation}{\thesection.\arabic{eq uation}}

For theorems the format is;

\newtheorem{name}[counter]{printed name}[section]

If you leave out the [counter] (where "counter" is the name of the counter) then it will make a new one, so for example

\newtheorem{corollary}{Corollary}[section]

\newtheorem{def}[lemma]{Definition}

will give you, Corollary 2.1.1, Definition 2.1.2,... whereas

\newtheorem{corollary}{Corollary}[section]

\newtheorem{def}{Definition}[section]

will give Corollary 2.1.1, Definition 2.1.1, Corollary 2.1.2, Corollary 2.1.3, Definition 2.1.2,...

You can also manually set counters with \setcounter{counter}{value} if you want to solve the numbering problem manually.