tags:

views:

2238

answers:

4

I have a problem with theorem numbering in LaTeX. I can make it number by subsection, e.g

Theorem 1.2.1

for the first theorem in the second subsection of the first section. But I need it to show me only the numbers of the subsection and the theorem, but not the section number, like this:

Theorem 2.1

I use

\newtheorem{thm}{Theorem}[subsection]

for the numbering.

A: 

Does this work?

\newtheorem{thm}{Theorem}[section]

See these LaTeX tips.

jjclarkson
I've already tried that. That gives me the numbering like this `section_number.theorem_number`, but I need `subsection_number.theorem_number`
jbradaric
A: 

Insert this line in your preamble (or anywhere else before the \newtheorem statement):

\renewcommand{\thesubsection}{\arabic{subsection}}

This will reset the numbering command of the thm environment to ignore the section numbers (when numbering theorems) and display only the subsection numbers and theorem numbers. Section numbers will still be displayed in front of section headings, just not the theorems included within the sections. So, just as you describe, the first theorem in the second subsection of the first section will be numbered 2.1. Alternatives to \arabic include:

  • \Roman - produces capital roman numbers, such as II.1
  • \roman - produces lower-case roman numbers, such as ii.1
  • \Alph - produces capital letters, such as B.1
  • \alph - produces lower-case letters, such as b.1
Alex Basson
Won't this affect numbered subsection headings as well?
las3rjock
Yes, you're right, this will cause both the theorem numberings and the numberings of the subsection headings to ignore section numbers.
Alex Basson
I *think*, although I'm not sure, that you could make the renumbering specific to theorems if you included the \renewcommand line within the \newtheorem environment definition. But of course, this would require manually re-implementing the \newtheorem environment definition, which may not be worth it.
Alex Basson
+1  A: 

There's no easy way to do this. The AMS Theorem Package only provides a way to control when numbering resets (section, subsection), if it's tied to other environments (corollary, lemma) and number order ("1.1 Theorem" vs. "Theorem 1.1").

Theorem's get their numbering from the \thesection or \thesubsection command. You can redefine the \thesubsection command to get the numbering you want, but that will also affect everything else that uses \thesubsection.

Naaff
+4  A: 
las3rjock
Clever. Note that, while this does what was requested, it depends on the internals of amsthm, so it might be fragile. Also, wouldn't this be confusing to readers since you have "Theorem 1.1" for the first theorem in every subsection?
Naaff
@Naaff I'm right with you wondering why the question asker wants to number theorems this way. I personally would avoid the cross-reference ambiguity that you mention by sticking with the default of section.subsection.theorem, or by numbering theorems consecutively without resetting for the entire document.
las3rjock