如何在右侧并排制作多个 QED 方块

如何在右侧并排制作多个 QED 方块

我有一个很长的证明,其中包含两个引理;在引理的末尾,我想在页面右侧并排放置三个 QED 符号。如果我使用\endproof\endproof,方块会垂直放置并占据页面的大部分空间,如果我使用 ,\qed\qed\qed我会得到方块这里如果我使用\qedhere\quedhere,则只有一个\qedhere渲染。

答案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}

在此处输入图片描述

相关内容