ifiseries.sty 43.5 KB
Newer Older
Lasse Kliemann's avatar
Lasse Kliemann committed
1 2 3 4 5 6 7 8 9 10 11 12
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ifiseries}
\RequirePackage{kvoptions}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Options and their defaults

\DeclareBoolOption[false]{natbib}
\DeclareBoolOption[false]{babelbib}
\DeclareBoolOption[true]{biblatex}
\DeclareStringOption[sort,numbers]{natbibOptions}
\DeclareStringOption[alphabetic]{biblatexstyle}
13
\DeclareStringOption[minalphanames=3,maxcitenames=4,maxbibnames=10,autolang=other]{biblatexOptions}
Lasse Kliemann's avatar
Lasse Kliemann committed
14 15 16 17 18 19 20 21 22 23
\DeclareStringOption[]{biblatexAdditionalOptions}
\DeclareStringOption[biber]{biblatexBackend}
\DeclareStringOption[]{bibresource}
\DeclareStringOption[ngerman,english]{babelOptions}
\DeclareStringOption[]{variorefOptions}
\DeclareBoolOption[true]{algorithm}
\DeclareStringOption[linesnumbered,ruled,vlined]{algorithmOptions}
\DeclareStringOption[alphaurl]{bibliographystyle} % only for bibtex, not biblatex
\DeclareStringOption[utf8]{inputencOptions}
\DeclareBoolOption[true]{tikz}
24
\DeclareStringOption[1.3]{pgfplotscompat}
Lasse Kliemann's avatar
Lasse Kliemann committed
25 26
\DeclareBoolOption[true]{algorithmForwardCompatibility}
\DeclareBoolOption[true]{algorithmBackwardCompatibility}
27
\DeclareStringOption[acronym]{acronymPackage}
Lasse Kliemann's avatar
Lasse Kliemann committed
28
\DeclareStringOption[smaller,nohyperlinks,printonlyused]{acronymOptions}
29
\DeclareStringOption[4em]{acroLabelWidth}
30
\DeclareStringOption[]{hyphenatOptions}
Lasse Kliemann's avatar
Lasse Kliemann committed
31 32
\DeclareStringOption[caption=false,font=footnotesize]{subfigOptions}
\DeclareStringOption[]{theorems}
33 34
\DeclareStringOption[]{theoremsplainfont}
\DeclareStringOption[]{theoremsremarkfont}
Lasse Kliemann's avatar
Lasse Kliemann committed
35 36 37 38 39 40 41 42 43 44
\DeclareStringOption[Bibliography]{refname}
\DeclareStringOption[black]{hypercolor}
\DeclareBoolOption[false]{dottednumbers}
\DeclareStringOption[english]{language}
\DeclareBoolOption[true]{runningtitle}
\DeclareBoolOption[true]{includehead}
\DeclareBoolOption[true]{frenchspacing}
\DeclareBoolOption[false]{onemargin}
\DeclareStringOption[]{margincontrol}
\DeclareBoolOption[true]{mathabx}
Lasse Kliemann's avatar
Lasse Kliemann committed
45
\DeclareBoolOption[false]{txfonts}
46
\DeclareBoolOption[true]{xcolor}
Lasse Kliemann's avatar
Lasse Kliemann committed
47 48 49 50 51 52 53 54 55 56

\DeclareBoolOption[true]{layout}
\DeclareBoolOption[true]{pagelayout}
\DeclareStringOption[ustrade]{paper}
\DeclareStringOption[]{paperwidth}
\DeclareStringOption[]{paperheight}
\DeclareStringOption[0mm]{bindingcorrection}
\DeclareStringOption[.25]{halfparskipfill}
\DeclareBoolOption[false]{halfparskip}
\DeclareStringOption[Palatino]{font}
57
\DeclareStringOption[ppl]{PalatinoSC}
Lasse Kliemann's avatar
Lasse Kliemann committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
\DeclareStringOption[12]{marginfrac}
\DeclareStringOption[floatrow]{figure}
\DeclareStringOption[]{compact}
\DeclareStringOption[1.5]{headsepmult}
\DeclareStringOption[3]{footskipmult}
\DeclareBoolOption[false]{leftmarkright}
\if@twoside
\DeclareBoolOption[false]{hcenter}
\else
\DeclareBoolOption[true]{hcenter}
\fi
\@ifclassloaded{book}%
{\DeclareStringOption[section]{theoremswithin}}%
{\DeclareStringOption[subsection]{theoremswithin}}

\DeclareBoolOption[false]{largepaper}

\ProcessKeyvalOptions*

\RequirePackage{etoolbox}
\RequirePackage{xifthen}
\RequirePackage{expl3}
80
\RequirePackage{xparse}
Lasse Kliemann's avatar
Lasse Kliemann committed
81 82 83 84 85 86 87 88 89 90 91

\ififiseries@largepaper
  \let\ifiseries@marginfrac\@undefined%
  \let\ifiseries@headsepmult\@undefined%
  \let\ifiseries@footskipmult\@undefined%
  \DeclareStringOption[9]{marginfrac}%
  \DeclareStringOption[2]{headsepmult}%
  \DeclareStringOption[3.5]{footskipmult}%
\fi

\ExplSyntaxOn
92
\str_case:onF{\ifiseries@language}{
93 94
  {english} {\relax}
  {german} {
Lasse Kliemann's avatar
Lasse Kliemann committed
95 96 97 98 99 100 101 102 103 104 105
      \let\ifiseries@babelOptions\@undefined%
      \let\ifiseries@variorefOptions\@undefined%
      \let\ifiseries@refname\@undefined%
      \let\ifiseries@dottednumberstrue\@undefined%
      \let\ifiseries@dottednumbersfalse\@undefined%
      \let\ififiseries@dottednumbers\@undefined%
      \DeclareStringOption[english,ngerman]{babelOptions}%
      \DeclareStringOption[ngerman]{variorefOptions}%
      \DeclareStringOption[Bibliografie]{refname}%
      \DeclareBoolOption[true]{dottednumbers}%
      }
106
}{\PackageError{ifiseries}{Unsupported~language:~\ifiseries@language}\@ehc}
Lasse Kliemann's avatar
Lasse Kliemann committed
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
\ExplSyntaxOff

\ifthenelse{\equal{\ifiseries@theorems}{numberslast}}%
{\let\ifiseries@theoremswithin\@undefined%
\@ifclassloaded{book}%
{\DeclareStringOption[chapter]{theoremswithin}}%
{\DeclareStringOption[section]{theoremswithin}}}%
{}

\ProcessKeyvalOptions*

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Packages with no or minimal influence on the main layout

\RequirePackage[\ifiseries@inputencOptions]{inputenc}
\RequirePackage[T1]{fontenc}
123
\ififiseries@xcolor
124 125 126 127
% The changes package will load xcolor, which clashes with the beamer and dinbrief classes.
% We thus refrain from loading both if one of those classes is active, and simply load the changes package
% which loads xcolor if everything is alright.
\@ifclassloaded{beamer}{}{\@ifclassloaded{dinbrief}{}{\RequirePackage[xcolor={rgb,svgnames}]{changes}}}
128
\fi
Lasse Kliemann's avatar
Lasse Kliemann committed
129 130
\RequirePackage[\ifiseries@babelOptions]{babel}

Christoph Daniel Schulze's avatar
Christoph Daniel Schulze committed
131 132 133
% To avoid a possible error with TeXLive 2015 (at least on Mac), we
% include floatrow as early as possible.
\ExplSyntaxOn
134 135 136 137 138
\str_case:onF{\ifiseries@figure}{
  {} {\relax}
  {floatrow} {\RequirePackage{floatrow}\DeclareCaptionSubType[alph]{figure}}
  {subfig} {\RequirePackage[\ifiseries@subfigOptions]{subfig}\RequirePackage{sidecap}\sidecaptionvpos{figure}{t}}
}{\PackageError{ifiseries}{Unknown~figure~system:~\ifiseries@figure}\@ehc}
Christoph Daniel Schulze's avatar
Christoph Daniel Schulze committed
139 140
\ExplSyntaxOff

