Boxes and text\textrm

\textrmCommand

Roman/upright text inside math expressions, especially in older LaTeX source.

\textrm{a}
Available in
base, textmacros
Kind
prefix
Allowed mode
math, text
Frequency
1.28% of corpus formulasrank 43 of 263
Commonality
medium
Tags
presentation
Renderer support
PackageMathJaxKaTeXXeTeX
baseMathJax: FullKaTeX: FullXeTeX: Full
textmacrosMathJax: FullKaTeX: FullXeTeX: Full
About the test scope

Syntax#

\textrmm:T{a}text content

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

Common tasks#

How to write roman text inside math#

\textrm{area}(S)

How to write a roman subscript word#

\textrm is text-mode roman; \mathrm stays in math mode.

v_{\textrm{rms}}

Examples#

base

\textrm b

textmacros

\text{\textrm{a}}

Package variants#

PackageSignatureAllowed modeNotes
basem:TmathRoman/upright text inside math expressions, especially in older LaTeX source.
textmacrosm:TtextUsed to set a short span in roman text inside MathJax text mode.

In TeXForm#

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

Expands to (textmacros)#

\textrm{#1} {\rm #1}

Equivalent forms#

  • \textup{#1}exact

    MathJax maps both to BaseMethods.HBox with VARIANT.NORMAL; LaTeX NFSS distinguishes family and shape conceptually, but not here.

See also#

Test cases#

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