# Aligning equation on two lines

I have an equation of this kind:

\begin{equation*}
A_1 \rightarrow A_2 \rightarrow \dots \rightarrow A_N
\end{equation*}


And I would like to add a $B_1$ under $A_1$, $B_2$ under $A_2$ and $B_N$ under $A_N$. My idea was to use the environment align:

\begin{align*}
&A_1 \rightarrow &A_2 \rightarrow \dots &\rightarrow A_N \\
&B_1 &B_2 &B_3
\end{align*}


However it does not work as I was imagined. I would like to find a way to keep the equation above unchanged somehow.

Any help will be very much appreciated!

I'd keep the equation* environment and use bespoke array environments to place B_1 below A_1, B_2 below A_2, etc.

\documentclass{article} % or some other suitable document class
\usepackage{amsmath} % for 'equation*' env.
%% macro with a bespoke 'array' env.:
\newcommand\mybox[2]{\begin{array}[t]{@{}c@{}}
\displaystyle #1 \\ \displaystyle #2
\end{array}}

\begin{document}

\begin{equation*}
A_1 \rightarrow A_2 \rightarrow \dots \rightarrow A_N
\end{equation*}

\begin{equation*}
\mybox{A_1}{B_1} \to \mybox{A_2}{B_2} \to \dots \to \mybox{A_N}{B_N}
\end{equation*}

\end{document}

• Thanks a lot! I didn't know the environment array! Apr 8 at 11:55

It's easy with tikz-cd:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}

\begin{equation*}
\begin{tikzcd}[column sep=1em,row sep=-0.5ex]
A_1 \arrow[r] &
A_2 \arrow[r] &
\cdots \arrow[r] &
A_N
\\
B_1 & B_2 & & B_N
\end{tikzcd}
\end{equation*}

\end{document}


You can use the underset command. MWE:

\documentclass{report}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
\underset{B_1}{A_1} \rightarrow \underset{B_2}{A_2} \rightarrow \dots \rightarrow \underset{B_N}{A_N} \\
\end{equation*}

\end{document}

• Thanks! The problem with \underset is that it reduces the sizes of $B_1$, $B_2$ and $B_N$... Apr 8 at 13:02
• Should be solved by inserting \displaymath where desired. Apr 8 at 19:15

Another solution with equation* and stackengine:

    \documentclass{article}
\usepackage{amsmath}
\usepackage[usestackEOL]{stackengine}

\begin{document}

\begin{equation*}\stackMath\renewcommand{\Sstackgap}{3\jot}
\stackunder{A_1}{B_1} \longrightarrow \stackunder{A_2}{B_2}
\longrightarrow \dots \longrightarrow \stackunder{A_N}{B_N}
\end{equation*}

\end{document}


• Really cool! Never heard of it before! Apr 8 at 12:36
• Thank you for your kind appreciation! Stackengine is indeed a very useful package. Apr 8 at 12:39

You may use the IEEEeqnarray* environment from the IEEEtrantools package.

\documentclass{article}
\usepackage{amsmath}
\usepackage{IEEEtrantools}

\begin{document}
\begin{IEEEeqnarray*}{c'c'c'c'c} % ' provides 1em separation between columns. You may use other glues for shorter or wider separation
A_1 & \rightarrow & A_2 & \rightarrow \dots \rightarrow & A_N \\
B_1 & & B_2 & & B_3
\end{IEEEeqnarray*}
\end{document}


• The spacing around the \to arrows isn't even. Is there a way to make the spacing more even?
– Mico
Apr 8 at 10:40
• @Mico Do you mean the spacing around the dots? That's possible using additional columns. Apr 8 at 11:27
• Thanks a lot! I wasn't aware of this! Apr 8 at 11:53
• @Imran - II was referring to the fact that there's more whitespace around the arrows in A_1 & \rightarrow & A_2 than in \rightarrow \dots \rightarrow.
– Mico
Apr 8 at 13:05
• @Mico I don't know. They should be the same though. Apr 8 at 16:23

With tabularray:

\documentclass[border=3.141592, varwidth]{standalone}
\usepackage{tabularray}

\begin{document}
$\begin{tblr}{cells=c, colsep=2pt} A_1 & \to & A_2 & \to & \cdots & \to & A_N \\ B_1 & & B_2 & & & & B_3 \end{tblr}$
\end{document}