How to Align Multi-Line Equations in LibreOffice Math

Creating multi-line aligned equations in LibreOffice Math is essential for presenting complex mathematical proofs, derivations, and step-by-step calculations clearly. This guide explains the primary methods for formatting multi-line equations, including using the matrix command to align equations by equal signs, utilizing alignl with newline for simple left-alignment, and applying the phantom command for custom spacing.

The most effective way to align equations at a specific character (such as an equals sign =) is by using a matrix structure. In LibreOffice Math, the matrix command creates a grid where # separates columns and ## separates rows.

Syntax

matrix {
  left_side_1 # = right_side_1 ##
  left_side_2 # = right_side_2
}

Example

To align a derivation at the equals sign:

matrix {
  f(x) # = (x + 2)^2 - 4 ##
       # = x^2 + 4x + 4 - 4 ##
       # = x^2 + 4x
}

By placing the = symbol in the second column, all subsequent rows will align directly beneath it.


Method 2: Using alignl and newline

For simple multi-line formulas that only need to be left-aligned rather than aligned at a specific operator, use the alignl tag combined with newline.

Syntax

alignl line_1 newline
alignl line_2 newline
alignl line_3

Example

alignl 2x + 3y = 7 newline
alignl 4x - y = 5

Note: You can also use alignc for center alignment or alignr for right alignment.


Method 3: Using the phantom Command

If you need to align symbols across lines without using a matrix, the phantom command creates invisible spacing equal to the width of the specified characters.

Syntax

alignl line_1 newline
alignl phantom { hidden_content } visible_content

Example

alignl y = 2x^2 + 5x + 3 newline
alignl phantom { y } = (2x + 3)(x + 1)

In this example, phantom { y } creates blank space identical to the width of y, forcing the second equals sign to align directly below the first one.