1

I would like to make the horizontal alignment of the aligned environment match that of align. I like to group and align a set of equations that belong together, and I like that equation+aligned gives my one vertically centered equation number. However, the horizontal spacing of align is better. In the particular example below, I could of course use two \notag's but what if there were eight lines of equations? Is there a simple way to achieve the best of both worlds?

\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}

Display of equation alignments.

  • The internal forms of the alignment environments do not have the generous horizontal spacing of the normal forms. Just put a \qquad at the beginning of the second column. – campa May 23 '18 at 7:59
  • @campa Actually, \qquad\qquad\qquad\quad is what gets me there in this example. :) – Mankka May 23 '18 at 8:02
  • 1
    \hspace{7em} is easier. But you got the idea. – campa May 23 '18 at 8:02
1

Note alignedat gives you full control on the spacing between alignment columns. Here are three possibilities:

\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} 

enter image description here

| improve this answer | |
  • This is very similar to what @campa suggested in a comment to the question. If I typeset both align and equation+aligned I can manually tune the hspace to make them match. This is exactly what I don't want to do. – Mankka May 23 '18 at 11:59
  • 1
    I'm afraid the only choice is between a manual space adjustment and a manual deleting of unwanted equation tags. – Bernard May 23 '18 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.