# Three stacked lines not evenly distributed

I'm having some small spacing glitches with this stack, and I'm wondering about the best way to do this:

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{tensor}

\begin{document}

$$A_{\mu \nu \lambda} + \left[ \: \substack{ \mu \; \rightarrow \; \lambda \\ \nu \; \rightarrow \; \mu \\ \lambda \; \rightarrow \; \nu } \: \right] + \left[ \: \substack{ \mathstrut \smash{\mu \; \rightarrow \; \nu} \\ \mathstrut \smash{\nu \; \rightarrow \; \lambda} \\ \mathstrut \smash{\lambda \; \rightarrow \; \mu} } \: \right]$$

\end{document}


Preview:

As you can see on the preview, the second part has variable vertical spacings (mostly because of the lambda symbol), which I find very ugly. I hacked it (last part) by smashing everything and added a phantom vertical space (using \mathstrut). But is there a better or simpler way of doing this? How can I get a better result?

• Is there a reason to use \substack instead of something like an array? – Vincent Jul 24 '20 at 17:14
• @Vincent, No. Array could do it too. Maybe I should try it. – Cham Jul 24 '20 at 17:17
• Hmmm, array gives something too big. I need all the indices to stay of the same size – Cham Jul 24 '20 at 17:20

I think you're abusing the \substack machinery by employing it in a situation it clearly wasn't meant to be used in.

I suggest you employ either a bmatrix environment or a bsmallmatrix environment; if you choose the latter, be sure to employ \mathstrut directives in all rows too.

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[total={6in,10in},
left=1.5in,top=0.5in,
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}% for 'bsmallmatrix' env.
\usepackage{tensor}

\begin{document}
\begin{gather*}
%% Row 1: \left[ \substac{ ... } \right]
A_{\mu \nu \lambda} +
\left[ \: \substack{
\mu \; \rightarrow \; \lambda \\
\nu \; \rightarrow \; \mu \\
\lambda \; \rightarrow \; \nu
} \: \right] +
\left[ \: \substack{
\mathstrut \smash{\mu \; \rightarrow \; \nu} \\
\mathstrut \smash{\nu \; \rightarrow \; \lambda} \\
\mathstrut \smash{\lambda \; \rightarrow \; \mu}
} \: \right]\\
%% Row 2: bmatrix environment
A_{\mu \nu \lambda} +
\begin{bmatrix}
\mu \to \lambda \\
\nu \to \mu \\
\lambda \to \nu
\end{bmatrix} +
\begin{bmatrix}
\mu \to \nu \\
\nu \to \lambda \\
\lambda \to \mu
\end{bmatrix}\\
%% Row 3: bsmallmatrix environment
A_{\mu \nu \lambda} +
\begin{bsmallmatrix}
\mu \to \lambda \mathstrut\\
\nu \to \mu \mathstrut\\
\lambda \to \nu\mathstrut
\end{bsmallmatrix} +
\begin{bsmallmatrix}
\mu \to \nu \mathstrut\\
\nu \to \lambda \mathstrut\\
\lambda \to \mu \mathstrut
\end{bsmallmatrix}
\end{gather*}

\end{document}


You could use an array where the entries are in \scriptstyle.

\documentclass[11pt]{article}
\usepackage{lmodern}
\usepackage{mathtools}
\usepackage{array}
\begin{document}
$\renewcommand{\arraystretch}{0.55} A_{\mu \nu \lambda} + \biggl[ \begin{array}{@{\,}>{\scriptstyle}c@{\,}} \mu \; \rightarrow \; \lambda \\ \nu \; \rightarrow \; \mu \\ \lambda \; \rightarrow \; \nu \end{array} \biggr]$
\end{document}


You can use an array in \scriptsize.

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{tensor}

\newenvironment{scriptarray}[2][c]
{%
\mathord{}% just to ensure this is used in math
\hbox\bgroup\scriptsize$\begin{array}[#1]{#2}% } {% \end{array}$\egroup
}

\begin{document}

$$A_{\mu \nu \lambda} + \left[ \begin{scriptarray}{@{}c@{}} \mu \rightarrow \lambda \\ \nu \rightarrow \mu \\ \lambda \rightarrow \nu \end{scriptarray} \right]$$

\end{document}