`\ensuremath`

`{`<*math commands*>`}`

In L^{A}TEX 2.09, if you wanted a command to work both in math mode and
in text mode, the suggested method was to define something like:

\newcommand{\Gp}{\mbox{$G_p$}}Unfortunately, the

`\mbox`

stops `\Gp`

changing size correctly in (for
instance) subscripts or a fraction.
In L\newcommand{\Gp}{\ensuremath{G_p}}Now

`\Gp`

will work correctly in all contexts.
This is because the `\ensuremath`

does nothing, producing simply
`G_p`

, when `\Gp`

is used within math mode; but it ensures that math
mode is entered (and exited) as required when `\Gp`

is used in text
mode.