答案1
为了简单起见,这里有一个宏\qeds[<number]
,它将 s 放在证明的末尾。默认值为 2。如果=1,<number>
\qedsymbol
则不起作用。<number>
我在宏中的符号之间留了一个小空格\,
,但您可以随意更改它。
\documentclass{article}
\usepackage{amsthm,pgffor}
\newcommand{\qeds}[1][2]{\qedhere\foreach\n in{2,...,#1}{\,\qedsymbol}}
\begin{document}
\begin{proof}
Here is a proof!
\end{proof}
\begin{proof}
Here is a proof!\qeds
\end{proof}
\begin{proof}
Here is a proof!\qeds[3]
\end{proof}
\end{document}
答案2
在文档中切勿使用\proof
和,而应使用 和。否则,您就是在自找麻烦。\endproof
\begin{proof}
\end{proof}
也许是像下面这样?
这里我确实使用了\proof
和\endproof
,但隐藏在的定义中proofnoqed
。
\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\NewCommandCopy{\QEDSYM}{\qedsymbol}
\newenvironment{proofnoqed}[1][\proofname]
{\proof[#1]\renewcommand{\qed}{}}
{\endproof}
\begin{document}
\begin{theorem}
Pigs can't fly.
\end{theorem}
\begin{proof}\renewcommand{\qedsymbol}{\QEDSYM\,\QEDSYM\,\QEDSYM}
We will divide the proof in two lemmas.
\begin{lemma}\label{pigs-4l}
Pigs are four-legged.
\end{lemma}
\begin{proofnoqed}[Proof of lemma~\ref{pigs-4l}]
This should be obvious as soon as you look at a pig.
\end{proofnoqed}
\begin{lemma}\label{4l-nofly}
No four-legged animal can fly.
\end{lemma}
\begin{proofnoqed}[Proof of lemma~\ref{4l-nofly}]
By contradiction. Suppose a four-legged animal can fly. This would
imply that the sky is pink, which it isn't.
\end{proofnoqed}
The two lemmas finish the proof.
\end{proof}
\end{document}
我们可以使这个过程自动化吗?可以。
\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newcounter{noqed}
\NewCommandCopy{\QEDSYM}{\qedsymbol}
\newenvironment{proofnoqed}[1][\proofname]
{\stepcounter{noqed}\proof[#1]\renewcommand{\qed}{}}
{\endproof}
\AtBeginEnvironment{proof}{\setcounter{noqed}{0}}
\ExplSyntaxOn
\renewcommand{\qedsymbol}
{
\prg_replicate:nn { \value{noqed} } { \QEDSYM\, } \QEDSYM
}
\ExplSyntaxOff
\begin{document}
\begin{theorem}
Pigs can't fly.
\end{theorem}
\begin{proof}
We will divide the proof in two lemmas.
\begin{lemma}\label{pigs-4l}
Pigs are four-legged.
\end{lemma}
\begin{proofnoqed}[Proof of lemma~\ref{pigs-4l}]
This should be obvious as soon as you look at a pig.
\end{proofnoqed}
\begin{lemma}\label{4l-nofly}
No four-legged animal can fly.
\end{lemma}
\begin{proofnoqed}[Proof of lemma~\ref{4l-nofly}]
By contradiction. Suppose a four-legged animal can fly. This would
imply that the sky is pink, which it isn't.
\end{proofnoqed}
The two lemmas finish the proof.
\end{proof}
\begin{theorem}
Some birds can fly.
\end{theorem}
\begin{proof}
Look in the sky.
\end{proof}
\end{document}