# Stacking symbols

How could I stack two symbols on top of each other, so that they would appear smaller, i.e. something like \begin{array}a\\b\end{array}, but would fit nicely in a single line with the rest? So for example, I want to write blah blah blah $S(\begin{array}a\\b\end{array})$ blah blah in one single line.

Thanks a lot!

• amsmath has the smallmatrix environment for this. – egreg Jul 10 '13 at 13:42
• @egreg The smallmatrix worked perfectly! Thanks pal! =) @StevenB.Segletes - Thanks, I will wait for this! So far the small matrix suits my taste, but I am eager to also learn another method as you suggested with stackengine. Thanks a lot! =) – Eric Jul 10 '13 at 13:46
• Related: Matrix in small size – Werner Jul 10 '13 at 15:35

\documentclass{article}
\usepackage{stackengine}
\parskip 1ex
\begin{document}

Default:% 3pt gap betwen glyphs
$$c \stackanchor{a}{b} d$$

Baselineskip gap:
$$\def\stacktype{L} c \stackanchor{a}{b} d$$

Narrower vertical gap:
$$c \stackanchor[1pt]{a}{b} d$$

Bottom aligned:
$$c \stackon{a}{b} d$$

Top aligned:
$$c \stackunder{a}{b} d$$

Scriptsize:
$$c \stackanchor{\scriptstyle a}{\scriptstyle b} d$$

\end{document}


• Thanks for this. For now I just need the smallmatrix command. But I have to keep this, as I might (with high likelihood) use this as well. – Eric Jul 10 '13 at 14:07

If it's only 2 symbols, there is a nice little, convenient hack:

$S(\smash{{}^a_b})$


Basically you create an empty group to attach the subscript and superscript to and then hack the height of the box containing them (practically reducing it to zero), so it won't interfere with the lines above or below.

This has the benefit of not requiring any package.

Use with caution! :)

• Thanks for the suggestion. However, upon comparing, I am more inclined to use smallmatrix as the natural spacing seems more suitable to what I am doing. =) – Eric Jul 10 '13 at 14:08