Rewrite Rulesphysics/commutator-expand

physics/commutator-expand

Expand commutators to explicit square-bracket fences.

Rewrite patterns#

  1. commutator-auto-sized\comm{#1}{#2}\left[#1,#2\right]
  2. commutator-fixed-size\comm*{#1}{#2}[#1,#2]

Examples#

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

Commutator angular momentum#

Before

\comm{L_x}{L_y}=i\hbar L_z

After this rule

\left[L_x,L_y\right]=i\hbar L_z

Rendering verified with the declared packages.

Commutator star fixed size#

Before

\comm*{A}{B}=0

After this rule

[A,B]=0

Rendering verified with the declared packages.

Same family#

Notes#

Covers the star branch, where star suppresses automatic fence sizing. Explicit big-size control after the command is parsed by MathJax but is outside the current argspec metadata and is outside this rule’s rewrite.

Disable this rule#

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

Open in Playground