%% skrapport Skånings rapportklass
%%
%% Copyright (C) 2012-2015 by Simon Sigurdhsson <sigurdhsson@gmail.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Simon Sigurdhsson.
%%
%% This work consists of the file skrapport.tex and the derived files:
%%  * skrapport.cls
%%  * skrapport-colortheme-default.sty
%%  * skrapport-colortheme-unscathed.sty
%%  * skrapport-colortheme-violet.sty
%%  * skrapport-colortheme-cruelwater.sty
%%  * skrapport-colortheme-skdoc.sty
%%  * skrapport-size-common.sty
%%  * skrapport-size10pt.clo
%%  * skrapport-size11pt.clo
%%  * skrapport-size12pt.clo
\documentclass{skdoc}
\let\SI\relax
\usepackage{siunitx}
\DeclareSIUnit\point{pt}
\usepackage{hologo,booktabs,xcoffins,calc}
\usepackage[style=authoryear]{biblatex}
\usepackage{csquotes}
\usepackage{varioref,cleveref}
%\usepackage{chslacite}

\ExplSyntaxOn
\cs_set_protected_nopar:Npn\ExplHack{
    \char_set_catcode_letter:n{ 58 }
    \char_set_catcode_letter:n{ 95 }
}
\ExplSyntaxOff

% Hide the implementation
\OnlyDescription

