如何仅在一章中更改定理编号样式?

如何仅在一章中更改定理编号样式?

我想更改论文中某一章的编号theormn和,但不更改其他章节。也就是说,一章中的编号(和)与另一章中的编号不同。lemmatheormnlemma

如何仅将更改应用于一个章节?

例如在第1、2、4、5章中:

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

在第 3 章中:

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

答案1

你可以定义两组定理,这没什么大不了的,然后定义一对切换宏。

\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}

在此处输入图片描述

不过,我不确定这是不是一个好主意。另外,我不喜欢用直排版来写定理陈述:用斜体字打印可以帮助读者获得视觉线索。

相关内容