Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/documentation/chapters/options.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ \section{\Class{KOMA} Options}
they are separated by half a line worth of space: the \Option{parskip}
value is \enquote{half}.} not marked by indentation.

The \KOMAScript\xspace option \Option{BCOR} (binding correction) is supported;
its value is forwarded to \Package{geometry} as a binding offset so that
inner margins are enlarged automatically. For example,
\lstinline|\documentclass[BCOR=8mm]{kaobook}| adds an 8\,mm correction to
the inner margin.

\section{\Class{kao} Options}

In the future I plan to add more options to set the paragraph formatting
Expand Down
17 changes: 17 additions & 0 deletions kao.sty
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,27 @@
\@ifclasswith{\@baseclass}{a4paperlandscape}{\setlength{\hscale}{1.414mm}\setlength{\vscale}{0.707mm}}{}
\@ifclasswith{\@baseclass}{169paperlandscape}{\setlength{\hscale}{1.414mm}\setlength{\vscale}{0.562mm}}{}

% Create a length to store the binding correction from KOMAScript
\newlength{\kao@bcor}
\setlength{\kao@bcor}{0pt}

% Set the default page layout
\RequirePackage[
paperwidth=210\hscale,
paperheight=297\vscale,
]{geometry}

% Extract BCOR value from KOMAScript immediately after geometry is loaded
% This must happen before any \newgeometry calls
% Use ta@bcor which is KOMAScript's internal register for BCOR
\AtEndPreamble{%
\@ifundefined{ta@bcor}{%
\setlength{\kao@bcor}{0pt}%
}{%
\setlength{\kao@bcor}{\ta@bcor}%
}%
}

% Command to choose among the three possible layouts
\DeclareDocumentCommand{\pagelayout}{m}{%
\ifthenelse{\equal{margin}{#1}}{\marginlayout\marginfloatsetup}{}%
Expand All @@ -191,6 +206,7 @@
% Layout #1: large margins
\newcommand{\marginlayout}{%
\newgeometry{
bindingoffset=\kao@bcor,
top=27.4\vscale,
bottom=27.4\vscale,
inner=24.8\hscale,
Expand All @@ -205,6 +221,7 @@
% Layout #2: small, symmetric margins
\newcommand{\widelayout}{%
\newgeometry{
bindingoffset=\kao@bcor,
top=27.4\vscale,
bottom=27.4\vscale,
inner=24.8\hscale,
Expand Down