Rewrite patterns#
- bare
\asin\operatorname{asin} - trig-paren
\asin(#1)\operatorname{asin}\left(#1\right) - trig-power-paren
\asin[#1](#2)\operatorname{asin}^{#1}\left(#2\right) - trig-literal-power
\asin[#1]\operatorname{asin}[#1] - operator-brace
\tr{#1}\operatorname{tr}\left\{#1\right\} - operator-bracket
\tr[#1]\operatorname{tr}\left[#1\right] - operator-paren
\tr(#1)\operatorname{tr}\left(#1\right) - plain-operator
\erf\operatorname{erf} - trace-alias
\trace\operatorname{tr} - long-name-argument
\sine(#1)\operatorname{sin}(#1)
Examples#
Each example shows this rule applied in isolation. A complete normalization profile may make additional changes.
Trig power paren nested#
The rendered result has pixel differences from the input.
Trig paren#
The rendered result has pixel differences from the input.
Trig paren ordinary after#
The rendered result has pixel differences from the input.
Trig literal power#
The rendered result has pixel differences from the input.
Trig bare#
Rendering verified with the declared packages.
Operator brace#
The rendered result has pixel differences from the input.
Remaining 9 examples#
Listed as LaTeX source. Hover over, focus, or tap a row to preview the rendering before and after. 4 render with pixel differences from the input.
| Example | Before | After this rule |
|---|---|---|
| Operator bracket literal paren Pixel differences | \Tr[\frac{A}{2}](t) | \operatorname{Tr}\left[\frac{A}{2}\right](t) |
| Operator paren Pixel differences | \tr(\frac{A}{2}) | \operatorname{tr}\left(\frac{A}{2}\right) |
| Operator subscript literal paren | \tr_A(\rho) | \operatorname{tr}_A(\rho) |
| erf literal paren Pixel differences | \erf(\frac{x}{y}) | \operatorname{erf}(\frac{x}{y}) |
| trace literal paren Pixel differences | \trace(\frac{x}{y}) | \operatorname{tr}(\frac{x}{y}) |
| trace literal brace | \trace{\frac{x}{y}} | \operatorname{tr}{\frac{x}{y}} |
| trace capital bare | \Trace\rho | \operatorname{Tr}\rho |
| Long name literal paren | \sine(\frac{x}{y}) | \operatorname{sin}(\frac{x}{y}) |
| Long name literal brace | \Probability{\frac{A}{2}} | \operatorname{Pr}{\frac{A}{2}} |
Related rules#
Upstream rules#
physics/trace-capital-to-TrCollapse a bare Trace with no following argument group to the local Tr anchor.physics/trace-to-trCollapse a bare trace with no following argument group to the local tr anchor.
Downstream rules#
ams/operatorname-to-named-functionRewrite plain operatorname arguments to equivalent base named-function or named-operator commands.
Same family#
ams/operatorname-to-named-functionRewrite plain operatorname arguments to equivalent base named-function or named-operator commands.ams/idotsint-expandExpand idotsint to explicit repeated integral surfaces.base/limits-dropDrop explicit limits from an audited operator while preserving attached scripts.base/nolimits-dropDrop explicit nolimits from an audited operator while preserving attached scripts.physics/cosine-to-cosCollapse a bare cosine helper to the standard cos operator.physics/naturallogarithm-to-lnCollapse a bare natural logarithm helper to the standard ln operator.physics/probability-to-prCollapse a bare Probability helper to the standard Pr operator.physics/sine-to-sinCollapse a bare sine helper to the standard sin operator.physics/trace-capital-to-TrCollapse a bare Trace with no following argument group to the local Tr anchor.physics/trace-to-trCollapse a bare trace with no following argument group to the local tr anchor.physics/named-fn-paren-expandExpand physics power and auto-sized parenthesis arguments of standard named functions.physics/physics-operator-fence-expandExpand the physics auto-sized argument of exp, det, and Pr into an explicit fence.physics/rank-to-operatorname-rankRewrite 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#
TransformEngine(profile="corpus", disable_rules=["physics/named-fn-to-operatorname"])new TransformEngine({ profile: 'corpus', disableRules: ['physics/named-fn-to-operatorname'] })