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.
- 387
5 Answers
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}

- 237,551
-
As a customization, I found an optional [gap] parameter after the
\stackon,\stackunderor\stackanchorcommands. E.g. I used\newcommand{\lgeq}{\stackon[2pt]{\stackunder[0pt]{=}{<}}{>}}to get something like this. Of course that was inmathmode-- using\stackMathafter loading the packagestackengine. – 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
If you can cope with a bit of plain TeX syntax, you can just do this.
Put $a$ over $b$: $a \atop b$

- 42,268
-
4A little short. Package
amsmathis needed for\oversetand#will not work out of the box, use\#instead. – Heiko Oberdiek Jul 25 '17 at 19:26 -
oversetis explicitly not what OP want because the 2 symbols size are not equal though. – user202729 May 23 '23 at 01:49
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}
- 21
-
1Welcome to TeX.SE! It would be nice if you could extend the code into a small, complete example that can compile so future readers can copy and paste your solution as it is, i.e. your
\documentclass{}and end with\end{document}, a Minimal Working Example (MWE) please , helps improve the site :) – JamesT May 22 '23 at 11:08 -
1Just like
overset, this is not what OP want because the 2 symbols size are not equal. This would be an appropriate answer for syntax - How do I put text over symbols? - TeX - LaTeX Stack Exchange... but the top answer there already mentionstackrel. – user202729 May 23 '23 at 01:49



$\overset{\displaystyle a}{b}$– Apr 27 '15 at 00:57