我在 amsthm 中有以下内容:
\newtheoremstyle{thm}
{} % Space above
{} % Space below
{} % Theorem body font % (default is "\upshape")
{} % Indent amount
{\bfseries} % Theorem head font % (default is \mdseries)
{.} % Punctuation after theorem head % default: no punctuation
{ } % Space after theorem head
{} % Theorem head spec
\theoremstyle{thm}
\newtheorem*{thm}{Théorème}
\newtheorem{nthm}{Le théorème}
定理名称是法语的,这迫使我们创建两个不同的环境。一个用于编号定理,一个用于未编号定理。我是否可以只创建一个环境(thm 环境),以便当我插入 * 时,名称会自动替换为 Theoreme 而不是 La theoreme?定义其他环境后,上述代码会发生冲突,这就是我要求此替代方案的原因。谢谢。
答案1
不清楚问题是什么:看来你只是想要
\newtheorem*{thm*}{Théorème}
\newtheorem{thm}{Le théorème}
完整代码。
\documentclass{article}
\usepackage{amsthm}
\newtheoremstyle{thm}
{} % Space above
{} % Space below
{} % Theorem body font % (default is "\upshape")
{} % Indent amount
{\bfseries} % Theorem head font % (default is \mdseries)
{.} % Punctuation after theorem head % default: no punctuation
{ } % Space after theorem head
{} % Theorem head spec
\theoremstyle{thm}
\newtheorem*{thm*}{Théorème}
\newtheorem{thm}{Le théorème}
\begin{document}
\begin{thm}
This is numbered, with no attribution
\end{thm}
\begin{thm}[Euclid]
This is numbered, with attribution
\end{thm}
\begin{thm*}
This is unnumbered, with no attribution
\end{thm*}
\begin{thm*}[Archimedes]
This is unnumbered, with attribution
\end{thm*}
\end{document}
答案2
前言:我只是在执行我从问题中理解的内容。不过,我认为定理标题(例如“Le théorème 1”)在法语中听起来有点奇怪。无论如何,客户就是金钱。 :-)
您可以定义两个单独的环境,例如theo
和theo*
,分别调用nthm
或thm
。不过,不确定这样做能得到什么好处——也许除了清晰度。
\documentclass{article}
\usepackage{amsthm}
\newtheoremstyle{thm}
{} % Space above
{} % Space below
{} % Theorem body font % (default is "\upshape")
{} % Indent amount
{\bfseries} % Theorem head font % (default is \mdseries)
{.} % Punctuation after theorem head % default: no punctuation
{ } % Space after theorem head
{} % Theorem head spec
\theoremstyle{thm}
\newtheorem*{thm}{Théorème}
\newtheorem{nthm}{Le théorème}
\newenvironment{theo}[1][]{\nthm[#1]}{\endnthm}
\newenvironment{theo*}[1][]{\thm[#1]}{\endthm}
\begin{document}
\begin{theo}
This is a numbered theorem.
\end{theo}
\begin{theo*}
This is an unumbered theorem.
\end{theo*}
\begin{theo}
This is another numbered theorem.
\end{theo}
\end{document}
使用可选参数:
\begin{theo}
This is a numbered theorem.
\end{theo}
\begin{theo*}[Schreier]
This is an unumbered theorem.
\end{theo*}
\begin{theo}[Bolzano]
This is another numbered theorem.
\end{theo}