TeX in xlabel ?

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

    > I wish you luck!

Who needs luck when we've got people like you around! :slight_smile:

    > Taking this as a challenge (and having little to do while
    > waiting for images to process), I wrote a TFM parser that
    > handles the extra parameters for math symbols. This
    > format[1] is excruciatingly painful.

    > http://starship.python.net/crew/kernr/tfm.py

    > And then I realized that the output of tftopl(1) is
    > incredibly easy to parse and contains the same
    > information. <sigh>

    > Either way, you now have the information you need for some
    > fonts, at least.

Awesome - impressive work for an afternoon. Thanks for pointing me to
that dvi specification reference. I was trying to discern the format
from TeX: The Program, which despite its literate style, was less
accessible than the reference you pointed to. It is painful, though,
as you say, no matter how you slice it.

Funny that I missed tftopl in my hunt for a parser, which was sitting
right on my system the whole time.

In order to use this information in mathtext, we have reconstruct the
mapping from TeX symbol name to font and character number for each of
the tex symbols we use (cmr10, cmi10, cmex10 and cmsy10) . Currently
mathtext hardcodes the mapping from tex name to bakoma
fontname/number.

A better approach would be to use either the mathml or unicode number
as the internal code for each symbol, and then provide mappings from
these to the tfm fontname/charnum and to the corresponding tex symbol
names - my guess is that this has already been done and we just have
to dig it up.

Then we could use any of the fonts (Wolfram, Design Science, Symbol,
AMS, Bakoma) at http://www.mozilla.org/projects/mathml/fonts/encoding
for matplotlib mathtext, since the mapping from mathml/unicode to
fontname/charnum already exists on pages like
http://www.mozilla.org/projects/mathml/fonts/encoding/cmr.html, and is
easily parsed (I already did this when I was working on PS mathtext
with type1 fonts before Paul had the bright idea of just embedding the
truetype fonts in the ps document and reusing what we already had.

In summary, it would be nice to be able to readily go from tex name
<-> mathml/unicode name <-> fontname/charnum in a variety of files,
including at a minimum the bakoma ttf and the corresponding tfm files.
Got some images to process today <wink>

Does this sound like the right approach to you?

JDH

John Hunter wrote:

Awesome - impressive work for an afternoon. Thanks for pointing me to
that dvi specification reference. I was trying to discern the format
from TeX: The Program, which despite its literate style, was less
accessible than the reference you pointed to. It is painful, though,
as you say, no matter how you slice it.

Funny that I missed tftopl in my hunt for a parser, which was sitting
right on my system the whole time.

I know how you feel. *Believe* me. In any case, please use tftopl. I'm pretty sure there's a bug in how tfm.py reads the fixed-point values, but I'm giving up in favor of tftopl.

In order to use this information in mathtext, we have reconstruct the
mapping from TeX symbol name to font and character number for each of
the tex symbols we use (cmr10, cmi10, cmex10 and cmsy10) . Currently
mathtext hardcodes the mapping from tex name to bakoma
fontname/number.

A better approach would be to use either the mathml or unicode number
as the internal code for each symbol, and then provide mappings from
these to the tfm fontname/charnum and to the corresponding tex symbol
names - my guess is that this has already been done and we just have
to dig it up.

Does http://www.dessci.com/fr/support/tech/encodings/font_enc.stm help?

Then we could use any of the fonts (Wolfram, Design Science, Symbol,
AMS, Bakoma) at http://www.mozilla.org/projects/mathml/fonts/encoding
for matplotlib mathtext, since the mapping from mathml/unicode to
fontname/charnum already exists on pages like
http://www.mozilla.org/projects/mathml/fonts/encoding/cmr.html, and is
easily parsed (I already did this when I was working on PS mathtext
with type1 fonts before Paul had the bright idea of just embedding the
truetype fonts in the ps document and reusing what we already had.

In summary, it would be nice to be able to readily go from tex name
<-> mathml/unicode name <-> fontname/charnum in a variety of files,
including at a minimum the bakoma ttf and the corresponding tfm files.
Got some images to process today <wink>

Does this sound like the right approach to you?

More or less. Converting from TeX encodings (which are arcane) to modern standards as soon as possible is almost certainly the best approach.

···

--
Robert Kern
rkern@...376...

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

[Sorry for the self-reply]

Robert Kern wrote:

Does http://www.dessci.com/fr/support/tech/encodings/font_enc.stm help?

No, it in fact does not.

···

--
Robert Kern
rkern@...376...

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter