wiki:LatexFormulaMacro

Version 13 (modified by rjollos, 4 years ago) (diff)

Update page.

Render Latex formula to image

2006-04-20 update: This was originally created for a project which was using Trac 0.8. However, that project went away and so I haven't been using Trac. I haven't done anything with the latex hack since then, but other people have provided some patches for newer versions of Trac & other features. If someone wants to take over this page and continue development, please do.

Description

Render a latex formula to 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.

In order to create the image from the formula text, the following is performed:

  1. create .tex file in temporary directory
  2. run latex on .tex file to produce .dvi file
  3. run dvips on .dvi file to produce .eps file
  4. run convert on .eps file to produce .jpg file

Requirements

  • latex
  • dvips
  • convert (from the ImageMagic package)
  • ghostscript

Bugs/Feature Requests

Existing bugs and feature requests for LatexFormulaMacro are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out LatexFormulaMacro from here using Subversion, or browse the source with Trac.

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 matricies, like this:

[[formula(\mat{R'\\G'\\B'} = \mathbf{A} \mat{R\\G\\B} + \mathbf{x})]]

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
   \]
  }}}

Recent Changes

[8403] by rjollos on 2010-08-21 08:02:12
Add revision info to macro. Fixes #6569.
[8402] by rjollos on 2010-08-21 07:44:24
Adding 0.11 version to repository, previously attached to wiki page. Fixes #6568.
[678] by vgough on 2006-04-21 07:33:50
LatexFormulaMacro:

Apply changes from Ken McIvor
fixes #65

Author/Contributors

Author: vgough
Maintainer: vgough
Contributors:

TagIt(macro,vgough,beta)?