当我运行下面的代码时,我收到“失控参数”错误。我试图以类似于代码本身对齐的方式进行对齐。我也尝试使用 alignat。我遗漏了什么?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
& S &= 1 + \frac{1}{2} &+ \frac{1}{3} + \frac{1}{4} + \frac{1}{5} &+ \frac{1}{6} + \frac{1}{7} &+ \dots \\
& &> 1 &+ \frac{3}{3} &+ \frac{3}{6} &+ \dots
\end{align*}
\end{document}
答案1
错误来自空白行,但我怀疑您想要不同的对齐方式:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
original
\begin{align*}
& S &= 1 + \frac{1}{2} &+ \frac{1}{3} + \frac{1}{4} + \frac{1}{5} &+ \frac{1}{6} + \frac{1}{7} &+ \dots \\
& &> 1 &+ \frac{3}{3} &+ \frac{3}{6} &+ \dots
\end{align*}
move \&
\begin{align*}
S &= 1 + \frac{1}{2} &&+ \frac{1}{3} + \frac{1}{4} + \frac{1}{5} &&+ \frac{1}{6} + \frac{1}{7} &&+ \dots \\
&> 1 &&+ \frac{3}{3} &&+ \frac{3}{6} &&+ \dots
\end{align*}
alignat
\begin{alignat*}{4}
S &= 1 + \frac{1}{2} &&+ \frac{1}{3} + \frac{1}{4} + \frac{1}{5} &&+ \frac{1}{6} + \frac{1}{7} &&+ \dots \\
&> 1 &&+ \frac{3}{3} &&+ \frac{3}{6} &&+ \dots
\end{alignat*}
\end{document}