July 11, 2008

OOoLateX : Using LaTeX in OpenOffice documents


OOoLatex is a set marcos designed to provide latex support into OpenOffice. Complex equations can be inserted as images, the latex code is saved into the image attribute while simpler equations are expanded into symbol characters to be inserted as text.

Here are the instructions to install and uninstall this package on Ubuntu 8.04 with minimal hassle. Thanks a million to Toufik on the Ubuntu forum who posted these instructions originally. If you are on the Ubuntu forum and find these instructions useful, now is the time to thank Toufik for such a useful post. It is godsend for scientists who love OpenOffice to prepare slides that have loads of equations. And LaTeX rules in equation land.

Step 1. Install the dependencies
sudo apt-get install texlive imagemagick epstool


Step 2. Install the fonts.
mkdir OOoLatexFonts
cd OOoLatexFonts
wget http://mesh.dl.sourceforge.net/sourceforge/ooolatex/OOoLatexFonts.zip
unzip OOoLatexFonts.zip
cd ..
sudo mv OOoLatexFonts /usr/share/fonts/truetype/.
sudo fc-cache -f /usr/share/fonts/truetype

Step 3. Install the binaries for EMF
This involves installing the latex2emf program.The easiest way to install it is to grab the binaries directly from the OOoLatex website: http://sourceforge.net/project/showf...roup_id=150801
  • Ubuntu i386 or 64bits choose latex2emf_Linux_i386_binary.tar.gz
  • Ubuntu PPC choose latex2emf_Linux_PPC_binary.tar.gz
  • Others, you'll need to compile from source (grab OOoLatexEmf_noarch_src.tar.gz)

Once downloaded, go to the directory where you've downloaded:
tar -xzvf latex2emf_Linux_i386_binary.tar.gz
cd latex2emf_Linux_i386_binary/
sudo ./install.sh
The installer installs the binary latex2emf into /usr/bin/ and the library libEMF.so.1 into /usr/lib


Step 4. Install the oxt file
And finally, you can now install the extension! But first download the extension here:
http://sourceforge.net/project/showf...roup_id=150801
At the time of writing this post, the latest one was OOoLatex-4.0.0-beta-2-linux.oxt
There are two types of installation. The administrator mode is useful when installing for a lot of users but each user is not allowed to modify the configuration (most notably the shortcuts), only root can do that. Therefore I recommend, for normal user, to install in the single-user mode.
  • In a terminal :
    Single-user Mode
    /usr/lib/openoffice/program/unopkg.bin add OOoLatex-4.0.0-beta-2-linux.oxt
    Administrator Mode
    sudo /usr/lib/openoffice/program/unopkg.bin add --shared OOoLatex-4.0.0-beta-2-linux.oxt
Note that you'll have to accept the license.

Usage
After installation, try +M and +K (the default shortcuts). You can also add the OOoLatex Toolbar: View > Toolbars > OOoLatex

The module Equation transform a LaTeX code into an image. Two formats are proposed: .png and .emf. You probably know PNG, this is a kind of "normal" image. If you rescale it, you'll see pixel. A way to circumvent this problem is to increase the resolution (dpi) but you'll get larger files! Or to use the EMF format which is a scalable image: the equation is vectorised and don't loose resolution when you rescale it! This is probably the better choice but you need then some binaries (see above). Selecting an equation and opening the equation dialog box allows editing of the equation.

The module Expand was called Inline in the first versions of OOoLatex. Basically, it transforms (expands) the LaTeX special characters into ones that are usable by OpenOffice. This is done (partly) via the STIX general fonts. The interests of Expand is to include LaTeX characters directly in a sentence without requiring the insertion of an image (as in Equation). Apparently not all LaTeX code can be expanded, that's why a list is offered in the dialog box.

To Remove
Remove the extension:
Single User mode:
/usr/lib/openoffice/program/unopkg.bin remove net.sourceforge.ooolatex
Admin mode:
sudo /usr/lib/openoffice/program/unopkg.bin remove --shared net.sourceforge.ooolatex
Enjoy ! And remember to thank Toufik !

No comments: