# \pmatrix

Typesetting a matrix with parentheses using Plain TeX syntax

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

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Matrices](https://texform.dev/latex/topics/matrices) |
| Packages | base |
| Allowed mode | math |
| Tags | discouraged |
| Commonality | medium |
| Kind | prefix |

## Syntax

### base

Argument specification: `m`

Typesetting a matrix with parentheses using Plain TeX syntax

## Examples

```latex
\pmatrix{a & b \cr c & d}
```

[Open in Playground](https://play.texform.dev/?input=%5Cpmatrix%7Ba+%26+b+%5Ccr+c+%26+d%7D)

```latex
\pmatrix a
```

[Open in Playground](https://play.texform.dev/?input=%5Cpmatrix+a)

## Renderer support

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

## In TeXForm

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

### Discouraged in base

Plain TeX command that has been superseded by LaTeX environments.

```latex
\begin{pmatrix} $1 \end{pmatrix}
```

Standard LaTeX (amsmath) convention.

### [base/pmatrix-to-pmatrix-env](https://texform.dev/rules/base/pmatrix-to-pmatrix-env)

Rewrite plain-TeX pmatrix to the standard pmatrix environment with row breaks.

Level: authoring. Fidelity: reading.

```latex
\pmatrix{#1 \cr #2}
```

→

```latex
\begin{pmatrix} #1 \\ #2 \end{pmatrix}
```

```latex
\pmatrix{a_{11} & a_{12} & 0 \cr a_{21} & a_{22} & 1 \cr 0 & 1 & \lambda}
```

→

```latex
\begin{pmatrix} a_{11} & a_{12} & 0 \\ a_{21} & a_{22} & 1 \\ 0 & 1 & \lambda \end{pmatrix}
```

## See also

- [\\array](https://texform.dev/latex/commands/array)
- [\\cases](https://texform.dev/latex/commands/cases)
- [\\displaylines](https://texform.dev/latex/commands/displaylines)
- [\\eqalign](https://texform.dev/latex/commands/eqalign)
- [\\eqalignno](https://texform.dev/latex/commands/eqalignno)
- [\\leqalignno](https://texform.dev/latex/commands/leqalignno)
- [\\matrix](https://texform.dev/latex/commands/matrix)

## Test cases

### base

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