[Tex/LaTex] n `ex` unit equivalent for the capital ‘X’ in LaTeX

characterslengthsunit-of-measure

In LaTeX, the ex unit represents the height of a lowercase 'x' in the current font.

Is there a length in LaTeX that represents the height of a capital 'X'?

Best Answer

The information about 1ex is stored in the font; it is usually the height of a lowercase ‘x’, but it need not be necessarily.

You can access the height of an uppercase ‘X’ by

\fontcharht\font`X

A way for expressing lengths in this ‘unit of measure’ is

\newcommand{\eX}{\dimexpr\fontcharht\font`X\relax}

so you can say something like

\vspace{1.2\eX}

or

\setlength{\mylen}{2\eX}

where \mylen has been allocated with \newlength.