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.

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'?

share|improve this question

1 Answer 1

up vote 25 down vote accepted

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.

share|improve this answer
    
Somehow off-topic comment-question (;-)): Which commands do define 1ex to be (most times) the height of an x and which do deviate from them, and why? –  Christian Hupfer Jun 20 at 13:46
    
@ChristianHupfer See Johan's answer Q:4239 –  percusse Jun 20 at 13:47
4  
@ChristianHupfer No command defines 1ex; it's information stored in the font, it's the font designer's responsibility fixing it. –  egreg Jun 20 at 13:48
4  
@ChristianHupfer When a font is loaded, TeX builds an internal array where the \fontdimen parameters defined in the font are stored. A font need have at least seven \fontdimen parameters, but may have more (math symbol fonts need 22, math extension fonts need 13). The x-height is \fontdimen5; when TeX scans 1ex or 2.5ex, it looks at the internal array for the fifth value; you could also say 2.5\fontdimen5\font and achieve the same result. –  egreg Jun 20 at 13:55
2  
The \fontcharht is the case of the eTeX extension. It isn't icluded in standard TeX. The \dimexpr is the same case. –  wipet Jun 23 at 20:15

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.