How can I write a Template.pm filter to generate PNG output from LaTeX source code?

Posted by Sinan Ünür on Stack Overflow See other posts from Stack Overflow or by Sinan Ünür
Published on 2010-04-08T21:07:02Z Indexed on 2010/04/08 21:13 UTC
Read the original article Hit count: 303

Filed under:
|
|
|

I am looking for a way of generating PNG images of equations from LATEX source code embedded in templates. For example, given:

[% FILTER latex_display ]
\begin{eqnarray*}
\max && U(x,y) \\
\mathrm{s.t.} && p_x x + p_y y \leq I \\
&& x \geq 0, y \geq 0
\end{eqnarray*}
[% END %]

I would like to get the output:

<div class="latex display"><img src="equation.png" width="x" height="y"></div>

which should ultimately display as:

Consumer's Optimization Problem

I am using ttree to generate documents offline. I know about Template::Plugin::Latex but that is geared towards producing actual documents out of LATEX templates.

Any suggestions?

© Stack Overflow or respective owner

Related posts about perl

Related posts about latex