17

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?

  • 2
    As far as i know, loading geometry trashes the default KOMA settings. Maybe package showframe is better. – Johannes_B Jun 2 '14 at 19:40
  • @Johannes_B even though I'm explicitly passing every possible command (except, of course, for showframe)? – Mario S. E. Jun 2 '14 at 19:44
  • I am not sure. If you set DIV and BCOR after loading geometry, you might need \recalctypearea. But, as said before, i am not sure. – Johannes_B Jun 2 '14 at 19:48
  • @Johannes_B I know for sure these four options work (I have tested them all). I don't have an issue per se, I just want to know which one is the right one to call DIV and BCOR when using a custom .sty file – Mario S. E. Jun 2 '14 at 19:50
  • 1
    @Johannes_B: Option pass of package geometry should keep the current settings. – Heiko Oberdiek Jun 3 '14 at 16:21
21
+50

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.

  • I am sorry, but I would be grateful if you could help me produce the desired output in my previous question without using geometry package as in the accepted answer. – Diaa Apr 27 '17 at 0:19
  • 1
    @DiaaAbidou If you have special requirements for the page margins like 2cm for the bottom and 2cm for the right margin like in your linked question then you have to use package geometry. – esdd Apr 27 '17 at 8:55
  • I see; I thought it could be done using typearea only. Thanks for your clarification. – Diaa Apr 27 '17 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.