我使用amsbook
文档类,并且想在没有证明的语句末尾显示符号\qed
(使用定理环境,例如theorem
,,,...)来表明这些是已知的,但我没有提供证明。proposition
lemma
是否有一种简单的(甚至是预定义的方法)来做到这一点,例如使用
\begin{mytheorem}{\qed}
...
\end{mytheorem}
对于任何定理环境,mytheorem
无需执行
\newtheorem{mytheorem}[theorem]{Theorem}
\newtheorem{mytheoremqed}[theorem]{Theorem}
\AtEndEnvironment{mytheoremqed}{\null\hfill\qedsymbol}
... % repeat for proposition, lemma, corollary, ...
对于我拥有的每一个定理环境(这个解决方案在\qed 表示无证明的定理)?
最好同时提供两个版本
\begin{mytheorem}[{\cite{myref}}]
和
\begin{mytheorem}{\qed}[{\cite{myref}}]
应该管用。
答案1
\null\hfill\qedsymbol
首先让我举一个做错事的例子。请注意,\null\hfill\qedsymbol
显式添加与使用 相同\AtEndEnvironment
,唯一的区别是间接方法不考虑 之前可能存在的空格\null
,这会使情况变得更糟。
\documentclass{amsbook}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.\null\hfill\qedsymbol
\end{theorem}
\end{document}
对此,您有几种更好的选择。我认为,更简单的方法是将其附加到\qed
您未提供证明的语句的末尾。
\documentclass{amsbook}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.\qed
\end{theorem}
\end{document}
文本与之前相同,但墓碑位于所需的位置。
另一种方法是定义一个不同的环境,比如 -variant *
:
\documentclass{amsbook}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newenvironment{theorem*}
{\pushQED{\qed}\theorem}
{\popQED\endtheorem}
\begin{document}
\begin{theorem*}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem*}
\end{document}
这样做的缺点是需要在和部分*
都使用,但也有一些优点:如果您决定抑制这些墓碑,则无需更改输入;对于这些情况,您可以轻松地更改墓碑。\begin
\end
第三种可能性是定义theorem
为具有强制参数的环境,例如
\begin{theorem}{}
...<statement>...
\end{theorem}
当你不想要墓碑的时候
\begin{theorem}{\qed}
...<statement>...
\end{theorem}
它可以布置成支持
\begin{theorem}
...<statement>...
\end{theorem}
\begin{theorem}\qed
...<statement>...
\end{theorem}
使用以下技巧:
\documentclass{amsbook}
\usepackage{amsthm}
\newif\ifstumpqed
\newtheorem{theoremInner}{Theorem}
\newenvironment{theorem}[1]
{\ifx#1\qed\stumpqedtrue\pushQED{\qed}\fi\theoremInner}
{\ifstumpqed\popQED\fi\endtheoremInner}
\begin{document}
\begin{theorem}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed\label{whatever}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed[Whatever]\label{foo}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\end{document}
如果您有多个这样的声明需要管理,那么您可以抽象该过程:
\documentclass{amsbook}
\usepackage{amsthm}
\newcommand{\addqed}[1]{%
\expandafter\let\csname #1Inner\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname end#1Inner\expandafter\endcsname\csname end#1\endcsname
\expandafter\def\csname #1\endcsname##1{%
\ifx##1\qed\stumpqedtrue\pushQED{\qed}\fi\csname #1Inner\endcsname
}%
\expandafter\def\csname end#1\endcsname{%
\ifstumpqed\popQED\fi\csname end#1Inner\endcsname
}%
}
\newif\ifstumpqed
\newtheorem{theorem}{Theorem}[chapter]
\addqed{theorem}
\begin{document}
\begin{theorem}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed\label{whatever}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\begin{theorem}\qed[Whatever]\label{foo}
Some long theorem statement,
long long long long long
long long long long long
long long long long long
long long long long
enough to show bad effect.
\end{theorem}
\end{document}
因此,在\newtheorem
使用通常方法声明之后,添加
\addqed{<env name>}
您就完成了。