The memoir manual mentions
measuring the length of the lowercase alphabet
in order to decide the numbers of characters per line. Can this be done with LaTeX?
The memoir manual mentions
measuring the length of the lowercase alphabet
in order to decide the numbers of characters per line. Can this be done with LaTeX?
If with the length it means the width of all lowercase letters than you can use \settowidth{<length register>}{<content>}:
\documentclass{article}
\begin{document}
\newlength{\alphabetlength}
\settowidth{\alphabetlength}{abcdefghijklmnopqrstuvwxyz}
\the\alphabetlength
\end{document}
(I took the liberty to use the same format as Yiannis answer to allow for better comparison. His answer is fine too, but I wanted to show the official LaTeX way.)
You can place the letters in a box and measure its length. Here is a minimal to do this.
\documentclass{article}
\begin{document}
\newbox\alphabet
\sbox\alphabet{abcdefghijklmnopqrstuvwxyz}
\the\wd\alphabet
\end{document}
\sbox\alphabet{...} by \savebox\alphabet\hbox\bgroup...\egroup.
– Bruno Le Floch
May 14 '11 at 13:16
Just for the record, page 15 of memman.pdf brings the following to print the length of the lowercase alphabet:
\newlength{\mylen} % a length
\newcommand{\alphabet}{abc...xyz} % the lowercase alphabet
\begingroup % keep font change local
% font specification e.g., \Large\sffamily
\settowidth{\mylen}{\alphabet}
The length of this alphabet is \the\mylen. % print in document
\typeout{The length of the Large sans alphabet
is \the\mylen} % put in log file
\endgroup % end the grouping
Which is basically @Martin's way.
\ht,\wdand\dprespectively. – Martin Scharrer May 04 '11 at 20:07