我想让aligned
环境的水平对齐方式与 相匹配align
。我喜欢将一组属于同一类的方程式分组并对齐,并且我喜欢equation
+aligned
给出一个垂直居中的方程式编号。但是, 的水平间距align
更好。在下面的特定示例中,我当然可以使用两个 ,\notag
但如果有八行方程式怎么办?有没有一种简单的方法可以实现两全其美?
\documentclass{article}
\usepackage{lmodern}
\usepackage{mathtools}
\begin{document}
\noindent This display has nice alignment:
\begin{align}
E(y) &= \mu_y, & V(y) &= \sigma_y^2,\\
E(x) &=\mu_x, & C(x) &= \Sigma_x,\\
E(\epsilon) &= 0 \quad\text{and} & V(\epsilon) &= \sigma_\epsilon^2.
\end{align}
This display has a single number:
\begin{equation}
\begin{aligned}
E(y) &= \mu_y, & V(y) &= \sigma_y^2,\\
E(x) &=\mu_x, & C(x) &= \Sigma_x,\\
E(\epsilon) &= 0 \quad\text{and} & V(\epsilon) &= \sigma_\epsilon^2.
\end{aligned}
\end{equation}
\end{document}
答案1
注意,alignedat
您可以完全控制对齐列之间的间距。以下是三种可能性:
\documentclass{article}
\usepackage{lmodern}
\usepackage{mathtools}
\begin{document}
\noindent This display has nice alignment:
\begin{align}
E(y) &= \mu_y, & V(y) &= \sigma_y^2,\\
E(x) &=\mu_x, & C(x) &= \Sigma_x,\\
E(\epsilon) &= 0 \quad\text{and} & V(\epsilon) &= \sigma_\epsilon^2.
\end{align}
These displays have a single number (each):
\begin{equation}
\begin{alignedat}{2}
E(y) &= \mu_y, & V(y) &= \sigma_y^2,\\
E(x) &=\mu_x, & C(x) &= \Sigma_x,\\
E(\epsilon) &= 0 \quad\text{and} &\hspace{8em} V(\epsilon) &= \sigma_\epsilon^2.
\end{alignedat}
\end{equation}
%
\begin{equation}
\begin{aligned}
E(y) &= \mu_y, & V(y) &= \sigma_y^2,\\
E(x) &=\mu_x, & C(x) &= \Sigma_x,\\
E(\epsilon) &= 0 & \makebox[8em]{and\quad} V(\epsilon) &= \sigma_\epsilon^2.
\end{aligned}
\end{equation}
%
\begin{equation}
\begin{alignedat}{3}
E(y) &= \mu_y, & & & V(y) &= \sigma_y^2,\\
E(x) &=\mu_x, & & & C(x) &= \Sigma_x,\\
E(\epsilon) &= 0 & \makebox[9em]{and} & & V(\epsilon) &= \sigma_\epsilon^2.
\end{alignedat}
\end{equation}
\end{document}