[Tex/LaTex] Change numbering level for one chapter only

amsmathchaptersnumberingsectioningsections-paragraphs

Apologies if this is duplicate but couldn't find it.

I have a document using amsmath for chapter, section & subsection numbering, & everything (theorems, lemmas etc) uses the same numbering system.

I have one chapter that has no sections or subsections (this does make sense, honest, its a 5-6 page theorem that doesn't fit with anything else). The problem is the numbering here starts at 4.0.13 (because I haven't reset the subsection counter, presumably).

I have two options – either set it to 4.1.1 or even better, have only two part numbering in this chapter so that the theorems/lemmas can be numbered 4.1, 4.2 etc etc. I have read quite a few posts about \numberwithin & \counterwithin but am pretty confused.

Example below – here the thm in chapter 2 is number 2.0.3 but I want it to be 2.1.1 or preferably just 2.1.

\documentclass{scrreprt}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}

\theoremstyle{plain}% default
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{prop}[thm]{Proposition}
\theoremstyle{definition}
\newtheorem{defn}[thm]{Definition}
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]
\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\newtheorem{case}{Case}
\makeatletter\@addtoreset{case}{thm}\makeatother
\makeatletter
\def\thm@space@setup{%
 \thm@preskip=\parskip \thm@postskip=0pt}
\makeatother

\makeatletter\@addtoreset{case}{lem}\makeatother
\makeatletter
\def\thm@space@setup{%
\thm@preskip=\parskip \thm@postskip=0pt}
\makeatother

\begin{document}

\begin{chapter}{chap title}
\begin{section}{title blah}
\begin{thm}
hello
\end{thm}
\begin{subsection}{title blahh}
\begin{lem} 
hi
\end{lem}
\end{subsection}
\end{section}
\end{chapter}

\begin{chapter}{chap title 2}
\begin{thm}
hello again
\end{thm}
\end{chapter}

\end{document}

Best Answer

There are no chapter, section or subsection environments. Don't use \begin{chapter} and similar constructions, even if they appear to work.

You can make the decision about the numbering automatic: if the section counter is zero, as it is after \chapter, the theorems will be numbered “chapter.theorem”, otherwise “chapter.section.theorem”. No manual resetting is needed for chapters where theorems are inside sections.

I removed the setting to \thm@space@setup because I don't really understand what they're supposed to do.

\documentclass{scrreprt}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}

\theoremstyle{plain}% default
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{prop}[thm]{Proposition}

\theoremstyle{definition}
\newtheorem{defn}[thm]{Definition}
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]

\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\newtheorem{case}{Case}[thm]

\makeatletter
\@addtoreset{thm}{chapter}
\makeatother
\renewcommand{\thethm}{%
  \ifnum\value{section}=0
    \thechapter.%
  \else
    \thesection.%
  \fi
  \arabic{thm}%
}
\renewcommand{\thecase}{\arabic{case}}

\begin{document}

\chapter{chap title}
\section{title blah}
\begin{thm}
hello
\end{thm}

\subsection{title blahh}
\begin{lem} 
hi
\end{lem}

\chapter{chap title 2}
\begin{thm}
hello again
\end{thm}

\end{document}

Note how it's easier to reset the case number with every theorem.

enter image description here

enter image description here