I would like to have a command \newcommand{\restricted}[1]{...}
which doesn't allow you to call it with something like
\restricted{calling me {\bf like} this \textit{is} not allowed}
i.e., the use of \bf
, \textbf
, \tt
, and friends inside its argument should be forbidden.
Of course, I could, as suggested in Allow only certain commands in own environment, redefined all these commands to throw an error inside my command, but this would be very unelegant.
As they are all font changing commands, I hope that there is some internal command that they all call, so that locally redefining this one command can give me the behavior I want.
Unfortunately I don't know how \textbf
is implemented, couldn't find any documentation on its internal workings with google and \show\textbf
isn't very informative.
To clarify: I don't just want to suppress the effect of these macros, but really disallow them. The background is that I am writing a documentclass, and as the content of \title{}
should always look the same and is also used to automatically set pdf metadata, authors should not be able to say something like \title{\textbf{I want my title bold}}
.
\restricted{$\mathrm{a}$}
works as expected.