I'm unable to get \sf@size to work. It's set by \ensuremath.
MWE:
\documentclass{article}
\begin{document}
\makeatletter
sf@size: {\ensuremath \sf@size}
\makeatother
A\textsuperscript{B}C
\makeatletter
A$\ensuremath{^{\mbox{\fontsize\sf@size\z@ B}}}$C
\makeatother
\end{document}
\fontsize\sf@size\z@you need\selectfontfor the font change to take effect… as done by\textsuperscript.) – ShreevatsaR Apr 25 '18 at 06:59\ensuremath.« What do you think\ensuremathdoes? – Henri Menke Apr 25 '18 at 07:41