# physics/quantity-to-qty

Collapse quantity to the shorter qty helper.

https://texform.dev/rules/physics/quantity-to-qty

## Metadata

| Field | Value |
| --- | --- |
| Key | physics/quantity-to-qty |
| Level | authoring |
| Fidelity | render |
| Enabled by packages | physics |
| Profiles | Authoring, Faithful, Corpus, Equiv |

## Rewrite patterns

### paren

From:

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

To:

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

### bracket

From:

```latex
\quantity[#1]
```

To:

```latex
\qty[#1]
```

### brace

From:

```latex
\quantity{#1}
```

To:

```latex
\qty{#1}
```

### vertical-bar

From:

```latex
\quantity|#1|
```

To:

```latex
\qty|#1|
```

## Examples

Examples show the rule in isolation, not a complete normalization profile.

### qty alias

Before:

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

After this rule:

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

Packages: base, physics.

Rendering verified with the declared packages.

### qty alias brace context

Before:

```latex
g=\quantity{\frac{a}{b}}
```

After this rule:

```latex
g=\qty{\frac{a}{b}}
```

Packages: base, physics.

Rendering verified with the declared packages.

### qty alias bracket context

Before:

```latex
\quantity[a+b]^{-1}
```

After this rule:

```latex
\qty[a+b]^{-1}
```

Packages: base, physics.

Rendering verified with the declared packages.

### qty alias vertical bar context

Before:

```latex
\quantity|x-y|<\varepsilon
```

After this rule:

```latex
\qty|x-y|<\varepsilon
```

Packages: base, physics.

Rendering verified with the declared packages.

## Triggers

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

## Eliminates

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

## Produces

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

## Same family

- [base/Big-class-variants-to-Big](https://texform.dev/rules/base/Big-class-variants-to-Big): Collapse \Bigl, \Bigr, \Bigm to \Big.
- [base/Bigg-class-variants-to-Bigg](https://texform.dev/rules/base/Bigg-class-variants-to-Bigg): Collapse \Biggl, \Biggr, \Biggm to \Bigg.
- [base/big-class-variants-to-big](https://texform.dev/rules/base/big-class-variants-to-big): Collapse \bigl, \bigr, \bigm to \big.
- [base/bigg-class-variants-to-bigg](https://texform.dev/rules/base/bigg-class-variants-to-bigg): Collapse \biggl, \biggr, \biggm to \bigg.
- [base/Big-delimiter-size-drop](https://texform.dev/rules/base/Big-delimiter-size-drop): Drop the fixed delimiter size imposed by \Big.
- [base/Bigg-delimiter-size-drop](https://texform.dev/rules/base/Bigg-delimiter-size-drop): Drop the fixed delimiter size imposed by \Bigg.
- [base/big-delimiter-size-drop](https://texform.dev/rules/base/big-delimiter-size-drop): Drop the fixed delimiter size imposed by \big.
- [base/bigg-delimiter-size-drop](https://texform.dev/rules/base/bigg-delimiter-size-drop): Drop the fixed delimiter size imposed by \bigg.
- [physics/absolutevalue-to-abs](https://texform.dev/rules/physics/absolutevalue-to-abs): Collapse absolutevalue to the shorter abs helper before fence expansion.
- [physics/evaluated-to-eval](https://texform.dev/rules/physics/evaluated-to-eval): Collapse evaluated to the shorter eval helper before eval expansion.
- [physics/Bqty-to-brace-fence](https://texform.dev/rules/physics/Bqty-to-brace-fence): Rewrite Bqty to explicit brace fences.
- [physics/abs-to-vert-fence](https://texform.dev/rules/physics/abs-to-vert-fence): Rewrite abs to explicit vertical bar fences.
- [physics/bqty-to-bracket-fence](https://texform.dev/rules/physics/bqty-to-bracket-fence): Rewrite bqty to explicit bracket fences.
- [physics/norm-to-double-vert-fence](https://texform.dev/rules/physics/norm-to-double-vert-fence): Rewrite norm to explicit double-vertical-bar fences.
- [physics/pqty-to-paren-fence](https://texform.dev/rules/physics/pqty-to-paren-fence): Rewrite pqty to explicit parenthesis fences.
- [physics/eval-expand](https://texform.dev/rules/physics/eval-expand): Expand eval notation to the explicit fence-and-bar form.

## Notes

This alias preserves the selected delimiter form; fence expansion belongs to qty-specific rules.

## Disable this rule

```python
TransformEngine(profile="corpus", disable_rules=["physics/quantity-to-qty"])
```

```javascript
new TransformEngine({ profile: 'corpus', disableRules: ['physics/quantity-to-qty'] })
```

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