# physics/named-fn-to-operatorname

Rewrite physics-only named functions to operatorname and expand their auto-sized arguments.

https://texform.dev/rules/physics/named-fn-to-operatorname

## Metadata

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

## Rewrite patterns

### bare

From:

```latex
\asin
```

To:

```latex
\operatorname{asin}
```

### trig-paren

From:

```latex
\asin(#1)
```

To:

```latex
\operatorname{asin}\left(#1\right)
```

### trig-power-paren

From:

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

To:

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

### trig-literal-power

From:

```latex
\asin[#1]
```

To:

```latex
\operatorname{asin}[#1]
```

### operator-brace

From:

```latex
\tr{#1}
```

To:

```latex
\operatorname{tr}\left\{#1\right\}
```

### operator-bracket

From:

```latex
\tr[#1]
```

To:

```latex
\operatorname{tr}\left[#1\right]
```

### operator-paren

From:

```latex
\tr(#1)
```

To:

```latex
\operatorname{tr}\left(#1\right)
```

### plain-operator

From:

```latex
\erf
```

To:

```latex
\operatorname{erf}
```

### trace-alias

From:

```latex
\trace
```

To:

```latex
\operatorname{tr}
```

### long-name-argument

From:

```latex
\sine(#1)
```

To:

```latex
\operatorname{sin}(#1)
```

## Examples

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

### Trig power paren nested

Before:

```latex
\asin[2](x(y+z)\frac{a}{b})
```

After this rule:

```latex
\operatorname{asin}^{2}\left(x(y+z)\frac{a}{b}\right)
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Trig paren

Before:

```latex
\sech(\frac{x}{y})
```

After this rule:

```latex
\operatorname{sech}\left(\frac{x}{y}\right)
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Trig paren ordinary after

Before:

```latex
\csch(x)y
```

After this rule:

```latex
\operatorname{csch}\left(x\right)y
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Trig literal power

Before:

```latex
\asin[2]x
```

After this rule:

```latex
\operatorname{asin}[2]x
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Trig bare

Before:

```latex
\csch x
```

After this rule:

```latex
\operatorname{csch} x
```

Packages: base, ams, physics.

Rendering verified with the declared packages.

### Operator brace

Before:

```latex
\tr{\frac{A}{2}}
```

After this rule:

```latex
\operatorname{tr}\left\{\frac{A}{2}\right\}
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Operator bracket literal paren

Before:

```latex
\Tr[\frac{A}{2}](t)
```

After this rule:

```latex
\operatorname{Tr}\left[\frac{A}{2}\right](t)
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Operator paren

Before:

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

After this rule:

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

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### Operator subscript literal paren

Before:

```latex
\tr_A(\rho)
```

After this rule:

```latex
\operatorname{tr}_A(\rho)
```

Packages: base, ams, physics.

Rendering verified with the declared packages.

### erf literal paren

Before:

```latex
\erf(\frac{x}{y})
```

After this rule:

