# Which unit of measurement for textwidth?

Which unit of measurement should I use to specify \textwidth?

I used to specify \textheight in cm but read in some doc that one should always use multiples of \baselineskip. Indeed, the output improved considerably and I got rid of almost all badness messages. Hence I would like to know which unit is optimal for the specification of \textwidth or, in general, horizontal lengths? Of course it is not \baselineskip but what then?

My current specification is as follows:

\usepackage[
textwidth=16cm,
outer=2cm,
textheight=45\baselineskip,
heightrounded,
]{geometry}
-
Better would be to use a proper documentclass, for example scrbook. The advantage is that it builds a good type area with a proper textwidth. To get a good typographie you should use multiples of \baselineskip given in pt. – Kurt Aug 6 '12 at 15:37
@Kurt: I use the standard book class and I would rather not change it now. But what do you mean by "multiples of \baselineskip given in pt"? Isn't \baselineskip itself a kind of unit? – lpdbw Aug 6 '12 at 15:41
My English ... I mean that TeX uses pt to calculate. So \baselineskip becommes a value in pt. To get a proper typografie your text lines have to fit the textheight. So TeX/LaTeX has to calculate "(fontsize plus baselineskip) * number lines = textheight". Include \usepackage{layout} and try \layout in your document to get the layout of your document. – Kurt Aug 6 '12 at 15:55
@Kurt: your formula is wrong (fontsize is not playing any role other than it makes sense to choose a baselinskip that fits your font size) and also you have to at \topskip for the very first line. – Frank Mittelbach Aug 6 '12 at 16:33
@Frank: Yes there is an "something like" missing. But it was too late to correct my comment. Thanks. – Kurt Aug 6 '12 at 17:06

In theory you can use any supported unit. What is important, however, is that in case you have only normal paragraph text that this text properly fills the page (meaning that it doesn't have to be stretched apart to fill the page body as there may be nothing to stretch). It is therefore useful to define the \textheight as a function of \baselineskip and \topskip.

\baselineskip  is the distance from one baseline to the next in a paragraph
\topskip       is the distance from the top of the page area to the baseline of
the first line (if the page starts with a line)

For example in the standard book class (without an option like 11pt) the \baselineskipis 12pt and the \topskip is 10pt so a page with 40 lines should be 478pt. Of course you could achieve the same by giving the equivalent of that value in cm or mm but given that baselineskips are traditionally specified in points ...

If you use a value that isn't a multiple of baselineskip + topskip you may find to get "underfull" warnings, because TeX then tries to stretch pages to fill all space (that would happen in the bookclass, for example, as this class uses the setting `\flushbottom).

However, a better solution might be to use the package geometry that does a lot of work like this for you when setting up the page area. Have a look at its documentation.

-
In fact, I do use geometry --> I edited my original question accordingly! Do I still have to add \topskip to multiple of \baselienskip? – lpdbw Aug 6 '12 at 17:51
@lpdbw Don't worry: the heightrounded option of geometry performs the necessary computations to ensure that the final text height contains an integer number of lines, keeping into account the difference between \topskip and \baselineskip. – egreg Aug 6 '12 at 18:02
heightrounded does that for you behind the scenes for you, which is one of the reasons why I suggested geometry in the first place. – Frank Mittelbach Aug 6 '12 at 18:37

It really doesn't matter. Traditionally the text width would be given in pt (or commonly pica, pc = 12pt). TeX doesn't care but if you give font related sizes in terms of pt but paper related sizes in terms of conventional units such as cm or in it is harder to keep track of their relationship than if you use pt throughout. The book class uses a wild mix of pt and in units for setting the text and column width related parameters for various mostly historical reasons.

The analog of the advice for keeping \textheight and \topskip and \baselineskip in sync would be to make the text width \parindent plus a multiple of the character width, but that only makes sense if the text is mostly monospace, so isn't really relevant.

Note in the vertical case \textheight should be \topskip + an integer multiple of \baselineskip as \topskip controls where the first line goes.

-
Too short for an answer so I'll just comment here: You can do fun stuff with dimen registers: say your text width is 27 picas, then you can just say \vsize=1.62\hsize to have golden ratio between the width and height! (or, I guess I should say \textheight and \textwidth, but anyway) – morbusg Aug 6 '12 at 19:16