Site under construction...

# News

• 10/04/2007: For Ubuntu users, you can now easily install OOoLatex ! Have a look to the excellent post in the ubuntu forum.
• 15/03/2007: For some reason, the Bakoma ttf fonts coming from the CTAN are buggy, the character number 183 is missing in all fonts ("[", \kappa, \le,...).
The corrected font files are available here.

# Introduction

OOoLatex is a set of OpenOffice.org macros designed to integrate LaTeX equations. It contains two main modules: The first one, OOoLatexEquation, allows to insert Latex equations into Writer and Impress documents as png, eps or emf images while the second one, OOoLatexInline, can be used for simpler equations by expanding Latex code in the appropriated symbol characters.

With OOoLatexEquation, the equations are created and can be edited through an intuitive GUI while the informations (including the latex code, the characters size and the equation type) are stored in the image attribute and saved in the file. It is thus possible to edit these equations later.

To use OOoLatexEquation you need a Latex distribution and the program Ghostscript to create and process the equation. Some additional softwares are required to convert the image to png, eps or emf file format (see section Installation).

OOoLatex runs under Linux, MacOSX and Windows/Cygwin.

# Overview...

## Quick howto

A call to the macro OOoLatexEquation displays the main window (Type “ctrl-m” in Writer or in Impress, see Shortcut configuration)

Here, you can enter the latex code, select the size of the characters and the equation type.

• Display : to compile latex code inserted inside $...$.
• Inline : to compile latex code inserted inside $...$.
• Text : to compile latex code.

The button Latex will produce an image of the equation and insert it in the document.
Here is an example in Writer (emf format) :

Note: It's not possible to attach images to text layout in Impress. The inline mode of OOoLatexEquation will produce floating images contrarily to Writer.

The other module, OOoLatexInline, can be used to expand simple latex expression into the appropriate symbol characters. A call to the macro OOoLatexInline (type “ctrl-l” see Shortcut configuration) opens the inline macro input.

You can enter simple Latex code. Click on OK and the latex code is converted to appropriated characters. As OOoLatexInline converts latex code to symbol characters, it is not possible to convert code like \frac{}{} and so on... but you can use subscript “_{}” or upperscript “^{}”...

## Edition of equation (module OOoLatexEquation)

To edit an equation, just select it and call the main input window (For example “crtl-m”).

## Configuration window

To open the configuration dialog, click on Config from the OOoLatexEquation input window.

• The groups OOImpress and OOWriter allow to set the default size and type. It is possible to modify the default space between the text for the display mode in Writer.
• The Foreground and Background entries set the default color for \fg and \bg in RGB. The transp option makes the equation transparent. Note that with png, the transparency is achieved by subtraction of the bg color.
• Dpi is the resolution of the png image. The image are created for 10pt and rescaled.
• Set the Script path to the location of the shell script used by the macro (see Installation).
• The format allows to set the default format to png , eps or emf. If the Crop radio button is not selected, OOoLatex uses integer value of bounding box in eps unit. The cropping tries to reduce the width of the equation.
• The Base line allows to adjust the position of the equation in the inline mode of OOWriter.

The Apply button closes the dialog keeping the configuration only for the current session while the Save button closes the dialog before saving the configuration to file. The Default button resets the configuration and the Load button, sets the configuration from the latest saved one.

## Files format

OOoLatexEquation can use three file formats to integrate equations into OpenOffice.org documents. Each one has his advantages and disadvantages.

• The portable network graphic (png) format is probably the simplest to use. But it has the disadvantage that the image is pixelated. It's possible to increase the resolution but it is to the detriment of the file size. With transparent background, the border of the characters contains residue of the subtracted background color.
• The encapsulated postscript (eps) format gives very good results on postscript printer, but the preview image embedded into the eps file is not good enough to be used for quality screen display. Furthermore, it is not possible to obtain transparent image and the pdf export uses the preview image.
• The enhanced meta file (emf) format should be preferred since the image uses scalable fonts and can be made truly transparent. The pdf export embed the fonts so the file is readable from any computer but you need to install the Bakoma truetype fonts to be able see the document within OpenOffice.org.

Here is an example of transparent images on a bicolor background. From left to right, png (at 600 dpi with bg color set to '255,255,0') and emf images :

## Color integration

OOoLatex uses the package color. The default foreground \fg and background \bg colors are set in the configuration dialog window but you can use any command from the color package (predefined colors). For example :

# Installation of OOoLatex

