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'?
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'?
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.
1exto be (most times) the height of anxand which do deviate from them, and why? – Jun 20 '14 at 13:461ex; it's information stored in the font, it's the font designer's responsibility fixing it. – egreg Jun 20 '14 at 13:481exthen. – Jun 20 '14 at 13:50\tikz[baseline=-.5\eX]but it does not seem to work. Am I missing something? – sergej Jun 20 '14 at 13:55\fontdimenparameters defined in the font are stored. A font need have at least seven\fontdimenparameters, but may have more (math symbol fonts need 22, math extension fonts need 13). The x-height is\fontdimen5; when TeX scans1exor2.5ex, it looks at the internal array for the fifth value; you could also say2.5\fontdimen5\fontand achieve the same result. – egreg Jun 20 '14 at 13:55A\tikz[baseline=-1\eX]\draw(0,0)--(1,0);B– egreg Jun 20 '14 at 14:04\tikz[baseline=-.5\mylen]... – sergej Jun 20 '14 at 14:11\fontcharhtis the case of the eTeX extension. It isn't icluded in standard TeX. The\dimexpris the same case. – wipet Jun 23 '14 at 20:15\relaxis gobbled when\dimexpris evaluated. – egreg Jun 25 '14 at 08:22\endexprinstead of\relax, but I don't know the details of the implementation. – egreg Jun 25 '14 at 09:02