Code‎ > ‎

Latex for openoffice

I adapted a package that enables you to use Latex in OpenOffice presentations. The package is very much inspired by the TexPoint package of George Necula, and was originally written by Geoffroy Piroux. This is my own version, with (I believe) improved fonts and symbols.


Similarly to TexPoint, OOoLatex has two modes:
  • Inline mode: this mode enables you to write latex in the middle of text. You can use latex macros such as \rightarrow, \leq, \alpha, and so on, and for subscripts, all you need is a_3. The capabilities are not as advanced as full latex, however, as the mode relies on the fonts available to OpenOffice.
  • Display mode: in this mode, you can edit full-fledged latex equations (or general text), that are then processed by latex, and included as pictures. The latex used to generate the picture is associated with the picture, so that you can edit the latex after the fact.
The package has been tested with:
  • Linux: it works with OpenOffice 2.1, 2.2, and 2.4.
  • Mac: it works with OpenOffice and NeoOffice.
Note that you also need a latex installation for the package to work; you can install latex on a Mac via Darwin Ports (or Mac Ports) or fink. I have not tested the package under Windows, as I no longer own Windows PCs; I would appreciate hearing from others whether it does.


This package is derived from the one of Geoffroy Piroux. I replaced the use of fonts to use latex fonts I liked better, and I also re-defined the set of macros available to the inline mode. I also changed the way in which the bounding box is detected and used. Please feel free to improve on this package (I would love to hear from you, if you do).


  • Download OOolatex-oda-1.3.tgz from the attachments section.
  • Unpack it with tar xfvz OOolatex-lda-1.3.tgz
  • Install the fonts provided in the fonts directory:
    • In linux, you can install them in /usr/share/fonts/truetype/ooolatex (or in any other directory which is part of the font path).  
    • In a Mac, you might want to put the fonts in ~/Library/Fonts/
  • Note: the fonts have the same names as the latex-xft-fonts, but they are much better for ooolatex, as they define in a better way the inter-line spacing.
  • Install the latex packages, dvips, etc.  For a Mac, I recommend the MacTex package.
  • Copy bin/OOoLatex to a suitable place in the path, for instance,  /usr/local/bin, and ensure it is executable (chmod 755 /usr/local/bin/OOoLatex)
    In Mac OS X with DarwinPorts or MacPorts: use /opt/local/bin/
  • Launch OpenOffice, then:
    • select Tools > Macros > Organize Macros > Basic
    • Click on Organizer
    • Select Libraries, then Import, and import script.xlb , which is in the OOoLatex subdirectory.  This will create a new library called OOoLatex.
  • Now select some shortcuts. 
    • Use the menu Tools > Customize
    • Go to the tab Keyboard, and select the macro, in the Category column: > user > OOoLatex > OOoLatexEquation
         and > user > OOoLatex > OOoLatexInline
      For each of these, on the right column, select the Function "main", click on a shortcut of your liking, and click on "Modify".  Set your own shortcuts.  I like C-M for Inline mode, and C-N for Equation mode.
  • When Latex does not find the script file, in display mode, enter the path to the OOoLatex executable, that is, "/usr/local/bin/" (For Mac OS X with DarwinPorts / MacPorts:  use /opt/local/bin/).
Luca de Alfaro,
Sep 23, 2008, 9:31 AM