To use the OOoLatex you need at least the package OOoLatexMacro which can be found here. This package contains the OpenOffice.org macros OOoLatexEquation and OOoLatexInline as well as a shell script, OOoLatex called by the macro OOoLatexEquation to process the image of the equation.

To unarchive the package (tar.gz file) use the command tar zxvf nom_du_fichier.tar.gz in a terminal.

## System requirement

To use the module OOoLatexInline, you need to install some TrueType fonts. By default, OOoLatexInline needs the MathType fonts for the grec letters and some specials symbols and the Bakoma fonts for a wide range of other special mathematical characters and symbols. You should probably read the MathType Fonts License before using these fonts. The MathType fonts are directly available here.

The module OOoLatexEquation requests a standard Latex installation with ghostscript to process the equation. OOoLatexEquation has been tested with ESP Ghostscript 8.15 and AFPL Ghostscript 8.51.

The macro uses the shell script OOoLatex (see below for installation) to make the dvi file of the equation and to convert it to other formats. By default, the macro looks for the script in your ${home}/bin directory for Unix/Linux users and in c:\cygwin\bin for windows users, but you can put it in an other location depending of your system configuration and tell OOoLatex where the script is located (c.f. configuration window). For each of the supported file formats, you need some specific programs or font files: • for png, you need to install the program convert from the package ImageMagick. Notice that with the series of “test releases” (available for OpenOffice.org 2.x), the script OOoLatex can be configured to use Ghostscript to convert the image into the png format. This option should be preferred since Ghostscript can use the alpha channel for transparent background. To configure the script OOoLatex, comment the appropriate line in the beginning of the script. • for eps, install the program epstool. • and for emf, you need the Bakoma TrueType fonts and the program latex2emf (package OOoLatexEmf, see the README file for the latex2emf's installation procedure). Make sure that the Bakoma fonts are accessible from OpenOffice.org, they are not inserted into the emf file. Notice that you need to install the fonts on each computer used to to open documents containing the equations. The macro OOoLatexEquation uses the layer of the Draw module to import the image of the equation into the document. As a consequence, you need to install the Draw module and all the image format filter in addition to Writer and/or Impress. ### OOoLatex on Windows/Cygwin For the users unfamiliar with the cygwin and/or the unix world, there is now a step-by-step procedure, on the help forum, for the installation of a minimal system to be able to use OOoLatexEquation. See here. ### OOoLatex on Ubuntu/Linux An Ubuntu package have been developed by Toufik for the installation of OOoLatex and the dependancy on the Ubuntu Dapper and Edgy distributions (i386). See the post on the Ubuntu forum for more information. ## Script installation Copy the script OOoLatex from the directory OOoLatexMacro-[xxx]/bin/ to an appropriate location. For Linux/MacOSX users, copy it in a binary directory, as for example, in${home}/bin or in /usr/local/bin. For Cygwin users, the script should be copied in the binary directory at the root of the cygwin installation (probably c:\cygwin\bin).
Note: The cygwin installation tree must be at the root of the c:, d: or e: drive to be properly detected by the macro (this limitation will be removed in future release).

To check your installation, you can run the script independently of OpenOffice in a terminal.
You can test the script with the following example,

\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
%%%
\usepackage{color}
\definecolor{bg}{RGB}{255,255,255}
\definecolor{fg}{RGB}{0,0,0}
\pagecolor{bg}
\color{fg}
%%%
\pagestyle{empty}
\begin{document}
$\iint\cos\theta(\vec r) dx dy$
\end{document}

Save it in the file test.tex and run the following command in a terminal OOoLatex -e png test.tex.
If there is no problem, the file test.png will be created in the current directory.
Run OOoLatex -h for more options.

## Macro installation

To install the OOoLatex macros, launch OpenOffice, open the "marco organizer" from the menu Tools>Macro, button Organizer and select the tab "Libraries". There is a button "Append" which allows you to select the file script.xlb from the directory OOoLatexMacro-[xxx]/macro1.1.x/ for OpenOffice-1.1.x and from OOoLatexMacro-[xxx]/macro2.0/ for OpenOffice-2.x.

## Shortcut configuration

Now, you can assign keys to the macros (for example “crtl-m” and “crtl-l”).

From the menu Tools>Customize go to the tab Keyboard and select the macro “main” of the module OOoLatexEquation and OOoLatexInline. Choose a short cut and click on Modify.

Last update : 17/04/2007 [gpiroux]