# \braket

Used for bra-ket notation in quantum mechanics with fixed-size angle brackets.

https://texform.dev/latex/commands/braket

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Physics: bra-ket](https://texform.dev/latex/topics/physics-braket) |
| Packages | braket, physics |
| Allowed mode | math |
| Tags |  |
| Commonality | low |
| Kind | prefix |

## Syntax

### braket

Argument specification: `m`

Used for bra-ket notation in quantum mechanics with fixed-size angle brackets.

### physics

Argument specification: `s m g`

Used in quantum-mechanical bra-ket notation to typeset bra-ket inner products.

## Examples

```latex
\braket{\psi}
```

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

```latex
\braket{\psi | \phi}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbraket%7B%5Cpsi+%7C+%5Cphi%7D)

```latex
\braket{\phi | A | \psi}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbraket%7B%5Cphi+%7C+A+%7C+%5Cpsi%7D)

```latex
\braket{a}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbraket%7Ba%7D)

```latex
\braket{a}{b}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbraket%7Ba%7D%7Bb%7D)

```latex
\braket*{a}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbraket*%7Ba%7D)

```latex
\braket*{a}{b}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbraket*%7Ba%7D%7Bb%7D)

## Package variants

| Package | Argument specification | Allowed mode | Description |
| --- | --- | --- | --- |
| braket | m | math | Used for bra-ket notation in quantum mechanics with fixed-size angle brackets. |
| physics | s m g | math | Used in quantum-mechanical bra-ket notation to typeset bra-ket inner products. |

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| braket | full | full | none |
| physics | full | full | full |

## In TeXForm

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

### [physics/physics-braket-expand](https://texform.dev/rules/physics/physics-braket-expand)

Expand braket to an explicit angle-bracket form with a middle bar.

Level: faithful. Fidelity: render.

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

→

```latex
\left\langle #1 \middle\vert #2 \right\rangle
```

```latex
\braket{\psi_n}{\psi_m}=\delta_{nm}
```

→

```latex
\left\langle \psi_n \middle\vert \psi_m \right\rangle=\delta_{nm}
```

## Equivalent forms

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

exact. Alias implemented by the same parse method; the same optional star and optional second braced group are also accepted.

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

exact. Alias implemented by the same parse method; if the second braced group is omitted, MathJax duplicates #1 as the ket.

## See also

- [\\Braket](https://texform.dev/latex/commands/Braket)
- [\\innerproduct](https://texform.dev/latex/commands/innerproduct)
- [\\ip](https://texform.dev/latex/commands/ip)
- [\\set](https://texform.dev/latex/commands/set)
- [\\Set](https://texform.dev/latex/commands/Set)

## Test cases

### braket

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \braket{a} | Positive: baseline | Pass | Pass | Fail |
| \braket a | Positive: bare[0] | Pass | Pass | Fail |

### physics

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \braket{a} | Positive: baseline | Pass | Pass | Pass |
| \braket*{a} | Positive: vary:s[0] | Pass | Pass | Pass |
| \braket{a}{b} | Positive: vary:g[2] | Pass | Pass | Pass |
| \braket*{a}{b} | Positive: maximal | Pass | Pass | Pass |
| \braket a | Positive: bare[1] | Pass | Pass | Pass |
