答案1
两种方式:滥用\tag
和使用flalign
。(顺便说一下,\cdot
等号后面的 看起来放错了位置。)
% twocolumn for smaller snapshot
\documentclass[twocolumn]{article}
\usepackage{amsmath}
\begin{document}
Abusing \verb+\tag+
\begin{align}
(a+b)^2 & = 4 \cdot \frac{1}{2} ab + c^2 \nonumber \\
a^2 + 2ab + b^2 & = \cdot 2ab + c^2 \tag*{$\mid - 2ab$} \\
a^2 + b^2 & = c^2 \nonumber
\end{align}
or with \verb+flalign*+
\begin{flalign*}
&& (a+b)^2 & = 4 \cdot \frac{1}{2} ab + c^2 \\
\phantom{ \mid- 2ab}&& a^2 + 2ab + b^2 & = \cdot 2ab + c^2 & \mid - 2ab \\
&& a^2 + b^2 & = c^2
\end{flalign*}
This is what happens with the second one if you don't use \verb+\phantom+
\begin{flalign*}
&& (a+b)^2 & = 4 \cdot \frac{1}{2} ab + c^2 \\
&& a^2 + 2ab + b^2 & = \cdot 2ab + c^2 & \mid - 2ab \\
&& a^2 + b^2 & = c^2
\end{flalign*}
\end{document}
请注意,我使用了:\mid
而不是\vert
: 注意不同的间距