如果我按节对定理进行编号,那么 amsthm 将第一节中的第一个定理编号为
Theorem 1.1.
我怎样才能将其更改为
Theorem 1-1
?
答案1
如果你已经建立了一个类似定理的环境,比如说,theorem
通过
\newtheorem{theorem}{Theorem}[section]
然后你需要添加的是指令
\renewcommand\thetheorem{\thesection-\arabic{theorem}}
根据@barbarabeeton的评论,如果你想改变编号样式全部定理类环境,实际上执行起来要容易得多
\makeatletter
\renewcommand{\@thmcountersep}{-}
\makeatother
在序言中。
此外,如果您还想抑制.
复合定理编号后的(“点”,又名“句号”),我建议您在序言中执行以下代码:
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother
完整的 MWE (最小工作示例):
\documentclass{amsart} % or some other suitable docuemnt class
%% \usepackage{amsthm} % not needed if 'amsart' doc. class is in use
\usepackage{etoolbox}
\makeatletter
\renewcommand{\@thmcountersep}{-} % per @barbarabeeton's suggestion
\patchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{} % optional
\makeatother
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\begin{document}
\setcounter{section}{3}
\begin{theorem} Bla bla bla. \end{theorem}
\begin{definition} Ble ble ble. \end{definition}
\end{document}