[Tex/LaTex] Stacking symbols

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!

Best Answer

\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}

enter image description here