30

In my answer to “Which measurement units should one use in LaTeX?” I explore the values of 1em and 1ex for different fonts using both TFM fonts and the font mechanisms of XeLaTeX that uses non-TFM fonts.

My, highly empirical, conclusions in that post are:

  • For TFM fonts:
    • The value of 1em is not equal to the ‘selected size’ of the font, nor is it the width of an actual “M”.
    • The value of 1ex is not tied to the size of an actual “x”. However, for all the ‘Computer Modern’ text fonts and most styles of the ‘Latin Modern’ text fonts, 1ex = \ht of \hbox{x}
  • For non-TFM fonts (in XeLaTeX):
    • The value of 1em is exactly the ‘selected font size’.
    • The value of 1ex is exactly the height of an “x”. (\ht of \hbox{x})

Now to my question. Am I correct to assume that:

  • For TFM fonts:
    • The values of 1em and 1ex are separate, “independent”, values in the font definition file, and those are read into LaTeX when the font is loaded.
  • For non-TFM fonts (in XeLaTeX):
    • The value of 1em is always set to the ‘selected font size’, and the value of 1ex is always set to the height of an “x”. (\ht of \hbox{x})
    • or; is it possible to have 1em ≠ ‘selected font size’ and/or 1ex\ht of \hbox{x}?

Edit to better specify what answer I am looking for:

The answer provided by tohecz deals with the design reasons for having 1em and 1ex not exactly tied to the extents of letters “M“ and “x”. What I am looking for is an answer more on the lines of where TeX loads these values from.

The answer provided by David Carlisle corroborates my first assertion (that for TFM fonts values are loaded from the font definition file, and are independent on the extents of the letters “M” and “x”).

What’s left is whether, for Xe(La)TeX, fonts loaded from non-TFM files, the values are always taken from the selected size and extents of letter “x”.

I find this interesting since the values of 1em and 1ex differ between whether you load Latin Modern fonts from TFM files (via e.g. \usepackage{lmodern}) or via new font methods (via e.g. \fontspec{LMSans10})

[I realize that \usepackage{lmodern} is probably most consistent, but still...]

3
  • With \usepackage{lmodern} you're not using the OpenType version, but the standard TFM fonts.
    – egreg
    Feb 13, 2013 at 23:27
  • @egreg: I know that. However (on my system) the fonts LMSans10 (and friends) are Type1 fonts (lc-list reports file names like lmss10.pbf), so they are not OpenType either.
    – Johan_E
    Feb 13, 2013 at 23:34
  • I agree with David that most probably XeTeX uses a default for those dimensions. I believe that OpenType fonts have the possibility of setting the value for the em, but I don't think the ex is meaningful for them.
    – egreg
    Feb 13, 2013 at 23:40

2 Answers 2

17

As listed in

What do different \fontdimen<num> mean

the ex and em lengths are specified separately in the tfm format as parameters 5 and 6 respectively. the font designer can set these to anything, although usually ex is as you say the height of an x (em is a bit more variable but is usually close to the nominal design size). Also you can set them to anything in TeX just after loading the font, before any text is typeset with it.

Not sure about xetex, but I suspect it takes the default values that you suggest.

1
  • Thanks. Exactly (part of) the answer I was looking for. Hopefully someone can answer the XeTeX part of my question.
    – Johan_E
    Feb 13, 2013 at 23:25
5

Im not sure if this is a valid answer since I'm neither a professional typographer nor a font designer. Still, I'll add my opinion: I suppose that a sort of consistency plays a role here.

You want a \rule{1ex}{1ex} have the same size not depending whether the current font setting is \bfseries or \itshape (which changes \heightof{x}). And reason why in Computer Modern and derived fonts the 1em changes from 10pt to 11pt for \mdseries vs. \bfseries might be in the fact that \widthof{<single-digit>} is always 0.5em for these fonts.

1
  • Sure, I agree with what you write. However that is not what I ask for. I will update my question to better reflect what kind of answer I am looking for. [Don’t delete this answer, it still contains useful background information]
    – Johan_E
    Feb 13, 2013 at 22:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .