# Vertical Alignment Every Other Line and Wide Expressions

I'm sorry if this was asked elsewhere, but I couldn't find anything. I've had this question for a while now, and it really bothers me; I seem to run into these situations relatively often.

The generic problem is that I have a derivation I want to show in which I want to 1) align equals signs where appropriate but 2) the LHS at the start of the derivation is rather wide and 3) the intermediate results might spill across multiple lines, and I especially 4) need some of these intermediate results to print to the left of the alignment set up by the equals sign on the first line (because the LHS of the first line is wide and the intermediate lines are also wide).

What I'd really like is for the intermediate results to automatically justify similar to multline or, depending on the situation, for me to align them myself independently of the & from the enveloping align environment.

mathtools' multlined environment doesn't seem to work because all printing is to the right of the equals sign, which is itself to the right of a wide expression.

I've included some code below that shows my best attempt to tackle the problem, which required some fine tuning of a negative horizontal shift to try to align the right justification of the intermediate steps. I apologize that it's a bit hard to read.

\documentclass[]{article}

\usepackage{amsmath}

\setlength{\jot}{10pt}

\newcommand{\an}{\langle #1 \rangle}

\begin{document}

\begin{align}
\begin{split}
A(1^-6^-5^+2^+4^+3^-) & = \frac{\an{13}^3\an{23}}{\an{12}\an{24}\an{43}\an{31}}\frac{\an{12}}{\an{16}\an{65}\an{52}}\biggl( \\
& \hspace{-0.8in} \frac{\langle2|6|1]}{\langle2|5+6|1]}\frac{\an{26}^2}{(p_2+k_5+k_6)^2}\frac{}{\an{12}}%\frac{\an{56}}{}
+ \frac{\langle2|5|1]}{\langle2|5+6|1]}\frac{^2}{(p_1+k_5+k_6)^2}\frac{\an{16}}{}
\biggr)\end{split} \\
\begin{split} & = A(1^-2^+4^+3^-)\frac{\an{12}}{\an{16}\an{65}\an{52}}\biggl( \\
& \hspace{-0.5in} \frac{1}{\langle2|5+6|1]}\frac{\an{26}^3}{(p_2+k_5+k_6)^2}+ \frac{\langle2|5|1]}{\langle2|5+6|1]}\frac{^2}{(p_1+k_5+k_6)^2}\frac{\an{16}}{}
\biggr)\end{split}
\end{align}

\end{document}


I've included a picture of the output from the above code from my machine below: Thank you very much for your help!

• Welcome to TeX.SE.
– Mico
May 28 '19 at 8:45

I propose two layouts, both based on align:

\documentclass[]{article}

\usepackage{amsmath,mathtools}

\usepackage{showframe}

\DeclarePairedDelimiter{\an}{\langle}{\rangle}

\begin{document}

\begin{align}
A(1^-6^-5^+2^+4^+3^-)
& =
\frac{\an{13}^3\an{23}}{\an{12}\an{24}\an{43}\an{31}}\frac{\an{12}}{\an{16}\an{65}\an{52}} \notag\\
\frac{\langle2|6|1]}{\langle2|5+6|1]}\frac{\an{26}^2}{(p_2+k_5+k_6)^2}\frac{}{\an{12}} \notag\\
\biggr)
\\
& =
A(1^-2^+4^+3^-)\frac{\an{12}}{\an{16}\an{65}\an{52}} \notag\\
\frac{1}{\langle2|5+6|1]}\frac{\an{26}^3}{(p_2+k_5+k_6)^2} \notag\\
\biggr)
\end{align}

\begin{align}
&\lefteqn{A(1^-6^-5^+2^+4^+3^-)=} \notag \\
& =
\frac{\an{13}^3\an{23}}{\an{12}\an{24}\an{43}\an{31}}\frac{\an{12}}{\an{16}\an{65}\an{52}} \notag\\
\frac{\langle2|6|1]}{\langle2|5+6|1]}\frac{\an{26}^2}{(p_2+k_5+k_6)^2}\frac{}{\an{12}}
+ \frac{\langle2|5|1]}{\langle2|5+6|1]}\frac{^2}{(p_1+k_5+k_6)^2}\frac{\an{16}}{}
\biggr)
\\
& =
A(1^-2^+4^+3^-)\frac{\an{12}}{\an{16}\an{65}\an{52}} \notag\\
\frac{1}{\langle2|5+6|1]}\frac{\an{26}^3}{(p_2+k_5+k_6)^2}
+ \frac{\langle2|5|1]}{\langle2|5+6|1]}\frac{^2}{(p_1+k_5+k_6)^2}\frac{\an{16}}{}
\biggr)
\end{align}

