# ams/bmatrix-env-to-bracket-matrix

Rewrite the fenced bmatrix environment to explicit brackets around a core matrix environment.

https://texform.dev/rules/ams/bmatrix-env-to-bracket-matrix

## Metadata

| Field | Value |
| --- | --- |
| Key | ams/bmatrix-env-to-bracket-matrix |
| Level | corpus |
| Fidelity | render |
| Enabled by packages | ams |
| Profiles | Corpus, Equiv |

## Rewrite patterns

From:

```latex
\begin{bmatrix} #1 \end{bmatrix}
```

To:

```latex
\left[\begin{matrix} #1 \end{matrix}\right]
```

## Examples

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

### bmatrix

Before:

```latex
\begin{bmatrix} a & b \\ c & d \end{bmatrix}
```

After this rule:

```latex
\left[\begin{matrix} a & b \\ c & d \end{matrix}\right]
```

Packages: base, ams.

Rendering verified with the declared packages.

## Triggers

- [bmatrix](https://texform.dev/latex/environments/bmatrix)

## Eliminates

- [bmatrix](https://texform.dev/latex/environments/bmatrix)

## Produces

- [matrix](https://texform.dev/latex/environments/matrix)
- [\\left](https://texform.dev/latex/commands/left)
- [\\right](https://texform.dev/latex/commands/right)

## Same family

- [ams/Bmatrix-env-to-brace-matrix](https://texform.dev/rules/ams/Bmatrix-env-to-brace-matrix): Rewrite the fenced Bmatrix environment to explicit braces around a core matrix environment.
- [ams/Vmatrix-env-to-Vert-matrix](https://texform.dev/rules/ams/Vmatrix-env-to-Vert-matrix): Rewrite the fenced Vmatrix environment to explicit double bars around a core matrix environment.
- [ams/pmatrix-env-to-paren-matrix](https://texform.dev/rules/ams/pmatrix-env-to-paren-matrix): Rewrite the fenced pmatrix environment to explicit parens around a core matrix environment.
- [ams/vmatrix-env-to-vert-matrix](https://texform.dev/rules/ams/vmatrix-env-to-vert-matrix): Rewrite the fenced vmatrix environment to explicit vertical bars around a core matrix environment.
- [base/cases-to-cases-env](https://texform.dev/rules/base/cases-to-cases-env): Rewrite plain-TeX cases to the standard cases environment with row breaks.
- [base/eqalign-to-aligned-env](https://texform.dev/rules/base/eqalign-to-aligned-env): Rewrite eqalign to the standard aligned environment.
- [base/eqalignno-to-align-env](https://texform.dev/rules/base/eqalignno-to-align-env): Rewrite eqalignno to the standard align* environment.
- [base/matrix-to-matrix-env](https://texform.dev/rules/base/matrix-to-matrix-env): Rewrite plain-TeX matrix to the standard matrix environment with row breaks.
- [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.
- [physics/antidiagonalmatrix-to-admat](https://texform.dev/rules/physics/antidiagonalmatrix-to-admat): Collapse antidiagonalmatrix to the shorter admat helper.
- [physics/diagonalmatrix-to-dmat](https://texform.dev/rules/physics/diagonalmatrix-to-dmat): Collapse diagonalmatrix to the shorter dmat helper.
- [physics/matrixdeterminant-to-mdet](https://texform.dev/rules/physics/matrixdeterminant-to-mdet): Collapse matrixdeterminant to the shorter mdet determinant helper.
- [physics/bmqty-to-mqty](https://texform.dev/rules/physics/bmqty-to-mqty): Expand bmqty to the core mqty builder with bracket fence syntax.
- [physics/mdet-to-vmqty](https://texform.dev/rules/physics/mdet-to-vmqty): Expand mdet to the vmqty determinant-style builder.
- [physics/pmqty-to-mqty](https://texform.dev/rules/physics/pmqty-to-mqty): Expand pmqty to the core mqty builder with paren fence syntax.
- [physics/zmat-to-xmat](https://texform.dev/rules/physics/zmat-to-xmat): Expand zmat to the explicit xmat zero-filled builder.

## Disable this rule

```python
TransformEngine(profile="corpus", disable_rules=["ams/bmatrix-env-to-bracket-matrix"])
```

```javascript
new TransformEngine({ profile: 'corpus', disableRules: ['ams/bmatrix-env-to-bracket-matrix'] })
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Bbmatrix%7D+a+%26+b+%5C%5C+c+%26+d+%5Cend%7Bbmatrix%7D)
