Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Update:

Per Yan's suggestion, currently reading: ctan.tug.org/ctan/macros/latex/doc/encguide.pdf

Setup

When I type $\alpha$ in LaTeX, this \alpha becomes mapped to some character inside of some foobar.pfb file.

Question

Where is this mapping stored?

Context

This is a followup to: Generating fonts of all LaTeX math symbols

I have figured out that:

* I want *.pfb, not *.ttfs
* I can load *.pfbs into my Java display code and they work perfectly fine

Now, I need a way to map the various defines in ams math to the various characters in the various *.pfb files.

Elegant Solution

Given that the mapping is likely not in an easily parseable format, is there a way to get TeX to query it for me? I.e. I'm totally happy defining some macro of the form:

\magicmacro{symbol-name}

which then dumps out to output.log which *.pfb file and which character symbol-name maps to.

Thanks!

share|improve this question
    
Perhaps you are asking about encoding. See ctan.tug.org/ctan/macros/latex/doc/encguide.pdf It is difficult to answer things without actually repeating what's there. The most relevant part is section 1 and references therein –  Yan Zhou May 18 '12 at 1:31
    
I believe what I want is either (1) something like the Appendices of that document, except instead of the actual symbol, I want the LaTeX command used to generate the symbol or (2) a *.enc file <-- not so sure about this one. –  user13546 May 18 '12 at 2:23
add comment

2 Answers

The mapping from \alpha to the glyph is not so easy. Let's first see how \alpha is defined in Plain TeX

\mathchardef\alpha="010B

This means, first of all, that \alpha can be used only in math mode. Then TeX interprets the four hexadecimal figures (" is the prefix telling TeX that the following number is expressed in its hexadecimal form):

  1. 0 means that \alpha is to be considered as an ordinary symbol, for spacing in math formulas;

  2. 1 means that the glyph will be taken from the math family number 1

  3. 0B means that the glyph is at position 0B in that font (a TeX font has 256 slots, numbered from "00 to "FF).

Let's see \sum, for comparison:

\mathchardef\sum="1350

1 is the "operator type", 3 is the math family and 50 is the slot.

TeX maintains up to 16 math families and families from 0 to 3 have a special meaning: from family 0 are drawn the digits (so the font assigned to it should match the document's main font), the letters for function names like "sin" and the uppercase Greek letters; in family 1 we find the math italic letters and the lowercase Greek letters; in family 2 most of the symbols such as \times or \sim; in family 3 the big operators like \sum, \int and the extensible delimiters.

LaTeX builds on the same scheme, of course, but adds some layers for easing programming and switching fonts. Its definition of \alpha can be found in fontmath.ltx:

\DeclareMathSymbol{\alpha}{\mathord}{letters}{"0B}

that is very similar to the previous one: \mathord stands for 0, letters is a symbolic name for 1 and "0B denotes the same slot. Here's \sum:

\DeclareMathSymbol{\sum}{\mathop}{largesymbols}{"50}

(largesymbols will be translated into 3 and \mathop into 1).

The story doesn't end here. We have to assign fonts to the math families. This is done again in fontmath.ltx:

\DeclareSymbolFont{operators}   {OT1}{cmr} {m}{n}
\DeclareSymbolFont{letters}     {OML}{cmm} {m}{it}
\DeclareSymbolFont{symbols}     {OMS}{cmsy}{m}{n}
\DeclareSymbolFont{largesymbols}{OMX}{cmex}{m}{n}

assign fonts to the main math families described above. When LaTeX is asked to typeset an \alpha (so in the letters family) it looks for an OML-encoded font in family cmm, medium weight and italic shape; so it looks in the definitions in the file omlcmm.fd where it finds

\DeclareFontShape{OML}{cmm}{m}{it}%
     {<5><6><7><8><9>gen*cmmi%
      <10><10.95>cmmi10%
      <12><14.4><17.28><20.74><24.88>cmmi12%
      }{}

that says, roughly, that if the symbol has to be in size 10 it must be in the font cmmi10. It's then a job for pdftex to get the translation into the .pfb file via the pdftex.map file where lines such as

cmmi10 CMMI10 <cmmi10.pfb

are present; the first cmmi10 means the TeX font, CMMI10 is its Postscript name and then cmmi10.pfb is the actual Postscript font file.

Not for the faint of heart, I'm afraid: it involves many low level concepts from the basis of TeX and hundreds of definitions. But not unmanageable, after all.

share|improve this answer
add comment

I believe what I want is:

/usr/local/texlive/2011/texmf-dist/source/latex/amsfonts/*.dtx

in particular, the DeclareMathSymbol parts

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.