![如何避免对齐时出现较大的水平间隙?](https://linux22.com/image/373315/%E5%A6%82%E4%BD%95%E9%81%BF%E5%85%8D%E5%AF%B9%E9%BD%90%E6%97%B6%E5%87%BA%E7%8E%B0%E8%BE%83%E5%A4%A7%E7%9A%84%E6%B0%B4%E5%B9%B3%E9%97%B4%E9%9A%99%EF%BC%9F.png)
答案1
我不确定我是否明白你想要做什么,但我会选择这样的事情:
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
\usepackage[utf8]{inputenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\usepackage{amsmath}
\begin{document}
An example:
\begin{equation}
\begin{split}
A &= \text{1st fairly large expr.}\cdot C \\
&=\text{1st fairly large expr.} \cdot
\begin{aligned}[t]
& (\text{2nd fairly large expr.} \\
& \quad + \text{3rd fairly large expr.})
\end{aligned}
\end{split}
\end{equation}
This assumes that you want to label the whole block with a single
equation number.
\end{document}
这是输出:
另外一个选择
如果希望每行都编号,请使用alignat
:
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
\usepackage[utf8]{inputenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\usepackage{amsmath}
\newcommand*{\myexpr}[1]{%
\langle\text{#1 fairly large expr.}\rangle
}
\begin{document}
An example:
\begin{equation}
\begin{split}
A &= \myexpr{1st} \cdot C \\
&= \myexpr{1st} \cdot
\begin{aligned}[t]
& (\myexpr{2nd} \\
& \quad + \myexpr{3rd})
\end{aligned}
\end{split}
\end{equation}
This assumes you want to label the whole block with a single equation number.
Individual lines can be numbered with the help of the \texttt{alignat}
environment:
\begin{alignat}{2}
A &= \myexpr{1st} && \cdot C \\
&= \myexpr{1st}
&& \cdot (\myexpr{2nd} \notag \\ % no number on this line
& && \mathbin{\hphantom{\cdot}} \quad {} + \myexpr{3rd})
\end{alignat}
We've also shown how to suppress the equation number on a particular line.
\end{document}
请注意幻象的二元运算符的性质是如何\cdot
被保留的,以便它被正确地间隔开。
输出为:
答案2
这里有两个选项:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Option 1:
\begin{align*}
A = {} & B C \\
= {} & B (D \\
& \phantom{B} + E)
\end{align*}
Option 2:
\begin{align*}
A &= B C \\
&= B (D \\
&\phantom{{}= B} + E)
\end{align*}
\end{document}
由于您将括号拆分到多行,因此不能使用\left
- \right
。有关更多信息,请参阅如何使\left
,\right
对分隔符在多行上起作用?