Write LaTeX Math Formulas in LibreOffice
Creating mathematical equations in LibreOffice can be achieved either by using its built-in Math syntax, which closely resembles LaTeX, or by installing the TexMaths extension to compile true LaTeX code directly into your documents. This guide outlines how to use native LibreOffice markup for rapid formula creation, compares it with LaTeX commands, and explains how to enable full LaTeX support through an extension.
Method 1: Using Native LibreOffice Math Syntax
LibreOffice comes with a built-in equation editor called LibreOffice Math. While it uses its own markup language, the syntax is heavily inspired by LaTeX and is intuitive for LaTeX users.
How to Insert a Formula
- Open your document in LibreOffice Writer.
- Navigate to Insert > Object > Formula (or
press
Alt + I, thenO, thenF). - Type your formula markup in the Command pane at the bottom.
Native Syntax vs. LaTeX Syntax
| Mathematical Element | LaTeX Syntax | LibreOffice Math Syntax |
|---|---|---|
| Superscript | x^{2} |
x^2 or
x^{2} |
| Subscript | x_{i} |
x_i or
x_{i} |
| Fractions | \frac{a}{b} |
a over b |
| Square Root | \sqrt{x} |
sqrt {x} |
| N-th Root | \sqrt[n]{x} |
nroot{n}{x} |
| Summation | \sum_{i=1}^{n} |
sum from{i=1} to{n} |
| Definite Integral | \int_{a}^{b} f(x) dx |
int from{a} to{b} f(x) dx |
| Greek Letters | \alpha, \beta,
\Omega |
%alpha, %beta,
%OMEGA |
| Multiplication | \times,
\cdot |
times, cdot |
| Inequalities | \le, \ge,
\neq |
<=, >=,
<> |
| Matrices | \begin{matrix} a & b \\ c & d \end{matrix} |
matrix { a # b ## c # d } |
| Brackets (scalable) | \left( \frac{a}{b} \right) |
left( a over b right) |
Method 2: Using the TexMaths Extension for Full LaTeX Support
If you require exact LaTeX syntax, macros, and standard LaTeX
rendering packages (such as amsmath), you can use the
open-source TexMaths extension.
Prerequisites
- A working LaTeX distribution installed on your system (e.g., TeX Live, MacTeX, or MiKTeX).
- Modern DVI-to-PNG/SVG converters (typically bundled with standard LaTeX installations).
Installation and Configuration
- Download the TexMaths extension (
.oxtfile) from the official LibreOffice Extensions repository. - In LibreOffice, go to Tools > Extension Manager > Add, select the downloaded file, and restart LibreOffice.
- Go to the newly added TexMaths toolbar and click the TexMaths System Configuration icon.
- Set the paths to your local
latex,dvipng, anddvisvgmexecutables.
Inserting Equations with TexMaths
Click the TexMaths Equations icon on the toolbar (or press
Ctrl + Alt + M).Select your equation type: Inline, Numbered, or Display.
Enter pure LaTeX code:
f(x) = \int_{-\infty}^{\infty} \hat{f}(\xi)\,e^{2 \pi i \xi x}\,d\xiClick LaTeX to compile the equation into an SVG or PNG object embedded in your document.