From: Chris B. <Chr...@no...> - 2004-10-26 19:45:01
|
John Hunter wrote: >>>>>>"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$)' did you mean: s = r'Mean ($\mu=5$) and standard deviation ($\sigma=1$)' I think there was a missing "$". That would be nice. > It would be nice to be able to choose one or the other -- that would be nice. > 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. Ah. too bad. It's nice to know you've looked into this some. > 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. web2c is essentially a compiler of sorts, isn't it? So there wouldn't be any problem with distributing C code created by it would there? In any case, there are LOTS of commercial TeX distributions out there, so there must be a way. This doesn't address the other big issues, however. AmiPro, the word processor bought by Lotus, then later turned into WordPro, used TeX to format math. I used it for years before I discovered LaTeX because it had such nice math rendering (MS Word's still sucks!). They somehow managed to embed it, so I suppose it can be done! That doesn't mean it's the least bit easy, however. > But there > are some possibilities for improving what matplotlib already offers. good news, of course. > 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. That would be a nice option, but I'd rather see a DVI driver built in to Matplotlib, than a raster format. That's how PyX does it. I guess that would require matplotlib to have the same fonts, however. Another option would be PDF or EPS, but that would probably only be convenient for PS and/or PDF output. > 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. very cool. > 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? good question. That would be nice, too. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |