# Common numbering with ntheorem

I have the exact same question as detailed in Common, per-section numbering of theorems, lemmas etc., but I am using ntheorem and so can't use the accepted answers code. Does anyone know how to adapt this to the case of ntheorem? Thanks!

Here is a MWE

\documentclass{article}

\usepackage{amsmath,amssymb,amscd,thmtools,amscd}

\usepackage{eucal}

\usepackage[thmmarks]{ntheorem}

\newcounter{dummy} \numberwithin{dummy}{section}

\theoremprework{\setlength
\theorempreskipamount{10 pt}\setlength\theorempostskipamount{10 pt}}

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\clubsuit}}
\theoremseparator{:}
\newtheorem{example}{Example}[dummy][subsection]

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\blacklozenge}}
\theoremseparator{:}
\newtheorem{remark}{Remark}[dummy][subsection]

\theoremprework{\setlength\theorempreskipamount{10 pt}}

\theoremstyle{plain}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{theorem}{Theorem}[dummy][subsection]

\theoremstyle{plain}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{prop}{Proposition}[dummy][subsection]

\theoremstyle{plain}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{corollary}{Corollary}[dummy][subsection]

\theoremstyle{plain}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{lemma}{Lemma}[dummy][subsection]

\begin{document}

\begin{theorem} Hey
\end{theorem}

\begin{lemma}I
\end{lemma}

\begin{prop}Just
\end{prop}

\begin{remark}Met
\end{remark}

\begin{example}You
\end{example}

\end{document}


At the end I would like it to look something like

1 First Section

1.1 First Subsection

Theorem 1.1.1

Proposition 1.1.2

Lemma 1.1.3

1.2 Second Subsection

Theorem 1.2.1

Proposition 1.2.2

Lemma 1.2.3

From your code, it seems that you want each of the theorem-like environments to inherit the subsection counter. As such, I have used

\newcounter{dummy}
\numberwithin{dummy}{subsection}


in the below.

Note that you can use

\newtheorem{example}[dummy]{Example}


which tells the newtheorem command to make the example counter inherit the dummy counter, but not

\newtheorem{example}{Example}[dummy][subsection]


as this is undefined.

Here's the complete MWE:

\documentclass{article}

\usepackage{amsmath,amssymb}
\usepackage[thmmarks]{ntheorem}

\newcounter{dummy}
\numberwithin{dummy}{subsection}

\theoremprework{\setlength
\theorempreskipamount{10 pt}\setlength\theorempostskipamount{10 pt}}

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\clubsuit}}
\theoremseparator{:}
\newtheorem{example}[dummy]{Example}

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{\ensuremath{\blacklozenge}}
\theoremseparator{:}
\newtheorem{remark}[dummy]{Remark}

\theoremprework{\setlength\theorempreskipamount{10 pt}}

\theoremstyle{plain}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{theorem}[dummy]{Theorem}

\theoremstyle{plain}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{prop}[dummy]{Proposition}

\theoremstyle{plain}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{corollary}[dummy]{Corollary}

\theoremstyle{plain}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{lemma}[dummy]{Lemma}

\begin{document}

\section{Section}
\subsection{SubSection}
\begin{theorem} Hey
\end{theorem}

\begin{lemma}I
\end{lemma}

\begin{prop}Just
\end{prop}

\begin{remark}Met
\end{remark}

\begin{example}You
\end{example}

\subsection{SubSection}
\begin{theorem} Hey
\end{theorem}

\begin{lemma}I
\end{lemma}

\begin{prop}Just
\end{prop}

\begin{remark}Met
\end{remark}

\begin{example}You
\end{example}
\end{document}

• That works!...almost. It makes my theorems come out like theorem 1.1.0.1 instead of 1.1.1. – Alex Youcis Feb 25 '13 at 3:51
• @cmhughest That still isn't exact right. I've edited my original post with what I would like the outcome to look like. Thanks so much! – Alex Youcis Feb 25 '13 at 3:58
• @AlexYoucis see the update :) – cmhughes Feb 25 '13 at 4:05
• @AlexYoucis you're welcome :) Your question is now very clear- remember to make future questions as clear at the beginning :) – cmhughes Feb 25 '13 at 4:11

This does not require introduction of new counters at all. \newtheorem has two syntaxes

\newtheorem{myname}{Heading}[countwithin]


and

\newtheorem{myname}[usecounter]{Heading}


So if you set up your first theorem definition to be counted within subsection, and then tell the other environments to use the counter of your first environment you will get the desired numbering. Here is a cut down version of the code with irrelevant formatting etc. removed:

\documentclass{article}

\usepackage{amssymb}
\usepackage[thmmarks]{ntheorem}

\theoremstyle{plain}
\newtheorem{example}{Example}[subsection]
\newtheorem{remark}[example]{Remark}
\newtheorem{theorem}[example]{Theorem}
\newtheorem{prop}[example]{Proposition}
\newtheorem{corollary}[example]{Corollary}
\newtheorem{lemma}[example]{Lemma}

\begin{document}

\section{First section}
\subsection{First subsection}

\begin{theorem}
Theorem
\end{theorem}

\begin{prop}
Proposition
\end{prop}

\begin{lemma}
Lemma
\end{lemma}

\subsection{Second subsection}

\begin{theorem}
Theorem
\end{theorem}

\begin{prop}
Proposition
\end{prop}

\begin{lemma}
Lemma
\end{lemma}

\section{Second section}
\subsection{Next subsection}

\begin{theorem}
Theorem
\end{theorem}

\begin{prop}
Proposition
\end{prop}

\begin{lemma}
Lemma
\end{lemma}

\subsection{Last subsection}

\begin{theorem}
Theorem
\end{theorem}

\begin{prop}
Proposition
\end{prop}

\begin{lemma}
Lemma
\end{lemma}

\end{document}


I had a similar problem today and found a different solutions having some advantages as well as some disadvantages.

In the ntheorem.std file the most common environments like "theorem", "lemma", "definition" etc. are already defined in English and in German (see the ntheorem documentation).

You should find ntheorem.std in your package repository. For me it was: "C:\Program Files\MiKTeX 2.9\tex\latex\ntheorem"

There it says

\newtheorem{Theorem}{Theorem}
\newtheorem{theorem}{Theorem}
...


So just change those commands to

\newtheorem{Theorem}{Theorem}[subsection]
\newtheorem{theorem}[Theorem]{Theorem}
...


or whatever numbering you like.

Edit: I forgot that when you want to use those standard environments you have to tell Latex to include ntheorem with the standard option.

\usepackage[standard]{ntheorem}