请参阅代码中我的问题:
\documentclass{article}
\usepackage{amsmath,amsthm,mathtools}
\begin{document}
I am not sure align at the equal sign is a good idea, it looks weird to me.
\begin{align}
y & = \Sigma aaa \\ \nonumber
& = bbb + ccc \\ \nonumber
& + ddd + eee \\ \nonumber
& + fff + ggg
\end{align}
So I am trying some other options, like this [Effect-1],
\begin{align}
y= & \Sigma aaa \\ \nonumber
= &bbb + ccc \\ \nonumber
& {\rm{~~~~}} + ddd + eee \\ \nonumber
& {\rm{~~~~}} + fff + ggg
\end{align}
That is the first line and second line, align at equal sign, and the second and the rest, align at plus sign.
Or this [Effect-2],
\begin{align}
y= & \Sigma aaa \\ \nonumber
= & {\rm{~~~}} bbb + ccc \\ \nonumber
& + ddd + eee \\ \nonumber
& + fff + ggg
\end{align}
That is the first line and second line, align at equal sign, and the second and the rest, align at characters sign, and in the meantime, keep plus sign not aligned with equal sign.
Some sentences. Some sentences. Some sentences. Some sentences. Some sentences. Some sentences.
Some sentences. Some sentences. Some sentences. Some sentences. Some sentences. Some sentences. Some sentences.
\begin{align}
y= & \Sigma aaa \\ \nonumber
= & \rm{~~~} bbb - ccc - ddd - eee \\ \nonumber
& - fff - ggg
\end{align}
I want this new equation aligned with the above equations without using intertext.
Questions:
1) Using \emph{rm spaces} looks stupid and not always correct, any better solution for multi alignments?
2) How to align across different paragraphs, if I do not want to use "inter text"?
\end{document}
答案1
您可以采用以下几种方法:
\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/{mathtools}
\begin{document}
One way
\begin{align}
y & = \Sigma aaa \\
& = bbb + ccc \nonumber \\
& \mathrel{\phantom{=}}{} + ddd + eee \nonumber \\
& \mathrel{\phantom{=}}{} + fff + ggg \nonumber
\end{align}
Another way,
\begin{align}
y &= \Sigma aaa \\
&= bbb + ccc \nonumber \\
&\mathrel{\phantom{=}}\phantom{bbb} + ddd + eee \nonumber \\
&\mathrel{\phantom{=}}\phantom{bbb} + fff + ggg \nonumber
\end{align}
That is the first line and second line, align at equal sign, and the second and the rest,
align at plus sign.
Yet another way
\begin{align}
y &= \Sigma aaa \\
&= {}\mathbin{\phantom{+}} bbb + ccc \nonumber \\
&\mathrel{\phantom{=}}{} + ddd + eee \nonumber \\
&\mathrel{\phantom{=}}{} + fff + ggg \nonumber
\end{align}
That is the first line and second line, align at equal sign, and the second and the rest,
align at characters sign, and in the meantime, keep plus sign not aligned with equal sign.
\begin{align}
y &= \Sigma aaa \\
&= bbb - ccc - ddd - eee \nonumber \\
& - fff - ggg \nonumber
\end{align}
I want this new equation aligned with the equations below without using intertext.
\begin{align}
y &\mathrlap{{}= \Sigma aaa}\phantom{{}= bbb - ccc - ddd - eee} \\
&= {}\mathbin{\phantom{+}} bbb + ccc \nonumber \\
&\mathrel{\phantom{=}}{} + ddd + eee \nonumber \\
&\mathrel{\phantom{=}}{} + fff + ggg \nonumber
\end{align}
\end{document}
一些注意事项:
- 不要留下空行
align
(以避免垂直间距过大); - 用于
\phantom{..}
获取正确的间距而无需实际排版; - 使用
\phantom
可能会删除与运算符/关系相关的间距。通过{}
在“丢失的一侧”添加一个空组来解决此问题。 - 当避免时
\intertext
,您需要能够(手动)捕获对齐两侧最大的(水平)元素,并使用逐字传输\phantom
。其他组件的实际设置应使用重叠技术(\mathrlap
或\mathllap
,如我的示例所示)。
答案2
或者这样:
\begin{align}
y & = \Sigma aaa \\ \nonumber
& = bbb + ccc \\ \nonumber
& \quad{}+ ddd + eee \\ \nonumber
& \quad{}+ fff + ggg
\end{align}
{}
表示+
符号周围的适当间距,\quad
并且\qquad
是数学模式下的标准长度。