\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation*}
(a+b)(a+b)=a^{2}+2ab+b^{2}.
\end{equation*}
This may of course be written
\begin{flalign*}
&&(a+b)^{2}&=a^{2}+2ab+b^{2}&\\
\makebox[0pt]{Similarly}&&
(a-b)^{2}&= a^{2}-2ab+b^{2}&\\
\text{In the case}&&
(a+b)(a-b)&= a^{2}-b^{2}
\end{flalign*}
\end{document}
答案1
使用\phantom
较长文本的版本(\text{In the case}
)以便正确对齐Similarly
:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation*}
(a+b)(a+b)=a^{2}+2ab+b^{2}.
\end{equation*}
This may of course be written
\begin{flalign*}
&&(a+b)^{2}&=a^{2}+2ab+b^{2} & \\
\rlap{Similarly}\phantom{\text{In the case}}&&
(a-b)^{2}&= a^{2}-2ab+b^{2} & \\
\text{In the case}&&
(a+b)(a-b)&= a^{2}-b^{2} &
\end{flalign*}
\end{document}
答案2
您已在使用一个\makebox
,因此请使用另一个:
\documentclass{article}
\usepackage{mathtools,showframe}
\begin{document}
\begin{equation*}
(a+b)(a+b)=a^{2}+2ab+b^{2}.
\end{equation*}
This may of course be written
\begin{flalign*}
&&(a+b)^{2}&=a^{2}+2ab+b^{2}&\\
\makebox[0pt][l]{Similarly}&&
(a-b)^{2}&= a^{2}-2ab+b^{2}&\\
\makebox[0pt][l]{In the case}&&
(a+b)(a-b)&= a^{2}-b^{2}
\end{flalign*}
\end{document}