# \rm

Legacy math-mode declaration for switching subsequent symbols in the current group to upright/roman.

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Fonts and styles](https://texform.dev/latex/topics/fonts-styles) |
| Packages | base, textmacros |
| Allowed mode | math, text |
| Tags | presentation, discouraged |
| Commonality | medium |
| Kind | declarative |

## Syntax

### base

Argument specification: ``

Legacy math-mode declaration for switching subsequent symbols in the current group to upright/roman.

### textmacros

Argument specification: ``

Legacy declaration that switches following text to upright/roman styling until the current group ends.

## Common tasks

### How to switch a run into roman math

Legacy switch; prefer \mathrm{d}x.

```latex
{\rm d}x
```

[Open in Playground](https://play.texform.dev/?input=%7B%5Crm+d%7Dx)

### How to write an upright label with \rm

```latex
{\rm Hom}(A,B)
```

[Open in Playground](https://play.texform.dev/?input=%7B%5Crm+Hom%7D%28A%2CB%29)

## Examples

```latex
x \rm y
```

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

```latex
{x \rm y} z
```

[Open in Playground](https://play.texform.dev/?input=%7Bx+%5Crm+y%7D+z)

```latex
\text{\rm x}
```

[Open in Playground](https://play.texform.dev/?input=%5Ctext%7B%5Crm+x%7D)

## Package variants

| Package | Argument specification | Allowed mode | Description |
| --- | --- | --- | --- |
| base |  | math | Legacy math-mode declaration for switching subsequent symbols in the current group to upright/roman. |
| textmacros |  | text | Legacy declaration that switches following text to upright/roman styling until the current group ends. |

## Renderer support

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

## Usage frequency

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

## In TeXForm

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

### Discouraged in base

Legacy declaration-style font switch; modern LaTeX prefers explicit argument-scoped math alphabet commands over plain-TeX-style switches.

```latex
{\rm $1} -> \mathrm{$1}
```

\mathrm is the modern argument-scoped math alphabet command; it avoids legacy declaration-style scope and is the standard LaTeX form.

### Discouraged in textmacros

Two-letter font commands are obsolete plain TeX syntax not officially supported in LaTeX2e. They lack proper font selection coordination (NFSS).

```latex
\textrm{$1}
```

Modern LaTeX2e command that respects current font properties and provides proper scoping.

```latex
{\rmfamily $1}
```

Modern LaTeX2e declarative equivalent.

## Equivalent forms

```latex
\mathrm{#1}
```

approximate. Prefix command alternative for math mode

```latex
\textrm{...}
```

approximate. \textrm is a command with arguments, whereas \rm is declarative.

```latex
{\rmfamily ...}
```

exact. 

## See also

- [\\bf](https://texform.dev/latex/commands/bf)
- [\\cal](https://texform.dev/latex/commands/cal)
- [\\it](https://texform.dev/latex/commands/it)
- [\\mit](https://texform.dev/latex/commands/mit)
- [\\oldstyle](https://texform.dev/latex/commands/oldstyle)
- [\\sf](https://texform.dev/latex/commands/sf)
- [\\tt](https://texform.dev/latex/commands/tt)

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| {\rm a} | Positive: baseline | Pass | Pass | Pass |

### textmacros

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| {\rm a} | Positive: baseline | Pass | Pass | Pass |