\end{document}


Note that showframe is used just to show the margins of the text block. • Hi egreg, thank you very much for taking the time to submit an answer to my question. I like the layout of your second suggestion. But I don't think that either suggestion answers my original question. The first suggestion leaves a huge amount of empty space on the left because all text is to the right of the aligned equals. And for the second I don't see how one could further down align to the topmost equals sign as I want to.
– WAH
May 28 '19 at 12:30
• @WAH Use a very wide page. I'm not sure what you actually want, to be honest. May 28 '19 at 12:34
• Hi egreg, I'd like a result formatted like in the output I showed, but with the intermediate lines aligned on the right (instead of approximately aligned from the fine tuning of the negative hspace used). An aligned-inception, so to speak. Or, second best case, have the intermediate lines right justified. But in either of these cases, I want the ability for the intermediate lines to be written to the left of the aligned equals signs, as is shown in the output I provided.
– WAH
May 28 '19 at 12:40
\documentclass[a4paper]{article}
\usepackage{mathtools}
\newcommand{\an}{\langle #1 \rangle}
\begin{document}

\begin{multline}
A(1^-6^-5^+2^+4^+3^-) =
\frac{\an{13}^3\an{23}}{\an{12}\an{24}\an{43}\an{31}}\frac{\an{12}}{\an{16}\an{65}\an{52}}\cdot\\
\biggl(\frac{\langle2|6|1]}{\langle2|5+6|1]}\frac{\an{26}^2}{(p_2+k_5+k_6)^2}\frac{}{\an{12}}%\frac{\an{56}}{}
+ \frac{\langle2|5|1]}{\langle2|5+6|1]}\frac{^2}{(p_1+k_5+k_6)^2}\frac{\an{16}}{}
\biggr)
\end{multline}
\begin{multline}
\phantom{A(1^-6^-5^+2^+4^+3^-)} =
A(1^-2^+4^+3^-)\frac{\an{12}}{\an{16}\an{65}\an{52}}\cdot\\
\biggl(\frac{1}{\langle2|5+6|1]}\frac{\an{26}^3}{(p_2+k_5+k_6)^2}+
\frac{\langle2|5|1]}{\langle2|5+6|1]}\frac{^2}{(p_1+k_5+k_6)^2}\frac{\an{16}}{}
\biggr)
\end{multline}

\end{document} or with only one equation number:

\documentclass[a4paper]{article}
\usepackage{mathtools}
\newcommand{\an}{\langle #1 \rangle}
\begin{document}

\begin{multline}
A(1^-6^-5^+2^+4^+3^-) =
\frac{\an{13}^3\an{23}}{\an{12}\an{24}\an{43}\an{31}}\frac{\an{12}}{\an{16}\an{65}\an{52}}\cdot\\
\biggl(\frac{\langle2|6|1]}{\langle2|5+6|1]}\frac{\an{26}^2}{(p_2+k_5+k_6)^2}\frac{}{\an{12}}%\frac{\an{56}}{}
+ \frac{\langle2|5|1]}{\langle2|5+6|1]}\frac{^2}{(p_1+k_5+k_6)^2}\frac{\an{16}}{}
\biggr) \\
\shoveleft{\phantom{A(1^-6^-5^+2^+4^+3^-)} =
A(1^-2^+4^+3^-)\frac{\an{12}}{\an{16}\an{65}\an{52}}\cdot}\\
\biggl(\frac{1}{\langle2|5+6|1]}\frac{\an{26}^3}{(p_2+k_5+k_6)^2}+
\frac{\langle2|5|1]}{\langle2|5+6|1]}\frac{^2}{(p_1+k_5+k_6)^2}\frac{\an{16}}{}
\biggr)
\end{multline}

\end{document} • Hi Red-Cloud, thank you very much for submitting an answer to my question. Using phantom is a good idea I hadn't thought of. I feel like your solution could be improved. First, you're really making two different equations; the vertical spacing isn't quite right, and LaTeX will more likely split the result across two pages. Second, what if I perform some manipulations on the LHS that I wish to display so that it's not so easy to align the equals sign, but would rather require fine tuning?
– WAH
May 28 '19 at 11:10
• see extended answer. May 28 '19 at 11:19
• Hi Red-Cloud, thank you very much for extending your answer. The new suggestion is better because it's now a single equation block. But I still don't see how to get the vertical alignment without fine tuning if the LHS changes in a non-trivial way. For example, suppose I wanted the LHS to become $\therefore\Gamma$? (I recognize that this is a bit contrived, but I have run across these kinds of situations before.)
– WAH
May 28 '19 at 11:55