I strongly suspect this is a duplicate but just could not find it answered.
Specific example: I need a 1/2 in subscripts and I use _{\text\textonehalf} for that purpose (\textonehalf is from the textcomp package). But inside theorems it becomes italicized, which I would like to avoid.
Is there a canonical way to handle this?
Here is a mwe
\documentclass{amsart}
\usepackage{textcomp}
\usepackage{amsthm}
\newtheorem{Theorem}{Theorem}
\begin{document}
\begin{Theorem}
Theorem-like environments make $x_{\text\textonehalf}$ look ugly.
\end{Theorem}
\begin{proof}
Look how cool does it look outside of them: $x_{\text\textonehalf}$!
\end{proof}
\end{document}

\textexplicitly asks for the outer text font, perhaps\textupis what you are looking for. – David Carlisle Jun 15 '20 at 13:31\textis the wrong command to use. (there are so many users who apply\textas a big hammer to solve every problem) – daleif Jun 15 '20 at 14:22\textis the wrong command to use. Here you want the subscript to always be upright. But that is not what\textdoes. It typeset its contents in the font front outside math. In the theorem, the font outside math is italics and thus the output of\textis italics. Do you see my point. As I also mention you're not the first person to do this mistake. IMO this misuse is one of the most common – daleif Aug 16 '20 at 18:08