# How to change the alignment in a single split environment?

New user of LaTeX here. While learning how to align equations with the equation and split environments, I asked myself how I could modify the vertical alignment in a single split expression. Here is what I have :

\begin{equation*}
\begin{split}
& w = u - v \\
\iff & w_n = u_n - v_n \\
\iff & w_{n+1} = u_{n+1} - v_{n+1} \\
&= 2u_n - n + 3 - (2v_n - n + 3) \\
&= 2u_n - n + 3 - 2v_n + n - 3 \\
&= 2u_n - 2v_n \\
&= 2(u_n - v_n) \\
&= 2w_n
\end{split}
\end{equation*}


and what it produces : What I would like to have is this : How would I manage to do so?

• Welcome to TeX.SE.
– Mico
Sep 26 at 18:37

Nest aligned (top aligned) in align*. No phantom or zero width boxes are needed.

Explanation: you have one global alignment point (at the w's), plus alignment for a whole block at =.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
& w = u - v \\
& w_n = u_n - v_n \\
& \begin{aligned}[t]
w_{n+1} &= u_{n+1} - v_{n+1} \\
&= 2u_n - n + 3 - (2v_n - n + 3) \\
&= 2u_n - n + 3 - 2v_n + n - 3 \\
&= 2u_n - 2v_n \\
&= 2(u_n - v_n) \\
&= 2w_n
\end{aligned}
\end{align*}

\end{document}


Don't use \iff here, it adds space also at its left side. I suggest you replace the single split environment with two consecutive aligned environments. \documentclass{article}
\usepackage{array}
\usepackage{mathtools} % for '\mathrlap' macro
\begin{document}

\begin{equation*}
\begin{aligned}[b]
& w      \mathrlap{{}= u - v}     \\
\iff{} & w_n    \mathrlap{{}= u_n - v_n} \\
\iff{} & w_{n+1}
\end{aligned}%
\begin{aligned}[t]
&= u_{n+1} - v_{n+1} \\
&= 2u_n - n + 3 - (2v_n - n + 3) \\
&= 2u_n - n + 3 - 2v_n + n - 3 \\
&= 2u_n - 2v_n \\
&= 2(u_n - v_n) \\
&= 2w_n
\end{aligned}
\end{equation*}

\end{document}


Instead of using two aligned environments, one could also employ a two-column array environment to generate the screenshot shown above.

$\newcolumntype{L}{>{\displaystyle}l} % \newcolumntype is defined in 'array' package \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{1.25} % mimic look of displaymath env. \begin{array}{LL} \multicolumn{2}{L}{\phantom{\iff{}} w = u - v} \\ \multicolumn{2}{L}{\iff w_n = u_n - v_n} \\ \iff w_{n+1} &{}= u_{n+1} - v_{n+1} \\ &{}= 2u_n - n + 3 - (2v_n - n + 3) \\ &{}= 2u_n - n + 3 - 2v_n + n - 3 \\ &{}= 2u_n - 2v_n \\ &{}= 2(u_n - v_n) \\ &{}= 2w_n \end{array}$

• Thanks for this solution! While I understand most of the code, I don't know what mathrlap is, and I could barely find it on the internet. Could you explain it to me or refer me to an explanation please? Sep 26 at 19:36
• @LucasMartiniano - \mathrlap is a macro that's provided by the mathtools package. See section 3.1, "Fine-tuning mathematical layout", of the package's user guide for a discussion of the \mathclap, \mathllap, and mathrlap macros.
– Mico
Sep 26 at 19:51

Welcome to TeX:SE!

For showed equations layout the split is not appropriate. With use of the array you can get the following result: \documentclass{article}
\usepackage{amsmath}

\begin{document}
$\setlength\arraycolsep{1pt} \begin{array}{r r l} & w = & u - v \\ \iff & w_n = & u_n - v_n \\ \iff & w_{n+1} & = u_{n+1} - v_{n+1} \\ & & = 2u_n - n + 3 - (2v_n - n + 3) \\ & & = 2u_n - n + 3 - 2v_n + n - 3 \\ & & = 2u_n - 2v_n \\ & & = 2(u_n - v_n) \\ & & = 2w_n \end{array}$
\end{document}

• I think the OP would like to align the first three rows so that the w terms line up.
– Mico
Sep 26 at 18:55
• @Mico, you may be right, but to my taste suggested solution gives nicer result ;-) (very opinion based). Sep 26 at 19:00