Reading these answers, and comments to them, piqued my curiosity…
Especially this sentence that Will Robertson wrote in his answer:
[...] I usually consider 1em
to be about the same size as the font size in points.
It inspired me to investigate the actual behavior of TeX (or rather LaTeX).
Since my findings could be of interest to those finding this question, I post them here.
Computer Modern
I started of by checking what length 1em
and 1ex
are for different selection of Roman/Serif/Typewriter, Medium/Bold, and Upright/Italic/Slanted/SmallCaps. Here are the results:
As we can see, 1em
varies quiet a lot; from 10.00 pt to 11.82 pt. The length of 1ex
is more consistent, with only three different values for all the different styles.
In the table some actual measurements of the font is included. These are the width of an “M” (measured as \wd
of an \hbox{M}
created when the font is active) and the height and depth of an “x” (measured similarly as \ht
and \dp
of an \hbox{x}
).
An interesting point of this table is that 1em
is neither 10 pt (the selected font size) or the M-width. On the other hand, 1ex
corresponds exactly to the height of an “x”, except for typewriter small caps.
Latin Modern
[Xavier asked about the results for Latin Modern using pdfLaTeX, so I added this section.]
To check the values for Latin Modern using pdfLaTeX I added this to the preamble:
\usepackage{lmodern}
\usepackage[T1]{fontenc}
Some more styles are available, compared to Computer Modern, so I added them to the list. Also, the bold italic typewriter style was not available for Latin Modern, so I removed it.
The values of this table corresponds to the values for Computer Modern to within a hundredth of a point for the columns 1em
, M-height, 1ex
and x-depth (all zero again).
This time it’s a bit different for the x-height values. For the most part they correspond to the value of 1ex
. However they do not correspond for these styles: medium small caps roman, all medium sans, and all typewriter styles apart from medium italic.
XeLaTeX and Latin Modern
Generating the above tables with XeLaTeX instead of pdfLaTeX, without changing the code, results in exactly the same values.
I continued the investigation with XeLaTeX and the Latin Modern fonts. I used fontspec
to load the fonts “manually” with \fontspec{fontname}
where fontname is given in the first column of the table. [See note in Conclusions regarding fontspec
.] This uses the system wide (non TeX specific) catalogue, via the fontconfig
library, to locate and load the fonts. In this particular case it loads Type1 fonts (.pfb
-files) that just happen to live in my main texmf tree.
Once again, the values for 1ex
matches the measured x-height exactly (even when x-depth is non-zero). This time, however, 1em
is exactly the specified font size (10 pt). One more thing to note is that the measured values correspond to the values for Computer Modern (rounded to hundredths of points) except for when the x-depth is non-zero.
More fonts
For good measures, I also compiled a table for some other fonts. These are all TrueType and OpenType fonts.
Conclusions
[Edit: after adding the section on Latin Modern in pdfLaTeX, I have reconsidered some of the conclusions.]
The font metric mechanism seems to differ between using TFM fonts and Xe(La)TeX’s new font support.
(non-Xe)LaTeX
(this also applies to XeLaTeX using TFM fonts.)
- The value of
1em
is not equal to the seleted 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, from the presented data I can conclude that 1ex
is most often the height of an actual “x” (\ht
of \hbox{x}
); while the value of 1em
is (almost?) never the width of an “M” (\wd
of \hbox{M}
).
XeLaTeX/fontspec
Note: I realize that this probably has nothing to do with fontspec
, per se. It is more the question of “old” vs. “new” font handling mechanisms in the engine. However I use the phrase XeLaTeX/fontspec to differentiate the new font handling from the TFM font handling still present in the XeTeX engine.
From the collected data I conclude that, for non-TFM fonts:
- 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}
)
Different Sizes
Regarding different font sizes, I have done some runs for 12 pt text, and found nothing surprising. Just remembering that the Computer Modern fonts have optical sizes so 1em
and 1ex
will (probably) depend on the font size in a non-simple way.