Wednesday, March 14, 2012

Latex in OpenOffice/LibreOffice

Latex equations can be inserted in Impress (powerpoint of OpenOffice/LibreOffice) via OOolatex. In this article I will talk on how to install and config OOolatex in linux and windows, pitfalls and a few tips.

Installation and config in linux


Install openoffice

It's probably a good idea to download and install openoffice from openoffice website. The latex extension works with 3.3. After download run the following commands:
tar -zxvf OOo_3.3.0_Linux_x86_install-deb_en-US.tar.gz
cd OOO330_m20_native_packed-1_en-US.9567/DEBS/
sudo dpkg -i *.deb
cd desktop-integration
sudo dpkg -i *.deb

Dependencies

Install the dependencies
sudo apt-get install texlive-latex-base dvipng

Font installation

Download the fonts and copy paste the *.ttf and *.otf files in
/usr/local/share/fonts/openoffice/
directory as root and then run the command
sudo fc-cache -fv

Extension installation

Download the linux version of the extension from the download section of the OOolatex website. To install, open the extension via Openoffice.


Config of OOolatex

After installation, reopen Impress. Click on the ``Config" button on the toolbar and fill in the paths. Change them according to your installation.
Latex: /usr/bin/
Ghostscript: /usr/bin/

Bug

Png output format is working, but not emf

In ubuntu if png output format is working, but not emf, then run impress from the command line and then try using OOolatex with emf selected. If the command line shows that it cannot find libstdc++5, then download the library file libstdc++5_x.y.z-w_i386.deb from here where x.y.z-w is the version number. Latest ubuntu repositories only provide libstdc++6, so one has to manually download and install this library.
For some reason OOolatex specifically requires the i386 version. So even if you have amd64 bit machine with amd64 ubuntu installed, you will still need the i386 version installed. After downloading the file from the above website install it with the following command:
sudo dpkg --force-architecture -i libstdc++5_x.y.z-w_i386.deb
Reopen impress and try again.


Installation and config in Windows


Install dependencies

Download and install miktex, ghostscript, openoffice and minsys from their respective websites. For minsys, use mingw-get-inst-xxxxxxxx.exe to install msys.


Font installation

Download the fonts and copy paste the *.ttf and *.otf files in C:\Windows\fonts\. Don't worry if it says bad font.


Extension installation

Download the windows version of the extension from the download section of the OOolatex website. To install open the extension via Openoffice.


Config of OOolatex

After installation, reopen Impress. Click on the ``Config" button on the toolbar and fill in the paths. Change them according to your installation.
Latex: C:\Program Files (x86)\MiKTeX 2.8\miktex\bin\
Ghostscript: C:\Program Files (x86)\gs\gs9.02\bin\
MinSYS: C:\MinGW\msys\1.0\bin\

Tips


  • If one wants to re-edit the equations after the file is re-opened, then the impress file needs to saved in ``odp" format rather than ``ppt" format.
  • For output format it is better to use emf format rather than png format.
  • Use ``Expand" button for inline equations and ``Equation" button for equations on a line of their own.
  • Example of writing multi-line equation
    \begin{array}{ccc}
    \mathcal{L} &=& T - V \\[0.2cm]
    \mathcal{H} &=& T + V 
    \end{array}
    

No comments:

Post a Comment