Mathematics/Multiline equations

Unofficial ConTeXt Wiki mirror

Last modified: 2025-01-12

Basic Alignment with \startalign

\NC stands for new column, \NR stands for new row.

Changing the number of columns

The above equations were aligned at =. Suppose you also want the + to align. Well, this is simple in context, simply specify the number of columns with \startalign

Equation numbering with \startplaceformula

Aligned equations can be numbered by using \startplaceformula (as usual), and by placing a tag after \NR

Sub-numbering with \startsubformulas

The numbering can be changed to a subformula style by encapsulating \startplaceformula with \startsubformulas :

Specifying and defining alignment with \definemathalignment

If you want more control over the formatting, and want the middle column to be center aligned, you can do that by

This mechanism allows fancier alignments like


These kind of new alignment can be defined using \definemathalignment.

A second example, to emulate gather environment of amsmath, we can use

Cases

with \startmathcases (two columns)

Context provides a \startmathcases \stopmathcases pair to make it easy to get cases. The cases environment consists of two columns, separated by \NC. Each line must end with a \NR.

The second column is by default in math mode. To typeset the second column in text mode, use \TC:

with \definemathmatrix

One of the powerful structures in displaying mathematical formulas is the possibility of defining custom maths alignment. For instance the following definition

Numbering cases with \startplaceformula plus \startsubformulas

As you may expect: