# underline alignment

$$\label{eq:OrdenaAlpha} \begin{array}{lrl} \alpha^{0} = \alpha & = & (+6 \quad -1 \quad +4 \quad -5 \quad \underline{-2} \quad \underline{-3}) \\ \alpha^{1} = \alpha^{0} \circ \tau(5,6,7) & = & (+6 \quad -1 \quad \underline{+4 \quad -5 \quad -3 \quad -2}) \\ \alpha^{2} = \alpha^{1} \circ \rho(3,6) & = & (\underline{+6 \quad -1} \quad \underline{+2} \quad +3 \quad +5 \quad -4) \\ \alpha^{3} = \alpha^{2} \circ \tau(1,3,4) & = & (+2 \quad \underline{+6} \quad \underline{-1} \quad +3 \quad +5 \quad -4) \\ \alpha^{4} = \alpha^{3} \circ \tau(2,3,4) & = & (+2 \quad -1 \quad +6 \quad \underline{+3} \quad \underline{+5} \quad -4) \\ \alpha^{5} = \alpha^{4} \circ \tau(4,5,6) & = & (+2 \quad -1 \quad +6 \quad +5 \quad +3 \quad -4) \end{array}$$


Would like to use /underline and maintain alignment.

• Please don't change the question to invalidate existing answers. – egreg Sep 26 at 19:56
• Only use the additional brace group {} when you want to make the + or - a binary operator. BTW, are those signs supposed to be binary operators representing plus or minus operations, or do they indicate a negative or positive number? Want to make sure you are getting the correct spacing? For the cases where you don't have a sign, but want to align with a sign above, you need to use \underscore{\hphantom{-}...}. – Peter Grill Sep 26 at 19:57

Use \undeline{{} ...} when you want the binary spacing. Otherwise, the + (similarly a -) in \undeline{+5}, etc is treated as a unary operator.

## Code:

\documentclass{article}

\begin{document}
$$\label{eq:OrdenaAlpha} \begin{array}{lrl} \alpha^{0} = \alpha & = (+6 \quad -1 \quad +4 \quad -5 \quad \underline{{}-2} \quad \underline{{}-3}) \\ \alpha^{1} = \alpha^{0} \circ \tau(5,6,7) & = (+6 \quad -1 \quad \underline{{}+4 \quad -5 \quad -3 \quad -2}) \\ \alpha^{2} = \alpha^{1} \circ \rho(3,6) & = (\underline{+6 \quad -1} \quad \underline{{}+2} \quad +3 \quad +5 \quad -4) \\ \alpha^{3} = \alpha^{2} \circ \tau(1,3,4) & = (+2 \quad \underline{{}+6} \quad \underline{{}-1} \quad +3 \quad +5 \quad -4) \\ \alpha^{4} = \alpha^{3} \circ \tau(2,3,4) & = (+2 \quad -1 \quad +6 \quad \underline{{}+3} \quad \underline{{}+5} \quad -4) \\ \alpha^{5} = \alpha^{4} \circ \tau(4,5,6) & = (+2 \quad -1 \quad +6 \quad +5 \quad +3 \quad -4) \end{array}$$
\end{document}


I suggest a more complicated input, but with better output:

\documentclass{article}
\usepackage{amsmath,array,booktabs}

\begin{document}

$$\label{eq:OrdenaAlpha} \setlength{\arraycolsep}{0pt} \setlength{\aboverulesep}{-3pt} \renewcommand{\arraystretch}{1.5} \newcolumntype{f}{>{\kern0pt\quad\kern0pt}c} \begin{array}{ l % the powers >{{}}r<{{}} % the equals sign r<{\,} % the parenthesis *{5}{rf} % the first five values r % the last value >{\,}l % the parenthesis } \alpha^{0} = \alpha & = & (& +6 && -1 && +4 && -5 && -2 && -3 &) \\ \cmidrule{12-12}\cmidrule{14-14} \alpha^{1} = \alpha^{0} \circ \tau(5,6,7) & = & (& +6 && -1 && +4 && -5 && -3 && -2 &) \\ \cmidrule{8-14} \alpha^{2} = \alpha^{1} \circ \rho(3,6) & = & (& +6 && -1 && +2 && +3 && +5 && -4 &) \\ \cmidrule{4-6}\cmidrule{8-8} \alpha^{3} = \alpha^{2} \circ \tau(1,3,4) & = & (& +2 && +6 && -1 && +3 && +5 && -4 &) \\ \cmidrule{6-6}\cmidrule{8-8} \alpha^{4} = \alpha^{3} \circ \tau(2,3,4) & = & (& +2 && -1 && +6 && +3 && +5 && -4 &) \\ \cmidrule{10-10}\cmidrule{12-12} \alpha^{5} = \alpha^{4} \circ \tau(4,5,6) & = & (& +2 && -1 && +6 && +5 && +3 && -4 &) \end{array}$$

\end{document}


The intercolumn space is set to zero, but between any two of the values there is a phantom column 1em wide; this allows for getting the precise length of the underlines. By setting \aboverulespace to a negative value, we get it nearer the numbers. A thin space is added after ( and before ) to avoid conflicts.

The values are in columns 4, 6, 8, 10, 12 and 14.

For unsigned values, here's a possible variation using center alignment.

\documentclass{article}
\usepackage{amsmath,array,booktabs}

\begin{document}

$$\setlength{\arraycolsep}{0pt} \setlength{\aboverulesep}{-3pt} \renewcommand{\arraystretch}{1.5} \newcolumntype{f}{>{\kern0pt\quad\kern0pt}c} \begin{array}{ l % the powers >{{}}r<{{}} % the equals sign r<{\,} % the parenthesis *{5}{cf} % the first five values c % the last value >{\,}l % the parenthesis } \alpha^{0} = \alpha & = & (& 2 && 4 && 6 && 1 && 5 && 3 &) \\ \cmidrule{4-4} \alpha^{1} = \alpha^{0} \circ \rho(1,1) & = & (& -2 && 4 && 6 && 1 && 5 && 3 &) \\ \cmidrule{12-14} \alpha^{2} = \alpha^{1} \circ \rho(5,5) & = & (& -2 && 4 && 6 && 1 && -5 && 3 &) \\ \cmidrule{14-14} \alpha^{3} = \alpha^{2} \circ \rho(6,6) & = & (& -2 && 4 && 6 && 1 && -5 && -3 &) \\ \cmidrule{10-12} \alpha^{4} = \alpha^{3} \circ \rho(4,5) & = & (& -2 && 4 && 6 && 5 && -1 && -3 &) \\ \cmidrule{4-4}\cmidrule{6-6}\cmidrule{8-8} \alpha^{5} = \alpha^{4} \circ \rho(2,4) & = & (& -2 && -5 && -6 && -4 && -1 && -3 &) \\ \cmidrule{4-8} \alpha^{6} = \alpha^{5} \circ \rho(1,3) & = & (& 6 && 5 && 2 && -4 && -1 && -3 &) \\ \cmidrule{10-14} \alpha^{7} = \alpha^{6} \circ \rho(4,6) & = & (& 6 && 5 && 2 && 3 && 1 && 4 &) \end{array}$$

\end{document}