# Aligning different for each pair of equations in same align-environment

I am using the following environment and want to have alignment for each the first two, the second two and the third two equations at the =-Symbol. In this moment everything aligns at the same point but this way the last equation for instance is too far on the left. What would you suggest? Splitting it up in three align-environments doesn't help as then the seperation between the equations would be too big.

\begin{align}
Cov\left(\tilde{c}_D,\tilde{r}_M\right) &= \sum_{i=1}^4f_i\left(c_{D,i}-E(\tilde{c}_D)\right)\left(r_{M,i}-E(\tilde{r}_M)\right),\\
Cov\left(\tilde{c}_E,\tilde{r}_M\right) &= \sum_{i=1}^4f_i\left(c_{E,i}-E(\tilde{c}_E)\right)\left(r_{M,i}-E(\tilde{r}_M)\right),\\
V_D &= \frac{E(\tilde{c}_D) - \left( E\left(\tilde{r}_M\right) - r_f\right)\frac{Cov\left(\tilde{c}_D,\tilde{r}_M\right)}{\sigma_{\tilde{r}_M}^2}}{1+r_f},\\
V_U &= \frac{E(\tilde{c}_E) - \left( E\left(\tilde{r}_M\right) - r_f\right)\frac{Cov\left(\tilde{c}_E,\tilde{r}_M\right)}{\sigma_{\tilde{r}_M}^2}}{1+r_f},\\
\mu_D &= \frac{E(\tilde{c}_D)}{V_D} - 1 \text{~und~}\\
\mu_E &= \frac{E(\tilde{c}_E)}{V_E} - 1.
\end{align}

• For future questions: You really should make your code minimal working examples (MWE). A MWE is compilable and creates the described problem. It starts at \documentclass and ends at \end{document} and includes all packages that are needed for your code (but not more). – Skillmon Jun 19 '17 at 11:18

ok, I found a solution by myself as I googled for another problem. This helps:

\begin{gather}
\begin{align}
Cov\left(\tilde{c}_D,\tilde{r}_M\right) &= \sum_{i=1}^4f_i\left(c_{D,i}-E(\tilde{c}_D)\right)\left(r_{M,i}-E(\tilde{r}_M)\right),\\
Cov\left(\tilde{c}_E,\tilde{r}_M\right) &= \sum_{i=1}^4f_i\left(c_{E,i}-E(\tilde{c}_E)\right)\left(r_{M,i}-E(\tilde{r}_M)\right),
\end{align}\\
\begin{align}
V_D &= \frac{E(\tilde{c}_D) - \left( E\left(\tilde{r}_M\right) - r_f\right)\frac{Cov\left(\tilde{c}_D,\tilde{r}_M\right)}{\sigma_{\tilde{r}_M}^2}}{1+r_f},\\
V_U &= \frac{E(\tilde{c}_E) - \left( E\left(\tilde{r}_M\right) - r_f\right)\frac{Cov\left(\tilde{c}_E,\tilde{r}_M\right)}{\sigma_{\tilde{r}_M}^2}}{1+r_f},
\end{align}\\
\begin{align}
\mu_D &= \frac{E(\tilde{c}_D)}{V_D} - 1 \text{~und~}\\
\mu_E &= \frac{E(\tilde{c}_E)}{V_E} - 1.
\end{align}
\end{gather}

• @DavidCarlisle It works: the amsmath documentation explains (well hidden in the last part about error messages) "the chief exception is that align and most of its variants can be used inside the gather environment". – campa Jun 19 '17 at 11:26
• @campa sigh I wonder who's maintaining amsmath these days:-) (thanks I'll delete the comment) – David Carlisle Jun 19 '17 at 11:29
• Add \DeclareMathOperator{\Cov}{Cov} to your preamble and use \Cov in the formulas. Each of the \left and \right you have here should be omitted. – egreg Jun 19 '17 at 12:22

I suggest some improvements: using subequations since the equations go in pairs,medium-sized fractions from nccmath for fractions in fractions, declare Cov as a math operator (for now, Cov looks like the product of three variables), and another placement of the word ‘und’ with the ArrowBetweenLines command from mathtools:

\documentclass{article}
\usepackage{mathtools, nccmath}
\DeclareMathOperator{\Cov}{Cov}

\begin{document}

\begin{gather}
\begin{subequations}
\begin{align}
\Cov\left(\tilde{c}_D,\tilde{r}_M\right) & = ∑_{i=1}⁴f_i\left(c_{D,i}-E(\tilde{c}_D)\right)\left(r_{M,i}-E(\tilde{r}_M)\right), \\
\Cov\left(\tilde{c}_E,\tilde{r}_M\right) & = ∑_{i=1}⁴f_i\left(c_{E,i}-E(\tilde{c}_E)\right)\left(r_{M,i}-E(\tilde{r}_M)\right),
\end{align}
\end{subequations}
\\
\begin{subequations}
\begin{align}
V_D & = \frac{E(\tilde{c}_D) - \left( E\left(\tilde{r}_M\right) - r_f\right)\mfrac{\Cov\left(\tilde{c}_D,\tilde{r}_M\right)}{\sigma_{\tilde{r}_M}²}}{1+r_f}, \\
V_U & = \frac{E(\tilde{c}_E) - \left( E\left(\tilde{r}_M\right) - r_f\right)\mfrac{\Cov\left(\tilde{c}_E,\tilde{r}_M\right)}{\sigma_{\tilde{r}_M}²}}{1+r_f},
\end{align}
\end{subequations}\\
\begin{subequations}
\begin{alignat}{2}
& & \mu_D & = \frac{E(\tilde{c}_D)}{V_D} - 1 \\
\ArrowBetweenLines[\text{und~}]
& & \mu_E & = \frac{E(\tilde{c}_E)}{V_E} - 1.
\end{alignat}
\end{subequations}
\end{gather}

\end{document}