# \quantity

Used in physics-style notation to wrap an expression in automatically chosen fences, e.g. parentheses, brackets, braces, or absolute-value bars, with an empty default when no recognized delimiter follows.

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Physics: quantities](https://texform.dev/latex/topics/physics-quantities) |
| Packages | physics |
| Allowed mode | math |
| Tags |  |
| Commonality | low |
| Kind | prefix |

## Syntax

### physics

Argument specification: `d<(,)><[,]><{,}><|,|>`

Used in physics-style notation to wrap an expression in automatically chosen fences, e.g. parentheses, brackets, braces, or absolute-value bars, with an empty default when no recognized delimiter follows.

## Examples

```latex
\quantity
```

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

```latex
\quantity(a)
```

[Open in Playground](https://play.texform.dev/?input=%5Cquantity%28a%29)

```latex
\quantity[a]
```

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

```latex
\quantity{a}
```

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

```latex
\quantity|a|
```

[Open in Playground](https://play.texform.dev/?input=%5Cquantity%7Ca%7C)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| physics | full | none | full |

## In TeXForm

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

### [physics/quantity-to-qty](https://texform.dev/rules/physics/quantity-to-qty)

Collapse quantity to the shorter qty helper.

Level: authoring. Fidelity: render.

```latex
\quantity(#1)
```

→

```latex
\qty(#1)
```

```latex
\quantity(a+b)
```

→

```latex
\qty(a+b)
```

## Equivalent forms

```latex
\qty
```

exact. MathJax maps both names to the same parse method with the same parameters, including the optional paired-delimiter form and the no-argument fallback.

## See also

- [\\abs](https://texform.dev/latex/commands/abs)
- [\\absolutevalue](https://texform.dev/latex/commands/absolutevalue)
- [\\bqty](https://texform.dev/latex/commands/bqty)
- [\\Bqty](https://texform.dev/latex/commands/Bqty)
- [\\norm](https://texform.dev/latex/commands/norm)
- [\\order](https://texform.dev/latex/commands/order)
- [\\pqty](https://texform.dev/latex/commands/pqty)
- [\\qty](https://texform.dev/latex/commands/qty)
- [\\vqty](https://texform.dev/latex/commands/vqty)

## Test cases

### physics

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \quantity | Positive: baseline | Pass | Fail | Pass |
| \quantity (a) | Positive: vary:d[0] | Pass | Fail | Pass |
