Rewrite Rulesphysics/trace-to-tr

physics/trace-to-tr

Collapse a bare trace with no following argument group to the local tr anchor.

Rewrite patterns#

  1. bare\trace\tr

Examples#

Each example shows this rule applied in isolation. A complete normalization profile may make additional changes.

Bare#

Before

\trace\rho=1

After this rule

\tr\rho=1

Rendering verified with the declared packages.

Scripted bare#

Before

\trace_A\rho

After this rule

\tr_A\rho

Rendering verified with the declared packages.

Downstream rules#

Same family#

Notes#

In LaTeX physics.sty 1.3, \trace is \DeclareMathOperator{\trace}{tr}, while \tr is \opbraces{\trace}: a following {...}, [...], or (...) becomes an auto-sized fence after \tr but stays literal after \trace. Only the bare form is equivalent, so the rule skips \trace when its next sibling, counted by its script base, is an explicit brace group, [ or (; a \trace that carries scripts is bare because physics grabs nothing after scripts. In faithful, named-fn-to-operatorname rewrites the skipped branches to \operatorname{tr} and keeps the delimiters literal. MathJax treats both names as the same Expression, so it renders every branch alike. Touches-only convergence: every Applied removes one bare \trace; non-matching nodes return Skipped.

Disable this rule#

TransformEngine(profile="corpus", disable_rules=["physics/trace-to-tr"])
new TransformEngine({ profile: 'corpus', disableRules: ['physics/trace-to-tr'] })

Open in Playground