For my document I have some commands that write a bit of text in a different font-size. This works fine until I want to set this text as subscript. The text generated by my command then has the same absolute size in both cases (as expected).
Is there a way to modify my command in a way that it changes the size according to whether it is in normal script or subscript? I could have different commands for subscript and normal but then I would have to find adequate sizes for the subscript and my commands list would blow up even more.
MWE:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\mytext}[0]{\text{\normalsize{World}}}
\begin{document}
IS:\\
Normal: Hello $\mytext$\\
Subscript: Hello $_\mytext$\\
\par
WANT:\\
Normal: Hello World\\
Subscript: Hello $_\text{World}$
\end{document}
Obviously, I don't actually use \normalsize
but e.g. \footnotesize
, \small
, etc.
\larger
and\smaller
, which are relative to the current size.\normalsize{argument}
is incorrect,\normalsize
is a switch that does not take arguments. It has local scope in a group (here the scope is the\text
command) so you don't get any side effects in this particular case, but what happens is that\normalsize
changes the font size for everything inside the scope and{}
is ignored. So correct is{\normalsize World}
which explicitly sets the scope around the switch and does not use arguments.