[Tex/LaTex] DIV and BCOR setting in KOMA (best practices)

best practicesgeometrykoma-scriptmarginstypearea

I have been playing around and I now realize it is possible to set the type area using a KOMA class by a couple of ways, and I'll like to know which is the correct one.

\documentclass[%
a4paper,
12pt,
%BCOR=3mm, %<---Should I load it here or in 'marito.sty'?
%DIV=12, %<---Should I load it here or in 'marito.sty'?
twoside,%default
]{scrbook}

\usepackage{marito}

\begin{document}
Recto Page
\newpage
Verso Page
\end{document}

First option: I know that KOMA default is a4paper, and if I set the font to 12pt it automatically defaults to DIV=12.

Second option: I know I can set both BCOR and DIV directly as an optional argument to the KOMA-class scrbook.

Third option: Since I'm using my own .sty file, I can set BCOR and DIV with \typearea[3mm]{12} (see marito.sty)

Fourth option: Also, because of the use of my marito.sty file, I can set BCOR and DIV with \KOMAoptions{DIV=12,BCOR=12mm}

This is what is contained in marito.sty:

\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
%\typearea[3mm]{12} % <---Should I use this one
%\KOMAoptions{DIV=12,BCOR=3mm} %<--- or this one?
\RequirePackage{lmodern}

\RequirePackage[pass,showframe]{geometry} % Just to show the frame around the textbox

As mentioned in the comments, I have tested all possibilities and they all seem to work. The question I have is what's the right way to set the BCOR and DIV when you are using a custom .sty file?

Best Answer

Note that the KOMA-Script class loads the package typearea itself and the text block and the margins are calculated immediately for the first time.

The first and the second version are the same (if the standard value is chosen in the second): the text body and the margins are calculated onces.

Third version: There is a second calculation of the page layout when \typearea[<bcor>]{<div>} is called. Already done changes of line spacing and KOMAoptions regarding to the page layout are taken into account.

And there is also a difference between your third and fourth version. From the KOMA-Script manual:

If both BCOR and DIV need changing, then it is recommended to use \typearea, since then the text block and margins are recalculated only once. With \KOMAoptions{DIV=DIV ,BCOR=BCOR } the text block and margins are recalculated once for the change to DIV and again for the change to BCOR.


I suggest to set the BCOR option as an argument of the KOMA-class because it depends from the document itself, especially from the number of pages.


Note that the predefined DIV value is only a compromise and does not take into account the font chosen. I suggest to use DIV=calc instead of the predefined value.

Here is an simple example to demonstrate the difference:

\documentclass[BCOR=3mm,12pt]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\KOMAoptions{DIV=calc}% recalculate the page layout with a calculated DIV value
\usepackage{blindtext}

\begin{document}
\blinddocument
\end{document}

The following snippet of the log file shows that the calculated DIV value is 9 instead of the predefined value 12:

...
(C:\LocalPrograms\LocalTeXMFs\koma-script-current\tex\latex\koma-script\typeare
a.sty
Package: typearea 2014/04/09 v3.13.1756 KOMA-Script package (type area)

Package typearea, 2014/04/09 v3.13.1756 KOMA-Script package (type area)
                  Copyright (C) Frank Neukam, 1992-1994
                  Copyright (C) Markus Kohm, 1994-

\ta@bcor=\skip41
\ta@div=\count79
\ta@hblk=\skip42
\ta@vblk=\skip43
\ta@temp=\skip44
\footheight=\skip45
Package typearea Info: These are the values describing the layout:
(typearea)             DIV  = 12
(typearea)             BCOR = 8.53581pt
(typearea)             \paperwidth      = 597.50793pt
(typearea)              \textwidth      = 441.7291pt
(typearea)              DIV departure   = -4%
(typearea)              \evensidemargin = 25.89203pt
(typearea)              \oddsidemargin  = -14.65317pt
(typearea)             \paperheight     = 845.04694pt
(typearea)              \textheight     = 635.5pt
(typearea)              \topmargin      = -41.72441pt
(typearea)              \headheight     = 18.125pt
(typearea)              \headsep        = 21.75pt
(typearea)              \topskip        = 12.0pt
(typearea)              \footskip       = 50.75pt
(typearea)              \baselineskip   = 14.5pt
(typearea)              on input line 1332.
)
...
...
DIV calculation for typearea with good linewidth.
LaTeX Font Info:    Try loading font information for T1+lmr on input line 4.
(C:\LocalPrograms\MiKTeX2.9\tex\latex\lm\t1lmr.fd
File: t1lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
)
Package typearea Info: These are the values describing the layout:
(typearea)             DIV  = 9
(typearea)             BCOR = 8.53581pt
(typearea)             \paperwidth      = 597.50793pt
(typearea)              \textwidth      = 392.64809pt
(typearea)              DIV departure   = 0%
(typearea)              \evensidemargin = 58.6127pt
(typearea)              \oddsidemargin  = 1.70717pt
(typearea)             \paperheight     = 845.04694pt
(typearea)              \textheight     = 577.5pt
(typearea)              \topmargin      = -18.25089pt
(typearea)              \headheight     = 18.125pt
(typearea)              \headsep        = 21.75pt
(typearea)              \topskip        = 12.0pt
(typearea)              \footskip       = 50.75pt
(typearea)              \baselineskip   = 14.5pt
(typearea)              on input line 4.
...

But as I have already mentioned the KOMA-Script class loads the package typearea itself and at that moment the class option DIV=calc is evaluated to a value according to the LaTeX standard font.

After loading a package with a significant different font (lmodern is similar to the standard fonts) you have to (re)calculate this value using \KOMAoptions{DIV=calc} or \typearea[current]{calc}. Instead you can say \recalctypearea if DIV=calc was already set for the previous calculation of the text block and the margins. \recalctypearea is an abbreviated command for \KOMAoptions{DIV=last} or \typearea[current]{last}.

In addition, a recalculation by the typearea package is necessary if you change KOMAoptions regarding the page layout (headheight, headinclude etc.) and also if you change the line spreading (to ensure that the \textheight less \topskip is a multiple of \baselineskip).


In conclusion, I suggest:

Use \documentclass[BCOR=<bcor>,DIV=calc,...]{scrbook} in the main file.

If there are significant changes of font or any changes of the line spacing or the KOMAoptions regarding the page layout in your marito.sty file, use \recalctypearea after this changes are done.

Note that you find all values determined by typearea in the log file. If necessary you can set a moderately adjusted value <div> by \documentclass[BCOR=<bcor>,DIV=<div>,...]{scrbook}. Then the command \recalctypearea will also use this manually chosen <div> value.