Friday, March 23, 2012

TexMaths: A LaTeX plugin for Open/LibreOffice

I have been a big fan of an OpenOffice extension called OOoLaTeX - which lets you typeset equations in OpenOffice Writer and Impress (the word-processing and presentation software, respectively).
I love it because equations look beautiful, and I can cut-paste from my LaTeX manuscripts (and wikipedia sources for lectures).
Getting fonts to work, does require some gymnastics - but is not a deal-breaker. The trouble with OOoLaTeX however is that it is no longer actively maintained (the last updates date back to late 2007), and getting it to work with newer releases has started to get increasingly painful. In fact, late last year, I reluctantly gave the LaTeX presentation class "beamer" a shot, and actually found it very usable.

I found out last week that there is a new LaTeX plugin for LibreOffice (version >= 3.3) called TeXMaths
TexMaths is a LaTeX equation editor for LibreOffice. It is derived from OOoLatex, originally developed by Geoffroy Piroux (see here). 
As its predecessor, TexMaths is a LibreOffice extension that allows you to enter and edit LaTeX equations directly into LibreOffice documents. All you need is a working LaTeX installation, at least one of the two programs dvipng or dvisvgm and of course the TexMaths LibreOffice extension.
It looks like what OOoLaTeX should have looked like by now, if it were maintained. The primary advantage of TexMaths over OOoLaTeX is that equations are rendered either in png or svg (instead of emf). This simplifies the installation process a great deal, because you don't have to wrestle with the issue of getting fonts right.

SVG is scalable (so you can resize the equation without screwing it up), and you can drag and drop it into other programs (Inkscape has its own native LaTeX support).

The whole episode points to the both the pitfalls and strength of open source software. One can get accustomed to programs (especially those with single authors) that subsequently become obsolete, because the principal coder has moved on to better things. However, if the program fills an important demand, often, someone else steps up, and builds and improves the older program.


Anonymous said...

I wish TexMath images were less scalable in Libre Office writer! I find it hard to get a consistent look to math documents with a continuum of scales. I'd prefer to have a discrete set of scales and it would be nice to have consistent control over the appearance of mathematical symbols by an interface that resembles the format->character->font interface for normal characters.

rabil said...

TexMaths does more than just equations. You can even use it to create in-line formulas in impress (something impress cannot do unlike writer). For example, in the TexMaths code box:


This is a list:


\item This is the first item

\item This is the second item

\item Here is an inline equation:

$X_i=\alpha_i + \beta_i \mu + \epsilon_i$


More text can follow.


This will create a slide with text and an itemized list. You can insert the title in the regular slide's title text box. You can edit the TextMaths code later if necessary.

IMO, however, it's just better to use latex directly for presentations and documents.

rabil said...

For some reason, the latex code I typed does not display! The basic idea is that you can write latex code using TexMaths - not just equations. You can include in-line equations by inserting dollar signs before and after the formula.

Sachin Shanbhag said...

Thanks for your comments. That does seem very handy. Over the past couple of years though, I have mostly migrated to LaTeX+beamer for my presentations.