Boxes and text\text

\textCommand

Inserting words or short phrases into mathematical expressions.

\text{a}
Available in
base, textmacros
Kind
prefix
Allowed mode
math, text
Frequency
8.70% of corpus formulasrank 6 of 263
Commonality
high
Renderer support
PackageMathJaxKaTeXXeTeX
baseMathJax: FullKaTeX: FullXeTeX: None
textmacrosMathJax: NoneKaTeX: FullXeTeX: None
About the test scope

Syntax#

\textm:T{a}text content

Argspec m:T — one mandatory argument. Same argspec in base and textmacros. Reading argspecs

Common tasks#

How to insert a word in a formula#

x=0 \text{ otherwise}

How to write a cases condition#

\begin{cases} x & \text{if } x\ge 0 \\ -x & \text{if } x<0 \end{cases}

How to write a subscript phrase that shrinks#

\text scales in subscripts; \mbox does not.

T_{\text{max}}

Examples#

base

\text b

Package variants#

PackageSignatureAllowed modeNotes
basem:TmathInserting words or short phrases into mathematical expressions.
textmacrosm:Ttext—

In TeXForm#

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

Equivalent forms#

  • \textnormal{#1}exact

    In MathJax base, both map directly to BaseMethods.HBox with no extra style or font arguments.

See also#

Test cases#

base
InputCaseMathJaxKaTeXXeTeX
\text{a}Positive · baselinePassPassFail
\text aPositive · bare[0]PassPassFail
\text{a^2}Negative · neg:T[0]PassFailFail
textmacros
InputCaseMathJaxKaTeXXeTeX
\text{a}Positive · baselineFailPassFail
\text aPositive · bare[0]FailPassFail
\text{a^2}Negative · neg:T[0]FailFailFail
All 21 in Boxes and text