I think this is a follow-up to How to capture the current math style?.
In this MWE, \bm{\testbox}
works when used after \testbox
. But it does not work on its own (commented line):
\documentclass{article}
\usepackage{scalerel,bm}
\newcommand{\testbox}{\ThisStyle{\mbox{$\SavedStyle X$}}}
\begin{document}
$\testbox \bm{\testbox}$
% $\bm{\testbox}$
\end{document}
The error is:
! Undefined control sequence.
\ThisStyle #1->\ifmmode \def \@mmode
{T}\mathchoice {\edef \m@switch {D}\LMe...
l.6 $\bm{\testbox}
What am I doing wrong?
Edit: I have found out that this works:
$\ThisStyle{\@gobble\SavedStyle} \bm{\testbox}$
But I have no idea, why :)