[Pmwiki-users] Math->image using LaTeX (was Re: More blue skye stuff...)
Christian Ridderström
chr
Wed Feb 4 17:26:46 CST 2004
On Wed, 4 Feb 2004, Robin Sheat wrote:
> On Tue, Feb 03, 2004 at 11:25:01PM +0100, Christian Ridderstr?m wrote:
>
> However, I wouldn't mind using standard LaTeX notation and having it
> automagically converted to a .png on the fly. I have a script that does
> this for some presentation software (magicpoint), so I can embed
> x=\frac{a}{b} directly into it. How hard would this be to implement in
> PmWiki?
I have a mockup here:
http://www.lyx.org/~chr/wiki/pmwiki.php?pagename=Math.Math
A statement such as [[$ e+f = \sqrt{r^2 - x^2} $]] invokes a function
called FmtMath() with 'e+f = \sqrt{r^2 - x^2}' as one of the arguments.
This function writes the latex code to a temporary file and then invokes
an external script 'latex-to-png.sh' with the name of the temporary
file as an argument. The external script is supposed to return the
name of the image showing the formula that corresponds to the latex
code.
All that's missing here is a the external script, but you had something
like that... :-)
A practical feature What's probably missing is a cacheing system. Before
converting the latex, FmtMath() or the external script, should check if
this particular piece of latex has already been converted. OTOH, if we
cache these images we'll also need to do garbage collection so that the
size cache-directory doesn't increase arbitrarily.
/Christian
--
Christian Ridderstr?m http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list