# aligned

Used for inner aligned systems of equations or derivation steps inside another displayed formula, with an optional vertical-position argument.

https://texform.dev/latex/environments/aligned

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Alignment](https://texform.dev/latex/topics/alignment) |
| Packages | ams |
| Allowed mode | math |
| Tags | math-alignment, nestable |
| Commonality | high |
| Body mode | math |

## Syntax

### ams

Argument specification: `o`

Used for inner aligned systems of equations or derivation steps inside another displayed formula, with an optional vertical-position argument.

## Common tasks

### How to nest an alignment inside one equation

aligned is nestable; align is not.

```latex
\begin{equation} \begin{aligned} a &= b+c \\ &= d \end{aligned} \end{equation}
```

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

### How to put a small system beside a condition

```latex
\begin{equation} \left\{ \begin{aligned} x &= a \\ y &= b \end{aligned} \right. \end{equation}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Bequation%7D+%5Cleft%5C%7B+%5Cbegin%7Baligned%7D+x+%26%3D+a+%5C%5C+y+%26%3D+b+%5Cend%7Baligned%7D+%5Cright.+%5Cend%7Bequation%7D)

### How to top-align a nested block

```latex
\begin{equation} f(x)= \begin{aligned}[t] &x^2 \\ &+1 \end{aligned} \end{equation}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Bequation%7D+f%28x%29%3D+%5Cbegin%7Baligned%7D%5Bt%5D+%26x%5E2+%5C%5C+%26%2B1+%5Cend%7Baligned%7D+%5Cend%7Bequation%7D)

## Examples

```latex
\begin{aligned}a\end{aligned}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Baligned%7Da%5Cend%7Baligned%7D)

```latex
\begin{aligned}[t]a\end{aligned}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Baligned%7D%5Bt%5Da%5Cend%7Baligned%7D)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| ams | full | full | full |

## Usage frequency

1.79% of formulas in the measured corpus contain this entry, rank 9 of 31 entries with frequency data.

## In TeXForm

TeXForm reads the environment body in math mode.

## See also

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

## Test cases

### ams

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \begin{aligned} a & b \end{aligned} | Positive: baseline | Pass | Pass | Pass |
| \begin{aligned}[a] a & b \end{aligned} | Positive: vary:o[0] | Pass | Pass | Pass |
