# \pmat

Shorthand for generating 2×2 Pauli matrices in quantum mechanics and quantum computing contexts within matrix environments

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

## Metadata

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

## Syntax

### physics

Argument specification: `m`

Shorthand for generating 2×2 Pauli matrices in quantum mechanics and quantum computing contexts within matrix environments

## Examples

```latex
\pmat{2}
```

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

```latex
\pmat{y}
```

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

## Renderer support

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

## In TeXForm

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

### Expands to (physics)

```latex
\pmat{2}
```

→

```latex
2 0 & -i\\ i & 0
```

Rewrites parser string with Pauli matrix content based on first character: 0→identity, 1/x→σ_x, 2/y→σ_y, 3/z→σ_z. Rest of argument is prepended to matrix.

## Equivalent forms

```latex
\paulimatrix{2}
```

exact. Full name for \pmat

## See also

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

## Test cases

### physics

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