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

  1. Open your document in LibreOffice Writer.
  2. Navigate to Insert > Object > Formula (or press Alt + I, then O, then F).
  3. 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

Installation and Configuration

  1. Download the TexMaths extension (.oxt file) from the official LibreOffice Extensions repository.
  2. In LibreOffice, go to Tools > Extension Manager > Add, select the downloaded file, and restart LibreOffice.
  3. Go to the newly added TexMaths toolbar and click the TexMaths System Configuration icon.
  4. Set the paths to your local latex, dvipng, and dvisvgm executables.

Inserting Equations with TexMaths

  1. Click the TexMaths Equations icon on the toolbar (or press Ctrl + Alt + M).

  2. Select your equation type: Inline, Numbered, or Display.

  3. Enter pure LaTeX code:

    f(x) = \int_{-\infty}^{\infty} \hat{f}(\xi)\,e^{2 \pi i \xi x}\,d\xi
  4. Click LaTeX to compile the equation into an SVG or PNG object embedded in your document.