# \smash

Used to suppress an expression’s height and/or depth so it does not affect surrounding layout, such as line spacing or delimiter sizing.

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

## Metadata

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

## Syntax

### base

Argument specification: `O{}:N m`

Used to suppress an expression’s height and/or depth so it does not affect surrounding layout, such as line spacing or delimiter sizing.

### textmacros

Argument specification: `O{}:N m:T`

Used to typeset content while suppressing its recorded height/depth, often to prevent tall or deep material from affecting line spacing or box measurements in text.

## Examples

```latex
\smash{x}
```

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

```latex
\smash[t]{x}
```

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

```latex
\smash[b]{x}
```

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

```latex
\text{\smash{a}}
```

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

```latex
\text{\smash[t]{a}}
```

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

```latex
\text{\smash[b]{a}}
```

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

## Package variants

| Package | Argument specification | Allowed mode | Description |
| --- | --- | --- | --- |
| base | O{}:N m | math | Used to suppress an expression’s height and/or depth so it does not affect surrounding layout, such as line spacing or delimiter sizing. |
| textmacros | O{}:N m:T | text | Used to typeset content while suppressing its recorded height/depth, often to prevent tall or deep material from affecting line spacing or box measurements in text. |

## Renderer support

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

## Usage frequency

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

## In TeXForm

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

## Test cases

### base

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \smash{a} | Positive: baseline | Pass | Pass | Pass |
| \smash[a]{b} | Positive: vary:o[0] | Pass | Pass | Pass |
| \smash a | Positive: bare[1] | Pass | Pass | Pass |
| \smash[\alpha]{a} | Negative: neg:N[0] | Pass | Pass | Pass |

### textmacros

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \smash{a} | Positive: baseline | Pass | Pass | Pass |
| \smash[a]{b} | Positive: vary:o[0] | Pass | Pass | Pass |
| \smash a | Positive: bare[1] | Pass | Pass | Pass |
| \smash[\alpha]{a} | Negative: neg:N[0] | Pass | Fail | Fail |
| \smash{a^2} | Negative: neg:T[1] | Fail | Fail | Fail |
