LaTeX math mode and mbox mode
Asked Answered
D

4

14

According to a doc I found around

An \mbox within math mode does not use the current math font; rather it uses the typeface of the surrounding running text.

In math mode, I would like to write something like a_{\mbox{foo}}. If I use this, the foo will be quite big, too big. If I write a_{foo}, foo will be in italic.

What is the magic trick to have non-italic, small text?

Deciliter answered 6/8, 2009 at 15:46 Comment(0)
S
16

I personally prefer to use the \text{} command provided by the AMS-LaTeX package. To use this, you need to include the statement

\usepackage{amsmath}

somewhere in your document preamble, and then in any mathematical environment,

a_{\text{foo}}

will produce the desired output. Section 6 of the User’s Guide for the amsmath Package mentions that the \mbox{} equivalent is

a_{\mbox{\scriptsize foo}}

A final option is

a_{\mathrm{foo}}

which is what I used before I discovered AMS-LaTeX and the \text{} command.

Schmitz answered 6/8, 2009 at 15:54 Comment(0)
A
3

You can use the similar commands \mathmbox or \mathmakebox provided by the mathtools package.

Agiotage answered 4/7, 2015 at 5:21 Comment(0)
U
2

I usually use the option a_{\rm foo} since this is the shortest form I am aware of. I'm not sure if there are any caveats though. I guess the proper form is using the form a_{\text{foo}} suggested by las3rjock

Unwilling answered 12/12, 2012 at 12:29 Comment(0)
F
1

You can just type a_{\text{foo}}

I did not try, but it should work

EDIT: as las3rjock said, the \text{.} is provided by the AMS-LaTeX package. So you need to add the \usepackage{amsmath}

Forrester answered 6/8, 2009 at 15:48 Comment(2)
\text{} is a command provided by the AMS-LaTeX package, so it will not work if you don't have the statement "\usepackage{amsmath}" somewhere in your document preamble.Schmitz
Or \usepackage{amstext} if you don't want amsmath (for some reason).Agata

© 2022 - 2024 — McMap. All rights reserved.