[[PageOutline(2-5,Contents,pullout)]]
= Render Latex formula to image
== Description
This plugin allows you to render a mathematical formula as an image using Latex, dvips, and !ImageMagick.
The images are named based on a SHA1 hash of the formula and parameters, so that images don't have to be regenerated every time they are viewed.
To create the image from the formula text, the following is performed:
1. Create .tex file in temporary directory.
1. Run latex on .tex file to produce .dvi file.
1. Run dvips on .dvi file to produce .eps file.
1. Run convert on .eps file to produce .jpg file.
See also tagged:LaTeX
== Bugs/Feature Requests
Existing bugs and feature requests for LatexFormulaMacro are
[report:9?COMPONENT=LatexFormulaMacro here].
If you have any issues, create a
[/newticket?component=LatexFormulaMacro new ticket].
[[TicketQuery(component=LatexFormulaMacro&group=type,format=progress)]]
== Download
Download the zipped source from [export:latexformulamacro here].
== Source
You can check out LatexFormulaMacro from [/svn/latexformulamacro here] using Subversion, or [source:latexformulamacro browse the source] with Trac.
== Installation
Requirements:
* Latex
* dvips
* convert (from the !ImageMagic package)
* ghostscript
General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page.
== Example
By default, the Latex code is rendered in math mode. This allows for quick math expressions. There is also a built-in macro called "mat" which is used for formatting matrices, like this:
{{{
[[formula(\mat{R'\\G'\\B'} = \mathbf{A} \mat{R\\G\\B} + \mathbf{x})]]
}}}
which will produce the following formula:
[[Image(matrixequation.png)]]
For more complicated usage, use the !{{{ ... }}} format and the "nomode" command to disable the display-math mode:
{{{
{{{
#!formula
#nomode
A more complicated equation should be typeset in {\em displayed math\/} mode,
like this:
\[
z \left( 1 \ +\ \sqrt{\omega_{i+1} + \zeta -\frac{x+1}{\Theta +1} y + 1}
\ \right)
\ \ \ =\ \ \ 1
\]
}}}
}}}
and no formula will be displayed.
== Recent Changes
[[ChangeLog(latexformulamacro, 3)]]
== Author/Contributors
'''Author:''' [wiki:vgough] [[BR]]
'''Maintainer:''' [[Maintainer]] [[BR]]
'''Contributors:'''