# physics/named-fn-paren-expand

Expand physics power and auto-sized parenthesis arguments of standard named functions.

https://texform.dev/rules/physics/named-fn-paren-expand

## Metadata

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

## Rewrite patterns

### trig-paren

From:

```latex
\sin(#1)
```

To:

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

### trig-power-paren

From:

```latex
\sin[#1](#2)
```

To:

```latex
\sin^{#1}\left(#2\right)
```

## Examples

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

### Trig paren nested

Before:

```latex
\sin(x+(y-z)\frac{a}{b})
```

After this rule:

```latex
\sin\left(x+(y-z)\frac{a}{b}\right)
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Trig power paren

Before:

```latex
\sin[2](\frac{x}{y})
```

After this rule:

```latex
\sin^{2}\left(\frac{x}{y}\right)
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Trig paren scripted close

Before:

```latex
\cos(\frac{x}{y})^2
```

After this rule:

```latex
\cos\left(\frac{x}{y}\right)^2
```

Packages: base, ams, physics.

Rendering verified with the declared packages.

### Trig paren ordinary after

Before:

```latex
\ln(x)y
```

After this rule:

```latex
\ln\left(x\right)y
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

## Triggers

- [\\sin](https://texform.dev/latex/commands/sin)
- [\\sinh](https://texform.dev/latex/commands/sinh)
- [\\arcsin](https://texform.dev/latex/commands/arcsin)
- [\\cos](https://texform.dev/latex/commands/cos)
- [\\cosh](https://texform.dev/latex/commands/cosh)
- [\\arccos](https://texform.dev/latex/commands/arccos)
- [\\tan](https://texform.dev/latex/commands/tan)
- [\\tanh](https://texform.dev/latex/commands/tanh)
- [\\arctan](https://texform.dev/latex/commands/arctan)
- [\\csc](https://texform.dev/latex/commands/csc)
- [\\sec](https://texform.dev/latex/commands/sec)
- [\\cot](https://texform.dev/latex/commands/cot)
- [\\coth](https://texform.dev/latex/commands/coth)
- [\\log](https://texform.dev/latex/commands/log)
- [\\ln](https://texform.dev/latex/commands/ln)

## Produces

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

## Touches

- [\\sin](https://texform.dev/latex/commands/sin)
- [\\sinh](https://texform.dev/latex/commands/sinh)
- [\\arcsin](https://texform.dev/latex/commands/arcsin)
- [\\cos](https://texform.dev/latex/commands/cos)
- [\\cosh](https://texform.dev/latex/commands/cosh)
- [\\arccos](https://texform.dev/latex/commands/arccos)
- [\\tan](https://texform.dev/latex/commands/tan)
- [\\tanh](https://texform.dev/latex/commands/tanh)
- [\\arctan](https://texform.dev/latex/commands/arctan)
- [\\csc](https://texform.dev/latex/commands/csc)
- [\\sec](https://texform.dev/latex/commands/sec)
- [\\cot](https://texform.dev/latex/commands/cot)
- [\\coth](https://texform.dev/latex/commands/coth)
- [\\log](https://texform.dev/latex/commands/log)
- [\\ln](https://texform.dev/latex/commands/ln)

## 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/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/sine-to-sin](https://texform.dev/rules/physics/sine-to-sin): Collapse a bare sine helper to the standard sin 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-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/physics-operator-fence-expand](https://texform.dev/rules/physics/physics-operator-fence-expand): Expand the physics auto-sized argument of exp, det, and Pr into an explicit fence.
- [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 \trigbraces (o d()): \sin[n](...), \sinh[n](...), \arcsin[n](...), \cos[n](...), \cosh[n](...), \arccos[n](...), \tan[n](...), \tanh[n](...), \arctan[n](...), \csc[n](...), \sec[n](...), \cot[n](...), \coth[n](...), \log[n](...), \ln[n](...) get a power and an auto-sized parenthesis fence, while \sin{...} grabs nothing. The physics records hold the parentheses as a d() slot, so the parser attaches them, matching nested parentheses as xparse does, and a group that separates the name from the parenthesis, as in {\sin}(x) or \sin{}(x), keeps it literal. The rule leaves unchanged a bare name, a command that carries scripts (\sin^2(x)), and \sin[n] without following parentheses, which LaTeX prints as a literal [n] and MathJax reads as a power. Touches-only convergence: every Applied removes one physics named function with an attached parenthesis argument (the group becomes a \left(...\right) fence and any power moves into a superscript); non-matching nodes return Skipped. enabled_by_packages is pinned to physics because the base records of these names have a different structure signature (no optional power or parenthesis slot), and the active record must come from physics at runtime. 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.

## Disable this rule

```python
TransformEngine(profile="corpus", disable_rules=["physics/named-fn-paren-expand"])
```

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

[Open in Playground](https://play.texform.dev/?input=%5Csin%28x%2B%28y-z%29%5Cfrac%7Ba%7D%7Bb%7D%29)
