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.

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}
\theoremheaderfont{\upshape \bfseries}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{corollary}{Corollary}[dummy][subsection]

\theoremstyle{plain}
\theoremheaderfont{\upshape \bfseries}
\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

share|improve this question
    
@cmhughes Added an MWE! Thanks! –  Alex Youcis Feb 25 '13 at 3:34

2 Answers 2

up vote 4 down vote accepted

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.

screenshot

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}
\theoremheaderfont{\upshape \bfseries}
\theorembodyfont{\slshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{corollary}[dummy]{Corollary}

\theoremstyle{plain}
\theoremheaderfont{\upshape \bfseries}
\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}
share|improve this answer
    
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
    
You are awesome my friend, awesome. Thanks! –  Alex Youcis Feb 25 '13 at 4:08
    
@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:

Sample output

\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}
share|improve this answer

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.