The TexMaths Toolbar

TexMaths Toolbar Once the TexMaths extension is installed into LibreOffice, you should see a new toolbar in Writer, Impress and Draw. This is the TexMaths toolbar. In Writer, this toolbar is made of four icons, while in Impress and Draw it has only three.

In Writer, clicking on the left most icon (the one with the blue Pi symbol) launches the TexMaths Equations macro. The second icon is used for TexMaths Numbered Equations. The third icon (with the tools) opens the TexMaths Sysconfig dialog. Finally, the right most icon (featuring a gear) is bound to the TexMaths Recompile Equations macro. Note that in Impress and Draw, the second icon is not present.

Getting Started with TexMaths Equations

Equation window To insert your first equation into a document, simply type a LaTex math instruction in the text field of the TexMaths Equations window and then click on the LaTeX button.

Ex: x(t) = \mu ^2 (t) should produce the equation Equation

Selecting the Image Format

TexMaths can generate and insert two kinds of images in a LibreOffice document. To select the image format, use the selector located within the Image Format frame.

The default image format is the SVG vector format. It allows LaTeX equations to be resized without precision loss and does not need any special math font to be installed in LibreOffice, because math symbols are simply drawn using curves. This is the preferred (and default) format but there can be some issues when exporting LibreOffice documents to MS Office old versions, like MS Office 2000 (see below).

The other supported image format is PNG and is a raster image format. Thus, you have to select a resolution to use it. While 600 dpi is the default resolution, you can choose among several predefined values. You can also toggle the image transparency, which can be useful when the document background is not white. There should be no compatibility issues when using PNG format for MS Office document export.

Note that each format is only available if the corresponding external program (dvisvgm for SVG and dvipng for PNG) is installed onto your system with its path set using the TexMaths System Configuration dialog. At least one of these two programs is required to run TexMaths.

Font Size

TexMaths can handle different character sizes for your equations. To change the font size, use the selector located within the font size frame.

You can choose between predefined font sizes or type the one you prefer if it is not listed.



You can toggle the equation image transparency by checking the Transparency checkbox in the TexMaths dialog box. This can be useful when the document background is not white. Transparency can now be used with both SVG and PNG image formats.

Equation Type

TexMaths can generate three types of LaTeX equations:

To select an equation type, just use the radio button located within the Equation Type frame.

To generate display equations or inline display equations, all you have to do is to select the appropriate equation type and then type the text of your equation in the text field of the TexMaths Equations dialog.

Ex: To generate the Greek alpha symbol, just type \alpha

Inline display equations are obtained by the same way, but the difference is the style of the generated equation which is better integrated within a text. For example, sum index and exponent are displayed besides the sum sign and not below or above.

Both kinds of equations are ideal for simple one line equations and vertical alignment within text is correct, but they cannot handle multiline equations or more general LaTeX environments. For that kind of equations, select the LaTeX equation type and type your equation within \begin{} and \end{} instructions. You can use any LaTeX environment instructions.

Ex: Type the following lines to display a three lines equation, aligned on the equal sign.
x &= 1 \\
y &= 2x+1\\
&= 3\\

Equation Name

In the TexMaths Equations dialog, you can enter a label in the Name text field. This can be used to retrieve and equation by its name and could help when dealing with animations in Impress.

Generate LaTeX Equations

Once you typed an equation, you can generate it by clicking on the LaTeX button of the TexMaths Equations dialog. This generates an image of your equation in the format, type and size you selected.

Numbering Equations in Writer

Numbering equations is as simple as clicking on the TexMaths Numbered Equations icon (or entering a keyboard shortcut if you have defined one), enter your equation and click on the LaTeX button. A centered, numbered equation is then automatically inserted in your Writer document.

You can also select the alignment you want (left or right), the spacing and the equation caption in the Options Tab of the TexMaths System Configuration dialog.

Edit LaTeX Equations

Within a LibreOffice document, select an equation image and click on the TexMaths Equations icon in the TexMaths toolbar (or use a keyboard shortcut if you have defined one). This shows up the TexMaths Equations dialog with the text of your equation selected. Just edit this text and click on the LateX button to generate the modified equation.

You can of course close a document, open it again and edit your saved equations.

Text to LaTex in Writer

Type some LaTeX code directly within a Writer document (i.e. without opening the TexMaths dialog), select the text and click on the TexMaths Equations icon (or use a keyboard shortcut if you have defined one). The selected text is then silently converted to a LaTeX equation image. The applied image format, equation size and equation type are the default ones defined in the TexMaths Preferences.



TexMaths comes with some default settings. If these settings don't suit your needs, you can change them using the TexMaths Preferences dialog which is obtained by clicking on the Preferences button. This dialog allows you to change the image format, font size, equation type, etc., for each type of LibreOffice document. You can than save your new settings, restore default ones or load already saved settings.


