# How to insert LaTeX formulas in LibreOffice?

I am using Libreoffice normally, but I need have Gauss Matrix (http://en.wikipedia.org/wiki/Gaussian_elimination) in Libreoffice . I found that Latex can do that. I installed Lyx on Ubuntu. How can I write Gauss Matrix in Lyx? Also how can I export it to Libreoffice Writer?

• try and press Edit on wikipedia, then you will see the equivalent LaTeX code. – zeroth Dec 18 '13 at 10:35
• I don't know where the problem is in LO Math with GausJordan. Have you tried this: left (matrix{1 # 5 ## 2 # 4} ~ mline ~ matrix{7 ## 9} right ) – user61915 Sep 5 '14 at 4:17

Please don't abandon LibreOffice just for this. You can insert LaTeX formulas directly using the TexMaths extension.

## Installation:

2. Open LibreOffice Writer, go to Tools -> Extension Manager, and select the file (*.oxt) just downloaded.

3. Close all instances of LibreOffice and start it again.

You'll see a new toolbar:

## Configuration:

TexMaths supports two image formats, PNG and SVG. In practice, PNG resolution is quite poor, you need to install the dvisvgm converter for SVG.

On Ubuntu, it's as simple as:

$sudo apt-get install texlive-extra-utils  and on Fedora, it's: $ sudo dnf install texlive-dvisvgm


After you install it, go to TexMaths system configuration and provide the paths for latex, dvipng and dvisvgm. See the screenshot below for reference:

Finally, set the preferences to use SVG by default.

## Usage:

The new toolbar is pretty simple, discover it by yourself. There are a few tips I would like to share to improve productivity though.

• To edit a previously inserted formula, click on the image and on the correspondent toolbar button.
• Define shortcuts in the Shortcuts tab of the TexMaths system configuration, I'd suggest Ctrl+h and Ctrl+k since there is no predefined shortcut for this keyboard combination in LibreOffice.
• You just got my upvote, great answer! – lf_araujo Mar 11 '17 at 2:18
• Just a note: this plugin is quite fragile in LibreOffice so be prepared to save frequently. For example: the default SVG format produces objects that can be selected individually in LibreOffice and if you accidentally do so, the whole formula becomes uneditable. – norok2 Oct 13 '17 at 13:35
• First of all, thanks! This is really cool extension. One problem though - I'm unable to use non ASCII characters in my LaTeX formulas. For example I try to do V_ц which should compile to V with little ц at the bottom and to the right of V, but the compiled image doesn't show ц at all. I guess the underlying packages don't know how to handle Cyrillic alphabet properly. Any idea how to fix this? – dKab Nov 27 '17 at 17:09
• @dKab, yes there is a way, go to TexMaths options, add this to the preamble \usepackage[utf8]{inputenc} \usepackage[T2A]{fontenc}, now add an equation with the code V_\text{ц}. Press "LaTeX" button (sometimes you have to resize the dialog window to see the button). – alfC May 21 '18 at 18:36
• Great answer, TeXMaths is pretty decent if you have to use LO. Sometimes you have to resize the dialog window to see the "Compile to LaTeX" button. XeLaTeX compilation doesn't work for me but the preamble option is pretty powerful. TeXMaths alignment (vertical and horizontal) is even better than with the official LibreOffice Math. – alfC May 21 '18 at 18:38

The TexMaths solution does not work if you are using the snap version of LibreOffice because it does not have permission to access the /usr/ folder. Instead I use Writer2Latex.