# physics/physics-operator-fence-expand

Expand the physics auto-sized argument of exp, det, and Pr into an explicit fence.

https://texform.dev/rules/physics/physics-operator-fence-expand

## Metadata

| Field | Value |
| --- | --- |
| Key | physics/physics-operator-fence-expand |
| Level | faithful |
| Fidelity | reading |
| Enabled by packages | physics |
| Profiles | Faithful, Corpus, Equiv |

## Rewrite patterns

### operator-brace

From:

```latex
\exp{#1}
```

To:

```latex
\exp\left\{#1\right\}
```

### operator-bracket

From:

```latex
\exp[#1]
```

To:

```latex
\exp\left[#1\right]
```

### operator-paren

From:

```latex
\exp(#1)
```

To:

```latex
\exp\left(#1\right)
```

## Examples

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

### Operator brace

Before:

```latex
\exp{\frac{x}{y}}
```

After this rule:

```latex
\exp\left\{\frac{x}{y}\right\}
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Operator bracket literal paren

Before:

```latex
\exp[\frac{x}{y}](t)
```

After this rule:

```latex
\exp\left[\frac{x}{y}\right](t)
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Operator paren

Before:

```latex
\det(\frac{A}{2})
```

After this rule:

```latex
\det\left(\frac{A}{2}\right)
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Operator paren ordinary after

Before:

```latex
\Pr(A)B
```

After this rule:

```latex
\Pr\left(A\right)B
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

## Triggers

- [\\exp](https://texform.dev/latex/commands/exp)
- [\\det](https://texform.dev/latex/commands/det)
- [\\Pr](https://texform.dev/latex/commands/Pr)

## Produces

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

## Touches

- [\\exp](https://texform.dev/latex/commands/exp)
- [\\det](https://texform.dev/latex/commands/det)
- [\\Pr](https://texform.dev/latex/commands/Pr)

## Upstream

- [ams/operatorname-to-named-function](https://texform.dev/rules/ams/operatorname-to-named-function): Rewrite plain operatorname arguments to equivalent base named-function or named-operator commands.
- [physics/probability-to-pr](https://texform.dev/rules/physics/probability-to-pr): Collapse a bare Probability helper to the standard Pr operator.

## Same family

- [ams/operatorname-to-named-function](https://texform.dev/rules/ams/operatorname-to-named-function): Rewrite plain operatorname arguments to equivalent base named-function or named-operator commands.
- [ams/idotsint-expand](https://texform.dev/rules/ams/idotsint-expand): Expand idotsint to explicit repeated integral surfaces.
- [base/limits-drop](https://texform.dev/rules/base/limits-drop): Drop explicit limits from an audited operator while preserving attached scripts.
- [base/nolimits-drop](https://texform.dev/rules/base/nolimits-drop): Drop explicit nolimits from an audited operator while preserving attached scripts.
- [physics/cosine-to-cos](https://texform.dev/rules/physics/cosine-to-cos): Collapse a bare cosine helper to the standard cos operator.
- [physics/naturallogarithm-to-ln](https://texform.dev/rules/physics/naturallogarithm-to-ln): Collapse a bare natural logarithm helper to the standard ln operator.
- [physics/probability-to-pr](https://texform.dev/rules/physics/probability-to-pr): Collapse a bare Probability helper to the standard Pr operator.
- [physics/sine-to-sin](https://texform.dev/rules/physics/sine-to-sin): Collapse a bare sine helper to the standard sin operator.
- [physics/trace-capital-to-Tr](https://texform.dev/rules/physics/trace-capital-to-Tr): Collapse a bare Trace with no following argument group to the local Tr anchor.
- [physics/trace-to-tr](https://texform.dev/rules/physics/trace-to-tr): Collapse a bare trace with no following argument group to the local tr anchor.
- [physics/named-fn-paren-expand](https://texform.dev/rules/physics/named-fn-paren-expand): Expand physics power and auto-sized parenthesis arguments of standard named functions.
- [physics/named-fn-to-operatorname](https://texform.dev/rules/physics/named-fn-to-operatorname): Rewrite physics-only named functions to operatorname and expand their auto-sized arguments.
- [physics/rank-to-operatorname-rank](https://texform.dev/rules/physics/rank-to-operatorname-rank): Rewrite rank to an explicit operatorname form instead of a package-local alias.

## Notes

Semantics follow LaTeX physics.sty 1.3. These names use \opbraces (g o d()): only the first of \exp{...}, \exp[...], \exp(...) and the matching forms of \det and \Pr becomes an auto-sized fence; later brackets or parentheses stay literal. The physics records hold that first group as one paired d<(,)><[,]><{,}> slot, so the parser attaches it, matching nested delimiters as xparse does, and a group that separates the name from the delimiter, as in {\exp}(x), keeps the delimiter literal. The rule leaves unchanged a bare name and a command that carries scripts (\det_A(x)); an unclosed delimiter is a parse error, as in LaTeX. Touches-only convergence: every Applied removes one physics operator with an attached argument (the argument becomes a \left...\right fence); non-matching nodes return Skipped. Only the physics records of these names carry that slot, so enabled_by_packages derives to physics and the rule key belongs to physics; a base-only context keeps \exp(x) unchanged. Fidelity is reading: physics closes the fence inside \mathopen{}\mathclose\bgroup...\egroup, which acts as a closing atom, while an explicit \left...\right fence is an inner atom. The explicit fence therefore adds about 1/6 em before the opening delimiter and another 1/6 em after the fence when an ordinary atom or an opening delimiter follows, about 1/3 em in the worst case; script styles show no difference. No compensating space is inserted. MathJax differs: MathJax physics hides the braces of \exp{...} and prints \exp[...] literally, while LaTeX shows auto-sized braces and brackets. In display style, LaTeX places the scripts of \det_A and \Pr_X below the operator and MathJax places them beside it; the rule does not rewrite these scripted commands.

## Disable this rule

```python
TransformEngine(profile="corpus", disable_rules=["physics/physics-operator-fence-expand"])
```

```javascript
new TransformEngine({ profile: 'corpus', disableRules: ['physics/physics-operator-fence-expand'] })
```

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