[Tex/LaTex] How to change theorem numbering style in one chapter only

numberingtheorems

I want to change numbering theormn and lemma in one chapter in thesis without change other chapters. Namely numbering (theormn and lemma) in one chapter is different from another chapter.

How to apply a change to one chapter only?

For example, in chapter 1,2,4,5:

\theoremstyle{definition}‎
‎‎\theoremstyle{theorem}‎
‎\newtheorem{theorem}{theormn}[chapter]‎
‎\newtheorem{lem}{lemma}‎
‎\newtheorem{cor}{corollary}‎

while in chapter 3:

\newtheorem{theorem}{theormn}‎
‎\newtheorem{lemma}[theorem]{lemma}‎
‎‎\newtheorem{colo}[theorem]{corollary}‎

Best Answer

You can define two sets of theorems, which is not a big deal, then define a pair of switching macros.

\documentclass{book}
\usepackage{amsthm}

% normal theorems
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lem}{Lemma}
\newtheorem{cor}{Corollary}

% special theorems
\newtheorem{Xtheorem}{Theorem}
\newtheorem{Xlem}[Xtheorem]{Lemma}
\newtheorem{Xcor}[Xtheorem]{Corollary}

\makeatletter
% add the theorem names you want to the following list
\newcommand{\tahora@theoremlist}{theorem,lem,cor}

% syntactic sugar; etoolbox already provides \csletcs, so \providecommand is used
\providecommand{\csletcs}[2]{%
  \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname
}

% save the old meanings
\@for\next:=\tahora@theoremlist\do{%
  \global\csletcs{SAVED\next}{\next}%
  \global\csletcs{endSAVED\next}{end\next}%
}

% define the switching macros
\newcommand{\dospecialtheorems}{%
  \@for\next:=\tahora@theoremlist\do{%
    % change the meanings
    \global\csletcs{\next}{X\next}%
    \global\csletcs{end\next}{endX\next}%
  }%
}
\newcommand{\undospecialtheorems}{%
  \@for\next:=\tahora@theoremlist\do{%
    % restore the meanings
    \global\csletcs{\next}{SAVED\next}%
    \global\csletcs{end\next}{endSAVED\next}%
  }%
}
\makeatother

\begin{document}
\mainmatter
\chapter{One}

\begin{lem}
A lemma
\end{lem}

\begin{theorem}
A theorem
\end{theorem}

\begin{theorem}
Another theorem
\end{theorem}

\begin{cor}
A corollary
\end{cor}

\chapter{Two}
% Switch to the special numbering
\dospecialtheorems

\begin{lem}
A lemma
\end{lem}

\begin{theorem}
A theorem
\end{theorem}

\begin{theorem}
Another theorem
\end{theorem}

\begin{cor}
A corollary
\end{cor}

% Switch back to the usual numbering
\undospecialtheorems

\chapter{Three}

\begin{lem}
A lemma
\end{lem}

\begin{theorem}
A theorem
\end{theorem}

\begin{theorem}
Another theorem
\end{theorem}

\begin{cor}
A corollary
\end{cor}

\end{document}

enter image description here

I'm not sure this is a good idea, though. Also I dislike having theorem statements in upright type: printing them in italics help readers giving them visual clues.

Related Question