For my text-in-mathmode needs in LaTeX, I use \mbox. However, it does not seem to behave well in subscripts. How can I write text that adjusts its height?
$ 3 \mbox{dB} = f_{ 3 \mbox{dB} } $
compiles to

For my text-in-mathmode needs in LaTeX, I use \mbox. However, it does not seem to behave well in subscripts. How can I write text that adjusts its height?
$ 3 \mbox{dB} = f_{ 3 \mbox{dB} } $
compiles to

Use the \text macro of the amsmath package instead of \mbox for general text in mathmode. It takes care of these issues.
Note that for units in math- or textmode the use of the siunitx package is highly recommended.
$R_{\textup{lake}}$ would be a better choice. Why try setting it in an italic context. So for named indices I'd use \textup, one could use \mathrm or \textrm, but then what if one is using a sans serif context, so in these cases \textup (i.e. non italic text font) is better. But for general comments in math, \text is the right choice
– daleif
Mar 06 '11 at 23:13
\textup which seems to be a nice alternative to \text. I was talking more about the general case in \mbox vs. \text where \text (or its friends) should always be used.
– Martin Scharrer
Mar 06 '11 at 23:19
\text is the correct thing to use. In my (Danish) LaTeX book we have an 'evil' macro such that X_|text| equals X_{\textup}. Another reason for using \textup over, say, \mathrm is that \textup support national letters, whereas \mathrm does not. Lake in Danish is s\o{} and \o is not allowed in math.
– daleif
Mar 06 '11 at 23:56
\textup is also not optimal; it'll be bold in a bold context. I guess \textnormal is better.
– Hendrik Vogt
Feb 15 '13 at 20:22
\text here.
– Hendrik Vogt
Feb 15 '13 at 20:24
\text is for text :-) such as \text{if} and \text{otherwise} in a cases environment. See also this recent question of mine.
– Hendrik Vogt
Feb 16 '13 at 09:15
:-) But would you want the subscript to change from upright to italic, depending on the context? At least in my field that's highly undesirable!
– Hendrik Vogt
Feb 16 '13 at 09:34