3

I am trying to number my theorems, corollaries, Lemmas, Propositions, Definitions, Remarks etc. I put the following code:

\theoremstyle{theorem} 
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newtheorem{example}{Example}[definition]

\theoremstyle{remark}    
\newtheorem{remark}{Remark}[section]

I want to produce the following:

theorem 1.1

proposition 1.2

definition 1.3

example 1.4

remark 1.5

lemma 1.6

but the code above gives me

theorem 1.1

definition 1.1

remark 1.1

lemma 1.2

Can anyone tell me if there is a code that numbers all these respectively?

  • 1
    Welcome to TeX.SE. So, basically, you would like all theorem-like environments to share a common counter? Please advise. – Mico Aug 6 '15 at 12:57
  • Thank you! Yes that is exactly what I want, but the above code doesn't do that. – P.D. Aug 6 '15 at 13:00
  • P.D. if you find an answer helpful you should give it a +1. In addition, the answer that you feel best answers your question gets the green tick. – Andrew Aug 6 '15 at 14:02
3

When using either the ntheorem or the amsthm package to declare theorem-like environments, it's important to make use of the following rules of syntax when using \newtheorem:

  • If you want the counter of a theorem-like environment to be subordinate to, say, the section number, use a directive such as

    \newtheorem{theorem}{Theorem}[section]
    

    i.e., the option [section] (the name of the "parent counter") should come at the end.

  • If, on the other hand, you want the theorem-like environment (say, corollary) to share a counter with an already-existing environment (say, theorem), use the following syntax:

    \newtheorem{corollary}[theorem]{Corollary}
    

    i.e., i..e, the option [theorem] (the name of the "shared counter") should be placed between the environment name and the way the environment's name should be typeset.

The output of a full MWE:

enter image description here

\documentclass{article}  
\usepackage{ntheorem}

\theoremstyle{theorem} 
   \newtheorem{theorem}{Theorem}[section]
   \newtheorem{corollary}[theorem]{Corollary}
   \newtheorem{lemma}[theorem]{Lemma}
   \newtheorem{proposition}[theorem]{Proposition}
\theoremstyle{definition}
   \newtheorem{definition}[theorem]{Definition}
   \newtheorem{example}[theorem]{Example}
\theoremstyle{remark}    
  \newtheorem{remark}[theorem]{Remark}

\begin{document}
\setcounter{section}{1}

\begin{theorem} a \end{theorem}
\begin{proposition} b \end{proposition}
\begin{definition} c \end{definition}
\begin{example} d \end{example}
\begin{remark} e \end{remark}
\begin{lemma} f \end{lemma}

\end{document}
  • Thank you! Your answer was very helpful. The code now gives me exactly the desired numbering! – P.D. Aug 6 '15 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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