# How to specify the font for use by the typearea package?

One of the factors that the typearea package takes into account in calculating the page layout is the font. There is a typearea option for specifying the font size (namely, fontsize), but I haven't seen any option for specifying the font type or any font property other than its size.

Is the size the only aspect of the font that typearea uses? Isn't it possible for different fonts with the same size to have different actual sizes when rendered, which should be taken into account when laying out the page?

• typearea takes into account the (nominal) font size and the \baselineskip when calculation the page layout. It is quite possible that different fonts with the same nominal font size look different and that you will have to adjust the baselineskip/baselinestretch and/or \topskip for a perfect result. – Ulrike Fischer Jun 13 '17 at 7:32
• No package developer will start to teach a package how wide a font is. Especially given that there are thousands of thousabds of fonts – Johannes_B Jun 13 '17 at 7:33
• @UlrikeFischer: You wrote that typearea takes into account the (nominal) font size and the \baselineskip. There is a way of telling typearea what font size to consider, namely the fontsize option. But how can one tell typearea what \baselineskip to consider? – Evan Aad Jun 13 '17 at 7:39
• Every fontsize has a connected baselineskip (that's the second argument in the \fontsize command), typearea takes the \baselineskip connected to \normalsize. – Ulrike Fischer Jun 13 '17 at 7:46
• the fontsize-option defines \normalsize and \small etc and sets also their baselineskip. Try \small \the\baselineskip or \tiny\the\baselineskip with various fontsize=XXpt settings. Btw: It would be possible to take the width of characters into account by measuring some sample text, but I don't think that this is implemented in typearea (@esdd would know better). – Ulrike Fischer Jun 13 '17 at 7:58

To be on the safe side, just put the command \recalctypearea right before \begin{document}. As far as I understand the manual (you get the english version with texdoc scrguien on the command line), \recalctypearea will start a recalculation of the typearea.

If you change fonts or margin settings in the middle of your document, do the same.

Edit: There is no need to calculate the typearea in dependence to »special effects« of a fonts. Whether the textwidth is a little bit more or not simply is not important. Maybe you should read the section in the KOMA-script manual about typearea and then something about typography.

• So what if I specify the font with fontspec inside the preamble and then call \recalctypearea. Will typearea take into account all aspects of the font that were specified, including swash effects and whatnot? Or will it only consider the font size and baseline? – Evan Aad Jun 13 '17 at 7:50

typearea (if you use the option calc) tries to find an optimal layout along the lines of some classical construction method.

It uses the \baselineskip of \normalsize, the linespread (\baselinestretch), the fontsize, and also the width of the chars (it measures beside others a sample text abcdefghijklmnopqrstuvwxyz).

It is doing a quite good job if you want a layout with this construction method.

But you should take into account these limits:

1. When using the fontsize option (don't use the \fontsize command to setup document defaults) the baseline is calculated/set in dependance to the (nominal) font size and doesn't need to be ideal. Sometimes it is necessary to add a \linespread (e.g. with the setspace package).

2. The calculations of typearea should be done after all font and paper size related settings have been made. So issuing a \recalctypearea at \begin{document} is normally a good idea.

3. typearea can take only font metrics into account. It doesn't see swashes or other features of the glyphs.

4. In edge cases (small fontsize, large fontsize, unusual font, unusual paper sizes, unusual book content ...) the calculation perhaps doesn't give the most pleasing result.

5. The construction method itself doesn't need to be the best choice. There are other ways to define a good page layout.

So keep an open mind and don't believe that computers/computation can really replace the critical eye of a human designer.

• Thanks. Regarding point #1: so the use of the \fontsize command in the preamble is discouraged in documents that use a KOMA-script document class? – Evan Aad Jun 13 '17 at 8:51
• It is useless (in all classes). If you want to change the default font size you need to redefine \normalsize, that's what to fontsize option of KOMA does internally. – Ulrike Fischer Jun 13 '17 at 8:53