我尝试将 QED 语句 ( \qed
) 放置在我的自定义环境中,但方块错位了。这是一张图片:
相关代码如下:
\renewcommand{\qedsymbol}{$\blacksquare$}
\newenvironment{exercise}[1][]
{
\par\medskip
\noindent \textbf{Exercício~#1.} \rmfamily
}
{
\medskip
}
% Some other code in here . . .
\begin{exercise}[7]
\begin{exitem}[a]
($\Rightarrow$) Seja $\epsilon \in \mathbb{R}^+$. Então $x \le y
\Rightarrow x + \epsilon \le y + \epsilon$. Ainda, $0 < \epsilon
\Rightarrow 0 \le \epsilon \Rightarrow x = x + 0 \le x + \epsilon \le y +
\epsilon$.
Pela arbitrariedade de $\epsilon$, $x \le y + \epsilon$, para qualquer
$\epsilon > 0$. \qed
($\Leftarrow$) Suponhas que $x \le y + \epsilon$ para todo $\epsilon \in
\mathbb{R}^+$ e que $x \nleq y$. Como $\le$ é ordem total, temos que
$y < x$. Assim:
\begin{equation*}
\left \{
\begin{aligned}
0 & \le -x + y + \epsilon \\
0 & < x - yA
\end{aligned}
\right .
\Rightarrow
0 \le (x - y)(-x + y + \epsilon) = -(x - y)^2 + \epsilon (x - y)
\end{equation*}
Tomando-se $\epsilon = \frac{1}{2} (x - y)$ -- perceba que $y < x
\Rightarrow 0 < x - y$ -- segue que:
\begin{equation*}
0 \le - \frac{(x - y)^2}{2} \Rightarrow (x - y)^2 \le 0
\end{equation*}
No entanto, $0 \le x - y \Rightarrow 0 < (x - y)^2 \le 0$ \lightning.
Logo, $x \le y$. \qed
\end{exitem}
我能做些什么呢?我该如何解决这个问题?
答案1
正如@barbarabeeton的评论,这个问题应该通过后置{\parfillskip 0pt \par}
未对齐的 来解决\qed
。这可以做成一个宏:
\DeclareRobustCommand{\QED}
{
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{\qedsymbol}{\parfillskip 0pt \par}
}