# \mbox

Boxing short text fragments inside math expressions without line breaking.

https://texform.dev/latex/commands/mbox

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Boxes and text](https://texform.dev/latex/topics/boxes-text) |
| Packages | base |
| Allowed mode | both |
| Tags | decoration |
| Commonality | medium |
| Kind | prefix |

## Syntax

### base

Argument specification: `m:T`

Boxing short text fragments inside math expressions without line breaking.

## Common tasks

### How to insert a short text label in math

Legacy box; \text is the LaTeX replacement and scales in subscripts.

```latex
x=0 \mbox{ if } t<0
```

[Open in Playground](https://play.texform.dev/?input=x%3D0+%5Cmbox%7B+if+%7D+t%3C0)

### How to write a subscript word that should not shrink

```latex
T_{\mbox{eff}}
```

[Open in Playground](https://play.texform.dev/?input=T_%7B%5Cmbox%7Beff%7D%7D)

## Examples

```latex
\mbox{a}
```

[Open in Playground](https://play.texform.dev/?input=%5Cmbox%7Ba%7D)

```latex
\mbox b
```

[Open in Playground](https://play.texform.dev/?input=%5Cmbox+b)

```latex
\raisebox{1ex}{\mbox{$x^2$}}
```

[Open in Playground](https://play.texform.dev/?input=%5Craisebox%7B1ex%7D%7B%5Cmbox%7B%24x%5E2%24%7D%7D)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| base | full | none | full |

## Usage frequency

2.99% of formulas in the measured corpus contain this entry, rank 21 of 263 entries with frequency data.

## In TeXForm

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

## Equivalent forms

```latex
\hbox{#1}
```

exact. In MathJax base, both map to BaseMethods.HBox with style 0.

## See also

- [\\hbox](https://texform.dev/latex/commands/hbox)
- [\\text](https://texform.dev/latex/commands/text)
- [\\textbf](https://texform.dev/latex/commands/textbf)
- [\\textit](https://texform.dev/latex/commands/textit)
- [\\textnormal](https://texform.dev/latex/commands/textnormal)
- [\\textrm](https://texform.dev/latex/commands/textrm)
- [\\textsf](https://texform.dev/latex/commands/textsf)
- [\\texttt](https://texform.dev/latex/commands/texttt)
- [\\textup](https://texform.dev/latex/commands/textup)

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \mbox{a} | Positive: baseline | Pass | Fail | Pass |
| \mbox a | Positive: bare[0] | Pass | Fail | Pass |
| \mbox{a^2} | Negative: neg:T[0] | Pass | Fail | Fail |
