From: John H. <jdh...@ac...> - 2004-10-26 16:45:04
|
>>>>> "Chris" == Chris Barker <Chr...@no...> writes: Chris> Gary wrote: >> Matplotlib doesn't support \text, and it requires that the >> first and last characters of a TeX string be $. I guess it >> only processes mathmode. Well, it can't do *everything*. It is on the goals page (http://matplotlib.sourceforge.net/goals.html) to support embedded math strings like s = r'Mean ($\mu=5) and standard deviation ($\sigma=1$)' This wouldn't be too hard - just takes some time that I haven't had of late. Chris> Oh well, I've always thought that if you want to support Chris> Math in a graphics package, you would actually use TeX, Chris> rather than emulating it. Maybe like PyX: Chris> http://pyx.sourceforge.net/ Yes, but you lose the platform independence and portability by doing this. It would be nice to be able to choose one or the other -- see below. Chris> The problem, of course, is that requiring a TeX system is a Chris> BIG dependency! It would be nice if one could re-package Chris> the Tex interpreter to be embedded. I have no idea how big Chris> a job that would be. You'd also have all the font issues, Chris> of course, but while that would all be a lot of work, I'm Chris> not sure it would be more work than trying to re-write TeX! It would be a monster job. There is basically no way to factor tex into components -- it's a monolithic system, in part because of the heavy use of web macros. And web2c, the conversion of web/pascal to c, is GPLd and less permissive than the matplotlib license. So embedding tex is a no-go, aside from size considerations. But there are some possibilities for improving what matplotlib already offers. One is to fall back on tex where available as a command line tool (as pyx does, I believe), and use other command line tools to convert the dvi to png or some other raster format and then embed it. This would require a few external libs and utilities, but it's certainly doable. Another idea I had while reading Knuth's "TeX: The Program" is to use the layout information in the TFM font metric files. Apparently math fonts have additional layout information in them, like where to place superscripts. I've looked at several tfm parsing implementations, and haven't found one yet that actually extracts this information; most extract the standard font information but not the special math information. But if we could access this info, we could include the tfm files for common raster sizes and use the layout info crafted by the master himself. A third possibility would be to support mathml, using some good mathml renderer. Is there a good, free mathml rendering library - what does mozilla use for this? JDH |