# How to put one symbol (number) above another

I'd like to put one symbol over another? There are some similar things in math, like $\binom{a}{b}$, but I don't want the parentheses, or $\frac{a}{b}$ without the division line. The closest I've found is $\overset{a}{b}$ (from mathtools) but the a ends up smaller than the b.

• Use $\overset{\displaystyle a}{b}$
– user11232
Apr 27 '15 at 0:57
• I came upon this question looking for the notation of the binomial coefficient, which is similar to OP's request although wrapped in parentheses. If found the answer to my question over here: tex.stackexchange.com/a/127711/137054 Dec 12 '19 at 12:24

Does it serves for the purpose?

$_{b}^{a}$


Output:

Just to give the OP different options, here I show the basic features of the stackengine approach to stacking, with the first column as a \stackon, the second as a \stackunder and the third as a \stackanchor. The first row uses "short" stacks, in which the gap between the top of one element and the bottom of the element above it are fixed, whereas the second row uses "long" stacks, in which the baseline skip between adjacent rows is fixed.

While I don't show it here, the default gaps and baseline skips may be redefined, or simply passed as an optional argument.

\documentclass{article}
\usepackage{stackengine}
\stackMath
\begin{document}
% \def\stacktype{S}% DEFAULT TYPE, constant gap between stacked elements
$x \stackon{g}{b} y \stackon{b}{g} z\quad x \stackunder{g}{b} y \stackunder{b}{g} z\quad x \stackanchor{g}{b} y \stackanchor{b}{g} z$
\def\stacktype{L}% constant baselineskip between stacked elements
$x \stackon{g}{b} y \stackon{b}{g} z\quad x \stackunder{g}{b} y \stackunder{b}{g} z\quad x \stackanchor{g}{b} y \stackanchor{b}{g} z$
\end{document}


• As a customization, I found an optional [gap] parameter after the \stackon, \stackunder or \stackanchor commands. E.g. I used \newcommand{\lgeq}{\stackon[2pt]{\stackunder[0pt]{=}{<}}{>}} to get something like this. Of course that was in math mode-- using \stackMath after loading the package stackengine. Apr 15 '21 at 6:22
• @ParthaD. Nice. That package developer thought of everything! ;^) Apr 15 '21 at 8:42

If you can cope with a bit of plain TeX syntax, you can just do this.

Put $a$ over $b$: $a \atop b$


You can use

${b}^{\#}$

$\overset{\#}{b}$


For overset, you need amsmath package.

• A little short. Package amsmath is needed for \overset and # will not work out of the box, use \# instead. Jul 25 '17 at 19:26