# ams/substack-expand

Expand substack directly to the explicit centered subarray environment.

https://texform.dev/rules/ams/substack-expand

## Metadata

| Field | Value |
| --- | --- |
| Key | ams/substack-expand |
| Level | faithful |
| Fidelity | render |
| Enabled by packages | ams |
| Profiles | Faithful, Corpus, Equiv |

## Rewrite patterns

From:

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

To:

```latex
\begin{subarray}{c}#1\\#2\end{subarray}
```

## Examples

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

### Three row substack

Before:

```latex
\sum_{\substack{1\le i\le n\\ i\text{ odd}\\ i\ne 5}} a_i
```

After this rule:

```latex
\sum_{\begin{subarray}{c}1\le i\le n\\ i\text{ odd}\\ i\ne 5\end{subarray}} a_i
```

Packages: base, ams.

Rendering verified with the declared packages.

## Triggers

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

## Eliminates

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

## Produces

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

## Same family

- [base/buildrel-to-stackrel](https://texform.dev/rules/base/buildrel-to-stackrel): Rewrite plain TeX buildrel syntax to stackrel.
- [base/duplicate-mathrel-wrapper-drop](https://texform.dev/rules/base/duplicate-mathrel-wrapper-drop): Drop one directly nested duplicate mathrel wrapper.
- [base/widehat-to-hat](https://texform.dev/rules/base/widehat-to-hat): Drop stretchiness from \widehat by rewriting it to \hat.
- [base/widetilde-to-tilde](https://texform.dev/rules/base/widetilde-to-tilde): Drop stretchiness from \widetilde by rewriting it to \tilde.
- [base/stackbin-expand](https://texform.dev/rules/base/stackbin-expand): Expand stackbin to an explicit binary-level stacked operator form.
- [base/stackrel-expand](https://texform.dev/rules/base/stackrel-expand): Expand stackrel to an explicit relation-level stacked operator form.

## Disable this rule

```python
TransformEngine(profile="corpus", disable_rules=["ams/substack-expand"])
```

```javascript
new TransformEngine({ profile: 'corpus', disableRules: ['ams/substack-expand'] })
```

[Open in Playground](https://play.texform.dev/?input=%5Csum_%7B%5Csubstack%7B1%5Cle+i%5Cle+n%5C%5C+i%5Ctext%7B+odd%7D%5C%5C+i%5Cne+5%7D%7D+a_i)
