在排版包含长表达式的方程式链时,我喜欢将所有内容放在方程式符号的右侧,以避免框过满或使用multlined
& 朋友。目前,我通过align
将 & 符号放置为 的环境来执行此操作,但我刚刚注意到这会删除和 表达式=&
之间的空格。=
IISC equation
+split
并alignat
表现相同。我浏览了许多关于方程对齐的问题,但尚未找到这个确切的情况。我很高兴得到任何关于如何实现这一点的指示。
如果这不容易实现,我可能会考虑将第一行与=
甚至稍微向左移动一点。
这是一个 MWe:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
This is what I'd like to avoid.
\begin{align*}
\text{First very long expression}
&= \text{Second very long expression that might cause an overfull box}\\
&= \text{Third very long expression}
\end{align*}
This is the alignment that I would like to achieve, but the \verb|\hphantom| seems like an ugly workaround.
\begin{align*}
&\hphantom{=.} \text{First very long expression}\\
&= \text{Second very long expression that might cause an overfull box}\\
&= \text{Third very long expression}
\end{align*}
Unfortunately \verb|align| removes the space between \verb|=| and expression when placing the \verb|&| right of the \verb|=|.
\begin{align*}
& \text{First very long expression}\\
=& \text{Second very long expression that might cause an overfull box}\\
=& \text{Third very long expression}
\end{align*}
\end{document}
答案1
={}&
将给出\mathrel
= 就像$=$
在 = 后不给出空格一样,但是$={}$
将在 = 后给出空格。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Unfortunately \verb|align| removes the space between \verb|=| and expression when placing the \verb|&| right of the \verb|=|.
\begin{align*}
& \text{First very long expression}\\
={}& \text{Second very long expression that might cause an overfull box}\\
={}& \text{Third very long expression}
\end{align*}
\end{document}
答案2
另一种放置方式是将第一个表达式放在对齐等号的稍微左边。
\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage[nopar]{lipsum}
\begin{document}
\lipsum[1][1-4]
\begin{align*}
\lefteqn{\text{First very long expression}}
\quad&\\
&= \text{Second very long expression that might cause an overfull box}\\
&= \text{Third very long expression}
\end{align*}
\lipsum[2][1-4]
\begin{align*}
\mathmakebox[1em][l]{\text{First very long expression}}&\\
&= \text{Second very long expression that might cause an overfull box}\\
&= \text{Third very long expression}
\end{align*}
\lipsum[3][1-4]
\end{document}
第二种方法不太隐秘,但本质上与第一种方法相同。