如何在以下环境的第一行中的第一个减号处获取第二个对齐标记alignat
?我想用它在两行上写第二个表达式,将加号与 sigma 符号前面对齐。
\documentclass{amsart}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
f(x_{4}) &= (x_{4} &&- x_{1}) + (x_{4} - x_{2}) + (x_{4} - x_{3}) + \sum_{i=5}^{8} (x_{i} - x_{4}) \\
&= \bigl[(x_{4} - x_{3}) + (x_{3} - x_{1})\bigr] + \bigl[(x_{4} - x_{3}) + (x_{3} - x_{2})\bigr] + (x_{4} - x_{3}) \\
&&+ \sum_{i=5}^{8} \bigl[(x_{i} - x_{3}) - (x_{4} - x_{3})\bigr] \\
&= (x_{3} - x_{1}) + (x_{3} - x_{2}) - (x_{4} - x_{3}) + \sum_{i=5}^{8} (x_{i} - x_{3}) \\
&< (x_{3} - x_{1}) + (x_{3} - x_{2}) + \sum_{i=4}^{8} (x_{i} - x_{3}) \\
&< \sum_{i=1}^{8} \vert x_{i} - x_{3} \vert \\
&= f(x_{3}) ,
\end{alignat*}
\end{document}
答案1
-
我会将第二个表达式中的第一个与环境内部的使用+
对齐。+(x_4 - x_3)
aligned
align*
\documentclass{amsart}
\usepackage{amsmath}
\begin{document}
\begin{align*}
f(x_{4}) &= (x_{4}-x_{1}) + (x_{4} - x_{2}) + (x_{4} - x_{3}) + \sum_{i=5}^{8} (x_{i} - x_{4}) \\
&=\begin{aligned}[t]\bigl[(x_{4} &- x_{3}) + (x_{3} - x_{1})\bigr] + \bigl[(x_{4} - x_{3}) + (x_{3} - x_{2})\bigr] \\
&+(x_{4} - x_{3})+\sum_{i=5}^{8} \bigl[(x_{i} - x_{3}) - (x_{4} - x_{3})\bigr] \end{aligned} \\
&= (x_{3} - x_{1}) + (x_{3} - x_{2}) - (x_{4} - x_{3}) + \sum_{i=5}^{8} (x_{i} - x_{3}) \\
&< (x_{3} - x_{1}) + (x_{3} - x_{2}) + \sum_{i=4}^{8} (x_{i} - x_{3}) \\
&< \sum_{i=1}^{8} \vert x_{i} - x_{3} \vert \\
&= f(x_{3}) ,
\end{align*}
\end{document}
答案2
像这样的排列?
\documentclass{amsart}
\begin{document}
\begin{align*}
f(x_4) &= (x_4 - x_1) + (x_4 - x_2) + (x_4 - x_3) + \sum_{i=5}^8 (x_i - x_4) \\
&= \bigl[(x_4 - x_3) + (x_3 - x_1)\bigr] + \bigl[(x_4 - x_3) + (x_3 - x_2)\bigr] + (x_4 - x_3) \\
&\quad+ \sum_{i=5}^8 \bigl[(x_i - x_3) - (x_4 - x_3)\bigr] \\
&= (x_3 - x_1) + (x_3 - x_2) - (x_4 - x_3) + \sum_{i=5}^8 (x_i - x_3) \\
&< (x_3 - x_1) + (x_3 - x_2) + \sum_{i=4}^8 (x_i - x_3) \\
&< \sum_{i=1}^8 \vert x_i - x_3 \vert \\
&= f(x_3)
\end{align*}
\end{document}
或者按照 Thruston 在评论中所建议的,用\qquad
代替\quad
。
或者按照 Enrico 的建议,(x_4-x_3)
也移动到下一行。
\documentclass{amsart}
\begin{document}
\begin{align*}
f(x_4) &= (x_4 - x_1) + (x_4 - x_2) + (x_4 - x_3) + \sum_{i=5}^8 (x_i - x_4) \\
&= \bigl[(x_4 - x_3) + (x_3 - x_1)\bigr] + \bigl[(x_4 - x_3) + (x_3 - x_2)\bigr] \\
&\quad + (x_4 - x_3)+ \sum_{i=5}^8 \bigl[(x_i - x_3) - (x_4 - x_3)\bigr] \\
&= (x_3 - x_1) + (x_3 - x_2) - (x_4 - x_3) + \sum_{i=5}^8 (x_i - x_3) \\
&< (x_3 - x_1) + (x_3 - x_2) + \sum_{i=4}^8 (x_i - x_3) \\
&< \sum_{i=1}^8 \vert x_i - x_3 \vert \\
&= f(x_3) ,
\end{align*}
\end{document}
在评论中澄清后再次尝试:
\documentclass{amsart}
\begin{document}
\begin{align*}
f(x_4) &= (x_4 - x_1) + (x_4 - x_2) + (x_4 - x_3) + \sum_{i=5}^8 (x_i - x_4) \\
&= \bigl[(x_4 - x_3) + (x_3 - x_1)\bigr] + \bigl[(x_4 - x_3) + (x_3 - x_2)\bigr]+ (x_4 - x_3) \\
&\phantom{{}=(x_4} + \sum_{i=5}^8 \bigl[(x_i - x_3) - (x_4 - x_3)\bigr] \\
&= (x_3 - x_1) + (x_3 - x_2) - (x_4 - x_3) + \sum_{i=5}^8 (x_i - x_3) \\
&< (x_3 - x_1) + (x_3 - x_2) + \sum_{i=4}^8 (x_i - x_3) \\
&< \sum_{i=1}^8 \lvert x_i - x_3 \rvert \\
&= f(x_3)
\end{align*}
\end{document}
答案3
你是这个意思吗?
% arara: pdflatex
\documentclass{amsart}
\begin{document}
\begin{align*}
f(x_{4})&= (x_{4} - x_{1}) + (x_{4} - x_{2}) + (x_{4} - x_{3}) + \sum_{i=5}^{8} (x_{i} - x_{4}) \\
&= \bigl[(x_{4} - x_{3}) + (x_{3} - x_{1})\bigr] + \bigl[(x_{4} - x_{3}) + (x_{3} - x_{2})\bigr] + (x_{4} - x_{3}) \\
&\hphantom{{}= (x_{4}} + \mathop{\smash[b]{\sum_{i=5}^{8}}} \bigl[(x_{i} - x_{3}) - (x_{4} - x_{3})\bigr] \\
&= (x_{3} - x_{1}) + (x_{3} - x_{2}) - (x_{4} - x_{3}) + \sum_{i=5}^{8} (x_{i} - x_{3}) \\
&< (x_{3} - x_{1}) + (x_{3} - x_{2}) + \mathop{\smash{\sum_{i=4}^{8}}} (x_{i} - x_{3}) \\
&< \sum_{i=1}^{8} \lvert x_{i} - x_{3} \rvert \\
&= f(x_{3}),
\end{align*}
\end{document}
不过,我不建议这样做,因为我看不出为什么要与这一点对齐。但这看起来像您上面尝试过的做法。我倾向于与第二行的第一个符号对齐,或者更好的第二个符号,甚至更好的第三个符号对齐。或者使用\quad
上面推荐的一些或类似的符号,以便在所有公式中保持一致。
答案4
我会使用multlined
以下mathtools
包:
\documentclass{amsart}
\usepackage{mathtools}
\begin{document}
\begin{align*}
f(x_{4})
& = (x_{4} - x_{1}) + (x_{4} - x_{2}) + (x_{4} - x_{3}) + \sum_{i=5}^{8} (x_{i} - x_{4}) \\
& = \!\begin{multlined}[t][0.5\linewidth]
\bigl[(x_{4} - x_{3}) + (x_{3} - x_{1})\bigr]
+ \bigl[(x_{4} - x_{3}) + (x_{3} - x_{2})\bigr] \\
+ (x_{4} - x_{3})
+ \sum_{i=5}^{8} \bigl[(x_{i} - x_{3}) - (x_{4} - x_{3})\bigr]
\end{multlined} \\
& = (x_{3} - x_{1}) + (x_{3} - x_{2}) - (x_{4} - x_{3}) + \sum_{i=5}^{8} (x_{i} - x_{3}) \\
& < (x_{3} - x_{1}) + (x_{3} - x_{2}) + \sum_{i=4}^{8} (x_{i} - x_{3}) \\
& < \sum_{i=1}^{8} \vert x_{i} - x_{3} \vert \\
& = f(x_{3}) ,
\end{align*}
\end{document}