Changing the font size dynamically

fontsize

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}

enter image description here
Obviously, I don't actually use \normalsize but e.g. \footnotesize, \small, etc.

Best Answer

The relsize package defines relative size commands. The main command is \relsize{n} with n positive or negative for larger and smaller text, respectively. There are also shortcut commands \larger and \smaller for \relsize{1} and \relsize{-1}.

To replicate the MWE the main command can be used:

\documentclass{article}
\usepackage{relsize}
\usepackage{amsmath}
\newcommand{\mytext}[0]{\text{\relsize{0}World}}
\newcommand{\mysmalltext}[0]{\text{\relsize{-1}World}}
\begin{document}
    IS:\\
    Normal: Hello $\mytext$\\
    Subscript: Hello $_\mytext$\\
    \par
    WANT:\\
    Normal: Hello World\\
    Subscript: Hello $_\text{World}$\\
    \par
    IS:\\
    Normal: Hello $\mysmalltext$\\
    Subscript: Hello $_\mysmalltext$\\
\end{document}

Result:

enter image description here