# \phantom

Used to reserve space in mathematical formulas equal to the size of the argument without printing it.

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Spacing](https://texform.dev/latex/topics/spacing) |
| Packages | base, textmacros |
| Allowed mode | math, text |
| Tags | invisible, spacing |
| Commonality | medium |
| Kind | prefix |

## Syntax

### base

Argument specification: `m`

Used to reserve space in mathematical formulas equal to the size of the argument without printing it.

### textmacros

Argument specification: `m:T`

Used for manual alignment and spacing tweaks in equations.

## Examples

```latex
\phantom{x}
```

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

```latex
\text{\phantom{abc}}
```

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

## Package variants

| Package | Argument specification | Allowed mode | Description |
| --- | --- | --- | --- |
| base | m | math | Used to reserve space in mathematical formulas equal to the size of the argument without printing it. |
| textmacros | m:T | text | Used for manual alignment and spacing tweaks in equations. |

## Renderer support

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

## Usage frequency

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

## In TeXForm

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

## See also

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

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \phantom{a} | Positive: baseline | Pass | Pass | Pass |
| \phantom a | Positive: bare[0] | Pass | Pass | Pass |

### textmacros

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