Here I use stacks to recursively place \sim
under the argument, based on the value of the optional argument. In the definition, the [1pt]
is the under-gap from the argument and the [0pt]
is the vertical separation between \sim
characters in a multi-stack. These values can be altered to suit (including being made negative).
I have not used any bold font for the tensor itself, though it could be added, if desired, to the definition, or at time of invocation.
The specification of \def\useanchorwidth{T}
says to ignore the width of the \sim
underset in setting the horizontal spacing. The only time that could be an issue is if you, for example, used adjacent invocations on narrow arguments, e.g., \tenq[2]{i}\tenq[3]{j}
. While the \useanchorwidth
line could be removed, in which case \tenq
with narrow arguments would always take up at least the width of a \scriptscriptstyle\sim
, my first step would instead be to manually add \,
space on those very rare occasions when needed.
\documentclass{article}
\usepackage{stackengine}
\stackMath
\newcommand\tenq[2][1]{%
\def\useanchorwidth{T}%
\ifnum#1>1%
\stackunder[0pt]{\tenq[\numexpr#1-1\relax]{#2}}{\scriptscriptstyle\sim}%
\else%
\stackunder[1pt]{#2}{\scriptscriptstyle\sim}%
\fi%
}
\begin{document}
\[
\tenq{\sigma}\neq\tenq[2]{\Lambda}\neq\tenq[3]{\Delta}\neq\tenq[4]{\psi}
\]
\end{document}
You can use the following "dirty" trick with \vphantom
\overset{\lambda}{R}\tensor{\vphantom{R}}{^a_b_c_d}
This works with the package \tensor
.
MWE
\documentclass{letter}
\usepackage{amsmath}
\usepackage{tensor}
\begin{document}
\[ \overset{\lambda}{R}\tensor{\vphantom{R}}{^a_b_c_d} \]
\end{document}
Best Answer
Not very beautiful, as the kerning looks different for different symbols (the double harpoon gets shorter or longer for other symbols below). But if you just need it ones, it doesn't matter. Or you define it for each symbol with different magnitude of kerning.