LaTeX Preamble

Clicking on the Preamble button shows the TexMaths Preamble dialog that allows you to adjust your LaTeX preamble. For example, to generate colored equations, uncomment the three following lines of the default preamble, change the RGB color value to what you want, and save the preamble.

% \definecolor{fgcolor}{RGB}{0,0,255}
% \definecolor{bgcolor}{RGB}{255,255,255}
% \pagecolor{bgcolor}\color{fgcolor}

Now, all new equations will have the color scheme you have defined in the preamble. Note the transparency option has priority over the background color specified in the preamble. Therefore, uncheck the transparency option if you want a background color.

Starting with TexMaths 0.38, the preamble is stored into the document properties. This way each document can have its own preamble. Note the default preamble is global and can't be changed.

\input, \include and \usepackage Commands

Starting with TexMaths 0.41, \input and \include LaTeX commands can be used to insert the content of a LaTeX (.tex) text file. The inserted .tex files are assumed to be located in the same directory as the document.

Ex: In the document my_doc.odt, the LaTeX command:


can be used to insert the content of the LaTeX file my_equations.tex provided that this file is located in the same directory as my_doc.odt.

There is also the possibility to use custom .sty files through the use of \usepackage commands. These commands have to be inserted in the preamble and then (if desired) stored in the current document. The .sty files have to be located in the same directory as the document.

Ex: In the document my_doc.odt, the document style my_style.sty can be used by adding to the LaTeX preamble the command:


The file my_style.sty has to be located in the same directory as my_doc.odt otherwise this won't work.

Recompilation of TexMaths Equations

When a document (in Writer, Impress or Draw) contains many equations, it can be useful to be able to change their font size, transparency, image format, etc., in a single shot. This is the purpose of the TexMaths Recompile Equations macro.

Clicking on the related toolbar icon (the one with the gear) opens a dialog where you can change a number of equation parameters, and the preamble. If you don't want to change a parameter from a list, then select the '---' entry of that list. For a check box, select the '-' state if you don't want to change the related parameter.

In any of the three document types, you can recompile all equations from the document by selecting the Recompile All Equations option.

In Writer documents, by selecting the Recompile Selected Equations option, you can choose to recompile only equations that are located within the selected text area. Note that, due to some limitations with selections in LibreOffice, this macro does not recompile equations located in tables, text frames, header and footer. If needed, you can recompile those equations one by one, by editing them the usual way.

In Impress and Draw documents, by selecting the Recompile Equations from Slide option, you can recompile only equations that are located within the current slide.

When all parameters and options have been set, then click on the Run button and all or selected equations should be updated with the new parameter values. When dealing with hundreds of equations, this can take a while, so please be patient.

Compatibility with ooolatex

Starting with version 0.34, TexMaths is compatible with ooolatex. This means that if you have a document that contains ooolatex equations, you can edit those equations by selecting them (one by one) and calling the TexMaths Equation macro. You can then modify the LaTeX code and regenerate the equation either in either SVG or PNG format, as you prefer.

Exporting Documents to MS Office

If you plan to export your documents to MS Office (Word and Powerpoint, whatever versions), you should save your LibreOffice documents to .doc and .ppt formats, *NOT* to .docx or .pptx formats. Indeeed, while LibreOffice can produce these formats, the equation images are badly converted and there will be severe issues when rendering them in Word or Powerpoint.

It is also recommended to set the Word vertical alignment compatibility option (in the TexMaths System Configuration dialog) if your Writer documents have to be exported to Word. This will greatly improve in Word the vertical alignment of in text equations.

Starting with TexMaths 0.38, exported SVG equations are well rendered in Word and Powerpoint 2003 and above, but still not in Word and Powerpoint 2000. So if you're stuck with these rather old versions, you'll have to use the PNG format.

Keyboard Shortcuts

To configure shortcuts to launch the TexMaths Equations with or without numbering, click on the TexMaths System Configuration button of the TexMaths toolbar and define your shortcuts. For equations without numbering, you can have a single shortcut for all applications or a different one for each. Since numbered equations can only be used in Writer, there is only one shortcut for them.

Within the TexMaths Equations dialog, you can use the following shortcuts:

Known Issues

SVG rendering is buggy in LibreOffice versions 3.x (equations appear as if they were written in bold face), but it works well in versions 4.x or 5.x. So if you want to use SVG, I recommend to upgrade LibreOffice to version 4.x or 5.x.

TexMaths can also be used in Apache Openoffice 3.4.x, but SVG rendering is completely broken. However, PNG equations are well rendered.

TexMaths works well (PNG and SVG formats) in Apache Openoffice 4.x.

Equations that include PSTtricks commands cannot be rendered correctly as PNG images because of dvipng. You can safely use SVG format instead.

Copyright 2012-2017 Roland Baudin