# physics/commutator-expand

Expand commutators to explicit square-bracket fences.

https://texform.dev/rules/physics/commutator-expand

## Metadata

| Field | Value |
| --- | --- |
| Key | physics/commutator-expand |
| Level | faithful |
| Fidelity | render |
| Enabled by packages | physics |
| Profiles | Faithful, Corpus, Equiv |

## Rewrite patterns

### commutator-auto-sized

From:

```latex
\comm{#1}{#2}
```

To:

```latex
\left[#1,#2\right]
```

### commutator-fixed-size

From:

```latex
\comm*{#1}{#2}
```

To:

```latex
[#1,#2]
```

## Examples

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

### Commutator angular momentum

Before:

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

After this rule:

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

Packages: base, physics.

Rendering verified with the declared packages.

### Commutator star fixed size

Before:

```latex
\comm*{A}{B}=0
```

After this rule:

```latex
[A,B]=0
```

Packages: base, physics.

Rendering verified with the declared packages.

## Triggers

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

## Eliminates

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

## Produces

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

## Same family

- [physics/expectation-expand](https://texform.dev/rules/physics/expectation-expand): Expand expectation-value helpers to explicit angle brackets.
- [physics/matrixel-expand](https://texform.dev/rules/physics/matrixel-expand): Expand matrix elements to explicit angle-bracket and bar fences.
- [physics/physics-bra-expand](https://texform.dev/rules/physics/physics-bra-expand): Expand bra to an explicit angle-bracket and bar fence form.
- [physics/physics-braket-expand](https://texform.dev/rules/physics/physics-braket-expand): Expand braket to an explicit angle-bracket form with a middle bar.
- [physics/physics-ket-expand](https://texform.dev/rules/physics/physics-ket-expand): Expand ket to an explicit bar and angle-bracket fence form.
- [physics/poisson-bracket-expand](https://texform.dev/rules/physics/poisson-bracket-expand): Expand poisson brackets to explicit brace fences.

## 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

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

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

[Open in Playground](https://play.texform.dev/?input=%5Ccomm%7BL_x%7D%7BL_y%7D%3Di%5Chbar+L_z)