% Bibliography entries
\begin{filecontents}{skrapport.bib}
    @article{kpfonts,
        author = {Christophe Caignaert},
        title = {KP-Fonts 3.31},
        year = {2010},
        url = {http://www.tex.ac.uk/tex-archive/fonts/kpfonts/doc/kpfonts.pdf}
    }
    @standard{ISO216,
        title = {ISO 216:2007},
        subtitle = {Writing paper and certain classes of printed matter -- Trimmed sizes -- A and B series, and indication of machine direction},
        author = {{International Organization for Standardization, Technical Committee 6}},
        year = {2007}
    }
    @standard{ISO8601,
        title = {ISO 8601:2004},
        subtitle = {Data elements and interchange formats -- Information interchange -- Representation of dates and times},
        author = {{International Organization for Standardization, Technical Committee 154}},
        year = {2004}
    }
    @article{Flynn,
        author = {Peter Flynn},
        title = {Rolling your own Document Class: Using \LaTeX{} to
                 keep away from the Dark Side},
        journal = {The Prac\TeX{} Journal},
        number = {4},
        year = {2006},
        url = {http://tug.org/pracjourn/2006-4/flynn/flynn.pdf}
    }
\end{filecontents}
\addbibresource{skrapport.bib}

% Declare the target files
\SelfPreambleTo{\mypreamble}
\DeclareFile[key=class,preamble=\mypreamble]{skrapport.cls}
\DeclareFile[key=size-common,preamble=\mypreamble]%
    {skrapport-size-common.sty}
\DeclareFile[key=size-10,preamble=\mypreamble]{skrapport-size10pt.clo}
\DeclareFile[key=size-11,preamble=\mypreamble]{skrapport-size11pt.clo}
\DeclareFile[key=size-12,preamble=\mypreamble]{skrapport-size12pt.clo}
\DeclareFile[key=theme-default,preamble=\mypreamble]%
    {skrapport-colortheme-default.sty}
\DeclareFile[key=theme-unscathed,preamble=\mypreamble]%
    {skrapport-colortheme-unscathed.sty}
\DeclareFile[key=theme-cruelwater,preamble=\mypreamble]%
    {skrapport-colortheme-cruelwater.sty}
\DeclareFile[key=theme-violet,preamble=\mypreamble]%
    {skrapport-colortheme-violet.sty}
\DeclareFile[key=theme-skdoc,preamble=\mypreamble]%
    {skrapport-colortheme-skdoc.sty}

% This is where the documentation begins
\begin{document}
    % Change & version info
    \version{0.12e}
    \changes{0.01}{Initial version}
    \changes{0.03}{Removed \cs{rd} and \cs{id}}
    \changes{0.04}{Added \pkg{microtype} package}
    \changes{0.05}{Improved documentation}
    \changes{0.06}{Corrected cheksum, further improved documentation}
    \changes{0.07}{Various bugfixes, \hologo{XeLaTeX} compatibility,
                    better float settings, quote style fix,
                    \opt{intlimits} option to \pkg{amsmath}}
    \changes{0.07a}{Fixed \pkg{kpfonts} issues}
    \changes{0.09}{Introduced \pkg{kvoptions},
                    fixed abstract in twocolumn mode}
    \changes{0.10}{Include skmath if exists
                    and wanted. Gobble optional arguments to
                    \env{figure} and \env{table} in two-column mode}
    \changes{0.10a}{Include \pkg{xparse} (fixes breakage)}
    \changes{0.11}{Added \opt{minion} for Adobe Minion Pro font}
    \changes{0.11a}{Added \opt{skdoc} font option and \thm{skdoc} color theme}
    \changes{0.12}{Deprecated several macros, moved to \LaTeX3. Use of TOC depth above 3 is now unsupported}
    \changes{0.12a}{The \pkg{fontspec} package is now only loaded when using the \texttt{word} or \texttt{none} font stacks on \hologo{LuaLaTeX} or \hologo{XeLaTeX}. The \texttt{word} font stack is now
    the default font stack on \hologo{XeLaTeX}}
    \changes{0.12b}{Minor and major bugfixes to \cs{maketitle}, \opt{ptsize}, \opt{twocolumn} and others}
    \changes{0.12c}{Added german language option, fixed sectioning macros in \opt{twocolumn} mode}
    \changes{0.12d}{Added \opt{hanging-titles}, latin phrase macros. Load \pkg{isomath}. Don't load \pkg{icomma}. Use \cs{frenchspacing}}
    \changes{0.12e}{Replace usage of deprecated \pkg{expl3} macros (thanks for the heads-up, Joseph Wright!)}
    % Don't forget to update the version number and release date of
    % the package declaration in the implementation!

    % Metadata
    \package[ctan=skrapport,vcs=https://github.com/urdh/skrapport]{skrapport}
    \title{The \textbf{\thepackage} document class}
    \author{Simon Sigurdhsson}
    \email{sigurdhsson@gmail.com}

    % First page
    \maketitle
    \begin{abstract}
        A document class intended for simple documents \emph{e.g.}
        reports handed in to courses and such. It is small,
        straight-forward and heavily inspired by the Prac\TeX{}
        Journal style.
    \end{abstract}
    \tableofcontents

    \section{Documentation}
    The \thepackage\ document class aims to make typesetting simple but
    stylish documents (mostly reports) as effortless as possible. It
    does this by mostly reimplementing the default \pkg{article} class
    in \LaTeX3, while making modifications to both form and function
    along the way.

    Because it is reimplemented in \LaTeX3, it may be incompatible with
    any number of packages that patch or otherwise modify internals of
    \pkg{article} or other document classes. For commonly used packages
    (especially those used frequently by the author), this shouldn't be
    a problem. The author gladly accepts reports of any such issues at
    the project issue tracker --- see \enquote{Known issues} on
    \vpageref{sec:issues}.

    \subsection{Options}
    As with other document classes, the class is loaded, possibly with
    options, by issuing \Macro\documentclass[<options>]{skrapport}.
    The class has a number of options controlling both form and function,
    by \emph{e.g.} setting the font size, selecting a font stack, setting
    the section title style, and so on.

    \subsubsection{Layout}
    Two options controlling the overall layout of the document are
    provided. Collectively they control the paper size and text layout
    of the document.

    \Option{paper}\WithValues{a4, a5}\AndDefault{a4}
    The \opt{paper} option controls the paper size of the document.
    Internally, this is set by the \pkg{typearea} package, so in theory
    many more paper sizes could be available, but the current options
    cover most useful documents.

    \Option{twocolumn}
    The \opt{twocolumn} option sets up a two-column mode. This is not
    provided by internal \LaTeX\ mechanics as in the original
    \pkg{article} class, but instead by patching environments and macros
    and using a combination of the \pkg{multicol} and \pkg{grid}
    packages. In theory, this means that baselines of adjacent columns
    should be aligned, and that three- or four-column modes are possible
    in the future (but that'd be ridiculous).

    \subsubsection{Style}
    A couple of options to control the style of the document are
    provided. Two of them, \opt{leqno} and \opt{fleqn}, are mainly
    provided for compatibility with the \pkg{article} class.

    \Option{leqno}
    This option makes display math environments typeset their labels on
    the left-hand side of the formula instead of the right-hand side.

    \Option{fleqn}
    This option makes display math environments left-align the entire
    formula as opposed to centering it.

    \Option{indent}\WithValues{true, false}\AndDefault{false}
    The \opt{indent} option enables or disables the indentation of
    paragraphs, with the default being not to indent anything. The
    default behaviour thus is similar to that obtained using the
    \pkg{parskip} package with the \pkg{article} package.

    \Option{titles}\WithValues{rm, it, bf, sf}\AndDefault{bf}
    Section titles (and a few other elements) are controlled by this
    option in that they are typeset either using the regular roman font,
    the boldfaced roman font or the sans serif font. For historical
    reasons the default is a boldfaced roman font, but the sans serif
    option is very handsome.

    \Option{hanging-titles}\WithValues{true, false}\AndDefault{false}
    This options allow sections to be set as \enquote{hanging} titles,
    \emph{i.e.} with the section number in the margin.

    \Option{color}\WithValues{\meta{color theme}}\AndDefault{default}
    This option tells the class to activate color theme support and
    optionally load a color theme. Several color themes are available
    (as detailed by \enquote{Color themes} \vpageref{ssec:color}),
    and the special value \texttt{false} disables color support
    entirely (which only means that the \pkg{xcolor} package isn't
    loaded, and that \cs{colortheme} remains undefined).

    \subsubsection{Fonts}
    Only two options control the font setup of the document class. The
    class provides the same point sizes as \pkg{article}, but also
    provides a large number of font stacks to choose from.

    \Option{ptsize}\WithValues{10pt, 11pt, 12pt}\AndDefault{11pt}
    The document class provides the same three point sizes as the
    \pkg{article} class. There is room for expansion, but there really
    shouldn't be any reason to use other point sizes.

    \Option{font}\WithValues{none, kpfonts, lmodern, palatino, minion, skdoc, word}\AndDefault{kpfonts}
    Several different font stacks, detailed by \vref{tab:font}, are
    provided. Most of these work with \hologo{pdfLaTeX}, but there are
    two special font stacks: \texttt{none} and \texttt{word}. The
    former, predictably, loads no fonts whatsoever leaving the document
    with Computer Modern fonts. This is useful if the fonts are replaced
    later anyway, such as when using \hologo{XeLaTeX}.

    The \texttt{word}
    font stack, however, does load a few fonts. The fonts must be present
    and installed on the system as OTF or TTF fonts, and the font stack
    requires either \hologo{XeLaTeX} or \hologo{LuaLaTeX}.
    Both \texttt{word} and \texttt{none} load the \pkg{fontspec}
    package, assuming the document is compiled using \hologo{XeLaTeX}
    or \hologo{LuaLaTeX}.

    \Notice{The \texttt{skdoc} font stack doesn't have a math font.}
    \Warning{Currently, \pkg{fontspec} is always loaded by
             \hologo{XeLaTeX} regardless of options due to
             the use of \pkg{polyglossia}. This means that
             you \emph{have} to use OpenType fonts in your
             document, otherwise \emph{only} Latin Modern
             Roman (\emph{i.e.} no sans-serif or monospace
             fonts) will be available. Therefore, the \texttt{word}
             font stack is the default when using \hologo{XeLaTeX}.
             \Hologo{LuaLaTeX} is not affected by this.}

    \begin{table}[tp]
        \centering
        \caption{Font stacks provided by \thepackage.}
        \label{tab:font}
        \NewCoffin\tempcoffin\newlength\templength
        \SetHorizontalCoffin\tempcoffin{
            \begin{tabular}{lllll}
                \toprule
                Font stack & Serif font & Math font & Sans serif font & Monospace font \\
                \midrule
                \texttt{kpfonts} & Kp-Fonts & Kp-Fonts & Kp-Fonts & Kp-Fonts \\
                \texttt{lmodern} & Latin Modern & Latin Modern & Latin Modern & Source Code Pro \\
                \texttt{palatino} & \TeX\ Gyre & PX & Arev & Source Code Pro \\
                \texttt{minion} & Minion Pro & Minion Pro & Myriad Pro & Source Code Pro \\
                \texttt{skdoc} & PT Serif & --- & Open Sans & Source Code Pro \\
                \texttt{word} & Cambria & Cambria Math & Calibri & Consolas \\
                \bottomrule
            \end{tabular}
        }
        \setlength{\templength}{(\textwidth - \CoffinWidth\tempcoffin)/2}
        \hspace*{\templength}
        \TypesetCoffin\tempcoffin
    \end{table}

    \subsubsection{Functionality}
    The final three options affect functionality in one way or another.
    Since \thepackage\ was originally designed for reports written in
    either swedish or english, the class always loads either \pkg{babel}
    or \pkg{polyglossia} with either of these languages. Additionally,
    the class may load the \pkg{skmath} package if desirable.

    \Option{nomath}\WithValues{true, false}\AndDefault{false}
    When \texttt{false}, the \pkg{skmath} package is loaded, providing
    improvements to the math functionality of \pkg{amsmath} and friends.

    \Option{lang}\WithValues{en, sv, de}\AndDefault{sv}
    This option specifies what main language \pkg{babel} or
    \pkg{polyglossia} set up with. English (or swedish, for
    \texttt{lang=en}) is loaded as well, for use in constructs
    that allow for a second language.

    \Option{draft}\WithValues{true, false}\AndDefault{false}
    The \opt{draft} option, much like in \pkg{article}, enables
    \cs{overfullrule}s and possibly similar functionality in loaded
    packages (if they react to the global \opt{draft} option).

    \subsection{User-level commands and environments}
    The general idea behind the document class is to provide most
    (if not all) of the macros provided by the standard \LaTeXe{}
    classes, as well as additional macros to simplify and beautify
    the documents produced. As such, most of the documentation that
    follows details macros that are present in the standard document
    classes. Some of them have changed functionality or semantics,
    so at least a skim through this section is recommended.

    \subsubsection{The front page}
    The front page is the part of the document that has seen the most
    changes in \thepackage\ compared to \pkg{article}. In addition to
    the new, Prac\TeX-inspired layout, there are a few additional
    pieces of information in it. Also, the \cs{author} macro has been
    dramatically improved.

    \DescribeMacro\date{<ISO8601 date>}
    The \cs{date} macro now internally employs \pkg{isodate} to typeset
    the date of the document. This means that the input must be either
    the string \enquote{today}, the token \cs{today} or a date as defined
    by ISO8601\footcite{ISO8601}. The mechanisms provided by
    \pkg{isodate} can be used to affect the output format.

    \DescribeMacro\author[<email>]{<name>}
    In contrast with the \pkg{article} package, the \cs{author} macro
    should no longer be used to typeset several author names at once.
    Instead, one \cs{author} command is to be issued for every author,
    optionally providing a corresponding email. These are then combined,
    in the order they are given, to form a list of authors and a
    corresponding list of email adresses.

    \DescribeMacro\regarding{<topic>}
    This macro defines a topic or other short message detailing the
    purpose of the document. It is typeset along with the date in the
    upper left corner of the title page.

    \DescribeMacro\license{<license name>}
    The \cs{license} macro defines a short license name to be typeset
    in the lower right corner of the title page. This mechanism could of
    course be used to typeset an institution name or similar as well.
    It is only typeset when also using the \env{titlepage} environment
    described below.

    \DescribeMacro\title{<document title>}
    The \cs{title} macro, while not defined by \pkg{skrapport}, is
    relevant to describe. It simply sets the title of the document, as
    displayed by \cs{maketitle}.

    \DescribeMacro\maketitle[hide=\{date,regarding,email\},nopdfinfo]
    As in \pkg{article}, the \cs{maketitle} macro typesets the
    information provided by \cs{title}, \cs{author} and friends to form
    a stylish front page. When combined with \env{abstract},
    \env{titlepage} and/or \cs{tableofcontents}, you get a very
    good-looking preamble with almost no effort.

    The optional argument is a key-value list with two valid entries,
    \opt*{hide} and \opt*{nopdfinfo}. The \opt*{hide} entry accepts a
    comma-separated list in which the values \opt*{date},
    \opt*{regarding} and \opt*{email}
    are interpreted as instructions to hide the corresponding entry from
    the front page. The \opt*{nopdfinfo} key disables the generation of
    PDF information by \pkg{hyperref}.

    \DescribeEnv[<abstract text>]{abstract}
    The \env{abstract} environment defines an abstract, which is typeset
    in a block with the \cs{abstractname} word next to it (see
    \emph{e.g.} the title page of this manual for an example).

    \DescribeEnv[<title page contents>]{titlepage}
    Normally, \cs{maketitle} doesn't reserve its own page. By enclosing
    \cs{maketitle} (and \env{abstract} if appropriate) in the
    \env{titlepage} environment, the contents are typeset on their
    own page, without page numbering and with the \cs{license} text
    in the lower right corner (if applicable).

    \subsubsection{Sectioning}
    \DescribeMacro\section*[<short title>]{<title>}
    \DescribeMacro\subsection*[<short title>]{<title>}
    \DescribeMacro\subsubsection*[<short title>]{<title>}
    \DescribeMacro\paragraph*[<short title>]{<title>}
    \DescribeMacro\subparagraph*[<short title>]{<title>}
    The sectioning macros are superficially very similar to those
    provided by \pkg{article}, but have been completely reimplemented
    in \pkg{expl3} code. Additionally, the style of these sectioning
    macros, as detailed by the \opt{titles} option documentation above,
    can be changed.

    All of them have both arguments and behaviour in common, only
    differing in style. The starred versions are unnumbered, but still
    accept the opional short title (simply discarding it). The optional
    short title is used in the table of contents. The
    \texttt{secnumdepth} counter limits the depth of section numbering.

    The first three macros, being section titles, are typeset as actual
    titles on their own line with appropriate spacing above and below.
    The paragraph macros instead typeset run-in titles.

    \subsubsection{Macros and environments from \pkg{article}}
    Aside from the \env{itemize} and \env{enumerate} envionments and the
    font selection macros, which are carried without modification from
    \LaTeXe, a couple of environments and macros are defined.

    The old font macros, whose use has been discouraged for a long time,
    are now deprecated. Instead of functioning correctly, they will emit
    an error and require user input. Use the \cs*{text??}/\cs*{??family}
    macros instead. For emphasis, use the \cs{emph} macro.

    \DescribeMacro\emph{<text>}
    Emphasized text will be typeset in italic, or bold italic if the
    macro is used in a context where italic is already used (such as
    inside another \cs{emph} invokation).

    \DescribeEnv[\cs*{item}\oarg{item} \meta{description}]{description}
    The \env{description} environment behaves as expected, typesetting
    a list of descriptions as in the \pkg{article} class.

    \DescribeEnv[<short quote>]{quote}
    Intended for short quotes, the \env{quote} environment simply
    typesets a centered block of italic text.

    \DescribeEnv[<long quote>]{quotation}
    Longer quoted passages are typeset using the \env{quotation}
    environment. This is simply a \env{quote} environment with additional
    spacing above and below.

    \DescribeEnv[<pretentious poetry>]{verse}
    The \env{verse} environment is intended for poetry and other text
    where line breaks are critical. Use \verb|\\| to break
    lines.

    \DescribeMacro\appendix
    This macro signals the end of the main matter and the start of
    the appendix. In essence, it resets the section numbering counter
    and changes the section numbering to the upper-case alphabetic
    sequence.

    \subsubsection{Floats}
    Both the \env{figure} and \env{table} float environments accept an
    optional positioning argument. The default positioning is
    \texttt{tp}. Both environments also have starred variants, which
    do nothing in one-column mode while typesetting the figure across
    both columns in two-column mode. As usual, \cs{centering},
    \cs{caption} and \cs{label} should be used inside the floats.

    \DescribeEnv[<content>]{figure}[position]
    This float environment is intended for figures. The most common
    contents are \cs{includegraphics} statements or \env{tikzpicture}
    environments.

    \DescribeEnv[<content>]{table}[position]
    A float intended for tables. Probably contains \env{tabular}s.

    \DescribeEnv{figcenter}
    This environment is useful for wide figures and tables. It typesets
    its contents centered horizonally, but allows the content to extend
    into the margin. The content is set in a horizontal coffin.

    \subsubsection{Table of contents}
    \DescribeMacro\tableofcontents
    The table of contents are typeset using this macro. The
    \texttt{tocdepth} counter limits the depth of the table of
    contents, but for stylistic reasons values higher than 3 are
    unsupported.

%    \subsubsection{Basic bibliography support}

    \subsubsection{Miscellaneous}
    \DescribeMacro\comment*{<comment>}
    \DescribeMacro\note*{<comment>}
    \DescribeMacro\com*{<comment>}
    These macros, the two latter being aliases of the first one, typeset
    an author's comment in the document. The starred variants typeset the
    comment inline with a red background, while the unstarred variant
    typesets the comment in a \cs{marginpar}.

    \DescribeMacro\eg
    \DescribeMacro\ie
    \DescribeMacro\etc
    \DescribeMacro\cf
    \DescribeMacro\viz
    These macro print the abbreviation of the latin phrases
    \emph{exempli gratia}, \emph{id est}, \emph{et cetera},
    \emph{confer} and \emph{videlicet}, respectively.
    The macros peek ahead to find punctuation marks and spaces, so they
    should behave correctly regardless of usage (assuming they're used in
    running text and uncomplicated settings). In languages other than
    english, appropriate translations are made if applicable.

    \DescribeMacro\dash
    This macro prints an em-dash surrounded by thin spaces, as discussed
    by \textcite[\pno~8]{Flynn}. When \cs*{DeclareUnicodeCharacter} is
    available, the real em dash uses this definition.

    \subsubsection{Color theme support}
    \DescribeMacro\colortheme{<theme>}
    The \cs{colortheme} macro, which is only available when the
    \opt{color} option is \texttt{true}, applies a color theme to
    the document. For a list of available color themes, see
    \enquote{Color themes} \vpageref{ssec:color}.

    \subsubsection{Font size macros}
    The font size macros, expectedly, set the size of the text. They
    do not take arguments, instead affecting all subsequent text of the
    current \TeX\ group, so use braces to provide and limit context.
    Also note that unlike \pkg{article}, these macros are \emph{all}
    available, regardless of point size option.

    \DescribeMacro\tiny
    Typesets {\tiny tiny} text.
    \DescribeMacro\scriptsize
    Typesets {\scriptsize script-size} text.
    \DescribeMacro\footnotesize
    Typesets {\footnotesize footnote-sized} text.
    \DescribeMacro\small
    Typesets {\small small} text.
    \DescribeMacro\normalsize
    Typesets normal text.
    \DescribeMacro\large
    Typesets {\large large} text.
    \DescribeMacro\Large
    Typesets {\Large slightly larger} text.
    \DescribeMacro\LARGE
    Typesets {\LARGE even larger} text.
    \DescribeMacro\huge
    Typesets {\huge huge} text.
    \DescribeMacro\Huge
    Typesets {\Huge really huge} text.

    \subsection{Color themes}\label{ssec:color}
    \DescribeMacro\colortheme{<theme>}
    If the package is loaded with the \opt{color} option, changing the color theme is
    possible using \cs{colortheme}, which loads an
    appropriate package. At the moment, four color themes are available.

    \Theme{default}
    The \thm{default} theme is fairly conservative, only coloring
    \pkg{hyperef} links with more readable, slightly darker colors than
    the standard ones. It should print well even on non-color printers.

    \Theme{unscathed}
    The \thm{unscathed} theme is based on a palette with the same
    name on COLOURlovers%
\footnote{\url{http://www.colourlovers.com/palette/1440498/unscathed}},
    and applies a \textcolor[HTML]{463335}{dark brown} color to
    emphasized text, a \textcolor[HTML]{CF5D3B}{rusty} color to links,
    a \textcolor[HTML]{B34430}{darker rust} color to titles and a
    \textcolor[HTML]{70524A}{lighter brown} to quotes.

    \Theme{cruelwater}
    The \thm{cruelwater} theme is also based on a palette from
    COLOURlovers%
\footnote{\url{http://www.colourlovers.com/palette/126030/Cruel_Water_at_Night}},
    and applies a \textcolor[HTML]{030C22}{dark blue} color to bold
    text and captions, a \textcolor[HTML]{20293F}{slightly less dark
    blue} to titles and emphasized text, a \textcolor[HTML]{A9B0B3}{
    light gray} color to small print and a \textcolor[HTML]{404749}{
    darker gray} to quotes.

    \Theme{violet}
    The \thm{violet} theme, like \thm{unscathed} and \thm{cruelwater},
    is based on a COLOURlovers palette%
\footnote{\url{http://www.colourlovers.com/palette/1831303/Violet_White_Bedrm}}.
    It colors all links \textcolor[HTML]{932444}{bright purple}, applies
    a \textcolor[HTML]{311A2A}{dark puple} color to titles, bold text
    and captions, a \textcolor[HTML]{D6CBCF}{grayish purple} to small
    print, a \textcolor[HTML]{463335}{dark brown} color to quotes and a
    \textcolor[HTML]{98758D}{pastel violet} color to emphasized text.

    \Theme{skdoc}
    The \thm{skdoc} theme is loosely based on the \pkg{skdoc} document class, with which this documentation is typeset.

%    \subsection{Additional information}
%    The document class includes a number of packages by default. This
%    is useful to know, since passing explicit options to these packages
%    will require you to utilize the \cs{PassOptionsToPackage} macro
%    before you load the class using \cs{documentclass}.
%    Table~\ref{tab:pkgs} lists the packages included by \thepkg\ along
%    with their options (if applicable).
%
%    \begin{table}[tbp]
%        \centering
%        \caption{User-level packages included by \thepkg.}
%        \label{tab:pkgs}
%        \begin{tabular}{llp{15em}}
%            \toprule
%            \textbf{Package} & \textbf{Options} & \textbf{Comments} \\
%            \midrule
%            \pkg{amsmath} & \texttt{intlimits} & Provides \hologo{AmS} commands and environments. \\
%            \pkg{amssymb} & & Only if not using \opt{kpfonts}.\\
%            \pkg{babel} & see options \opt{swe} and \opt{eng} & Only loaded if \emph{not} using \hologo{XeTeX}.\\
%            \pkg{calc} & & \\
%            \pkg{fontenc} & \texttt{T1} & Only loaded if \emph{not} using \hologo{XeTeX}. Makes sure we are using a good font encoding for crisp appearance on-screen (OT1 is horrible). \\
%            \pkg{fontspec} & \texttt{quiet} & Only loaded if using \hologo{XeTeX}. Provides basic OTF font selection commands.\\
%            \pkg{geometry} & \texttt{a4paper} or \texttt{a5paper} & This is used by the \opt{paper} option to set the paper area. \\
%            \pkg{icomma} & & \\
%            \pkg{inconsolata} & & \\
%            \pkg{microtype} & & Provides micro-typographic improvements.\\
%            \pkg{multicol} & & Only loaded with the \opt{twocolumn} option. \\
%            \pkg{polyglossia} & see options \opt{swe} and \opt{eng} & Only loaded if using \hologo{XeTeX}.\\
%            \pkg{skmath} & & Only if it exists and \opt{nomath} isn't set.\\
%            \pkg{textcomp} & & Only if not using \opt{kpfonts}.\\
%            \pkg{xcolor} & & Only loaded with the \opt{color} option.\\
%            \bottomrule
%        \end{tabular}
%    \end{table}

    \section{Known issues}\label{sec:issues}
    A list of current issues is available in the Github repository of this
    package\footnote{\url{https://github.com/urdh/skrapport/issues}}, but as
    of the release of \theversion, there is one known issue:
    \begin{description}
    %    \item[\#6]  ???
        \item[--] If a \cs{subsubsection} is the last item of the Table
        of Contents, it will not be indented properly.
    \end{description}

    If you discover any bugs in this package, please report them to the issue
    tracker in the \thepackage\ Github repository.

    \Implementation\ExplHack
    \section{Implementation}
    Start by including \pkg{expl3}, \pkg{l3keys2e} and some other
    useful packages, as well as declaring the class.
\begin{MacroCode}{class}
\RequirePackage{expl3,l3keys2e,xparse,xstring,etoolbox}
\ProvidesExplClass{skrapport}%
    {2015/07/17}{0.12e}{stylish report document class}
\end{MacroCode}

    \subsection{Messages}
    Tons of messages are declared for future use.
\begin{MacroCode}{class}
\msg_new:nnnn{skrapport}{option-deprecated}{Option~`#1'~deprecated!}
    {Please~use~`#2'~instead.}
\msg_new:nnnn{skrapport}{option-no-effect}{Option~`#1'~deprecated!}
    {It~has~no~effect;~simply~use~nothing~instead.}
\msg_new:nnnn{skrapport}{invalid-paper-size}{Invalid~paper~size~`#1'!}
    {\token_to_str:N\__skrapport_setup_paper:n~was~invoked~with~an~
     invalid~argument;~paper~size~will~remain~unchanged.}
\msg_new:nnnn{skrapport}{invalid-point-size}{Invalid~point~size~`#1'!}
    {\token_to_str:N\__skrapport_setup_ptsize:n~was~invoked~with~an~
     invalid~argument;~cannot~continue~without~setting~a~valid~point~
     size.~Please~fix~the~issue~before~typesetting~again.}
\msg_new:nnnn{skrapport}{invalid-titles}{Invalid~title~type~`#1'!}
    {\token_to_str:N\__skrapport_setup_titles:n~was~invoked~with~an~
     invalid~argument;~falling~back~to~`#2'.}
\msg_new:nnnn{skrapport}{invalid-lang}{Invalid~language~`#1'!}
    {\token_to_str:N\__skrapport_setup_lang:n~was~invoked~with~an~
     invalid~argument;~`babel'~and/or~`polyglossia'~will~remain~
    unloaded.}
\msg_new:nnnn{skrapport}{invalid-font}{Invalid~font~`#1'!}
    {\token_to_str:N\__skrapport_setup_font:n~was~invoked~with~an~
     invalid~argument;~no~font~package~has~been~loaded.~This~may~result~
     in~bad~rendering~due~to~old~Computer~Modern~fonts.}
\msg_new:nnnn{skrapport}{noop-call}{No-op~invokation~of~macro!}
    {\token_to_str:N#1~was~invoked,~but~circumstances~dictate~that~the~
    macro~should~do~nothing.~Will~do~\token_to_str:N\prg_do_nothing:~
    instead.}
\msg_new:nnnn{skrapport}{old-font-deprecated}{Deprecated~macro~\token_to_str:N#1!}
    {The~old~font~macro~\token_to_str:N#1~is~deprecated!~Use~
    \token_to_str:N#2~instead.}
\msg_new:nnnn{skrapport}{color-patch-failed}{Could~not~patch~macro~\token_to_str:N#1!}
    {The~macro~\token_to_str:N#1~could~not~be~patched!~Color~theme~
    support~may~be~incomplete.}
\msg_new:nnnn{skrapport}{license-not-printed}{Detected~\token_to_str:N\license\ but~no~`titlepage'!}
    {The~text~provided~by~\token_to_str:N\license\ is~only~printed~when~
    the~`titlepage'~environment~is~used,~but~it~seems~to~be~missing.}
\msg_new:nnnn{skrapport}{font-requires-xetex}{The~`font=#1'~option~requires~XeTeX~or~luaTeX!}
    {Please~choose~another~font~setup~or~compile~the~document~with~
    either~xelatex~or~lualatex.}
\msg_new:nnnn{skrapport}{tocdepth-too-deep}{TOC~depth~is~too~deep!}
    {The~current~tocdepth,~#1,~is~not~supported.~Please~redefine~the~
    \token_to_str:N#2~macro~to~enable~support.}
\msg_new:nnnn{skrapport}{caption-in-figcenter}{Cannot~use~\token_to_str:N\caption\ here!}
    {The~\token_to_str:N\caption\ macro~can't~be~used~inside~figcenter~environments!~Please~move~the~caption~to~the~enclosing~float~environment.}
\end{MacroCode}
    This message should probably not be used at all. Except in
    development versions straight off Github, of course.
\begin{MacroCode}{class}
\msg_new:nnn{skrapport}{not-implemented}
    {Unimplemented~macro~\token_to_str:N#1!}
\end{MacroCode}

    \subsection{Options}
    First, a few booleans used by parts of the option handling code.
    \begin{macro}{\g__skrapport_draft_bool}
    Are we in \opt{draft} mode?
\begin{MacroCode}{class}
\bool_new:N\g__skrapport_draft_bool
\end{MacroCode}
    \end{macro}
    \begin{macro}{\g__skrapport_color_bool}
    Are we supposed to be using \opt{color}s?
\begin{MacroCode}{class}
\bool_new:N\g__skrapport_color_bool
\end{MacroCode}
    \end{macro}
    \begin{macro}{\g__skrapport_has_polyglossia_bool}
    Has \pkg{polyglossia} been loaded?
\begin{MacroCode}{class}
\bool_new:N\g__skrapport_has_polyglossia_bool
\end{MacroCode}
    \end{macro}

    \subsubsection{Option setup macros}
    In this section, all options declared in the previous section are
    implemented using setup macros. Some of these may have to be called
    in an appropriate order, but I haven't checked that yet.

    \begin{macro}{\__skrapport_setup_paper:n}[1]
        {Paper size (\texttt{a4} or \texttt{a5})}
    \changes{0.12}{Use \pkg{typearea} to set paper size}
    Note the extra integer, which is set up for use with \pkg{grid}.
    \begin{macro*}{\g__skrapport_grid_lines_int}
\begin{MacroCode}{class}
\int_new:N\g__skrapport_grid_lines_int
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_setup_paper:n#1{
    \str_case:nnF{#1}{
\end{MacroCode}
    The two options simply consist of passing the appropriate option
    to the \pkg{typearea} package. Note that the use of \pkg{typearea}
    mean that we theoretically could accept more paper size options.
\begin{MacroCode}{class}
        {a4}{
            \PassOptionsToPackage{paper=A4}{typearea}
            \int_gset:Nn\g__skrapport_grid_lines_int{40}
        }
        {a5}{
            \PassOptionsToPackage{paper=A5}{typearea}
            \int_gset:Nn\g__skrapport_grid_lines_int{28}
        }
    }{
\end{MacroCode}
    Invalid paper sizes (such calls should never happen) are
    handled by issuing a warning and hoping that the default
    paper size is acceptable.
\begin{MacroCode}{class}
        \msg_warning:nnn{skrapport}{invalid-paper-size}{#1}
    }
\end{MacroCode}
    The \pkg{typearea} package is loaded with the options specified
    earlier through \cs{PassOptionsToPackage}, and some additional ones.
\begin{MacroCode}{class}
    \AtEndOfClass{\RequirePackage[DIV=calc]{typearea}}
\end{MacroCode}
    In case the point size changes later, or two column mode is
    activated, we recalculate the typearea just before the typesetting
    begins.
\begin{MacroCode}{class}
    \AtBeginDocument{\recalctypearea}
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_ptsize:n}[1]
        {Point size (\texttt{10pt}, \texttt{11pt} or \texttt{12pt})}
    The standard point sizes are defined much like in the \pkg{article}
    class, \emph{i.e.} by saving a number and loading \file{size10.clo},
    \file{size11.clo} or \file{size12.clo} as appropriate
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_setup_ptsize:n#1{
    \str_case:nnF{#1}{
\end{MacroCode}
    \begin{macro*}{\c__skrapport_ptsize_token}
\begin{MacroCode}{class}
        {10pt}{\int_const:Nn\c__skrapport_ptsize_int{0}}
        {11pt}{\int_const:Nn\c__skrapport_ptsize_int{1}}
        {12pt}{\int_const:Nn\c__skrapport_ptsize_int{2}}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
    }{
\end{MacroCode}
    Invalid point sizes are critical errors, since we can't recover
    from them in any reasonable way. Loading a default point size is
    unreasonable, since all in-class calls to this macro should know
    what sizes are available, and if you're calling it with invalid
    parameters from elsewhere, you should be punished.
\begin{MacroCode}{class}
        \msg_critical:nnn{skrapport}{invalid-point-size}{#1}
    }
    \file_input:n{skrapport-size#1.clo}
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_twocolumn:}
    \changes{0.12c}{Major changes to the sectioning commands, to
    override what \pkg{grid} is doing}
    Setting up for twocolumn mode is slightly compliacted. Note that this
    macro should be called from \cs{AtEndOfClass} to ensure that we patch
    everything correctly. Note also that \pkg{multicol} is always loaded
    as it is used for the \env{theindex} environment.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_twocolumn:{
    \RequirePackage{etoolbox}
    \AtBeginDocument{
        \KOMAoptions{twocolumn=false,DIV=12}
    }
\end{MacroCode}
    We include the \pkg{grid} package in two-column mode, because
    it looks way better that way.
\begin{MacroCode}{class}
    \int_set:Nn\l_tmpa_int{10+\c__skrapport_ptsize_int}
    \int_set:Nn\l_tmpb_int{12*\l_tmpa_int/10}
    \RequirePackage[fontsize=\l_tmpa_int pt,
                    baseline=\l_tmpb_int pt,
                    lines=\g__skrapport_grid_lines_int]{grid}
\end{MacroCode}
    Now, we patch commands. First up is \env{abstract}. Save the old
    one in case we need it (we do).
\begin{MacroCode}{class}
    \cs_set_eq:Nc\__skrapport_onecol_abstract:{environment~abstract~code}
    \cs_set_eq:Nc\__skrapport_end_onecol_abstract:{environment~abstract~end~aux~}
    \pretocmd{\__skrapport_onecol_abstract:}{\null}{}{}
    \RenewDocumentEnvironment{abstract}{}{\section*{\abstractname}}{}
\end{MacroCode}
    Then \env{document} (kind of, at least) and \cs{maketitle}. Again,
    save the old \cs{maketitle}.
\begin{MacroCode}{class}
    \AfterEndPreamble{\begin{multicols}{2}}
    \AtEndDocument{\end{multicols}}
    \cs_set_eq:NN\__skrapport_onecol_maketitle:\maketitle
    \pretocmd{\maketitle}{\begin{onecol}}{}{}
    \apptocmd{\maketitle}{\end{onecol}}{}{}
\end{MacroCode}
    Next up is \env{titlepage}. This is where we need the saved
    \env{abstract} and \cs{maketitle}.
\begin{MacroCode}{class}
    \BeforeBeginEnvironment{titlepage}{
        \begin{onecol}
        \cs_set_eq:cN{environment~abstract~code}\__skrapport_onecol_abstract:
        \cs_set_eq:cN{environment~abstract~end~aux~}\__skrapport_end_onecol_abstract:
        \cs_set_eq:NN\maketitle\__skrapport_onecol_maketitle:
    }
    \AfterEndEnvironment{titlepage}{\end{onecol}}
\end{MacroCode}
    Always typeset \env{equation} and friends outside the grid:
\begin{MacroCode}{class}
    \BeforeBeginEnvironment{equation}{\begin{gridenv}}
    \AfterEndEnvironment{equation}{\end{gridenv}}
    \BeforeBeginEnvironment{equation*}{\begin{gridenv}}
    \AfterEndEnvironment{equation*}{\end{gridenv}}
    \BeforeBeginEnvironment{multline}{\begin{gridenv}}
    \AfterEndEnvironment{multline}{\end{gridenv}}
    \BeforeBeginEnvironment{multline*}{\begin{gridenv}}
    \AfterEndEnvironment{multline*}{\end{gridenv}}
    \BeforeBeginEnvironment{gather}{\begin{gridenv}}
    \AfterEndEnvironment{gather}{\end{gridenv}}
    \BeforeBeginEnvironment{gather*}{\begin{gridenv}}
    \AfterEndEnvironment{gather*}{\end{gridenv}}
    \BeforeBeginEnvironment{align}{\begin{gridenv}}
    \AfterEndEnvironment{align}{\end{gridenv}}
    \BeforeBeginEnvironment{align*}{\begin{gridenv}}
    \AfterEndEnvironment{align*}{\end{gridenv}}
    \BeforeBeginEnvironment{flalign}{\begin{gridenv}}
    \AfterEndEnvironment{flalign}{\end{gridenv}}
    \BeforeBeginEnvironment{flalign*}{\begin{gridenv}}
    \AfterEndEnvironment{flalign*}{\end{gridenv}}
    \BeforeBeginEnvironment{alignat}{\begin{gridenv}}
    \AfterEndEnvironment{alignat}{\end{gridenv}}
    \BeforeBeginEnvironment{alignat*}{\begin{gridenv}}
    \AfterEndEnvironment{alignat*}{\end{gridenv}}
\end{MacroCode}
    Since \pkg{grid} override the usual sectioning macros, we have to
    provide fixed and improved variants that conform to our style
    and out public API. This is only necessary for
    the \enquote{major} sectioning macros, not \cs*{paragraph} and
    \cs*{subparagraph}.
    \begin{macro*}{\section}
\begin{MacroCode}{class}
    \skip_gset:Nn\c__skrapport_section_pre_skip{-.999\baselineskip}
    \skip_gset:Nn\c__skrapport_section_post_skip{0.001\baselineskip}
    \dim_gset:Nn \c__skrapport_section_indent_dim{\c_zero_dim}
    \cs_set_protected:Nn\__skrapport_section_style:
        {\normalfont\__skrapport_title_style:}
    \DeclareDocumentCommand\section{som}{
        \__skrapport_generic_section:nnnnn{section}{1}{##1}{##2}{##3}
    }
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\subsection}
\begin{MacroCode}{class}
    \skip_gset:Nn\c__skrapport_subsection_pre_skip{\baselineskip}
    \skip_gset:Nn\c__skrapport_subsection_post_skip{-.35\baselineskip}
    \dim_gset:Nn \c__skrapport_subsection_indent_dim{\c_zero_dim}
    \cs_set_protected:Nn\__skrapport_subsection_style:
        {\normalfont\__skrapport_title_style:\unskip}
    \DeclareDocumentCommand\subsection{som}{
        \__skrapport_generic_section:nnnnn{subsection}{2}{##1}{##2}{##3}
    }
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\subsubsection}
\begin{MacroCode}{class}
    \skip_gset:Nn\c__skrapport_subsubsection_pre_skip{\baselineskip}
    \skip_gset:Nn\c__skrapport_subsubsection_post_skip{-.35\baselineskip}
    \dim_gset:Nn \c__skrapport_subsubsection_indent_dim{\c_zero_dim}
    \cs_set_protected:Nn\__skrapport_subsubsection_style:
        {\normalfont\itshape\__skrapport_title_style:\unskip}
    \DeclareDocumentCommand\subsubsection{som}{
        \__skrapport_generic_section:nnnnn{subsubsection}{3}{##1}{##2}{##3}
    }
\end{MacroCode}
    \end{macro*}
    We also redefine \cs{l@section} to make the TOC blend in a bit.
    \begin{macro*}{\l@section}
\begin{MacroCode}{class}
    \DeclareDocumentCommand\l@section{mm}{
        \group_begin:
            \skip_vertical:n{.75ex}
            \__skrapport_title_style:
            \__skrapport_toc_line:nnnnn{1}{0em}{1.3em}{##1}{
                \__skrapport_title_style: ##2
            }
        \group_end:
    }
\end{MacroCode}
    \end{macro*}
    The \env{figure} environment is patched\ldots
\begin{MacroCode}{class}
    \cs_new:Npn\__skrapport_xdblfloat:nn##1##2{\@xdblfloat{##1}[##2]}
    \cs_generate_variant:Nn\__skrapport_xdblfloat:nn{nx}
    \RenewDocumentEnvironment{figure}{o}{
        \begin{gridenv}
            \vspace{\intextsep}
            \begin{minipage}{\linewidth}
                \cs_set:Npn\@captype{figure}
                \centering
    }{
            \end{minipage}
            \vspace{\intextsep}
        \end{gridenv}
    }
    \RenewDocumentEnvironment{figure*}{o}{
        \__skrapport_xdblfloat:nx{figure}
            {\IfNoValueTF{##1}{tp}{##1}}
        \dim_set_eq:NN\hsize\textwidth
        \dim_set_eq:NN\linewidth\textwidth
        \centering
    }{
        \end@dblfloat
    }
\end{MacroCode}
    \ldots as is \env{table}.
\begin{MacroCode}{class}
    \RenewDocumentEnvironment{table}{o}{%
        \begin{gridenv}
            \vspace{\intextsep}
            \begin{minipage}{\linewidth}
                \cs_set:Npn\@captype{table}
                \cs_set_eq:NN\__skrapport_old_caption:\caption
                \RenewDocumentCommand{\caption}{om}{%
                    \skip_set_eq:NN\l_tmpa_skip\abovecaptionskip
                    \skip_set_eq:NN\abovecaptionskip\belowcaptionskip
                    \skip_set_eq:NN\belowcaptionskip\l_tmpa_skip
                    \vspace{\abovecaptionskip}
                    \__skrapport_old_caption:[####1]{####2}
                    \vspace{\belowcaptionskip}
                }
                \centering
    }{
            \end{minipage}
            \vspace{\intextsep}
        \end{gridenv}
    }
    \RenewDocumentEnvironment{table*}{o}{
        \__skrapport_xdblfloat:nx{table}
            {\IfNoValueTF{##1}{tp}{##1}}
        \dim_set_eq:NN\hsize\textwidth
        \dim_set_eq:NN\linewidth\textwidth
        \centering
    }{
        \end@dblfloat
    }
\end{MacroCode}
    \begin{environment}{onecol}
    \changes{0.10}{Fixed, now not completely broken}
    \changes{0.12b}{Reverted to \cs{newenvironment}, because \pkg{xparse} breaks the trickery}
    Finally, we define an environment \env{onecol} that typesets
    arbitrary material in a single column. This is a bit tricky to
    do, and probably cargo-cult as well. We define the start of the
    environment to immediately end itself (with the empty ending),
    then end the \env{multiols} environment, redefine our end macro
    to start \env{multicols} as well as redefining the start of
    \env{onecol} to simply reset itself, then start the environment
    again only to have it ended at once.

    Basically, we trick \LaTeX\ into thinking that we have an empty
    \env{onecol} environment at the end of the first \env{multicols},
    then some content inside a fake \env{onecol}, then an empty
    \env{onecol} at the start of the next \env{multicols}. Voilá, no
    wierd group errors!
\begin{MacroCode}{class}
    \newenvironment{onecol}{
        \end{onecol}
        \end{multicols}
        \group_begin:
        \cs_set:Npn\endonecol{
            \group_end:
            \begin{multicols}{2}
            \cs_set_eq:NN\__skrapport_old_onecol:\onecol
            \cs_set:Npn\onecol{
                \cs_set_eq:NN\onecol\__skrapport_old_onecol:
            }
            \begin{onecol}
        }
        \cs_set:Npn\onecol{}
        \begin{onecol}
    }{}
\end{MacroCode}
    \end{environment}
\begin{MacroCode}{class}
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_leqno:}
    Instead of loading \file{leqno.clo}, we reimplement the (tiny) file
    as LaTeX3 code and include it directly. It's not terribly advanced.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_leqno:{
    \RenewDocumentCommand\@eqnnum{}{
        \hbox_to_wd:nn{.01pt}{}
        \hbox_overlap_right:n{
            \normalfont\normalcolor
            \skip_horizontal:n{-\displaywidth}
            (\theequation)
        }
    }
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_fleqn:}
    The \file{fleqn.clo} functionality is more complex, so we include
    the file instead of reimplementing.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_fleqn:{
    \file_input:n{fleqn.clo}
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_titles:n}[1]
        {Title style (\texttt{rm}, \texttt{it},
                      \texttt{bf} or \texttt{sf})}
    The title styles are implemented by creating a new macro
    \cs{__skrapport_title_style:} which will later be used by
    \cs{section} and friends.
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_setup_titles:n#1{
    \str_case:nnF{#1}{
\end{MacroCode}
    \begin{macro*}{\__skrapport_title_style:}
        \changes{0.11a}{Removed incorrect \cs{bfseries}, replaced
                        \cs{relax} with \cs{rmfamily}}
        \changes{0.12d}{Added \texttt{it} option}
\begin{MacroCode}{class}
        {rm}{\cs_new_protected:Nn\__skrapport_title_style:{\rmfamily}}
        {it}{\cs_new_protected:Nn\__skrapport_title_style:{\itshape}}
        {bf}{\cs_new_protected:Nn\__skrapport_title_style:{\bfseries}}
        {sf}{\cs_new_protected:Nn\__skrapport_title_style:{\sffamily}}
\end{MacroCode}
    \end{macro*}
    The fall-back for incorrect parameters is an informational message
    along with setting up for \cs{rmfamily} titles.
\begin{MacroCode}{class}
    }{
        \msg_info:nnnn{skrapport}{invalid-titles}{#1}{rm}
        \__skrapport_setup_titles:n{rm}
    }
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_lang:n}[1]
        {Language (\texttt{sv}, \texttt{en} or \texttt{de})}
    \changes{0.12d}{Use \pkg{babel} mechanisms for language-dependent
        strings, so they work correctly in \env{otherlanguage}}
    Thus far only two language options are implemented, each of them
    setting the other as the \enquote{other} language. We check if
    \pkg{polyglossia} has been loaded (this is done by
    \cs{__skrapport_setup_xelatex:}): if it has, we use the
    \pkg{polyglossia} interface for setting languages, otherwise we
    load the \pkg{babel} package with appropriate options.
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_setup_lang:n#1{
    \str_case:nnF{#1}{
        {sv}{
            \bool_if:NTF\g__skrapport_has_polyglossia_bool{
                \setmainlanguage{swedish}
                \setotherlanguage[variant=british]{english}
            }{
                \RequirePackage[british,swedish]{babel}
            }
\end{MacroCode}
    \begin{macro*}{\__skrapport_RFC_language:}
\begin{MacroCode}{class}
            \cs_gset:Nn\__skrapport_RFC_language:{swe}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
            \PassOptionsToPackage{iso,swedish}{isodate}
        }
        {en}{
            \bool_if:NTF\g__skrapport_has_polyglossia_bool{
                \setmainlanguage[variant=british]{english}
                \setotherlanguage{swedish}
            }{
                \RequirePackage[swedish,british]{babel}
            }
\end{MacroCode}
    \begin{macro*}{\__skrapport_RFC_language:}
\begin{MacroCode}{class}
            \cs_gset:Nn\__skrapport_RFC_language:{eng}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
            \PassOptionsToPackage{iso,british}{isodate}
        }
        {de}{
            \bool_if:NTF\g__skrapport_has_polyglossia_bool{
                \setmainlanguage{ngerman}
                \setotherlanguage[variant=british]{english}
            }{
                \RequirePackage[british,ngerman]{babel}
            }
\end{MacroCode}
    \begin{macro*}{\__skrapport_RFC_language:}
\begin{MacroCode}{class}
            \cs_gset:Nn\__skrapport_RFC_language:{ger}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
            \PassOptionsToPackage{iso,ngerman}{isodate}
        }
    }{
\end{MacroCode}
    Fallback prints an informational message and leaves both \pkg{babel}
    and \pkg{polyglossia} unloaded.
\begin{MacroCode}{class}
        \msg_info:nnn{skrapport}{invalid-lang}{#1}
    }
\end{MacroCode}
    After loading \pkg{babel} or \pkg{polyglossia}, we provide
    translation strings. This is done using the \cs*{addto} and
    \cs*{captions<lang>}, which is compatible with both packages.
    \begin{macro*}{\captionsswedish}
    \changes{0.12e}{Don't redefine standard language strings}
    \begin{macro*}{\dateswedish}
\begin{MacroCode}{class}
    \addto\captionsswedish{
        \cs_gset:Nn\__skrapport_and_word:{och}
        \cs_gset:Nn\__skrapport_Email_word:{E-post}
        \cs_gset:Nn\__skrapport_Comment_word:{Kommentar}
        \cs_gset:Nn\__skrapport_eg_word:{t.ex.}
        \cs_gset:Nn\__skrapport_ie_word:{dvs.}
        \cs_gset:Nn\__skrapport_etc_word:{\emph{etc.}}
        \cs_gset:Nn\__skrapport_cf_word:{jfr.}
        \cs_gset:Nn\__skrapport_viz_word:{dvs.}
    }
    \cs_gset:Npn\dateswedish{
        \cs_gset:Npn\today
            {\int_use:N\year--\int_use:N\month--\int_use:N\day}
    }
\end{MacroCode}
    \end{macro*}
    \end{macro*}
    \begin{macro*}{\captionsbritish}
    \changes{0.12e}{Don't redefine standard language strings}
    \begin{macro*}{\datebritish}
\begin{MacroCode}{class}
    \addto\captionsbritish{
        \cs_gset:Nn\__skrapport_and_word:{and}
        \cs_gset:Nn\__skrapport_Email_word:{Email}
        \cs_gset:Nn\__skrapport_Comment_word:{Comment}
        \cs_gset:Nn\__skrapport_eg_word:{\emph{e.g.}}
        \cs_gset:Nn\__skrapport_ie_word:{\emph{i.e.}}
        \cs_gset:Nn\__skrapport_etc_word:{\emph{etc.}}
        \cs_gset:Nn\__skrapport_cf_word:{\emph{cf.}}
        \cs_gset:Nn\__skrapport_viz_word:{\emph{viz.}}
    }
    \cs_gset:Npn\datebritish{
        \cs_gset:Npn\today
            {\int_use:N\year--\int_use:N\month--\int_use:N\day}
    }
\end{MacroCode}
    \end{macro*}
    \end{macro*}
    \begin{macro*}{\captionsngerman}
    \changes{0.12e}{Don't redefine standard language strings}
    \begin{macro*}{\datengerman}
\begin{MacroCode}{class}
    \addto\captionsngerman{
        \cs_gset:Nn\__skrapport_and_word:{und}
        \cs_gset:Nn\__skrapport_Email_word:{E-Mail}
        \cs_gset:Nn\__skrapport_Comment_word:{Kommentar}
        \cs_gset:Nn\__skrapport_eg_word:{z.~B.}
        \cs_gset:Nn\__skrapport_ie_word:{d.~h.}
        \cs_gset:Nn\__skrapport_etc_word:{usw.}
        \cs_gset:Nn\__skrapport_cf_word:{vgl.}
        \cs_gset:Nn\__skrapport_viz_word:{\emph{viz.}}
    }
    \cs_gset:Npn\datengerman{
        \cs_gset:Npn\today
            {\int_use:N\day.\,\int_use:N\month.\,\int_use:N\year}
    }
\end{MacroCode}
    \end{macro*}
    \end{macro*}
\begin{MacroCode}{class}
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_font:n}[1]
        {Font (\texttt{none}, \texttt{kpfonts}, \texttt{lmodern},
         \texttt{palatino}, \texttt{minion} or \texttt{skdoc})}
    \changes{0.12a}{Drop the post-\pkg{amsmath} hook entirely.
                    Load \pkg{fontspec} in \texttt{word} and
                    \texttt{none}}
    We set up the somewhat involved font stack.
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_setup_font:n#1{
    \PassOptionsToPackage{intlimits}{amsmath}
    \PassOptionsToPackage{full}{textcomp}
    \str_case:nnF{#1}{
\end{MacroCode}
    The \texttt{none} font stack is special. If we're using
    \hologo{XeTeX} or \hologo{LuaTeX}, we load the \pkg{fontspec}
    package. Otherwise, we do nothing.
\begin{MacroCode}{class}
        {none}{
            \bool_if:nT{\luatex_if_engine_p: || \xetex_if_engine_p:}{
                \RequirePackage[quiet]{fontspec}
            }
        }
\end{MacroCode}
    The \texttt{kpfonts} font stack simply loads \pkg{kpfonts}...
\begin{MacroCode}{class}
        {kpfonts}{
            \RequirePackage[easyscsl,intlimits,sumlimits]{kpfonts}
        }
\end{MacroCode}
    ...and the \texttt{lmodern} font stack loads \pkg{lmodern}.
\begin{MacroCode}{class}
        {lmodern}{
            \RequirePackage{lmodern}
        }
\end{MacroCode}
    The \texttt{palatino} font stack loads \pkg{tgpagella} if available,
    but falls back to \pkg{mathpazo} otherwise.
\begin{MacroCode}{class}
        {palatino}{
            \file_if_exist:nTF{tgpagella.sty}{
                \RequirePackage{arev}
                \RequirePackage{pxfonts}
                \RequirePackage{tgpagella}
            }{
                \RequirePackage[osf]{mathpazo}
            }
        }
\end{MacroCode}
    Minion Pro, provided by the \texttt{minion} font stack, loads both
    \pkg{minionpro} (the font) and \pkg{MnSymbol} (appropriate math
    symbols).
\begin{MacroCode}{class}
        {minion}{
            \AtEndOfClass{
                \cs_set_eq:NN\__skrapport_old_vec:\vec
                \cs_undefine:N\vec
                \RequirePackage{MyriadPro}
                \RequirePackage{MinionPro}
                \RequirePackage{MnSymbol}
                \cs_set_eq:NN\vec\__skrapport_old_vec:
            }
        }
\end{MacroCode}
    Finally, the \texttt{skdoc} font stack loads \pkg{PTSerif} and
    \pkg{opensans}, inspired by the style of the \pkg{skdoc} class.
\begin{MacroCode}{class}
        {skdoc}{
            \RequirePackage{PTSerif}
            \RequirePackage[defaultsans,osfigures,scale=0.95]{opensans}
        }
\end{MacroCode}
    The \texttt{word} font stack mimics recent versions of Microsoft
    Word, using Cambria, Consolas and Calibri. This requires a modern
    engine that supports \pkg{fontspec}.
\begin{MacroCode}{class}
        {word}{
            \bool_if:nF{\luatex_if_engine_p: || \xetex_if_engine_p:}{
                \msg_fatal:nnn{skrapport}{font-requires-xetex}{word}
            }
            \RequirePackage[quiet]{fontspec}
            \setmainfont[Ligatures=TeX]{Cambria}
            \setsansfont[Ligatures=TeX]{Calibri}
            \setmonofont[Scale=0.95]{Consolas}
            \apptocmd{\__skrapport_after_ams_hook:}{
                \setmathfont{Cambria Math}
            }{}{}
        }
    }{
\end{MacroCode}
    As a fallback, we print a waning and load no font packages.
\begin{MacroCode}{class}
        \msg_warning:nnn{skrapport}{invalid-font}{#1}
    }
    \str_if_eq:nnF{#1}{none}{
\end{MacroCode}
    All font stacks except \texttt{none} and \texttt{kpfonts} require
    additional packages. Or, rather, \texttt{none} can't load these
    packages by definition, and \texttt{kpfonts} already loads them
    internally \footcite[p.~1]{kpfonts}. They are always useful.

    We also load \pkg{sourcecodepro} as our monospace font.
    But we don't load it when using the \texttt{none} font stack.
\begin{MacroCode}{class}
        \str_if_eq:nnF{#1}{kpfonts}{
            \str_if_eq:nnF{#1}{word}{
                \RequirePackage{sourcecodepro}
            }
            \AtEndOfClass{
                \RequirePackage{amsmath}
\end{MacroCode}
    The \pkg{mnsymbol} package is incompatible with \pkg{amssymb}.
\begin{MacroCode}{class}
              \str_if_eq:nnF{#1}{minion}{
                    \RequirePackage{amssymb}
                }
                \RequirePackage{textcomp}
            }
        }
    }
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_parskip:}
    \changes{0.12a}{Fixed bug where font size reset the \cs{parindent}}
    This part mixes \LaTeXe\ and \LaTeX3, which may not be a good thing.
    On the other hand, it seems hard to avoid. Most of the code is
    half-lifted from \pkg{parskip} and converted to \LaTeX3.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_parskip:{
    \AtEndOfClass{
        \skip_gset:Nn\parskip{0.5\baselineskip~plus~2pt}
        \dim_gzero:N\parindent
        \skip_gset:Nn\parfillskip{30pt~plus~1fil}
\end{MacroCode}
    \begin{macro*}{\@listI}
    \begin{macro*}{\@listi}
\begin{MacroCode}{class}
        \cs_gset:Npn\@listI{
            \dim_set_eq:NN\leftmargin\leftmargini
            \dim_set_eq:NN\parsep\parskip
            \dim_zero:N\topsep
            \dim_zero:N\itemsep
        }
        \cs_gset_eq:NN\@listi\@listI
\end{MacroCode}
    \end{macro*}
    \end{macro*}
\begin{MacroCode}{class}
        \dim_gset_eq:NN\leftmargin\leftmargini
        \dim_gset_eq:NN\parsep\parskip
        \dim_gzero:N\topsep
        \dim_gzero:N\itemsep
\end{MacroCode}
    \begin{macro*}{\@listii}
\begin{MacroCode}{class}
        \cs_gset:Npn\@listii{
            \dim_set_eq:NN\leftmargin\leftmarginii
            \dim_set_eq:NN\labelwidth\leftmarginii
            \dim_set_eq:NN\parsep\parskip
            \dim_sub:Nn\labelwidth{-\labelsep}
            \dim_zero:N\topsep
            \dim_zero:N\itemsep
        }
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\@listiii}
\begin{MacroCode}{class}
        \cs_gset:Npn\@listiii{
            \dim_set_eq:NN\leftmargin\leftmarginiii
            \dim_set_eq:NN\labelwidth\leftmarginiii
            \dim_set_eq:NN\parsep\parskip
            \dim_sub:Nn\labelwidth{-\labelsep}
            \dim_zero:N\topsep
            \dim_zero:N\itemsep
        }
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
        \dim_gzero:N\partopsep
\end{MacroCode}
    \begin{macro*}{\@starttoc}[1]
        {Table of contents extension}
\begin{MacroCode}{class}
        \RenewDocumentCommand\@starttoc{m}{
            \group_begin:
            \dim_zero:N\parskip
            \file_if_exist:nT{\c_job_name_tl.##1}{
                \file_input:n{\c_job_name_tl.##1}
            }
            \if@filesw
                \iow_new:c{tf@##1}
                \iow_open:cn{tf@##1}{\c_job_name_tl.##1}
            \fi
            \@nobreakfalse
            \group_end:
        }
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
    }
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_math:}
    This is the simplest option, only loading \pkg{skmath} if it exists.
    Also the post-skmath hook is run.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_math:{
    \file_if_exist:nT{skmath.sty}{\RequirePackage{skmath}}
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_draft:}
    Setting up the \opt{draft} mode is also fairly easy, as we only need
    wider (wider than \SI{0}{\point}, that is) \cs{overfullrule}s.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_draft:{
    \bool_if:NTF\g__skrapport_draft_bool{
        \dim_gset:Nn\overfullrule{5pt}
    }{
        \msg_log:nnn{skrapport}{noop-call}{\__skrapport_setup_draft:}
        \prg_do_nothing:
    }
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_color:}
    Setting up colors is also fairly easy, as we only have to load the
    \pkg{xcolor} package. All the other color-related code is in other
    places, utilizing the \cs{g__skdoc_color_bool} boolean.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_color:{
    \bool_if:NTF\g__skrapport_color_bool{
        \RequirePackage{xcolor}
        \PassOptionsToPackage{
            labelfont+={bf,color=skrapport@captioncolor}
        }{caption}
    }{
        \msg_log:nnn{skrapport}{noop-call}{\__skrapport_setup_color:}
        \prg_do_nothing:
    }
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\__skrapport_setup_color:n}
    We may also set up a specific color theme using options. This is
    easily done by first calling \cs{__skrapport_setup_color:}, then
    calling \cs{colortheme} at \cs{BeginDocument}.
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_setup_color:n#1{
    \__skrapport_setup_color:
    \bool_if:NTF\g__skrapport_color_bool{
        \AtBeginDocument{\colortheme{#1}}
    }{
        \msg_log:nnn{skrapport}{noop-call}{\__skrapport_setup_color:n}
        \prg_do_nothing:
    }
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_xelatex:}
    \changes{0.12a}{Don't load \pkg{polyglossia} for \hologo{LuaTeX}.
                    Don't load \pkg{fontspec} for any engine}
    \changes{0.12d}{Force \texttt{quiet} option for \pkg{fontspec}}
    This macro contains special setup code for the \hologo{XeTeX} and
    \hologo{LuaTeX} engines, such as providing
    missing commands (which have been replaced by equivalent Unicode
    characters, apparently) and loading \pkg{polyglossia}.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_xelatex:{
    \AtEndOfClass{
        \cs_undefine:N\dblcolon
        \cs_undefine:N\coloneqq
        \cs_undefine:N\Coloneqq
        \cs_undefine:N\eqqcolon
        \RequirePackage{unicode-math}
        \unimathsetup {
            math-style     = ISO,
            bold-style     = ISO,
            sans-style     = italic,
            nabla          = upright,
            partial        = italic,
            vargreek-shape = unicode
        }
    }
\end{MacroCode}
    \begin{macro}{\nobreakspace}
\begin{MacroCode}{class}
    \DeclareDocumentCommand\nobreakspace{}{\leavevmode\nobreak\space}
\end{MacroCode}
    \end{macro}
    Since apparently \hologo{LuaLaTeX} isn't supported by
    \pkg{polyglossia}, we fall back to \pkg{babel} in that engine.
    Thus, only load \pkg{polyglossia} for \hologo{XeLaTeX}.
\begin{MacroCode}{class}
    \xetex_if_engine:TF{
        \PassOptionsToPackage{quiet}{fontspec}
        \RequirePackage{polyglossia}
        \bool_gset_true:N\g__skrapport_has_polyglossia_bool
    }{
        \bool_gset_false:N\g__skrapport_has_polyglossia_bool
    }
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_pdftex:}
    \changes{0.12d}{Load \pkg{isomath}}
    This macro contains special setup code for the \hologo{pdfTeX}
    engine. Currently, it only sets the font encoding to T1.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_pdftex:{
    \RequirePackage[T1]{fontenc}
    \AtEndOfClass{
        \RequirePackage{isomath}
    }
    \bool_gset_false:N\g__skrapport_has_polyglossia_bool
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\__skrapport_setup_engine_specific:}
    This macro detects the current engine and calls the appropriate
    engine setup macro.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_engine_specific:{
    \bool_if:nTF{\luatex_if_engine_p: || \xetex_if_engine_p:}{
        \__skrapport_setup_xelatex:
    }{
        \__skrapport_setup_pdftex:
    }
}
\end{MacroCode}
    \end{macro}

    \paragraph{Variants with expandable arguments}
    Some option setup macros accept arguments, but those arguments are
    not expanded. Here, we provide variants which expand the parameters
    properly using the excellent \pkg{l3prg} functionality.
    \begin{macro}{\__skrapport_setup_ptsize:x}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\__skrapport_setup_ptsize:n{ x }
\end{MacroCode}
    \end{macro}
    \begin{macro}{\__skrapport_setup_titles:x}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\__skrapport_setup_titles:n{ x }
\end{MacroCode}
    \end{macro}
    \begin{macro}{\__skrapport_setup_lang:x}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\__skrapport_setup_lang:n{ x }
\end{MacroCode}
    \end{macro}
    \begin{macro}{\__skrapport_setup_font:x}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\__skrapport_setup_font:n{ x }
\end{MacroCode}
    \end{macro}

    \subsubsection{Key-value system}
    Let's define some \pkg{l3keys} corresponding to the options. Note
    that most of them just refer to a macro in their \texttt{.code:n}
    block --- these macros were defined earlier.
\begin{MacroCode}{class}
\keys_define:nn{skrapport}{
\end{MacroCode}
    \begin{option}{paper}{a4paper, a5paper, a4, a5}
    \changes{0.12}{Values \texttt{a4paper} and \texttt{a5paper} are
                  now deprecated}
    \begin{option}{a4paper}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{a5paper}
    \changes{0.12}{Option is now deprecated}
    Declare the paper size options. Note that having to handle the
    deprecated \texttt{a4paper} and \texttt{a5paper} values of the
    \opt{paper} option makes the code less readable. In a few
    versions, when these options are removed, the code should probably
    be refactored to look something like the \opt{ptsize} option below.
\begin{MacroCode}{class}
    paper .choice:,
    paper / a4 .code:n =
        {\__skrapport_setup_paper:n{a4}},
    paper / a5 .code:n =
        {\__skrapport_setup_paper:n{a5}},
    paper / a4paper .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {paper=a4paper}{paper=a4}
         \keys_set:nn{skrapport}{paper=a4}},
    paper / a5paper .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {paper=a5paper}{paper=a5}
         \keys_set:nn{skrapport}{paper=a4}},
    paper .value_required:,
    a4paper .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {a4paper}{paper=a4}
         \keys_set:nn{skrapport}{paper=a4}},
    a5paper .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {a5paper}{paper=a5}
         \keys_set:nn{skrapport}{paper=a5}},
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{ptsize}{10pt, 11pt, 12pt}
    \begin{option}{10pt}
    \begin{option}{11pt}
    \begin{option}{12pt}
    Declare point size options. Note that we don't deprecate the
    non-\opt{ptsize} aliases as they are much easier to type.
\begin{MacroCode}{class}
    ptsize .choices:nn =
        { 10pt, 11pt, 12pt }
        {\__skrapport_setup_ptsize:x{\tl_use:N\l_keys_choice_tl}},
    ptsize .value_required:,
    10pt .meta:n = {ptsize=10pt},
    11pt .meta:n = {ptsize=11pt},
    12pt .meta:n = {ptsize=12pt},
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{twocolumn}
    \changes{0.08}{Added option \opt{twocolumn}}
    \changes{0.12a}{Use \cs{AtEndOfClass} instead of \cs{AtEndClass}}
    Declare column options. The code here should be run through
    \cs{AtEndOfClass} so that the setup code can patch everythin
    properly.
    \begin{option}{onecolumn}
    \changes{0.12}{Option is now deprecated}
    The \opt{onecolumn} option has no effect and is deprecated.
\begin{MacroCode}{class}
    twocolumn .code:n =
        {\AtEndOfClass{\__skrapport_setup_twocolumn:}},
    onecolumn .code:n =
        {\msg_warning:nnn{skrapport}{option-no-effect}{onecolumn}},
\end{MacroCode}
    \end{option}
    \end{option}

    \begin{option}{draft}{true, false}
    \begin{option}{final}
    Declare \opt{draft} and \opt{final} options. Note that even if the
    \opt{final} option does absolutely nothing, users may expect it to
    be there and as such it is not deprecated.
\begin{MacroCode}{class}
    draft .choice:,
    draft / true .code:n =
        {\bool_gset_true:N\g__skrapport_draft_bool
         \__skrapport_setup_draft:},
    draft / false .code:n =
        {\bool_gset_false:N\g__skrapport_draft_bool},
    draft .default:n = true,
    final .code:n = {\prg_do_nothing:},
\end{MacroCode}
    \end{option}
    \end{option}

    Declare the \opt{fleqn} and \opt{leqno} options, mainly for
    compatibility with the \pkg{article} class.
    \begin{option}{leqno}
\begin{MacroCode}{class}
    leqno .code:n =
        {\__skrapport_setup_leqno:},
\end{MacroCode}
    \end{option}
    \begin{option}{fleqn}
\begin{MacroCode}{class}
    fleqn .code:n =
        {\__skrapport_setup_fleqn:},
\end{MacroCode}
    \end{option}

    \begin{option}{titles}{rm, it, bf, sf}
    Declare options for section titles. The old \opt*{??titles} aliases
    are deprecated and will be removed in a future version.
    \begin{option}{rmtitles}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{bftitles}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{sftitles}
    \changes{0.09}{Added \opt{sftitles} option}
    \changes{0.12}{Option is now deprecated}
\begin{MacroCode}{class}
    titles .choices:nn =
        { rm, it, bf, sf }
        {\__skrapport_setup_titles:x{\tl_use:N\l_keys_choice_tl}},
    titles .value_required:,
    rmtitles .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {rmtitles}{titles=rm}
         \keys_set:nn{skrapport}{titles=rm}},
    bftitles .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {bftitles}{titles=bf}
         \keys_set:nn{skrapport}{titles=bf}},
    sftitles .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {sftitles}{titles=sf}
         \keys_set:nn{skrapport}{titles=sf}},
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{hanging-titles}{true, false}
    \changes{0.12d}{Added option to enable \enquote{hanging} titles}
\begin{MacroCode}{class}
    hanging-titles .bool_gset:N = \g__skrapport_hanging_titles_bool,
    hanging-titles .default:n = true,
    hanging-titles .initial:n = false,
\end{MacroCode}
    \end{option}

    \begin{option}{lang}{sv, en, de}
    \changes{0.12c}{Added option value \texttt{de}}
    \changes{0.12}{Incompatible change: values \texttt{swe} and
                   \texttt{eng} are now \texttt{sv} and \texttt{en},
                   respectively}
    \begin{option}{swe}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{eng}
    \changes{0.12}{Option is now deprecated}
    Declare options for swedish/english \pkg{babel} or
    \pkg{polyglossia} support. Again, the old \opt{swe} and \opt{eng}
    aliases are deprecated and will be removed.
\begin{MacroCode}{class}
    lang .choices:nn =
        { sv, en, de }
        {\__skrapport_setup_lang:x{\tl_use:N\l_keys_choice_tl}},
    lang .value_required:,
    swe .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {swe}{lang=sv}
         \keys_set:nn{skrapport}{lang=sv}},
    eng .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {eng}{lang=en}
         \keys_set:nn{skrapport}{lang=en}},
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{font}{none, kpfonts, lmodern, palatino, minion, skdoc}
    Declare font options. Again, aliases are deprecated.
    \begin{option}{kpfonts}
    \changes{0.07}{Added option \opt{kpfonts}, set as default
                    option for fonts}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{lmodern}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{palatino}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{minion}
    \changes{0.11}{Added option \opt{minion}}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{skdoc}
    \changes{0.11a}{Added option \opt{skdoc}}
    \changes{0.12}{Option is now deprecated}
    \begin{option}{nofont}
    \changes{0.12}{Option is now deprecated}
\begin{MacroCode}{class}
    font .choices:nn =
        { none, kpfonts, lmodern, palatino, minion, skdoc, word }
        {\__skrapport_setup_font:x{\tl_use:N\l_keys_choice_tl}},
    font .value_required:,
    nofont .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {nofont}{font=none}
         \keys_set:nn{skrapport}{font=none}},
    kpfonts .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {kpfonts}{font=kpfonts}
         \keys_set:nn{skrapport}{font=kpfonts}},
    lmodern .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {lmodern}{font=lmodern}
         \keys_set:nn{skrapport}{font=lmodern}},
    palatino .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {palatino}{font=palatino}
         \keys_set:nn{skrapport}{font=palatino}},
    minion .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {minion}{font=minion}
         \keys_set:nn{skrapport}{font=minion}},
    skdoc .code:n =
        {\msg_warning:nnnn{skrapport}{option-deprecated}
            {skdoc}{font=skdoc}
         \keys_set:nn{skrapport}{font=skdoc}},
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}
    \end{option}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{indent}{true, false}
    \changes{0.02}{Added option of indented paragraphs}
    \begin{option}{noindent}
    \changes{0.12}{Option is now deprecated}
    Declare indentation options. Since the \opt{noindent} option
    technically has no effect and is an alias of \opt{indent=false},
    it has been deprecated.
\begin{MacroCode}{class}
    indent .choice:,
    indent / true .code:n = {\prg_do_nothing:},
    indent / false .code:n = {\__skrapport_setup_parskip:},
    indent .default:n = true,
    noindent .code:n =
        {\msg_warning:nnn{skrapport}{option-no-effect}{noindent}},
\end{MacroCode}
    \end{option}
    \end{option}

    \begin{option}{color}{true, false}
    \changes{0.09}{Added \opt{color} option}
    \changes{0.12}{Converted to a key-value option which will load
                   the specified color theme.}
    \begin{option}{nocolor}
    Declare color options. Note that we explicitly set the boolean
    \cs{g__skrapport_color_bool} as well as setting up the colors
    through \cs{__skrapport_setup_color:n}, so that we can keep track
    of the color usage even after the options have been set up.
\begin{MacroCode}{class}
    color .code:n =
        {\str_if_eq:nnTF{#1}{false}
            {\bool_gset_false:N\g__skrapport_color_bool}
            {\bool_gset_true:N\g__skrapport_color_bool
             \str_if_eq:nnTF{#1}{true}
                {\__skrapport_setup_color:n{default}}
                {\__skrapport_setup_color:n{#1}}}},
    color .default:n = true,
    nocolor .meta:n = {color=false},
\end{MacroCode}
    \end{option}
    \end{option}

    \begin{option}{nomath}{true, false}
    \begin{option}{math}
    \changes{0.12}{Option is now deprecated}
    Declare math options. As with the \opt{noindent} option, \opt{math}
    has been deprecated since it is an alias and has no effect.
\begin{MacroCode}{class}
    nomath .choice:,
    nomath / false .code:n = {\__skrapport_setup_math:},
    nomath / true .code:n = {\prg_do_nothing:},
    nomath .default:n = true,
    math .code:n =
        {\msg_warning:nnn{skrapport}{option-no-effect}{math}},
\end{MacroCode}
    \end{option}
    \end{option}

    That's it, we're done setting up the \pkg{l3keys} for the options.
\begin{MacroCode}{class}
}
\end{MacroCode}

    We will now define a \enquote{defaults} key-value system because
    \texttt{.initial:n} doesn't work they way we want it to. This
    key-value system will be used to set flags with which we will
    determine wether to set certain default options.
    \begin{macro}{\__skrapport_setup_defaults:}
    \changes{0.12a}{\texttt{word} font stack is now the default font stack when using \hologo{XeLaTeX}}
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_setup_defaults:{
    \bool_new:N\l__skrapport_has_option_indent_bool
    \bool_new:N\l__skrapport_has_option_nomath_bool
    \bool_new:N\l__skrapport_has_option_color_bool
    \bool_new:N\l__skrapport_has_option_font_bool
    \bool_new:N\l__skrapport_has_option_lang_bool
    \bool_new:N\l__skrapport_has_option_titles_bool
    \bool_new:N\l__skrapport_has_option_draft_bool
    \bool_new:N\l__skrapport_has_option_ptsize_bool
    \bool_new:N\l__skrapport_has_option_paper_bool
    \keys_define:nn{skrapport-default}{
        indent .code:n =
            {\bool_set_true:N\l__skrapport_has_option_indent_bool},
        nomath .code:n =
            {\bool_set_true:N\l__skrapport_has_option_nomath_bool},
        color .code:n =
            {\bool_set_true:N\l__skrapport_has_option_color_bool},
        font .code:n =
            {\bool_set_true:N\l__skrapport_has_option_font_bool},
        lang .code:n =
            {\bool_set_true:N\l__skrapport_has_option_lang_bool},
        titles .code:n =
            {\bool_set_true:N\l__skrapport_has_option_titles_bool},
        draft .code:n =
            {\bool_set_true:N\l__skrapport_has_option_draft_bool},
        ptsize .code:n =
            {\bool_set_true:N\l__skrapport_has_option_ptsize_bool},
        paper .code:n =
            {\bool_set_true:N\l__skrapport_has_option_paper_bool},
\end{MacroCode}
    The following keys correspond to deprecated options. They should
    be removed when the corresponding options are removed.
\begin{MacroCode}{class}
        nofont .code:n =   {\keys_set:nn{skrapport-default}{font}},
        kpfonts .code:n =  {\keys_set:nn{skrapport-default}{font}},
        lmodern .code:n =  {\keys_set:nn{skrapport-default}{font}},
        palatino .code:n = {\keys_set:nn{skrapport-default}{font}},
        minion .code:n =   {\keys_set:nn{skrapport-default}{font}},
        skdoc .code:n =    {\keys_set:nn{skrapport-default}{font}},
        swe .code:n =      {\keys_set:nn{skrapport-default}{lang}},
        eng .code:n =      {\keys_set:nn{skrapport-default}{lang}},
        rmtitles .code:n = {\keys_set:nn{skrapport-default}{titles}},
        bftitles .code:n = {\keys_set:nn{skrapport-default}{titles}},
        sftitles .code:n = {\keys_set:nn{skrapport-default}{titles}},
        10pt .code:n =     {\keys_set:nn{skrapport-default}{ptsize}},
        11pt .code:n =     {\keys_set:nn{skrapport-default}{ptsize}},
        12pt .code:n =     {\keys_set:nn{skrapport-default}{ptsize}},
        a4paper .code:n =  {\keys_set:nn{skrapport-default}{paper}},
        a5paper .code:n =  {\keys_set:nn{skrapport-default}{paper}},
\end{MacroCode}
\begin{MacroCode}{class}
    }
    \ProcessKeysOptions{skrapport-default}
    \bool_if:NF\l__skrapport_has_option_indent_bool{
        \keys_set:nn{skrapport}{indent=false}
    }
    \bool_if:NF\l__skrapport_has_option_nomath_bool{
        \keys_set:nn{skrapport}{nomath=false}
    }
    \bool_if:NF\l__skrapport_has_option_color_bool{
        \keys_set:nn{skrapport}{color=true}
    }
    \bool_if:NF\l__skrapport_has_option_font_bool{
        \xetex_if_engine:TF{
            \keys_set:nn{skrapport}{font=word}
        }{
            \keys_set:nn{skrapport}{font=kpfonts}
        }
    }
    \bool_if:NF\l__skrapport_has_option_lang_bool{
        \keys_set:nn{skrapport}{lang=sv}
    }
    \bool_if:NF\l__skrapport_has_option_titles_bool{
        \keys_set:nn{skrapport}{titles=bf}
    }
    \bool_if:NF\l__skrapport_has_option_draft_bool{
        \keys_set:nn{skrapport}{draft=false}
    }
    \bool_if:NF\l__skrapport_has_option_ptsize_bool{
        \keys_set:nn{skrapport}{ptsize=11pt}
    }
    \bool_if:NF\l__skrapport_has_option_paper_bool{
        \keys_set:nn{skrapport}{paper=a4}
    }
}
\end{MacroCode}
    \end{macro}

    Finally, we process the class options using the keys defined earlier.
    We also run the engine-specific code implemented above, and the fake
    key system used to define defaults.

    Note that we save and restore \cs{@classoptionslist} around the
    engine-specific setup. This is because we might load \pkg{xkeyval},
    which apparently removes all key-value options from the list when
    loaded (and this is really bad for us).
\begin{MacroCode}{class}
\cs_set_eq:NN\__skrapport_tmpa_cs:\@classoptionslist
\RequirePackage{xkeyval}
\cs_set_eq:NN\__skrapport_tmpb_cs:\@classoptionslist
\cs_set_eq:NN\@classoptionslist\__skrapport_tmpa_cs:
\__skrapport_setup_engine_specific:
\ProcessKeysOptions{skrapport}
\__skrapport_setup_defaults:
\cs_set_eq:NN\@classoptionslist\__skrapport_tmpb_cs:
\cs_undefine:N\__skrapport_tmpa_cs:
\cs_undefine:N\__skrapport_tmpb_cs:
\end{MacroCode}

    \subsection{Required packages}
    We also include some essential packages per default. The
    \pkg{calc} package, for instance, is essential in later
    definitions.
\begin{MacroCode}{class}
\RequirePackage{calc,isodate,multicol}
\end{MacroCode}

    At the end of the class definition we load a very
    useful package that improves typesetting: \pkg{microtype}.
    Also set \cs{frenchspacing}.
\begin{MacroCode}{class}
\AtEndOfClass{
    \RequirePackage{microtype}
    \frenchspacing
}
\end{MacroCode}

    When the document starts, we set the URL style if the user has
    loaded the \pkg{url} package.
\begin{MacroCode}{class}
\AtBeginDocument{
    \cs_if_exist:NT\urlstyle{\urlstyle{same}}
}
\end{MacroCode}

    \subsection{Utilities}
    We define useful \LaTeX3 replacements of \LaTeXe\ stuff that
    hasn't made its way into \pkg{interface3}. This includes
    a \cs{settowidth} clone and possibly more stuff later.
    \begin{macro}{\dim_set_to_wd:Nn}
\begin{MacroCode}{class}
\cs_new:Npn\dim_set_to_wd:Nn#1#2{
    \hbox_set:Nn\l_tmpa_box{#2}
    \dim_set:Nn#1{\box_wd:N\l_tmpa_box}
    \box_clear:N\l_tmpa_box
}
\end{MacroCode}
    \end{macro}

    \subsection{Hidden things}
    Set some default measurements (should probably be replaced with
    simply loading \pkg{typearea}).
\begin{MacroCode}{class}
\dim_add:Nn\textwidth{0.5\oddsidemargin}
\dim_add:Nn\textwidth{0.5\evensidemargin}
\dim_add:Nn\oddsidemargin{-0.5\oddsidemargin}
\dim_add:Nn\evensidemargin{-0.5\evensidemargin}
\dim_gset:Nn\lineskip{1pt}
\dim_gset:Nn\normallineskip{1pt}
\end{MacroCode}
    \begin{macro}{\baselinestretch}
    Note that we can't use \cs{RenewDocumentCommand} as that yields an
    infinite loop before or at \env{document}.
\begin{MacroCode}{class}
\cs_set:Npn\baselinestretch{}
\end{MacroCode}
    \end{macro}

    \subsubsection{Penalties}
\begin{MacroCode}{class}
\int_gset:Nn\@lowpenalty  {51}
\int_gset:Nn\@medpenalty {151}
\int_gset:Nn\@highpenalty{301}
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{1}
\setcounter{totalnumber}{4}
\setcounter{dbltopnumber}{2}
\end{MacroCode}
    \begin{macro}{\topfraction}
\begin{MacroCode}{class}
\RenewDocumentCommand\topfraction{}{.75}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\bottomfraction}
\begin{MacroCode}{class}
\RenewDocumentCommand\bottomfraction{}{.5}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\textfraction}
\begin{MacroCode}{class}
\RenewDocumentCommand\textfraction{}{.25}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\floatpagefraction}
\begin{MacroCode}{class}
\RenewDocumentCommand\floatpagefraction{}{.625}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\dbltopfraction}
\begin{MacroCode}{class}
\RenewDocumentCommand\dbltopfraction{}{.75}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\dblfloatpagefraction}
\begin{MacroCode}{class}
\RenewDocumentCommand\dblfloatpagefraction{}{.625}
\end{MacroCode}
    \end{macro}

    \subsection{User-level commands and environments}
    \subsubsection{The front page}
    \begin{macro}{\title}[1]
        {Title of the document}
    \begin{macro*}{\g__skrapport_title_tl}
\begin{MacroCode}{class}
\tl_new:N\g__skrapport_title_tl
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\title{m}{
    \tl_gset:Nn\g__skrapport_title_tl{#1}
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\date}[1]
        {Date in ISO8601 format}
    The \cs{date} macro sets the current date of the document. It only
    accepts dates accepted by \pkg{isodate} (or the special value
    \enquote{\texttt{today}}). Dates are always printed using the
    current format as specified by the \pkg{isodate} package. The default
    value of the date (if \cs{date} isn't used) is \cs{today}.
    \begin{macro*}{\g__skrapport_title_tl}
\begin{MacroCode}{class}
\tl_new:N\g__skrapport_date_tl
\tl_gset:Nn\g__skrapport_date_tl{\today}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\date{m}{
    \str_if_eq:nnTF{#1}{today}{
        \tl_gset:Nn\g__skrapport_date_tl{\today}
    }{
        \if_meaning:w \today #1
            \tl_gset:Nn\g__skrapport_date_tl{\today}
        \else:
            \tl_gset:Nn\g__skrapport_date_tl{\printdate{#1}}
        \fi:
    }
}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\author}[2]
        {Optional email address}
        {Author name}
    \changes{0.10b}{Improved \cs{author} macro}
    \changes{0.12}{Use comma-separated lists instead of token list}
    The \cs{author} macro is redefined to accept an optional argument
    and to be used multiple times.
    \begin{macro*}{\__skrapport_email:n}[1]
        {Email address}
    \changes{0.12a}{Store \cs{textemdash} instead of \cs{NoValue}}
    The \cs{skrapport@email} helper macro typesets an email address
    using \pkg{hyperref} if that package is used. This is suboptimal,
    the macro behaves differently with respect to special characters
    depending on wether \pkg{hyperref} is loaded or not.
\begin{MacroCode}{class}
\cs_new_nopar:Npn\__skrapport_email:n#1{
    \texttt{#1}
}
\AtBeginDocument{
    \cs_if_exist:NT\href{
        \cs_gset_nopar:Npn\__skrapport_email:n#1{
            \href{mailto:#1}{\nolinkurl{#1}}
        }
    }
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\g__skrapport_author_clist}
\begin{MacroCode}{class}
\clist_new:N\g__skrapport_author_clist
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\g__skrapport_email_clist}
\begin{MacroCode}{class}
\clist_new:N\g__skrapport_email_clist
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\author{om}{%
    \clist_gput_right:Nn\g__skrapport_author_clist{#2}
    \clist_gput_right:Nn\g__skrapport_email_clist
        {\IfNoValueTF{#1}{\textemdash}{#1}}
}
\end{MacroCode}
    \begin{macro}{\__skrapport_author_list:}
    \changes{0.12a}{Use \cs{clist_use:Nnnn}}
    This macro lists all the authors in the comma-separated list
    \cs{g__skrapport_author_clist}, separating them with a comma
    or the word \enquote{and} (in the appropriate language).
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_author_list:{
    \clist_use:Nnnn\g__skrapport_author_clist
        {~\__skrapport_and_word:{}~}{,~}{~\__skrapport_and_word:{}~}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\__skrapport_email_list:}
    \changes{0.12a}{Use \cs{clist_use:Nnnn}}
    This macro lists the email addresses in the comma-separated list
    \cs{g__skrapport_email_clist} by applying \cs{__skrapport_email:}
    if appropriate (or printing an em-dash if no value exists) and
    separating them with commas.
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_email_list:{
    \int_compare:nT{\clist_count:N\g__skrapport_author_clist>\c_zero}{
        \clist_use:Nnnn\g__skrapport_email_clist{\\}{\\}{\\}
    }
}
\end{MacroCode}
    \end{macro}
    \end{macro}

    \begin{macro}{\regarding}[1]
        {Text snippet}
    This macro defines a variable used by \cs{maketitle} to insert a
    simple text into the header on the title page.
    \begin{macro*}{\g__skrapport_regarding_tl}
\begin{MacroCode}{class}
\tl_new:N\g__skrapport_regarding_tl
\DeclareDocumentCommand\regarding{m}{
    \tl_gset:Nn\g__skrapport_regarding_tl{#1}
}
\end{MacroCode}
    \end{macro*}
    \end{macro}

    \begin{macro}{\license}[1]
        {Short license description}
    \changes{0.07}{Added command \cs{license}}
    This macro defines a variable used by \cs{maketitle} to insert a
    license into the footer on the titlepage.
    \begin{macro*}{\g__skrapport_copyright_unprinted_bool}
\begin{MacroCode}{class}
\bool_new:N\g__skrapport_copyright_unprinted_bool
\AtEndDocument{
    \bool_if:NT\g__skrapport_copyright_unprinted_bool
        {\msg_warning:nn{skrapport}{license-not-printed}}
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\g__skrapport_copyright_tl}
\begin{MacroCode}{class}
\tl_new:N\g__skrapport_copyright_tl
\DeclareDocumentCommand\license{m}{
    \tl_gset:Nn\g__skrapport_copyright_tl{#1}
    \bool_gset_true:N\g__skrapport_copyright_unprinted_bool
}
\end{MacroCode}
    \end{macro*}
    \end{macro}

    \begin{macro}{\maketitle}[1]
        {Optional key-value list}
    \changes{0.12a}{Added optional key-value argument and PDFinfo}
    The standard \cs{maketitle} command as taken from the \pkg{article}
    class but with some basic restyling.
\begin{MacroCode}{class}
\keys_define:nn{skrapport/maketitle}{
    hide .clist_set:N = \l__skrapport_maketitle_hide_clist,
    hide .value_required:,
    nopdfinfo .bool_set_inverse:N = \l__skrapport_maketitle_pdfinfo_bool,
    nopdfinfo .default:n = true,
    nopdfinfo .initial:n = false
}
\end{MacroCode}
    \begin{macro*}{\__skrapport_smallprint_style:}
\begin{MacroCode}{class}
\cs_new_protected:Nn\__skrapport_smallprint_style:{}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\__skrapport_abstract_style:}
\begin{MacroCode}{class}
\cs_new_protected:Nn\__skrapport_abstract_style:
    {\__skrapport_title_style:}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\maketitle{o}{
    \clist_clear:N\l__skrapport_maketitle_hide_clist
    \IfNoValueF{#1}{\keys_set:nn{skrapport/maketitle}{#1}}
    \bool_if:NT\l__skrapport_maketitle_pdfinfo_bool{
        \exp_args:NNx\cs_if_exist_use:NT\hypersetup{{
            pdfinfo={
                Title={\tl_use:N\g__skrapport_title_tl},
                Subject={\tl_use:N\g__skrapport_regarding_tl},
                Author={
                    \clist_use:Nnnn\g__skrapport_author_clist{,~}{,~}{,~}
                },
                Lang={\__skrapport_RFC_language:}
            }
        }}
    }
    \par
    \group_begin:
        \RenewDocumentCommand\thefootnote{}{
            \fnsymbol{footnote}
        }
        \RenewDocumentCommand\@makefnmark{}{
            \hbox_overlap_right:n{
                \@textsuperscript{\normalfont\@thefnmark}
            }
        }
        \RenewDocumentCommand\@makefntext{m+}{
            \dim_set:Nn\parindent{1em}\noindent
            \hbox_to_wd:nn{1.8em}{
                \hss\@textsuperscript{\normalfont\@thefnmark}
            }
            ##1
        }
        \newpage
        \int_gzero:N\@topnum
        \__skrapport_maketitle:
        \thispagestyle{plain}
    \group_end:
    \setcounter{footnote}{0}
}
\end{MacroCode}
    \end{macro}
    \begin{macro*}{\__skrapport_maketitle:}
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_maketitle:{
    \newpage
    \hbox:n{}
    \begin{flushleft}
        \vspace{-\headsep}
        \clist_if_in:NnF\l__skrapport_maketitle_hide_clist{regarding}{
            \small\__skrapport_smallprint_style:
            \tl_use:N\g__skrapport_regarding_tl
            \clist_if_in:NnF\l__skrapport_maketitle_hide_clist{date}{
                \tl_if_empty:NF\g__skrapport_regarding_tl{,~}
            }
        }
        \clist_if_in:NnF\l__skrapport_maketitle_hide_clist{date}{
            \tl_use:N\g__skrapport_date_tl
        }
        \clist_if_in:NnTF\l__skrapport_maketitle_hide_clist{regarding}{
            \clist_if_in:NnTF\l__skrapport_maketitle_hide_clist{date}
                {}{\par}
        }{\par}
        \vspace{1.5cm}
        {
            \Huge\__skrapport_title_style:
            \tl_use:N\g__skrapport_title_tl
            \par
        }
        \vspace{.125cm}
        {
            \Large\__skrapport_title_style:
            \__skrapport_author_list:
        }
        \vspace{.75cm}
    \end{flushleft}
    \par
    \clist_if_in:NnF\l__skrapport_maketitle_hide_clist{email}{
        \dim_set_to_abstract_or_email_wd:N\l_tmpa_dim
        \bool_gset_false:N\g__skrapport_abstract_used
        \dim_set:Nn\l_tmpb_dim
            {\textwidth-\l_tmpa_dim-\c__skrapport_abstract_separator_dim}
        \begin{minipage}[t]{\l_tmpa_dim}
            \begin{flushright}
                \leavevmode\__skrapport_abstract_style:
                \__skrapport_Email_word:
            \end{flushright}
        \end{minipage}
        \hspace{\c__skrapport_abstract_separator_dim}
        \begin{minipage}[t]{\l_tmpb_dim}
            \__skrapport_email_list:
        \end{minipage}
        \par
    }
}
\end{MacroCode}
    \end{macro*}

    \begin{macro*}{\g__skrapport_abstract_used}
    This boolean keeps track of wether the \env{abstract} environment has
    been used, and is set accordingly in the main auxillary file.
\begin{MacroCode}{class}
\bool_new:N\g__skrapport_abstract_used
\AtEndDocument{
    \iow_shipout:Nx\@mainaux{ % !!!
        \exp_not:N\ExplSyntaxOn
        \bool_if:NTF\g__skrapport_abstract_used
            {\exp_not:n{\bool_gset_true:N\g__skrapport_abstract_used}}
            {\exp_not:n{\bool_gset_false:N\g__skrapport_abstract_used}}
        \exp_not:N\ExplSyntaxOff
    }
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\dim_set_to_abstract_or_email_wd:N}[1]
        {Dimension register}
    \changes{0.12a}{Set abstract style before word to fix incorrect width}
    This macro sets a dimension to either the width of the email word
    or the width of the abstract word depending on the state of
    \cs{g__skrapport_abstract_used}.
\begin{MacroCode}{class}
\cs_new:Npn\dim_set_to_abstract_or_email_wd:N#1{
    \dim_set_to_wd:Nn\l_tmpa_dim
        {\__skrapport_abstract_style:\abstractname}
    \dim_set_to_wd:Nn\l_tmpb_dim
        {\__skrapport_abstract_style:\__skrapport_Email_word:}
    \bool_if:NTF\g__skrapport_abstract_used
        {\dim_set:Nn#1{\dim_max:nn{\l_tmpa_dim}{\l_tmpb_dim}}}
        {\dim_set_eq:NN#1\l_tmpb_dim}
}
\end{MacroCode}
    \end{macro*}

    \begin{environment}{abstract}
    Standard restyled \env{abstract} environment from the
    \pkg{article} class.
\begin{MacroCode}{class}
\dim_const:Nn\c__skrapport_abstract_separator_dim{1em}
\DeclareDocumentEnvironment{abstract}{}{
    \bool_gset_true:N\g__skrapport_abstract_used
    \dim_set_to_abstract_or_email_wd:N\l_tmpa_dim
    \dim_set:Nn\l_tmpb_dim
        {\textwidth-\l_tmpa_dim-\c__skrapport_abstract_separator_dim}
    \begin{minipage}[t]{\l_tmpa_dim}
        \begin{flushright}
            \leavevmode\__skrapport_abstract_style:
            \abstractname
        \end{flushright}
    \end{minipage}
    \hspace{\c__skrapport_abstract_separator_dim}
    \begin{minipage}[t]{\l_tmpb_dim}
}{
    \end{minipage}
}
\end{MacroCode}
    \end{environment}

    \begin{environment}{titlepage}
    Titlepage environment.
    \begin{macro}{\ps@skrapport@titlepage}
\begin{MacroCode}{class}
\cs_new:Npn\ps@skrapport@titlepage{
    \cs_set:Npn\@oddhead{}
    \cs_set:Npn\@evenhead{}
    \cs_set:Npn\@oddfoot{
        \begin{minipage}{\textwidth}
            \raggedleft\small\par
            \__skrapport_smallprint_style:
            \tl_use:N\g__skrapport_copyright_tl
        \end{minipage}
    }
    \cs_set_eq:NN\@evenfoot\@oddfoot
}
\end{MacroCode}
    \end{macro}
\begin{MacroCode}{class}
\DeclareDocumentEnvironment{titlepage}{}{
    \cleardoublepage\setcounter{page}{1}
}{
    \bool_gset_false:N\g__skrapport_copyright_unprinted_bool
    \thispagestyle{skrapport@titlepage}
    \cleardoublepage\setcounter{page}{1}
}
\end{MacroCode}
    \end{environment}

    \subsubsection{Sectioning}
    Sectioning macros. This is kind of messy. We start with creaiting
    some counters using our homemade \LaTeX3 counter macros.
\begin{MacroCode}{class}
\setcounter{secnumdepth}{3}
\newcounter{section}
\newcounter{subsection}[section]
\newcounter{subsubsection}[subsection]
\newcounter{paragraph}[subsubsection]
\newcounter{subparagraph}[paragraph]
\end{MacroCode}
    Next up, we have macros to display the section numberings.
    \begin{macro*}{\thesection}
\begin{MacroCode}{class}
\cs_gset:Npn\thesection{
    \arabic{section}
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\thesubsection}
\begin{MacroCode}{class}
\cs_gset:Npn\thesubsection{
    \thesection.\arabic{subsection}
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\thesubsubsection}
\begin{MacroCode}{class}
\cs_gset:Npn\thesubsubsection{
    \thesubsection.\arabic{subsubsection}
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\theparagraph}
\begin{MacroCode}{class}
\cs_gset:Npn\theparagraph{
    \thesubsubsection.\arabic{paragraph}
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\thesubparagraph}
\begin{MacroCode}{class}
\cs_gset:Npn\thesubparagraph{
    \theparagraph.\arabic{subparagraph}
}
\end{MacroCode}
    \end{macro*}

    \paragraph{Pre- and post-section spacing}
    Here comes the tricky part. We define two generic macros that add
    spacing before and after the section title, to condense the code
    a bit. Note that many of the following macros constitute a
    reimplementation of \cs{@startsection}, \cs{@ssect}, \cs{@sect} and
    friends.
    \begin{macro}{\__skrapport_pre_section:n}[1]
        {Skip before the section title}
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_pre_section:n#1{
    \leavevmode\par
    \skip_set:Nn\l_tmpa_skip{#1}
    \@afterindenttrue % !!!
    \dim_compare:nT{\l_tmpa_skip<\c_zero_skip}{
        \skip_set:Nn\l_tmpa_skip{-\l_tmpa_skip}
        \@afterindentfalse % !!!
    }
    \if@nobreak \everypar{} \else
        \addpenalty\@secpenalty % !!!
        \skip_vertical:N\l_tmpa_skip
    \fi
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\__skrapport_post_section:n}[1]
        {Space after the section title}
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_post_section:n#1{
    \skip_set:Nn\l_tmpa_skip{#1}
    \dim_compare:nTF{\l_tmpa_skip>\c_zero_skip}{
        \par\nobreak
        \skip_vertical:N\l_tmpa_skip
        \@afterheading % !!!
    }{
        \@nobreakfalse
        \global\@noskipsectrue
        \skip_horizontal:n{-\l_tmpa_skip}
    }
    \ignorespaces
}
\end{MacroCode}
    \end{macro}

    \paragraph{Starred sections}
    These two macros (the first only being an alias for the second with
    its last argument empty) correspond to unnumbered sections. Or,
    rather, they do all the typesetting and none of the TOC/counter
    stuff. This means that starred sections only call this macro, while
    unstarred ones call other macros in addition to this macro.
    \begin{macro*}{\__skrapport_section_star:nnn}
    \begin{macro}{\__skrapport_section_star:nnnn}[4]
        {Indentation of section title}
        {Styling of the section title}
        {Actual section title}
        {Optional code to run in the indentation (\emph{i.e.} section number)}
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_section_star:nnn#1#2#3{
    \__skrapport_section_star:nnnn{#1}{#2}{#3}{}
}
\cs_new:Npn\__skrapport_section_star:nnnn#1#2#3#4{
    \group_begin:
        #2
        \hbox_set:Nn\l_tmpa_box{{\skip_horizontal:n{#1}#4}}
        \dim_set:Nn\hangindent{#1+\box_wd:N\l_tmpa_box}
        \noindent\box_use_clear:N\l_tmpa_box
        \interlinepenalty\@M % !!!
        #3
    \group_end:
}
\end{MacroCode}
    \end{macro}
    \end{macro*}

    \paragraph{Unstarred sections}
    This macro typesets an unstarred section, \emph{i.e.} a numbered
    one. It defines a temporary macro containing the section number
    (maybe, depends on the \cs{c@secnumdepth} counter) which it passes
    on to \cs{__skrapport_section_star:nnnn}, and then writes some things
    to the TOC.
    \begin{macro}{\__skrapport_section_nostar:nnnnnn}[6]
        {Section counter name}
        {Section level}
        {Indentation of section title}
        {Styling of the section title}
        {Actual section title}
        {Section title for TOC}
    \changes{0.12d}{Added support for hanging titles}
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_section_nostar:nnnnnn#1#2#3#4#5#6{
    \cs_set:Nn\__skrapport_saved_section:{}
    \int_compare:nF{#2>\value{secnumdepth}}{
        \refstepcounter{#1}
        \cs_set:Nn\__skrapport_saved_section:{
            \bool_if:NTF\g__skrapport_hanging_titles_bool
                {\llap{\use:c{the#1}\hspace{1ex}}}
                {\use:c{the#1}~}
        }
    }
    \__skrapport_section_star:nnnn
        {#3}{#4}{#5}{\__skrapport_saved_section:}
    \use:c{#1mark}{#6}
    \addcontentsline{toc}{#1}{
        \int_compare:nF{#2>\value{secnumdepth}}{
            \protect\numberline{\use:c{the#1}}
        }
        #6
    }
}
\end{MacroCode}
    \end{macro}

    \paragraph{Generic sectioning macros}
    We will now set up a generic sectioning macro. First, we need
    version of the above macros that expand their arguments.
    \begin{macro*}{\__skrapport_pre_section:c}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\__skrapport_pre_section:n{c}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\__skrapport_post_section:c}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\__skrapport_post_section:n{c}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\__skrapport_section_star:ccn}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\__skrapport_section_star:nnn{ccn}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\__skrapport_section_nostar:nnccnn}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\__skrapport_section_nostar:nnnnnn{nnccnn}
\end{MacroCode}
    \end{macro*}

    Now, the generic sectioning macro basically takes the sectioning
    macro arguments straight up (arguments 3--5), additionally
    requiring a section counter name and a section level. It expects
    that constant dimensions (see definition of \cs{section} below)
    and a formatting macro are available, and passes these as arguments
    to the underlying sectioning macros as appropriate.
    \begin{macro}{\__skrapport_generic_section:nnnnn}[5]
        {Section counter name}
        {Section level}
        {Star (tested with \cs{IfBooleanTF})}
        {Optional argument (or \cs{NoValue})}
        {Section title text}
\begin{MacroCode}{class}
\cs_set:Nn\__skrapport_generic_section:nnnnn{
    \__skrapport_pre_section:c{c__skrapport_#1_pre_skip}
    \IfBooleanTF#3{
        \__skrapport_section_star:ccn
            {c__skrapport_#1_indent_dim}
            {__skrapport_#1_style:}
            {#5}
    }{
        \IfNoValueTF{#4}{
            \__skrapport_section_nostar:nnccnn
                {#1}{#2}
                {c__skrapport_#1_indent_dim}
                {__skrapport_#1_style:}
                {#5}
                {#5}
        }{
            \__skrapport_section_nostar:nnccnn
                {#1}{#2}
                {c__skrapport_#1_indent_dim}
                {__skrapport_#1_style:}
                {#5}
                {#4}
        }
    }
    \__skrapport_post_section:c{c__skrapport_#1_post_skip}
}
\end{MacroCode}
    \end{macro}

    \paragraph{Public sectioning API}
    It's time to define the public sectioning macros. They all follow
    the same format: first, two skips and one dimension (used by
    \cs{__skrapport_generic_section:nnnnn}) are defined, as well as
    a macro defining the text style of the section. Then, the actual
    macro is provided.
    \begin{macro}{\section}[3]
        {Star (tested with \cs{IfBooleanTF})}
        {Optional short title (or \cs{NoValue})}
        {Sectioning title}
    \begin{macro*}{\c__skrapport_section_pre_skip}
    This is the skip \emph{before} a section title.
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_section_pre_skip{-4ex~plus~1ex~minus~-1ex}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_section_post_skip}
    This is the skip \emph{after} a section title.
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_section_post_skip{.5ex~plus~.5ex}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_section_indent_dim}
    This is the \emph{indentation} of a section title.
\begin{MacroCode}{class}
\dim_const:Nn \c__skrapport_section_indent_dim{\c_zero_dim}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_section_style:}
    This is the text style of a section title.
\begin{MacroCode}{class}
\cs_set_protected:Nn\__skrapport_section_style:
    {\normalfont\LARGE\__skrapport_title_style:}
\end{MacroCode}
    \end{macro*}
    Finally, the public macro is provided.
\begin{MacroCode}{class}
\DeclareDocumentCommand\section{som}{
    \__skrapport_generic_section:nnnnn{section}{1}{#1}{#2}{#3}
}
\end{MacroCode}
    \end{macro}

    The other sectioning macros (macros from section to subparagraph are
    available) are defined in an analogous manner.
    \begin{macro}{\subsection}[3]
        {Star (tested with \cs{IfBooleanTF})}
        {Optional short title (or \cs{NoValue})}
        {Sectioning title}
    \begin{macro*}{\c__skrapport_subsection_pre_skip}
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_subsection_pre_skip{-3ex~plus~1ex~minus~-1ex}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subsection_post_skip}
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_subsection_post_skip{.25ex~plus~.25ex}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subsection_indent_dim}
\begin{MacroCode}{class}
\dim_const:Nn \c__skrapport_subsection_indent_dim{\c_zero_dim}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subsection_style:}
\begin{MacroCode}{class}
\cs_set_protected:Nn\__skrapport_subsection_style:
    {\normalfont\Large\__skrapport_title_style:}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\subsection{som}{
    \__skrapport_generic_section:nnnnn{subsection}{2}{#1}{#2}{#3}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\subsubsection}[3]
        {Star (tested with \cs{IfBooleanTF})}
        {Optional short title (or \cs{NoValue})}
        {Sectioning title}
    \begin{macro*}{\c__skrapport_subsubsection_pre_skip}
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_subsubsection_pre_skip{-2ex~plus~.5ex~minus~-.5ex}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subsubsection_post_skip}
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_subsubsection_post_skip{.125ex~plus~.125ex}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subsubsection_indent_dim}
\begin{MacroCode}{class}
\dim_const:Nn \c__skrapport_subsubsection_indent_dim{\c_zero_dim}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subsubsection_style:}
\begin{MacroCode}{class}
\cs_set_protected:Nn\__skrapport_subsubsection_style:
    {\normalfont\large\__skrapport_title_style:}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\subsubsection{som}{
    \__skrapport_generic_section:nnnnn{subsubsection}{3}{#1}{#2}{#3}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\paragraph}[3]
        {Star (tested with \cs{IfBooleanTF})}
        {Optional short title (or \cs{NoValue})}
        {Sectioning title}
    \begin{macro*}{\c__skrapport_paragraph_pre_skip}
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_paragraph_pre_skip{1ex~plus~.25ex~minus~-.25ex}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_paragraph_post_skip}
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_paragraph_post_skip{-1em}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_paragraph_indent_dim}
\begin{MacroCode}{class}
\dim_const:Nn \c__skrapport_paragraph_indent_dim{\c_zero_dim}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_paragraph_style:}
\begin{MacroCode}{class}
\cs_set_protected:Nn\__skrapport_paragraph_style:
    {\normalfont\normalsize\__skrapport_title_style:}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\paragraph{som}{
    \__skrapport_generic_section:nnnnn{paragraph}{4}{#1}{#2}{#3}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\subparagraph}[3]
        {Star (tested with \cs{IfBooleanTF})}
        {Optional short title (or \cs{NoValue})}
        {Sectioning title}
    \begin{macro*}{\c__skrapport_subparagraph_pre_skip}
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_subparagraph_pre_skip{1ex~plus~.25ex~minus~-.25ex}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subparagraph_post_skip}
\begin{MacroCode}{class}
\skip_const:Nn\c__skrapport_subparagraph_post_skip{-1em}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subparagraph_indent_dim}
\begin{MacroCode}{class}
\dim_const:Nn \c__skrapport_subparagraph_indent_dim{\parindent}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\c__skrapport_subparagraph_style:}
\begin{MacroCode}{class}
\cs_set_protected:Nn\__skrapport_subparagraph_style:
    {\normalfont\normalsize\__skrapport_title_style:\itshape}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\subparagraph{som}{
    \__skrapport_generic_section:nnnnn{subparagraph}{5}{#1}{#2}{#3}
}
\end{MacroCode}
    \end{macro}

    \subsubsection{Macros and environments from \pkg{article}}
    \paragraph{List environments}
    First, several dimensions are provided and three penalties defined.
\begin{MacroCode}{class}
\dim_gset:Nn\leftmargini{2em}
\dim_gset_eq:NN\leftmargin\leftmargini
\dim_gset:Nn\leftmarginii{2em}
\dim_gset:Nn\leftmarginiii{1.5em}
\dim_gset:Nn\leftmarginiv{1.5em}
\dim_gset:Nn\leftmarginv{1em}
\dim_gset:Nn\leftmarginvi{1em}
\dim_gset:Nn\labelsep{.5em}
\dim_gset_eq:NN\labelwidth\leftmargini
\dim_gsub:Nn\labelwidth{-\labelsep}
\int_gset:Nn\@beginparpenalty{-\@lowpenalty}
\int_gset:Nn\@endparpenalty  {-\@lowpenalty}
\int_gset:Nn\@itempenalty    {-\@lowpenalty}
\end{MacroCode}

    Then, we define the appearance of the item numbers.
    \begin{macro*}{\theenumi}
    The first level consists of arabic numbers (\(1,2,3,\dotsc\)).
\begin{MacroCode}{class}
\cs_set:Npn\theenumi  {\arabic{enumi}}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\theenumii}
    The second level consists of lower-case alphabetic characters
    (\(\text{a},\text{b},\text{c},\dotsc\)).
\begin{MacroCode}{class}
\cs_set:Npn\theenumii {\alph{enumii}}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\theenumiii}
    The third level consists of lower-case roman numerals
    (\(\text{i},\text{ii},\text{iii},\dotsc\)).
\begin{MacroCode}{class}
\cs_set:Npn\theenumiii{\roman{enumiii}}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\theenumiv}
    The fourth level consists of upper-case alphabetic characters
    (\(\text{A},\text{B},\text{C},\dotsc\)).
\begin{MacroCode}{class}
\cs_set:Npn\theenumiv {\Alph{enumiv}}
\end{MacroCode}
    \end{macro*}
    We also need macros that typeset the actual labels. Here, different
    levels have a different postfix: all levels except the second are
    postfixed by a period, while the second level is postfixed by a
    closing bracket.
    \begin{macro*}{\labelenumi}
\begin{MacroCode}{class}
\cs_new:Npn\labelenumi{\theenumi.}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\labelenumii}
\begin{MacroCode}{class}
\cs_new:Npn\labelenumii{\theenumii)}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\labelenumiii}
\begin{MacroCode}{class}
\cs_new:Npn\labelenumiii{\theenumiii.}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\labelenumiv}
\begin{MacroCode}{class}
\cs_new:Npn\labelenumiv{\theenumiv.}
\end{MacroCode}
    \end{macro*}
    We also fix the referencing of lower-level items so that one can
    refer to them properly (\emph{i.e.} as 1b(iii) and so on).
    \begin{macro*}{\p@enumii}
\begin{MacroCode}{class}
\cs_set:Npn\p@enumii{\theenumi}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\p@enumiii}
\begin{MacroCode}{class}
\cs_set:Npn\p@enumiii{\theenumi(\theenumii)}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\p@enumiiv}
\begin{MacroCode}{class}
\cs_set:Npn\p@enumiv{\p@enumiii\theenumiii}
\end{MacroCode}
    \end{macro*}

    All that was for numbered lists (\env{enumerate}). Now, we define
    the \enquote{labels} of \env{itemize} items. Alternately, they
    are a bullet (\textbullet) and a boldfaced dash
    ({\normalfont\bfseries\textendash}).
    \begin{macro*}{\labelitemi}
\begin{MacroCode}{class}
\cs_set:Npn\labelitemi{\textbullet}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\labelitemii}
\begin{MacroCode}{class}
\cs_set:Npn\labelitemii{\normalfont\bfseries\textendash}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\labelitemiii}
\begin{MacroCode}{class}
\cs_set:Npn\labelitemiii{\textbullet}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\labelitemiv}
\begin{MacroCode}{class}
\cs_set:Npn\labelitemiv{\normalfont\bfseries\textendash}
\end{MacroCode}
    \end{macro*}

    The last of the commonly used list environments is \env{description}.
    Defining it is fairly simple --- we define a list with empty item
    labels and a bit of hackery for the \cs{makelabel} macro inside.
    \begin{environment}{description}
\begin{MacroCode}{class}
\DeclareDocumentEnvironment{description}{}{
    \begin{list}{}{
        \dim_zero:N\labelwidth
        \dim_set:Nn\itemindent{-\leftmargin}
        \cs_set_eq:NN\makelabel\descriptionlabel
    }
}{
    \end{list}
}
\end{MacroCode}
    \begin{macro}{\descriptionlabel}
    Additionally, the \cs{descriptionlabel} macro is defined.
\begin{MacroCode}{class}
\NewDocumentCommand\descriptionlabel{m}{
    \hspace{\labelsep}\normalfont\bfseries #1
}
\end{MacroCode}
    \end{macro}
    \end{environment}

    \paragraph{Quotation environments}
    The quotation environments are also fairly simple --- \env{quote}
    is just a list with a single item, and \env{quotation} is a
    \env{quote} with extra skips around it.
    \begin{environment}{quote}
\begin{MacroCode}{class}
\NewDocumentEnvironment{quote}{}{
    \begin{list}{}{
        \dim_set_eq:NN\rightmargin\leftmargin
    }
    \item\itshape
}{
    \end{list}
}
\end{MacroCode}
    \end{environment}
    \begin{environment}{quotation}
\begin{MacroCode}{class}
\NewDocumentEnvironment{quotation}{}{
    \bigskip
    \begin{quote}
}{
    \end{quote}
    \bigskip
}
\end{MacroCode}
    \end{environment}
    There's a \env{verse} environment, too, but it's just \env{quote}.
    \begin{environment}{verse}
\begin{MacroCode}{class}
\NewDocumentEnvironment{verse}{}{
    \begin{quote}
}{
    \end{quote}
}
\end{MacroCode}
    \end{environment}

    \paragraph{Front- and backmatter}
    We only define one front/backmatter macro; \cs{appendix}.
    \begin{macro}{\appendix}
\begin{MacroCode}{class}
\NewDocumentCommand\appendix{}{
    \par
    \setcounter{section}{0}
    \setcounter{subsection}{0}
    \cs_gset:Npn\thesection{\Alph{section}}
}
\end{MacroCode}
    \end{macro}

    \paragraph{Old font macros}
    The old font macros have been deprecated. Do not use!
    \begin{macro}{\rm}
    \changes{0.12}{Deprecated command}
\begin{MacroCode}{class}
\DeclareDocumentCommand\rm{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\rm}{\textrm}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\sf}
    \changes{0.12}{Deprecated command}
\begin{MacroCode}{class}
\DeclareDocumentCommand\sf{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\sf}{\textsf}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\tt}
    \changes{0.12}{Deprecated command}
\begin{MacroCode}{class}
\DeclareDocumentCommand\tt{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\tt}{\texttt}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\bf}
    \changes{0.12}{Deprecated command}
\begin{MacroCode}{class}
\DeclareDocumentCommand\bf{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\bf}{\textbf}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\it}
    \changes{0.12}{Deprecated command}
\begin{MacroCode}{class}
\DeclareDocumentCommand\it{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\it}{\textit}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\sl}
    \changes{0.12}{Deprecated command}
\begin{MacroCode}{class}
\DeclareDocumentCommand\sl{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\sl}{\textsl}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\sc}
    \changes{0.12}{Deprecated command}
\begin{MacroCode}{class}
\DeclareDocumentCommand\sc{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\sc}{\textsc}}
\end{MacroCode}
    \end{macro}

    \paragraph{The emphasis macro}
    \begin{macro}{\emph}
    \changes{0.12}{Changed definition, may have introduced spacing issues}
    Redefining the \cs{emph} style to be bold when nested.
    \begin{macro*}{\em}
    \changes{0.12}{Deprecated command}
\begin{MacroCode}{class}
\DeclareDocumentCommand\em{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\em}{\emph}}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\__skrapport_emphstyle:}
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_emphstyle:{
    \itshape
    \dim_compare:nF{\fontdimen\c_one\font>\c_zero_dim}{\bfseries}
}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\DeclareDocumentCommand\emph{m+}{
    \ifmmode
        \text{\__skrapport_emphstyle: #1}
    \else
        {\__skrapport_emphstyle: #1}
    \fi
}
\end{MacroCode}
    \end{macro}

    \paragraph{The footnote rule}
    \begin{macro*}{\footnoterule}
    \changes{0.12}{Removed footnote rule entirely}
\begin{MacroCode}{class}
\DeclareDocumentCommand\footnoterule{}{}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\@makefntext}
\begin{MacroCode}{class}
\DeclareDocumentCommand\@makefntext{m+}{
    \dim_set:Nn\parindent{1em}\noindent
    \hbox_to_wd:nn{1.8em}{\hss\@makefnmark}
    #1
}
\end{MacroCode}
    \end{macro*}

    \subsubsection{Floats}
    \paragraph{Table- and box-related lengths}
\begin{MacroCode}{class}
\dim_gset:Nn\arraycolsep    {5pt}
\dim_gset:Nn\tabcolsep      {6pt}
\dim_gset:Nn\arrayrulewidth{.4pt}
\dim_gset:Nn\doublerulesep  {2pt}
\dim_gset_eq:NN\tabbingsep\labelsep
\skip_gset_eq:NN{\skip\@mpfootins}{\skip\footins}
\dim_gset:Nn\fboxsep        {3pt}
\dim_gset:Nn\fboxrule      {.4pt}
\end{MacroCode}

    \paragraph{Counters}
\begin{MacroCode}{class}
\newcounter{figure}
\newcounter{table}
\end{MacroCode}
    \begin{macro*}{\theequation}
\begin{MacroCode}{class}
\cs_set:Npn\theequation{\arabic{equation}}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\thefigure}
\begin{MacroCode}{class}
\cs_set:Npn\thefigure{\arabic{figure}}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\thetable}
\begin{MacroCode}{class}
\cs_set:Npn\thetable{\arabic{table}}
\end{MacroCode}
    \end{macro*}

    \paragraph{Defaults}
    The default placement, list extension and caption text of all floats.
\begin{MacroCode}{class}
\cs_new:Npn  \fps@figure{tb}
\cs_new:Npn\ftype@figure{1}
\cs_new:Npn  \ext@figure{lof}
\cs_new:Npn \fnum@figure{\figurename\ \thefigure}
\cs_new:Npn  \fps@table {tb}
\cs_new:Npn\ftype@table {2}
\cs_new:Npn  \ext@table {lot}
\cs_new:Npn \fnum@table {\tablename\ \thetable}
\end{MacroCode}

    \paragraph{Environments}
    \begin{macro}{\__skrapport_xfloat:nn}
    \begin{macro*}{\__skrapport_xfloat:nx}
    This is a helper macro basically replacing the \cs{@float} macro
    used by \LaTeXe.
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_xfloat:nn#1#2{\@xfloat{#1}[#2]}
\cs_generate_variant:Nn\__skrapport_xfloat:nn{nx}
\end{MacroCode}
    \end{macro*}
    \end{macro}
    \begin{environment}{figure}
    \changes{0.12a}{Figures are now \cs{centering}ed by default}
    \begin{environment*}{figure*}
\begin{MacroCode}{class}
\DeclareDocumentEnvironment{figure}{o}{
    \__skrapport_xfloat:nx{figure}
        {\IfNoValueTF{#1}{\fps@figure}{#1}}
    \centering
}{
    \end@float
}
\DeclareDocumentEnvironment{figure*}{o}{
    \__skrapport_xfloat:nx{figure}
        {\IfNoValueTF{#1}{tp}{#1}}
    \centering
}{
    \end@float
}
\end{MacroCode}
    \end{environment*}
    \end{environment}
    \begin{environment}{table}
    \changes{0.12a}{Tables are now \cs{centering}ed by default}
    \begin{environment*}{table*}
\begin{MacroCode}{class}
\DeclareDocumentEnvironment{table}{o}{
    \__skrapport_xfloat:nx{table}
        {\IfNoValueTF{#1}{\fps@table}{#1}}
    \centering
}{
    \end@float
}
\DeclareDocumentEnvironment{table*}{o}{
    \__skrapport_xfloat:nx{table}
        {\IfNoValueTF{#1}{tp}{#1}}
    \centering
}{
    \end@float
}
\end{MacroCode}
    \end{environment*}
    \end{environment}

    In addition to the \env{figure} and \env{table} environments, we
    also provide a \env{figcenter} environment that enables centering
    of figures or tables that are too wide for the page.
    \begin{macro*}{\coffin_typeset:Nnnon}
\begin{MacroCode}{class}
\cs_generate_variant:Nn\coffin_typeset:Nnnnn{Nnnon}
\end{MacroCode}
    \end{macro*}
    \begin{environment}{figcenter}
    \changes{0.12c}{Fixed the x-offset calculation}
\begin{MacroCode}{class}
\DeclareDocumentEnvironment{figcenter}{}{
    \cs_set_eq:NN\l__tmpa_cs\caption
    \cs_set:Npn\caption{\msg_error:nn{skrapport}{caption-in-figcenter}}
    \coffin_clear:N\l_tmpa_coffin
    \hcoffin_set:Nw\l_tmpa_coffin
}{
    \hcoffin_set_end:
    \dim_set:Nn\l_tmpa_dim{(\textwidth - \coffin_wd:N\l_tmpa_coffin)/2}
    \coffin_typeset:Nnnon\l_tmpa_coffin{H}{l}{\dim_use:N\l_tmpa_dim}{0pt}
    \cs_set_eq:NN\caption\l__tmpa_cs
    \cs_undefine:N\l__tmpa_cs
}
\end{MacroCode}
    \end{environment}

    \paragraph{Captions}
    Before we begin, we pass options to \pkg{caption}, in case the user
    is loading it or another package based upon it. This fixes an issue
    where the custom caption style was overwritten with the ugly default
    \pkg{article} caption style.
\begin{MacroCode}{class}
\PassOptionsToPackage{font=small,labelfont+=bf,textfont+=it}{caption}
\end{MacroCode}
    \begin{macro*}{\__skrapport_caption_name_style:}
\begin{MacroCode}{class}
\cs_new_protected:Nn\__skrapport_caption_name_style:{\small\bfseries}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\__skrapport_caption_text_style:}
\begin{MacroCode}{class}
\cs_new_protected:Nn\__skrapport_caption_text_style:{\small\itshape}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\skip_new:N\abovecaptionskip
\skip_set:Nn\abovecaptionskip{10pt}
\skip_new:N\belowcaptionskip
\skip_set:Nn\belowcaptionskip{10pt}
\end{MacroCode}
    \begin{macro*}{\@makecaption}
    \changes{0.10c}{Fix missing coloring command for some captions}
    \changes{0.12}{Split \cs{@captionstyle} into two macros}
    \changes{0.12a}{Fix a bug which applied caption name styling to the
        caption text}
    This should possibly be redefined already at the \cs{caption} level.
\begin{MacroCode}{class}
\cs_new:Npn\@makecaption#1#2{
    \skip_vertical:N\abovecaptionskip
    \hbox_set:Nn\l_tmpa_box{
        \color@setgroup % !!!
        {\__skrapport_caption_name_style:#1:~}
        {\__skrapport_caption_text_style:#2}
        \color@endgroup % !!!
    }
    \dim_compare:nTF{\box_wd:N\l_tmpa_box>\hsize}{
        {\__skrapport_caption_name_style:#1:~}
        {\__skrapport_caption_text_style:#2}
        \par
    }{
        \global\@minipagefalse % !!!
        \hbox_to_wd:nn{\hsize}{
            \hfil
            \box_use_clear:N\l_tmpa_box
            \hfil
        }
    }
    \skip_vertical:N\belowcaptionskip
}
\end{MacroCode}
    \end{macro*}

    \subsubsection{Table of contents}
\begin{MacroCode}{class}
\cs_new:Npn\@pnumwidth{1.55em}
\cs_new:Npn\@tocrmarg{2em}
\cs_new:Npn\@dotsep{1.7}
\setcounter{tocdepth}{3}
\end{MacroCode}
    \begin{macro}{\tableofcontents}
    \changes{0.12}{Removed spacing and \cs{@mkboth} call}
\begin{MacroCode}{class}
\DeclareDocumentCommand\tableofcontents{}{
  \section*{\contentsname}
  \makeatletter
  \@starttoc{toc}
  \makeatother
}
\end{MacroCode}
    \end{macro}

    The following macros conspire to replace \cs{@dottedtocline}.
    \begin{macro*}{\__skrapport_toc_line:nnnnnn}[6]
        {TOC line character}
        {Table of contents level of the line}
        {Indentation at the start of the line}
        {Width of the section number}
        {Section title}
        {Page number}
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_toc_line:nnnnnn#1#2#3#4#5#6{
    \int_compare:nF{#2>\value{tocdepth}}{
        \skip_vertical:n{0pt~plus~.2pt}
        \group_begin:
            \skip_set:Nn\leftskip{#3}
            \skip_set_eq:NN\rightskip\@tocrmarg
            \skip_set:Nn\parfillskip{-\rightskip}
            \dim_set:Nn\parindent{#3}
            \@afterindenttrue % !!!
            \interlinepenalty\@M % !!!
            \leavevmode
\end{MacroCode}
    This here is pretty dumb. We can't use a \LaTeX3\ temporary skip
    register (or skip the temporary), because \texttt{\#5} further down
    will contain a \cs{hbox} based on \cs{@tempdima}. The proper thing
    to do here would be to rewrite \cs{addcontentsline}, I guess. Bah.
\begin{MacroCode}{class}
            \skip_set:Nn\@tempdima{#4} % !!! (dumb)
            \skip_add:Nn\leftskip{\@tempdima}
            \null\nobreak
            \skip_horizontal:n{-\leftskip}
            {#5}\nobreak
            \str_if_eq:nnTF{#1}{}{
                \hfill
            }{
                \leaders\hbox:n{
                    \(\mkern\@dotsep mu\hbox{#1}\mkern\@dotsep mu\) % !!!
                }
            }
            \hfill\nobreak
            \hbox_to_wd:nn{\@pnumwidth}{ % !!!
                \hfil\normalfont\normalcolor #6
            }
            \par
        \group_end:
    }
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\__skrapport_toc_line:nnnnnn}[5]
        {Table of contents level of the line}
        {Indentation at the start of the line}
        {Width of the section number}
        {Section title}
        {Page number}
    This is a variant of \cs{__skrapport_toc_line:nnnnnn} which
    implicitly sets empty space as its TOC line.
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_toc_line:nnnnn#1#2#3#4#5{
    \__skrapport_toc_line:nnnnnn{}{#1}{#2}{#3}{#4}{#5}
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\l@section}
    \changes{0.12}{Now uses \cs{__skrapport_toc_line:nnnnn}}
\begin{MacroCode}{class}
\DeclareDocumentCommand\l@section{mm}{
    \group_begin:
        \skip_vertical:n{.75ex}
        \bfseries
        \__skrapport_toc_line:nnnnn{1}{0em}{1.3em}{#1}{#2}
    \group_end:
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\l@subsection}
    \changes{0.12}{Now uses \cs{__skrapport_toc_line:nnnnnn}}
\begin{MacroCode}{class}
\DeclareDocumentCommand\l@subsection{mm}{
    \group_begin:
        \skip_vertical:n{.35ex}
        \penalty\@secpenalty % !!!
        \__skrapport_toc_line:nnnnnn{.}{2}{1.3em}{2em}{#1}{#2}
    \group_end:
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\l@subsubsection}
    \changes{0.12}{Changed style to match \pkg{skdoc}}
\begin{MacroCode}{class}
\DeclareDocumentCommand\l@subsubsection{mm}{
    \skip_set:Nn\leftskip{3.3em}
    \dim_set_eq:NN\parindent\c_zero_dim
    \group_begin:
        \cs_set_eq:NN\numberline\use_none:n
        \small #1~[#2]
    \group_end:
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\l@paragraph}
\begin{MacroCode}{class}
\DeclareDocumentCommand\l@paragraph{mm}{
    \int_compare:nF{4>\value{tocdepth}}{
        \msg_warning:nnnn{skrapport}{tocdepth-too-deep}
            {4}{\l@paragraph}
    }
}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\l@subparagraph}
\begin{MacroCode}{class}
\DeclareDocumentCommand\l@subparagraph{mm}{
    \int_compare:nF{5>\value{tocdepth}}{
        \msg_warning:nnnn{skrapport}{tocdepth-too-deep}
            {5}{\l@subparagraph}
    }
}
\end{MacroCode}
    \end{macro*}

    Fix for \emph{e.g.}~\pkg{tocloft} package.
\begin{MacroCode}{class}
\cs_set:Npn\l@figure{}
\cs_set:Npn\l@table{}
\end{MacroCode}

    \subsubsection{Basic bibliography support}
\begin{MacroCode}{class}
\dim_new:N\bibindent
\dim_set:Nn\bibindent{2em}
\end{MacroCode}
    \begin{environment}{thebibliography}
    \changes{0.12}{Removed \cs{@mkboth}, \cs{@openbib@code} and
                   \cs{@noitemerr}}
\begin{MacroCode}{class}
\DeclareDocumentEnvironment{thebibliography}{m}{
    \section*{\refname}
    \list{\@biblabel{\arabic{enumiv}}}{
        \dim_set_to_wd:Nn\labelwidth{\@biblabel{#1}}
        \dim_set_eq:NN\leftmargin\labelwidth
        \dim_add:Nn\leftmargin{\labelsep}
        \usecounter{enumiv} % !!!
        \cs_set:Nn\p@enumiv{}
        \RenewDocumentCommand\theenumiv{}{\arabic{enumiv}}
    }
    \sloppy
    \int_set:Nn\clubpenalty{4000}
    \int_set_eq:NN\@clubpenalty\clubpenalty
    \int_set:Nn\widowpenalty{4000}
}{
    \cs_set:Nn\@noitemerr{}
    \endlist
}
\end{MacroCode}
    \end{environment}
    \begin{macro*}{\newblock}
\begin{MacroCode}{class}
\DeclareDocumentCommand\newblock{}{
    \skip_horizontal:n{.11em~plus~.33em~minus~.07em}
}
\end{MacroCode}
    \end{macro*}
    \begin{environment}{theindex}
    \changes{0.12}{Use \pkg{multicol} instead of \cs{twocolumn} mode,
                   removed \cs{@mkboth} call}
\begin{MacroCode}{class}
\DeclareDocumentEnvironment{theindex}{}{
    \begin{multicols}{2}[\section*{\indexname}]
    \thispagestyle{plain}
    \dim_zero:N\parindent
    \skip_set:N\parskip{\c_zero_skip~plus~.3pt}
    \dim_zero:N\columnseprule
    \dim_set:Nn\columnsep{35pt}
    \cs_set_eq:NN\item\@idxitem
}{
    \end{multicols}
}
\end{MacroCode}
    \end{environment}
    \begin{macro*}{\@idxitem}
\begin{MacroCode}{class}
\DeclareDocumentCommand\@idxitem{}{
    \par
    \dim_set:Nn\hangindent{40pt}
}
\end{MacroCode}
    \end{macro*}
    \begin{macro}{\subitem}
\begin{MacroCode}{class}
\DeclareDocumentCommand\subitem{}{
    \@idxitem
    \hspace*{20pt}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\subsubitem}
\begin{MacroCode}{class}
\DeclareDocumentCommand\subsubitem{}{
    \@idxitem
    \hspace*{30pt}
}
\end{MacroCode}
    \end{macro}
    \begin{macro*}{\indexspace}
\begin{MacroCode}{class}
\DeclareDocumentCommand\indexspace{}{
    \par
    \skip_vertical:n{10pt~plus~5pt~minus~3pt}
}
\end{MacroCode}
    \end{macro*}

    \subsubsection{Miscellaneous}
    A macro \cs{comment} (alias \cs{com}/\cs{note}) is defined to let
    the user add comments and notes to the document.
    \begin{macro}{\__skrapport_comment:n}
\begin{MacroCode}{class}
\cs_new:Npn\__skrapport_comment:n#1{
    {\textbf{\__skrapport_Comment_word: :}~#1}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\comment}
    \changes{0.10}{Added macro for comments}
    \changes{0.12b}{No longer uses \cs{colorbox} if no color package is loaded}
\begin{MacroCode}{class}
\DeclareDocumentCommand\comment{sm}{
    \IfBooleanTF{#1}
        {
            \cs_if_exist_use:NT\colorbox{{red!50}}
                {\__skrapport_comment:n{#2}}
        }
        {\marginpar{\__skrapport_comment:n{#2}}}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\com}
    \begin{macro}{\note}
    \changes{0.10b}{Fixed a silly error in \cs{com} and \cs{note}}
\begin{MacroCode}{class}
\ProvideDocumentCommand\com{sm}
    {\IfBooleanTF{#1}{\comment*{#2}}{\comment{#2}}}
\ProvideDocumentCommand\note{sm}
    {\IfBooleanTF{#1}{\comment*{#2}}{\comment{#2}}}
\end{MacroCode}
    \end{macro}
    \end{macro}

    \begin{macro}{\__skrapport_space_if_not_punctuation:}
\begin{MacroCode}{class}
\cs_new:Nn\__skrapport_space_if_not_punctuation:{
    \clist_if_in:noF
        {{,},:,;,!,?,-,),'}
        {\token_to_meaning:N\l_peek_token}
        {\ }
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\__skrapport_peek_punctuation:n}
    \begin{macro*}{\__skrapport_peek_punctuation:x}
\begin{MacroCode}{class}
\cs_new_nopar:Nn\__skrapport_peek_punctuation:n{
    \mbox{#1}
    \peek_meaning_remove:NTF.{}{
        \peek_meaning:NF\ {
            \peek_after:Nw\__skrapport_space_if_not_punctuation:
        }
    }
}
\cs_generate_variant:Nn\__skrapport_peek_punctuation:n{x}
\end{MacroCode}
    \end{macro*}
    \end{macro}
    \begin{macro}{\eg}
\begin{MacroCode}{class}
\DeclareDocumentCommand\eg{}{
    \__skrapport_peek_punctuation:x{\__skrapport_eg_word:}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\ie}
\begin{MacroCode}{class}
\DeclareDocumentCommand\ie{}{
    \__skrapport_peek_punctuation:x{\__skrapport_ie_word:}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\etc}
\begin{MacroCode}{class}
\DeclareDocumentCommand\etc{}{
    \__skrapport_peek_punctuation:x{\__skrapport_etc_word:}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\cf}
\begin{MacroCode}{class}
\DeclareDocumentCommand\cf{}{
    \__skrapport_peek_punctuation:x{\__skrapport_cf_word:}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\viz}
\begin{MacroCode}{class}
\DeclareDocumentCommand\viz{}{
    \__skrapport_peek_punctuation:x{\__skrapport_viz_word:}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\dash}
\begin{MacroCode}{class}
\DeclareDocumentCommand\dash{}{
    \cs_if_exist_use:NT\texorpdfstring
    {\unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}{{ - }}
}
\cs_if_exist_use:NT\DeclareUnicodeCharacter{{2014}{\dash}}
\end{MacroCode}
    \end{macro}

    \subsubsection{Color theme support}
    Color theme setup. Start by patching commands and declaring
    default colors. Not implemented: background colors for e.g.
    quote environments and sections headings, different colors
    for the different sectioning levels.
\begin{MacroCode}{class}
\bool_if:NT\g__skrapport_color_bool{
    \apptocmd{\bfseries}
        {\color{skrapport@boldcolor}}{}
        {\msg_warning:nnn{skrapport}{color-patch-failed}{\bfseries}}
    \apptocmd{\itshape}
        {\color{skrapport@italiccolor}}{}
        {\msg_warning:nnn{skrapport}{color-patch-failed}{\itshape}}
    \apptocmd{\__skrapport_title_style:}
        {\color{skrapport@titlecolor}}{}
        {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_title_style:}}
    \apptocmd{\__skrapport_smallprint_style:}
        {\color{skrapport@smallprintcolor}}{}
        {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_smallprint_style:}}
    \apptocmd{\__skrapport_abstract_style:}
        {\color{skrapport@titlecolor}}{}
        {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_abstract_style:}}
    \apptocmd{\quote}
        {\color{skrapport@quotecolor}}{}
        {\msg_warning:nnn{skrapport}{color-patch-failed}{\quote}}
    \apptocmd{\__skrapport_caption_name_style:}
        {\color{skrapport@captioncolor}}{}
        {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_caption_name_style:}}
    \apptocmd{\__skrapport_emphstyle:}
        {\color{skrapport@emphcolor}}{}
        {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_emphstyle:}}
\end{MacroCode}
% I have no idea why this was here or what difference it makes. These
% things should be using \__skrapport_title_style:.
%    \ifskrapport@twocolumn\AtBeginDocument{%
%        \renewcommand\section{\@startsection {section}{1}{\z@}%
%            {-.999\baselineskip}{0.001\baselineskip}{\bfseries\mathversi%on{bold}\color{skrapport@titlecolor}}}
%        \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
%            {\baselineskip}{-.35\baselineskip}{\bfseries\color{skrapport@titlecolor}\unskip}}
%        \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
%            {\baselineskip}{-.35\baselineskip}{\itshape\color{skrapport@titlecolor}\unskip}}
%    }\fi
%    \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
%        {1ex \@plus .25ex \@minus -.25ex}{-1em}{\normalfont\normalsize\bfseries\color{skrapport@titlecolor}}}
%    \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
%        {1ex \@plus .25ex \@minus -.25ex}{-1em}{\normalfont\normalsize\itshape\color{skrapport@titlecolor}}}
\begin{MacroCode}{class}
    \AtBeginDocument{\@ifpackageloaded{hyperref}{%
        \hypersetup{%
            citebordercolor=skrapport@citecolor,citecolor=skrapport@citecolor,%
            filebordercolor=skrapport@filecolor,filecolor=skrapport@filecolor,%
            linkbordercolor=skrapport@linkcolor,linkcolor=skrapport@linkcolor,%
            menubordercolor=skrapport@menucolor,menucolor=skrapport@menucolor,%
            urlbordercolor=skrapport@urlcolor,urlcolor=skrapport@urlcolor,%
            runbordercolor=skrapport@runcolor,runcolor=skrapport@runcolor%
        }
    }{}}
    \AtBeginDocument{\color{skrapport@defaultcolor}}
\end{MacroCode}
    \begin{macro}{\colortheme}
    The \cs{colortheme} macro allows the end-user to load color themes
    (described later) to customize the colors of the document when the
    class is loaded with the \opt{color} option.
\begin{MacroCode}{class}
    \DeclareDocumentCommand\colortheme{m}{
        \usepackage{skrapport-colortheme-#1}
    }
\end{MacroCode}
    \end{macro}
\begin{MacroCode}{class}
    \colortheme{default}
}
\end{MacroCode}

    \subsection{Final class setup}
    We end the document class by setting a few lengths along with the
    page style and page numbering. Also, activate \cs{raggedbottom} and
    \cs{onexolumn} (since we always do all the two-column stuff
    ourselves anyway).
\begin{MacroCode}{class}
\dim_set:Nn\columnsep{10pt}
\dim_zero:N\columnseprule
\pagestyle{plain}
\pagenumbering{arabic}
\raggedbottom
\onecolumn
\endinput
\end{MacroCode}

    \subsection{Color themes}
    As described earlier, the user can load color themes to customize
    the appearance of the document if the class was loaded with the
    \opt{color} option. Four themes are available by default.

    \subsubsection{Default color theme}
    \begin{theme}{Default}
    \changes{0.09}{Added default color theme}
\begin{MacroCode}{theme-default}
\RequirePackage{expl3}
\ProvidesExplPackage{skrapport-colortheme-default}
    {2012/06/07}{1.0}{skrapport color theme default}
\definecolor{skrapport@citecolor}{named}{green}
\definecolor{skrapport@filecolor}{named}{teal}
\definecolor{skrapport@linkcolor}{named}{red}
\definecolor{skrapport@menucolor}{named}{red}
\definecolor{skrapport@urlcolor}{named}{cyan}
\definecolor{skrapport@runcolor}{named}{teal}
\definecolor{skrapport@boldcolor}{named}{black}
\definecolor{skrapport@titlecolor}{named}{black}
\definecolor{skrapport@italiccolor}{named}{black}
\definecolor{skrapport@smallprintcolor}{named}{black}
\definecolor{skrapport@quotecolor}{named}{black}
\definecolor{skrapport@captioncolor}{named}{black}
\definecolor{skrapport@emphcolor}{named}{black}
\definecolor{skrapport@defaultcolor}{named}{black}
\endinput
\end{MacroCode}
    \end{theme}

    \subsubsection{Unscathed color theme}
    \begin{theme}{Unscathed}
    \changes{0.09}{Added \enquote{Unschathed} color theme}
\begin{MacroCode}{theme-unscathed}
\RequirePackage{expl3}
\ProvidesExplPackage{skrapport-colortheme-unscathed}
    {2012/06/07}{1.0}{skrapport color theme unscathed}
\definecolor{skrapport@citecolor}{named}{skrapport@defaultcolor}
\definecolor{skrapport@filecolor}{named}{skrapport@defaultcolor}
\definecolor{skrapport@menucolor}{named}{skrapport@defaultcolor}
\definecolor{skrapport@runcolor}{named}{skrapport@defaultcolor}
\definecolor{skrapport@emphcolor}{HTML}{463335}
\definecolor{skrapport@linkcolor}{HTML}{CF5D3B}
\definecolor{skrapport@urlcolor}{named}{skrapport@linkcolor}
\definecolor{skrapport@titlecolor}{HTML}{B34430}
\definecolor{skrapport@captioncolor}{named}{skrapport@titlecolor}
\definecolor{skrapport@quotecolor}{HTML}{70524A}
\definecolor{skrapport@smallprintcolor}{named}{skrapport@quotecolor}
\endinput
\end{MacroCode}
    \end{theme}

    \subsubsection{Cruelwater color theme}
    \begin{theme}{Cruelwater}
    \changes{0.09}{Added \enquote{Cruelwater} color theme}
\begin{MacroCode}{theme-cruelwater}
\RequirePackage{expl3}
\ProvidesExplPackage{skrapport-colortheme-cruelwater}
    {2012/06/07}{1.0}{skrapport color theme cruelwater}
\definecolor{skrapport@citecolor}{named}{black}
\definecolor{skrapport@filecolor}{named}{black}
\definecolor{skrapport@linkcolor}{named}{black}
\definecolor{skrapport@menucolor}{named}{black}
\definecolor{skrapport@urlcolor}{named}{black}
\definecolor{skrapport@runcolor}{named}{black}
\definecolor{skrapport@boldcolor}{HTML}{030C22}
\definecolor{skrapport@titlecolor}{HTML}{20293F}
\definecolor{skrapport@italiccolor}{named}{black}
\definecolor{skrapport@smallprintcolor}{HTML}{A9B0B3}
\definecolor{skrapport@quotecolor}{HTML}{404749}
\definecolor{skrapport@captioncolor}{HTML}{030C22}
\definecolor{skrapport@emphcolor}{HTML}{20293F}
\definecolor{skrapport@defaultcolor}{named}{black}
\endinput
\end{MacroCode}
    \end{theme}

    \subsubsection{Violet color theme}
    \begin{theme}{Violet}
\changes{0.09}{Added \enquote{Violet} color theme}
\begin{MacroCode}{theme-violet}
\RequirePackage{expl3}
\ProvidesExplPackage{skrapport-colortheme-violet}
    {2012/06/07}{1.0}{skrapport color theme violet}
\definecolor{skrapport@citecolor}{HTML}{932444}
\definecolor{skrapport@filecolor}{HTML}{932444}
\definecolor{skrapport@linkcolor}{HTML}{932444}
\definecolor{skrapport@menucolor}{HTML}{932444}
\definecolor{skrapport@urlcolor}{HTML}{932444}
\definecolor{skrapport@runcolor}{HTML}{932444}
\definecolor{skrapport@boldcolor}{HTML}{311A2A}
\definecolor{skrapport@titlecolor}{HTML}{311A2A}
\definecolor{skrapport@italiccolor}{named}{black}
\definecolor{skrapport@smallprintcolor}{HTML}{D6CBCF}
\definecolor{skrapport@quotecolor}{HTML}{463335}
\definecolor{skrapport@captioncolor}{HTML}{311A2A}
\definecolor{skrapport@emphcolor}{HTML}{98758D}
\definecolor{skrapport@defaultcolor}{named}{black}
\endinput
\end{MacroCode}
    \end{theme}

    \subsubsection{skdoc color theme}
    \begin{theme}{skdoc}
\changes{0.11a}{Added \enquote{skdoc} color theme}
\begin{MacroCode}{theme-skdoc}
\RequirePackage{expl3}
\ProvidesExplPackage{skrapport-colortheme-skdoc}
    {2013/04/10}{1.0}{skrapport color theme skdoc}
\definecolor{skrapport@citecolor}{RGB}{140,35,24}
\definecolor{skrapport@filecolor}{RGB}{73,10,61}
\definecolor{skrapport@linkcolor}{RGB}{140,35,24}
\definecolor{skrapport@menucolor}{RGB}{140,35,24}
\definecolor{skrapport@urlcolor}{RGB}{73,10,61}
\definecolor{skrapport@runcolor}{RGB}{73,10,61}
\definecolor{skrapport@boldcolor}{RGB}{73,10,61}
\definecolor{skrapport@titlecolor}{RGB}{11,72,107}
\definecolor{skrapport@italiccolor}{named}{black}
\definecolor{skrapport@smallprintcolor}{RGB}{11,72,107}
\definecolor{skrapport@quotecolor}{RGB}{140,35,24}
\definecolor{skrapport@captioncolor}{RGB}{11,72,107}
\definecolor{skrapport@emphcolor}{RGB}{73,10,61}
\definecolor{skrapport@defaultcolor}{named}{black}
\endinput
\end{MacroCode}
    \end{theme}

    \section{Point sizes}
    The point size options are pretty much \LaTeX3 translations of the
    standard \pkg{article} class option files. There's a lot of duplicate
    code here which may be worth to consolidate a bit.

    \subsubsection{Common macros}
    We first set up a package providing replacements for \LaTeXe\ macros,
    common to all the point size files.
\begin{MacroCode}{size-common}
\RequirePackage{expl3}
\ProvidesExplPackage{skrapport-size-common}
    {2013/04/29}{1.0}{skrapport point size option common macros}
\end{MacroCode}
    \begin{macro}{\__skrapport_set_font_size:nn}[2]
        {Font size}
        {Baseline skip?} % !!!
\begin{MacroCode}{size-common}
\cs_new:Npn\__skrapport_set_font_size:nn#1#2{
    \fontsize{#1}{#2} % !!!
    \selectfont
}
\end{MacroCode}
    \end{macro}
\begin{MacroCode}{size-common}
\endinput
\end{MacroCode}

    \subsubsection{Actual point size files}
\begin{MacroCode}{size-10,size-11,size-12}
\RequirePackage{expl3}
\end{MacroCode}
\begin{MacroCode}{size-10}
\ProvidesExplFile{skrapport-size10pt.clo}
    {2013/04/29}{1.0}{skrapport point size option 10pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
\ProvidesExplFile{skrapport-size11pt.clo}
    {2013/04/29}{1.0}{skrapport point size option 11pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
\ProvidesExplFile{skrapport-size12pt.clo}
    {2013/04/29}{1.0}{skrapport point size option 12pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
\RequirePackage{skrapport-size-common}
\end{MacroCode}
    \begin{macro}{\normalsize}
\begin{MacroCode}{size-10,size-11,size-12}
\RenewDocumentCommand\normalsize{}{
\end{MacroCode}
\begin{MacroCode}{size-10}
    \__skrapport_set_font_size:nn{10}{12}
    \skip_gset:Nn   \abovedisplayskip      {10pt~plus~2pt~minus~5pt}
    \skip_gset:Nn   \abovedisplayshortskip {0pt ~plus~3pt}
    \skip_gset:Nn   \belowdisplayshortskip {6pt ~plus~3pt~minus~3pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
    \__skrapport_set_font_size:nn{11}{13.2}
    \skip_gset:Nn   \abovedisplayskip      {11pt ~plus~3pt  ~minus~6pt}
    \skip_gset:Nn   \abovedisplayshortskip {0pt  ~plus~3pt}
    \skip_gset:Nn   \belowdisplayshortskip {6.5pt~plus~3.5pt~minus~3pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \__skrapport_set_font_size:nn{12}{14.5}
    \skip_gset:Nn   \abovedisplayskip      {12pt ~plus~3pt  ~minus~7pt}
    \skip_gset:Nn   \abovedisplayshortskip {0pt  ~plus~3pt}
    \skip_gset:Nn   \belowdisplayshortskip {6.5pt~plus~3.5pt~minus~3pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
    \skip_gset_eq:NN\belowdisplayskip      \abovedisplayskip
    \cs_gset_eq:NN\@listi\@listI
}
\end{MacroCode}
    \end{macro}
\begin{MacroCode}{size-10,size-11,size-12}
\normalsize
\end{MacroCode}
    \begin{macro}{\small}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\small{}{
\end{MacroCode}
\begin{MacroCode}{size-10}
    \__skrapport_set_font_size:nn{9}{11}
    \skip_gset:Nn   \abovedisplayskip      {8.5pt~plus~3pt~minus~4pt}
    \skip_gset:Nn   \abovedisplayshortskip {0pt  ~plus~2pt}
    \skip_gset:Nn   \belowdisplayshortskip {4pt  ~plus~2pt~minus~2pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
    \__skrapport_set_font_size:nn{10}{12}
    \skip_gset:Nn   \abovedisplayskip      {10pt~plus~2pt~minus~5pt}
    \skip_gset:Nn   \abovedisplayshortskip {0pt ~plus~2pt}
    \skip_gset:Nn   \belowdisplayshortskip {6pt ~plus~3pt~minus~3pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \__skrapport_set_font_size:nn{11}{13.6}
    \skip_gset:Nn   \abovedisplayskip      {11pt ~plus~3pt  ~minus~6pt}
    \skip_gset:Nn   \abovedisplayshortskip {0pt  ~plus~3pt}
    \skip_gset:Nn   \belowdisplayshortskip {6.5pt~plus~3.5pt~minus~3pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
    \skip_gset_eq:NN\belowdisplayskip      \abovedisplayskip
    \cs_gset:Npn\@listi{
        \dim_gset_eq:NN\leftmargin\leftmargini
\end{MacroCode}
\begin{MacroCode}{size-10}
        \skip_gset:Nn\topsep{4pt~plus~2pt~minus~2pt}
        \skip_gset:Nn\parsep{2pt~plus~1pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
        \skip_gset:Nn\topsep{6pt~plus~2pt~minus~2pt}
        \skip_gset:Nn\parsep{3pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
        \skip_gset:Nn\topsep{  9pt~plus~3pt~minus~5pt}
        \skip_gset:Nn\parsep{4.5pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
        \skip_gset_eq:NN\itemsep\parsep
    }
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\footnotesize}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\footnotesize{}{
\end{MacroCode}
\begin{MacroCode}{size-10}
    \__skrapport_set_font_size:nn{8}{9.5}
    \skip_gset:Nn   \abovedisplayskip      {6pt~plus~2pt~minus~4pt}
    \skip_gset:Nn   \abovedisplayshortskip {0pt~plus~1pt}
    \skip_gset:Nn   \belowdisplayshortskip {3pt~plus~1pt~minus~2pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
    \__skrapport_set_font_size:nn{9}{11}
    \skip_gset:Nn   \abovedisplayskip      {8pt~plus~2pt~minus~4pt}
    \skip_gset:Nn   \abovedisplayshortskip {0pt~plus~1pt}
    \skip_gset:Nn   \belowdisplayshortskip {4pt~plus~2pt~minus~2pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \__skrapport_set_font_size:nn{10}{12}
    \skip_gset:Nn   \abovedisplayskip      {10pt~plus~2pt~minus~5pt}
    \skip_gset:Nn   \abovedisplayshortskip { 0pt~plus~3pt}
    \skip_gset:Nn   \belowdisplayshortskip { 6pt~plus~3pt~minus~3pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
    \skip_gset_eq:NN\belowdisplayskip      \abovedisplayskip
    \cs_gset:Npn\@listi{
        \dim_gset_eq:NN\leftmargin\leftmargini
\end{MacroCode}
\begin{MacroCode}{size-10}
        \skip_gset:Nn\topsep{3pt~plus~1pt~minus~1pt}
        \skip_gset:Nn\parsep{2pt~plus~1pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
        \skip_gset:Nn\topsep{4pt~plus~2pt~minus~2pt}
        \skip_gset:Nn\parsep{2pt~plus~1pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
        \skip_gset:Nn\topsep{6pt~plus~2pt~minus~2pt}
        \skip_gset:Nn\parsep{3pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
        \skip_gset_eq:NN\itemsep\parsep
    }
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\scriptsize}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\scriptsize{}{
\end{MacroCode}
\begin{MacroCode}{size-10}
    \__skrapport_set_font_size:nn{7}{8}
\end{MacroCode}
\begin{MacroCode}{size-11,size-12}
    \__skrapport_set_font_size:nn{8}{9.5}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\tiny}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\tiny{}{
\end{MacroCode}
\begin{MacroCode}{size-10}
    \__skrapport_set_font_size:nn{5}{6}
\end{MacroCode}
\begin{MacroCode}{size-11,size-12}
    \__skrapport_set_font_size:nn{6}{7}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\large}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\large{}{
\end{MacroCode}
\begin{MacroCode}{size-10,size-11}
    \__skrapport_set_font_size:nn{12}{14}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \__skrapport_set_font_size:nn{14}{18}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\Large}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\Large{}{
\end{MacroCode}
\begin{MacroCode}{size-10,size-11}
    \__skrapport_set_font_size:nn{14}{18}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \__skrapport_set_font_size:nn{17}{22}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\LARGE}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\LARGE{}{
\end{MacroCode}
\begin{MacroCode}{size-10,size-11}
    \__skrapport_set_font_size:nn{17}{22}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \__skrapport_set_font_size:nn{20}{25}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\huge}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\huge{}{
\end{MacroCode}
\begin{MacroCode}{size-10,size-11}
    \__skrapport_set_font_size:nn{20}{25}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \__skrapport_set_font_size:nn{25}{30}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\Huge}
\begin{MacroCode}{size-10,size-11,size-12}
\NewDocumentCommand\Huge{}{
\end{MacroCode}
\begin{MacroCode}{size-10,size-11}
    \__skrapport_set_font_size:nn{25}{30}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \__skrapport_set_font_size:nn{30}{36}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
}
\end{MacroCode}
    \end{macro}
\begin{MacroCode}{size-10}
\dim_set:Nn\parindent {15pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
\dim_set:Nn\parindent {17pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
\dim_set:Nn\parindent {1.5em}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
\skip_set:Nn\smallskipamount{ 3pt~plus~1pt~minus~1pt}
\skip_set:Nn\medskipamount  { 6pt~plus~2pt~minus~2pt}
\skip_set:Nn\bigskipamount  {12pt~plus~4pt~minus~4pt}
\dim_set:Nn\headheight{12pt}
\dim_set:Nn\headsep   {25pt}
\dim_set:Nn\topskip   {10pt}
\dim_set:Nn\footskip  {30pt}
\dim_set:Nn\maxdepth  { 5pt}
\end{MacroCode}
    These (\emph{i.e.} text width and height) are hopefully overwritten
    by \pkg{typearea} later, so we don't bother much with them.
\begin{MacroCode}{size-10,size-11,size-12}
\dim_set:Nn\textwidth  {\paperwidth-2cm}
\dim_set:Nn\textheight{\paperheight-2cm}
\dim_set:Nn\oddsidemargin  {.2cm}
\dim_set:Nn\evensidemargin  {1cm}
\dim_set:Nn\marginparsep   {11pt}
\dim_set:Nn\marginparpush   {5pt}
\dim_set:Nn\marginparwidth {.8cm-\marginparsep}
\dim_set:Nn\topmargin{\paperheight-1cm
                      -\headheight-\headsep
                      -\textheight-\footskip
                      -.5\topmargin}
\end{MacroCode}
\begin{MacroCode}{size-10}
\dim_set:Nn\footnotesep{6.65pt}
\skip_set:Nn{\skip\footins} { 9pt~plus~4pt~minus~2pt}
\skip_set:Nn\floatsep       {12pt~plus~2pt~minus~2pt}
\skip_set:Nn\textfloatsep   {20pt~plus~2pt~minus~4pt}
\skip_set:Nn\intextsep      {12pt~plus~2pt~minus~2pt}
\skip_set:Nn\dblfloatsep    {12pt~plus~2pt~minus~2pt}
\skip_set:Nn\dbltextfloatsep{20pt~plus~2pt~minus~4pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
\dim_set:Nn\footnotesep{7.7pt}
\skip_set:Nn{\skip\footins} {10pt~plus~4pt~minus~2pt}
\skip_set:Nn\floatsep       {12pt~plus~2pt~minus~2pt}
\skip_set:Nn\textfloatsep   {20pt~plus~2pt~minus~4pt}
\skip_set:Nn\intextsep      {12pt~plus~2pt~minus~2pt}
\skip_set:Nn\dblfloatsep    {12pt~plus~2pt~minus~2pt}
\skip_set:Nn\dbltextfloatsep{20pt~plus~2pt~minus~4pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
\dim_set:Nn\footnotesep{8.4pt}
\skip_set:Nn{\skip\footins} {10.8pt~plus~4pt~minus~2pt}
\skip_set:Nn\floatsep       {12pt  ~plus~2pt~minus~4pt}
\skip_set:Nn\textfloatsep   {20pt  ~plus~2pt~minus~4pt}
\skip_set:Nn\intextsep      {14pt  ~plus~4pt~minus~4pt}
\skip_set:Nn\dblfloatsep    {14pt  ~plus~2pt~minus~4pt}
\skip_set:Nn\dbltextfloatsep{20pt  ~plus~2pt~minus~4pt}
\end{MacroCode}
    These six have been changed slightly compared to \LaTeXe.
\begin{MacroCode}{size-10,size-11,size-12}
\skip_set:Nn\@fptop{ 5pt}
\end{MacroCode}
\begin{MacroCode}{size-10}
\skip_set:Nn\@fpsep{10pt~plus~2fil}
\end{MacroCode}
\begin{MacroCode}{size-11}
\skip_set:Nn\@fpsep{11pt~plus~2fil}
\end{MacroCode}
\begin{MacroCode}{size-12}
\skip_set:Nn\@fpsep{12pt~plus~2fil}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
\skip_set:Nn\@fpbot{ 5pt}
\skip_set:Nn\@dblfptop{ 5pt}
\end{MacroCode}
\begin{MacroCode}{size-10}
\skip_set:Nn\@dblfpsep{10pt~plus~2fil}
\end{MacroCode}
\begin{MacroCode}{size-11}
\skip_set:Nn\@dblfpsep{11pt~plus~2fil}
\end{MacroCode}
\begin{MacroCode}{size-12}
\skip_set:Nn\@dblfpsep{12pt~plus~2fil}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
\skip_set:Nn\@dblfpbot{ 5pt}
\end{MacroCode}
\begin{MacroCode}{size-10}
\skip_set:Nn\partopsep{2pt~plus~1pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
\skip_set:Nn\partopsep{3pt~plus~1pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
\skip_set:Nn\partopsep{3pt~plus~2pt~minus~2pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
\cs_set:Npn\@listi{
    \dim_set_eq:NN\leftmargin\leftmargini
\end{MacroCode}
\begin{MacroCode}{size-10}
    \skip_set:Nn\parsep {4pt~plus~2pt~minus~1pt}
    \skip_set:Nn\topsep {8pt~plus~2pt~minus~4pt}
    \skip_set:Nn\itemsep{4pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
    \skip_set:Nn\parsep {4.5pt~plus~2pt~minus~1pt}
    \skip_set:Nn\topsep {  9pt~plus~3pt~minus~5pt}
    \skip_set:Nn\itemsep{4.5pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \skip_set:Nn\parsep { 5pt~plus~2.5pt~minus~1pt}
    \skip_set:Nn\topsep {10pt~plus~4pt  ~minus~6pt}
    \skip_set:Nn\itemsep{ 5pt~plus~2.5pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
}
\cs_set_eq:NN\@listI\@listi
\dim_gset_eq:NN\leftmargin\leftmargini
\end{MacroCode}
\begin{MacroCode}{size-10}
\skip_gset:Nn\parsep {4pt~plus~2pt~minus~1pt}
\skip_gset:Nn\topsep {8pt~plus~2pt~minus~4pt}
\skip_gset:Nn\itemsep{4pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
\skip_gset:Nn\parsep {4.5pt~plus~2pt~minus~1pt}
\skip_gset:Nn\topsep {  9pt~plus~3pt~minus~5pt}
\skip_gset:Nn\itemsep{4.5pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
\skip_gset:Nn\parsep { 5pt~plus~2.5pt~minus~1pt}
\skip_gset:Nn\topsep {10pt~plus~4pt  ~minus~6pt}
\skip_gset:Nn\itemsep{ 5pt~plus~2.5pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
\cs_set:Npn\@listii{
    \dim_set_eq:NN\leftmargin\leftmarginii
    \dim_set:Nn\labelwidth{\leftmarginii-\labelsep}
\end{MacroCode}
\begin{MacroCode}{size-10}
    \skip_set:Nn\parsep {2pt~plus~1pt~minus~1pt}
    \skip_set:Nn\topsep {4pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-11}
    \skip_set:Nn\parsep {  2pt~plus~1pt~minus~1pt}
    \skip_set:Nn\topsep {4.5pt~plus~2pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \skip_set:Nn\parsep {2.5pt~plus~1pt  ~minus~1pt}
    \skip_set:Nn\topsep {  5pt~plus~2.5pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
    \skip_set_eq:NN\itemsep\parsep
}
\cs_set:Npn\@listiii{
    \dim_set_eq:NN\leftmargin\leftmarginiii
    \dim_set:Nn\labelwidth{\leftmarginiii-\labelsep}
    \skip_set_eq:NN\parsep\c_zero_skip
\end{MacroCode}
\begin{MacroCode}{size-10,size-11}
    \skip_set:Nn\topsep   {2pt~plus~1pt~minus~1pt}
    \skip_set:Nn\partopsep{1pt~plus~0pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-12}
    \skip_set:Nn\topsep   {2.5pt~plus~1pt~minus~1pt}
    \skip_set:Nn\partopsep{  1pt~plus~0pt~minus~1pt}
\end{MacroCode}
\begin{MacroCode}{size-10,size-11,size-12}
    \skip_set_eq:NN\itemsep\topsep
}
\cs_set:Npn\@listiv{
    \dim_set_eq:NN\leftmargin\leftmarginiv
    \dim_set:Nn\labelwidth{\leftmarginiv-\labelsep}
}
\cs_set:Npn\@listv{
    \dim_set_eq:NN\leftmargin\leftmarginv
    \dim_set:Nn\labelwidth{\leftmarginv-\labelsep}
}
\cs_set:Npn\@listvi{
    \dim_set_eq:NN\leftmargin\leftmarginvi
    \dim_set:Nn\labelwidth{\leftmarginvi-\labelsep}
}
\endinput
\end{MacroCode}

    \Finale
    \section{Installation}
    The easiest way to install this package is using the package
    manager provided by your \LaTeX\ installation if such a program
    is available. Failing that, provided you have obtained the package
    source (\file{skrapport.tex} and \file{Makefile}) from either CTAN
    or Github, running \texttt{make install} inside the source directory
    works well. This will extract the documentation and code from
    \file{skrapport.tex}, install all files into the TDS tree at
    \texttt{TEXMFHOME} and run \texttt{mktexlsr}.

    If you want to extract code and documentation without installing
    the package, run \texttt{make all} instead. If you insist on not
    using \texttt{make}, remember that packages distributed using
    \pkg{skdoc} must be extracted using \texttt{pdflatex}, \emph{not}
    \texttt{tex} or \texttt{latex}.

    \PrintChanges
    \PrintIndex
    \printbibliography
\end{document}
