FormuLaTeX – LaTeX in XSLidy
FormuLaTeX Introduction
Philippe Cattin, Erik Wilde
ETH Zürich
July 2006
FormuLaTeX
- For many scientific presentations and lectures a means to render formulas is required
- FormuLaTeX is what ↗ TeXPoint is for ↗ PowerPoint and ↗ OOoLatex for ↗ OpenOffice but only better
- It allows you to easily integrate -formulas or LaTeX snippets into any xslidy presentation
- FormuLaTeX uses the powerfull and flexible extension mechanism of xslidy
Advantages of FormuLaTeX
- You can use all the power of in your xslidy presentations
- FormuLaTeX scales the formulas and adjusts the baseline automatically and transparently for the user
- The formulas, such as , are dynamically rescaled with the font size
- Multiple occurances of the same content such as and are transparently collapsed to one single PNG/GIF image
- FormuLaTeX renders PNG/GIF images of the content with transparency set correctly
- FormuLaTeX uses a sophisticated caching mechanism to avoid the regeneration of already processed formulas
Disadvantages of FormuLaTeX
- Some characters in the code have to be escaped as to not interfere with XML, e.g. & has to be replaced by & and <> by < and > respectively
- FormuLaTeX is a 3-pass process
- extender.xsl: pass generates the .html files as well as the .tex files with the formulas
- formulatex.pl: generates the PNG/GIF files for all the formulas as well as the scaling and baseline information (.sex files)
- extender.xsl: the second pass re-generates the html files with the correct scaling and baseline information
- FormuLaTeX requires perl, perl-magick, ghostscript and a working installation
Entering LaTeX Code
Using FormuLaTeX is very easy. The following code snippet
<tex>$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$</tex>
for example yields a detailed
rendering of the
Quadratic equation:
You don't have to fuzz around with scaling and positioning the image correctly. FormuLaTex scales the formulas correctly and even handles the baseline settings fully automatically, so that
and
appear properly aligned.
Example 1 with Changing Font Size
As the equation height is bound to the height of the letter 'x', the size of the equations changes with font size:Example 2 with Packages and Special Characters
The following code snippet
<tex pkg="amsmath">$f(x,y)=\begin{bmatrix}
f(0,0) & f(0,1) & \cdots & f(0,M-1)\\
f(1,0) & \ddots & & f(1,M-1)\\
\vdots & & \ddots & \vdots\\
f(N-1,0) & f(N-1,1) & \cdots & f(N-1,M-1)\\
\end{bmatrix}$</tex>
is rendered as
Example 3 with Background
As the generated PNG/GIF images use transparency, there is no problem with potential background colours and background images.
The faint background image can be clearly seen behind the formula.
Example 4 Colour
The formulatex can even generate GIF/PNG images using colour.
<tex pkg="color">\[{\cal F}\{f(x,y)\}=F(u,v)=\color{red}\frac{1}{N}\color{black}\sum_{x=0}^{N-1}\sum_{y=0}^{N-1}f(x,y)e^{-\mbox{j} 2\pi (ux+vy/N)}\]</tex>
Installation
Installation is pretty simple
- Copy the extender.xsl into
your top-level directory and unzip formulatex (see this documentation for an example).
- Verify, that all the prerequisites for formulatex.pl are installed:
- A working installation
- Perl with the modules Image::Magick, Digest::MD5, and Files::Copy
- ghostscript
Processing FormuLaTeX Presentations
The following commands show how to generated the documentation for the formulatex documentation:
- saxon formulatex.xml extender.xsl
- formulatex/formulatex.pl
- saxon formulatex.xml extender.xsl