我怎样才能通过保持等号对齐来对齐这些等式?
\begin{align*}
& (x^2-5x+4)^2-8(x^2-5x+4)-20 &= 0 &\\
& u^2-8u-20 &= 0 \\
& (u-10)(u+2) &= 0 \\
u &= 10 \quad &\text{or} \quad u &=-2\\
x^2-5x+4 &=10 & x^2-5x+4 &= -2\\
x^2-5x-6 &= 0 & x^2-5x+6 &= 0\\
\end{align*}
这似乎也像对齐方程式的顶部一样。
答案1
这些等号彼此之间只是松散地关联。不要将它们对齐。
好吧,“糟糕”毕竟也不是那么糟糕,但是标题就应该是这样的,不是吗?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section{Ugly}
\begin{align*}
&\begin{aligned}
(x^2-5x+4)^2-8(x^2-5x+4)-20 &= 0 \\
u^2-8u-20 &= 0 \\
(u-10)(u+2) &= 0
\end{aligned}
\\
&\begin{aligned}[t]
u&=10 \\
x^2-5x+4 &= 10 \\
x^2-5x-6 &= 0
\end{aligned}
\qquad\text{or}\qquad
\begin{aligned}[t]
u &=-2\\
x^2-5x+4 &= -2\\
x^2-5x+6 &= 0
\end{aligned}
\end{align*}
\section{Bad}
\begin{align*}
&\begin{aligned}
&(x^2-5x+4)^2-8(x^2-5x+4)-20 = 0 \\
&u^2-8u-20 = 0 \\
&(u-10)(u+2) = 0
\end{aligned}
\\
&\begin{aligned}[t]
&u=10 \\
&x^2-5x+4 = 10 \\
&x^2-5x-6 = 0
\end{aligned}
\qquad\text{or}\qquad
\begin{aligned}[t]
&u =-2\\
&x^2-5x+4 = -2\\
&x^2-5x+6 = 0
\end{aligned}
\end{align*}
\section{Good}
\begin{gather*}
(x^2-5x+4)^2-8(x^2-5x+4)-20 = 0 \\
u^2-8u-20 = 0 \\
(u-10)(u+2) = 0
\\
\begin{gathered}[t]
u=10 \\
x^2-5x+4 = 10 \\
x^2-5x-6 = 0
\end{gathered}
\qquad\text{or}\qquad
\begin{gathered}[t]
u =-2\\
x^2-5x+4 = -2\\
x^2-5x+6 = 0
\end{gathered}
\end{gather*}
\end{document}