# Text in subscript

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

-
see the FAQ: tex.ac.uk/cgi-bin/texfaq2html?label=mathstext –  Philipp Mar 7 '11 at 1:35
@Philipp: Thanks, I hadn't read that. –  Tim N Mar 7 '11 at 1:43

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.

-
Thanks. Should I always use \text instead of \mbox? –  Tim N Mar 6 '11 at 23:01
@Tim: For text inside mathmode yes, but not in textmode. –  Martin Scharrer Mar 6 '11 at 23:06
I do not quite agree, say you want to specify the radius of a circular lake, then $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 6 '11 at 23:13
@daleif: I didn't know about \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 6 '11 at 23:19
@daleif: Good point, thanks! –  Tim N Mar 6 '11 at 23:20