# physics/physics-ket-expand

Expand ket to an explicit bar and angle-bracket fence form.

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

## Metadata

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

## Rewrite patterns

### ket-auto-sized

From:

```latex
\ket{#1}
```

To:

```latex
\left\vert #1 \right\rangle
```

### ket-fixed-size

From:

```latex
\ket*{#1}
```

To:

```latex
\vert #1 \rangle
```

## Examples

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

### ket eigenvalue

Before:

```latex
H\ket{\psi}=E\ket{\psi}
```

After this rule:

```latex
H\left\vert \psi \right\rangle=E\left\vert \psi \right\rangle
```

Packages: base, physics.

Rendering verified with the declared packages.

### ket star fixed size

Before:

```latex
H\ket*{\psi}=E\ket*{\psi}
```

After this rule:

```latex
H\vert \psi \rangle=E\vert \psi \rangle
```

Packages: base, physics.

Rendering verified with the declared packages.

## Triggers

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

## Eliminates

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

## 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/commutator-expand](https://texform.dev/rules/physics/commutator-expand): Expand commutators to explicit square-bracket fences.
- [physics/poisson-bracket-expand](https://texform.dev/rules/physics/poisson-bracket-expand): Expand poisson brackets to explicit brace fences.

## Notes

Covers the physics star branch, where star suppresses automatic fence sizing.

## Disable this rule

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

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

[Open in Playground](https://play.texform.dev/?input=H%5Cket%7B%5Cpsi%7D%3DE%5Cket%7B%5Cpsi%7D)
