Is there an "underscript" command?
I would recommend using \underaccent
from the accents
package. For comparison purposes I have included the output \underset
and \stackrel
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{accents}
\usepackage{xcolor}
\begin{document}
$\quad\color{blue} \text{underset: } \underset{x}{A}$
$\quad\color{black}\text{stackrel: } \stackrel{A}{x}$
$\quad\color{red} \text{underaccent: } \underaccent{x}{A}$
\end{document}
While the stackengine
package is not really designed for math mode, it can work in math mode in several ways:
if the arguments are set in math delimiters;
if the stacking macro is wrapped in a
\ensurestackMath{}
macro; orif the global invocation
\stackMath
has been issued in prior code (can be undone with\stackText
).
It gives the flexibility to control the vertical gaps (as either an interelement gap or as a baseline shift), the left-center-right alignment of the stack, whether the stack is built up or down from the anchor of the stack, whether it prints the output (or merely saves it for later use), and whether the width of the stack is defined by the widest element of the stack or merely by the width of the anchor element of the stack.
\documentclass{article}
\usepackage{stackengine}
\begin{document}
\stackengine{4pt}{$A$}{$x$}{U}{c}{F}{T}{S}
\stackengine{2pt}{$A$}{$\scriptstyle x$}{U}{c}{F}{T}{S}
\stackengine{2pt}{$A$}{$\scriptscriptstyle x$}{U}{c}{F}{T}{S}
\end{document}
The \stackengine
command is the basic command of the package with all the options to tweak. Often, a shortcut command can be used instead, for example \stackunder[2pt]{$A$}{$\scriptscriptstyle x$}
will produce the last item from above.