Lasse Kliemann's avatar
Lasse Kliemann committed
141
\RequirePackage{amsmath}
142 143 144 145 146 147 148 149 150 151 152 153 154 155
\ififiseries@mathabx
  \RequirePackage[matha]{mathabx}
  %%% see http://tex.stackexchange.com/questions/271767/size-substitutions-with-amsmath-mathabx-mathpazo/281443#281443
  \DeclareFontShape{U}{matha}{m}{n}{
    <-6> matha5
    <6-7> matha6
    <7-8> matha7
    <8-9> matha8
    <9-10> matha9
    <10-12> matha10
    <12-> matha12
    }{}
  %%%
\fi
Lasse Kliemann's avatar
Lasse Kliemann committed
156 157 158 159 160 161 162 163 164 165 166 167
\RequirePackage{amssymb}
\RequirePackage{amsfonts}
\RequirePackage{amstext}
\RequirePackage{mathtools}
\RequirePackage{nicefrac}
\RequirePackage{graphicx}
\RequirePackage{grffile}
\RequirePackage{eso-pic}
\RequirePackage{listings}
\RequirePackage{booktabs}
\RequirePackage{multicol}
\RequirePackage{multirow}
168
\RequirePackage{varwidth}
169
\RequirePackage[autolanguage,np]{numprint}
Lasse Kliemann's avatar
Lasse Kliemann committed
170 171 172 173 174 175 176
\RequirePackage{units}
\RequirePackage[babel=true]{csquotes}
\ififiseries@natbib\RequirePackage[\ifiseries@natbibOptions]{natbib}\fi
\ififiseries@babelbib\RequirePackage{babelbib}\fi
\ififiseries@biblatex
  \RequirePackage[style=\ifiseries@biblatexstyle,\ifiseries@biblatexOptions,\ifiseries@biblatexAdditionalOptions,backend=\ifiseries@biblatexBackend]{biblatex}%
  \ifdefempty{\ifiseries@bibresource}{}{\addbibresource{\ifiseries@bibresource}}%
