# How to prevent a long break when using align with both single-line and multi-line (aligned) equations?

I have the following code which produces two aligned equations: one is a single line long, while the other one uses aligned to have several lines.

\begin{align}
W' &= W \cup W^\star &\text{donde } \left| W^\star \right| = \left| W \right| \text{ y } W \cap W^\star = \varnothing \\
R' &=
\begin{aligned}[t]
&\left\{ \left< u, v \right> \mid u \neq v \wedge u \operatorname{R} v \right\} \\
\cup &\left\{ \left< f(u), f(v) \right> \mid u \neq v \wedge u \operatorname{R} v \right\} \\
\cup &\left\{ \left< u, f(u) \right> \mid u \operatorname{R} u \right\} \\
\cup &\left\{ \left< f(u), u \right> \mid u \operatorname{R} u \right\}
\end{aligned}
&\text{donde } f : M \to W
\end{align}


The result is this image, there is a big break after W' so that it has the same height as R'.

Strangely, this doesn't happen if I don't align the second column (donde ...).

How can I prevent this big vertical space from happening? Both lines should be reasonable close.

This can unfortunately happen when the equation number has to be moved down because it can't fit the line.

Solution: do a bit of backspacing.

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{align}
W' &= W \cup W^\star
&\hspace{-4em}\text{donde } \lvert W^\star \rvert = \lvert W \rvert \text{ y } W \cap W^\star = \varnothing \\
R' &=
\begin{aligned}[t]
&\{ \langle u, v \rangle \mid u \neq v \wedge u \mathrel{\mathrm{R}} v \} \\
&\cup \{ \langle f(u), f(v) \rangle \mid u \neq v \wedge u \mathrel{\mathrm{R}} v \} \\
&\cup \{ \langle u, f(u) \rangle \mid u \mathrel{\mathrm{R}} u \} \\
&\cup \{ \langle f(u), u \rangle \mid u \mathrel{\mathrm{R}} u \}
\end{aligned}
&\hspace{-4em}\text{donde } f : M \to W
\end{align}

\end{document}


I removed all \left and \right that in the particular situation only add unwanted space. I also modified the four-line set description to a more standard appearance.

• That makes sense; I'm using a weird equatino numbering scheme that's invisible in this case so I didn't see the problems with the number. Just making the second column less wide by using gathered worked as fine as this solution. Commented Feb 23, 2020 at 16:11

You can use the mathrlap command (from mathtools) in the longest line.

However, I think the two explanations starting with donde do not need to be aligned, and I propose a better-looking layout, with a simpler code, after we've defined the \set and \innerp commands, which require \DeclarePairedDelimiterX command (again from mathtools) and xparse:

\documentclass{article}
\usepackage{xparse}
\usepackage{mathtools, amssymb}

\DeclarePairedDelimiterX{\set}[1]\{\}{\setargs{#1}}
\NewDocumentCommand{\setargs}{>{\SplitArgument{1}{;}}m}
{\setargsaux#1}
\NewDocumentCommand{\setargsaux}{mm}
{\IfNoValueTF{#2}{#1}{\nonscript\,#1\nonscript\;\delimsize\vert\nonscript\:\allowbreak #2\nonscript\,}}

\DeclarePairedDelimiterX{\innerp}[1]{\langle}{\rangle}{\innpargs{#1}}
\NewDocumentCommand{\innpargs}{ >{\SplitArgument{1}{,}}m }
{\innpargsaux#1}
\NewDocumentCommand{\innpargsaux}{ m m }
{#1\,,#2}%

\begin{document}

\begin{align}
W' &= W \cup W^\star & & \text{donde } \left| W^\star \right| = \left| W \right| \text{ y } W \cap W^\star = \varnothing \\
R' &=
\begin{aligned}[t]
&\left\{ \left< u, v \right> \mid u \neq v \wedge u \operatorname{R} v \right\} \\
\cup &\mathrlap{\left\{ \left< f(u), f(v) \right> \mid u \neq v \wedge u \operatorname{R} v \right\}} \\
\cup &\left\{ \left< u, f(u) \right> \mid u \operatorname{R} u \right\} \\
\cup &\left\{ \left< f(u), u \right> \mid u \operatorname{R} u \right\}
\end{aligned}
& & \text{donde } f : M \to W
\end{align}
\vskip 2ex
\begin{align}
W' &= W \cup W^\star, \qquad \text{donde } \left| W^\star \right| = \left| W \right| \text{ y } W \cap W^\star = \varnothing \\
R' &=
\begin{aligned}[t]
&\set[\big]{\innerp{u, v } ; u \neq v \wedge u \operatorname{R} v } \\
& \cup \set[\big]{\innerp{f(u), f(v) } ; u \neq v \wedge u \operatorname{R} v } \qquad
\text{donde } f : M \to W\\
& \cup \set[\big]{\innerp{u, f(u) } ; u \operatorname{R} u } \cup \set[\big]{\innerp{f(u), u} \mid u \operatorname{R} u }
\end{aligned}
\end{align}

\end{document}