I'd like to create a version of the command \tmb{}{}{} (for stacking 3 pieces of information in the order top, middle, bottom) from egreg's solution here that allows one to use text input as first and third arguments (instead of math formulas; writing \tmb{\text{}}{}{\text{}} repeatedly is tedious). Here's my attempt and what's wrong with it:
\documentclass{scrartcl} \usepackage{amsmath} \usepackage{mathtools} % See https://tex.stackexchange.com/questions/596113/how-to-properly-stack-three-symbols-e-g-symbols-or-text-above-and-below-conver/596116#596116 \makeatletter \newcommand{\tmb}[3]{% \mathrel{% \vbox{\offinterlineskip\m@th \ialign{% \hfil##\hfil\cr $\scriptscriptstyle#1\mathstrut$\cr \noalign{\vspace{0.3ex}} \vtop{% \ialign{% \hfil##\hfil\cr $#2$\cr $\scriptscriptstyle#3\mathstrut$\cr }% }\cr }% }% }% } \makeatother % My trial to define a version that accepts text as 1st and 3rd argument \makeatletter \newcommand{\tmbtext}[3]{% \mathrel{% \vbox{\offinterlineskip\m@th \ialign{% \hfil##\hfil\cr \tiny#1\strut\cr \noalign{\vspace{0ex}} \vtop{% \ialign{% \hfil##\hfil\cr $#2$\cr \tiny#3\strut\cr }% }\cr }% }% }% } \makeatother \begin{document} \begin{alignat*}{2} &\mathclap{\tmb{n=km}{=}{\text{def.}}} \qquad&& \text{... the original version with formulas and text above/below ``$=$''}\\ &\mathclap{\tmbtext{$n=km$}{=}{def.}} \qquad&& \text{... text version, but formula now has too much horizontal space around ``$=$''}\\ &\mathclap{\tmbtext{$\scriptstyle n=km$}{=}{def.}} \qquad&& \text{... fixes the horizontal spacing problem but providing \texttt{scriptstyle} every time is tedious} \end{alignat*} \end{document} I'd ideally like to be able to provide text or a formula enclosed in $ $ symbols (just like the second version above), but have the output displayed as in the third version (without the need to manually provide \scriptstyle or other commands). Is that possible?


$...$. What's your real aim?