177 178 179
  \ExplSyntaxOn%
  \str_case:onF{\ifiseries@language}{%
    {english} {%
180
      \DeclareFieldFormat{realtitlecase}{\MakeSentenceCase*{#1}}%
181 182 183
      \DeclareFieldFormat[incollection]{title}{\enquote{#1}}%
    }}{}%
  \ExplSyntaxOff%
Lasse Kliemann's avatar
Lasse Kliemann committed
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
  \defbibheading{section}[\refname]{\section{#1}}%
  %% cf. texmf-dist/tex/latex/biblatex/biblatex.def
  \renewbibmacro*{title}{%
    \ifboolexpr{
      test {\iffieldundef{title}}
      and
      test {\iffieldundef{subtitle}}
    }
      {}
      {\printtext[title]{%
         \printfield[realtitlecase]{title}%
         \setunit{\subtitlepunct}%
         \printfield[realtitlecase]{subtitle}}%
       \newunit}%
    \printfield{titleaddon}}%
    %%
\else
201 202
  \bibliographystyle{\ifiseries@bibliographystyle}%
  \RequirePackage{bibentry}%
Lasse Kliemann's avatar
Lasse Kliemann committed
203 204 205 206 207 208
\fi
\RequirePackage[\ifiseries@variorefOptions]{varioref}
\RequirePackage{url}
\RequirePackage{dsfont}
\RequirePackage{bbding}
\RequirePackage{pifont}
Lasse Kliemann's avatar
Lasse Kliemann committed
209
\ififiseries@txfonts\RequirePackage{txfonts}\fi
Lasse Kliemann's avatar
Lasse Kliemann committed
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
\RequirePackage{stmaryrd}
\RequirePackage{calc}
\RequirePackage{blindtext}
\RequirePackage{setspace}
\RequirePackage{relsize}
\ififiseries@algorithm
\RequirePackage[\ifiseries@algorithmOptions]{algorithm2e}
\ififiseries@algorithmForwardCompatibility
  \ifthenelse{\isundefined{\DontPrintSemicolon}}{\newcommand*{\DontPrintSemicolon}{\dontprintsemicolon}}{}
  \ifthenelse{\isundefined{\SetAlgoVlined}}{\newcommand*{\SetAlgoVlined}{\SetVline}}{}
  \ifthenelse{\isundefined{\SetAlgoNoLine}}{\newcommand*{\SetAlgoNoLine}{\SetNoline}}{}
\fi
\ififiseries@algorithmBackwardCompatibility
  \ifthenelse{\isundefined{\RestyleAlgo}}{\let\RestyleAlgo\restylealgo}
\fi\fi
\RequirePackage[compatibility=false]{caption} % compatibility switched off for hyperref
\RequirePackage{bookmark}
\RequirePackage{hyperref}
\hypersetup{%
  final=true,%
  colorlinks=true,%
  linkcolor=\ifiseries@hypercolor,%
  citecolor=\ifiseries@hypercolor,%
  urlcolor=\ifiseries@hypercolor,%
}
\RequirePackage[strict]{changepage}
\ififiseries@tikz
  \RequirePackage{tikz}
  \usetikzlibrary{positioning}
  \usetikzlibrary{arrows}
  \usetikzlibrary{shapes}
  \usetikzlibrary{shadows}
  \usetikzlibrary{decorations.text}
  \usetikzlibrary{decorations.markings}
  \usetikzlibrary{decorations.pathmorphing}
  \usetikzlibrary{petri}
  \usetikzlibrary{shapes.symbols}
  \usetikzlibrary{shapes.arrows}
  \usetikzlibrary{decorations}
  \usetikzlibrary{decorations.pathreplacing}
  \usetikzlibrary{decorations.shapes}
  \usetikzlibrary{calc}
  \usetikzlibrary{chains}
  \usetikzlibrary{patterns}
  \usetikzlibrary{matrix}
  \usetikzlibrary{backgrounds}
  \usetikzlibrary{mindmap}
  \usetikzlibrary{topaths}
  \usetikzlibrary{automata}
\fi
Lasse Kliemann's avatar
Lasse Kliemann committed
260
\RequirePackage{pgfplots}
261
\pgfplotsset{compat=\ifiseries@pgfplotscompat}
Lasse Kliemann's avatar
Lasse Kliemann committed
262 263 264 265 266 267 268 269 270 271
\RequirePackage{microtype}
\RequirePackage{enumitem} %%% add 'inline' option once it is supported everywhere
\newlist{compactitemize}{itemize}{3}
\setlist[compactitemize]{label=\raisebox{.1em}{\smaller\textbullet}}
\newlist{compactenumerate}{enumerate}{2}
\setlist[compactenumerate]{label=\arabic*.}
\newlist{compactdescription}{description}{3}
\RequirePackage{placeins}
\RequirePackage[draft]{fixme}
\fxsetup{theme=color}
272
\normalem
Lasse Kliemann's avatar
Lasse Kliemann committed
273

274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
\ExplSyntaxOn
\str_case:onF{\ifiseries@acronymPackage}{
  {acronym} {
      \RequirePackage[\ifiseries@acronymOptions]{acronym}%
  }
  {acro} {
      \RequirePackage{acro}%
      % We need a custom list to make sure the list item indentation works properly with extra information
      \newlist{kcssacronyms}{description}{1}
      \setlist[kcssacronyms]{
          leftmargin = !,
          labelwidth=\ifiseries@acroLabelWidth
      }
      % Define custom list and extra styles
      \DeclareAcroListStyle{kcssacrolist}{list}{
          list = kcssacronyms
      }
      \DeclareAcroExtraStyle{newline}{inline}{
          brackets = false,
          punct = true,
          punct-symbol = \\
      }
      % Basic acro setup with sensible defaults
      \acsetup{
          extra-format = {\footnotesize},
          extra-style = newline,
          label-prefix = lbl:,
          list-caps = true,
          list-heading = chapter*,
          list-short-width = 10em,
          list-style = kcssacrolist,
          hyperref = false,
          page-style = none,
          short-format = {\smaller},
          sort = true,
      }
      % Our list name depends on the language
      \str_case:on{\ifiseries@language}{
          {english} {
              \acsetup{
                  list-name = List\ of\ Acronyms,
              }
          }
          {german} {
              \acsetup{
                  list-name = Akronymverzeichnis,
              }
          }
      }
  }
}{\PackageError{ifiseries}{Unsupported~acronyms~package:~\ifiseries@acronymPackage}\@ehc}
\ExplSyntaxOff

Lasse Kliemann's avatar
Lasse Kliemann committed
327
\RequirePackage{xspace}
328
\RequirePackage[\ifiseries@hyphenatOptions]{hyphenat}
329
\RequirePackage[shortcuts]{extdash}
Lasse Kliemann's avatar
Lasse Kliemann committed
330 331 332 333 334 335 336 337 338 339 340
\RequirePackage{eurosym}
\RequirePackage[full]{textcomp}
\RequirePackage{ellipsis}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Useful commands

%% Remove margins for screen viewing.
%% This command is used by the code below if 'compact' is set.
%% It is the same as the '\nomargin' command in 'localKit'.
\newcommand*{\nomargin}{
341 342 343 344 345 346
  \setlength{\oddsidemargin}{.02\textwidth-1in}
  \setlength{\evensidemargin}{.02\textwidth-1in}
  \setlength{\paperwidth}{1.04\textwidth}
  \setlength{\paperheight}{\headheight+\headsep+\textheight+\footskip}
  \setlength{\paperheight}{1.04\paperheight}
  \setlength{\topmargin}{.02\paperheight-1in}
Lasse Kliemann's avatar
Lasse Kliemann committed
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
}

%% Abbreviations
\newcommand*{\abbrdot}{\protect\@ifnextchar.{}{.\@\xspace}}
\newcommand*{\abbrcomma}{\protect\@ifnextchar,{}{,\xspace}}
\newcommand*{\eg}{e.\@\,g.\@\abbrcomma}
\newcommand*{\ie}{i.\@\,e.\@\abbrcomma}
\newcommand*{\cf}{cf\abbrdot}
\newcommand*{\Eg}{E.\@\,g.\@\abbrcomma}
\newcommand*{\Ie}{I.\@\,e.\@\abbrcomma}
\newcommand*{\Cf}{Cf\abbrdot}
\newcommand*{\etal}{et~al\abbrdot}
\newcommand*{\etc}{etc\abbrdot}
\newcommand*{\vs}{vs\abbrdot}
\newcommand*{\Wlg}{W.l.o.g\abbrdot}
\newcommand*{\wlg}{w.l.o.g\abbrdot}
\newcommand*{\OBdA}{O.B.d.A\abbrdot}
\newcommand*{\oBdA}{o.B.d.A\abbrdot}
\newcommand*{\wrt}{w.r.t.\@\xspace}
\newcommand*{\rv}{r.v.\@\xspace}
\newcommand*{\aka}{a.k.a.\@\xspace}
\newcommand*{\ellipsis}{\xspace}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Paragraph skip instead of paragraph indentation.

%% This should go behind \ififiseries@layout, but on the other hand
374
%% it must happen before we load theorems. It should not be a problem
Lasse Kliemann's avatar
Lasse Kliemann committed
375 376 377 378 379 380 381 382 383 384 385 386 387
%% to have it here since it will only do something if option halfparskip
%% is set.

\ififiseries@halfparskip
    \setlength{\parskip}{.5\baselineskip plus .5\baselineskip}
    \setlength{\parindent}{0em}
    \setlength{\parfillskip}{\ifiseries@halfparskipfill\textwidth plus 1fil}
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Theorems. If 'theorems' is empty, nothing happens here.

\ExplSyntaxOn
388
\str_case:onF{\ifiseries@theorems}{
Lasse Kliemann's avatar
Lasse Kliemann committed
389 390 391
{} {\relax}
{numbersfirst} {
  \ififiseries@dottednumbers% FIXME how can I pass through boolean options?
392
    \RequirePackage[within=\ifiseries@theoremswithin,likeequations,language=\ifiseries@language,dottednumbers=true,plainfont=\ifiseries@theoremsplainfont,remarkfont=\ifiseries@theoremsremarkfont]{localTheorem}%
Lasse Kliemann's avatar
Lasse Kliemann committed
393
  \else%
394
    \RequirePackage[within=\ifiseries@theoremswithin,likeequations,language=\ifiseries@language,dottednumbers=false,plainfont=\ifiseries@theoremsplainfont,remarkfont=\ifiseries@theoremsremarkfont]{localTheorem}%
Lasse Kliemann's avatar
Lasse Kliemann committed
395 396 397 398 399 400 401 402
  \fi%
  \let\@subsection\subsection%
  \renewcommand*\subsection{\@ifnextchar*{\@subsection}{\@subsection*}}%
  \let\@subsubsection\subsubsection%
  \renewcommand*\subsubsection{\@ifnextchar*{\@subsubsection}{\@subsubsection*}}%
}
{numberslast} {
  \ififiseries@dottednumbers%
403
    \RequirePackage[within=\ifiseries@theoremswithin,numbersfirst=false,language=\ifiseries@language,dottednumbers=true,plainfont=\ifiseries@theoremsplainfont,remarkfont=\ifiseries@theoremsremarkfont]{localTheorem}%
Lasse Kliemann's avatar
Lasse Kliemann committed
404
  \else%
405
    \RequirePackage[within=\ifiseries@theoremswithin,numbersfirst=false,language=\ifiseries@language,dottednumbers=false,plainfont=\ifiseries@theoremsplainfont,remarkfont=\ifiseries@theoremsremarkfont]{localTheorem}%
Lasse Kliemann's avatar
Lasse Kliemann committed
406 407
  \fi%
}
408
}{\PackageError{ifiseries}{Unknown~theorem~system:~\ifiseries@theorems}\@ehc}
Lasse Kliemann's avatar
Lasse Kliemann committed
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
\ExplSyntaxOff

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Display settings.
%%%% This used to be in the layout section below, but now I feel
%%%% that it is almost always a good idea (2014-01-07).

\allowdisplaybreaks
\AtBeginDocument{
  \setlength{\abovedisplayshortskip}{-.5\baselineskip plus .5\baselineskip}
  \setlength{\abovedisplayskip}{\medskipamount}
  \setlength{\belowdisplayshortskip}{\medskipamount}
  \setlength{\belowdisplayskip}{\medskipamount}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Enumeration environments.
%%%% This used to be in the layout section below, but now I feel
%%%% that it is almost always a good idea (2014-01-08).

\ififiseries@halfparskip
%
% For halfparskip, we set topsep to 0 everywhere.
% This seems to be necessary to prevent excessive whitespace.
%
\setitemize{leftmargin=*, label=$\triangleright$, topsep=0em}
\setenumerate{leftmargin=*, topsep=0em}
\setdescription{leftmargin=\parindent, style=sameline, font=\it, topsep=0em}
\setlist[compactitemize]{%
  label=\raisebox{.1em}{\smaller\textbullet},%
  leftmargin=*,%
  topsep=.0em plus .1em,%
  parsep=.2em plus .1em,%
  itemsep=.2em plus .1em,%
}
\setlist[compactitemize,2,3]{%
  topsep=.0em,%
  partopsep=.1em,%
  parsep=.1em,%
  itemsep=.1em,%
}
%
\setlist[compactenumerate]{%
  label=\arabic*.,%
  leftmargin=*,%
  topsep=.0em plus .1em,%
  parsep=.2em plus .1em,%
  itemsep=.2em plus .1em,%
}
% FIXME: third level does not work for compactenumerate
\setlist[compactenumerate,2]{%
  label=(\alph*),%
  topsep=.0em,%
  partopsep=.1em,%
  parsep=.1em,%
  itemsep=.1em,%
}
%
\setlist[compactdescription]{%
  style=sameline,%
  font=\it,%
  leftmargin=\parindent,%
  topsep=.0em plus .1em,%
  parsep=.2em plus .1em,%
  itemsep=.2em plus .1em,%
}
\setlist[compactdescription,2,3]{%
  topsep=.0em,%
  partopsep=.1em,%
  parsep=.1em,%
  itemsep=.1em,%
}
\else
%
% Settings for non-halfparskip (the normal settings).
%
\@ifclassloaded{beamer}{\setitemize{leftmargin=*,%
  label={\usebeamercolor[fg]{itemize item}%
  \scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleright$}}}%
  \setenumerate{leftmargin=*}%
  \setdescription{font={\normalfont\usebeamercolor[fg]{itemize item}}}}%
  {\setitemize{leftmargin=*, label=$\triangleright$}%
   \setenumerate{leftmargin=*}%
   \setdescription{leftmargin=\parindent, style=sameline, font=\it}}
\setlist[compactitemize]{%
  label=\raisebox{.1em}{\smaller\textbullet},%
  leftmargin=*,%
  topsep=.4em plus .1em,%
  parsep=.2em plus .1em,%
  itemsep=.2em plus .1em,%
}
\setlist[compactitemize,2,3]{%
  topsep=.1em,%
  partopsep=.1em,%
  parsep=.1em,%
  itemsep=.1em,%
}
%
\setlist[compactenumerate]{%
  label=\arabic*.,%
  leftmargin=*,%
  topsep=.4em plus .1em,%
  parsep=.2em plus .1em,%
  itemsep=.2em plus .1em,%
}
\setlist[compactenumerate,2,3]{%
  topsep=.1em,%
  partopsep=.1em,%
  parsep=.1em,%
  itemsep=.1em,%
}
%
\setlist[compactdescription]{%
  style=sameline,%
  font=\it,%
  leftmargin=\parindent,%
  topsep=.4em plus .1em,%
  parsep=.2em plus .1em,%
  itemsep=.2em plus .1em,%
}
\setlist[compactdescription,2,3]{%
  topsep=.1em,%
  partopsep=.1em,%
  parsep=.1em,%
  itemsep=.1em,%
}
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Hyperref's \autoref feature.
%%%% This used to be in the layout section below, but now I feel
%%%% that it is almost always a good idea (2014-01-09).

\@ifclassloaded{beamer}{}{%
\providecommand*{\subfigureautorefname}{\figureautorefname}
% \extrasenglish seem to be invoked twice, so need \renew.. there, hence all \...refname must be defined
\ifthenelse{\isundefined{\algocfautorefname}}{\newcommand*{\algocfautorefname}{Algorithm}}{}
\ifthenelse{\isundefined{\algorithmautorefname}}{\newcommand*{\algorithmautorefname}{Algorithm}}{}
\addto\extrasenglish{
  \renewcommand*{\chapterautorefname}{Chapter}
  \renewcommand*{\sectionautorefname}{Section}
  \renewcommand*{\subsectionautorefname}{Section}
551
  \renewcommand*{\subsubsectionautorefname}{Section}
Lasse Kliemann's avatar
Lasse Kliemann committed
552 553 554 555 556 557
  \renewcommand*{\algocfautorefname}{Algorithm}
  \renewcommand*{\algorithmautorefname}{Algorithm}}
\addto\extrasngerman{
  \renewcommand*{\chapterautorefname}{Kapitel}
  \renewcommand*{\sectionautorefname}{Abschnitt}
  \renewcommand*{\subsectionautorefname}{Abschnitt}
558
  \renewcommand*{\subsubsectionautorefname}{Abschnitt}
Lasse Kliemann's avatar
Lasse Kliemann committed
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
  \renewcommand*{\algocfautorefname}{Algorithmus}
  \renewcommand*{\algorithmautorefname}{Algorithmus}}
} %%% end ifclassloaded not beamer

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Configure listings package.
%%%% This used to be in the layout section below, but now I feel
%%%% that it is almost always a good idea (2014-01-11).

\lstset{basicstyle=\tt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Packages and settings with influence on the main layout

\ififiseries@layout

\newcommand*{\ifiseries@titlefontfamily}{}
\newcommand*{\ifiseries@sectionfontweight}{\bfseries}
\newcommand*{\ifiseries@chapterfontweight}{\bfseries}

%% Font and linespread.
\ExplSyntaxOn
581
\str_case:onF{\ifiseries@font}{
Lasse Kliemann's avatar
Lasse Kliemann committed
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673
{} {\relax}
{Arial} {
  \RequirePackage[sfmath]{kpfonts}
  \RequirePackage{uarial}
  \renewcommand*\familydefault{\sfdefault}
  \linespread{1.05}
}
{BaskervaldX} {
  \RequirePackage[lf]{Baskervaldx}%
  \RequirePackage[bigdelims,vvarbb]{newtxmath}%
  \RequirePackage[cal=boondoxo]{mathalfa}%
  \renewcommand*\oldstylenums[1]{\textosf{#1}}%
}
{Bera} {
  \RequirePackage[scaled]{beraserif}%
  \RequirePackage[scaled=.86]{berasans}%
  \RequirePackage[scaled=.86]{beramono}%
  \linespread{1.05}%
}
{BeraSans} {
  \RequirePackage[sfmath]{kpfonts} % only for the math
  \RequirePackage[scaled]{beraserif}
  \RequirePackage[scaled=.86]{berasans}
  \RequirePackage[scaled=.86]{beramono}
  \linespread{1.05}
  \renewcommand*\familydefault{\sfdefault}
}
{Charter} { %% sometimes problem: "Too many math alphabets used in version normal."
  \RequirePackage[bitstream-charter]{mathdesign}%
  \RequirePackage[scaled]{berasans}%
  \RequirePackage[scaled]{beramono}%
  \RequirePackage{eucal}%
  \linespread{1.05}%
}
{CharterText} { %% FIXME: how to prevent charter replacing mathcal?
  %\RequirePackage{lmodern}% looks also good, but too small
  \RequirePackage{eulervm}%
  \RequirePackage{charter}%
  \RequirePackage[scaled]{berasans}%
  \RequirePackage[scaled]{beramono}%
  \RequirePackage{eucal}%
  \linespread{1.05}%
}
{ConcreteEuler} {
  \RequirePackage{lmodern}%
  \RequirePackage[boldsans]{concmath}%
  \RequirePackage{eulervm}%
  \RequirePackage[scaled=.84]{beramono}%
  \linespread{1.05}%
}
{DejaVu} {
  \RequirePackage[scaled]{DejaVuSerif}
  \RequirePackage{eulervm}
  \RequirePackage[scaled=.95]{beramono}
  \linespread{1.10}
}
{DejaVuCondensed} {
  \RequirePackage[scaled]{DejaVuSerifCondensed}
  \RequirePackage{eulervm}
  \RequirePackage[scaled=.95]{beramono}
  \linespread{1.10}
}
{Droid} {
  % NOTE: might look better without bold
  % \RequirePackage{mathpazo}% only for the math, use scale=.96 with this
  \RequirePackage{concmath}%
  \RequirePackage[scale=.90,default]{droidserif}
  \RequirePackage[scale=.90,defaultsans]{droidsans}
  \RequirePackage[scale=.90,defaultmono]{droidmono}
  \linespread{1.10}
}
{GaramondMathdesign} { %% sometimes problem: "Too many math alphabets used in version normal."
  \RequirePackage[urw-garamond]{mathdesign}%
  \RequirePackage{eucal}%
  \RequirePackage[scaled=.82]{berasans}%
  \RequirePackage[scaled=.82]{beramono}%
  \linespread{1.05}%
}
{GaramondExpertMathdesign} {
  \RequirePackage[urw-garamond]{mathdesign}
  \RequirePackage{garamondx}
  \RequirePackage[scaled=.82]{berasans}
  \RequirePackage[scaled=.82]{beramono}
  \linespread{1.05}
}
{GaramondExpertNewTX} {
  \RequirePackage{garamondx}
  \RequirePackage[garamondx,cmbraces]{newtxmath}
  \RequirePackage[scaled=.85]{berasans}
  \RequirePackage[scaled=.85]{beramono}
  \linespread{1.05}
}
674 675 676 677 678 679
{Helvetica} {
  \RequirePackage[sfmath]{kpfonts}
  \RequirePackage{helvet}
  \renewcommand{\familydefault}{\sfdefault}
  \fontfamily{phv}\selectfont
}
Lasse Kliemann's avatar
Lasse Kliemann committed
680 681 682 683 684 685
{Heros} {
  \RequirePackage[sfmath]{kpfonts}
  \RequirePackage{tgheros}
  \renewcommand*\familydefault{\sfdefault}
  \linespread{1.08}
}
686 687 688 689 690 691
{Heuristica} {
  \RequirePackage{heuristica}
  \RequirePackage[heuristica,vvarbb,bigdelims]{newtxmath}
  \renewcommand*\oldstylenums[1]{\textosf{#1}}
  \linespread{1.10}
}
Lasse Kliemann's avatar
Lasse Kliemann committed
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720
{Kerkis} { %% some problems in math mode, e.g., tildas extend into symbols
  \usepackage{kmath,kerkis}%
  \let\openbox\@undefined%
  \RequirePackage[scaled=.81]{berasans}%
  \RequirePackage[scaled=.81]{beramono}%
  \renewcommand*{\bfdefault}{sb}%
  \linespread{1.10}%
}
{KP} {
  \RequirePackage{kpfonts}%
  \linespread{1.05}%
}
{KPSans} {
  \RequirePackage[sfmath]{kpfonts}
  \renewcommand*\familydefault{\sfdefault}
  \linespread{1.05}
}
{LatinModern} {
  \RequirePackage{lmodern}%
  \RequirePackage[scaled=.80]{beramono}%
  \let\@bfseries\bfseries%
  \renewcommand*{\bfseries}{\sffamily\@bfseries\fontseries{sbc}\selectfont}%
  \linespread{1.05}%
}
{LatinModernBold} {
  \RequirePackage{lmodern}%
  \RequirePackage[scaled=.80]{beramono}%
  \linespread{1.05}%
}
721 722 723 724 725
{LinuxLibertine} {
  \RequirePackage{libertine}
  \RequirePackage{libertinust1math}
  \linespread{1.05}
}
Lasse Kliemann's avatar
Lasse Kliemann committed
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752
{NewCenturySchoolbook} {
  \RequirePackage{fouriernc}%
  \RequirePackage[scaled=.85]{beramono}%
  \linespread{1.10}%
}
{NewPX} {
  \RequirePackage{newpxtext,newpxmath}%
  \RequirePackage[scaled=.86]{berasans}%
  \RequirePackage[scaled=.86]{beramono}%
  \linespread{1.05}%
}
{NewTX} {
  \RequirePackage{newtxtext,newtxmath}%
  \RequirePackage[scaled=.84]{berasans}%
  \RequirePackage[scaled=.84]{beramono}%
  \linespread{1.05}%
}
{Palatino} {
  \RequirePackage[sc]{mathpazo}%
  \@ifclassloaded{beamer}{%
    \RequirePackage[scaled=.90]{helvet}%
    \RequirePackage[scaled=.80]{beramono}%
  }{%
    \RequirePackage[scaled=.80]{berasans}%
    \RequirePackage[scaled=.80]{beramono}%
  }%
  \linespread{1.05}%
753 754 755 756 757 758 759
  \ExplSyntaxOn
  \str_case:onF {\ifiseries@PalatinoSC} {
    {ppl} {\AtBeginDocument{\DeclareFontShape{T1}{pplx}{bx}{sc}{<->ssub*ppl/bx/sc}{}}}
    {jkp} {\AtBeginDocument{\DeclareFontShape{T1}{pplx}{bx}{sc}{<->ssub*jkp/bx/sc}{}}}
    {none} {}
  }{\PackageError{ifiseries}{Unsupported~Palatino~Smallcaps:~\ifiseries@PalatinoSC}\@ehc}
  \ExplSyntaxOff
Lasse Kliemann's avatar
Lasse Kliemann committed
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806
}
{Schola} {
  \RequirePackage{fouriernc}% only for the math
  \RequirePackage{tgschola}%
  \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}%
  \RequirePackage[scaled=.88]{beramono}%
  \linespread{1.05}%
}
{Stix} { %%% causes lots of conflicts with macros from newKit
  \RequirePackage{stix}%
  \RequirePackage[scaled=.86]{berasans}%
  \RequirePackage[scaled=.86]{beramono}%
  \linespread{1.05}%
}
{Times} {
  \RequirePackage{mathptmx}%
  \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}%
  \RequirePackage[scaled=.87]{helvet}%
  \RequirePackage[scaled=.82]{beramono}%
  \linespread{1.05}%
}
{Termes} {
  \RequirePackage{tgtermes}%
  \RequirePackage[scaled=.86]{berasans}%
  \RequirePackage[scaled=.86]{beramono}%
  \linespread{1.05}%
}
{TX} {
  \RequirePackage{txfonts}%
  \RequirePackage[scaled=.86]{berasans}%
  \RequirePackage[scaled=.86]{beramono}%
  \linespread{1.05}%
}
{Utopia} {
  \RequirePackage[widespace]{fourier}%
  \RequirePackage{eucal}%
  \RequirePackage[scaled=.82]{berasans}%
  \RequirePackage[scaled=.82]{beramono}%
  \linespread{1.05}%
}
{UtopiaMathdesign} { %% sometimes problem: "Too many math alphabets used in version normal."
  \RequirePackage[adobe-utopia]{mathdesign}%
  \RequirePackage{eucal}%
  \RequirePackage[scaled=.82]{berasans}%
  \RequirePackage[scaled=.82]{beramono}%
  \linespread{1.05}%
}
807
}{\PackageError{ifiseries}{Unknown~font:~\ifiseries@font}\@ehc}
Lasse Kliemann's avatar
Lasse Kliemann committed
808 809 810 811 812 813 814
\ExplSyntaxOff

%% \prg_case_str cannot occur inside an argument.
%% So we have to prepare several commands here to be called later
%% inside the \@ifclassloaded.
\ExplSyntaxOn
%
815 816 817 818 819 820 821 822 823
\newcommand{\ifiseries@temp@paper}{
\str_case:onF{\ifiseries@paper} {
  {} {\relax}
  {ustrade} {\geometry{paperwidth=15.24cm, paperheight=22.86cm}}
  {15522} {\geometry{paperwidth=15.50cm, paperheight=22.00cm}}
  {royal} {\geometry{paperwidth=15.57cm, paperheight=23.39cm}}
  {crownquarto} {\geometry{paperwidth=18.91cm, paperheight=24.589cm}}
  {kindlefirehd7} {\geometry{paperwidth=3.703704in, paperheight=5.925926in}}
  {5x8} {\geometry{paperwidth=12.7cm, paperheight=20.32cm}}
Lasse Kliemann's avatar
Lasse Kliemann committed
824 825
}{\geometry{paper=\ifiseries@paper}}}
%
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865
\newcommand{\ifiseries@temp@compact}{
\str_case:onF{\ifiseries@compact}{
  {} {\relax}
  {moderate} {
    \setlength{\headsep}{.5\baselineskip}%
    \setlength{\footskip}{\baselineskip}%
    \nomargin%
  }
  {strong} {
    %% This does the same as the '\ebook' command in 'localKit'.
    \fancyhf{}%
    \fancyfoot[R]{\thepage}%
    \fancypagestyle{plain}{\fancyhf{}\fancyfoot[R]{\thepage}}%
    \setlength{\headsep}{0pt}%
    \setlength{\headheight}{0pt}%
    %\setlength{\topskip}{0pt}% affects height of textblock in ways difficult to determine!
    \setlength{\footskip}{1.5\baselineskip}%
    \setlength{\oddsidemargin}{.02\textwidth-1in}%
    \setlength{\evensidemargin}{.02\textwidth-1in}%
    \setlength{\paperwidth}{1.04\textwidth}%
    \setlength{\paperheight}{\textheight+\footskip}%
    \setlength{\topmargin}{.005\paperheight-1in}% CHANGE
    \setlength{\paperheight}{1.02\paperheight}%
  }
  {expand} {
    %% This gives a compact layout, but by expanding the textblock into the margins.
    %% Page width and height is maintained.
    \geometry{%
      headheight=0em,%
      headsep=0em,%
      left=.02\paperwidth,%
      right=.02\paperwidth,%
      top=.01\paperheight,%
      footskip=\baselineskip,%
      bottom=\baselineskip}%
    \setlength{\headwidth}{\textwidth}%
    \fancyhf{}\fancyfoot[R]{\thepage}%
    \fancypagestyle{plain}{\fancyhf{}\fancyfoot[R]{\thepage}}%
  }
}{\PackageError{ifiseries}{Unknown~compact~system:~\ifiseries@compact}\@ehc}}
Lasse Kliemann's avatar
Lasse Kliemann committed
866 867 868 869 870 871 872
\ExplSyntaxOff
%% End of preparations.

\@ifclassloaded{beamer}{}{%
%% Page layout.
\ififiseries@pagelayout
\RequirePackage{geometry}
873
\ifiseries@temp@paper
Lasse Kliemann's avatar
Lasse Kliemann committed
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933
\ifdefempty{\ifiseries@paperheight}{}{\ifdefempty{\ifiseries@paperwidth}{}%
  {\geometry{paperwidth=\ifiseries@paperwidth,paperheight=\ifiseries@paperheight}}}
%
\ifthenelse
  {\equal{\@ptsize}{1}}
  {\setlength{\headheight}{13.59999pt}}
  {\ifthenelse
    {\equal{\@ptsize}{2}}
    {\setlength{\headheight}{14.49998pt}}
    {}}
%
\ifdefempty{\ifiseries@margincontrol}{%
\ififiseries@onemargin
\geometry{%
heightrounded, %
headsep=\ifiseries@headsepmult\baselineskip, %
footskip=\ifiseries@footskipmult\baselineskip, %
inner=0.1in, %
outer=(3\paperwidth/\ifiseries@marginfrac)-0.1in, %
marginparwidth=(3\paperwidth/\ifiseries@marginfrac)-0.3in, %
top=\paperheight/\ifiseries@marginfrac, vmarginratio=1:2}
\ififiseries@includehead\geometry{includehead}\fi
\else
\ififiseries@hcenter
\geometry{%
heightrounded, %
headsep=\ifiseries@headsepmult\baselineskip, %
footskip=\ifiseries@footskipmult\baselineskip, %
inner=(3\paperwidth/(2*\ifiseries@marginfrac))+\ifiseries@bindingcorrection, %
outer=(3\paperwidth/(2*\ifiseries@marginfrac))-\ifiseries@bindingcorrection, %
top=\paperheight/\ifiseries@marginfrac, vmarginratio=1:2}
\ififiseries@includehead\geometry{includehead}\fi
\else
\geometry{%
heightrounded, %
headsep=\ifiseries@headsepmult\baselineskip, %
footskip=\ifiseries@footskipmult\baselineskip, %
inner=(\paperwidth/\ifiseries@marginfrac)+\ifiseries@bindingcorrection, %
outer=(2\paperwidth/\ifiseries@marginfrac)-\ifiseries@bindingcorrection, %
top=\paperheight/\ifiseries@marginfrac, vmarginratio=1:2}
\ififiseries@includehead\geometry{includehead}\fi
\fi
\fi
}{\expandafter\geometry\expandafter{\ifiseries@margincontrol}}
\fi % pagelayout

%% Folios and running titles (and others, see below).
\ififiseries@leftmarkright\let\rightmark\leftmark\fi
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\@ifclassloaded{book}{%
\let\@frontmatter\frontmatter
\renewcommand*{\frontmatter}{\@frontmatter\renewcommand*{\chaptermark}[1]{\markboth{##1}{##1}}}
\let\@mainmatter\mainmatter
\renewcommand*{\mainmatter}{\@mainmatter\renewcommand*{\chaptermark}[1]{\markboth{\thechapter. \ ##1}{}}}
\let\@backmatter\backmatter
\renewcommand*{\backmatter}{\@backmatter\bookmarksetup{startatroot}}
\let\@appendix\appendix
\renewcommand*{\appendix}{\bookmarksetup{startatroot}\@appendix}
934
\if@twoside
Lasse Kliemann's avatar
Lasse Kliemann committed
935
\ififiseries@runningtitle\fancyhead[LE]{\nouppercase{\leftmark}}\fi
936 937 938
\else
\ififiseries@runningtitle\fancyhead[C]{\nouppercase{\leftmark}}\fi
\fi
Lasse Kliemann's avatar
Lasse Kliemann committed
939
}{ %%% else ifclassloaded book
940
\if@twoside
Lasse Kliemann's avatar
Lasse Kliemann committed
941
\ififiseries@runningtitle\fancyhead[LE]{\nouppercase{\rightmark}}\fi
942 943 944
\else
\ififiseries@runningtitle\fancyhead[C]{\nouppercase{\rightmark}}\fi
\fi
Lasse Kliemann's avatar
Lasse Kliemann committed
945
} %%% end ifclassloaded book
946 947
\renewcommand*{\headrulewidth}{0pt}
\if@twoside
Lasse Kliemann's avatar
Lasse Kliemann committed
948 949 950 951
\ififiseries@runningtitle\fancyhead[RO]{\nouppercase{\rightmark}}\fi
\fancyfoot[RO]{\thepage}
\fancyfoot[LE]{\thepage}
\fancypagestyle{plain}{\fancyhf{}\fancyfoot[LE]{\thepage}\fancyfoot[RO]{\thepage}}
952 953 954 955 956
\else
\ififiseries@runningtitle\fancyhead[C]{\nouppercase{\rightmark}}\fi
\fancyfoot[C]{\thepage}
\fancypagestyle{plain}{\fancyhf{}\fancyfoot[C]{\thepage}}
\fi
Lasse Kliemann's avatar
Lasse Kliemann committed
957 958

%% Compact system: reduce margins.
959
\ifiseries@temp@compact
Lasse Kliemann's avatar
Lasse Kliemann committed
960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992

%% Empty clearpages (i.e., pages left blank before a chapter start).
\renewcommand*{\cleardoublepage}{%
  \clearpage
  \if@twoside
    \ifodd
      \c@page
    \else
      \thispagestyle{empty}
      \hbox{}
      \newpage
      \if@twocolumn
        \hbox{}
        \newpage
      \fi
    \fi
  \fi
}

%% Section headings.
\@ifclassloaded{dinbrief}{\newcommand{\section}[1]{}}{%%% FIXME what's a good definition for \section in dinbrief?
\RequirePackage{sectsty}
\sectionfont{\normalfont\Large\ifiseries@sectionfontweight\ifiseries@titlefontfamily}
\subsectionfont{\normalfont\large\ifiseries@sectionfontweight\ifiseries@titlefontfamily}
\subsubsectionfont{\normalfont\normalsize\ifiseries@sectionfontweight\ifiseries@titlefontfamily}
\ififiseries@dottednumbers
  \def\@seccntformat#1{\csname the#1\endcsname.\quad}
  \def\@subseccntformat#1{\csname the#1\endcsname.\quad}
  \def\@subsubseccntformat#1{\csname the#1\endcsname.\quad}
\fi

%% Part title page (package 'sectsty' must be loaded first).
\newenvironment{centerpage}%
993 994 995 996 997
  {\begin{adjustwidth*}%
    {(\paperwidth-\textwidth)/2-1in-\oddsidemargin+\ifiseries@bindingcorrection}%
    {(\paperwidth-\textwidth)/2-1in-\evensidemargin-\ifiseries@bindingcorrection}%
  \centering}%
  {\end{adjustwidth*}}
Lasse Kliemann's avatar
Lasse Kliemann committed
998
\newcommand*{\typesetpart}[1]{{%
999 1000 1001 1002 1003 1004
  \begin{centerpage}
  \null
  \vspace{.20\textheight}
  \interlinepenalty \@M
  \normalfont
  \ifnum \c@secnumdepth >-2\relax
1005
    \LARGE\bfseries\ifiseries@titlefontfamily \partname\nobreakspace\thepart
1006 1007 1008 1009 1010
    \par\normalsize\normalfont
    \vskip 20\p@
  \fi
  \Huge \bfseries \ifiseries@titlefontfamily #1\par
  \end{centerpage}
Lasse Kliemann's avatar
Lasse Kliemann committed
1011 1012
}}
\renewcommand*{\part}{%
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027
  \if@openright
    \FloatBarrier
    \newpage\thispagestyle{empty}\hbox{}
    \cleardoublepage
  \else
    \clearpage
  \fi
  \thispagestyle{empty}%
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \secdef\@part\@spart%
Lasse Kliemann's avatar
Lasse Kliemann committed
1028 1029
}
\renewcommand*{\@part}[2][]{%
1030 1031 1032 1033 1034 1035 1036 1037 1038
  \ifnum \c@secnumdepth >-2\relax
    \refstepcounter{part}%
    \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
  \else
    \addcontentsline{toc}{part}{#1}%
  \fi
  \markboth{}{}%
  \typesetpart{#2}%
  \@endpart%
Lasse Kliemann's avatar
Lasse Kliemann committed
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
}

%% Chapter titles
%% cf. texlive/2011/texmf-dist/tex/latex/base/book.cls
\@ifclassloaded{book}{%
\renewcommand*{\@makechapterhead}[1]{%
  %\vspace*{20\p@}%
  {\parindent \z@ \flushright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
1049
        \large\ifiseries@chapterfontweight\ifiseries@titlefontfamily \@chapapp\space \thechapter
Lasse Kliemann's avatar
Lasse Kliemann committed
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062
        \par\normalsize\normalfont\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \huge \ifiseries@chapterfontweight \ifiseries@titlefontfamily #1\par\nobreak
    \vskip 50\p@
  }}
\renewcommand*{\@makeschapterhead}[1]{%
  %\vspace*{50\p@}%
  {\parindent \z@ \flushright
    \normalfont
    \interlinepenalty\@M
1063
    {\huge\bfseries  #1\par\nobreak}
Lasse Kliemann's avatar
Lasse Kliemann committed
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094
    \vskip 50\p@
  }}
}{} %%% end ifclassloaded book
} %%% end ifclassloaded not beamer
} % end ifclassloaded not dinbrief

%% Bibliography.
\@ifclassloaded{book}{%
\newcommand*{\preparebibliography}{%
\renewcommand*{\refname}{\ifiseries@refname}%
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\refname}
}%
\newcommand*{\tocbibliography}{%
\preparebibliography%
\ififiseries@biblatex\printbibliography\else\bibliography{\ifiseries@bibresource}\fi}}{%
\newcommand*{\preparebibliography}{%
\renewcommand*{\refname}{\ifiseries@refname}%
\phantomsection
\addcontentsline{toc}{section}{\refname}
}%
\newcommand*{\tocbibliography}{%
\preparebibliography%
\ififiseries@biblatex\printbibliography\else\bibliography{\ifiseries@bibresource}\fi}}

%% For multiple authors.
\newcommand*{\andauthor}{\\[.5\baselineskip]}

%% Command to create generic cover pages.
\ifthenelse{\equal{\ifiseries@compact}{}}{\newcommand*{\ifiseries@titlepagetopskip}{}}%
1095
  {\newcommand*{\ifiseries@titlepagetopskip}{\vspace*{5ex}}}
Lasse Kliemann's avatar
Lasse Kliemann committed
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144
\newcommand{\gentitlepage}[4]{%
\newpage
\thispagestyle{empty}
\begin{centerpage}
\ifiseries@titlepagetopskip%
\Huge \ifthenelse{\expandafter\isempty\expandafter{#1}}{\mbox{ }}{#1}\\
\normalsize\vspace{5ex}
\Large \ifthenelse{\expandafter\isempty\expandafter{#2}}{\mbox{ }}{#2}\\
\normalsize\vspace{5ex}
\Large \ifthenelse{\expandafter\isempty\expandafter{#3}}{\mbox{ }}{#3}\\
\normalsize\vfill
#4
\end{centerpage}}
\newcommand{\titlepagetitle}{}
\newcommand{\titlepagesubtitle}{}
\newcommand{\titlepageauthor}{}
\newcommand{\titlepagetext}{}
\newcommand{\makegentitlepage}{\gentitlepage{\titlepagetitle}{\titlepagesubtitle}{\titlepageauthor}{\titlepagetext}}

%% Command to create the cover page for dissertations.
\newcommand{\disstitlepage}[5]{%
\gentitlepage{#1}{#2}{#3}{%
Dissertation\\
zur Erlangung des akademischen Grades\\
%
\expandafter\ifstrequal\expandafter{#4}{nat}{%
  Doktor der Naturwissenschaften\\%
  (Dr.~rer.~nat.)\\%
  }{\expandafter\ifstrequal\expandafter{#4}{ing}{%
  Doktor der Ingenieurwissenschaften\\%
  (Dr.-Ing.)\\%
  }{}}%
%
der Technischen Fakult\"at\\
der Christian-Albrechts-Universit\"at zu Kiel\\
eingereicht im Jahr #5}}
\newcommand{\disstitlepagedegree}{nat}
\newcommand{\disstitlepageyear}{\textbf{?? Year ??}}
\newcommand{\makedisstitlepage}{\disstitlepage%
{\titlepagetitle}%
{\titlepagesubtitle}%
{\titlepageauthor}%
{\disstitlepagedegree}%
{\disstitlepageyear}}

%% Command to create the cover page for student's thesis.
\newcommand{\studtitlepage}[7]{%
\gentitlepage{#1}{#2}{#3}{%
#4\\
1145
#5\\
Lasse Kliemann's avatar
Lasse Kliemann committed
1146
\vspace{1ex}
1147 1148 1149 1150 1151 1152
\ifthenelse{\isempty{#6}}{}{#6\\}%
\iflanguage{english}{Department of Computer Science\\
Kiel University}{%
\iflanguage{ngerman}{Institut f\"ur Informatik\\
Christian-Albrechts-Universit\"at zu Kiel}{}%
}\\
Lasse Kliemann's avatar
Lasse Kliemann committed
1153
\vspace{1ex}
1154 1155 1156 1157 1158
\iflanguage{english}{Advised by }{%
\iflanguage{ngerman}{Betreut durch }{}%
}\\
#7
}}
Lasse Kliemann's avatar
Lasse Kliemann committed
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196
\newcommand{\studtitlepagetype}{Bachelor-Arbeit}
\newcommand{\studtitlepageyear}{\textbf{?? Year ??}}
\newcommand{\studtitlepagegroup}{\textbf{?? Research Group ??}}
\newcommand{\studtitlepagesupervisor}{\textbf{?? Supervisor ??}}
\newcommand{\makestudtitlepage}{\studtitlepage%
{\titlepagetitle}%
{\titlepagesubtitle}%
{\titlepageauthor}%
{\studtitlepagetype}%
{\studtitlepageyear}%
{\studtitlepagegroup}%
{\studtitlepagesupervisor}}

%% Command to create the reviewer page for dissertations.
\newcommand{\dissreviewerpage}[4]{%
\newpage
\thispagestyle{plain}
\vspace*{.5\textheight}
\noindent
\begin{tabular}{@{}p{.20\textwidth}@{\hspace{.05\textwidth}}p{.75\textwidth}@{}}
  1.~Gutachter: & \ifthenelse{\equal{#1}{_}}{\rule{12em}{.3pt}}{#1} \\[1em]
  2.~Gutachter: & \ifthenelse{\equal{#2}{_}}{\rule{12em}{.3pt}}{#2}
  \ifthenelse{\equal{#3}{}}{}{\\[1em] 3.~Gutachter: & \ifthenelse{\equal{#3}{_}}{\rule{12em}{.3pt}}{#3}}
\end{tabular}
\par
\vspace*{2em}
\noindent
Datum der m\"undlichen Pr\"ufung:~\ifthenelse{\equal{#4}{_}}{\rule{12em}{.3pt}}{#4}}
\newcommand{\dissreviewerpagei}{_}
\newcommand{\dissreviewerpageii}{_}
\newcommand{\dissreviewerpageiii}{_}
\newcommand{\dissreviewerpagedate}{}
\newcommand{\makedissreviewerpage}{\dissreviewerpage%
{\dissreviewerpagei}%
{\dissreviewerpageii}%
{\dissreviewerpageiii}%
{\dissreviewerpagedate}}

1197 1198
%% Selbstständigkeitserklärung for students (formerly Eidesstattliche Erklärung)
\newcommand*{\studeidesstatt}{%
Lasse Kliemann's avatar
Lasse Kliemann committed
1199 1200 1201 1202 1203
\newpage
\thispagestyle{plain}
\hskip 0mm
\vfill
\begin{otherlanguage}{ngerman}
1204
\noindent
1205 1206 1207
\textbf{Selbstst{\"a}ndigkeitserkl{\"a}rung}\par
\bigskip\noindent Hiermit erkl{\"a}re ich,
dass ich die vorliegende Arbeit selbst\-st{\"a}n\-dig verfasst und keine
Lasse Kliemann's avatar
Lasse Kliemann committed
1208 1209 1210 1211 1212 1213
anderen als die angegebenen Quellen und Hilfsmittel verwendet habe.\par
\bigskip\noindent Kiel,
\vskip 10mm
\hfill\rule{18em}{.3pt}%
\end{otherlanguage}}

1214 1215 1216 1217 1218 1219 1220 1221
%% Selbstständigkeitserklärung for dissertations
\newcommand*{\disseidesstatt}{%
\newpage
\thispagestyle{plain}
\hskip 0mm
\vfill
\begin{otherlanguage}{ngerman}
\noindent
1222
\textbf{Erkl{\"a}rung entsprechend \S9 der Promotionsordnung}\par
1223 1224 1225 1226 1227 1228 1229
\bigskip\noindent
Hiermit gebe ich folgende Erkl{\"a}rungen ab:
\begin{itemize}
  \item Diese Abhandlung ist,
        abgesehen von der Beratung durch die Betreuerin oder den Betreuer,
        nach Inhalt und Form meine eigene Arbeit.
  \item Kein Teil dieser Arbeit ist bereits an anderer Stelle
Christoph Daniel Schulze's avatar
Christoph Daniel Schulze committed
1230
        im Rahmen eines Pr{\"u}fungsverfahrens vorgelegt worden.
1231 1232 1233 1234 1235
        Teile wurden, wie in der Arbeit gekennzeichnet,
        im Rahmen wissenschaftlicher Ver{\"o}ffentlichungen publiziert.
  \item Die Arbeit ist unter Einhaltung der Regeln
        guter wissenschaftlicher Praxis
        der Deutschen Forschungsgemeinschaft entstanden.
1236
  \item Es wurde mir noch nie ein akademischer Grad entzogen.
1237 1238 1239 1240 1241 1242
\end{itemize}\par
\bigskip\noindent Kiel,
\vskip 10mm
\hfill\rule{18em}{.3pt}%
\end{otherlanguage}}

Lasse Kliemann's avatar
Lasse Kliemann committed
1243
%% Command to create a page with meta data.
1244
\newcommand{\metapage}[9]{%
Lasse Kliemann's avatar
Lasse Kliemann committed
1245 1246
\newpage%
\thispagestyle{plain}%
1247
{\footnotesize%
Lasse Kliemann's avatar
Lasse Kliemann committed
1248 1249 1250
\mbox{}\vfill%
\begin{itemize}[label=]%
  \item Kiel Computer Science Series (KCSS) #1%
1251
  \ifthenelse{\expandafter\isempty\expandafter{#2}}{}{\\(revised edition of #2)}%
1252
  \item
1253
  URN:NBN #3\\
1254 1255
  ISSN 2193-6781 (print version)\\
  ISSN 2194-6639 (electronic version)
1256 1257
  \item Electronic version, updates, errata available via
       \url{https://www.informatik.uni-kiel.de/kcss}
1258
  \ifthenelse{\expandafter\isempty\expandafter{#4}}{}{\item The author can be contacted via #4}%
Lasse Kliemann's avatar
Lasse Kliemann committed
1259
  \item Published by the Department of Computer Science, Kiel University%
1260
  \item #5%
Lasse Kliemann's avatar
Lasse Kliemann committed
1261 1262
  \item Please cite as:%
       \begin{itemize}%
1263
         \item #6%
Lasse Kliemann's avatar
Lasse Kliemann committed
1264 1265 1266 1267 1268 1269 1270 1271
       \end{itemize}%
  \item \lstinputlisting[%
    nolol=true,frame=none,numbers=none,language={},style={},keywordsprefix={},basicstyle=\tt,%
    aboveskip=\medskipamount,belowskip=\medskipamount,lineskip=0pt,boxpos=c,print=true,%
    showlines=false,gobble=0,tabsize=8,showtabs=false,showspaces=false,%
    linewidth=\linewidth,xleftmargin=0pt,xrightmargin=0pt,resetmargins=false,breaklines=false,%
    columns={[c]fixed},flexiblecolumns=false,keepspaces=false,basewidth={0.6em,0.45em},fontadjust=false,%
    mathescape=false,escapechar={},escapeinside={},%
1272 1273 1274
    ]{#7}%
  \item \textcopyright\ #8%
  \ifthenelse{\expandafter\isempty\expandafter{#8}}{}{\item #9}%
1275
\end{itemize}}}
1276 1277 1278
\newcommand{\metapageversion}{\textbf{?? dated ??}}
\newcommand{\metapagereplacedversion}{}
\newcommand{\metapageurnnbn}{\textbf{?? URN:NBN ??}}
Lasse Kliemann's avatar
Lasse Kliemann committed
1279 1280 1281 1282 1283 1284 1285 1286
\newcommand{\metapagecontact}{}
\newcommand{\metapagegroup}{\textbf{?? Research Group ??}}
\newcommand{\metapagecite}{\textbf{?? Citation ??}}
\newcommand{\metapagebibfile}{metapage.bib}
\newcommand{\metapagecopyright}{\textbf{?? Copyright ??}}
\newcommand{\metapagetext}{}
\newcommand{\makemetapage}{\metapage%
{\metapageversion}%
1287 1288
{\metapagereplacedversion}%
{\metapageurnnbn}%
Lasse Kliemann's avatar
Lasse Kliemann committed
1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306
{\metapagecontact}%
{\metapagegroup}%
{\metapagecite}%
{\metapagebibfile}%
{\metapagecopyright}%
{\metapagetext}}

%% Figures and captions.
\captionsetup{font=small,labelfont=bf,labelsep=period}
\ifdefstring{\ifiseries@figure}{floatrow}{%
  \captionsetup[subfigure]{labelformat=parens,labelsep=space}%
  \floatsetup[table]{style=plaintop}%
  \floatsetup[figure]{capbesideposition={center,inside},facing=yes}}{}
% Alter some defaults for better treatment of figures.
% Taken from http://mintaka.sdsu.edu/GF/bibliog/latex/floats.html
% See also p.105 of "TeX Unbound" for suggested values.
% General parameters, for ALL pages:
\renewcommand*{\topfraction}{0.9} % max fraction of floats at top
1307
\renewcommand*{\bottomfraction}{0.8} % max fraction of floats at bottom
Lasse Kliemann's avatar
Lasse Kliemann committed
1308 1309 1310 1311 1312
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4} % 2 may work better
\setcounter{dbltopnumber}{2} % for 2-column pages
1313
\renewcommand*{\dbltopfraction}{0.9} % fit big float above 2-col. text
Lasse Kliemann's avatar
Lasse Kliemann committed
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327
\renewcommand*{\textfraction}{0.07} % allow minimal text w. figs
% Parameters for FLOAT pages (not text pages):
\renewcommand*{\floatpagefraction}{0.7} % require fuller float pages
% N.B.: floatpagefraction MUST be less than topfraction
\renewcommand*{\dblfloatpagefraction}{0.7} % require fuller float pages

%% Configure the url package, and adjust \href command.
\ifthenelse{\isundefined{\DeclareUrlCommand}}{\renewcommand*{\path}[1]{\url{#1}}}{\DeclareUrlCommand\path{}} %%% workaround
\renewcommand*{\UrlFont}{\smaller\tt}
\let\@href\href
\renewcommand*{\href}[3][]{\@href[#1]{#2}{\UrlFont #3}}
\newcommand*{\mailtohref}[1]{\href{mailto:#1}{#1}}

%% Optionally enable french spacing
1328 1329 1330
\ififiseries@frenchspacing
\frenchspacing
\let\@selectlanguage\selectlanguage
1331 1332
%\RenewDocumentCommand\selectlanguage{m}{\selectlelanguage{#1}\frenchspacing}
\renewcommand{\selectlanguage}[1]{\@selectlanguage{#1}\frenchspacing}
1333
\fi
Lasse Kliemann's avatar
Lasse Kliemann committed
1334 1335

\fi % ifiseries@layout