Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Whenever I try to number my theorems according to the section they are in, they all end up having the same number. I tried the other numbering schemes to see what they do, and the only one that gives different numbers is when I point back to the theorem before it.

Here is my code for all three numbering schemes:

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

\begin{document}

\section{numbered by section}
\theoremstyle{plain}\newtheorem{fst}{Theorem}[section]
\begin{fst}\end{fst}
\theoremstyle{plain}\newtheorem{snd}{Theorem}[section]
\begin{snd}\end{snd}

\section{counted}
\theoremstyle{plain}\newtheorem{athm}{Theorem}
\begin{athm}\end{athm}
\theoremstyle{plain}\newtheorem{bthm}{Theorem}
\begin{bthm}\end{bthm}

\section{numbered by name of first theorem}
\theoremstyle{plain}\newtheorem{thma}{Theorem}[section]
\begin{thma}\end{thma}
\theoremstyle{plain}\newtheorem{thmb}[thma]{Theorem}
\begin{thmb}\end{thmb}

\end{document}

This is what that gives me:

enter image description here

As you can see, in the first two sections, the theorems did not count properly. What should I be doing differently? While the last version works, I would really like to be able to use the other two. Everything I look up says this is how to do it, so I'm not sure what else to try.

share|improve this question
2  
\newtheorem declares a new type of theorem environment, not a new instance of that type. Something like \newtheorem{thm}{Theorem}[section] \newtheorem{lma}[thm]{Lemma} declares two types of theorem environments, not two theorems. –  TH. Mar 18 '11 at 18:45
    
@TH. Thank you so much! That is exactly what I misunderstood. –  bobbinhood Mar 18 '11 at 18:47
add comment

1 Answer 1

up vote 11 down vote accepted

So, you found the solution already. If you want different theorem environments to share a counter, use the third numbering scheme. However, why do you define a new theoremstyle for each of your theorems? It suffices to define one for each kind of "theorem-like" environment and use it throughout. For example,

\theoremstyle{plain}
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]

\begin{definition}
A definition.
\end{definition}

\begin{theorem}
The first theorem.
\end{theorem}

\begin{theorem}
The second theorem.
\end{theorem}

If you want to use the same counter for definitions and theorems, use \newtheorem{theorem}[definition]{Theorem} instead.

share|improve this answer
    
The things I read made me think that I had to give each theorem its own theoremstyle and it's own name. I did not realize that I was actually defining a new environment each time. Your example clears that up for me. I've tried a few examples, and I'm now getting the results I was looking for. Thank you for your help. –  bobbinhood Mar 18 '11 at 18:50
    
@bobbinhood -- where exactly did you read about how to number theorems? if you were confused by the (ftp.ams.org/pub/tex/doc/amscls/amsthdoc.pdf)[amsthm user's guide], something is seriously wrong and we need to correct it. (i'm the person responsible for maintaining that documentation, and i really don't like to hear that people find it confusing.) –  barbara beeton Mar 18 '11 at 19:35
    
@barbara beeton I never saw the document you just linked. I wish I had. It is much more straightforward than the things I looked at. I primarily used ctan.mackichan.com/info/lshort/english/lshort.pdf I also looked at en.wikibooks.org/wiki/LaTeX/Theorems I used one other pdf, but I can't find it now. –  bobbinhood Mar 18 '11 at 20:32
    
@bobbinhood -- well, now that you know about the amsthm user's guide, you can use it if you have another question. the manual lshort.pdf is good, but its coverage of math isn't what it's really aimed at. regarding the wikibooks page you cite, the amsthm user's guide is linked there, at the very bottom. well, we at ams can only be responsible for the documentation we distribute; we try to keep that in good order, so if anyone finds a problem, do let us know -- write to tech-support@ams.org –  barbara beeton Mar 18 '11 at 22:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.