# Correct syntax for \text in math mode [duplicate]

In some contexts, I see the \text command used as follows: $A_\text B$ , which renders correctly as italics A subscripted by a roman B. However, I recall that I "read somewhere" that the proper usage is $A_\text{B}$ or even $A_{\text{B}}$. In particular, I note that importing packages like breqn introduces errors in the first and second cases.

What is correct, and why?

• Welcome to TeX.SX! Always use braces! The correct is $A_{\text{B}}$, and all others work by “accident” Nov 5 '20 at 11:35
• It's just a happy coincidence that the first two versions work. Don't rely on it and use braces. Nov 5 '20 at 11:36
• Not using braces when not needed is far more elegant. Moreover in this context you should use mathrm rather than text Nov 5 '20 at 11:41
• Actually ... \text should never even be used for this, it is the wrong command, \text does not do what you think it does, here use \$A_{\mathrm{B}} if B is suppose to be upright. Never \text for this Nov 5 '20 at 11:42
• @Blincer braces is always better than having to explain to users what it works without braces in some cases and not in other cases. Better to be consistent with the use of braces. Also no-one have guaranteed that the unbraced versions of some commands will always keep workling like that. Nov 5 '20 at 11:43