```latex
\operatorname{erf}(\frac{x}{y})
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### trace literal paren

Before:

```latex
\trace(\frac{x}{y})
```

After this rule:

```latex
\operatorname{tr}(\frac{x}{y})
```

Packages: base, ams, physics.

The rendered result has pixel differences from the input.

### trace literal brace

Before:

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

After this rule:

```latex
\operatorname{tr}{\frac{x}{y}}
```

Packages: base, ams, physics.

Rendering verified with the declared packages.

### trace capital bare

Before:

```latex
\Trace\rho
```

After this rule:

```latex
\operatorname{Tr}\rho
```

Packages: base, ams, physics.

Rendering verified with the declared packages.

### Long name literal paren

Before:

```latex
\sine(\frac{x}{y})
```

After this rule:

```latex
\operatorname{sin}(\frac{x}{y})
```

Packages: base, ams, physics.

Rendering verified with the declared packages.

### Long name literal brace

Before:

```latex
\Probability{\frac{A}{2}}
```

After this rule:

```latex
\operatorname{Pr}{\frac{A}{2}}
```

Packages: base, ams, physics.

Rendering verified with the declared packages.

## Triggers

- [\\asin](https://texform.dev/latex/commands/asin)
- [\\acos](https://texform.dev/latex/commands/acos)
- [\\atan](https://texform.dev/latex/commands/atan)
- [\\csch](https://texform.dev/latex/commands/csch)
- [\\arccsc](https://texform.dev/latex/commands/arccsc)
- [\\acsc](https://texform.dev/latex/commands/acsc)
- [\\sech](https://texform.dev/latex/commands/sech)
- [\\arcsec](https://texform.dev/latex/commands/arcsec)
- [\\asec](https://texform.dev/latex/commands/asec)
- [\\arccot](https://texform.dev/latex/commands/arccot)
- [\\acot](https://texform.dev/latex/commands/acot)
- [\\tr](https://texform.dev/latex/commands/tr)
- [\\Tr](https://texform.dev/latex/commands/Tr)
- [\\erf](https://texform.dev/latex/commands/erf)
- [\\trace](https://texform.dev/latex/commands/trace)
- [\\Trace](https://texform.dev/latex/commands/Trace)
- [\\sine](https://texform.dev/latex/commands/sine)
- [\\cosine](https://texform.dev/latex/commands/cosine)
- [\\naturallogarithm](https://texform.dev/latex/commands/naturallogarithm)
- [\\Probability](https://texform.dev/latex/commands/Probability)

## Eliminates

- [\\asin](https://texform.dev/latex/commands/asin)
- [\\acos](https://texform.dev/latex/commands/acos)
- [\\atan](https://texform.dev/latex/commands/atan)
- [\\csch](https://texform.dev/latex/commands/csch)
- [\\arccsc](https://texform.dev/latex/commands/arccsc)
- [\\acsc](https://texform.dev/latex/commands/acsc)
- [\\sech](https://texform.dev/latex/commands/sech)
- [\\arcsec](https://texform.dev/latex/commands/arcsec)
- [\\asec](https://texform.dev/latex/commands/asec)
- [\\arccot](https://texform.dev/latex/commands/arccot)
- [\\acot](https://texform.dev/latex/commands/acot)
- [\\tr](https://texform.dev/latex/commands/tr)
- [\\Tr](https://texform.dev/latex/commands/Tr)
- [\\erf](https://texform.dev/latex/commands/erf)
- [\\trace](https://texform.dev/latex/commands/trace)
- [\\Trace](https://texform.dev/latex/commands/Trace)

## Produces

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

## Touches

- [\\sine](https://texform.dev/latex/commands/sine)
- [\\cosine](https://texform.dev/latex/commands/cosine)
- [\\naturallogarithm](https://texform.dev/latex/commands/naturallogarithm)
- [\\Probability](https://texform.dev/latex/commands/Probability)

## Upstream

- [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.

## Downstream

- [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.

## 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/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. None of the short names here has a base command, so each one becomes \operatorname with its printed name (\trace and \Trace print tr and Tr). Trig-family names use \trigbraces (o d()): \asin[n](...), \acos[n](...), \atan[n](...), \csch[n](...), \arccsc[n](...), \acsc[n](...), \sech[n](...), \arcsec[n](...), \asec[n](...), \arccot[n](...), \acot[n](...) get a power and an auto-sized parenthesis fence, and \asin[n] without following parentheses keeps [n] as literal text. \tr{...}, \tr[...], \tr(...), \Tr{...}, \Tr[...], and \Tr(...) use \opbraces (g o d()): only the first group becomes an auto-sized fence. The physics records hold the grabbed group as a d() or paired d<(,)><[,]><{,}> slot, so the parser attaches it. \erf, \trace, and \Trace are plain \DeclareMathOperator commands, so following delimiters stay literal. A command that carries scripts (\tr_A(\rho)) is renamed without grabbing an argument. The long names \sine, \cosine, \naturallogarithm, and \Probability are the original operators saved with \let, so they grab nothing either; the rule rewrites them to \operatorname{sin}, \operatorname{cos}, \operatorname{ln}, and \operatorname{Pr} only when (, [, or a brace group follows, where the short command would grab it. Bare long names are left to the authoring aliases (sine-to-sin, cosine-to-cos, naturallogarithm-to-ln, probability-to-pr), so the long names are touches: every Applied on them removes one long name followed by an argument opener, and bare long names return Skipped. 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 treats \asin[2]x as a power, auto-sizes \erf(...) and \trace(...), hides the braces of \tr{...}, and prints \tr[...] literally.

## Disable this rule

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

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

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