8

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.

Dave
  • 387
  • 2
    Use $\overset{\displaystyle a}{b}$ –  Apr 27 '15 at 00: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: https://tex.stackexchange.com/a/127711/137054 – Michaël van de Weerd Dec 12 '19 at 12:24

5 Answers5

10

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}

enter image description here

  • 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. – Partha D. Apr 15 '21 at 06:22
  • @ParthaD. Nice. That package developer thought of everything! ;^) – Steven B. Segletes Apr 15 '21 at 08:42
9

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

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

enter image description here

Thruston
  • 42,268
6

Does it serves for the purpose?

$_{b}^{a}$

Output: enter image description here

5

You can use

${b}^{\#}$

$\overset{\#}{b}$

For overset, you need amsmath package.

enter image description here

Cragfelt
  • 4,005
2

How about using stackrel?

\documentclass{article}

\begin{document}

Look at this: $\stackrel{*}{\Rightarrow}$

This is one way of how to put one symbol above another symbol.

\end{document}

enter image description here