Debian Codegraph @

texmf-dist/source/latex/skrapport/skrapport.tex

raw
1 %% skrapport Skånings rapportklass
2 %%
3 %% Copyright (C) 2012-2016 by Simon Sigurdhsson <[email protected]>
4 %%
5 %% This work may be distributed and/or modified under the
6 %% conditions of the LaTeX Project Public License, either version 1.3
7 %% of this license or (at your option) any later version.
8 %% The latest version of this license is in
9 %% http://www.latex-project.org/lppl.txt
10 %% and version 1.3 or later is part of all distributions of LaTeX
11 %% version 2005/12/01 or later.
12 %%
13 %% This work has the LPPL maintenance status `maintained'.
14 %%
15 %% The Current Maintainer of this work is Simon Sigurdhsson.
16 %%
17 %% This work consists of the file skrapport.tex and the derived files:
18 %% * skrapport.cls
19 %% * skrapport-colortheme-default.sty
20 %% * skrapport-colortheme-unscathed.sty
21 %% * skrapport-colortheme-violet.sty
22 %% * skrapport-colortheme-cruelwater.sty
23 %% * skrapport-colortheme-skdoc.sty
24 %% * skrapport-size-common.sty
25 %% * skrapport-size10pt.clo
26 %% * skrapport-size11pt.clo
27 %% * skrapport-size12pt.clo
28 \documentclass{skdoc}
29 \let\SI\relax
30 \usepackage{siunitx}
31 \DeclareSIUnit\point{pt}
32 \usepackage{hologo,booktabs,xcoffins,calc}
33 \usepackage[style=authoryear]{biblatex}
34 \usepackage{csquotes}
35 \usepackage{varioref,cleveref}
36 %\usepackage{chslacite}
37
38 \ExplSyntaxOn
39 \cs_set_protected_nopar:Npn\ExplHack{
40 \char_set_catcode_letter:n{ 58 }
41 \char_set_catcode_letter:n{ 95 }
42 }
43 \ExplSyntaxOff
44
45 % Hide the implementation
46 \OnlyDescription
47
48 % Bibliography entries
49 \begin{filecontents}{skrapport.bib}
50 @article{kpfonts,
51 author = {Christophe Caignaert},
52 title = {KP-Fonts 3.33},
53 year = {2018},
54 url = {http://mirror.ctan.org/fonts/kpfonts/doc/kpfonts.pdf}
55 }
56 @standard{ISO216,
57 title = {ISO 216:2007},
58 subtitle = {Writing paper and certain classes of printed matter -- Trimmed sizes -- A and B series, and indication of machine direction},
59 author = {{International Organization for Standardization, Technical Committee 6}},
60 year = {2007}
61 }
62 @standard{ISO8601,
63 title = {ISO 8601:2004},
64 subtitle = {Data elements and interchange formats -- Information interchange -- Representation of dates and times},
65 author = {{International Organization for Standardization, Technical Committee 154}},
66 year = {2004}
67 }
68 @article{Flynn,
69 author = {Peter Flynn},
70 title = {Rolling your own Document Class: Using \LaTeX{} to
71 keep away from the Dark Side},
72 journal = {The Prac\TeX{} Journal},
73 number = {4},
74 year = {2006},
75 url = {http://tug.org/pracjourn/2006-4/flynn/flynn.pdf}
76 }
77 \end{filecontents}
78 \addbibresource{skrapport.bib}
79
80 % Declare the target files
81 \SelfPreambleTo{\mypreamble}
82 \DeclareFile[key=class,preamble=\mypreamble]{skrapport.cls}
83 \DeclareFile[key=size-common,preamble=\mypreamble]%
84 {skrapport-size-common.sty}
85 \DeclareFile[key=size-10,preamble=\mypreamble]{skrapport-size10pt.clo}
86 \DeclareFile[key=size-11,preamble=\mypreamble]{skrapport-size11pt.clo}
87 \DeclareFile[key=size-12,preamble=\mypreamble]{skrapport-size12pt.clo}
88 \DeclareFile[key=theme-default,preamble=\mypreamble]%
89 {skrapport-colortheme-default.sty}
90 \DeclareFile[key=theme-unscathed,preamble=\mypreamble]%
91 {skrapport-colortheme-unscathed.sty}
92 \DeclareFile[key=theme-cruelwater,preamble=\mypreamble]%
93 {skrapport-colortheme-cruelwater.sty}
94 \DeclareFile[key=theme-violet,preamble=\mypreamble]%
95 {skrapport-colortheme-violet.sty}
96 \DeclareFile[key=theme-skdoc,preamble=\mypreamble]%
97 {skrapport-colortheme-skdoc.sty}
98
99 % This is where the documentation begins
100 \begin{document}
101 % Change & version info
102 \version{0.12k}
103 \changes{0.01}{Initial version}
104 \changes{0.03}{Removed \cs{rd} and \cs{id}}
105 \changes{0.04}{Added \pkg{microtype} package}
106 \changes{0.05}{Improved documentation}
107 \changes{0.06}{Corrected cheksum, further improved documentation}
108 \changes{0.07}{Various bugfixes, \hologo{XeLaTeX} compatibility,
109 better float settings, quote style fix,
110 \opt{intlimits} option to \pkg{amsmath}}
111 \changes{0.07a}{Fixed \pkg{kpfonts} issues}
112 \changes{0.09}{Introduced \pkg{kvoptions},
113 fixed abstract in twocolumn mode}
114 \changes{0.10}{Include skmath if exists
115 and wanted. Gobble optional arguments to
116 \env{figure} and \env{table} in two-column mode}
117 \changes{0.10a}{Include \pkg{xparse} (fixes breakage)}
118 \changes{0.11}{Added \opt{minion} for Adobe Minion Pro font}
119 \changes{0.11a}{Added \opt{skdoc} font option and \thm{skdoc} color theme}
120 \changes{0.12}{Deprecated several macros, moved to \LaTeX3. Use of TOC depth above 3 is now unsupported}
121 \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
122 the default font stack on \hologo{XeLaTeX}}
123 \changes{0.12b}{Minor and major bugfixes to \cs{maketitle}, \opt{ptsize}, \opt{twocolumn} and others}
124 \changes{0.12c}{Added german language option, fixed sectioning macros in \opt{twocolumn} mode}
125 \changes{0.12d}{Added \opt{hanging-titles}, latin phrase macros. Load \pkg{isomath}. Don't load \pkg{icomma}. Use \cs{frenchspacing}}
126 \changes{0.12e}{Replace usage of deprecated \pkg{expl3} macros (thanks for the heads-up, Joseph Wright!)}
127 \changes{0.12f}{Fix incorrect usage of \pkg{xparse} macros}
128 \changes{0.12g}{Track \pkg{expl3} changes (thanks to Joseph Wright)}
129 \changes{0.12h}{Fix incompatibilities with recent \pkg{expl3}}
130 \changes{0.12i}{Track \pkg{expl3} changes (thanks to Joseph Wright)}
131 \changes{0.12j}{Track \pkg{expl3} changes (thanks to Phelype Oleinik). Replaces \pkg{opensans} option \opt{osfigures} with \opt{oldstyle}}
132 \changes{0.12k}{Don't try to generate \texttt{c}-variant macros from \texttt{n}-variant base forms}
133 % Don't forget to update the version number and release date of
134 % the package declaration in the implementation!
135
136 % Metadata
137 \package[ctan=skrapport,vcs=https://github.com/urdh/skrapport]{skrapport}
138 \title{The \textbf{\thepackage} document class}
139 \author{Simon Sigurdhsson}
140 \email{[email protected]}
141
142 % First page
143 \maketitle
144 \begin{abstract}
145 A document class intended for simple documents \emph{e.g.}
146 reports handed in to courses and such. It is small,
147 straight-forward and heavily inspired by the Prac\TeX{}
148 Journal style.
149 \end{abstract}
150 \tableofcontents
151
152 \section{Documentation}
153 The \thepackage\ document class aims to make typesetting simple but
154 stylish documents (mostly reports) as effortless as possible. It
155 does this by mostly reimplementing the default \pkg{article} class
156 in \LaTeX3, while making modifications to both form and function
157 along the way.
158
159 Because it is reimplemented in \LaTeX3, it may be incompatible with
160 any number of packages that patch or otherwise modify internals of
161 \pkg{article} or other document classes. For commonly used packages
162 (especially those used frequently by the author), this shouldn't be
163 a problem. The author gladly accepts reports of any such issues at
164 the project issue tracker --- see \enquote{Known issues} on
165 \vpageref{sec:issues}.
166
167 \subsection{Options}
168 As with other document classes, the class is loaded, possibly with
169 options, by issuing \Macro\documentclass[<options>]{skrapport}.
170 The class has a number of options controlling both form and function,
171 by \emph{e.g.} setting the font size, selecting a font stack, setting
172 the section title style, and so on.
173
174 \subsubsection{Layout}
175 Two options controlling the overall layout of the document are
176 provided. Collectively they control the paper size and text layout
177 of the document.
178
179 \Option{paper}\WithValues{a4, a5}\AndDefault{a4}
180 The \opt{paper} option controls the paper size of the document.
181 Internally, this is set by the \pkg{typearea} package, so in theory
182 many more paper sizes could be available, but the current options
183 cover most useful documents.
184
185 \Option{twocolumn}
186 The \opt{twocolumn} option sets up a two-column mode. This is not
187 provided by internal \LaTeX\ mechanics as in the original
188 \pkg{article} class, but instead by patching environments and macros
189 and using a combination of the \pkg{multicol} and \pkg{grid}
190 packages. In theory, this means that baselines of adjacent columns
191 should be aligned, and that three- or four-column modes are possible
192 in the future (but that'd be ridiculous).
193
194 \subsubsection{Style}
195 A couple of options to control the style of the document are
196 provided. Two of them, \opt{leqno} and \opt{fleqn}, are mainly
197 provided for compatibility with the \pkg{article} class.
198
199 \Option{leqno}
200 This option makes display math environments typeset their labels on
201 the left-hand side of the formula instead of the right-hand side.
202
203 \Option{fleqn}
204 This option makes display math environments left-align the entire
205 formula as opposed to centering it.
206
207 \Option{indent}\WithValues{true, false}\AndDefault{false}
208 The \opt{indent} option enables or disables the indentation of
209 paragraphs, with the default being not to indent anything. The
210 default behaviour thus is similar to that obtained using the
211 \pkg{parskip} package with the \pkg{article} package.
212
213 \Option{titles}\WithValues{rm, it, bf, sf}\AndDefault{bf}
214 Section titles (and a few other elements) are controlled by this
215 option in that they are typeset either using the regular roman font,
216 the boldfaced roman font or the sans serif font. For historical
217 reasons the default is a boldfaced roman font, but the sans serif
218 option is very handsome.
219
220 \Option{hanging-titles}\WithValues{true, false}\AndDefault{false}
221 This options allow sections to be set as \enquote{hanging} titles,
222 \emph{i.e.} with the section number in the margin.
223
224 \Option{color}\WithValues{\meta{color theme}}\AndDefault{default}
225 This option tells the class to activate color theme support and
226 optionally load a color theme. Several color themes are available
227 (as detailed by \enquote{Color themes} \vpageref{ssec:color}),
228 and the special value \texttt{false} disables color support
229 entirely (which only means that the \pkg{xcolor} package isn't
230 loaded, and that \cs{colortheme} remains undefined).
231
232 \subsubsection{Fonts}
233 Only two options control the font setup of the document class. The
234 class provides the same point sizes as \pkg{article}, but also
235 provides a large number of font stacks to choose from.
236
237 \Option{ptsize}\WithValues{10pt, 11pt, 12pt}\AndDefault{11pt}
238 The document class provides the same three point sizes as the
239 \pkg{article} class. There is room for expansion, but there really
240 shouldn't be any reason to use other point sizes.
241
242 \Option{font}\WithValues{none, kpfonts, lmodern, palatino, minion, skdoc, word}\AndDefault{kpfonts}
243 Several different font stacks, detailed by \vref{tab:font}, are
244 provided. Most of these work with \hologo{pdfLaTeX}, but there are
245 two special font stacks: \texttt{none} and \texttt{word}. The
246 former, predictably, loads no fonts whatsoever leaving the document
247 with Computer Modern fonts. This is useful if the fonts are replaced
248 later anyway, such as when using \hologo{XeLaTeX}.
249
250 The \texttt{word}
251 font stack, however, does load a few fonts. The fonts must be present
252 and installed on the system as OTF or TTF fonts, and the font stack
253 requires either \hologo{XeLaTeX} or \hologo{LuaLaTeX}.
254 Both \texttt{word} and \texttt{none} load the \pkg{fontspec}
255 package, assuming the document is compiled using \hologo{XeLaTeX}
256 or \hologo{LuaLaTeX}.
257
258 \Notice{The \texttt{skdoc} font stack doesn't have a math font.}
259 \Warning{Currently, \pkg{fontspec} is always loaded by
260 \hologo{XeLaTeX} regardless of options due to
261 the use of \pkg{polyglossia}. This means that
262 you \emph{have} to use OpenType fonts in your
263 document, otherwise \emph{only} Latin Modern
264 Roman (\emph{i.e.} no sans-serif or monospace
265 fonts) will be available. Therefore, the \texttt{word}
266 font stack is the default when using \hologo{XeLaTeX}.
267 \Hologo{LuaLaTeX} is not affected by this.}
268
269 \begin{table}[tp]
270 \centering
271 \caption{Font stacks provided by \thepackage.}
272 \label{tab:font}
273 \NewCoffin\tempcoffin\newlength\templength
274 \SetHorizontalCoffin\tempcoffin{
275 \begin{tabular}{lllll}
276 \toprule
277 Font stack & Serif font & Math font & Sans serif font & Monospace font \\
278 \midrule
279 \texttt{kpfonts} & Kp-Fonts & Kp-Fonts & Kp-Fonts & Kp-Fonts \\
280 \texttt{lmodern} & Latin Modern & Latin Modern & Latin Modern & Source Code Pro \\
281 \texttt{palatino} & \TeX\ Gyre & PX & Arev & Source Code Pro \\
282 \texttt{minion} & Minion Pro & Minion Pro & Myriad Pro & Source Code Pro \\
283 \texttt{skdoc} & PT Serif & --- & Open Sans & Source Code Pro \\
284 \texttt{word} & Cambria & Cambria Math & Calibri & Consolas \\
285 \bottomrule
286 \end{tabular}
287 }
288 \setlength{\templength}{(\textwidth - \CoffinWidth\tempcoffin)/2}
289 \hspace*{\templength}
290 \TypesetCoffin\tempcoffin
291 \end{table}
292
293 \subsubsection{Functionality}
294 The final three options affect functionality in one way or another.
295 Since \thepackage\ was originally designed for reports written in
296 either swedish or english, the class always loads either \pkg{babel}
297 or \pkg{polyglossia} with either of these languages. Additionally,
298 the class may load the \pkg{skmath} package if desirable.
299
300 \Option{nomath}\WithValues{true, false}\AndDefault{false}
301 When \texttt{false}, the \pkg{skmath} package is loaded, providing
302 improvements to the math functionality of \pkg{amsmath} and friends.
303
304 \Option{lang}\WithValues{en, sv, de}\AndDefault{sv}
305 This option specifies what main language \pkg{babel} or
306 \pkg{polyglossia} set up with. English (or swedish, for
307 \texttt{lang=en}) is loaded as well, for use in constructs
308 that allow for a second language.
309
310 \Option{draft}\WithValues{true, false}\AndDefault{false}
311 The \opt{draft} option, much like in \pkg{article}, enables
312 \cs{overfullrule}s and possibly similar functionality in loaded
313 packages (if they react to the global \opt{draft} option).
314
315 \subsection{User-level commands and environments}
316 The general idea behind the document class is to provide most
317 (if not all) of the macros provided by the standard \LaTeXe{}
318 classes, as well as additional macros to simplify and beautify
319 the documents produced. As such, most of the documentation that
320 follows details macros that are present in the standard document
321 classes. Some of them have changed functionality or semantics,
322 so at least a skim through this section is recommended.
323
324 \subsubsection{The front page}
325 The front page is the part of the document that has seen the most
326 changes in \thepackage\ compared to \pkg{article}. In addition to
327 the new, Prac\TeX-inspired layout, there are a few additional
328 pieces of information in it. Also, the \cs{author} macro has been
329 dramatically improved.
330
331 \DescribeMacro\date{<ISO8601 date>}
332 The \cs{date} macro now internally employs \pkg{isodate} to typeset
333 the date of the document. This means that the input must be either
334 the string \enquote{today}, the token \cs{today} or a date as defined
335 by ISO8601\footcite{ISO8601}. The mechanisms provided by
336 \pkg{isodate} can be used to affect the output format.
337
338 \DescribeMacro\author[<email>]{<name>}
339 In contrast with the \pkg{article} package, the \cs{author} macro
340 should no longer be used to typeset several author names at once.
341 Instead, one \cs{author} command is to be issued for every author,
342 optionally providing a corresponding email. These are then combined,
343 in the order they are given, to form a list of authors and a
344 corresponding list of email adresses.
345
346 \DescribeMacro\regarding{<topic>}
347 This macro defines a topic or other short message detailing the
348 purpose of the document. It is typeset along with the date in the
349 upper left corner of the title page.
350
351 \DescribeMacro\license{<license name>}
352 The \cs{license} macro defines a short license name to be typeset
353 in the lower right corner of the title page. This mechanism could of
354 course be used to typeset an institution name or similar as well.
355 It is only typeset when also using the \env{titlepage} environment
356 described below.
357
358 \DescribeMacro\title{<document title>}
359 The \cs{title} macro, while not defined by \pkg{skrapport}, is
360 relevant to describe. It simply sets the title of the document, as
361 displayed by \cs{maketitle}.
362
363 \DescribeMacro\maketitle[hide=\{date,regarding,email\},nopdfinfo]
364 As in \pkg{article}, the \cs{maketitle} macro typesets the
365 information provided by \cs{title}, \cs{author} and friends to form
366 a stylish front page. When combined with \env{abstract},
367 \env{titlepage} and/or \cs{tableofcontents}, you get a very
368 good-looking preamble with almost no effort.
369
370 The optional argument is a key-value list with two valid entries,
371 \opt*{hide} and \opt*{nopdfinfo}. The \opt*{hide} entry accepts a
372 comma-separated list in which the values \opt*{date},
373 \opt*{regarding} and \opt*{email}
374 are interpreted as instructions to hide the corresponding entry from
375 the front page. The \opt*{nopdfinfo} key disables the generation of
376 PDF information by \pkg{hyperref}.
377
378 \DescribeEnv[<abstract text>]{abstract}
379 The \env{abstract} environment defines an abstract, which is typeset
380 in a block with the \cs{abstractname} word next to it (see
381 \emph{e.g.} the title page of this manual for an example).
382
383 \DescribeEnv[<title page contents>]{titlepage}
384 Normally, \cs{maketitle} doesn't reserve its own page. By enclosing
385 \cs{maketitle} (and \env{abstract} if appropriate) in the
386 \env{titlepage} environment, the contents are typeset on their
387 own page, without page numbering and with the \cs{license} text
388 in the lower right corner (if applicable).
389
390 \subsubsection{Sectioning}
391 \DescribeMacro\section*[<short title>]{<title>}
392 \DescribeMacro\subsection*[<short title>]{<title>}
393 \DescribeMacro\subsubsection*[<short title>]{<title>}
394 \DescribeMacro\paragraph*[<short title>]{<title>}
395 \DescribeMacro\subparagraph*[<short title>]{<title>}
396 The sectioning macros are superficially very similar to those
397 provided by \pkg{article}, but have been completely reimplemented
398 in \pkg{expl3} code. Additionally, the style of these sectioning
399 macros, as detailed by the \opt{titles} option documentation above,
400 can be changed.
401
402 All of them have both arguments and behaviour in common, only
403 differing in style. The starred versions are unnumbered, but still
404 accept the opional short title (simply discarding it). The optional
405 short title is used in the table of contents. The
406 \texttt{secnumdepth} counter limits the depth of section numbering.
407
408 The first three macros, being section titles, are typeset as actual
409 titles on their own line with appropriate spacing above and below.
410 The paragraph macros instead typeset run-in titles.
411
412 \subsubsection{Macros and environments from \pkg{article}}
413 Aside from the \env{itemize} and \env{enumerate} envionments and the
414 font selection macros, which are carried without modification from
415 \LaTeXe, a couple of environments and macros are defined.
416
417 The old font macros, whose use has been discouraged for a long time,
418 are now deprecated. Instead of functioning correctly, they will emit
419 an error and require user input. Use the \cs*{text??}/\cs*{??family}
420 macros instead. For emphasis, use the \cs{emph} macro.
421
422 \DescribeMacro\emph{<text>}
423 Emphasized text will be typeset in italic, or bold italic if the
424 macro is used in a context where italic is already used (such as
425 inside another \cs{emph} invokation).
426
427 \DescribeEnv[\cs*{item}\oarg{item} \meta{description}]{description}
428 The \env{description} environment behaves as expected, typesetting
429 a list of descriptions as in the \pkg{article} class.
430
431 \DescribeEnv[<short quote>]{quote}
432 Intended for short quotes, the \env{quote} environment simply
433 typesets a centered block of italic text.
434
435 \DescribeEnv[<long quote>]{quotation}
436 Longer quoted passages are typeset using the \env{quotation}
437 environment. This is simply a \env{quote} environment with additional
438 spacing above and below.
439
440 \DescribeEnv[<pretentious poetry>]{verse}
441 The \env{verse} environment is intended for poetry and other text
442 where line breaks are critical. Use \verb|\\| to break
443 lines.
444
445 \DescribeMacro\appendix
446 This macro signals the end of the main matter and the start of
447 the appendix. In essence, it resets the section numbering counter
448 and changes the section numbering to the upper-case alphabetic
449 sequence.
450
451 \subsubsection{Floats}
452 Both the \env{figure} and \env{table} float environments accept an
453 optional positioning argument. The default positioning is
454 \texttt{tp}. Both environments also have starred variants, which
455 do nothing in one-column mode while typesetting the figure across
456 both columns in two-column mode. As usual, \cs{centering},
457 \cs{caption} and \cs{label} should be used inside the floats.
458
459 \DescribeEnv[<content>]{figure}[position]
460 This float environment is intended for figures. The most common
461 contents are \cs{includegraphics} statements or \env{tikzpicture}
462 environments.
463
464 \DescribeEnv[<content>]{table}[position]
465 A float intended for tables. Probably contains \env{tabular}s.
466
467 \DescribeEnv{figcenter}
468 This environment is useful for wide figures and tables. It typesets
469 its contents centered horizonally, but allows the content to extend
470 into the margin. The content is set in a horizontal coffin.
471
472 \subsubsection{Table of contents}
473 \DescribeMacro\tableofcontents
474 The table of contents are typeset using this macro. The
475 \texttt{tocdepth} counter limits the depth of the table of
476 contents, but for stylistic reasons values higher than 3 are
477 unsupported.
478
479 % \subsubsection{Basic bibliography support}
480
481 \subsubsection{Miscellaneous}
482 \DescribeMacro\comment*{<comment>}
483 \DescribeMacro\note*{<comment>}
484 \DescribeMacro\com*{<comment>}
485 These macros, the two latter being aliases of the first one, typeset
486 an author's comment in the document. The starred variants typeset the
487 comment inline with a red background, while the unstarred variant
488 typesets the comment in a \cs{marginpar}.
489
490 \DescribeMacro\eg
491 \DescribeMacro\ie
492 \DescribeMacro\etc
493 \DescribeMacro\cf
494 \DescribeMacro\viz
495 These macro print the abbreviation of the latin phrases
496 \emph{exempli gratia}, \emph{id est}, \emph{et cetera},
497 \emph{confer} and \emph{videlicet}, respectively.
498 The macros peek ahead to find punctuation marks and spaces, so they
499 should behave correctly regardless of usage (assuming they're used in
500 running text and uncomplicated settings). In languages other than
501 english, appropriate translations are made if applicable.
502
503 \DescribeMacro\dash
504 This macro prints an em-dash surrounded by thin spaces, as discussed
505 by \textcite[\pno~8]{Flynn}. When \cs*{DeclareUnicodeCharacter} is
506 available, the real em dash uses this definition.
507
508 \subsubsection{Color theme support}
509 \DescribeMacro\colortheme{<theme>}
510 The \cs{colortheme} macro, which is only available when the
511 \opt{color} option is \texttt{true}, applies a color theme to
512 the document. For a list of available color themes, see
513 \enquote{Color themes} \vpageref{ssec:color}.
514
515 \subsubsection{Font size macros}
516 The font size macros, expectedly, set the size of the text. They
517 do not take arguments, instead affecting all subsequent text of the
518 current \TeX\ group, so use braces to provide and limit context.
519 Also note that unlike \pkg{article}, these macros are \emph{all}
520 available, regardless of point size option.
521
522 \DescribeMacro\tiny
523 Typesets {\tiny tiny} text.
524 \DescribeMacro\scriptsize
525 Typesets {\scriptsize script-size} text.
526 \DescribeMacro\footnotesize
527 Typesets {\footnotesize footnote-sized} text.
528 \DescribeMacro\small
529 Typesets {\small small} text.
530 \DescribeMacro\normalsize
531 Typesets normal text.
532 \DescribeMacro\large
533 Typesets {\large large} text.
534 \DescribeMacro\Large
535 Typesets {\Large slightly larger} text.
536 \DescribeMacro\LARGE
537 Typesets {\LARGE even larger} text.
538 \DescribeMacro\huge
539 Typesets {\huge huge} text.
540 \DescribeMacro\Huge
541 Typesets {\Huge really huge} text.
542
543 \subsection{Color themes}\label{ssec:color}
544 \DescribeMacro\colortheme{<theme>}
545 If the package is loaded with the \opt{color} option, changing the color theme is
546 possible using \cs{colortheme}, which loads an
547 appropriate package. At the moment, four color themes are available.
548
549 \Theme{default}
550 The \thm{default} theme is fairly conservative, only coloring
551 \pkg{hyperef} links with more readable, slightly darker colors than
552 the standard ones. It should print well even on non-color printers.
553
554 \Theme{unscathed}
555 The \thm{unscathed} theme is based on a palette with the same
556 name on COLOURlovers%
557 \footnote{\url{http://www.colourlovers.com/palette/1440498/unscathed}},
558 and applies a \textcolor[HTML]{463335}{dark brown} color to
559 emphasized text, a \textcolor[HTML]{CF5D3B}{rusty} color to links,
560 a \textcolor[HTML]{B34430}{darker rust} color to titles and a
561 \textcolor[HTML]{70524A}{lighter brown} to quotes.
562
563 \Theme{cruelwater}
564 The \thm{cruelwater} theme is also based on a palette from
565 COLOURlovers%
566 \footnote{\url{http://www.colourlovers.com/palette/126030/Cruel_Water_at_Night}},
567 and applies a \textcolor[HTML]{030C22}{dark blue} color to bold
568 text and captions, a \textcolor[HTML]{20293F}{slightly less dark
569 blue} to titles and emphasized text, a \textcolor[HTML]{A9B0B3}{
570 light gray} color to small print and a \textcolor[HTML]{404749}{
571 darker gray} to quotes.
572
573 \Theme{violet}
574 The \thm{violet} theme, like \thm{unscathed} and \thm{cruelwater},
575 is based on a COLOURlovers palette%
576 \footnote{\url{http://www.colourlovers.com/palette/1831303/Violet_White_Bedrm}}.
577 It colors all links \textcolor[HTML]{932444}{bright purple}, applies
578 a \textcolor[HTML]{311A2A}{dark puple} color to titles, bold text
579 and captions, a \textcolor[HTML]{D6CBCF}{grayish purple} to small
580 print, a \textcolor[HTML]{463335}{dark brown} color to quotes and a
581 \textcolor[HTML]{98758D}{pastel violet} color to emphasized text.
582
583 \Theme{skdoc}
584 The \thm{skdoc} theme is loosely based on the \pkg{skdoc} document class, with which this documentation is typeset.
585
586 % \subsection{Additional information}
587 % The document class includes a number of packages by default. This
588 % is useful to know, since passing explicit options to these packages
589 % will require you to utilize the \cs{PassOptionsToPackage} macro
590 % before you load the class using \cs{documentclass}.
591 % Table~\ref{tab:pkgs} lists the packages included by \thepkg\ along
592 % with their options (if applicable).
593 %
594 % \begin{table}[tbp]
595 % \centering
596 % \caption{User-level packages included by \thepkg.}
597 % \label{tab:pkgs}
598 % \begin{tabular}{llp{15em}}
599 % \toprule
600 % \textbf{Package} & \textbf{Options} & \textbf{Comments} \\
601 % \midrule
602 % \pkg{amsmath} & \texttt{intlimits} & Provides \hologo{AmS} commands and environments. \\
603 % \pkg{amssymb} & & Only if not using \opt{kpfonts}.\\
604 % \pkg{babel} & see options \opt{swe} and \opt{eng} & Only loaded if \emph{not} using \hologo{XeTeX}.\\
605 % \pkg{calc} & & \\
606 % \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). \\
607 % \pkg{fontspec} & \texttt{quiet} & Only loaded if using \hologo{XeTeX}. Provides basic OTF font selection commands.\\
608 % \pkg{geometry} & \texttt{a4paper} or \texttt{a5paper} & This is used by the \opt{paper} option to set the paper area. \\
609 % \pkg{icomma} & & \\
610 % \pkg{inconsolata} & & \\
611 % \pkg{microtype} & & Provides micro-typographic improvements.\\
612 % \pkg{multicol} & & Only loaded with the \opt{twocolumn} option. \\
613 % \pkg{polyglossia} & see options \opt{swe} and \opt{eng} & Only loaded if using \hologo{XeTeX}.\\
614 % \pkg{skmath} & & Only if it exists and \opt{nomath} isn't set.\\
615 % \pkg{textcomp} & & Only if not using \opt{kpfonts}.\\
616 % \pkg{xcolor} & & Only loaded with the \opt{color} option.\\
617 % \bottomrule
618 % \end{tabular}
619 % \end{table}
620
621 \section{Known issues}\label{sec:issues}
622 A list of current issues is available in the Github repository of this
623 package\footnote{\url{https://github.com/urdh/skrapport/issues}}, but as
624 of the release of \theversion, there is one known issue:
625 \begin{description}
626 % \item[\#6] ???
627 \item[--] If a \cs{subsubsection} is the last item of the Table
628 of Contents, it will not be indented properly.
629 \end{description}
630
631 If you discover any bugs in this package, please report them to the issue
632 tracker in the \thepackage\ Github repository.
633
634 \Implementation\ExplHack
635 \section{Implementation}
636 Start by including \pkg{expl3}, \pkg{l3keys2e} and some other
637 useful packages, as well as declaring the class.
638 \begin{MacroCode}{class}
639 \RequirePackage{expl3,l3keys2e,xparse,xstring,etoolbox}
640 \ProvidesExplClass{skrapport}%
641 {2019/10/15}{0.12k}{stylish report document class}
642 \end{MacroCode}
643
644 \subsection{Messages}
645 Tons of messages are declared for future use.
646 \begin{MacroCode}{class}
647 \msg_new:nnnn{skrapport}{option-deprecated}{Option~`#1'~deprecated!}
648 {Please~use~`#2'~instead.}
649 \msg_new:nnnn{skrapport}{option-no-effect}{Option~`#1'~deprecated!}
650 {It~has~no~effect;~simply~use~nothing~instead.}
651 \msg_new:nnnn{skrapport}{invalid-paper-size}{Invalid~paper~size~`#1'!}
652 {\token_to_str:N\__skrapport_setup_paper:n~was~invoked~with~an~
653 invalid~argument;~paper~size~will~remain~unchanged.}
654 \msg_new:nnnn{skrapport}{invalid-point-size}{Invalid~point~size~`#1'!}
655 {\token_to_str:N\__skrapport_setup_ptsize:n~was~invoked~with~an~
656 invalid~argument;~cannot~continue~without~setting~a~valid~point~
657 size.~Please~fix~the~issue~before~typesetting~again.}
658 \msg_new:nnnn{skrapport}{invalid-titles}{Invalid~title~type~`#1'!}
659 {\token_to_str:N\__skrapport_setup_titles:n~was~invoked~with~an~
660 invalid~argument;~falling~back~to~`#2'.}
661 \msg_new:nnnn{skrapport}{invalid-lang}{Invalid~language~`#1'!}
662 {\token_to_str:N\__skrapport_setup_lang:n~was~invoked~with~an~
663 invalid~argument;~`babel'~and/or~`polyglossia'~will~remain~
664 unloaded.}
665 \msg_new:nnnn{skrapport}{invalid-font}{Invalid~font~`#1'!}
666 {\token_to_str:N\__skrapport_setup_font:n~was~invoked~with~an~
667 invalid~argument;~no~font~package~has~been~loaded.~This~may~result~
668 in~bad~rendering~due~to~old~Computer~Modern~fonts.}
669 \msg_new:nnnn{skrapport}{noop-call}{No-op~invokation~of~macro!}
670 {\token_to_str:N#1~was~invoked,~but~circumstances~dictate~that~the~
671 macro~should~do~nothing.~Will~do~\token_to_str:N\prg_do_nothing:~
672 instead.}
673 \msg_new:nnnn{skrapport}{old-font-deprecated}{Deprecated~macro~\token_to_str:N#1!}
674 {The~old~font~macro~\token_to_str:N#1~is~deprecated!~Use~
675 \token_to_str:N#2~instead.}
676 \msg_new:nnnn{skrapport}{color-patch-failed}{Could~not~patch~macro~\token_to_str:N#1!}
677 {The~macro~\token_to_str:N#1~could~not~be~patched!~Color~theme~
678 support~may~be~incomplete.}
679 \msg_new:nnnn{skrapport}{license-not-printed}{Detected~\token_to_str:N\license\ but~no~`titlepage'!}
680 {The~text~provided~by~\token_to_str:N\license\ is~only~printed~when~
681 the~`titlepage'~environment~is~used,~but~it~seems~to~be~missing.}
682 \msg_new:nnnn{skrapport}{font-requires-xetex}{The~`font=#1'~option~requires~XeTeX~or~luaTeX!}
683 {Please~choose~another~font~setup~or~compile~the~document~with~
684 either~xelatex~or~lualatex.}
685 \msg_new:nnnn{skrapport}{tocdepth-too-deep}{TOC~depth~is~too~deep!}
686 {The~current~tocdepth,~#1,~is~not~supported.~Please~redefine~the~
687 \token_to_str:N#2~macro~to~enable~support.}
688 \msg_new:nnnn{skrapport}{caption-in-figcenter}{Cannot~use~\token_to_str:N\caption\ here!}
689 {The~\token_to_str:N\caption\ macro~can't~be~used~inside~figcenter~environments!~Please~move~the~caption~to~the~enclosing~float~environment.}
690 \end{MacroCode}
691 This message should probably not be used at all. Except in
692 development versions straight off Github, of course.
693 \begin{MacroCode}{class}
694 \msg_new:nnn{skrapport}{not-implemented}
695 {Unimplemented~macro~\token_to_str:N#1!}
696 \end{MacroCode}
697
698 \subsection{Options}
699 First, a few booleans used by parts of the option handling code.
700 \begin{macro}{\g__skrapport_draft_bool}
701 Are we in \opt{draft} mode?
702 \begin{MacroCode}{class}
703 \bool_new:N\g__skrapport_draft_bool
704 \end{MacroCode}
705 \end{macro}
706 \begin{macro}{\g__skrapport_color_bool}
707 Are we supposed to be using \opt{color}s?
708 \begin{MacroCode}{class}
709 \bool_new:N\g__skrapport_color_bool
710 \end{MacroCode}
711 \end{macro}
712 \begin{macro}{\g__skrapport_has_polyglossia_bool}
713 Has \pkg{polyglossia} been loaded?
714 \begin{MacroCode}{class}
715 \bool_new:N\g__skrapport_has_polyglossia_bool
716 \end{MacroCode}
717 \end{macro}
718
719 \subsubsection{Option setup macros}
720 In this section, all options declared in the previous section are
721 implemented using setup macros. Some of these may have to be called
722 in an appropriate order, but I haven't checked that yet.
723
724 \begin{macro}{\__skrapport_setup_paper:n}[1]
725 {Paper size (\texttt{a4} or \texttt{a5})}
726 \changes{0.12}{Use \pkg{typearea} to set paper size}
727 Note the extra integer, which is set up for use with \pkg{grid}.
728 \begin{macro*}{\g__skrapport_grid_lines_int}
729 \begin{MacroCode}{class}
730 \int_new:N\g__skrapport_grid_lines_int
731 \end{MacroCode}
732 \end{macro*}
733 \begin{MacroCode}{class}
734 \cs_new:Npn\__skrapport_setup_paper:n#1{
735 \str_case:nnF{#1}{
736 \end{MacroCode}
737 The two options simply consist of passing the appropriate option
738 to the \pkg{typearea} package. Note that the use of \pkg{typearea}
739 mean that we theoretically could accept more paper size options.
740 \begin{MacroCode}{class}
741 {a4}{
742 \PassOptionsToPackage{paper=A4}{typearea}
743 \int_gset:Nn\g__skrapport_grid_lines_int{40}
744 }
745 {a5}{
746 \PassOptionsToPackage{paper=A5}{typearea}
747 \int_gset:Nn\g__skrapport_grid_lines_int{28}
748 }
749 }{
750 \end{MacroCode}
751 Invalid paper sizes (such calls should never happen) are
752 handled by issuing a warning and hoping that the default
753 paper size is acceptable.
754 \begin{MacroCode}{class}
755 \msg_warning:nnn{skrapport}{invalid-paper-size}{#1}
756 }
757 \end{MacroCode}
758 The \pkg{typearea} package is loaded with the options specified
759 earlier through \cs{PassOptionsToPackage}, and some additional ones.
760 \begin{MacroCode}{class}
761 \AtEndOfClass{\RequirePackage[DIV=calc]{typearea}}
762 \end{MacroCode}
763 In case the point size changes later, or two column mode is
764 activated, we recalculate the typearea just before the typesetting
765 begins.
766 \begin{MacroCode}{class}
767 \AtBeginDocument{\recalctypearea}
768 }
769 \end{MacroCode}
770 \end{macro}
771
772 \begin{macro}{\__skrapport_setup_ptsize:n}[1]
773 {Point size (\texttt{10pt}, \texttt{11pt} or \texttt{12pt})}
774 The standard point sizes are defined much like in the \pkg{article}
775 class, \emph{i.e.} by saving a number and loading \file{size10.clo},
776 \file{size11.clo} or \file{size12.clo} as appropriate
777 \begin{MacroCode}{class}
778 \cs_new:Npn\__skrapport_setup_ptsize:n#1{
779 \str_case:nnF{#1}{
780 \end{MacroCode}
781 \begin{macro*}{\c__skrapport_ptsize_token}
782 \begin{MacroCode}{class}
783 {10pt}{\int_const:Nn\c__skrapport_ptsize_int{0}}
784 {11pt}{\int_const:Nn\c__skrapport_ptsize_int{1}}
785 {12pt}{\int_const:Nn\c__skrapport_ptsize_int{2}}
786 \end{MacroCode}
787 \end{macro*}
788 \begin{MacroCode}{class}
789 }{
790 \end{MacroCode}
791 Invalid point sizes are critical errors, since we can't recover
792 from them in any reasonable way. Loading a default point size is
793 unreasonable, since all in-class calls to this macro should know
794 what sizes are available, and if you're calling it with invalid
795 parameters from elsewhere, you should be punished.
796 \begin{MacroCode}{class}
797 \msg_critical:nnn{skrapport}{invalid-point-size}{#1}
798 }
799 \file_input:n{skrapport-size#1.clo}
800 }
801 \end{MacroCode}
802 \end{macro}
803
804 \begin{macro}{\__skrapport_setup_twocolumn:}
805 \changes{0.12c}{Major changes to the sectioning commands, to
806 override what \pkg{grid} is doing}
807 Setting up for twocolumn mode is slightly compliacted. Note that this
808 macro should be called from \cs{AtEndOfClass} to ensure that we patch
809 everything correctly. Note also that \pkg{multicol} is always loaded
810 as it is used for the \env{theindex} environment.
811 \begin{MacroCode}{class}
812 \cs_new:Nn\__skrapport_setup_twocolumn:{
813 \RequirePackage{etoolbox}
814 \AtBeginDocument{
815 \KOMAoptions{twocolumn=false,DIV=12}
816 }
817 \end{MacroCode}
818 We include the \pkg{grid} package in two-column mode, because
819 it looks way better that way.
820 \begin{MacroCode}{class}
821 \int_set:Nn\l_tmpa_int{10+\c__skrapport_ptsize_int}
822 \int_set:Nn\l_tmpb_int{12*\l_tmpa_int/10}
823 \RequirePackage[fontsize=\l_tmpa_int pt,
824 baseline=\l_tmpb_int pt,
825 lines=\g__skrapport_grid_lines_int]{grid}
826 \end{MacroCode}
827 Now, we patch commands. First up is \env{abstract}. Save the old
828 one in case we need it (we do).
829 \begin{MacroCode}{class}
830 \cs_set_eq:Nc\__skrapport_onecol_abstract:{environment~abstract~code}
831 \cs_set_eq:Nc\__skrapport_end_onecol_abstract:{environment~abstract~end~aux~}
832 \pretocmd{\__skrapport_onecol_abstract:}{\null}{}{}
833 \RenewDocumentEnvironment{abstract}{}{\section*{\abstractname}}{}
834 \end{MacroCode}
835 Then \env{document} (kind of, at least) and \cs{maketitle}. Again,
836 save the old \cs{maketitle}.
837 \begin{MacroCode}{class}
838 \AfterEndPreamble{\begin{multicols}{2}}
839 \AtEndDocument{\end{multicols}}
840 \cs_set_eq:NN\__skrapport_onecol_maketitle:\maketitle
841 \pretocmd{\maketitle}{\begin{onecol}}{}{}
842 \apptocmd{\maketitle}{\end{onecol}}{}{}
843 \end{MacroCode}
844 Next up is \env{titlepage}. This is where we need the saved
845 \env{abstract} and \cs{maketitle}.
846 \begin{MacroCode}{class}
847 \BeforeBeginEnvironment{titlepage}{
848 \begin{onecol}
849 \cs_set_eq:cN{environment~abstract~code}\__skrapport_onecol_abstract:
850 \cs_set_eq:cN{environment~abstract~end~aux~}\__skrapport_end_onecol_abstract:
851 \cs_set_eq:NN\maketitle\__skrapport_onecol_maketitle:
852 }
853 \AfterEndEnvironment{titlepage}{\end{onecol}}
854 \end{MacroCode}
855 Always typeset \env{equation} and friends outside the grid:
856 \begin{MacroCode}{class}
857 \BeforeBeginEnvironment{equation}{\begin{gridenv}}
858 \AfterEndEnvironment{equation}{\end{gridenv}}
859 \BeforeBeginEnvironment{equation*}{\begin{gridenv}}
860 \AfterEndEnvironment{equation*}{\end{gridenv}}
861 \BeforeBeginEnvironment{multline}{\begin{gridenv}}
862 \AfterEndEnvironment{multline}{\end{gridenv}}
863 \BeforeBeginEnvironment{multline*}{\begin{gridenv}}
864 \AfterEndEnvironment{multline*}{\end{gridenv}}
865 \BeforeBeginEnvironment{gather}{\begin{gridenv}}
866 \AfterEndEnvironment{gather}{\end{gridenv}}
867 \BeforeBeginEnvironment{gather*}{\begin{gridenv}}
868 \AfterEndEnvironment{gather*}{\end{gridenv}}
869 \BeforeBeginEnvironment{align}{\begin{gridenv}}
870 \AfterEndEnvironment{align}{\end{gridenv}}
871 \BeforeBeginEnvironment{align*}{\begin{gridenv}}
872 \AfterEndEnvironment{align*}{\end{gridenv}}
873 \BeforeBeginEnvironment{flalign}{\begin{gridenv}}
874 \AfterEndEnvironment{flalign}{\end{gridenv}}
875 \BeforeBeginEnvironment{flalign*}{\begin{gridenv}}
876 \AfterEndEnvironment{flalign*}{\end{gridenv}}
877 \BeforeBeginEnvironment{alignat}{\begin{gridenv}}
878 \AfterEndEnvironment{alignat}{\end{gridenv}}
879 \BeforeBeginEnvironment{alignat*}{\begin{gridenv}}
880 \AfterEndEnvironment{alignat*}{\end{gridenv}}
881 \end{MacroCode}
882 Since \pkg{grid} override the usual sectioning macros, we have to
883 provide fixed and improved variants that conform to our style
884 and out public API. This is only necessary for
885 the \enquote{major} sectioning macros, not \cs*{paragraph} and
886 \cs*{subparagraph}.
887 \begin{macro*}{\section}
888 \begin{MacroCode}{class}
889 \skip_gset:Nn\c__skrapport_section_pre_skip{-.999\baselineskip}
890 \skip_gset:Nn\c__skrapport_section_post_skip{0.001\baselineskip}
891 \dim_gset:Nn \c__skrapport_section_indent_dim{\c_zero_dim}
892 \cs_set_protected:Nn\__skrapport_section_style:
893 {\normalfont\__skrapport_title_style:}
894 \DeclareDocumentCommand\section{som}{
895 \__skrapport_generic_section:nnnnn{section}{1}{##1}{##2}{##3}
896 }
897 \end{MacroCode}
898 \end{macro*}
899 \begin{macro*}{\subsection}
900 \begin{MacroCode}{class}
901 \skip_gset:Nn\c__skrapport_subsection_pre_skip{\baselineskip}
902 \skip_gset:Nn\c__skrapport_subsection_post_skip{-.35\baselineskip}
903 \dim_gset:Nn \c__skrapport_subsection_indent_dim{\c_zero_dim}
904 \cs_set_protected:Nn\__skrapport_subsection_style:
905 {\normalfont\__skrapport_title_style:\unskip}
906 \DeclareDocumentCommand\subsection{som}{
907 \__skrapport_generic_section:nnnnn{subsection}{2}{##1}{##2}{##3}
908 }
909 \end{MacroCode}
910 \end{macro*}
911 \begin{macro*}{\subsubsection}
912 \begin{MacroCode}{class}
913 \skip_gset:Nn\c__skrapport_subsubsection_pre_skip{\baselineskip}
914 \skip_gset:Nn\c__skrapport_subsubsection_post_skip{-.35\baselineskip}
915 \dim_gset:Nn \c__skrapport_subsubsection_indent_dim{\c_zero_dim}
916 \cs_set_protected:Nn\__skrapport_subsubsection_style:
917 {\normalfont\itshape\__skrapport_title_style:\unskip}
918 \DeclareDocumentCommand\subsubsection{som}{
919 \__skrapport_generic_section:nnnnn{subsubsection}{3}{##1}{##2}{##3}
920 }
921 \end{MacroCode}
922 \end{macro*}
923 We also redefine \cs{l@section} to make the TOC blend in a bit.
924 \begin{macro*}{\l@section}
925 \begin{MacroCode}{class}
926 \DeclareDocumentCommand\l@section{mm}{
927 \group_begin:
928 \skip_vertical:n{.75ex}
929 \__skrapport_title_style:
930 \__skrapport_toc_line:nnnnn{1}{0em}{1.3em}{##1}{
931 \__skrapport_title_style: ##2
932 }
933 \group_end:
934 }
935 \end{MacroCode}
936 \end{macro*}
937 The \env{figure} environment is patched\ldots
938 \begin{MacroCode}{class}
939 \cs_new:Npn\__skrapport_xdblfloat:nn##1##2{\@xdblfloat{##1}[##2]}
940 \cs_generate_variant:Nn\__skrapport_xdblfloat:nn{nx}
941 \RenewDocumentEnvironment{figure}{o}{
942 \begin{gridenv}
943 \vspace{\intextsep}
944 \begin{minipage}{\linewidth}
945 \cs_set:Npn\@captype{figure}
946 \centering
947 }{
948 \end{minipage}
949 \vspace{\intextsep}
950 \end{gridenv}
951 }
952 \RenewDocumentEnvironment{figure*}{o}{
953 \__skrapport_xdblfloat:nx{figure}
954 {\IfNoValueTF{##1}{tp}{##1}}
955 \dim_set_eq:NN\hsize\textwidth
956 \dim_set_eq:NN\linewidth\textwidth
957 \centering
958 }{
959 \end@dblfloat
960 }
961 \end{MacroCode}
962 \ldots as is \env{table}.
963 \begin{MacroCode}{class}
964 \RenewDocumentEnvironment{table}{o}{%
965 \begin{gridenv}
966 \vspace{\intextsep}
967 \begin{minipage}{\linewidth}
968 \cs_set:Npn\@captype{table}
969 \cs_set_eq:NN\__skrapport_old_caption:\caption
970 \RenewDocumentCommand{\caption}{om}{%
971 \skip_set_eq:NN\l_tmpa_skip\abovecaptionskip
972 \skip_set_eq:NN\abovecaptionskip\belowcaptionskip
973 \skip_set_eq:NN\belowcaptionskip\l_tmpa_skip
974 \vspace{\abovecaptionskip}
975 \__skrapport_old_caption:[####1]{####2}
976 \vspace{\belowcaptionskip}
977 }
978 \centering
979 }{
980 \end{minipage}
981 \vspace{\intextsep}
982 \end{gridenv}
983 }
984 \RenewDocumentEnvironment{table*}{o}{
985 \__skrapport_xdblfloat:nx{table}
986 {\IfNoValueTF{##1}{tp}{##1}}
987 \dim_set_eq:NN\hsize\textwidth
988 \dim_set_eq:NN\linewidth\textwidth
989 \centering
990 }{
991 \end@dblfloat
992 }
993 \end{MacroCode}
994 \begin{environment}{onecol}
995 \changes{0.10}{Fixed, now not completely broken}
996 \changes{0.12b}{Reverted to \cs{newenvironment}, because \pkg{xparse} breaks the trickery}
997 Finally, we define an environment \env{onecol} that typesets
998 arbitrary material in a single column. This is a bit tricky to
999 do, and probably cargo-cult as well. We define the start of the
1000 environment to immediately end itself (with the empty ending),
1001 then end the \env{multiols} environment, redefine our end macro
1002 to start \env{multicols} as well as redefining the start of
1003 \env{onecol} to simply reset itself, then start the environment
1004 again only to have it ended at once.
1005
1006 Basically, we trick \LaTeX\ into thinking that we have an empty
1007 \env{onecol} environment at the end of the first \env{multicols},
1008 then some content inside a fake \env{onecol}, then an empty
1009 \env{onecol} at the start of the next \env{multicols}. Voilá, no
1010 wierd group errors!
1011 \begin{MacroCode}{class}
1012 \newenvironment{onecol}{
1013 \end{onecol}
1014 \end{multicols}
1015 \group_begin:
1016 \cs_set:Npn\endonecol{
1017 \group_end:
1018 \begin{multicols}{2}
1019 \cs_set_eq:NN\__skrapport_old_onecol:\onecol
1020 \cs_set:Npn\onecol{
1021 \cs_set_eq:NN\onecol\__skrapport_old_onecol:
1022 }
1023 \begin{onecol}
1024 }
1025 \cs_set:Npn\onecol{}
1026 \begin{onecol}
1027 }{}
1028 \end{MacroCode}
1029 \end{environment}
1030 \begin{MacroCode}{class}
1031 }
1032 \end{MacroCode}
1033 \end{macro}
1034
1035 \begin{macro}{\__skrapport_setup_leqno:}
1036 Instead of loading \file{leqno.clo}, we reimplement the (tiny) file
1037 as LaTeX3 code and include it directly. It's not terribly advanced.
1038 \begin{MacroCode}{class}
1039 \cs_new:Nn\__skrapport_setup_leqno:{
1040 \RenewDocumentCommand\@eqnnum{}{
1041 \hbox_to_wd:nn{.01pt}{}
1042 \hbox_overlap_right:n{
1043 \normalfont\normalcolor
1044 \skip_horizontal:n{-\displaywidth}
1045 (\theequation)
1046 }
1047 }
1048 }
1049 \end{MacroCode}
1050 \end{macro}
1051
1052 \begin{macro}{\__skrapport_setup_fleqn:}
1053 The \file{fleqn.clo} functionality is more complex, so we include
1054 the file instead of reimplementing.
1055 \begin{MacroCode}{class}
1056 \cs_new:Nn\__skrapport_setup_fleqn:{
1057 \file_input:n{fleqn.clo}
1058 }
1059 \end{MacroCode}
1060 \end{macro}
1061
1062 \begin{macro}{\__skrapport_setup_titles:n}[1]
1063 {Title style (\texttt{rm}, \texttt{it},
1064 \texttt{bf} or \texttt{sf})}
1065 The title styles are implemented by creating a new macro
1066 \cs{__skrapport_title_style:} which will later be used by
1067 \cs{section} and friends.
1068 \begin{MacroCode}{class}
1069 \cs_new:Npn\__skrapport_setup_titles:n#1{
1070 \str_case:nnF{#1}{
1071 \end{MacroCode}
1072 \begin{macro*}{\__skrapport_title_style:}
1073 \changes{0.11a}{Removed incorrect \cs{bfseries}, replaced
1074 \cs{relax} with \cs{rmfamily}}
1075 \changes{0.12d}{Added \texttt{it} option}
1076 \begin{MacroCode}{class}
1077 {rm}{\cs_new_protected:Nn\__skrapport_title_style:{\rmfamily}}
1078 {it}{\cs_new_protected:Nn\__skrapport_title_style:{\itshape}}
1079 {bf}{\cs_new_protected:Nn\__skrapport_title_style:{\bfseries}}
1080 {sf}{\cs_new_protected:Nn\__skrapport_title_style:{\sffamily}}
1081 \end{MacroCode}
1082 \end{macro*}
1083 The fall-back for incorrect parameters is an informational message
1084 along with setting up for \cs{rmfamily} titles.
1085 \begin{MacroCode}{class}
1086 }{
1087 \msg_info:nnnn{skrapport}{invalid-titles}{#1}{rm}
1088 \__skrapport_setup_titles:n{rm}
1089 }
1090 }
1091 \end{MacroCode}
1092 \end{macro}
1093
1094 \begin{macro}{\__skrapport_setup_lang:n}[1]
1095 {Language (\texttt{sv}, \texttt{en} or \texttt{de})}
1096 \changes{0.12d}{Use \pkg{babel} mechanisms for language-dependent
1097 strings, so they work correctly in \env{otherlanguage}}
1098 Thus far only two language options are implemented, each of them
1099 setting the other as the \enquote{other} language. We check if
1100 \pkg{polyglossia} has been loaded (this is done by
1101 \cs{__skrapport_setup_xelatex:}): if it has, we use the
1102 \pkg{polyglossia} interface for setting languages, otherwise we
1103 load the \pkg{babel} package with appropriate options.
1104 \begin{MacroCode}{class}
1105 \cs_new:Npn\__skrapport_setup_lang:n#1{
1106 \str_case:nnF{#1}{
1107 {sv}{
1108 \bool_if:NTF\g__skrapport_has_polyglossia_bool{
1109 \setmainlanguage{swedish}
1110 \setotherlanguage[variant=british]{english}
1111 }{
1112 \RequirePackage[british,swedish]{babel}
1113 }
1114 \end{MacroCode}
1115 \begin{macro*}{\__skrapport_RFC_language:}
1116 \begin{MacroCode}{class}
1117 \cs_gset:Nn\__skrapport_RFC_language:{swe}
1118 \end{MacroCode}
1119 \end{macro*}
1120 \begin{MacroCode}{class}
1121 \PassOptionsToPackage{iso,swedish}{isodate}
1122 }
1123 {en}{
1124 \bool_if:NTF\g__skrapport_has_polyglossia_bool{
1125 \setmainlanguage[variant=british]{english}
1126 \setotherlanguage{swedish}
1127 }{
1128 \RequirePackage[swedish,british]{babel}
1129 }
1130 \end{MacroCode}
1131 \begin{macro*}{\__skrapport_RFC_language:}
1132 \begin{MacroCode}{class}
1133 \cs_gset:Nn\__skrapport_RFC_language:{eng}
1134 \end{MacroCode}
1135 \end{macro*}
1136 \begin{MacroCode}{class}
1137 \PassOptionsToPackage{iso,british}{isodate}
1138 }
1139 {de}{
1140 \bool_if:NTF\g__skrapport_has_polyglossia_bool{
1141 \setmainlanguage{ngerman}
1142 \setotherlanguage[variant=british]{english}
1143 }{
1144 \RequirePackage[british,ngerman]{babel}
1145 }
1146 \end{MacroCode}
1147 \begin{macro*}{\__skrapport_RFC_language:}
1148 \begin{MacroCode}{class}
1149 \cs_gset:Nn\__skrapport_RFC_language:{ger}
1150 \end{MacroCode}
1151 \end{macro*}
1152 \begin{MacroCode}{class}
1153 \PassOptionsToPackage{iso,ngerman}{isodate}
1154 }
1155 }{
1156 \end{MacroCode}
1157 Fallback prints an informational message and leaves both \pkg{babel}
1158 and \pkg{polyglossia} unloaded.
1159 \begin{MacroCode}{class}
1160 \msg_info:nnn{skrapport}{invalid-lang}{#1}
1161 }
1162 \end{MacroCode}
1163 After loading \pkg{babel} or \pkg{polyglossia}, we provide
1164 translation strings. This is done using the \cs*{addto} and
1165 \cs*{captions<lang>}, which is compatible with both packages.
1166 \begin{macro*}{\captionsswedish}
1167 \changes{0.12e}{Don't redefine standard language strings}
1168 \begin{macro*}{\dateswedish}
1169 \begin{MacroCode}{class}
1170 \addto\captionsswedish{
1171 \cs_gset:Nn\__skrapport_and_word:{och}
1172 \cs_gset:Nn\__skrapport_Email_word:{E-post}
1173 \cs_gset:Nn\__skrapport_Comment_word:{Kommentar}
1174 \cs_gset:Nn\__skrapport_eg_word:{t.ex.}
1175 \cs_gset:Nn\__skrapport_ie_word:{dvs.}
1176 \cs_gset:Nn\__skrapport_etc_word:{\emph{etc.}}
1177 \cs_gset:Nn\__skrapport_cf_word:{jfr.}
1178 \cs_gset:Nn\__skrapport_viz_word:{dvs.}
1179 }
1180 \cs_gset:Npn\dateswedish{
1181 \cs_gset:Npn\today
1182 {\int_use:N\year--\int_use:N\month--\int_use:N\day}
1183 }
1184 \end{MacroCode}
1185 \end{macro*}
1186 \end{macro*}
1187 \begin{macro*}{\captionsbritish}
1188 \changes{0.12e}{Don't redefine standard language strings}
1189 \begin{macro*}{\datebritish}
1190 \begin{MacroCode}{class}
1191 \addto\captionsbritish{
1192 \cs_gset:Nn\__skrapport_and_word:{and}
1193 \cs_gset:Nn\__skrapport_Email_word:{Email}
1194 \cs_gset:Nn\__skrapport_Comment_word:{Comment}
1195 \cs_gset:Nn\__skrapport_eg_word:{\emph{e.g.}}
1196 \cs_gset:Nn\__skrapport_ie_word:{\emph{i.e.}}
1197 \cs_gset:Nn\__skrapport_etc_word:{\emph{etc.}}
1198 \cs_gset:Nn\__skrapport_cf_word:{\emph{cf.}}
1199 \cs_gset:Nn\__skrapport_viz_word:{\emph{viz.}}
1200 }
1201 \cs_gset:Npn\datebritish{
1202 \cs_gset:Npn\today
1203 {\int_use:N\year--\int_use:N\month--\int_use:N\day}
1204 }
1205 \end{MacroCode}
1206 \end{macro*}
1207 \end{macro*}
1208 \begin{macro*}{\captionsngerman}
1209 \changes{0.12e}{Don't redefine standard language strings}
1210 \begin{macro*}{\datengerman}
1211 \begin{MacroCode}{class}
1212 \addto\captionsngerman{
1213 \cs_gset:Nn\__skrapport_and_word:{und}
1214 \cs_gset:Nn\__skrapport_Email_word:{E-Mail}
1215 \cs_gset:Nn\__skrapport_Comment_word:{Kommentar}
1216 \cs_gset:Nn\__skrapport_eg_word:{z.~B.}
1217 \cs_gset:Nn\__skrapport_ie_word:{d.~h.}
1218 \cs_gset:Nn\__skrapport_etc_word:{usw.}
1219 \cs_gset:Nn\__skrapport_cf_word:{vgl.}
1220 \cs_gset:Nn\__skrapport_viz_word:{\emph{viz.}}
1221 }
1222 \cs_gset:Npn\datengerman{
1223 \cs_gset:Npn\today
1224 {\int_use:N\day.\,\int_use:N\month.\,\int_use:N\year}
1225 }
1226 \end{MacroCode}
1227 \end{macro*}
1228 \end{macro*}
1229 \begin{MacroCode}{class}
1230 }
1231 \end{MacroCode}
1232 \end{macro}
1233
1234 \begin{macro}{\__skrapport_setup_font:n}[1]
1235 {Font (\texttt{none}, \texttt{kpfonts}, \texttt{lmodern},
1236 \texttt{palatino}, \texttt{minion} or \texttt{skdoc})}
1237 \changes{0.12a}{Drop the post-\pkg{amsmath} hook entirely.
1238 Load \pkg{fontspec} in \texttt{word} and
1239 \texttt{none}}
1240 We set up the somewhat involved font stack.
1241 \begin{MacroCode}{class}
1242 \cs_new:Npn\__skrapport_setup_font:n#1{
1243 \PassOptionsToPackage{intlimits}{amsmath}
1244 \PassOptionsToPackage{full}{textcomp}
1245 \str_case:nnF{#1}{
1246 \end{MacroCode}
1247 The \texttt{none} font stack is special. If we're using
1248 \hologo{XeTeX} or \hologo{LuaTeX}, we load the \pkg{fontspec}
1249 package. Otherwise, we do nothing.
1250 \begin{MacroCode}{class}
1251 {none}{
1252 \bool_if:nT{\sys_if_engine_luatex_p: || \sys_if_engine_xetex_p:}{
1253 \RequirePackage[quiet]{fontspec}
1254 }
1255 }
1256 \end{MacroCode}
1257 The \texttt{kpfonts} font stack simply loads \pkg{kpfonts}...
1258 \begin{MacroCode}{class}
1259 {kpfonts}{
1260 \RequirePackage[easyscsl,intlimits,sumlimits]{kpfonts}
1261 }
1262 \end{MacroCode}
1263 ...and the \texttt{lmodern} font stack loads \pkg{lmodern}.
1264 \begin{MacroCode}{class}
1265 {lmodern}{
1266 \RequirePackage{lmodern}
1267 }
1268 \end{MacroCode}
1269 The \texttt{palatino} font stack loads \pkg{tgpagella} if available,
1270 but falls back to \pkg{mathpazo} otherwise.
1271 \begin{MacroCode}{class}
1272 {palatino}{
1273 \file_if_exist:nTF{tgpagella.sty}{
1274 \RequirePackage{arev}
1275 \RequirePackage{pxfonts}
1276 \RequirePackage{tgpagella}
1277 }{
1278 \RequirePackage[osf]{mathpazo}
1279 }
1280 }
1281 \end{MacroCode}
1282 Minion Pro, provided by the \texttt{minion} font stack, loads both
1283 \pkg{minionpro} (the font) and \pkg{MnSymbol} (appropriate math
1284 symbols).
1285 \begin{MacroCode}{class}
1286 {minion}{
1287 \AtEndOfClass{
1288 \cs_set_eq:NN\__skrapport_old_vec:\vec
1289 \cs_undefine:N\vec
1290 \RequirePackage{MyriadPro}
1291 \RequirePackage{MinionPro}
1292 \RequirePackage{MnSymbol}
1293 \cs_set_eq:NN\vec\__skrapport_old_vec:
1294 }
1295 }
1296 \end{MacroCode}
1297 Finally, the \texttt{skdoc} font stack loads \pkg{PTSerif} and
1298 \pkg{opensans}, inspired by the style of the \pkg{skdoc} class.
1299 \begin{MacroCode}{class}
1300 {skdoc}{
1301 \RequirePackage{PTSerif}
1302 \RequirePackage[defaultsans,oldstyle,scale=0.95]{opensans}
1303 }
1304 \end{MacroCode}
1305 The \texttt{word} font stack mimics recent versions of Microsoft
1306 Word, using Cambria, Consolas and Calibri. This requires a modern
1307 engine that supports \pkg{fontspec}.
1308 \begin{MacroCode}{class}
1309 {word}{
1310 \bool_if:nF{\sys_if_engine_luatex_p: || \sys_if_engine_xetex_p:}{
1311 \msg_fatal:nnn{skrapport}{font-requires-xetex}{word}
1312 }
1313 \RequirePackage[quiet]{fontspec}
1314 \setmainfont[Ligatures=TeX]{Cambria}
1315 \setsansfont[Ligatures=TeX]{Calibri}
1316 \setmonofont[Scale=0.95]{Consolas}
1317 \apptocmd{\__skrapport_after_ams_hook:}{
1318 \setmathfont{Cambria Math}
1319 }{}{}
1320 }
1321 }{
1322 \end{MacroCode}
1323 As a fallback, we print a waning and load no font packages.
1324 \begin{MacroCode}{class}
1325 \msg_warning:nnn{skrapport}{invalid-font}{#1}
1326 }
1327 \str_if_eq:nnF{#1}{none}{
1328 \end{MacroCode}
1329 All font stacks except \texttt{none} and \texttt{kpfonts} require
1330 additional packages. Or, rather, \texttt{none} can't load these
1331 packages by definition, and \texttt{kpfonts} already loads them
1332 internally \footcite[p.~1]{kpfonts}. They are always useful.
1333
1334 We also load \pkg{sourcecodepro} as our monospace font.
1335 But we don't load it when using the \texttt{none} font stack.
1336 \begin{MacroCode}{class}
1337 \str_if_eq:nnF{#1}{kpfonts}{
1338 \str_if_eq:nnF{#1}{word}{
1339 \RequirePackage{sourcecodepro}
1340 }
1341 \AtEndOfClass{
1342 \RequirePackage{amsmath}
1343 \end{MacroCode}
1344 The \pkg{mnsymbol} package is incompatible with \pkg{amssymb}.
1345 \begin{MacroCode}{class}
1346 \str_if_eq:nnF{#1}{minion}{
1347 \RequirePackage{amssymb}
1348 }
1349 \RequirePackage{textcomp}
1350 }
1351 }
1352 }
1353 }
1354 \end{MacroCode}
1355 \end{macro}
1356
1357 \begin{macro}{\__skrapport_setup_parskip:}
1358 \changes{0.12a}{Fixed bug where font size reset the \cs{parindent}}
1359 This part mixes \LaTeXe\ and \LaTeX3, which may not be a good thing.
1360 On the other hand, it seems hard to avoid. Most of the code is
1361 half-lifted from \pkg{parskip} and converted to \LaTeX3.
1362 \begin{MacroCode}{class}
1363 \cs_new:Nn\__skrapport_setup_parskip:{
1364 \AtEndOfClass{
1365 \skip_gset:Nn\parskip{0.5\baselineskip~plus~2pt}
1366 \dim_gzero:N\parindent
1367 \skip_gset:Nn\parfillskip{30pt~plus~1fil}
1368 \end{MacroCode}
1369 \begin{macro*}{\@listI}
1370 \begin{macro*}{\@listi}
1371 \begin{MacroCode}{class}
1372 \cs_gset:Npn\@listI{
1373 \dim_set_eq:NN\leftmargin\leftmargini
1374 \dim_set_eq:NN\parsep\parskip
1375 \dim_zero:N\topsep
1376 \dim_zero:N\itemsep
1377 }
1378 \cs_gset_eq:NN\@listi\@listI
1379 \end{MacroCode}
1380 \end{macro*}
1381 \end{macro*}
1382 \begin{MacroCode}{class}
1383 \dim_gset_eq:NN\leftmargin\leftmargini
1384 \dim_gset_eq:NN\parsep\parskip
1385 \dim_gzero:N\topsep
1386 \dim_gzero:N\itemsep
1387 \end{MacroCode}
1388 \begin{macro*}{\@listii}
1389 \begin{MacroCode}{class}
1390 \cs_gset:Npn\@listii{
1391 \dim_set_eq:NN\leftmargin\leftmarginii
1392 \dim_set_eq:NN\labelwidth\leftmarginii
1393 \dim_set_eq:NN\parsep\parskip
1394 \dim_sub:Nn\labelwidth{-\labelsep}
1395 \dim_zero:N\topsep
1396 \dim_zero:N\itemsep
1397 }
1398 \end{MacroCode}
1399 \end{macro*}
1400 \begin{macro*}{\@listiii}
1401 \begin{MacroCode}{class}
1402 \cs_gset:Npn\@listiii{
1403 \dim_set_eq:NN\leftmargin\leftmarginiii
1404 \dim_set_eq:NN\labelwidth\leftmarginiii
1405 \dim_set_eq:NN\parsep\parskip
1406 \dim_sub:Nn\labelwidth{-\labelsep}
1407 \dim_zero:N\topsep
1408 \dim_zero:N\itemsep
1409 }
1410 \end{MacroCode}
1411 \end{macro*}
1412 \begin{MacroCode}{class}
1413 \dim_gzero:N\partopsep
1414 \end{MacroCode}
1415 \begin{macro*}{\@starttoc}[1]
1416 {Table of contents extension}
1417 \changes{0.12h}{Replaced use of deprecated \cs{c_job_name_tl}
1418 with \cs{c_sys_jobname_str}}
1419 \begin{MacroCode}{class}
1420 \RenewDocumentCommand\@starttoc{m}{
1421 \group_begin:
1422 \dim_zero:N\parskip
1423 \file_if_exist:nT{\c_sys_jobname_str.##1}{
1424 \file_input:n{\c_sys_jobname_str.##1}
1425 }
1426 \if@filesw
1427 \iow_new:c{tf@##1}
1428 \iow_open:cn{tf@##1}{\c_sys_jobname_str.##1}
1429 \fi
1430 \@nobreakfalse
1431 \group_end:
1432 }
1433 \end{MacroCode}
1434 \end{macro*}
1435 \begin{MacroCode}{class}
1436 }
1437 }
1438 \end{MacroCode}
1439 \end{macro}
1440
1441 \begin{macro}{\__skrapport_setup_math:}
1442 This is the simplest option, only loading \pkg{skmath} if it exists.
1443 Also the post-skmath hook is run.
1444 \begin{MacroCode}{class}
1445 \cs_new:Nn\__skrapport_setup_math:{
1446 \file_if_exist:nT{skmath.sty}{\RequirePackage{skmath}}
1447 }
1448 \end{MacroCode}
1449 \end{macro}
1450
1451 \begin{macro}{\__skrapport_setup_draft:}
1452 Setting up the \opt{draft} mode is also fairly easy, as we only need
1453 wider (wider than \SI{0}{\point}, that is) \cs{overfullrule}s.
1454 \begin{MacroCode}{class}
1455 \cs_new:Nn\__skrapport_setup_draft:{
1456 \bool_if:NTF\g__skrapport_draft_bool{
1457 \dim_gset:Nn\overfullrule{5pt}
1458 }{
1459 \msg_log:nnn{skrapport}{noop-call}{\__skrapport_setup_draft:}
1460 \prg_do_nothing:
1461 }
1462 }
1463 \end{MacroCode}
1464 \end{macro}
1465
1466 \begin{macro}{\__skrapport_setup_color:}
1467 Setting up colors is also fairly easy, as we only have to load the
1468 \pkg{xcolor} package. All the other color-related code is in other
1469 places, utilizing the \cs{g__skdoc_color_bool} boolean.
1470 \begin{MacroCode}{class}
1471 \cs_new:Nn\__skrapport_setup_color:{
1472 \bool_if:NTF\g__skrapport_color_bool{
1473 \RequirePackage{xcolor}
1474 \PassOptionsToPackage{
1475 labelfont+={bf,color=skrapport@captioncolor}
1476 }{caption}
1477 }{
1478 \msg_log:nnn{skrapport}{noop-call}{\__skrapport_setup_color:}
1479 \prg_do_nothing:
1480 }
1481 }
1482 \end{MacroCode}
1483 \end{macro}
1484 \begin{macro}{\__skrapport_setup_color:n}
1485 We may also set up a specific color theme using options. This is
1486 easily done by first calling \cs{__skrapport_setup_color:}, then
1487 calling \cs{colortheme} at \cs{BeginDocument}.
1488 \begin{MacroCode}{class}
1489 \cs_new:Npn\__skrapport_setup_color:n#1{
1490 \__skrapport_setup_color:
1491 \bool_if:NTF\g__skrapport_color_bool{
1492 \AtBeginDocument{\colortheme{#1}}
1493 }{
1494 \msg_log:nnn{skrapport}{noop-call}{\__skrapport_setup_color:n}
1495 \prg_do_nothing:
1496 }
1497 }
1498 \end{MacroCode}
1499 \end{macro}
1500
1501 \begin{macro}{\__skrapport_setup_xelatex:}
1502 \changes{0.12a}{Don't load \pkg{polyglossia} for \hologo{LuaTeX}.
1503 Don't load \pkg{fontspec} for any engine}
1504 \changes{0.12d}{Force \texttt{quiet} option for \pkg{fontspec}}
1505 This macro contains special setup code for the \hologo{XeTeX} and
1506 \hologo{LuaTeX} engines, such as providing
1507 missing commands (which have been replaced by equivalent Unicode
1508 characters, apparently) and loading \pkg{polyglossia}.
1509 \begin{MacroCode}{class}
1510 \cs_new:Nn\__skrapport_setup_xelatex:{
1511 \AtEndOfClass{
1512 \cs_undefine:N\dblcolon
1513 \cs_undefine:N\coloneqq
1514 \cs_undefine:N\Coloneqq
1515 \cs_undefine:N\eqqcolon
1516 \RequirePackage{unicode-math}
1517 \unimathsetup {
1518 math-style = ISO,
1519 bold-style = ISO,
1520 sans-style = italic,
1521 nabla = upright,
1522 partial = italic,
1523 vargreek-shape = unicode
1524 }
1525 }
1526 \end{MacroCode}
1527 \begin{macro}{\nobreakspace}
1528 \begin{MacroCode}{class}
1529 \DeclareDocumentCommand\nobreakspace{}{\leavevmode\nobreak\space}
1530 \end{MacroCode}
1531 \end{macro}
1532 Since apparently \hologo{LuaLaTeX} isn't supported by
1533 \pkg{polyglossia}, we fall back to \pkg{babel} in that engine.
1534 Thus, only load \pkg{polyglossia} for \hologo{XeLaTeX}.
1535 \begin{MacroCode}{class}
1536 \sys_if_engine_xetex:TF{
1537 \PassOptionsToPackage{quiet}{fontspec}
1538 \RequirePackage{polyglossia}
1539 \bool_gset_true:N\g__skrapport_has_polyglossia_bool
1540 }{
1541 \bool_gset_false:N\g__skrapport_has_polyglossia_bool
1542 }
1543 }
1544 \end{MacroCode}
1545 \end{macro}
1546
1547 \begin{macro}{\__skrapport_setup_pdftex:}
1548 \changes{0.12d}{Load \pkg{isomath}}
1549 This macro contains special setup code for the \hologo{pdfTeX}
1550 engine. Currently, it only sets the font encoding to T1.
1551 \begin{MacroCode}{class}
1552 \cs_new:Nn\__skrapport_setup_pdftex:{
1553 \RequirePackage[T1]{fontenc}
1554 \AtEndOfClass{
1555 \RequirePackage{isomath}
1556 }
1557 \bool_gset_false:N\g__skrapport_has_polyglossia_bool
1558 }
1559 \end{MacroCode}
1560 \end{macro}
1561
1562 \begin{macro}{\__skrapport_setup_engine_specific:}
1563 This macro detects the current engine and calls the appropriate
1564 engine setup macro.
1565 \begin{MacroCode}{class}
1566 \cs_new:Nn\__skrapport_setup_engine_specific:{
1567 \bool_if:nTF{\sys_if_engine_luatex_p: || \sys_if_engine_xetex_p:}{
1568 \__skrapport_setup_xelatex:
1569 }{
1570 \__skrapport_setup_pdftex:
1571 }
1572 }
1573 \end{MacroCode}
1574 \end{macro}
1575
1576 \paragraph{Variants with expandable arguments}
1577 Some option setup macros accept arguments, but those arguments are
1578 not expanded. Here, we provide variants which expand the parameters
1579 properly using the excellent \pkg{l3prg} functionality.
1580 \begin{macro}{\__skrapport_setup_ptsize:x}
1581 \begin{MacroCode}{class}
1582 \cs_generate_variant:Nn\__skrapport_setup_ptsize:n{ x }
1583 \end{MacroCode}
1584 \end{macro}
1585 \begin{macro}{\__skrapport_setup_titles:x}
1586 \begin{MacroCode}{class}
1587 \cs_generate_variant:Nn\__skrapport_setup_titles:n{ x }
1588 \end{MacroCode}
1589 \end{macro}
1590 \begin{macro}{\__skrapport_setup_lang:x}
1591 \begin{MacroCode}{class}
1592 \cs_generate_variant:Nn\__skrapport_setup_lang:n{ x }
1593 \end{MacroCode}
1594 \end{macro}
1595 \begin{macro}{\__skrapport_setup_font:x}
1596 \begin{MacroCode}{class}
1597 \cs_generate_variant:Nn\__skrapport_setup_font:n{ x }
1598 \end{MacroCode}
1599 \end{macro}
1600
1601 \subsubsection{Key-value system}
1602 Let's define some \pkg{l3keys} corresponding to the options. Note
1603 that most of them just refer to a macro in their \texttt{.code:n}
1604 block --- these macros were defined earlier.
1605 \begin{MacroCode}{class}
1606 \keys_define:nn{skrapport}{
1607 \end{MacroCode}
1608 \begin{option}{paper}{a4paper, a5paper, a4, a5}
1609 \changes{0.12}{Values \texttt{a4paper} and \texttt{a5paper} are
1610 now deprecated}
1611 \begin{option}{a4paper}
1612 \changes{0.12}{Option is now deprecated}
1613 \begin{option}{a5paper}
1614 \changes{0.12}{Option is now deprecated}
1615 Declare the paper size options. Note that having to handle the
1616 deprecated \texttt{a4paper} and \texttt{a5paper} values of the
1617 \opt{paper} option makes the code less readable. In a few
1618 versions, when these options are removed, the code should probably
1619 be refactored to look something like the \opt{ptsize} option below.
1620 \begin{MacroCode}{class}
1621 paper .choice:,
1622 paper / a4 .code:n =
1623 {\__skrapport_setup_paper:n{a4}},
1624 paper / a5 .code:n =
1625 {\__skrapport_setup_paper:n{a5}},
1626 paper / a4paper .code:n =
1627 {\msg_warning:nnnn{skrapport}{option-deprecated}
1628 {paper=a4paper}{paper=a4}
1629 \keys_set:nn{skrapport}{paper=a4}},
1630 paper / a5paper .code:n =
1631 {\msg_warning:nnnn{skrapport}{option-deprecated}
1632 {paper=a5paper}{paper=a5}
1633 \keys_set:nn{skrapport}{paper=a4}},
1634 paper .value_required:n = true,
1635 a4paper .code:n =
1636 {\msg_warning:nnnn{skrapport}{option-deprecated}
1637 {a4paper}{paper=a4}
1638 \keys_set:nn{skrapport}{paper=a4}},
1639 a5paper .code:n =
1640 {\msg_warning:nnnn{skrapport}{option-deprecated}
1641 {a5paper}{paper=a5}
1642 \keys_set:nn{skrapport}{paper=a5}},
1643 \end{MacroCode}
1644 \end{option}
1645 \end{option}
1646 \end{option}
1647
1648 \begin{option}{ptsize}{10pt, 11pt, 12pt}
1649 \begin{option}{10pt}
1650 \begin{option}{11pt}
1651 \begin{option}{12pt}
1652 Declare point size options. Note that we don't deprecate the
1653 non-\opt{ptsize} aliases as they are much easier to type.
1654 \begin{MacroCode}{class}
1655 ptsize .choices:nn =
1656 { 10pt, 11pt, 12pt }
1657 {\__skrapport_setup_ptsize:x{\tl_use:N\l_keys_choice_tl}},
1658 ptsize .value_required:n = true,
1659 10pt .meta:n = {ptsize=10pt},
1660 11pt .meta:n = {ptsize=11pt},
1661 12pt .meta:n = {ptsize=12pt},
1662 \end{MacroCode}
1663 \end{option}
1664 \end{option}
1665 \end{option}
1666 \end{option}
1667
1668 \begin{option}{twocolumn}
1669 \changes{0.08}{Added option \opt{twocolumn}}
1670 \changes{0.12a}{Use \cs{AtEndOfClass} instead of \cs{AtEndClass}}
1671 Declare column options. The code here should be run through
1672 \cs{AtEndOfClass} so that the setup code can patch everythin
1673 properly.
1674 \begin{option}{onecolumn}
1675 \changes{0.12}{Option is now deprecated}
1676 The \opt{onecolumn} option has no effect and is deprecated.
1677 \begin{MacroCode}{class}
1678 twocolumn .code:n =
1679 {\AtEndOfClass{\__skrapport_setup_twocolumn:}},
1680 onecolumn .code:n =
1681 {\msg_warning:nnn{skrapport}{option-no-effect}{onecolumn}},
1682 \end{MacroCode}
1683 \end{option}
1684 \end{option}
1685
1686 \begin{option}{draft}{true, false}
1687 \begin{option}{final}
1688 Declare \opt{draft} and \opt{final} options. Note that even if the
1689 \opt{final} option does absolutely nothing, users may expect it to
1690 be there and as such it is not deprecated.
1691 \begin{MacroCode}{class}
1692 draft .choice:,
1693 draft / true .code:n =
1694 {\bool_gset_true:N\g__skrapport_draft_bool
1695 \__skrapport_setup_draft:},
1696 draft / false .code:n =
1697 {\bool_gset_false:N\g__skrapport_draft_bool},
1698 draft .default:n = true,
1699 final .code:n = {\prg_do_nothing:},
1700 \end{MacroCode}
1701 \end{option}
1702 \end{option}
1703
1704 Declare the \opt{fleqn} and \opt{leqno} options, mainly for
1705 compatibility with the \pkg{article} class.
1706 \begin{option}{leqno}
1707 \begin{MacroCode}{class}
1708 leqno .code:n =
1709 {\__skrapport_setup_leqno:},
1710 \end{MacroCode}
1711 \end{option}
1712 \begin{option}{fleqn}
1713 \begin{MacroCode}{class}
1714 fleqn .code:n =
1715 {\__skrapport_setup_fleqn:},
1716 \end{MacroCode}
1717 \end{option}
1718
1719 \begin{option}{titles}{rm, it, bf, sf}
1720 Declare options for section titles. The old \opt*{??titles} aliases
1721 are deprecated and will be removed in a future version.
1722 \begin{option}{rmtitles}
1723 \changes{0.12}{Option is now deprecated}
1724 \begin{option}{bftitles}
1725 \changes{0.12}{Option is now deprecated}
1726 \begin{option}{sftitles}
1727 \changes{0.09}{Added \opt{sftitles} option}
1728 \changes{0.12}{Option is now deprecated}
1729 \begin{MacroCode}{class}
1730 titles .choices:nn =
1731 { rm, it, bf, sf }
1732 {\__skrapport_setup_titles:x{\tl_use:N\l_keys_choice_tl}},
1733 titles .value_required:n = true,
1734 rmtitles .code:n =
1735 {\msg_warning:nnnn{skrapport}{option-deprecated}
1736 {rmtitles}{titles=rm}
1737 \keys_set:nn{skrapport}{titles=rm}},
1738 bftitles .code:n =
1739 {\msg_warning:nnnn{skrapport}{option-deprecated}
1740 {bftitles}{titles=bf}
1741 \keys_set:nn{skrapport}{titles=bf}},
1742 sftitles .code:n =
1743 {\msg_warning:nnnn{skrapport}{option-deprecated}
1744 {sftitles}{titles=sf}
1745 \keys_set:nn{skrapport}{titles=sf}},
1746 \end{MacroCode}
1747 \end{option}
1748 \end{option}
1749 \end{option}
1750 \end{option}
1751
1752 \begin{option}{hanging-titles}{true, false}
1753 \changes{0.12d}{Added option to enable \enquote{hanging} titles}
1754 \begin{MacroCode}{class}
1755 hanging-titles .bool_gset:N = \g__skrapport_hanging_titles_bool,
1756 hanging-titles .default:n = true,
1757 hanging-titles .initial:n = false,
1758 \end{MacroCode}
1759 \end{option}
1760
1761 \begin{option}{lang}{sv, en, de}
1762 \changes{0.12c}{Added option value \texttt{de}}
1763 \changes{0.12}{Incompatible change: values \texttt{swe} and
1764 \texttt{eng} are now \texttt{sv} and \texttt{en},
1765 respectively}
1766 \begin{option}{swe}
1767 \changes{0.12}{Option is now deprecated}
1768 \begin{option}{eng}
1769 \changes{0.12}{Option is now deprecated}
1770 Declare options for swedish/english \pkg{babel} or
1771 \pkg{polyglossia} support. Again, the old \opt{swe} and \opt{eng}
1772 aliases are deprecated and will be removed.
1773 \begin{MacroCode}{class}
1774 lang .choices:nn =
1775 { sv, en, de }
1776 {\__skrapport_setup_lang:x{\tl_use:N\l_keys_choice_tl}},
1777 lang .value_required:n = true,
1778 swe .code:n =
1779 {\msg_warning:nnnn{skrapport}{option-deprecated}
1780 {swe}{lang=sv}
1781 \keys_set:nn{skrapport}{lang=sv}},
1782 eng .code:n =
1783 {\msg_warning:nnnn{skrapport}{option-deprecated}
1784 {eng}{lang=en}
1785 \keys_set:nn{skrapport}{lang=en}},
1786 \end{MacroCode}
1787 \end{option}
1788 \end{option}
1789 \end{option}
1790
1791 \begin{option}{font}{none, kpfonts, lmodern, palatino, minion, skdoc}
1792 Declare font options. Again, aliases are deprecated.
1793 \begin{option}{kpfonts}
1794 \changes{0.07}{Added option \opt{kpfonts}, set as default
1795 option for fonts}
1796 \changes{0.12}{Option is now deprecated}
1797 \begin{option}{lmodern}
1798 \changes{0.12}{Option is now deprecated}
1799 \begin{option}{palatino}
1800 \changes{0.12}{Option is now deprecated}
1801 \begin{option}{minion}
1802 \changes{0.11}{Added option \opt{minion}}
1803 \changes{0.12}{Option is now deprecated}
1804 \begin{option}{skdoc}
1805 \changes{0.11a}{Added option \opt{skdoc}}
1806 \changes{0.12}{Option is now deprecated}
1807 \begin{option}{nofont}
1808 \changes{0.12}{Option is now deprecated}
1809 \begin{MacroCode}{class}
1810 font .choices:nn =
1811 { none, kpfonts, lmodern, palatino, minion, skdoc, word }
1812 {\__skrapport_setup_font:x{\tl_use:N\l_keys_choice_tl}},
1813 font .value_required:n = true,
1814 nofont .code:n =
1815 {\msg_warning:nnnn{skrapport}{option-deprecated}
1816 {nofont}{font=none}
1817 \keys_set:nn{skrapport}{font=none}},
1818 kpfonts .code:n =
1819 {\msg_warning:nnnn{skrapport}{option-deprecated}
1820 {kpfonts}{font=kpfonts}
1821 \keys_set:nn{skrapport}{font=kpfonts}},
1822 lmodern .code:n =
1823 {\msg_warning:nnnn{skrapport}{option-deprecated}
1824 {lmodern}{font=lmodern}
1825 \keys_set:nn{skrapport}{font=lmodern}},
1826 palatino .code:n =
1827 {\msg_warning:nnnn{skrapport}{option-deprecated}
1828 {palatino}{font=palatino}
1829 \keys_set:nn{skrapport}{font=palatino}},
1830 minion .code:n =
1831 {\msg_warning:nnnn{skrapport}{option-deprecated}
1832 {minion}{font=minion}
1833 \keys_set:nn{skrapport}{font=minion}},
1834 skdoc .code:n =
1835 {\msg_warning:nnnn{skrapport}{option-deprecated}
1836 {skdoc}{font=skdoc}
1837 \keys_set:nn{skrapport}{font=skdoc}},
1838 \end{MacroCode}
1839 \end{option}
1840 \end{option}
1841 \end{option}
1842 \end{option}
1843 \end{option}
1844 \end{option}
1845 \end{option}
1846
1847 \begin{option}{indent}{true, false}
1848 \changes{0.02}{Added option of indented paragraphs}
1849 \begin{option}{noindent}
1850 \changes{0.12}{Option is now deprecated}
1851 Declare indentation options. Since the \opt{noindent} option
1852 technically has no effect and is an alias of \opt{indent=false},
1853 it has been deprecated.
1854 \begin{MacroCode}{class}
1855 indent .choice:,
1856 indent / true .code:n = {\prg_do_nothing:},
1857 indent / false .code:n = {\__skrapport_setup_parskip:},
1858 indent .default:n = true,
1859 noindent .code:n =
1860 {\msg_warning:nnn{skrapport}{option-no-effect}{noindent}},
1861 \end{MacroCode}
1862 \end{option}
1863 \end{option}
1864
1865 \begin{option}{color}{true, false}
1866 \changes{0.09}{Added \opt{color} option}
1867 \changes{0.12}{Converted to a key-value option which will load
1868 the specified color theme.}
1869 \begin{option}{nocolor}
1870 Declare color options. Note that we explicitly set the boolean
1871 \cs{g__skrapport_color_bool} as well as setting up the colors
1872 through \cs{__skrapport_setup_color:n}, so that we can keep track
1873 of the color usage even after the options have been set up.
1874 \begin{MacroCode}{class}
1875 color .code:n =
1876 {\str_if_eq:nnTF{#1}{false}
1877 {\bool_gset_false:N\g__skrapport_color_bool}
1878 {\bool_gset_true:N\g__skrapport_color_bool
1879 \str_if_eq:nnTF{#1}{true}
1880 {\__skrapport_setup_color:n{default}}
1881 {\__skrapport_setup_color:n{#1}}}},
1882 color .default:n = true,
1883 nocolor .meta:n = {color=false},
1884 \end{MacroCode}
1885 \end{option}
1886 \end{option}
1887
1888 \begin{option}{nomath}{true, false}
1889 \begin{option}{math}
1890 \changes{0.12}{Option is now deprecated}
1891 Declare math options. As with the \opt{noindent} option, \opt{math}
1892 has been deprecated since it is an alias and has no effect.
1893 \begin{MacroCode}{class}
1894 nomath .choice:,
1895 nomath / false .code:n = {\__skrapport_setup_math:},
1896 nomath / true .code:n = {\prg_do_nothing:},
1897 nomath .default:n = true,
1898 math .code:n =
1899 {\msg_warning:nnn{skrapport}{option-no-effect}{math}},
1900 \end{MacroCode}
1901 \end{option}
1902 \end{option}
1903
1904 That's it, we're done setting up the \pkg{l3keys} for the options.
1905 \begin{MacroCode}{class}
1906 }
1907 \end{MacroCode}
1908
1909 We will now define a \enquote{defaults} key-value system because
1910 \texttt{.initial:n} doesn't work they way we want it to. This
1911 key-value system will be used to set flags with which we will
1912 determine wether to set certain default options.
1913 \begin{macro}{\__skrapport_setup_defaults:}
1914 \changes{0.12a}{\texttt{word} font stack is now the default font stack when using \hologo{XeLaTeX}}
1915 \begin{MacroCode}{class}
1916 \cs_new:Nn\__skrapport_setup_defaults:{
1917 \bool_new:N\l__skrapport_has_option_indent_bool
1918 \bool_new:N\l__skrapport_has_option_nomath_bool
1919 \bool_new:N\l__skrapport_has_option_color_bool
1920 \bool_new:N\l__skrapport_has_option_font_bool
1921 \bool_new:N\l__skrapport_has_option_lang_bool
1922 \bool_new:N\l__skrapport_has_option_titles_bool
1923 \bool_new:N\l__skrapport_has_option_draft_bool
1924 \bool_new:N\l__skrapport_has_option_ptsize_bool
1925 \bool_new:N\l__skrapport_has_option_paper_bool
1926 \keys_define:nn{skrapport-default}{
1927 indent .code:n =
1928 {\bool_set_true:N\l__skrapport_has_option_indent_bool},
1929 nomath .code:n =
1930 {\bool_set_true:N\l__skrapport_has_option_nomath_bool},
1931 color .code:n =
1932 {\bool_set_true:N\l__skrapport_has_option_color_bool},
1933 font .code:n =
1934 {\bool_set_true:N\l__skrapport_has_option_font_bool},
1935 lang .code:n =
1936 {\bool_set_true:N\l__skrapport_has_option_lang_bool},
1937 titles .code:n =
1938 {\bool_set_true:N\l__skrapport_has_option_titles_bool},
1939 draft .code:n =
1940 {\bool_set_true:N\l__skrapport_has_option_draft_bool},
1941 ptsize .code:n =
1942 {\bool_set_true:N\l__skrapport_has_option_ptsize_bool},
1943 paper .code:n =
1944 {\bool_set_true:N\l__skrapport_has_option_paper_bool},
1945 \end{MacroCode}
1946 The following keys correspond to deprecated options. They should
1947 be removed when the corresponding options are removed.
1948 \begin{MacroCode}{class}
1949 nofont .code:n = {\keys_set:nn{skrapport-default}{font}},
1950 kpfonts .code:n = {\keys_set:nn{skrapport-default}{font}},
1951 lmodern .code:n = {\keys_set:nn{skrapport-default}{font}},
1952 palatino .code:n = {\keys_set:nn{skrapport-default}{font}},
1953 minion .code:n = {\keys_set:nn{skrapport-default}{font}},
1954 skdoc .code:n = {\keys_set:nn{skrapport-default}{font}},
1955 swe .code:n = {\keys_set:nn{skrapport-default}{lang}},
1956 eng .code:n = {\keys_set:nn{skrapport-default}{lang}},
1957 rmtitles .code:n = {\keys_set:nn{skrapport-default}{titles}},
1958 bftitles .code:n = {\keys_set:nn{skrapport-default}{titles}},
1959 sftitles .code:n = {\keys_set:nn{skrapport-default}{titles}},
1960 10pt .code:n = {\keys_set:nn{skrapport-default}{ptsize}},
1961 11pt .code:n = {\keys_set:nn{skrapport-default}{ptsize}},
1962 12pt .code:n = {\keys_set:nn{skrapport-default}{ptsize}},
1963 a4paper .code:n = {\keys_set:nn{skrapport-default}{paper}},
1964 a5paper .code:n = {\keys_set:nn{skrapport-default}{paper}},
1965 \end{MacroCode}
1966 \begin{MacroCode}{class}
1967 }
1968 \ProcessKeysOptions{skrapport-default}
1969 \bool_if:NF\l__skrapport_has_option_indent_bool{
1970 \keys_set:nn{skrapport}{indent=false}
1971 }
1972 \bool_if:NF\l__skrapport_has_option_nomath_bool{
1973 \keys_set:nn{skrapport}{nomath=false}
1974 }
1975 \bool_if:NF\l__skrapport_has_option_color_bool{
1976 \keys_set:nn{skrapport}{color=true}
1977 }
1978 \bool_if:NF\l__skrapport_has_option_font_bool{
1979 \sys_if_engine_xetex:TF{
1980 \keys_set:nn{skrapport}{font=word}
1981 }{
1982 \keys_set:nn{skrapport}{font=kpfonts}
1983 }
1984 }
1985 \bool_if:NF\l__skrapport_has_option_lang_bool{
1986 \keys_set:nn{skrapport}{lang=sv}
1987 }
1988 \bool_if:NF\l__skrapport_has_option_titles_bool{
1989 \keys_set:nn{skrapport}{titles=bf}
1990 }
1991 \bool_if:NF\l__skrapport_has_option_draft_bool{
1992 \keys_set:nn{skrapport}{draft=false}
1993 }
1994 \bool_if:NF\l__skrapport_has_option_ptsize_bool{
1995 \keys_set:nn{skrapport}{ptsize=11pt}
1996 }
1997 \bool_if:NF\l__skrapport_has_option_paper_bool{
1998 \keys_set:nn{skrapport}{paper=a4}
1999 }
2000 }
2001 \end{MacroCode}
2002 \end{macro}
2003
2004 Finally, we process the class options using the keys defined earlier.
2005 We also run the engine-specific code implemented above, and the fake
2006 key system used to define defaults.
2007
2008 Note that we save and restore \cs{@classoptionslist} around the
2009 engine-specific setup. This is because we might load \pkg{xkeyval},
2010 which apparently removes all key-value options from the list when
2011 loaded (and this is really bad for us).
2012 \begin{MacroCode}{class}
2013 \cs_set_eq:NN\__skrapport_tmpa_cs:\@classoptionslist
2014 \RequirePackage{xkeyval}
2015 \cs_set_eq:NN\__skrapport_tmpb_cs:\@classoptionslist
2016 \cs_set_eq:NN\@classoptionslist\__skrapport_tmpa_cs:
2017 \__skrapport_setup_engine_specific:
2018 \ProcessKeysOptions{skrapport}
2019 \__skrapport_setup_defaults:
2020 \cs_set_eq:NN\@classoptionslist\__skrapport_tmpb_cs:
2021 \cs_undefine:N\__skrapport_tmpa_cs:
2022 \cs_undefine:N\__skrapport_tmpb_cs:
2023 \end{MacroCode}
2024
2025 \subsection{Required packages}
2026 We also include some essential packages per default. The
2027 \pkg{calc} package, for instance, is essential in later
2028 definitions.
2029 \begin{MacroCode}{class}
2030 \RequirePackage{calc,isodate,multicol}
2031 \end{MacroCode}
2032
2033 At the end of the class definition we load a very
2034 useful package that improves typesetting: \pkg{microtype}.
2035 Also set \cs{frenchspacing}.
2036 \begin{MacroCode}{class}
2037 \AtEndOfClass{
2038 \RequirePackage{microtype}
2039 \frenchspacing
2040 }
2041 \end{MacroCode}
2042
2043 When the document starts, we set the URL style if the user has
2044 loaded the \pkg{url} package.
2045 \begin{MacroCode}{class}
2046 \AtBeginDocument{
2047 \cs_if_exist:NT\urlstyle{\urlstyle{same}}
2048 }
2049 \end{MacroCode}
2050
2051 \subsection{Utilities}
2052 We define useful \LaTeX3 replacements of \LaTeXe\ stuff that
2053 hasn't made its way into \pkg{interface3}. This includes
2054 a \cs{settowidth} clone and possibly more stuff later.
2055 \begin{macro}{\dim_set_to_wd:Nn}
2056 \begin{MacroCode}{class}
2057 \cs_new:Npn\dim_set_to_wd:Nn#1#2{
2058 \hbox_set:Nn\l_tmpa_box{#2}
2059 \dim_set:Nn#1{\box_wd:N\l_tmpa_box}
2060 \box_clear:N\l_tmpa_box
2061 }
2062 \end{MacroCode}
2063 \end{macro}
2064
2065 \subsection{Hidden things}
2066 Set some default measurements (should probably be replaced with
2067 simply loading \pkg{typearea}).
2068 \begin{MacroCode}{class}
2069 \dim_add:Nn\textwidth{0.5\oddsidemargin}
2070 \dim_add:Nn\textwidth{0.5\evensidemargin}
2071 \dim_add:Nn\oddsidemargin{-0.5\oddsidemargin}
2072 \dim_add:Nn\evensidemargin{-0.5\evensidemargin}
2073 \dim_gset:Nn\lineskip{1pt}
2074 \dim_gset:Nn\normallineskip{1pt}
2075 \end{MacroCode}
2076 \begin{macro}{\baselinestretch}
2077 Note that we can't use \cs{RenewDocumentCommand} as that yields an
2078 infinite loop before or at \env{document}.
2079 \begin{MacroCode}{class}
2080 \cs_set:Npn\baselinestretch{}
2081 \end{MacroCode}
2082 \end{macro}
2083
2084 \subsubsection{Penalties}
2085 \begin{MacroCode}{class}
2086 \int_gset:Nn\@lowpenalty {51}
2087 \int_gset:Nn\@medpenalty {151}
2088 \int_gset:Nn\@highpenalty{301}
2089 \setcounter{topnumber}{2}
2090 \setcounter{bottomnumber}{1}
2091 \setcounter{totalnumber}{4}
2092 \setcounter{dbltopnumber}{2}
2093 \end{MacroCode}
2094 \begin{macro}{\topfraction}
2095 \begin{MacroCode}{class}
2096 \RenewDocumentCommand\topfraction{}{.75}
2097 \end{MacroCode}
2098 \end{macro}
2099 \begin{macro}{\bottomfraction}
2100 \begin{MacroCode}{class}
2101 \RenewDocumentCommand\bottomfraction{}{.5}
2102 \end{MacroCode}
2103 \end{macro}
2104 \begin{macro}{\textfraction}
2105 \begin{MacroCode}{class}
2106 \RenewDocumentCommand\textfraction{}{.25}
2107 \end{MacroCode}
2108 \end{macro}
2109 \begin{macro}{\floatpagefraction}
2110 \begin{MacroCode}{class}
2111 \RenewDocumentCommand\floatpagefraction{}{.625}
2112 \end{MacroCode}
2113 \end{macro}
2114 \begin{macro}{\dbltopfraction}
2115 \begin{MacroCode}{class}
2116 \RenewDocumentCommand\dbltopfraction{}{.75}
2117 \end{MacroCode}
2118 \end{macro}
2119 \begin{macro}{\dblfloatpagefraction}
2120 \begin{MacroCode}{class}
2121 \RenewDocumentCommand\dblfloatpagefraction{}{.625}
2122 \end{MacroCode}
2123 \end{macro}
2124
2125 \subsection{User-level commands and environments}
2126 \subsubsection{The front page}
2127 \begin{macro}{\title}[1]
2128 {Title of the document}
2129 \begin{macro*}{\g__skrapport_title_tl}
2130 \begin{MacroCode}{class}
2131 \tl_new:N\g__skrapport_title_tl
2132 \end{MacroCode}
2133 \end{macro*}
2134 \begin{MacroCode}{class}
2135 \DeclareDocumentCommand\title{m}{
2136 \tl_gset:Nn\g__skrapport_title_tl{#1}
2137 }
2138 \end{MacroCode}
2139 \end{macro}
2140
2141 \begin{macro}{\date}[1]
2142 {Date in ISO8601 format}
2143 The \cs{date} macro sets the current date of the document. It only
2144 accepts dates accepted by \pkg{isodate} (or the special value
2145 \enquote{\texttt{today}}). Dates are always printed using the
2146 current format as specified by the \pkg{isodate} package. The default
2147 value of the date (if \cs{date} isn't used) is \cs{today}.
2148 \begin{macro*}{\g__skrapport_title_tl}
2149 \begin{MacroCode}{class}
2150 \tl_new:N\g__skrapport_date_tl
2151 \tl_gset:Nn\g__skrapport_date_tl{\today}
2152 \end{MacroCode}
2153 \end{macro*}
2154 \begin{MacroCode}{class}
2155 \DeclareDocumentCommand\date{m}{
2156 \str_if_eq:nnTF{#1}{today}{
2157 \tl_gset:Nn\g__skrapport_date_tl{\today}
2158 }{
2159 \if_meaning:w \today #1
2160 \tl_gset:Nn\g__skrapport_date_tl{\today}
2161 \else:
2162 \tl_gset:Nn\g__skrapport_date_tl{\printdate{#1}}
2163 \fi:
2164 }
2165 }
2166 \end{MacroCode}
2167 \end{macro}
2168
2169 \begin{macro}{\author}[2]
2170 {Optional email address}
2171 {Author name}
2172 \changes{0.10b}{Improved \cs{author} macro}
2173 \changes{0.12}{Use comma-separated lists instead of token list}
2174 The \cs{author} macro is redefined to accept an optional argument
2175 and to be used multiple times.
2176 \begin{macro*}{\__skrapport_email:n}[1]
2177 {Email address}
2178 \changes{0.12a}{Store \cs{textemdash} instead of \cs{NoValue}}
2179 The \cs{skrapport@email} helper macro typesets an email address
2180 using \pkg{hyperref} if that package is used. This is suboptimal,
2181 the macro behaves differently with respect to special characters
2182 depending on wether \pkg{hyperref} is loaded or not.
2183 \begin{MacroCode}{class}
2184 \cs_new_nopar:Npn\__skrapport_email:n#1{
2185 \texttt{#1}
2186 }
2187 \AtBeginDocument{
2188 \cs_if_exist:NT\href{
2189 \cs_gset_nopar:Npn\__skrapport_email:n#1{
2190 \href{mailto:#1}{\nolinkurl{#1}}
2191 }
2192 }
2193 }
2194 \end{MacroCode}
2195 \end{macro*}
2196 \begin{macro*}{\g__skrapport_author_clist}
2197 \begin{MacroCode}{class}
2198 \clist_new:N\g__skrapport_author_clist
2199 \end{MacroCode}
2200 \end{macro*}
2201 \begin{macro*}{\g__skrapport_email_clist}
2202 \begin{MacroCode}{class}
2203 \clist_new:N\g__skrapport_email_clist
2204 \end{MacroCode}
2205 \end{macro*}
2206 \begin{MacroCode}{class}
2207 \DeclareDocumentCommand\author{om}{%
2208 \clist_gput_right:Nn\g__skrapport_author_clist{#2}
2209 \clist_gput_right:Nn\g__skrapport_email_clist
2210 {\IfNoValueTF{#1}{\textemdash}{#1}}
2211 }
2212 \end{MacroCode}
2213 \begin{macro}{\__skrapport_author_list:}
2214 \changes{0.12a}{Use \cs{clist_use:Nnnn}}
2215 This macro lists all the authors in the comma-separated list
2216 \cs{g__skrapport_author_clist}, separating them with a comma
2217 or the word \enquote{and} (in the appropriate language).
2218 \begin{MacroCode}{class}
2219 \cs_new:Nn\__skrapport_author_list:{
2220 \clist_use:Nnnn\g__skrapport_author_clist
2221 {~\__skrapport_and_word:{}~}{,~}{~\__skrapport_and_word:{}~}
2222 }
2223 \end{MacroCode}
2224 \end{macro}
2225 \begin{macro}{\__skrapport_email_list:}
2226 \changes{0.12a}{Use \cs{clist_use:Nnnn}}
2227 This macro lists the email addresses in the comma-separated list
2228 \cs{g__skrapport_email_clist} by applying \cs{__skrapport_email:}
2229 if appropriate (or printing an em-dash if no value exists) and
2230 separating them with commas.
2231 \begin{MacroCode}{class}
2232 \cs_new:Nn\__skrapport_email_list:{
2233 \int_compare:nT{\clist_count:N\g__skrapport_author_clist>\c_zero_int}{
2234 \clist_use:Nnnn\g__skrapport_email_clist{\\}{\\}{\\}
2235 }
2236 }
2237 \end{MacroCode}
2238 \end{macro}
2239 \end{macro}
2240
2241 \begin{macro}{\regarding}[1]
2242 {Text snippet}
2243 This macro defines a variable used by \cs{maketitle} to insert a
2244 simple text into the header on the title page.
2245 \begin{macro*}{\g__skrapport_regarding_tl}
2246 \begin{MacroCode}{class}
2247 \tl_new:N\g__skrapport_regarding_tl
2248 \DeclareDocumentCommand\regarding{m}{
2249 \tl_gset:Nn\g__skrapport_regarding_tl{#1}
2250 }
2251 \end{MacroCode}
2252 \end{macro*}
2253 \end{macro}
2254
2255 \begin{macro}{\license}[1]
2256 {Short license description}
2257 \changes{0.07}{Added command \cs{license}}
2258 This macro defines a variable used by \cs{maketitle} to insert a
2259 license into the footer on the titlepage.
2260 \begin{macro*}{\g__skrapport_copyright_unprinted_bool}
2261 \begin{MacroCode}{class}
2262 \bool_new:N\g__skrapport_copyright_unprinted_bool
2263 \AtEndDocument{
2264 \bool_if:NT\g__skrapport_copyright_unprinted_bool
2265 {\msg_warning:nn{skrapport}{license-not-printed}}
2266 }
2267 \end{MacroCode}
2268 \end{macro*}
2269 \begin{macro*}{\g__skrapport_copyright_tl}
2270 \begin{MacroCode}{class}
2271 \tl_new:N\g__skrapport_copyright_tl
2272 \DeclareDocumentCommand\license{m}{
2273 \tl_gset:Nn\g__skrapport_copyright_tl{#1}
2274 \bool_gset_true:N\g__skrapport_copyright_unprinted_bool
2275 }
2276 \end{MacroCode}
2277 \end{macro*}
2278 \end{macro}
2279
2280 \begin{macro}{\maketitle}[1]
2281 {Optional key-value list}
2282 \changes{0.12a}{Added optional key-value argument and PDFinfo}
2283 The standard \cs{maketitle} command as taken from the \pkg{article}
2284 class but with some basic restyling.
2285 \begin{MacroCode}{class}
2286 \keys_define:nn{skrapport/maketitle}{
2287 hide .clist_set:N = \l__skrapport_maketitle_hide_clist,
2288 hide .value_required:n = true,
2289 nopdfinfo .bool_set_inverse:N = \l__skrapport_maketitle_pdfinfo_bool,
2290 nopdfinfo .default:n = true,
2291 nopdfinfo .initial:n = false
2292 }
2293 \end{MacroCode}
2294 \begin{macro*}{\__skrapport_smallprint_style:}
2295 \begin{MacroCode}{class}
2296 \cs_new_protected:Nn\__skrapport_smallprint_style:{}
2297 \end{MacroCode}
2298 \end{macro*}
2299 \begin{macro*}{\__skrapport_abstract_style:}
2300 \begin{MacroCode}{class}
2301 \cs_new_protected:Nn\__skrapport_abstract_style:
2302 {\__skrapport_title_style:}
2303 \end{MacroCode}
2304 \end{macro*}
2305 \begin{MacroCode}{class}
2306 \DeclareDocumentCommand\maketitle{o}{
2307 \clist_clear:N\l__skrapport_maketitle_hide_clist
2308 \IfNoValueF{#1}{\keys_set:nn{skrapport/maketitle}{#1}}
2309 \bool_if:NT\l__skrapport_maketitle_pdfinfo_bool{
2310 \exp_args:NNx\cs_if_exist_use:NT\hypersetup{{
2311 pdfinfo={
2312 Title={\tl_use:N\g__skrapport_title_tl},
2313 Subject={\tl_use:N\g__skrapport_regarding_tl},
2314 Author={
2315 \clist_use:Nnnn\g__skrapport_author_clist{,~}{,~}{,~}
2316 },
2317 Lang={\__skrapport_RFC_language:}
2318 }
2319 }}
2320 }
2321 \par
2322 \group_begin:
2323 \RenewDocumentCommand\thefootnote{}{
2324 \fnsymbol{footnote}
2325 }
2326 \RenewDocumentCommand\@makefnmark{}{
2327 \hbox_overlap_right:n{
2328 \@textsuperscript{\normalfont\@thefnmark}
2329 }
2330 }
2331 \RenewDocumentCommand\@makefntext{+m}{
2332 \dim_set:Nn\parindent{1em}\noindent
2333 \hbox_to_wd:nn{1.8em}{
2334 \hss\@textsuperscript{\normalfont\@thefnmark}
2335 }
2336 ##1
2337 }
2338 \newpage
2339 \int_gzero:N\@topnum
2340 \__skrapport_maketitle:
2341 \thispagestyle{plain}
2342 \group_end:
2343 \setcounter{footnote}{0}
2344 }
2345 \end{MacroCode}
2346 \end{macro}
2347 \begin{macro*}{\__skrapport_maketitle:}
2348 \begin{MacroCode}{class}
2349 \cs_new:Nn\__skrapport_maketitle:{
2350 \newpage
2351 \hbox:n{}
2352 \begin{flushleft}
2353 \vspace{-\headsep}
2354 \clist_if_in:NnF\l__skrapport_maketitle_hide_clist{regarding}{
2355 \small\__skrapport_smallprint_style:
2356 \tl_use:N\g__skrapport_regarding_tl
2357 \clist_if_in:NnF\l__skrapport_maketitle_hide_clist{date}{
2358 \tl_if_empty:NF\g__skrapport_regarding_tl{,~}
2359 }
2360 }
2361 \clist_if_in:NnF\l__skrapport_maketitle_hide_clist{date}{
2362 \tl_use:N\g__skrapport_date_tl
2363 }
2364 \clist_if_in:NnTF\l__skrapport_maketitle_hide_clist{regarding}{
2365 \clist_if_in:NnTF\l__skrapport_maketitle_hide_clist{date}
2366 {}{\par}
2367 }{\par}
2368 \vspace{1.5cm}
2369 {
2370 \Huge\__skrapport_title_style:
2371 \tl_use:N\g__skrapport_title_tl
2372 \par
2373 }
2374 \vspace{.125cm}
2375 {
2376 \Large\__skrapport_title_style:
2377 \__skrapport_author_list:
2378 }
2379 \vspace{.75cm}
2380 \end{flushleft}
2381 \par
2382 \clist_if_in:NnF\l__skrapport_maketitle_hide_clist{email}{
2383 \dim_set_to_abstract_or_email_wd:N\l_tmpa_dim
2384 \bool_gset_false:N\g__skrapport_abstract_used
2385 \dim_set:Nn\l_tmpb_dim
2386 {\textwidth-\l_tmpa_dim-\c__skrapport_abstract_separator_dim}
2387 \begin{minipage}[t]{\l_tmpa_dim}
2388 \begin{flushright}
2389 \leavevmode\__skrapport_abstract_style:
2390 \__skrapport_Email_word:
2391 \end{flushright}
2392 \end{minipage}
2393 \hspace{\c__skrapport_abstract_separator_dim}
2394 \begin{minipage}[t]{\l_tmpb_dim}
2395 \__skrapport_email_list:
2396 \end{minipage}
2397 \par
2398 }
2399 }
2400 \end{MacroCode}
2401 \end{macro*}
2402
2403 \begin{macro*}{\g__skrapport_abstract_used}
2404 This boolean keeps track of wether the \env{abstract} environment has
2405 been used, and is set accordingly in the main auxillary file.
2406 \begin{MacroCode}{class}
2407 \bool_new:N\g__skrapport_abstract_used
2408 \AtEndDocument{
2409 \iow_shipout:Nx\@mainaux{ % !!!
2410 \exp_not:N\ExplSyntaxOn
2411 \bool_if:NTF\g__skrapport_abstract_used
2412 {\exp_not:n{\bool_gset_true:N\g__skrapport_abstract_used}}
2413 {\exp_not:n{\bool_gset_false:N\g__skrapport_abstract_used}}
2414 \exp_not:N\ExplSyntaxOff
2415 }
2416 }
2417 \end{MacroCode}
2418 \end{macro*}
2419 \begin{macro*}{\dim_set_to_abstract_or_email_wd:N}[1]
2420 {Dimension register}
2421 \changes{0.12a}{Set abstract style before word to fix incorrect width}
2422 This macro sets a dimension to either the width of the email word
2423 or the width of the abstract word depending on the state of
2424 \cs{g__skrapport_abstract_used}.
2425 \begin{MacroCode}{class}
2426 \cs_new:Npn\dim_set_to_abstract_or_email_wd:N#1{
2427 \dim_set_to_wd:Nn\l_tmpa_dim
2428 {\__skrapport_abstract_style:\abstractname}
2429 \dim_set_to_wd:Nn\l_tmpb_dim
2430 {\__skrapport_abstract_style:\__skrapport_Email_word:}
2431 \bool_if:NTF\g__skrapport_abstract_used
2432 {\dim_set:Nn#1{\dim_max:nn{\l_tmpa_dim}{\l_tmpb_dim}}}
2433 {\dim_set_eq:NN#1\l_tmpb_dim}
2434 }
2435 \end{MacroCode}
2436 \end{macro*}
2437
2438 \begin{environment}{abstract}
2439 Standard restyled \env{abstract} environment from the
2440 \pkg{article} class.
2441 \begin{MacroCode}{class}
2442 \dim_const:Nn\c__skrapport_abstract_separator_dim{1em}
2443 \DeclareDocumentEnvironment{abstract}{}{
2444 \bool_gset_true:N\g__skrapport_abstract_used
2445 \dim_set_to_abstract_or_email_wd:N\l_tmpa_dim
2446 \dim_set:Nn\l_tmpb_dim
2447 {\textwidth-\l_tmpa_dim-\c__skrapport_abstract_separator_dim}
2448 \begin{minipage}[t]{\l_tmpa_dim}
2449 \begin{flushright}
2450 \leavevmode\__skrapport_abstract_style:
2451 \abstractname
2452 \end{flushright}
2453 \end{minipage}
2454 \hspace{\c__skrapport_abstract_separator_dim}
2455 \begin{minipage}[t]{\l_tmpb_dim}
2456 }{
2457 \end{minipage}
2458 }
2459 \end{MacroCode}
2460 \end{environment}
2461
2462 \begin{environment}{titlepage}
2463 Titlepage environment.
2464 \begin{macro}{\ps@skrapport@titlepage}
2465 \begin{MacroCode}{class}
2466 \cs_new:Npn\ps@skrapport@titlepage{
2467 \cs_set:Npn\@oddhead{}
2468 \cs_set:Npn\@evenhead{}
2469 \cs_set:Npn\@oddfoot{
2470 \begin{minipage}{\textwidth}
2471 \raggedleft\small\par
2472 \__skrapport_smallprint_style:
2473 \tl_use:N\g__skrapport_copyright_tl
2474 \end{minipage}
2475 }
2476 \cs_set_eq:NN\@evenfoot\@oddfoot
2477 }
2478 \end{MacroCode}
2479 \end{macro}
2480 \begin{MacroCode}{class}
2481 \DeclareDocumentEnvironment{titlepage}{}{
2482 \cleardoublepage\setcounter{page}{1}
2483 }{
2484 \bool_gset_false:N\g__skrapport_copyright_unprinted_bool
2485 \thispagestyle{skrapport@titlepage}
2486 \cleardoublepage\setcounter{page}{1}
2487 }
2488 \end{MacroCode}
2489 \end{environment}
2490
2491 \subsubsection{Sectioning}
2492 Sectioning macros. This is kind of messy. We start with creaiting
2493 some counters using our homemade \LaTeX3 counter macros.
2494 \begin{MacroCode}{class}
2495 \setcounter{secnumdepth}{3}
2496 \newcounter{section}
2497 \newcounter{subsection}[section]
2498 \newcounter{subsubsection}[subsection]
2499 \newcounter{paragraph}[subsubsection]
2500 \newcounter{subparagraph}[paragraph]
2501 \end{MacroCode}
2502 Next up, we have macros to display the section numberings.
2503 \begin{macro*}{\thesection}
2504 \begin{MacroCode}{class}
2505 \cs_gset:Npn\thesection{
2506 \arabic{section}
2507 }
2508 \end{MacroCode}
2509 \end{macro*}
2510 \begin{macro*}{\thesubsection}
2511 \begin{MacroCode}{class}
2512 \cs_gset:Npn\thesubsection{
2513 \thesection.\arabic{subsection}
2514 }
2515 \end{MacroCode}
2516 \end{macro*}
2517 \begin{macro*}{\thesubsubsection}
2518 \begin{MacroCode}{class}
2519 \cs_gset:Npn\thesubsubsection{
2520 \thesubsection.\arabic{subsubsection}
2521 }
2522 \end{MacroCode}
2523 \end{macro*}
2524 \begin{macro*}{\theparagraph}
2525 \begin{MacroCode}{class}
2526 \cs_gset:Npn\theparagraph{
2527 \thesubsubsection.\arabic{paragraph}
2528 }
2529 \end{MacroCode}
2530 \end{macro*}
2531 \begin{macro*}{\thesubparagraph}
2532 \begin{MacroCode}{class}
2533 \cs_gset:Npn\thesubparagraph{
2534 \theparagraph.\arabic{subparagraph}
2535 }
2536 \end{MacroCode}
2537 \end{macro*}
2538
2539 \paragraph{Pre- and post-section spacing}
2540 Here comes the tricky part. We define two generic macros that add
2541 spacing before and after the section title, to condense the code
2542 a bit. Note that many of the following macros constitute a
2543 reimplementation of \cs{@startsection}, \cs{@ssect}, \cs{@sect} and
2544 friends.
2545 \begin{macro}{\__skrapport_pre_section:n}[1]
2546 {Skip before the section title}
2547 \begin{MacroCode}{class}
2548 \cs_new:Npn\__skrapport_pre_section:n#1{
2549 \leavevmode\par
2550 \skip_set:Nn\l_tmpa_skip{#1}
2551 \@afterindenttrue % !!!
2552 \dim_compare:nT{\l_tmpa_skip<\c_zero_skip}{
2553 \skip_set:Nn\l_tmpa_skip{-\l_tmpa_skip}
2554 \@afterindentfalse % !!!
2555 }
2556 \if@nobreak \everypar{} \else
2557 \addpenalty\@secpenalty % !!!
2558 \skip_vertical:N\l_tmpa_skip
2559 \fi
2560 }
2561 \end{MacroCode}
2562 \end{macro}
2563 \begin{macro}{\__skrapport_post_section:n}[1]
2564 {Space after the section title}
2565 \begin{MacroCode}{class}
2566 \cs_new:Npn\__skrapport_post_section:n#1{
2567 \skip_set:Nn\l_tmpa_skip{#1}
2568 \dim_compare:nTF{\l_tmpa_skip>\c_zero_skip}{
2569 \par\nobreak
2570 \skip_vertical:N\l_tmpa_skip
2571 \@afterheading % !!!
2572 }{
2573 \@nobreakfalse
2574 \global\@noskipsectrue
2575 \skip_horizontal:n{-\l_tmpa_skip}
2576 }
2577 \ignorespaces
2578 }
2579 \end{MacroCode}
2580 \end{macro}
2581
2582 \paragraph{Starred sections}
2583 These two macros (the first only being an alias for the second with
2584 its last argument empty) correspond to unnumbered sections. Or,
2585 rather, they do all the typesetting and none of the TOC/counter
2586 stuff. This means that starred sections only call this macro, while
2587 unstarred ones call other macros in addition to this macro.
2588 \begin{macro*}{\__skrapport_section_star:nnn}
2589 \begin{macro}{\__skrapport_section_star:nnnn}[4]
2590 {Indentation of section title}
2591 {Styling of the section title}
2592 {Actual section title}
2593 {Optional code to run in the indentation (\emph{i.e.} section number)}
2594 \begin{MacroCode}{class}
2595 \cs_new:Npn\__skrapport_section_star:nnn#1#2#3{
2596 \__skrapport_section_star:nnnn{#1}{#2}{#3}{}
2597 }
2598 \cs_new:Npn\__skrapport_section_star:nnnn#1#2#3#4{
2599 \group_begin:
2600 #2
2601 \hbox_set:Nn\l_tmpa_box{{\skip_horizontal:n{#1}#4}}
2602 \dim_set:Nn\hangindent{#1+\box_wd:N\l_tmpa_box}
2603 \noindent\box_use_drop:N\l_tmpa_box
2604 \interlinepenalty\@M % !!!
2605 #3
2606 \group_end:
2607 }
2608 \end{MacroCode}
2609 \end{macro}
2610 \end{macro*}
2611
2612 \paragraph{Unstarred sections}
2613 This macro typesets an unstarred section, \emph{i.e.} a numbered
2614 one. It defines a temporary macro containing the section number
2615 (maybe, depends on the \cs{c@secnumdepth} counter) which it passes
2616 on to \cs{__skrapport_section_star:nnnn}, and then writes some things
2617 to the TOC.
2618 \begin{macro}{\__skrapport_section_nostar:nnnnnn}[6]
2619 {Section counter name}
2620 {Section level}
2621 {Indentation of section title}
2622 {Styling of the section title}
2623 {Actual section title}
2624 {Section title for TOC}
2625 \changes{0.12d}{Added support for hanging titles}
2626 \begin{MacroCode}{class}
2627 \cs_new:Npn\__skrapport_section_nostar:nnnnnn#1#2#3#4#5#6{
2628 \cs_set:Nn\__skrapport_saved_section:{}
2629 \int_compare:nF{#2>\value{secnumdepth}}{
2630 \refstepcounter{#1}
2631 \cs_set:Nn\__skrapport_saved_section:{
2632 \bool_if:NTF\g__skrapport_hanging_titles_bool
2633 {\llap{\use:c{the#1}\hspace{1ex}}}
2634 {\use:c{the#1}~}
2635 }
2636 }
2637 \__skrapport_section_star:nnnn
2638 {#3}{#4}{#5}{\__skrapport_saved_section:}
2639 \use:c{#1mark}{#6}
2640 \addcontentsline{toc}{#1}{
2641 \int_compare:nF{#2>\value{secnumdepth}}{
2642 \protect\numberline{\use:c{the#1}}
2643 }
2644 #6
2645 }
2646 }
2647 \end{MacroCode}
2648 \end{macro}
2649
2650 \paragraph{Generic sectioning macros}
2651 We will now set up a generic sectioning macro. First, we need
2652 version of the above macros that expand their arguments.
2653 \begin{macro*}{\__skrapport_pre_section:v}
2654 \changes{0.12k}{Argument specification changed from \texttt{c} to \texttt{v}}
2655 \begin{MacroCode}{class}
2656 \cs_generate_variant:Nn\__skrapport_pre_section:n{v}
2657 \end{MacroCode}
2658 \end{macro*}
2659 \begin{macro*}{\__skrapport_post_section:v}
2660 \changes{0.12k}{Argument specification changed from \texttt{c} to \texttt{v}}
2661 \begin{MacroCode}{class}
2662 \cs_generate_variant:Nn\__skrapport_post_section:n{v}
2663 \end{MacroCode}
2664 \end{macro*}
2665 \begin{macro*}{\__skrapport_section_star:vvn}
2666 \changes{0.12k}{Argument specification changed from \texttt{ccn} to \texttt{vvn}}
2667 \begin{MacroCode}{class}
2668 \cs_generate_variant:Nn\__skrapport_section_star:nnn{vvn}
2669 \end{MacroCode}
2670 \end{macro*}
2671 \begin{macro*}{\__skrapport_section_nostar:nnvvnn}
2672 \changes{0.12k}{Argument specification changed from \texttt{nnccnn} to \texttt{nnvvnn}}
2673 \begin{MacroCode}{class}
2674 \cs_generate_variant:Nn\__skrapport_section_nostar:nnnnnn{nnvvnn}
2675 \end{MacroCode}
2676 \end{macro*}
2677
2678 Now, the generic sectioning macro basically takes the sectioning
2679 macro arguments straight up (arguments 3--5), additionally
2680 requiring a section counter name and a section level. It expects
2681 that constant dimensions (see definition of \cs{section} below)
2682 and a formatting macro are available, and passes these as arguments
2683 to the underlying sectioning macros as appropriate.
2684 \begin{macro}{\__skrapport_generic_section:nnnnn}[5]
2685 {Section counter name}
2686 {Section level}
2687 {Star (tested with \cs{IfBooleanTF})}
2688 {Optional argument (or \cs{NoValue})}
2689 {Section title text}
2690 \begin{MacroCode}{class}
2691 \cs_set:Nn\__skrapport_generic_section:nnnnn{
2692 \__skrapport_pre_section:v{c__skrapport_#1_pre_skip}
2693 \IfBooleanTF#3{
2694 \__skrapport_section_star:vvn
2695 {c__skrapport_#1_indent_dim}
2696 {__skrapport_#1_style:}
2697 {#5}
2698 }{
2699 \IfNoValueTF{#4}{
2700 \__skrapport_section_nostar:nnvvnn
2701 {#1}{#2}
2702 {c__skrapport_#1_indent_dim}
2703 {__skrapport_#1_style:}
2704 {#5}
2705 {#5}
2706 }{
2707 \__skrapport_section_nostar:nnvvnn
2708 {#1}{#2}
2709 {c__skrapport_#1_indent_dim}
2710 {__skrapport_#1_style:}
2711 {#5}
2712 {#4}
2713 }
2714 }
2715 \__skrapport_post_section:v{c__skrapport_#1_post_skip}
2716 }
2717 \end{MacroCode}
2718 \end{macro}
2719
2720 \paragraph{Public sectioning API}
2721 It's time to define the public sectioning macros. They all follow
2722 the same format: first, two skips and one dimension (used by
2723 \cs{__skrapport_generic_section:nnnnn}) are defined, as well as
2724 a macro defining the text style of the section. Then, the actual
2725 macro is provided.
2726 \begin{macro}{\section}[3]
2727 {Star (tested with \cs{IfBooleanTF})}
2728 {Optional short title (or \cs{NoValue})}
2729 {Sectioning title}
2730 \begin{macro*}{\c__skrapport_section_pre_skip}
2731 This is the skip \emph{before} a section title.
2732 \begin{MacroCode}{class}
2733 \skip_const:Nn\c__skrapport_section_pre_skip{-4ex~plus~1ex~minus~-1ex}
2734 \end{MacroCode}
2735 \end{macro*}
2736 \begin{macro*}{\c__skrapport_section_post_skip}
2737 This is the skip \emph{after} a section title.
2738 \begin{MacroCode}{class}
2739 \skip_const:Nn\c__skrapport_section_post_skip{.5ex~plus~.5ex}
2740 \end{MacroCode}
2741 \end{macro*}
2742 \begin{macro*}{\c__skrapport_section_indent_dim}
2743 This is the \emph{indentation} of a section title.
2744 \begin{MacroCode}{class}
2745 \dim_const:Nn \c__skrapport_section_indent_dim{\c_zero_dim}
2746 \end{MacroCode}
2747 \end{macro*}
2748 \begin{macro*}{\c__skrapport_section_style:}
2749 This is the text style of a section title.
2750 \begin{MacroCode}{class}
2751 \cs_set_protected:Nn\__skrapport_section_style:
2752 {\normalfont\LARGE\__skrapport_title_style:}
2753 \end{MacroCode}
2754 \end{macro*}
2755 Finally, the public macro is provided.
2756 \begin{MacroCode}{class}
2757 \DeclareDocumentCommand\section{som}{
2758 \__skrapport_generic_section:nnnnn{section}{1}{#1}{#2}{#3}
2759 }
2760 \end{MacroCode}
2761 \end{macro}
2762
2763 The other sectioning macros (macros from section to subparagraph are
2764 available) are defined in an analogous manner.
2765 \begin{macro}{\subsection}[3]
2766 {Star (tested with \cs{IfBooleanTF})}
2767 {Optional short title (or \cs{NoValue})}
2768 {Sectioning title}
2769 \begin{macro*}{\c__skrapport_subsection_pre_skip}
2770 \begin{MacroCode}{class}
2771 \skip_const:Nn\c__skrapport_subsection_pre_skip{-3ex~plus~1ex~minus~-1ex}
2772 \end{MacroCode}
2773 \end{macro*}
2774 \begin{macro*}{\c__skrapport_subsection_post_skip}
2775 \begin{MacroCode}{class}
2776 \skip_const:Nn\c__skrapport_subsection_post_skip{.25ex~plus~.25ex}
2777 \end{MacroCode}
2778 \end{macro*}
2779 \begin{macro*}{\c__skrapport_subsection_indent_dim}
2780 \begin{MacroCode}{class}
2781 \dim_const:Nn \c__skrapport_subsection_indent_dim{\c_zero_dim}
2782 \end{MacroCode}
2783 \end{macro*}
2784 \begin{macro*}{\c__skrapport_subsection_style:}
2785 \begin{MacroCode}{class}
2786 \cs_set_protected:Nn\__skrapport_subsection_style:
2787 {\normalfont\Large\__skrapport_title_style:}
2788 \end{MacroCode}
2789 \end{macro*}
2790 \begin{MacroCode}{class}
2791 \DeclareDocumentCommand\subsection{som}{
2792 \__skrapport_generic_section:nnnnn{subsection}{2}{#1}{#2}{#3}
2793 }
2794 \end{MacroCode}
2795 \end{macro}
2796 \begin{macro}{\subsubsection}[3]
2797 {Star (tested with \cs{IfBooleanTF})}
2798 {Optional short title (or \cs{NoValue})}
2799 {Sectioning title}
2800 \begin{macro*}{\c__skrapport_subsubsection_pre_skip}
2801 \begin{MacroCode}{class}
2802 \skip_const:Nn\c__skrapport_subsubsection_pre_skip{-2ex~plus~.5ex~minus~-.5ex}
2803 \end{MacroCode}
2804 \end{macro*}
2805 \begin{macro*}{\c__skrapport_subsubsection_post_skip}
2806 \begin{MacroCode}{class}
2807 \skip_const:Nn\c__skrapport_subsubsection_post_skip{.125ex~plus~.125ex}
2808 \end{MacroCode}
2809 \end{macro*}
2810 \begin{macro*}{\c__skrapport_subsubsection_indent_dim}
2811 \begin{MacroCode}{class}
2812 \dim_const:Nn \c__skrapport_subsubsection_indent_dim{\c_zero_dim}
2813 \end{MacroCode}
2814 \end{macro*}
2815 \begin{macro*}{\c__skrapport_subsubsection_style:}
2816 \begin{MacroCode}{class}
2817 \cs_set_protected:Nn\__skrapport_subsubsection_style:
2818 {\normalfont\large\__skrapport_title_style:}
2819 \end{MacroCode}
2820 \end{macro*}
2821 \begin{MacroCode}{class}
2822 \DeclareDocumentCommand\subsubsection{som}{
2823 \__skrapport_generic_section:nnnnn{subsubsection}{3}{#1}{#2}{#3}
2824 }
2825 \end{MacroCode}
2826 \end{macro}
2827 \begin{macro}{\paragraph}[3]
2828 {Star (tested with \cs{IfBooleanTF})}
2829 {Optional short title (or \cs{NoValue})}
2830 {Sectioning title}
2831 \begin{macro*}{\c__skrapport_paragraph_pre_skip}
2832 \begin{MacroCode}{class}
2833 \skip_const:Nn\c__skrapport_paragraph_pre_skip{1ex~plus~.25ex~minus~-.25ex}
2834 \end{MacroCode}
2835 \end{macro*}
2836 \begin{macro*}{\c__skrapport_paragraph_post_skip}
2837 \begin{MacroCode}{class}
2838 \skip_const:Nn\c__skrapport_paragraph_post_skip{-1em}
2839 \end{MacroCode}
2840 \end{macro*}
2841 \begin{macro*}{\c__skrapport_paragraph_indent_dim}
2842 \begin{MacroCode}{class}
2843 \dim_const:Nn \c__skrapport_paragraph_indent_dim{\c_zero_dim}
2844 \end{MacroCode}
2845 \end{macro*}
2846 \begin{macro*}{\c__skrapport_paragraph_style:}
2847 \begin{MacroCode}{class}
2848 \cs_set_protected:Nn\__skrapport_paragraph_style:
2849 {\normalfont\normalsize\__skrapport_title_style:}
2850 \end{MacroCode}
2851 \end{macro*}
2852 \begin{MacroCode}{class}
2853 \DeclareDocumentCommand\paragraph{som}{
2854 \__skrapport_generic_section:nnnnn{paragraph}{4}{#1}{#2}{#3}
2855 }
2856 \end{MacroCode}
2857 \end{macro}
2858 \begin{macro}{\subparagraph}[3]
2859 {Star (tested with \cs{IfBooleanTF})}
2860 {Optional short title (or \cs{NoValue})}
2861 {Sectioning title}
2862 \begin{macro*}{\c__skrapport_subparagraph_pre_skip}
2863 \begin{MacroCode}{class}
2864 \skip_const:Nn\c__skrapport_subparagraph_pre_skip{1ex~plus~.25ex~minus~-.25ex}
2865 \end{MacroCode}
2866 \end{macro*}
2867 \begin{macro*}{\c__skrapport_subparagraph_post_skip}
2868 \begin{MacroCode}{class}
2869 \skip_const:Nn\c__skrapport_subparagraph_post_skip{-1em}
2870 \end{MacroCode}
2871 \end{macro*}
2872 \begin{macro*}{\c__skrapport_subparagraph_indent_dim}
2873 \begin{MacroCode}{class}
2874 \dim_const:Nn \c__skrapport_subparagraph_indent_dim{\parindent}
2875 \end{MacroCode}
2876 \end{macro*}
2877 \begin{macro*}{\c__skrapport_subparagraph_style:}
2878 \begin{MacroCode}{class}
2879 \cs_set_protected:Nn\__skrapport_subparagraph_style:
2880 {\normalfont\normalsize\__skrapport_title_style:\itshape}
2881 \end{MacroCode}
2882 \end{macro*}
2883 \begin{MacroCode}{class}
2884 \DeclareDocumentCommand\subparagraph{som}{
2885 \__skrapport_generic_section:nnnnn{subparagraph}{5}{#1}{#2}{#3}
2886 }
2887 \end{MacroCode}
2888 \end{macro}
2889
2890 \subsubsection{Macros and environments from \pkg{article}}
2891 \paragraph{List environments}
2892 First, several dimensions are provided and three penalties defined.
2893 \begin{MacroCode}{class}
2894 \dim_gset:Nn\leftmargini{2em}
2895 \dim_gset_eq:NN\leftmargin\leftmargini
2896 \dim_gset:Nn\leftmarginii{2em}
2897 \dim_gset:Nn\leftmarginiii{1.5em}
2898 \dim_gset:Nn\leftmarginiv{1.5em}
2899 \dim_gset:Nn\leftmarginv{1em}
2900 \dim_gset:Nn\leftmarginvi{1em}
2901 \dim_gset:Nn\labelsep{.5em}
2902 \dim_gset_eq:NN\labelwidth\leftmargini
2903 \dim_gsub:Nn\labelwidth{-\labelsep}
2904 \int_gset:Nn\@beginparpenalty{-\@lowpenalty}
2905 \int_gset:Nn\@endparpenalty {-\@lowpenalty}
2906 \int_gset:Nn\@itempenalty {-\@lowpenalty}
2907 \end{MacroCode}
2908
2909 Then, we define the appearance of the item numbers.
2910 \begin{macro*}{\theenumi}
2911 The first level consists of arabic numbers (\(1,2,3,\dotsc\)).
2912 \begin{MacroCode}{class}
2913 \cs_set:Npn\theenumi {\arabic{enumi}}
2914 \end{MacroCode}
2915 \end{macro*}
2916 \begin{macro*}{\theenumii}
2917 The second level consists of lower-case alphabetic characters
2918 (\(\text{a},\text{b},\text{c},\dotsc\)).
2919 \begin{MacroCode}{class}
2920 \cs_set:Npn\theenumii {\alph{enumii}}
2921 \end{MacroCode}
2922 \end{macro*}
2923 \begin{macro*}{\theenumiii}
2924 The third level consists of lower-case roman numerals
2925 (\(\text{i},\text{ii},\text{iii},\dotsc\)).
2926 \begin{MacroCode}{class}
2927 \cs_set:Npn\theenumiii{\roman{enumiii}}
2928 \end{MacroCode}
2929 \end{macro*}
2930 \begin{macro*}{\theenumiv}
2931 The fourth level consists of upper-case alphabetic characters
2932 (\(\text{A},\text{B},\text{C},\dotsc\)).
2933 \begin{MacroCode}{class}
2934 \cs_set:Npn\theenumiv {\Alph{enumiv}}
2935 \end{MacroCode}
2936 \end{macro*}
2937 We also need macros that typeset the actual labels. Here, different
2938 levels have a different postfix: all levels except the second are
2939 postfixed by a period, while the second level is postfixed by a
2940 closing bracket.
2941 \begin{macro*}{\labelenumi}
2942 \begin{MacroCode}{class}
2943 \cs_new:Npn\labelenumi{\theenumi.}
2944 \end{MacroCode}
2945 \end{macro*}
2946 \begin{macro*}{\labelenumii}
2947 \begin{MacroCode}{class}
2948 \cs_new:Npn\labelenumii{\theenumii)}
2949 \end{MacroCode}
2950 \end{macro*}
2951 \begin{macro*}{\labelenumiii}
2952 \begin{MacroCode}{class}
2953 \cs_new:Npn\labelenumiii{\theenumiii.}
2954 \end{MacroCode}
2955 \end{macro*}
2956 \begin{macro*}{\labelenumiv}
2957 \begin{MacroCode}{class}
2958 \cs_new:Npn\labelenumiv{\theenumiv.}
2959 \end{MacroCode}
2960 \end{macro*}
2961 We also fix the referencing of lower-level items so that one can
2962 refer to them properly (\emph{i.e.} as 1b(iii) and so on).
2963 \begin{macro*}{\p@enumii}
2964 \begin{MacroCode}{class}
2965 \cs_set:Npn\p@enumii{\theenumi}
2966 \end{MacroCode}
2967 \end{macro*}
2968 \begin{macro*}{\p@enumiii}
2969 \begin{MacroCode}{class}
2970 \cs_set:Npn\p@enumiii{\theenumi(\theenumii)}
2971 \end{MacroCode}
2972 \end{macro*}
2973 \begin{macro*}{\p@enumiiv}
2974 \begin{MacroCode}{class}
2975 \cs_set:Npn\p@enumiv{\p@enumiii\theenumiii}
2976 \end{MacroCode}
2977 \end{macro*}
2978
2979 All that was for numbered lists (\env{enumerate}). Now, we define
2980 the \enquote{labels} of \env{itemize} items. Alternately, they
2981 are a bullet (\textbullet) and a boldfaced dash
2982 ({\normalfont\bfseries\textendash}).
2983 \begin{macro*}{\labelitemi}
2984 \begin{MacroCode}{class}
2985 \cs_set:Npn\labelitemi{\textbullet}
2986 \end{MacroCode}
2987 \end{macro*}
2988 \begin{macro*}{\labelitemii}
2989 \begin{MacroCode}{class}
2990 \cs_set:Npn\labelitemii{\normalfont\bfseries\textendash}
2991 \end{MacroCode}
2992 \end{macro*}
2993 \begin{macro*}{\labelitemiii}
2994 \begin{MacroCode}{class}
2995 \cs_set:Npn\labelitemiii{\textbullet}
2996 \end{MacroCode}
2997 \end{macro*}
2998 \begin{macro*}{\labelitemiv}
2999 \begin{MacroCode}{class}
3000 \cs_set:Npn\labelitemiv{\normalfont\bfseries\textendash}
3001 \end{MacroCode}
3002 \end{macro*}
3003
3004 The last of the commonly used list environments is \env{description}.
3005 Defining it is fairly simple --- we define a list with empty item
3006 labels and a bit of hackery for the \cs{makelabel} macro inside.
3007 \begin{environment}{description}
3008 \begin{MacroCode}{class}
3009 \DeclareDocumentEnvironment{description}{}{
3010 \begin{list}{}{
3011 \dim_zero:N\labelwidth
3012 \dim_set:Nn\itemindent{-\leftmargin}
3013 \cs_set_eq:NN\makelabel\descriptionlabel
3014 }
3015 }{
3016 \end{list}
3017 }
3018 \end{MacroCode}
3019 \begin{macro}{\descriptionlabel}
3020 Additionally, the \cs{descriptionlabel} macro is defined.
3021 \begin{MacroCode}{class}
3022 \NewDocumentCommand\descriptionlabel{m}{
3023 \hspace{\labelsep}\normalfont\bfseries #1
3024 }
3025 \end{MacroCode}
3026 \end{macro}
3027 \end{environment}
3028
3029 \paragraph{Quotation environments}
3030 The quotation environments are also fairly simple --- \env{quote}
3031 is just a list with a single item, and \env{quotation} is a
3032 \env{quote} with extra skips around it.
3033 \begin{environment}{quote}
3034 \begin{MacroCode}{class}
3035 \NewDocumentEnvironment{quote}{}{
3036 \begin{list}{}{
3037 \dim_set_eq:NN\rightmargin\leftmargin
3038 }
3039 \item\itshape
3040 }{
3041 \end{list}
3042 }
3043 \end{MacroCode}
3044 \end{environment}
3045 \begin{environment}{quotation}
3046 \begin{MacroCode}{class}
3047 \NewDocumentEnvironment{quotation}{}{
3048 \bigskip
3049 \begin{quote}
3050 }{
3051 \end{quote}
3052 \bigskip
3053 }
3054 \end{MacroCode}
3055 \end{environment}
3056 There's a \env{verse} environment, too, but it's just \env{quote}.
3057 \begin{environment}{verse}
3058 \begin{MacroCode}{class}
3059 \NewDocumentEnvironment{verse}{}{
3060 \begin{quote}
3061 }{
3062 \end{quote}
3063 }
3064 \end{MacroCode}
3065 \end{environment}
3066
3067 \paragraph{Front- and backmatter}
3068 We only define one front/backmatter macro; \cs{appendix}.
3069 \begin{macro}{\appendix}
3070 \begin{MacroCode}{class}
3071 \NewDocumentCommand\appendix{}{
3072 \par
3073 \setcounter{section}{0}
3074 \setcounter{subsection}{0}
3075 \cs_gset:Npn\thesection{\Alph{section}}
3076 }
3077 \end{MacroCode}
3078 \end{macro}
3079
3080 \paragraph{Old font macros}
3081 The old font macros have been deprecated. Do not use!
3082 \begin{macro}{\rm}
3083 \changes{0.12}{Deprecated command}
3084 \begin{MacroCode}{class}
3085 \DeclareDocumentCommand\rm{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\rm}{\textrm}}
3086 \end{MacroCode}
3087 \end{macro}
3088 \begin{macro}{\sf}
3089 \changes{0.12}{Deprecated command}
3090 \begin{MacroCode}{class}
3091 \DeclareDocumentCommand\sf{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\sf}{\textsf}}
3092 \end{MacroCode}
3093 \end{macro}
3094 \begin{macro}{\tt}
3095 \changes{0.12}{Deprecated command}
3096 \begin{MacroCode}{class}
3097 \DeclareDocumentCommand\tt{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\tt}{\texttt}}
3098 \end{MacroCode}
3099 \end{macro}
3100 \begin{macro}{\bf}
3101 \changes{0.12}{Deprecated command}
3102 \begin{MacroCode}{class}
3103 \DeclareDocumentCommand\bf{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\bf}{\textbf}}
3104 \end{MacroCode}
3105 \end{macro}
3106 \begin{macro}{\it}
3107 \changes{0.12}{Deprecated command}
3108 \begin{MacroCode}{class}
3109 \DeclareDocumentCommand\it{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\it}{\textit}}
3110 \end{MacroCode}
3111 \end{macro}
3112 \begin{macro}{\sl}
3113 \changes{0.12}{Deprecated command}
3114 \begin{MacroCode}{class}
3115 \DeclareDocumentCommand\sl{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\sl}{\textsl}}
3116 \end{MacroCode}
3117 \end{macro}
3118 \begin{macro}{\sc}
3119 \changes{0.12}{Deprecated command}
3120 \begin{MacroCode}{class}
3121 \DeclareDocumentCommand\sc{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\sc}{\textsc}}
3122 \end{MacroCode}
3123 \end{macro}
3124
3125 \paragraph{The emphasis macro}
3126 \begin{macro}{\emph}
3127 \changes{0.12}{Changed definition, may have introduced spacing issues}
3128 Redefining the \cs{emph} style to be bold when nested.
3129 \begin{macro*}{\em}
3130 \changes{0.12}{Deprecated command}
3131 \begin{MacroCode}{class}
3132 \DeclareDocumentCommand\em{}{\msg_error:nnnn{skrapport}{old-font-deprecated}{\em}{\emph}}
3133 \end{MacroCode}
3134 \end{macro*}
3135 \begin{macro*}{\__skrapport_emphstyle:}
3136 \begin{MacroCode}{class}
3137 \cs_new:Nn\__skrapport_emphstyle:{
3138 \itshape
3139 \dim_compare:nF{\fontdimen\c_one_int\font>\c_zero_dim}{\bfseries}
3140 }
3141 \end{MacroCode}
3142 \end{macro*}
3143 \begin{MacroCode}{class}
3144 \DeclareDocumentCommand\emph{+m}{
3145 \ifmmode
3146 \text{\__skrapport_emphstyle: #1}
3147 \else
3148 {\__skrapport_emphstyle: #1}
3149 \fi
3150 }
3151 \end{MacroCode}
3152 \end{macro}
3153
3154 \paragraph{The footnote rule}
3155 \begin{macro*}{\footnoterule}
3156 \changes{0.12}{Removed footnote rule entirely}
3157 \begin{MacroCode}{class}
3158 \DeclareDocumentCommand\footnoterule{}{}
3159 \end{MacroCode}
3160 \end{macro*}
3161 \begin{macro*}{\@makefntext}
3162 \begin{MacroCode}{class}
3163 \DeclareDocumentCommand\@makefntext{+m}{
3164 \dim_set:Nn\parindent{1em}\noindent
3165 \hbox_to_wd:nn{1.8em}{\hss\@makefnmark}
3166 #1
3167 }
3168 \end{MacroCode}
3169 \end{macro*}
3170
3171 \subsubsection{Floats}
3172 \paragraph{Table- and box-related lengths}
3173 \begin{MacroCode}{class}
3174 \dim_gset:Nn\arraycolsep {5pt}
3175 \dim_gset:Nn\tabcolsep {6pt}
3176 \dim_gset:Nn\arrayrulewidth{.4pt}
3177 \dim_gset:Nn\doublerulesep {2pt}
3178 \dim_gset_eq:NN\tabbingsep\labelsep
3179 \skip_gset_eq:NN{\skip\@mpfootins}{\skip\footins}
3180 \dim_gset:Nn\fboxsep {3pt}
3181 \dim_gset:Nn\fboxrule {.4pt}
3182 \end{MacroCode}
3183
3184 \paragraph{Counters}
3185 \begin{MacroCode}{class}
3186 \newcounter{figure}
3187 \newcounter{table}
3188 \end{MacroCode}
3189 \begin{macro*}{\theequation}
3190 \begin{MacroCode}{class}
3191 \cs_set:Npn\theequation{\arabic{equation}}
3192 \end{MacroCode}
3193 \end{macro*}
3194 \begin{macro*}{\thefigure}
3195 \begin{MacroCode}{class}
3196 \cs_set:Npn\thefigure{\arabic{figure}}
3197 \end{MacroCode}
3198 \end{macro*}
3199 \begin{macro*}{\thetable}
3200 \begin{MacroCode}{class}
3201 \cs_set:Npn\thetable{\arabic{table}}
3202 \end{MacroCode}
3203 \end{macro*}
3204
3205 \paragraph{Defaults}
3206 The default placement, list extension and caption text of all floats.
3207 \begin{MacroCode}{class}
3208 \cs_new:Npn \fps@figure{tb}
3209 \cs_new:Npn\ftype@figure{1}
3210 \cs_new:Npn \ext@figure{lof}
3211 \cs_new:Npn \fnum@figure{\figurename\ \thefigure}
3212 \cs_new:Npn \fps@table {tb}
3213 \cs_new:Npn\ftype@table {2}
3214 \cs_new:Npn \ext@table {lot}
3215 \cs_new:Npn \fnum@table {\tablename\ \thetable}
3216 \end{MacroCode}
3217
3218 \paragraph{Environments}
3219 \begin{macro}{\__skrapport_xfloat:nn}
3220 \begin{macro*}{\__skrapport_xfloat:nx}
3221 This is a helper macro basically replacing the \cs{@float} macro
3222 used by \LaTeXe.
3223 \begin{MacroCode}{class}
3224 \cs_new:Npn\__skrapport_xfloat:nn#1#2{\@xfloat{#1}[#2]}
3225 \cs_generate_variant:Nn\__skrapport_xfloat:nn{nx}
3226 \end{MacroCode}
3227 \end{macro*}
3228 \end{macro}
3229 \begin{environment}{figure}
3230 \changes{0.12a}{Figures are now \cs{centering}ed by default}
3231 \begin{environment*}{figure*}
3232 \begin{MacroCode}{class}
3233 \DeclareDocumentEnvironment{figure}{o}{
3234 \__skrapport_xfloat:nx{figure}
3235 {\IfNoValueTF{#1}{\fps@figure}{#1}}
3236 \centering
3237 }{
3238 \end@float
3239 }
3240 \DeclareDocumentEnvironment{figure*}{o}{
3241 \__skrapport_xfloat:nx{figure}
3242 {\IfNoValueTF{#1}{tp}{#1}}
3243 \centering
3244 }{
3245 \end@float
3246 }
3247 \end{MacroCode}
3248 \end{environment*}
3249 \end{environment}
3250 \begin{environment}{table}
3251 \changes{0.12a}{Tables are now \cs{centering}ed by default}
3252 \begin{environment*}{table*}
3253 \begin{MacroCode}{class}
3254 \DeclareDocumentEnvironment{table}{o}{
3255 \__skrapport_xfloat:nx{table}
3256 {\IfNoValueTF{#1}{\fps@table}{#1}}
3257 \centering
3258 }{
3259 \end@float
3260 }
3261 \DeclareDocumentEnvironment{table*}{o}{
3262 \__skrapport_xfloat:nx{table}
3263 {\IfNoValueTF{#1}{tp}{#1}}
3264 \centering
3265 }{
3266 \end@float
3267 }
3268 \end{MacroCode}
3269 \end{environment*}
3270 \end{environment}
3271
3272 In addition to the \env{figure} and \env{table} environments, we
3273 also provide a \env{figcenter} environment that enables centering
3274 of figures or tables that are too wide for the page.
3275 \begin{macro*}{\coffin_typeset:Nnnon}
3276 \begin{MacroCode}{class}
3277 \cs_generate_variant:Nn\coffin_typeset:Nnnnn{Nnnon}
3278 \end{MacroCode}
3279 \end{macro*}
3280 \begin{environment}{figcenter}
3281 \changes{0.12c}{Fixed the x-offset calculation}
3282 \begin{MacroCode}{class}
3283 \DeclareDocumentEnvironment{figcenter}{}{
3284 \cs_set_eq:NN\l__tmpa_cs\caption
3285 \cs_set:Npn\caption{\msg_error:nn{skrapport}{caption-in-figcenter}}
3286 \coffin_clear:N\l_tmpa_coffin
3287 \hcoffin_set:Nw\l_tmpa_coffin
3288 }{
3289 \hcoffin_set_end:
3290 \dim_set:Nn\l_tmpa_dim{(\textwidth - \coffin_wd:N\l_tmpa_coffin)/2}
3291 \coffin_typeset:Nnnon\l_tmpa_coffin{H}{l}{\dim_use:N\l_tmpa_dim}{0pt}
3292 \cs_set_eq:NN\caption\l__tmpa_cs
3293 \cs_undefine:N\l__tmpa_cs
3294 }
3295 \end{MacroCode}
3296 \end{environment}
3297
3298 \paragraph{Captions}
3299 Before we begin, we pass options to \pkg{caption}, in case the user
3300 is loading it or another package based upon it. This fixes an issue
3301 where the custom caption style was overwritten with the ugly default
3302 \pkg{article} caption style.
3303 \begin{MacroCode}{class}
3304 \PassOptionsToPackage{font=small,labelfont+=bf,textfont+=it}{caption}
3305 \end{MacroCode}
3306 \begin{macro*}{\__skrapport_caption_name_style:}
3307 \begin{MacroCode}{class}
3308 \cs_new_protected:Nn\__skrapport_caption_name_style:{\small\bfseries}
3309 \end{MacroCode}
3310 \end{macro*}
3311 \begin{macro*}{\__skrapport_caption_text_style:}
3312 \begin{MacroCode}{class}
3313 \cs_new_protected:Nn\__skrapport_caption_text_style:{\small\itshape}
3314 \end{MacroCode}
3315 \end{macro*}
3316 \begin{MacroCode}{class}
3317 \skip_new:N\abovecaptionskip
3318 \skip_set:Nn\abovecaptionskip{10pt}
3319 \skip_new:N\belowcaptionskip
3320 \skip_set:Nn\belowcaptionskip{10pt}
3321 \end{MacroCode}
3322 \begin{macro*}{\@makecaption}
3323 \changes{0.10c}{Fix missing coloring command for some captions}
3324 \changes{0.12}{Split \cs{@captionstyle} into two macros}
3325 \changes{0.12a}{Fix a bug which applied caption name styling to the
3326 caption text}
3327 This should possibly be redefined already at the \cs{caption} level.
3328 \begin{MacroCode}{class}
3329 \cs_new:Npn\@makecaption#1#2{
3330 \skip_vertical:N\abovecaptionskip
3331 \hbox_set:Nn\l_tmpa_box{
3332 \color@setgroup % !!!
3333 {\__skrapport_caption_name_style:#1:~}
3334 {\__skrapport_caption_text_style:#2}
3335 \color@endgroup % !!!
3336 }
3337 \dim_compare:nTF{\box_wd:N\l_tmpa_box>\hsize}{
3338 {\__skrapport_caption_name_style:#1:~}
3339 {\__skrapport_caption_text_style:#2}
3340 \par
3341 }{
3342 \global\@minipagefalse % !!!
3343 \hbox_to_wd:nn{\hsize}{
3344 \hfil
3345 \box_use_drop:N\l_tmpa_box
3346 \hfil
3347 }
3348 }
3349 \skip_vertical:N\belowcaptionskip
3350 }
3351 \end{MacroCode}
3352 \end{macro*}
3353
3354 \subsubsection{Table of contents}
3355 \begin{MacroCode}{class}
3356 \cs_new:Npn\@pnumwidth{1.55em}
3357 \cs_new:Npn\@tocrmarg{2em}
3358 \cs_new:Npn\@dotsep{1.7}
3359 \setcounter{tocdepth}{3}
3360 \end{MacroCode}
3361 \begin{macro}{\tableofcontents}
3362 \changes{0.12}{Removed spacing and \cs{@mkboth} call}
3363 \begin{MacroCode}{class}
3364 \DeclareDocumentCommand\tableofcontents{}{
3365 \section*{\contentsname}
3366 \makeatletter
3367 \@starttoc{toc}
3368 \makeatother
3369 }
3370 \end{MacroCode}
3371 \end{macro}
3372
3373 The following macros conspire to replace \cs{@dottedtocline}.
3374 \begin{macro*}{\__skrapport_toc_line:nnnnnn}[6]
3375 {TOC line character}
3376 {Table of contents level of the line}
3377 {Indentation at the start of the line}
3378 {Width of the section number}
3379 {Section title}
3380 {Page number}
3381 \begin{MacroCode}{class}
3382 \cs_new:Npn\__skrapport_toc_line:nnnnnn#1#2#3#4#5#6{
3383 \int_compare:nF{#2>\value{tocdepth}}{
3384 \skip_vertical:n{0pt~plus~.2pt}
3385 \group_begin:
3386 \skip_set:Nn\leftskip{#3}
3387 \skip_set_eq:NN\rightskip\@tocrmarg
3388 \skip_set:Nn\parfillskip{-\rightskip}
3389 \dim_set:Nn\parindent{#3}
3390 \@afterindenttrue % !!!
3391 \interlinepenalty\@M % !!!
3392 \leavevmode
3393 \end{MacroCode}
3394 This here is pretty dumb. We can't use a \LaTeX3\ temporary skip
3395 register (or skip the temporary), because \texttt{\#5} further down
3396 will contain a \cs{hbox} based on \cs{@tempdima}. The proper thing
3397 to do here would be to rewrite \cs{addcontentsline}, I guess. Bah.
3398 \begin{MacroCode}{class}
3399 \skip_set:Nn\@tempdima{#4} % !!! (dumb)
3400 \skip_add:Nn\leftskip{\@tempdima}
3401 \null\nobreak
3402 \skip_horizontal:n{-\leftskip}
3403 {#5}\nobreak
3404 \str_if_eq:nnTF{#1}{}{
3405 \hfill
3406 }{
3407 \leaders\hbox:n{
3408 \(\mkern\@dotsep mu\hbox{#1}\mkern\@dotsep mu\) % !!!
3409 }
3410 }
3411 \hfill\nobreak
3412 \hbox_to_wd:nn{\@pnumwidth}{ % !!!
3413 \hfil\normalfont\normalcolor #6
3414 }
3415 \par
3416 \group_end:
3417 }
3418 }
3419 \end{MacroCode}
3420 \end{macro*}
3421 \begin{macro*}{\__skrapport_toc_line:nnnnnn}[5]
3422 {Table of contents level of the line}
3423 {Indentation at the start of the line}
3424 {Width of the section number}
3425 {Section title}
3426 {Page number}
3427 This is a variant of \cs{__skrapport_toc_line:nnnnnn} which
3428 implicitly sets empty space as its TOC line.
3429 \begin{MacroCode}{class}
3430 \cs_new:Npn\__skrapport_toc_line:nnnnn#1#2#3#4#5{
3431 \__skrapport_toc_line:nnnnnn{}{#1}{#2}{#3}{#4}{#5}
3432 }
3433 \end{MacroCode}
3434 \end{macro*}
3435 \begin{macro*}{\l@section}
3436 \changes{0.12}{Now uses \cs{__skrapport_toc_line:nnnnn}}
3437 \begin{MacroCode}{class}
3438 \DeclareDocumentCommand\l@section{mm}{
3439 \group_begin:
3440 \skip_vertical:n{.75ex}
3441 \bfseries
3442 \__skrapport_toc_line:nnnnn{1}{0em}{1.3em}{#1}{#2}
3443 \group_end:
3444 }
3445 \end{MacroCode}
3446 \end{macro*}
3447 \begin{macro*}{\l@subsection}
3448 \changes{0.12}{Now uses \cs{__skrapport_toc_line:nnnnnn}}
3449 \begin{MacroCode}{class}
3450 \DeclareDocumentCommand\l@subsection{mm}{
3451 \group_begin:
3452 \skip_vertical:n{.35ex}
3453 \penalty\@secpenalty % !!!
3454 \__skrapport_toc_line:nnnnnn{.}{2}{1.3em}{2em}{#1}{#2}
3455 \group_end:
3456 }
3457 \end{MacroCode}
3458 \end{macro*}
3459 \begin{macro*}{\l@subsubsection}
3460 \changes{0.12}{Changed style to match \pkg{skdoc}}
3461 \begin{MacroCode}{class}
3462 \DeclareDocumentCommand\l@subsubsection{mm}{
3463 \skip_set:Nn\leftskip{3.3em}
3464 \dim_set_eq:NN\parindent\c_zero_dim
3465 \group_begin:
3466 \cs_set_eq:NN\numberline\use_none:n
3467 \small #1~[#2]
3468 \group_end:
3469 }
3470 \end{MacroCode}
3471 \end{macro*}
3472 \begin{macro*}{\l@paragraph}
3473 \begin{MacroCode}{class}
3474 \DeclareDocumentCommand\l@paragraph{mm}{
3475 \int_compare:nF{4>\value{tocdepth}}{
3476 \msg_warning:nnnn{skrapport}{tocdepth-too-deep}
3477 {4}{\l@paragraph}
3478 }
3479 }
3480 \end{MacroCode}
3481 \end{macro*}
3482 \begin{macro*}{\l@subparagraph}
3483 \begin{MacroCode}{class}
3484 \DeclareDocumentCommand\l@subparagraph{mm}{
3485 \int_compare:nF{5>\value{tocdepth}}{
3486 \msg_warning:nnnn{skrapport}{tocdepth-too-deep}
3487 {5}{\l@subparagraph}
3488 }
3489 }
3490 \end{MacroCode}
3491 \end{macro*}
3492
3493 Fix for \emph{e.g.}~\pkg{tocloft} package.
3494 \begin{MacroCode}{class}
3495 \cs_set:Npn\l@figure{}
3496 \cs_set:Npn\l@table{}
3497 \end{MacroCode}
3498
3499 \subsubsection{Basic bibliography support}
3500 \begin{MacroCode}{class}
3501 \dim_new:N\bibindent
3502 \dim_set:Nn\bibindent{2em}
3503 \end{MacroCode}
3504 \begin{environment}{thebibliography}
3505 \changes{0.12}{Removed \cs{@mkboth}, \cs{@openbib@code} and
3506 \cs{@noitemerr}}
3507 \begin{MacroCode}{class}
3508 \DeclareDocumentEnvironment{thebibliography}{m}{
3509 \section*{\refname}
3510 \list{\@biblabel{\arabic{enumiv}}}{
3511 \dim_set_to_wd:Nn\labelwidth{\@biblabel{#1}}
3512 \dim_set_eq:NN\leftmargin\labelwidth
3513 \dim_add:Nn\leftmargin{\labelsep}
3514 \usecounter{enumiv} % !!!
3515 \cs_set:Nn\p@enumiv{}
3516 \RenewDocumentCommand\theenumiv{}{\arabic{enumiv}}
3517 }
3518 \sloppy
3519 \int_set:Nn\clubpenalty{4000}
3520 \int_set_eq:NN\@clubpenalty\clubpenalty
3521 \int_set:Nn\widowpenalty{4000}
3522 }{
3523 \cs_set:Nn\@noitemerr{}
3524 \endlist
3525 }
3526 \end{MacroCode}
3527 \end{environment}
3528 \begin{macro*}{\newblock}
3529 \begin{MacroCode}{class}
3530 \DeclareDocumentCommand\newblock{}{
3531 \skip_horizontal:n{.11em~plus~.33em~minus~.07em}
3532 }
3533 \end{MacroCode}
3534 \end{macro*}
3535 \begin{environment}{theindex}
3536 \changes{0.12}{Use \pkg{multicol} instead of \cs{twocolumn} mode,
3537 removed \cs{@mkboth} call}
3538 \begin{MacroCode}{class}
3539 \DeclareDocumentEnvironment{theindex}{}{
3540 \begin{multicols}{2}[\section*{\indexname}]
3541 \thispagestyle{plain}
3542 \dim_zero:N\parindent
3543 \skip_set:N\parskip{\c_zero_skip~plus~.3pt}
3544 \dim_zero:N\columnseprule
3545 \dim_set:Nn\columnsep{35pt}
3546 \cs_set_eq:NN\item\@idxitem
3547 }{
3548 \end{multicols}
3549 }
3550 \end{MacroCode}
3551 \end{environment}
3552 \begin{macro*}{\@idxitem}
3553 \begin{MacroCode}{class}
3554 \DeclareDocumentCommand\@idxitem{}{
3555 \par
3556 \dim_set:Nn\hangindent{40pt}
3557 }
3558 \end{MacroCode}
3559 \end{macro*}
3560 \begin{macro}{\subitem}
3561 \begin{MacroCode}{class}
3562 \DeclareDocumentCommand\subitem{}{
3563 \@idxitem
3564 \hspace*{20pt}
3565 }
3566 \end{MacroCode}
3567 \end{macro}
3568 \begin{macro}{\subsubitem}
3569 \begin{MacroCode}{class}
3570 \DeclareDocumentCommand\subsubitem{}{
3571 \@idxitem
3572 \hspace*{30pt}
3573 }
3574 \end{MacroCode}
3575 \end{macro}
3576 \begin{macro*}{\indexspace}
3577 \begin{MacroCode}{class}
3578 \DeclareDocumentCommand\indexspace{}{
3579 \par
3580 \skip_vertical:n{10pt~plus~5pt~minus~3pt}
3581 }
3582 \end{MacroCode}
3583 \end{macro*}
3584
3585 \subsubsection{Miscellaneous}
3586 A macro \cs{comment} (alias \cs{com}/\cs{note}) is defined to let
3587 the user add comments and notes to the document.
3588 \begin{macro}{\__skrapport_comment:n}
3589 \begin{MacroCode}{class}
3590 \cs_new:Npn\__skrapport_comment:n#1{
3591 {\textbf{\__skrapport_Comment_word: :}~#1}
3592 }
3593 \end{MacroCode}
3594 \end{macro}
3595 \begin{macro}{\comment}
3596 \changes{0.10}{Added macro for comments}
3597 \changes{0.12b}{No longer uses \cs{colorbox} if no color package is loaded}
3598 \begin{MacroCode}{class}
3599 \DeclareDocumentCommand\comment{sm}{
3600 \IfBooleanTF{#1}
3601 {
3602 \cs_if_exist_use:NT\colorbox{{red!50}}
3603 {\__skrapport_comment:n{#2}}
3604 }
3605 {\marginpar{\__skrapport_comment:n{#2}}}
3606 }
3607 \end{MacroCode}
3608 \end{macro}
3609 \begin{macro}{\com}
3610 \begin{macro}{\note}
3611 \changes{0.10b}{Fixed a silly error in \cs{com} and \cs{note}}
3612 \begin{MacroCode}{class}
3613 \ProvideDocumentCommand\com{sm}
3614 {\IfBooleanTF{#1}{\comment*{#2}}{\comment{#2}}}
3615 \ProvideDocumentCommand\note{sm}
3616 {\IfBooleanTF{#1}{\comment*{#2}}{\comment{#2}}}
3617 \end{MacroCode}
3618 \end{macro}
3619 \end{macro}
3620
3621 \begin{macro}{\__skrapport_space_if_not_punctuation:}
3622 \begin{MacroCode}{class}
3623 \cs_new:Nn\__skrapport_space_if_not_punctuation:{
3624 \clist_if_in:noF
3625 {{,},:,;,!,?,-,),'}
3626 {\token_to_meaning:N\l_peek_token}
3627 {\ }
3628 }
3629 \end{MacroCode}
3630 \end{macro}
3631 \begin{macro}{\__skrapport_peek_punctuation:n}
3632 \begin{macro*}{\__skrapport_peek_punctuation:x}
3633 \begin{MacroCode}{class}
3634 \cs_new_nopar:Nn\__skrapport_peek_punctuation:n{
3635 \mbox{#1}
3636 \peek_meaning_remove:NTF.{}{
3637 \peek_meaning:NF\ {
3638 \peek_after:Nw\__skrapport_space_if_not_punctuation:
3639 }
3640 }
3641 }
3642 \cs_generate_variant:Nn\__skrapport_peek_punctuation:n{x}
3643 \end{MacroCode}
3644 \end{macro*}
3645 \end{macro}
3646 \begin{macro}{\eg}
3647 \begin{MacroCode}{class}
3648 \DeclareDocumentCommand\eg{}{
3649 \__skrapport_peek_punctuation:x{\__skrapport_eg_word:}
3650 }
3651 \end{MacroCode}
3652 \end{macro}
3653 \begin{macro}{\ie}
3654 \begin{MacroCode}{class}
3655 \DeclareDocumentCommand\ie{}{
3656 \__skrapport_peek_punctuation:x{\__skrapport_ie_word:}
3657 }
3658 \end{MacroCode}
3659 \end{macro}
3660 \begin{macro}{\etc}
3661 \begin{MacroCode}{class}
3662 \DeclareDocumentCommand\etc{}{
3663 \__skrapport_peek_punctuation:x{\__skrapport_etc_word:}
3664 }
3665 \end{MacroCode}
3666 \end{macro}
3667 \begin{macro}{\cf}
3668 \begin{MacroCode}{class}
3669 \DeclareDocumentCommand\cf{}{
3670 \__skrapport_peek_punctuation:x{\__skrapport_cf_word:}
3671 }
3672 \end{MacroCode}
3673 \end{macro}
3674 \begin{macro}{\viz}
3675 \begin{MacroCode}{class}
3676 \DeclareDocumentCommand\viz{}{
3677 \__skrapport_peek_punctuation:x{\__skrapport_viz_word:}
3678 }
3679 \end{MacroCode}
3680 \end{macro}
3681 \begin{macro}{\dash}
3682 \begin{MacroCode}{class}
3683 \DeclareDocumentCommand\dash{}{
3684 \cs_if_exist_use:NT\texorpdfstring
3685 {\unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}{{ - }}
3686 }
3687 \cs_if_exist_use:NT\DeclareUnicodeCharacter{{2014}{\dash}}
3688 \end{MacroCode}
3689 \end{macro}
3690
3691 \subsubsection{Color theme support}
3692 Color theme setup. Start by patching commands and declaring
3693 default colors. Not implemented: background colors for e.g.
3694 quote environments and sections headings, different colors
3695 for the different sectioning levels.
3696 \begin{MacroCode}{class}
3697 \bool_if:NT\g__skrapport_color_bool{
3698 \apptocmd{\bfseries}
3699 {\color{skrapport@boldcolor}}{}
3700 {\msg_warning:nnn{skrapport}{color-patch-failed}{\bfseries}}
3701 \apptocmd{\itshape}
3702 {\color{skrapport@italiccolor}}{}
3703 {\msg_warning:nnn{skrapport}{color-patch-failed}{\itshape}}
3704 \apptocmd{\__skrapport_title_style:}
3705 {\color{skrapport@titlecolor}}{}
3706 {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_title_style:}}
3707 \apptocmd{\__skrapport_smallprint_style:}
3708 {\color{skrapport@smallprintcolor}}{}
3709 {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_smallprint_style:}}
3710 \apptocmd{\__skrapport_abstract_style:}
3711 {\color{skrapport@titlecolor}}{}
3712 {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_abstract_style:}}
3713 \apptocmd{\quote}
3714 {\color{skrapport@quotecolor}}{}
3715 {\msg_warning:nnn{skrapport}{color-patch-failed}{\quote}}
3716 \apptocmd{\__skrapport_caption_name_style:}
3717 {\color{skrapport@captioncolor}}{}
3718 {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_caption_name_style:}}
3719 \apptocmd{\__skrapport_emphstyle:}
3720 {\color{skrapport@emphcolor}}{}
3721 {\msg_warning:nnn{skrapport}{color-patch-failed}{\__skrapport_emphstyle:}}
3722 \end{MacroCode}
3723 % I have no idea why this was here or what difference it makes. These
3724 % things should be using \__skrapport_title_style:.
3725 % \ifskrapport@twocolumn\AtBeginDocument{%
3726 % \renewcommand\section{\@startsection {section}{1}{\z@}%
3727 % {-.999\baselineskip}{0.001\baselineskip}{\bfseries\mathversi%on{bold}\color{skrapport@titlecolor}}}
3728 % \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
3729 % {\baselineskip}{-.35\baselineskip}{\bfseries\color{skrapport@titlecolor}\unskip}}
3730 % \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
3731 % {\baselineskip}{-.35\baselineskip}{\itshape\color{skrapport@titlecolor}\unskip}}
3732 % }\fi
3733 % \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
3734 % {1ex \@plus .25ex \@minus -.25ex}{-1em}{\normalfont\normalsize\bfseries\color{skrapport@titlecolor}}}
3735 % \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
3736 % {1ex \@plus .25ex \@minus -.25ex}{-1em}{\normalfont\normalsize\itshape\color{skrapport@titlecolor}}}
3737 \begin{MacroCode}{class}
3738 \AtBeginDocument{\@ifpackageloaded{hyperref}{%
3739 \hypersetup{%
3740 citebordercolor=skrapport@citecolor,citecolor=skrapport@citecolor,%
3741 filebordercolor=skrapport@filecolor,filecolor=skrapport@filecolor,%
3742 linkbordercolor=skrapport@linkcolor,linkcolor=skrapport@linkcolor,%
3743 menubordercolor=skrapport@menucolor,menucolor=skrapport@menucolor,%
3744 urlbordercolor=skrapport@urlcolor,urlcolor=skrapport@urlcolor,%
3745 runbordercolor=skrapport@runcolor,runcolor=skrapport@runcolor%
3746 }
3747 }{}}
3748 \AtBeginDocument{\color{skrapport@defaultcolor}}
3749 \end{MacroCode}
3750 \begin{macro}{\colortheme}
3751 The \cs{colortheme} macro allows the end-user to load color themes
3752 (described later) to customize the colors of the document when the
3753 class is loaded with the \opt{color} option.
3754 \begin{MacroCode}{class}
3755 \DeclareDocumentCommand\colortheme{m}{
3756 \usepackage{skrapport-colortheme-#1}
3757 }
3758 \end{MacroCode}
3759 \end{macro}
3760 \begin{MacroCode}{class}
3761 \colortheme{default}
3762 }
3763 \end{MacroCode}
3764
3765 \subsection{Final class setup}
3766 We end the document class by setting a few lengths along with the
3767 page style and page numbering. Also, activate \cs{raggedbottom} and
3768 \cs{onexolumn} (since we always do all the two-column stuff
3769 ourselves anyway).
3770 \begin{MacroCode}{class}
3771 \dim_set:Nn\columnsep{10pt}
3772 \dim_zero:N\columnseprule
3773 \pagestyle{plain}
3774 \pagenumbering{arabic}
3775 \raggedbottom
3776 \onecolumn
3777 \endinput
3778 \end{MacroCode}
3779
3780 \subsection{Color themes}
3781 As described earlier, the user can load color themes to customize
3782 the appearance of the document if the class was loaded with the
3783 \opt{color} option. Four themes are available by default.
3784
3785 \subsubsection{Default color theme}
3786 \begin{theme}{Default}
3787 \changes{0.09}{Added default color theme}
3788 \begin{MacroCode}{theme-default}
3789 \RequirePackage{expl3}
3790 \ProvidesExplPackage{skrapport-colortheme-default}
3791 {2012/06/07}{1.0}{skrapport color theme default}
3792 \definecolor{skrapport@citecolor}{named}{green}
3793 \definecolor{skrapport@filecolor}{named}{teal}
3794 \definecolor{skrapport@linkcolor}{named}{red}
3795 \definecolor{skrapport@menucolor}{named}{red}
3796 \definecolor{skrapport@urlcolor}{named}{cyan}
3797 \definecolor{skrapport@runcolor}{named}{teal}
3798 \definecolor{skrapport@boldcolor}{named}{black}
3799 \definecolor{skrapport@titlecolor}{named}{black}
3800 \definecolor{skrapport@italiccolor}{named}{black}
3801 \definecolor{skrapport@smallprintcolor}{named}{black}
3802 \definecolor{skrapport@quotecolor}{named}{black}
3803 \definecolor{skrapport@captioncolor}{named}{black}
3804 \definecolor{skrapport@emphcolor}{named}{black}
3805 \definecolor{skrapport@defaultcolor}{named}{black}
3806 \endinput
3807 \end{MacroCode}
3808 \end{theme}
3809
3810 \subsubsection{Unscathed color theme}
3811 \begin{theme}{Unscathed}
3812 \changes{0.09}{Added \enquote{Unschathed} color theme}
3813 \begin{MacroCode}{theme-unscathed}
3814 \RequirePackage{expl3}
3815 \ProvidesExplPackage{skrapport-colortheme-unscathed}
3816 {2012/06/07}{1.0}{skrapport color theme unscathed}
3817 \definecolor{skrapport@citecolor}{named}{skrapport@defaultcolor}
3818 \definecolor{skrapport@filecolor}{named}{skrapport@defaultcolor}
3819 \definecolor{skrapport@menucolor}{named}{skrapport@defaultcolor}
3820 \definecolor{skrapport@runcolor}{named}{skrapport@defaultcolor}
3821 \definecolor{skrapport@emphcolor}{HTML}{463335}
3822 \definecolor{skrapport@linkcolor}{HTML}{CF5D3B}
3823 \definecolor{skrapport@urlcolor}{named}{skrapport@linkcolor}
3824 \definecolor{skrapport@titlecolor}{HTML}{B34430}
3825 \definecolor{skrapport@captioncolor}{named}{skrapport@titlecolor}
3826 \definecolor{skrapport@quotecolor}{HTML}{70524A}
3827 \definecolor{skrapport@smallprintcolor}{named}{skrapport@quotecolor}
3828 \endinput
3829 \end{MacroCode}
3830 \end{theme}
3831
3832 \subsubsection{Cruelwater color theme}
3833 \begin{theme}{Cruelwater}
3834 \changes{0.09}{Added \enquote{Cruelwater} color theme}
3835 \begin{MacroCode}{theme-cruelwater}
3836 \RequirePackage{expl3}
3837 \ProvidesExplPackage{skrapport-colortheme-cruelwater}
3838 {2012/06/07}{1.0}{skrapport color theme cruelwater}
3839 \definecolor{skrapport@citecolor}{named}{black}
3840 \definecolor{skrapport@filecolor}{named}{black}
3841 \definecolor{skrapport@linkcolor}{named}{black}
3842 \definecolor{skrapport@menucolor}{named}{black}
3843 \definecolor{skrapport@urlcolor}{named}{black}
3844 \definecolor{skrapport@runcolor}{named}{black}
3845 \definecolor{skrapport@boldcolor}{HTML}{030C22}
3846 \definecolor{skrapport@titlecolor}{HTML}{20293F}
3847 \definecolor{skrapport@italiccolor}{named}{black}
3848 \definecolor{skrapport@smallprintcolor}{HTML}{A9B0B3}
3849 \definecolor{skrapport@quotecolor}{HTML}{404749}
3850 \definecolor{skrapport@captioncolor}{HTML}{030C22}
3851 \definecolor{skrapport@emphcolor}{HTML}{20293F}
3852 \definecolor{skrapport@defaultcolor}{named}{black}
3853 \endinput
3854 \end{MacroCode}
3855 \end{theme}
3856
3857 \subsubsection{Violet color theme}
3858 \begin{theme}{Violet}
3859 \changes{0.09}{Added \enquote{Violet} color theme}
3860 \begin{MacroCode}{theme-violet}
3861 \RequirePackage{expl3}
3862 \ProvidesExplPackage{skrapport-colortheme-violet}
3863 {2012/06/07}{1.0}{skrapport color theme violet}
3864 \definecolor{skrapport@citecolor}{HTML}{932444}
3865 \definecolor{skrapport@filecolor}{HTML}{932444}
3866 \definecolor{skrapport@linkcolor}{HTML}{932444}
3867 \definecolor{skrapport@menucolor}{HTML}{932444}
3868 \definecolor{skrapport@urlcolor}{HTML}{932444}
3869 \definecolor{skrapport@runcolor}{HTML}{932444}
3870 \definecolor{skrapport@boldcolor}{HTML}{311A2A}
3871 \definecolor{skrapport@titlecolor}{HTML}{311A2A}
3872 \definecolor{skrapport@italiccolor}{named}{black}
3873 \definecolor{skrapport@smallprintcolor}{HTML}{D6CBCF}
3874 \definecolor{skrapport@quotecolor}{HTML}{463335}
3875 \definecolor{skrapport@captioncolor}{HTML}{311A2A}
3876 \definecolor{skrapport@emphcolor}{HTML}{98758D}
3877 \definecolor{skrapport@defaultcolor}{named}{black}
3878 \endinput
3879 \end{MacroCode}
3880 \end{theme}
3881
3882 \subsubsection{skdoc color theme}
3883 \begin{theme}{skdoc}
3884 \changes{0.11a}{Added \enquote{skdoc} color theme}
3885 \begin{MacroCode}{theme-skdoc}
3886 \RequirePackage{expl3}
3887 \ProvidesExplPackage{skrapport-colortheme-skdoc}
3888 {2013/04/10}{1.0}{skrapport color theme skdoc}
3889 \definecolor{skrapport@citecolor}{RGB}{140,35,24}
3890 \definecolor{skrapport@filecolor}{RGB}{73,10,61}
3891 \definecolor{skrapport@linkcolor}{RGB}{140,35,24}
3892 \definecolor{skrapport@menucolor}{RGB}{140,35,24}
3893 \definecolor{skrapport@urlcolor}{RGB}{73,10,61}
3894 \definecolor{skrapport@runcolor}{RGB}{73,10,61}
3895 \definecolor{skrapport@boldcolor}{RGB}{73,10,61}
3896 \definecolor{skrapport@titlecolor}{RGB}{11,72,107}
3897 \definecolor{skrapport@italiccolor}{named}{black}
3898 \definecolor{skrapport@smallprintcolor}{RGB}{11,72,107}
3899 \definecolor{skrapport@quotecolor}{RGB}{140,35,24}
3900 \definecolor{skrapport@captioncolor}{RGB}{11,72,107}
3901 \definecolor{skrapport@emphcolor}{RGB}{73,10,61}
3902 \definecolor{skrapport@defaultcolor}{named}{black}
3903 \endinput
3904 \end{MacroCode}
3905 \end{theme}
3906
3907 \section{Point sizes}
3908 The point size options are pretty much \LaTeX3 translations of the
3909 standard \pkg{article} class option files. There's a lot of duplicate
3910 code here which may be worth to consolidate a bit.
3911
3912 \subsubsection{Common macros}
3913 We first set up a package providing replacements for \LaTeXe\ macros,
3914 common to all the point size files.
3915 \begin{MacroCode}{size-common}
3916 \RequirePackage{expl3}
3917 \ProvidesExplPackage{skrapport-size-common}
3918 {2013/04/29}{1.0}{skrapport point size option common macros}
3919 \end{MacroCode}
3920 \begin{macro}{\__skrapport_set_font_size:nn}[2]
3921 {Font size}
3922 {Baseline skip?} % !!!
3923 \begin{MacroCode}{size-common}
3924 \cs_new:Npn\__skrapport_set_font_size:nn#1#2{
3925 \fontsize{#1}{#2} % !!!
3926 \selectfont
3927 }
3928 \end{MacroCode}
3929 \end{macro}
3930 \begin{MacroCode}{size-common}
3931 \endinput
3932 \end{MacroCode}
3933
3934 \subsubsection{Actual point size files}
3935 \begin{MacroCode}{size-10,size-11,size-12}
3936 \RequirePackage{expl3}
3937 \end{MacroCode}
3938 \begin{MacroCode}{size-10}
3939 \ProvidesExplFile{skrapport-size10pt.clo}
3940 {2013/04/29}{1.0}{skrapport point size option 10pt}
3941 \end{MacroCode}
3942 \begin{MacroCode}{size-11}
3943 \ProvidesExplFile{skrapport-size11pt.clo}
3944 {2013/04/29}{1.0}{skrapport point size option 11pt}
3945 \end{MacroCode}
3946 \begin{MacroCode}{size-12}
3947 \ProvidesExplFile{skrapport-size12pt.clo}
3948 {2013/04/29}{1.0}{skrapport point size option 12pt}
3949 \end{MacroCode}
3950 \begin{MacroCode}{size-10,size-11,size-12}
3951 \RequirePackage{skrapport-size-common}
3952 \end{MacroCode}
3953 \begin{macro}{\normalsize}
3954 \begin{MacroCode}{size-10,size-11,size-12}
3955 \RenewDocumentCommand\normalsize{}{
3956 \end{MacroCode}
3957 \begin{MacroCode}{size-10}
3958 \__skrapport_set_font_size:nn{10}{12}
3959 \skip_gset:Nn \abovedisplayskip {10pt~plus~2pt~minus~5pt}
3960 \skip_gset:Nn \abovedisplayshortskip {0pt ~plus~3pt}
3961 \skip_gset:Nn \belowdisplayshortskip {6pt ~plus~3pt~minus~3pt}
3962 \end{MacroCode}
3963 \begin{MacroCode}{size-11}
3964 \__skrapport_set_font_size:nn{11}{13.2}
3965 \skip_gset:Nn \abovedisplayskip {11pt ~plus~3pt ~minus~6pt}
3966 \skip_gset:Nn \abovedisplayshortskip {0pt ~plus~3pt}
3967 \skip_gset:Nn \belowdisplayshortskip {6.5pt~plus~3.5pt~minus~3pt}
3968 \end{MacroCode}
3969 \begin{MacroCode}{size-12}
3970 \__skrapport_set_font_size:nn{12}{14.5}
3971 \skip_gset:Nn \abovedisplayskip {12pt ~plus~3pt ~minus~7pt}
3972 \skip_gset:Nn \abovedisplayshortskip {0pt ~plus~3pt}
3973 \skip_gset:Nn \belowdisplayshortskip {6.5pt~plus~3.5pt~minus~3pt}
3974 \end{MacroCode}
3975 \begin{MacroCode}{size-10,size-11,size-12}
3976 \skip_gset_eq:NN\belowdisplayskip \abovedisplayskip
3977 \cs_gset_eq:NN\@listi\@listI
3978 }
3979 \end{MacroCode}
3980 \end{macro}
3981 \begin{MacroCode}{size-10,size-11,size-12}
3982 \normalsize
3983 \end{MacroCode}
3984 \begin{macro}{\small}
3985 \begin{MacroCode}{size-10,size-11,size-12}
3986 \NewDocumentCommand\small{}{
3987 \end{MacroCode}
3988 \begin{MacroCode}{size-10}
3989 \__skrapport_set_font_size:nn{9}{11}
3990 \skip_gset:Nn \abovedisplayskip {8.5pt~plus~3pt~minus~4pt}
3991 \skip_gset:Nn \abovedisplayshortskip {0pt ~plus~2pt}
3992 \skip_gset:Nn \belowdisplayshortskip {4pt ~plus~2pt~minus~2pt}
3993 \end{MacroCode}
3994 \begin{MacroCode}{size-11}
3995 \__skrapport_set_font_size:nn{10}{12}
3996 \skip_gset:Nn \abovedisplayskip {10pt~plus~2pt~minus~5pt}
3997 \skip_gset:Nn \abovedisplayshortskip {0pt ~plus~2pt}
3998 \skip_gset:Nn \belowdisplayshortskip {6pt ~plus~3pt~minus~3pt}
3999 \end{MacroCode}
4000 \begin{MacroCode}{size-12}
4001 \__skrapport_set_font_size:nn{11}{13.6}
4002 \skip_gset:Nn \abovedisplayskip {11pt ~plus~3pt ~minus~6pt}
4003 \skip_gset:Nn \abovedisplayshortskip {0pt ~plus~3pt}
4004 \skip_gset:Nn \belowdisplayshortskip {6.5pt~plus~3.5pt~minus~3pt}
4005 \end{MacroCode}
4006 \begin{MacroCode}{size-10,size-11,size-12}
4007 \skip_gset_eq:NN\belowdisplayskip \abovedisplayskip
4008 \cs_gset:Npn\@listi{
4009 \dim_gset_eq:NN\leftmargin\leftmargini
4010 \end{MacroCode}
4011 \begin{MacroCode}{size-10}
4012 \skip_gset:Nn\topsep{4pt~plus~2pt~minus~2pt}
4013 \skip_gset:Nn\parsep{2pt~plus~1pt~minus~1pt}
4014 \end{MacroCode}
4015 \begin{MacroCode}{size-11}
4016 \skip_gset:Nn\topsep{6pt~plus~2pt~minus~2pt}
4017 \skip_gset:Nn\parsep{3pt~plus~2pt~minus~1pt}
4018 \end{MacroCode}
4019 \begin{MacroCode}{size-12}
4020 \skip_gset:Nn\topsep{ 9pt~plus~3pt~minus~5pt}
4021 \skip_gset:Nn\parsep{4.5pt~plus~2pt~minus~1pt}
4022 \end{MacroCode}
4023 \begin{MacroCode}{size-10,size-11,size-12}
4024 \skip_gset_eq:NN\itemsep\parsep
4025 }
4026 }
4027 \end{MacroCode}
4028 \end{macro}
4029 \begin{macro}{\footnotesize}
4030 \begin{MacroCode}{size-10,size-11,size-12}
4031 \NewDocumentCommand\footnotesize{}{
4032 \end{MacroCode}
4033 \begin{MacroCode}{size-10}
4034 \__skrapport_set_font_size:nn{8}{9.5}
4035 \skip_gset:Nn \abovedisplayskip {6pt~plus~2pt~minus~4pt}
4036 \skip_gset:Nn \abovedisplayshortskip {0pt~plus~1pt}
4037 \skip_gset:Nn \belowdisplayshortskip {3pt~plus~1pt~minus~2pt}
4038 \end{MacroCode}
4039 \begin{MacroCode}{size-11}
4040 \__skrapport_set_font_size:nn{9}{11}
4041 \skip_gset:Nn \abovedisplayskip {8pt~plus~2pt~minus~4pt}
4042 \skip_gset:Nn \abovedisplayshortskip {0pt~plus~1pt}
4043 \skip_gset:Nn \belowdisplayshortskip {4pt~plus~2pt~minus~2pt}
4044 \end{MacroCode}
4045 \begin{MacroCode}{size-12}
4046 \__skrapport_set_font_size:nn{10}{12}
4047 \skip_gset:Nn \abovedisplayskip {10pt~plus~2pt~minus~5pt}
4048 \skip_gset:Nn \abovedisplayshortskip { 0pt~plus~3pt}
4049 \skip_gset:Nn \belowdisplayshortskip { 6pt~plus~3pt~minus~3pt}
4050 \end{MacroCode}
4051 \begin{MacroCode}{size-10,size-11,size-12}
4052 \skip_gset_eq:NN\belowdisplayskip \abovedisplayskip
4053 \cs_gset:Npn\@listi{
4054 \dim_gset_eq:NN\leftmargin\leftmargini
4055 \end{MacroCode}
4056 \begin{MacroCode}{size-10}
4057 \skip_gset:Nn\topsep{3pt~plus~1pt~minus~1pt}
4058 \skip_gset:Nn\parsep{2pt~plus~1pt~minus~1pt}
4059 \end{MacroCode}
4060 \begin{MacroCode}{size-11}
4061 \skip_gset:Nn\topsep{4pt~plus~2pt~minus~2pt}
4062 \skip_gset:Nn\parsep{2pt~plus~1pt~minus~1pt}
4063 \end{MacroCode}
4064 \begin{MacroCode}{size-12}
4065 \skip_gset:Nn\topsep{6pt~plus~2pt~minus~2pt}
4066 \skip_gset:Nn\parsep{3pt~plus~2pt~minus~1pt}
4067 \end{MacroCode}
4068 \begin{MacroCode}{size-10,size-11,size-12}
4069 \skip_gset_eq:NN\itemsep\parsep
4070 }
4071 }
4072 \end{MacroCode}
4073 \end{macro}
4074 \begin{macro}{\scriptsize}
4075 \begin{MacroCode}{size-10,size-11,size-12}
4076 \NewDocumentCommand\scriptsize{}{
4077 \end{MacroCode}
4078 \begin{MacroCode}{size-10}
4079 \__skrapport_set_font_size:nn{7}{8}
4080 \end{MacroCode}
4081 \begin{MacroCode}{size-11,size-12}
4082 \__skrapport_set_font_size:nn{8}{9.5}
4083 \end{MacroCode}
4084 \begin{MacroCode}{size-10,size-11,size-12}
4085 }
4086 \end{MacroCode}
4087 \end{macro}
4088 \begin{macro}{\tiny}
4089 \begin{MacroCode}{size-10,size-11,size-12}
4090 \NewDocumentCommand\tiny{}{
4091 \end{MacroCode}
4092 \begin{MacroCode}{size-10}
4093 \__skrapport_set_font_size:nn{5}{6}
4094 \end{MacroCode}
4095 \begin{MacroCode}{size-11,size-12}
4096 \__skrapport_set_font_size:nn{6}{7}
4097 \end{MacroCode}
4098 \begin{MacroCode}{size-10,size-11,size-12}
4099 }
4100 \end{MacroCode}
4101 \end{macro}
4102 \begin{macro}{\large}
4103 \begin{MacroCode}{size-10,size-11,size-12}
4104 \NewDocumentCommand\large{}{
4105 \end{MacroCode}
4106 \begin{MacroCode}{size-10,size-11}
4107 \__skrapport_set_font_size:nn{12}{14}
4108 \end{MacroCode}
4109 \begin{MacroCode}{size-12}
4110 \__skrapport_set_font_size:nn{14}{18}
4111 \end{MacroCode}
4112 \begin{MacroCode}{size-10,size-11,size-12}
4113 }
4114 \end{MacroCode}
4115 \end{macro}
4116 \begin{macro}{\Large}
4117 \begin{MacroCode}{size-10,size-11,size-12}
4118 \NewDocumentCommand\Large{}{
4119 \end{MacroCode}
4120 \begin{MacroCode}{size-10,size-11}
4121 \__skrapport_set_font_size:nn{14}{18}
4122 \end{MacroCode}
4123 \begin{MacroCode}{size-12}
4124 \__skrapport_set_font_size:nn{17}{22}
4125 \end{MacroCode}
4126 \begin{MacroCode}{size-10,size-11,size-12}
4127 }
4128 \end{MacroCode}
4129 \end{macro}
4130 \begin{macro}{\LARGE}
4131 \begin{MacroCode}{size-10,size-11,size-12}
4132 \NewDocumentCommand\LARGE{}{
4133 \end{MacroCode}
4134 \begin{MacroCode}{size-10,size-11}
4135 \__skrapport_set_font_size:nn{17}{22}
4136 \end{MacroCode}
4137 \begin{MacroCode}{size-12}
4138 \__skrapport_set_font_size:nn{20}{25}
4139 \end{MacroCode}
4140 \begin{MacroCode}{size-10,size-11,size-12}
4141 }
4142 \end{MacroCode}
4143 \end{macro}
4144 \begin{macro}{\huge}
4145 \begin{MacroCode}{size-10,size-11,size-12}
4146 \NewDocumentCommand\huge{}{
4147 \end{MacroCode}
4148 \begin{MacroCode}{size-10,size-11}
4149 \__skrapport_set_font_size:nn{20}{25}
4150 \end{MacroCode}
4151 \begin{MacroCode}{size-12}
4152 \__skrapport_set_font_size:nn{25}{30}
4153 \end{MacroCode}
4154 \begin{MacroCode}{size-10,size-11,size-12}
4155 }
4156 \end{MacroCode}
4157 \end{macro}
4158 \begin{macro}{\Huge}
4159 \begin{MacroCode}{size-10,size-11,size-12}
4160 \NewDocumentCommand\Huge{}{
4161 \end{MacroCode}
4162 \begin{MacroCode}{size-10,size-11}
4163 \__skrapport_set_font_size:nn{25}{30}
4164 \end{MacroCode}
4165 \begin{MacroCode}{size-12}
4166 \__skrapport_set_font_size:nn{30}{36}
4167 \end{MacroCode}
4168 \begin{MacroCode}{size-10,size-11,size-12}
4169 }
4170 \end{MacroCode}
4171 \end{macro}
4172 \begin{MacroCode}{size-10}
4173 \dim_set:Nn\parindent {15pt}
4174 \end{MacroCode}
4175 \begin{MacroCode}{size-11}
4176 \dim_set:Nn\parindent {17pt}
4177 \end{MacroCode}
4178 \begin{MacroCode}{size-12}
4179 \dim_set:Nn\parindent {1.5em}
4180 \end{MacroCode}
4181 \begin{MacroCode}{size-10,size-11,size-12}
4182 \skip_set:Nn\smallskipamount{ 3pt~plus~1pt~minus~1pt}
4183 \skip_set:Nn\medskipamount { 6pt~plus~2pt~minus~2pt}
4184 \skip_set:Nn\bigskipamount {12pt~plus~4pt~minus~4pt}
4185 \dim_set:Nn\headheight{12pt}
4186 \dim_set:Nn\headsep {25pt}
4187 \dim_set:Nn\topskip {10pt}
4188 \dim_set:Nn\footskip {30pt}
4189 \dim_set:Nn\maxdepth { 5pt}
4190 \end{MacroCode}
4191 These (\emph{i.e.} text width and height) are hopefully overwritten
4192 by \pkg{typearea} later, so we don't bother much with them.
4193 \begin{MacroCode}{size-10,size-11,size-12}
4194 \dim_set:Nn\textwidth {\paperwidth-2cm}
4195 \dim_set:Nn\textheight{\paperheight-2cm}
4196 \dim_set:Nn\oddsidemargin {.2cm}
4197 \dim_set:Nn\evensidemargin {1cm}
4198 \dim_set:Nn\marginparsep {11pt}
4199 \dim_set:Nn\marginparpush {5pt}
4200 \dim_set:Nn\marginparwidth {.8cm-\marginparsep}
4201 \dim_set:Nn\topmargin{\paperheight-1cm
4202 -\headheight-\headsep
4203 -\textheight-\footskip
4204 -.5\topmargin}
4205 \end{MacroCode}
4206 \begin{MacroCode}{size-10}
4207 \dim_set:Nn\footnotesep{6.65pt}
4208 \skip_set:Nn{\skip\footins} { 9pt~plus~4pt~minus~2pt}
4209 \skip_set:Nn\floatsep {12pt~plus~2pt~minus~2pt}
4210 \skip_set:Nn\textfloatsep {20pt~plus~2pt~minus~4pt}
4211 \skip_set:Nn\intextsep {12pt~plus~2pt~minus~2pt}
4212 \skip_set:Nn\dblfloatsep {12pt~plus~2pt~minus~2pt}
4213 \skip_set:Nn\dbltextfloatsep{20pt~plus~2pt~minus~4pt}
4214 \end{MacroCode}
4215 \begin{MacroCode}{size-11}
4216 \dim_set:Nn\footnotesep{7.7pt}
4217 \skip_set:Nn{\skip\footins} {10pt~plus~4pt~minus~2pt}
4218 \skip_set:Nn\floatsep {12pt~plus~2pt~minus~2pt}
4219 \skip_set:Nn\textfloatsep {20pt~plus~2pt~minus~4pt}
4220 \skip_set:Nn\intextsep {12pt~plus~2pt~minus~2pt}
4221 \skip_set:Nn\dblfloatsep {12pt~plus~2pt~minus~2pt}
4222 \skip_set:Nn\dbltextfloatsep{20pt~plus~2pt~minus~4pt}
4223 \end{MacroCode}
4224 \begin{MacroCode}{size-12}
4225 \dim_set:Nn\footnotesep{8.4pt}
4226 \skip_set:Nn{\skip\footins} {10.8pt~plus~4pt~minus~2pt}
4227 \skip_set:Nn\floatsep {12pt ~plus~2pt~minus~4pt}
4228 \skip_set:Nn\textfloatsep {20pt ~plus~2pt~minus~4pt}
4229 \skip_set:Nn\intextsep {14pt ~plus~4pt~minus~4pt}
4230 \skip_set:Nn\dblfloatsep {14pt ~plus~2pt~minus~4pt}
4231 \skip_set:Nn\dbltextfloatsep{20pt ~plus~2pt~minus~4pt}
4232 \end{MacroCode}
4233 These six have been changed slightly compared to \LaTeXe.
4234 \begin{MacroCode}{size-10,size-11,size-12}
4235 \skip_set:Nn\@fptop{ 5pt}
4236 \end{MacroCode}
4237 \begin{MacroCode}{size-10}
4238 \skip_set:Nn\@fpsep{10pt~plus~2fil}
4239 \end{MacroCode}
4240 \begin{MacroCode}{size-11}
4241 \skip_set:Nn\@fpsep{11pt~plus~2fil}
4242 \end{MacroCode}
4243 \begin{MacroCode}{size-12}
4244 \skip_set:Nn\@fpsep{12pt~plus~2fil}
4245 \end{MacroCode}
4246 \begin{MacroCode}{size-10,size-11,size-12}
4247 \skip_set:Nn\@fpbot{ 5pt}
4248 \skip_set:Nn\@dblfptop{ 5pt}
4249 \end{MacroCode}
4250 \begin{MacroCode}{size-10}
4251 \skip_set:Nn\@dblfpsep{10pt~plus~2fil}
4252 \end{MacroCode}
4253 \begin{MacroCode}{size-11}
4254 \skip_set:Nn\@dblfpsep{11pt~plus~2fil}
4255 \end{MacroCode}
4256 \begin{MacroCode}{size-12}
4257 \skip_set:Nn\@dblfpsep{12pt~plus~2fil}
4258 \end{MacroCode}
4259 \begin{MacroCode}{size-10,size-11,size-12}
4260 \skip_set:Nn\@dblfpbot{ 5pt}
4261 \end{MacroCode}
4262 \begin{MacroCode}{size-10}
4263 \skip_set:Nn\partopsep{2pt~plus~1pt~minus~1pt}
4264 \end{MacroCode}
4265 \begin{MacroCode}{size-11}
4266 \skip_set:Nn\partopsep{3pt~plus~1pt~minus~1pt}
4267 \end{MacroCode}
4268 \begin{MacroCode}{size-12}
4269 \skip_set:Nn\partopsep{3pt~plus~2pt~minus~2pt}
4270 \end{MacroCode}
4271 \begin{MacroCode}{size-10,size-11,size-12}
4272 \cs_set:Npn\@listi{
4273 \dim_set_eq:NN\leftmargin\leftmargini
4274 \end{MacroCode}
4275 \begin{MacroCode}{size-10}
4276 \skip_set:Nn\parsep {4pt~plus~2pt~minus~1pt}
4277 \skip_set:Nn\topsep {8pt~plus~2pt~minus~4pt}
4278 \skip_set:Nn\itemsep{4pt~plus~2pt~minus~1pt}
4279 \end{MacroCode}
4280 \begin{MacroCode}{size-11}
4281 \skip_set:Nn\parsep {4.5pt~plus~2pt~minus~1pt}
4282 \skip_set:Nn\topsep { 9pt~plus~3pt~minus~5pt}
4283 \skip_set:Nn\itemsep{4.5pt~plus~2pt~minus~1pt}
4284 \end{MacroCode}
4285 \begin{MacroCode}{size-12}
4286 \skip_set:Nn\parsep { 5pt~plus~2.5pt~minus~1pt}
4287 \skip_set:Nn\topsep {10pt~plus~4pt ~minus~6pt}
4288 \skip_set:Nn\itemsep{ 5pt~plus~2.5pt~minus~1pt}
4289 \end{MacroCode}
4290 \begin{MacroCode}{size-10,size-11,size-12}
4291 }
4292 \cs_set_eq:NN\@listI\@listi
4293 \dim_gset_eq:NN\leftmargin\leftmargini
4294 \end{MacroCode}
4295 \begin{MacroCode}{size-10}
4296 \skip_gset:Nn\parsep {4pt~plus~2pt~minus~1pt}
4297 \skip_gset:Nn\topsep {8pt~plus~2pt~minus~4pt}
4298 \skip_gset:Nn\itemsep{4pt~plus~2pt~minus~1pt}
4299 \end{MacroCode}
4300 \begin{MacroCode}{size-11}
4301 \skip_gset:Nn\parsep {4.5pt~plus~2pt~minus~1pt}
4302 \skip_gset:Nn\topsep { 9pt~plus~3pt~minus~5pt}
4303 \skip_gset:Nn\itemsep{4.5pt~plus~2pt~minus~1pt}
4304 \end{MacroCode}
4305 \begin{MacroCode}{size-12}
4306 \skip_gset:Nn\parsep { 5pt~plus~2.5pt~minus~1pt}
4307 \skip_gset:Nn\topsep {10pt~plus~4pt ~minus~6pt}
4308 \skip_gset:Nn\itemsep{ 5pt~plus~2.5pt~minus~1pt}
4309 \end{MacroCode}
4310 \begin{MacroCode}{size-10,size-11,size-12}
4311 \cs_set:Npn\@listii{
4312 \dim_set_eq:NN\leftmargin\leftmarginii
4313 \dim_set:Nn\labelwidth{\leftmarginii-\labelsep}
4314 \end{MacroCode}
4315 \begin{MacroCode}{size-10}
4316 \skip_set:Nn\parsep {2pt~plus~1pt~minus~1pt}
4317 \skip_set:Nn\topsep {4pt~plus~2pt~minus~1pt}
4318 \end{MacroCode}
4319 \begin{MacroCode}{size-11}
4320 \skip_set:Nn\parsep { 2pt~plus~1pt~minus~1pt}
4321 \skip_set:Nn\topsep {4.5pt~plus~2pt~minus~1pt}
4322 \end{MacroCode}
4323 \begin{MacroCode}{size-12}
4324 \skip_set:Nn\parsep {2.5pt~plus~1pt ~minus~1pt}
4325 \skip_set:Nn\topsep { 5pt~plus~2.5pt~minus~1pt}
4326 \end{MacroCode}
4327 \begin{MacroCode}{size-10,size-11,size-12}
4328 \skip_set_eq:NN\itemsep\parsep
4329 }
4330 \cs_set:Npn\@listiii{
4331 \dim_set_eq:NN\leftmargin\leftmarginiii
4332 \dim_set:Nn\labelwidth{\leftmarginiii-\labelsep}
4333 \skip_set_eq:NN\parsep\c_zero_skip
4334 \end{MacroCode}
4335 \begin{MacroCode}{size-10,size-11}
4336 \skip_set:Nn\topsep {2pt~plus~1pt~minus~1pt}
4337 \skip_set:Nn\partopsep{1pt~plus~0pt~minus~1pt}
4338 \end{MacroCode}
4339 \begin{MacroCode}{size-12}
4340 \skip_set:Nn\topsep {2.5pt~plus~1pt~minus~1pt}
4341 \skip_set:Nn\partopsep{ 1pt~plus~0pt~minus~1pt}
4342 \end{MacroCode}
4343 \begin{MacroCode}{size-10,size-11,size-12}
4344 \skip_set_eq:NN\itemsep\topsep
4345 }
4346 \cs_set:Npn\@listiv{
4347 \dim_set_eq:NN\leftmargin\leftmarginiv
4348 \dim_set:Nn\labelwidth{\leftmarginiv-\labelsep}
4349 }
4350 \cs_set:Npn\@listv{
4351 \dim_set_eq:NN\leftmargin\leftmarginv
4352 \dim_set:Nn\labelwidth{\leftmarginv-\labelsep}
4353 }
4354 \cs_set:Npn\@listvi{
4355 \dim_set_eq:NN\leftmargin\leftmarginvi
4356 \dim_set:Nn\labelwidth{\leftmarginvi-\labelsep}
4357 }
4358 \endinput
4359 \end{MacroCode}
4360
4361 \Finale
4362 \section{Installation}
4363 The easiest way to install this package is using the package
4364 manager provided by your \LaTeX\ installation if such a program
4365 is available. Failing that, provided you have obtained the package
4366 source (\file{skrapport.tex} and \file{Makefile}) from either CTAN
4367 or Github, running \texttt{make install} inside the source directory
4368 works well. This will extract the documentation and code from
4369 \file{skrapport.tex}, install all files into the TDS tree at
4370 \texttt{TEXMFHOME} and run \texttt{mktexlsr}.
4371
4372 If you want to extract code and documentation without installing
4373 the package, run \texttt{make all} instead. If you insist on not
4374 using \texttt{make}, remember that packages distributed using
4375 \pkg{skdoc} must be extracted using \texttt{pdflatex}, \emph{not}
4376 \texttt{tex} or \texttt{latex}.
4377
4378 \PrintChanges
4379 \PrintIndex
4380 \printbibliography
4381 \end{document}