How to Insert and Format Formulas in LibreOffice Writer
LibreOffice Writer includes a dedicated equation editor called LibreOffice Math that allows users to create, insert, and format mathematical formulas within text documents. This guide explains how to open the equation editor, construct formulas using visual tools and markup syntax, customize fonts and spacing, and align or number equations for professional academic and technical documentation.
Inserting a Formula Object
To create a new mathematical equation in LibreOffice Writer:
- Place your cursor where you want the equation to appear.
- Go to the top menu and select Insert > Object > Formula.
- The document view will split, opening the formula editing pane at the bottom of the screen and the Elements dock on the side.
Writing Formulas
You can write formulas using two methods: the graphical interface or the Math markup language.
1. Using the Elements Dock
The Elements dock groups symbols and operations into categories such as Unary/Binary Operators, Relations, Set Operations, Functions, and Brackets. Clicking any symbol automatically inserts its syntax template into the equation pane at the bottom.
2. Using Math Markup Syntax
You can type directly into the command pane at the bottom for faster input. Common examples include:
- Fractions:
a over bproduces \(\frac{a}{b}\) - Superscripts and Subscripts:
x^2for powers,x_ifor indices - Square Roots:
sqrt{x}ornroot{n}{x}for \(n\)-th roots - Greek Letters:
%alpha,%beta,%pi,%omega - Summations and Integrals:
sum from{i=1} to{n} {x_i}orint from{0} to{infinity} {f(x) dx} - Matrices:
matrix { a # b ## c # d }(where#separates columns and##separates rows) - Brackets:
left( x over y right)creates scalable parentheses that fit the height of the inner expression.
Formatting Formulas
When the formula editor is active, use the Format menu to modify styling across the formula:
- Font Size: Navigate to Format > Font Size to set the base size for variables and symbols. You can also adjust relative sizes for indices, limits, and operators.
- Fonts: Navigate to Format > Fonts to set specific typefaces for variables, functions, numbers, and general text.
- Spacing: Navigate to Format > Spacing to adjust the distance between operators, line spacing for matrices, and bracket margins.
- Alignment: Navigate to Format > Alignment to set the default alignment (Left, Centered, Right) for multiline expressions.
To apply text colors within an individual formula, use the markup
command color [name] { expression } (e.g.,
color red {x + y}).
Aligning and Numbering Equations
- Inline Formulas: Inserting a formula directly inside a text line aligns it with the baseline of surrounding text.
- Numbered Display Formulas: To insert a centered
formula with an automatic reference number aligned to the right margin,
type
fnon a blank line and pressF3. This inserts a two-column table containing a centered formula placeholder and an auto-incrementing equation number variable.
Editing Existing Formulas
To edit an existing equation, double-click the formula object in the document. The formula editing pane will reopen, allowing you to update the markup or styling. Click anywhere outside the formula pane to save changes and return to the standard document editor.