# \ref

Used for cross-references to previously labeled equations or other numbered objects in mathematical expressions.

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Labels and tags](https://texform.dev/latex/topics/cross-refs) |
| Packages | base, textmacros |
| Allowed mode | math, text |
| Tags |  |
| Commonality | high |
| Kind | prefix |

## Syntax

### base

Argument specification: `m:N`

Used for cross-references to previously labeled equations or other numbered objects in mathematical expressions.

### textmacros

Argument specification: `m:N`

Used in prose to insert the number or tag of a labeled equation, theorem, section, or similar object by label name.

## Examples

```latex
\ref{eq1}
```

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

```latex
\ref x
```

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

```latex
\text{\ref{eq1}}
```

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

## Package variants

| Package | Argument specification | Allowed mode | Description |
| --- | --- | --- | --- |
| base | m:N | math | Used for cross-references to previously labeled equations or other numbered objects in mathematical expressions. |
| textmacros | m:N | text | Used in prose to insert the number or tag of a labeled equation, theorem, section, or similar object by label name. |

## Renderer support

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

## Usage frequency

<0.01% of formulas in the measured corpus contain this entry, rank 215 of 263 entries with frequency data.

## In TeXForm

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

## See also

- [\\eqref](https://texform.dev/latex/commands/eqref)

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \ref{a} | Positive: baseline | Pass | Fail | Pass |
| \ref a | Positive: bare[0] | Pass | Fail | Pass |
| \ref{\alpha} | Negative: neg:N[0] | Pass | Fail | Fail |

### textmacros

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \ref{a} | Positive: baseline | Pass | Fail | Pass |
| \ref a | Positive: bare[0] | Pass | Fail | Pass |
| \ref{\alpha} | Negative: neg:N[0] | Pass | Fail | Fail |
