[Pmwiki-users] Re: Math->image using LaTeX (was Re: More blue skye stuff...)

Christian Ridderström chr
Thu Feb 5 12:31:26 CST 2004


On Thu, 5 Feb 2004, Patrick R. Michaud wrote:

> On Thu, Feb 05, 2004 at 01:26:35AM +0100, Christian Ridderstr?m wrote:
> > 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. 
> 
> I like the markup chosen here.

Is $ ... $ inline math or display math in Latex? (and what's the other?)

> > 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.
> 
> Easy:  MD5 hash the string in brackets, and use that as the name of the 
> (cached) file containing the output.  Whenever a formula is encountered,
> perform an MD5 to determine the appropriate cache file to send.  If the
> cache file doesn't exist, create it before sending.
> 
> To keep the cache directory from overflowing, just remove it on a periodic
> basis and let the system recreate the (cache) files as needed.

I almost wrote something like "and the cache implementation is left as an 
exercise for the interested reader" :-)

Btw, this is such a standard thing... isn't there a ready made package for 
cacheing things like this?

But about the MD5 hash... what's the likelyhood of a false positive?
Don't we also need to maintain an exact copy of the latex code?
Hmm... I wonder if the .png file could contain this information in some 
auxiliarly comment field?

/Christian

-- 
Christian Ridderstr?m                           http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list