# \mqty

Used as the short physics-package command for matrix quantities, with optional parentheses, brackets, braces-as-input, or vertical bars around the matrix body.

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

## Metadata

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

## Syntax

### physics

Argument specification: `s d<(,)><[,]><{,}><|,|>`

Used as the short physics-package command for matrix quantities, with optional parentheses, brackets, braces-as-input, or vertical bars around the matrix body.

## Examples

```latex
\mqty
```

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

```latex
\mqty{a}
```

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

```latex
\mqty(a)
```

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

```latex
\mqty*(a)
```

[Open in Playground](https://play.texform.dev/?input=%5Cmqty*%28a%29)

```latex
\mqty[a]
```

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

```latex
\mqty|a|
```

[Open in Playground](https://play.texform.dev/?input=%5Cmqty%7Ca%7C)

## 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
\mqty(#1)
```

→

```latex
\left(\begin{array}{} #1\end{array}\right)
```

Source constructs and reparses this macro string. Other branches use \begin{array}{} #1\end{array} for {#1}, bracket or vertical-bar \left...\right forms for [#1] and |#1|, an empty parenthesized array with no following body, and \lgroup/\rgroup for \mqty*(#1).

## Equivalent forms

```latex
\matrixquantity(#1)
```

exact. \matrixquantity is mapped to the same MatrixQuantity implementation for the same following syntax.

## See also

- [\\matrixquantity](https://texform.dev/latex/commands/matrixquantity)
- [\\smallmatrixquantity](https://texform.dev/latex/commands/smallmatrixquantity)
- [\\smqty](https://texform.dev/latex/commands/smqty)

## Test cases

### physics

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \mqty | Positive: baseline | Pass | Fail | Pass |
| \mqty* | Positive: vary:s[0] | Pass | Fail | Pass |
| \mqty (a) | Positive: vary:d[1] | Pass | Fail | Pass |
| \mqty*(a) | Positive: maximal | Pass | Fail | Pass |
