首先,MWE 及其输出如下。
\documentclass{article}
\usepackage{amsthm}
\makeatletter
\newtheoremstyle{myaxiom}%
{0.3\baselineskip plus 0.2ex minus 0.1ex}%
{0.3\baselineskip plus 0.2ex minus 0.1ex}%
{\itshape}%
{}%
{}%
{}%
{1em}%
{\bfseries\thmnote{#3}}%
\makeatother
\theoremstyle{myaxiom}
\newtheorem{axiom}{}
\begin{document}
\begin{axiom}[Axiom of Choice{ \normalfont (Zermelo, E., 1904)}]
Any collection of nonempty sets has a choice function.
\end{axiom}
\end{document}
如你所见,我定义了一个公理样式,其中只有\thmnote
定理头。如果我想得到如图所示的输出,我必须输入上述代码。它有一个缺点:我在输入注释时必须做更多设置。所以我的问题是:
有没有办法定义一个具有两个参数的新公理环境,其中一个参数用于公理名称,另一个用于其注释?
我尝试过下面的方法。
\theoremstyle{theorem}
\newtheorem*{axiomofchoice}{Axiom of Choice}
但是当我写一个新的公理时,我必须定义一个这样的新命令,所以请忽略这种方式。
答案1
我认为最自然的方式是在调用环境时设置标签。
\documentclass{article}
\usepackage{amsthm}
\newtheoremstyle{myaxiom}
{0.3\baselineskip plus 0.2ex minus 0.1ex}
{0.3\baselineskip plus 0.2ex minus 0.1ex}
{\itshape}
{}
{\bfseries}
{}
{1em}
{\thmname{#1}\normalfont\thmnote{ (#3)}}%
\theoremstyle{myaxiom}
\newtheorem*{myaxiom}{\myaxiomname}
\newcommand{\myaxiomname}{}
\newenvironment{axiom}[1]
{\renewcommand\myaxiomname{#1}\myaxiom}
{\endmyaxiom}
\begin{document}
\begin{axiom}{Axiom of Choice}[Zermelo, E., 1904]
Any collection of nonempty sets has a choice function.
\end{axiom}
\begin{axiom}{Axiom of Choice}
Any collection of nonempty sets has a choice function.
\end{axiom}
\end{document}
答案2
当然,有多种方法可以实现这一点。以下是允许有注释和没有注释的一种方法:
\documentclass{article}
\usepackage{amsthm}
\newtheoremstyle{myaxiom}%
{0.3\baselineskip plus 0.2ex minus 0.1ex}%
{0.3\baselineskip plus 0.2ex minus 0.1ex}%
{\itshape}%
{}%
{}%
{}%
{1em}%
{\bfseries\thmnote{#3}}%
\theoremstyle{myaxiom}
\newtheorem{axiom}{}
\NewDocumentEnvironment{namedaxiom}{mo}{
\IfNoValueTF{#2}{%
\begin{axiom}[#1]}{%
\begin{axiom}[#1{ \mdseries(#2)}]}
}{
\end{axiom}
}
\begin{document}
\begin{namedaxiom}{Axiom of Choice}[Zermelo, E., 1904]
Any collection of nonempty sets has a choice function.
\end{namedaxiom}
\begin{namedaxiom}{Continuum Hypothesis}
There is no cardinal number between $\aleph_0$ and $2^{\aleph_0}$.
\end{namedaxiom}
\end{document}