summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/skrapport/skrapport.tex
blob: c9b6bc8ad65fd80c989054919308a25b8fac4356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
%% chscite Skånings rapportklass
%%
%% Copyright (C) 2012 by Simon Sigurdhsson <sigurdhsson@gmail.com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Simon Sigurdhsson.
%% 
%% This work consists of the file skrapport.tex and the 
%% derived files skrapport.cls, skrapport-colortheme-default.sty,
%% skrapport-colortheme-unscathed.sty, skrapport-colortheme-violet.sty
%% and skrapport-colortheme-cruelwater.sty.
\documentclass{skdoc}
\usepackage{hologo,booktabs}
\usepackage[style=authoryear]{biblatex}
\usepackage{csquotes}
%\usepackage{chslacite}

% Hide the implementation
\OnlyDescription

% Bibliography entries
\begin{filecontents}{skrapport.bib}
    @article{kpfonts,
        author = {Christophe Caignaert},
        title = {KP-Fonts 3.31},
        year = {2010},
        url = {http://www.tex.ac.uk/tex-archive/fonts/kpfonts/doc/kpfonts.pdf}
    }
\end{filecontents}
\addbibresource{skrapport.bib}

% Declare the target files
\SelfPreambleTo{\mypreamble}
\DeclareFile[key=class,preamble=\mypreamble]{skrapport.cls}
\DeclareFile[key=theme-default,preamble=\mypreamble]%
    {skrapport-colortheme-default.sty}
\DeclareFile[key=theme-unscathed,preamble=\mypreamble]%
    {skrapport-colortheme-unscathed.sty}
\DeclareFile[key=theme-cruelwater,preamble=\mypreamble]%
    {skrapport-colortheme-cruelwater.sty}
\DeclareFile[key=theme-violet,preamble=\mypreamble]%
    {skrapport-colortheme-violet.sty}

% This is where the documentation begins
\begin{document}
    % Change & version info
    \version{0.10b}
    \changes{0.01}{Initial version}
    \changes{0.03}{Removed \cs{rd} and \cs{id}}
    \changes{0.04}{Added \pkg{microtype} package}
    \changes{0.05}{Improved documentation}
    \changes{0.06}{Corrected cheksum, further improved documentation}
    \changes{0.07}{Various bugfixes, \hologo{XeLaTeX} compatibility, 
                    better float settings, quote style fix,
                    \opt{intlimits} option to \pkg{amsmath}}
    \changes{0.07a}{Fixed \pkg{kpfonts} issues}
    \changes{0.09}{Introduced \pkg{kvoptions},
                    fixed abstract in twocolumn mode}
    \changes{0.10}{Include skmath if exists
                    and wanted. Gobble optional arguments to
                    \env{figure} and \env{table} in two-column mode.}
    \changes{0.10a}{Include \pkg{xparse} (fixes breakage).}

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

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

    \section{Documentation}
    \subsection{Loading the class}
    The document class is loaded using \cs{documentclass} as usual,
    but it has a bunch of options that you might want to know about.

    \subsubsection{Compatibility options}
    There are a couple of options that are mostly provided for
    compatibility with the standard \LaTeXe\ document classes. These
    will do exactly the same thing they do in the standard classes,
    although they may differ in default value. Although some of these
    are key-value options, for compatibility their valid values may
    also be passed as keys.

    \Options{paper}\WithValues{a4paper, a5paper}\AndDefault{a4paper}
    Specifying paper size is possible using the \opt{paper} option
    (the values of which are based
    on European paper sizes; use the \pkg{geometry} package for other
    standards). Only A4 and A5 are defined since these two sizes cover
    pretty much all intended use of the class. \opt{a4paper} is the
    default value of this option, and the only other valid value is
    \opt{a5paper}.

    \Options{ptsize}\WithValues{10pt, 11pt, 12pt}\AndDefault{11pt}
    The same font sizes specified in the standard classes are also
    available in \thepackage\ (\emph{i.e.} \opt{10pt},
    \opt{11pt} and \opt{12pt}. The default font size is
    \opt{11pt}, and there should be no compelling reason to change
    this.

    \Options{draft,final}
    The \opt{draft} and \opt{final} options work as expected, triggering
    or untriggering the familiar draft mode. The default is \opt{final}.

    \Options{fleqn,leqno}
    Purely for compatibility \thepackage\ also defines the \opt{fleqn}
    and \opt{leqno} options. As with the standard \LaTeXe\ classes,
    \opt{fleqn} aligns equations with the left-hand margin and
    \opt{leqno} places equation numbers to the left. None of these
    are activated by default.

    \subsubsection{Typographic options}
    There is also a number of options available to change certain
    aspects of the typography of the typeset document.

    \Options{titles}\WithValues{rm, bf, sf}\AndDefault{rm}
    There are three different ways to typeset section headings in
    \thepackage: \texttt{rm} (upright serif), \texttt{bf} (boldfaced
    serif) and \texttt{sf} (sans serif). The default is \texttt{rm}.

    \Options{font}\WithValues{nofont, lmodern, palatino, kpfonts}\AndDefault{kpfonts}
    In addition, the specific font can also be changed --- the available
    choices are \texttt{lmodern} (Latin Modern), \texttt{kpfonts}
    (Kp-Fonts) and \texttt{palatino} (either \TeX-Gyre Pagella or
    Pazo Math depending on what's available), with the default being
    \texttt{kpfonts}. It is also possible to tell \thepackage\ not
    to use any font (\texttt{nofont}), which is sometimes useful
    when using \hologo{XeLaTeX}, among other things.

    \Options{indent,noindent}
    Controlling indentation is posible using the options
    \texttt{(no)indent}. The default, \texttt{noindent}, behaves
    much like the \pkg{parskip} package in that it replaces
    paragraph indentation with vertical spacing.

    \Options{onecolumn,twocolumn}
    Similar to the options available in the standard classes, these
    options specify wether to typeset the document in one or two
    columns. Unlike the standard classes, the two-column mode is
    implemented using \pkg{multicol}. The default is \opt{onecolumn}.

    \subsubsection{Other options}
    \Options{swe,eng}
    Either \pkg{babel} or \pkg{polyglossia} (depending on engine) is
    loaded by the package. These options specify what language should
    be used as the main language (swedish or english); both languages
    are always loaded. The default is \opt{swe}.

    \Options{color,nocolor}
    It is also possible to load \pkg{xcolor} inside the package. If
    this is done, a range of color themes (discussed later) will be
    available in the package and these will affect the document. The
    default value is \opt{nocolor}.

    \Options{math,nomath}
    Loading the \pkg{skmath} package is recommended and as such it is
    loaded by default. If this for some reason is undesirable, the
    \opt{nomath} option will supress this behaviour.

    \subsection{Macros and environments}
    In general, the class defines the same macros as the \pkg{article} class, and adds a few. Only the novel ones are described here, as
    the inherited ones should behave identically.

    \subsubsection{Front-matter and metadata}
    \DescribeMacro\license{<license>}
    The \cs{license} macro specifies the name of a license under which
    the document is available. This will be typeset on the lower right
    corner of the title page.

    \DescribeMacro\regarding{<text>}
    The class adds a \cs{regarding} macro, which is used like the 
    standard \cs{author} and \cs{title} macros and should be given an 
    accurate but short description of the purpose of the report (i.e.
    ~course name or similar). This is printed along with the date on 
    the top of the title/first page.

    \DescribeMacro\author[<email>]{<author>}
    The \cs{author} macro is redefined in two ways. To begin with, the
    macro now acceps an optional argument specifying the email address
    of the author. If the macro is used multiple times, authors are
    appended to the list of author names displayed by \cs{maketitle}.

    \DescribeMacro\maketitle
    The title page (or rather, block) has been refashioned to mimic the
    Prac\TeX\ Journal style. This means a fairly compact block, starting
    with a line of text containing the date and subject matter, followed
    by a large skip and then the title, author and optionally an
    abstract set ragged-right and fairly close together.

    \subsubsection{Useful macros}
    The class defines a few additional macros that aren't available in
    \pkg{article} but don't fit in any specifiv \enquote{set} of
    features. These include commands to typeset comments.

    \DescribeMacro\comment*{<comment>}
    \DescribeMacro\com*{<comment>}
    \DescribeMacro\note*{<comment>}
    The \cs{comment} macro (also available in an unstarred variant)
    typesets a comment. The starred variant typesets the commen in red
    prefixed by the word \enquote{Comment}, while the unstarred variant
    typesets the comment as a margin note (but still prefixed). The
    \cs{com} and \cs{note} macros are aliases of \cs{comment}.

    \subsubsection{Two-column mode}
    \DescribeEnv[<content>]{onecol}
    In \opt{twocolumn} mode, the package defines an environment
    \env{onecol} which typesets its contents in a single column. 
    Additionally, it redefines \env{figure} and \env{table} as
    non-floats, leaving the starred versions intact.

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

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

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

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

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

    \subsection{Additional information}
    The document class includes a number of packages by default. This
    is useful to know, since passing explicit options to these packages
    will require you to utilize the \cs{PassOptionsToPackage} macro
    before you load the class using \cs{documentclass}.
    Table~\ref{tab:pkgs} lists the packages included by \thepkg\ along
    with their options (if applicable).

    \begin{table}[tbp]
        \centering
        \caption{User-level packages included by \thepkg.}
        \label{tab:pkgs}
        \begin{tabular}{llp{15em}}
            \toprule
            \textbf{Package} & \textbf{Options} & \textbf{Comments} \\
            \midrule
            \pkg{amsmath} & \texttt{intlimits} & Provides \hologo{AmS} commands and environments. \\
            \pkg{amssymb} & & Only if not using \opt{kpfonts}.\\
            \pkg{babel} & see options \opt{swe} and \opt{eng} & Only loaded if \emph{not} using \hologo{XeTeX}.\\
            \pkg{calc} & & \\
            \pkg{fontenc} & \texttt{T1} & Only loaded if \emph{not} using \hologo{XeTeX}. Makes sure we are using a good font encoding for crisp appearance on-screen (OT1 is horrible). \\
            \pkg{fontspec} & \texttt{quiet} & Only loaded if using \hologo{XeTeX}. Provides basic OTF font selection commands.\\
            \pkg{geometry} & \texttt{a4paper} or \texttt{a5paper} & This is used by the \opt{paper} option to set the paper area. \\
            \pkg{icomma} & & \\
            \pkg{microtype} & & Provides micro-typographic improvements.\\
            \pkg{multicol} & & Only loaded with the \opt{twocolumn} option. \\
            \pkg{polyglossia} & see options \opt{swe} and \opt{eng} & Only loaded if using \hologo{XeTeX}.\\
            \pkg{skmath} & & Only if it exists and \opt{nomath} isn't set.\\
            \pkg{textcomp} & & Only if not using \opt{kpfonts}.\\
            \pkg{xcolor} & & Only loaded with the \opt{color} option.\\
            \bottomrule
        \end{tabular}
    \end{table}

    \subsection{Known issues}
    A list of current issues is available in the Github repository of this
    package\footnote{\url{https://github.com/urdh/skrapport/issues}}, but as
    of the release of \theversion, there are only two known issues:
    \begin{description}
        \item[\#6]  When using the \opt{color} option, sometimes captions are
                    uncolored. It seems that color only appears when the caption
                    is long enough to break a line. It is unknown wether this is
                    due to some error in \thepackage\ or something caused by
                    \pkg{caption} (or another dependency).
        \item[\#7]  As of a recent update to \pkg{xparse}, the \opt{twocolumn}
                    option is broken. When loading \thepackage\ with that option,
                    \pkg{xparse} emits a warning stating that \enquote{Argument
                    specification for expandable command ends with optional
                    argument}. Presumably this is because environments are now
                    defined using expandable macros, whereas they weren't before.
                    %It's a tricky one to solve while keeping the \env{figure} and
                    %\env{table} environments API-compatible across \opt{onecolumn}
                    %and \opt{twocolumn} documents.
    \end{description}
    If you discover any bugs in this package, please report them to the issue
    tracker in the \thepackage\ Github repository.

    \Implementation
    \section{Implementation}
    Start with the standard \LaTeX\ cruft.
\begin{MacroCode}{class}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{skrapport}%
    [2013/01/09 v0.10a Skånings rapportklass]
\end{MacroCode}
    Then, start by including \pkg{kvoptions} and defining some
    variables for future use.
\begin{MacroCode}{class}
\RequirePackage{xparse,xstring}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=skrapport,prefix=skrapport@}
\newcommand\@ptsize{}
\IfFileExists{ifxetex.sty}{%
  \RequirePackage{ifxetex}%
}{%
  \newif\ifxetex\xetexfalse%
}
\end{MacroCode}

    \subsection{Options}
    \begin{option}{paper}{a4paper, a5paper}
    \begin{option}{a4paper}
    \begin{option}{a5paper}
    Declare the paper size options.
\begin{MacroCode}{class}
\DeclareStringOption[a4paper]{paper}
\DeclareVoidOption{a4paper}{\skrapport@SetupPaper}
\DeclareVoidOption{a5paper}{\skrapport@SetupPaper}
\newcommand*{\skrapport@SetupPaper}{\expandafter\@skrapport@SetupPaper\expandafter{\CurrentOption}}
\newcommand*{\@skrapport@SetupPaper}[1]{\setkeys{skrapport}{paper={#1}}}
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{ptsize}{10pt, 11pt, 12pt}
    \begin{option}{10pt}
    \begin{option}{11pt}
    \begin{option}{12pt}
    Declare point size options.
\begin{MacroCode}{class}
\DeclareStringOption[11pt]{ptsize}
\DeclareVoidOption{10pt}{\skrapport@SetupPtsize}
\DeclareVoidOption{11pt}{\skrapport@SetupPtsize}
\DeclareVoidOption{12pt}{\skrapport@SetupPtsize}
\newcommand*{\skrapport@SetupPtsize}{\expandafter\@skrapport@SetupPtsize\expandafter{\CurrentOption}}
\newcommand*{\@skrapport@SetupPtsize}[1]{\setkeys{skrapport}{ptsize={#1}}}
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{twocolumn}
    \changes{0.08}{Added option \opt{twocolumn}}
    \begin{option}{onecolumn}
    Declare column options.
\begin{MacroCode}{class}
\DeclareBoolOption[false]{twocolumn}
\DeclareComplementaryOption{onecolumn}{twocolumn}
\end{MacroCode}
    \end{option}
    \end{option}

    \begin{option}{draft}
    \begin{option}{final}
    Declare \opt{draft} and \opt{final} options.
\begin{MacroCode}{class}
\DeclareBoolOption[false]{draft}
\DeclareComplementaryOption{final}{draft}
\end{MacroCode}
    \end{option}
    \end{option}


    Declare the \opt{fleqn} and \opt{leqno} options for
    compatibility with the \pkg{article} class.
    \begin{option}{leqno}
\begin{MacroCode}{class}
\DeclareBoolOption[false]{leqno}
\end{MacroCode}
    \end{option}
    \begin{option}{fleqn}
\begin{MacroCode}{class}
\DeclareBoolOption[false]{fleqn}
\end{MacroCode}
    \end{option}

    \begin{option}{titles}{rm, bf, sf}
    Declare options for section titles.
    \begin{option}{rmtitles}
    \begin{option}{bftitles}
    \begin{option}{sftitles}
    \changes{0.09}{Added \opt{sftitles} option}
\begin{MacroCode}{class}
\DeclareStringOption[rm]{titles}
\DeclareVoidOption{rmtitles}{\skrapport@SetupTitles}
\DeclareVoidOption{bftitles}{\skrapport@SetupTitles}
\DeclareVoidOption{sftitles}{\skrapport@SetupTitles}
\newcommand*{\skrapport@SetupTitles}{\expandafter\@skrapport@SetupTitles\expandafter{\CurrentOption}}
\newcommand*{\@skrapport@SetupTitles}[1]{%
    \IfStrEq{#1}{bftitles}{%
        \setkeys{skrapport}{titles={bf}}%
    }{\IfStrEq{#1}{sftitles}{%
        \setkeys{skrapport}{titles={sf}}%
    }{
        \setkeys{skrapport}{titles={rm}}%
    }}}
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{swe}
    \begin{option}{eng}
    Declare options for swedish/english \pkg{babel} or
    \pkg{polyglossia} support.
\begin{MacroCode}{class}
\DeclareBoolOption[false]{eng}
\DeclareComplementaryOption{swe}{eng}
\end{MacroCode}
    \end{option}
    \end{option}

    \begin{option}{font}{nofont, kpfonts, lmodern, palatino}
    Declare font options.
    \begin{option}{kpfonts}
    \changes{0.07}{Added option \opt{kpfonts}, set as default
                    option for fonts}
    \begin{option}{lmodern}
    \begin{option}{palatino}
    \begin{option}{nofont}
\begin{MacroCode}{class}
\DeclareStringOption[kpfonts]{font}
\DeclareVoidOption{kpfonts}{\skrapport@SetupFont}
\DeclareVoidOption{lmodern}{\skrapport@SetupFont}
\DeclareVoidOption{palatino}{\skrapport@SetupFont}
\DeclareVoidOption{nofont}{\skrapport@SetupFont}
\newcommand*{\skrapport@SetupFont}{\expandafter\@skrapport@SetupFont\expandafter{\CurrentOption}}
\newcommand*{\@skrapport@SetupFont}[1]{\setkeys{skrapport}{font={#1}}}
\end{MacroCode}
    \end{option}
    \end{option}
    \end{option}
    \end{option}
    \end{option}

    \begin{option}{indent}
    \changes{0.02}{Added option of indented paragraphs}
    \begin{option}{noindent}
    Declare indentation options.
\begin{MacroCode}{class}
\DeclareBoolOption[false]{indent}
\DeclareComplementaryOption{noindent}{indent}
\end{MacroCode}
    \end{option}
    \end{option}

    \begin{option}{color}
    \changes{0.09}{Added \opt{color} option}
    \begin{option}{nocolor}
    Declare color options.
\begin{MacroCode}{class}
\DeclareBoolOption[true]{color}
\DeclareComplementaryOption{nocolor}{color}
\end{MacroCode}
    \end{option}
    \end{option}

    \begin{option}{math}
    \begin{option}{nomath}
    Declare math options.
\begin{MacroCode}{class}
\DeclareBoolOption[true]{math}
\DeclareComplementaryOption{nomath}{math}
\end{MacroCode}
    \end{option}
    \end{option}

    Execute default options and process given options.
\begin{MacroCode}{class}
\ProcessKeyvalOptions*
\end{MacroCode}

    \subsection{Loading packages}
    \subsubsection{Optional packages}
    Require packages as per given options. Start with the paper size.
\begin{MacroCode}{class}
\IfStrEq{\skrapport@paper}{a4paper}{%
    \RequirePackage[a4paper]{geometry}
    \setlength\paperheight {297mm}
    \setlength\paperwidth  {210mm}
}{\IfStrEq{\skrapport@paper}{a5paper}{%
    \RequirePackage[a5paper]{geometry}
    \setlength\paperheight {210mm}
    \setlength\paperwidth  {148mm}
}{%
    \ClassError{skrapport}{%
        Option `paper' has unknown value `\skrapport@paper'!
    }{} 
}}
\end{MacroCode}

    \begin{macro}{\@ptsize}
    Follow up with the point size.
\begin{MacroCode}{class}
\IfStrEq{\skrapport@ptsize}{10pt}{%
    \renewcommand\@ptsize{0}
}{%
    \IfStrEq{\skrapport@ptsize}{11pt}{%
        \renewcommand\@ptsize{1}
    }{%
        \IfStrEq{\skrapport@ptsize}{12pt}{%
            \renewcommand\@ptsize{2}
        }{%
            \ClassError{skrapport}{%
                Option `ptsize' has unknown value `\skrapport@ptsize'!
            }{}
        }
    }
}
\end{MacroCode}
    \end{macro}

    Setting \opt{draft} mode is fairly easy, we only need
    \cs{overfullrule}s.
\begin{MacroCode}{class}
\ifskrapport@draft
    \setlength\overfullrule{5pt}
\else
    \setlength\overfullrule{0pt}
\fi
\end{MacroCode}

    Load \file{leqno.clo} and \file{fleqno.clo} if those options are desired.
\begin{MacroCode}{class}
\ifskrapport@leqno\input{leqno.clo}\fi
\ifskrapport@fleqn\input{fleqn.clo}\fi
\end{MacroCode}

    \begin{macro*}{\@titstyle}
    Set the title font as prescribed.
\begin{MacroCode}{class}
\IfStrEq{\skrapport@titles}{bf}{%
    \let\@titstyle\bfseries%
}{\IfStrEq{\skrapport@titles}{sf}{%
    \let\@titstyle\sffamily\bfseries%
}{%
    \let\@titstyle\relax%
}}
\end{MacroCode}
    \end{macro*}

    Now things get tricky. If we are using \hologo{XeTeX}, we don't
    want \pkg{fontenc} because it makes no sense. We \emph{do} want
    \pkg{fontspec}, though, because we want to be able to specify
    fonts. We also include a \cs{nobreakspace} macro which seems to
    be broken in \hologo{XeTeX}.
\begin{MacroCode}{class}
\ifxetex
  \RequirePackage[quiet]{fontspec}
\end{MacroCode}
    \begin{macro}{\nobreakspace}
\begin{MacroCode}{class}
    \DeclareRobustCommand\nobreakspace{\leavevmode\nobreak\space}
\end{MacroCode}
    \end{macro}
\begin{MacroCode}{class}
\else
  \RequirePackage[T1]{fontenc}  
\fi
\end{MacroCode}

    The \opt{color} option requires both \pkg{etoolbox} and
    \pkg{xcolor} to be loaded.
\begin{MacroCode}{class}
\ifskrapport@color
    \RequirePackage{etoolbox}
    \RequirePackage{xcolor}
\fi
\end{MacroCode}

    We also need to handle the \opt{font} option. Note that we only
    load \pkg{tpagella} if it exists, and fall back to \pkg{mathpazo}
    otherwise.
\begin{MacroCode}{class}    
\IfStrEq{\skrapport@font}{nofont}{}{%
    \IfStrEq{\skrapport@font}{kpfonts}{%
        \RequirePackage[easyscsl,intlimits,sumlimits]{kpfonts}
    }{%
        \IfStrEq{\skrapport@font}{palatino}{%
            \IfFileExists{tgpagella.sty}{%
                \RequirePackage{tgpagella}
            }{%
                \RequirePackage[sc]{mathpazo}
            }
        }{%
            \IfStrEq{\skrapport@font}{lmodern}{%
                \RequirePackage{lmodern}
            }{%
                \ClassError{skrapport}{%
                    Option `font' has unknown value `\skrapport@font'!
                }{}
            }
        }
    }
}
\end{MacroCode}

    Language options follow. It it a bit convoluted since we load
    \pkg{polyglossia} in \hologo{XeTeX} and \pkg{babel} in \TeX,
    but it's fairly easy to follow.
\begin{MacroCode}{class}
\ifxetex
    \RequirePackage{xkeyval}
    \RequirePackage{polyglossia}
    \ifskrapport@eng
        \setmainlanguage[variant=british]{english}
        \setotherlanguage{swedish}
    \else
        \setmainlanguage{swedish}
        \setotherlanguage[variant=british]{english}
    \fi
\else
    \ifskrapport@eng
        \RequirePackage[swedish,british]{babel}
    \else
        \RequirePackage[british,swedish]{babel}
    \fi
\fi
\end{MacroCode}

    Two-column mode requires \pkg{etoolbox} and \pkg{multicol}.
\begin{MacroCode}{class}
\ifskrapport@twocolumn
    \RequirePackage{etoolbox}
    \RequirePackage{multicol}
\fi
\end{MacroCode}

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

    At the end of the class definition we load a couple of very
    useful packages that improve typesetting. These are
    \pkg{microtype}, \pkg{icomma} and \pkg{amsmath}. Additionally,
    we load \pkg{skmath} if it exists and is wanted, and unless we
    are using KP-Fonts, we load \pkg{amssymb} and \pkg{textcomp} (the
    reason being that \pkg{kpfonts} load these packages itself, see
    \textcite[p.~1]{kpfonts}, and we don't want conflicting options).
\begin{MacroCode}{class}
\AtEndOfClass{
    \RequirePackage{microtype}
    \RequirePackage{icomma}
    \IfStrEq{\skrapport@font}{kpfonts}{}{\RequirePackage[intlimits]{amsmath}}
    \let\Finv\relax
    \let\Game\relax
    \let\beth\relax
    \let\gimel\relax
    \let\daleth\relax
    \IfStrEq{\skrapport@font}{kpfonts}{}{\RequirePackage{amssymb}}
    \IfStrEq{\skrapport@font}{kpfonts}{}{\RequirePackage{textcomp}}
    \ifskrapport@math\IfFileExists{skmath.sty}{\RequirePackage{skmath}}{}\fi
}
\end{MacroCode}
    
    When the document starts, we set the URL style if the user has
    loaded the \pkg{url} package.
\begin{MacroCode}{class}
\AtBeginDocument{
    \@ifundefined{urlstyle}{}{\urlstyle{same}}
}
\end{MacroCode}

    Lastly, we include the correct point size \texttt{.clo} file from the
    \pkg{article} class.
\begin{MacroCode}{class}
\input{size1\@ptsize.clo}
\end{MacroCode}
    
    \subsection{Hidden things}
    Set some default measurements.
\begin{MacroCode}{class}
\addtolength\textwidth{0.5\oddsidemargin}
\addtolength\textwidth{0.5\evensidemargin}
\addtolength\oddsidemargin{-0.5\oddsidemargin}
\addtolength\evensidemargin{-0.5\evensidemargin}
\setlength\lineskip{1\p@}
\setlength\normallineskip{1\p@}
\end{MacroCode}
    \begin{macro}{\baselinestretch}
\begin{MacroCode}{class}
\renewcommand\baselinestretch{}
\end{MacroCode}
    \end{macro}

    \subsubsection{Indentation}
    Indentation code. Undo the indentation set by the \pkg{article} 
    class if indentation was requested by the user. See the
    \pkg{parskip} package for further information. Enable french
    spacing as well.
\begin{MacroCode}{class}
\ifskrapport@indent\else
    \setlength\parskip{0.5\baselineskip \@plus 2pt}
    \parindent=\z@
    \setlength\parfillskip{30\p@ \@plus 1fil}
\end{MacroCode}
    \begin{macro*}{\@listI}
    \begin{macro*}{\@listi}
\begin{MacroCode}{class}
    \def\@listI{\leftmargin\leftmargini
       \topsep\z@ \parsep\parskip \itemsep\z@}
    \let\@listi\@listI
\end{MacroCode}
    \end{macro*}
    \end{macro*}
\begin{MacroCode}{class}
    \@listi
\end{MacroCode}
    \begin{macro*}{\@listii}
\begin{MacroCode}{class}
    \def\@listii{\leftmargin\leftmarginii
      \labelwidth\leftmarginii\advance\labelwidth-\labelsep
      \topsep\z@ \parsep\parskip \itemsep\z@}
\end{MacroCode}
    \end{macro*}
    \begin{macro*}{\@listiii}
\begin{MacroCode}{class}
    \def\@listiii{\leftmargin\leftmarginiii
      \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
      \topsep\z@ \parsep\parskip \itemsep\z@}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
    \partopsep=\z@
    \@ifundefined{CheckCommand}{}{%
      \CheckCommand*{\@starttoc}[1]{%
        \begingroup
          \makeatletter
          \@input{\jobname.#1}%
          \if@filesw
            \expandafter\newwrite\csname tf@#1\endcsname
            \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
          \fi
          \@nobreakfalse
        \endgroup}}
\end{MacroCode}
    \begin{macro*}{\@starttoc}
\begin{MacroCode}{class}
    \renewcommand*{\@starttoc}[1]{%
      \begingroup
        \makeatletter
        \parskip\z@
        \@input{\jobname.#1}%
        \if@filesw
          \expandafter\newwrite\csname tf@#1\endcsname
          \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
        \fi
        \@nobreakfalse
      \endgroup}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\fi
\frenchspacing
\end{MacroCode}

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

    \subsection{User-level commands}
    \subsubsection{The front page}
    \begin{macro}{\author}
    \changes{0.10b}{Improved \cs{author} macro}
    The \cs{author} macro is redefined to accept an optional argument
    and to be used multiple times.
    \begin{macro*}{\skrapport@email}
    The \cs{skrapport@email} helper macro typesets an email address
    using \pkg{hyperref} if that package is used. This is suboptimal,
    the macro behaves differently with respect to special characters
    depending on wether \pkg{hyperref} is loaded or not.
\begin{MacroCode}{class}
\ProvideDocumentCommand\skrapport@email{m}{\texttt{#1}}
\AtBeginDocument{
    \@ifpackageloaded{hyperref}{%
        \DeclareDocumentCommand\skrapport@email{m}{%
            \href{mailto:#1}{\nolinkurl{#1}}%
        }%
    }{}%
}
\end{MacroCode}{class}
    \end{macro*}
    \begin{macro*}{\@author}
\begin{MacroCode}{class}
\def\@author{\relax}
\DeclareDocumentCommand\author{om}{%
    \def\skrapport@tempi{#2\IfNoValueTF{#1}{}{~$\langle$\skrapport@email{#1}$\rangle$}}
    \if\@author\relax
        \xdef\@author{\skrapport@tempi}
    \else
        \expandafter\gdef\expandafter\@author\expandafter{\@author\\[0.5ex]\skrapport@tempi}
    \fi
}
\end{MacroCode}
    \end{macro*}
    \end{macro}

    \begin{macro}{\regarding}
    This macro defines a variable used by \cs{maketitle} to insert a 
    simple text into the header on the title page.
    \begin{macro*}{\@regarding}
\begin{MacroCode}{class}
\def\@regarding{\relax}
\newcommand{\regarding}[1]{\gdef\@regarding{#1}}
\end{MacroCode}
    \end{macro*}
    \end{macro}

    \begin{macro}{\license}
    \changes{0.07}{Added command \cs{license}}
    This macro defines a variable used by \cs{maketitle} to insert a 
    license into the footer on the titlepage.
    \begin{macro*}{\@copyright}
\begin{MacroCode}{class}
\def\@copyright{\relax}
\newcommand{\license}[1]{\gdef\@copyright{#1}}
\end{MacroCode}
    \end{macro*}
    \end{macro}

    \begin{macro}{\maketitle}
    The standard \cs{maketitle} command as taken from the \pkg{article}
    class but with some basic restyling.
\begin{MacroCode}{class}
\let\@smallprintstyle\relax
\newcommand\maketitle{\par%
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
    \long\def\@makefntext##1{\parindent 1em\noindent%
      \hb@xt@1.8em{\hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
    \newpage
    \global\@topnum\z@
    \@maketitle
    \thispagestyle{plain}\@thanks
  \endgroup
  \setcounter{footnote}{0}%
}
\end{MacroCode}
    \end{macro}
    \begin{macro*}{\@maketitle}
\begin{MacroCode}{class}
\def\@maketitle{%
  \newpage
  \null
  \begin{flushleft}%
        \vspace{-\headsep}
    {\small%
      \@smallprintstyle
      \if\@regarding\relax\else\@regarding{, }\fi%
      \@date\par%
    }%
    \vspace{1.5cm}%
    {\Huge\@titstyle\@title\par}%
    \vspace{.125cm}%
    {\Large\@titstyle\@author}%
    \vspace{.75cm}%
  \end{flushleft}%
  \par%
}
\end{MacroCode}
    \end{macro*}

    \begin{environment}{abstract}
    Standard restyled \env{abstract} environment from the
    \pkg{article} class.
\begin{MacroCode}{class}
\newenvironment{abstract}{\newlength\skrapport@abstract@tw\newlength\skrapport@abstract@aw\settowidth{\skrapport@abstract@tw}{\bfseries\abstractname}\setlength{\skrapport@abstract@aw}{\the\textwidth-\the\skrapport@abstract@tw-1em}\begin{minipage}[t]{\skrapport@abstract@tw}\begin{flushright}\leavevmode\bfseries\abstractname\end{flushright}\end{minipage}\hspace{1em}\begin{minipage}[t]{\skrapport@abstract@aw}}{\end{minipage}}
\end{MacroCode}
    \end{environment}

    \begin{environment}{titlepage}
    Titlepage environment.
    \begin{macro*}{\ps@skrapport@titlepage}
\begin{MacroCode}{class}
\newcommand\ps@skrapport@titlepage{\def\@oddhead{}\def\@evenhead{}\def\@oddfoot{\begin{minipage}{\textwidth}\raggedleft\small\par\@smallprintstyle\@copyright\end{minipage}}\let\@evenfoot\@oddfoot}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\newenvironment{titlepage}{\cleardoublepage\setcounter{page}\@ne}{\thispagestyle{skrapport@titlepage}\cleardoublepage\setcounter{page}\@ne}
\end{MacroCode}
    \end{environment}

    \subsubsection{Sectioning}
    Sectioning commands.
\begin{MacroCode}{class}
\setcounter{secnumdepth}{3}
\newcounter{section}
\newcounter{subsection}[section]
\newcounter{subsubsection}[subsection]
\newcounter{paragraph}[subsubsection]
\newcounter{subparagraph}[paragraph]
\end{MacroCode}
    \begin{macro*}{\thesection}
    \begin{macro*}{\thesubsection}
    \begin{macro*}{\thesubsubsection}
    \begin{macro*}{\theparagraph}
    \begin{macro*}{\thesubparagraph}
\begin{MacroCode}{class}
\renewcommand\thesection{\@arabic\c@section}
\renewcommand\thesubsection{\thesection.\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}
\renewcommand\theparagraph{\thesubsubsection.\@arabic\c@paragraph}
\renewcommand\thesubparagraph{\theparagraph.\@arabic\c@subparagraph}
\end{MacroCode}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \begin{macro}{\section}
\begin{MacroCode}{class}
\newcommand\section{\@startsection{section}{1}{\z@}%
  {-4ex \@plus 1ex \@minus -1ex}%
  {.5ex \@plus.5ex}%
  {\normalfont\LARGE\@titstyle}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\subsection}
\begin{MacroCode}{class}
\newcommand\subsection{\@startsection{subsection}{2}{\z@}%
  {-3ex \@plus 1ex \@minus -1ex}%
  {.25ex \@plus.25ex}%
  {\normalfont\Large\@titstyle}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\subsubsection}
\begin{MacroCode}{class}
\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
  {-2ex \@plus .5ex \@minus -.5ex}%
  {.125ex \@plus.125ex}%
  {\normalfont\large\@titstyle}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\paragraph}
\begin{MacroCode}{class}
\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
  {1ex \@plus .25ex \@minus -.25ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\subparagraph}
\begin{MacroCode}{class}
\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
  {1ex \@plus .25ex \@minus -.25ex}%
  {-1em}%
  {\normalfont\normalsize\itshape}}
\end{MacroCode}
    \end{macro}

    \subsubsection{Commands from \pkg{article}}
    Itemization commands.
\begin{MacroCode}{class}
\setlength\leftmargini{2em}
\leftmargin\leftmargini
\setlength\leftmarginii{2em}
\setlength\leftmarginiii{1.5em}
\setlength\leftmarginiv{1.5em}
\setlength\leftmarginv{1em}
\setlength\leftmarginvi{1em}
\setlength\labelsep{.5em}
\setlength\labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
\end{MacroCode}
    \begin{macro*}{\theenumi}
    \begin{macro*}{\theenumii}
    \begin{macro*}{\theenumiii}
    \begin{macro*}{\theenumiv}
\begin{MacroCode}{class}
\renewcommand\theenumi{\@arabic\c@enumi}
\renewcommand\theenumii{\@alph\c@enumii}
\renewcommand\theenumiii{\@roman\c@enumiii}
\renewcommand\theenumiv{\@Alph\c@enumiv}
\end{MacroCode}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \begin{macro*}{\labelenumi}
    \begin{macro*}{\labelenumii}
    \begin{macro*}{\labelenumiii}
    \begin{macro*}{\labelenumiv}
\begin{MacroCode}{class}
\newcommand\labelenumi{\theenumi.}
\newcommand\labelenumii{\theenumii)}
\newcommand\labelenumiii{\theenumiii.}
\newcommand\labelenumiv{\theenumiv.}
\end{MacroCode}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \begin{macro*}{\p@enumii}
    \begin{macro*}{\p@enumiii}
    \begin{macro*}{\p@enumiiv}
\begin{MacroCode}{class}
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\theenumi(\theenumii)}
\renewcommand\p@enumiv{\p@enumiii\theenumiii}
\end{MacroCode}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \begin{macro*}{\labelitemi}
    \begin{macro*}{\labelitemii}
    \begin{macro*}{\labelitemiii}
    \begin{macro*}{\labelitemiv}
\begin{MacroCode}{class}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\textopenbullet}
\newcommand\labelitemiii{\normalfont\bfseries\textendash}
\newcommand\labelitemiv{\textrightarrow}
\end{MacroCode}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \begin{environment}{description}
\begin{MacroCode}{class}
\newenvironment{description}
  {\list{}{\labelwidth\z@\itemindent-\leftmargin
    \let\makelabel\descriptionlabel}}{\endlist}
\newcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\bfseries #1}
\end{MacroCode}
    \end{environment}

    Quotation environments.
    \begin{environment}{quote}
\begin{MacroCode}{class}
\newenvironment{quote}{\list{}{\rightmargin\leftmargin}\item\relax\itshape}{\endlist}
\end{MacroCode}
    \end{environment}
    \begin{environment}{quotation}
\begin{MacroCode}{class}
\newenvironment{quotation}{\bigskip\begin{quote}}{\end{quote}\bigskip}
\end{MacroCode}
    \end{environment}
    \begin{environment}{verse}
\begin{MacroCode}{class}
\newenvironment{verse}{\begin{quote}}{\end{quote}}
\end{MacroCode}
    \end{environment}

    \begin{macro}{\appendix}
    Appendix macro.
\begin{MacroCode}{class}
\newcommand\appendix{\par\setcounter{section}{0}\setcounter{subsection}{0}\gdef\thesection{\@Alph\c@section}}
\end{MacroCode}
    \end{macro}

    Old font commands.
    \begin{macro}{\rm}
\begin{MacroCode}{class}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\sf}
\begin{MacroCode}{class}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\tt}
\begin{MacroCode}{class}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\bf}
\begin{MacroCode}{class}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\it}
\begin{MacroCode}{class}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\sl}
\begin{MacroCode}{class}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\sc}
\begin{MacroCode}{class}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\end{MacroCode}
    \end{macro}

    \begin{macro}{\emph}
    Redefining the \cs{emph} style to be bold when nested.
    \begin{macro*}{\em}
\begin{MacroCode}{class}
\let\@emstyle\relax
\DeclareRobustCommand\em{%
    \@nomath\em%
    \ifdim \fontdimen\@ne\font >\z@%
        \itshape\bfseries%
    \else%
        \itshape%
    \fi%
    \@emstyle%
}
\end{MacroCode}
    \end{macro*}
    \end{macro}

    \begin{macro*}{\footnoterule}
    Footnote code.
    \begin{macro*}{\@makefntext}
\begin{MacroCode}{class}
\renewcommand\footnoterule{%
    \kern-3\p@
    \hrule\@width.4\columnwidth
    \kern2.6\p@}
\newcommand\@makefntext[1]{%
    \parindent 1em%
    \noindent
    \hb@xt@1.8em{\hss\@makefnmark}#1}
\end{MacroCode}
    \end{macro*}
    \end{macro*}

    Basic translatable texts.
    \begin{macro}{\contentsname}
\begin{MacroCode}{class}
\newcommand\contentsname{Innehåll}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\refname}
\begin{MacroCode}{class}
\newcommand\refname{Referenser}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\figurename}
\begin{MacroCode}{class}
\newcommand\figurename{Figur}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\tablename}
\begin{MacroCode}{class}
\newcommand\tablename{Tabell}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\appendixname}
\begin{MacroCode}{class}
\newcommand\appendixname{Bilaga}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\abstractname}
\begin{MacroCode}{class}
\newcommand\abstractname{Sammanfattning}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\today}
\begin{MacroCode}{class}
\def\today{\year--\month--\day}
\end{MacroCode}
    \end{macro}

    \subsubsection{Floats}
    Figure and table floats.
\begin{MacroCode}{class}
\setlength\arraycolsep{5\p@}
\setlength\tabcolsep{6\p@}
\setlength\arrayrulewidth{.4\p@}
\setlength\doublerulesep{2\p@}
\setlength\tabbingsep{\labelsep}
\skip\@mpfootins=\skip\footins
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}
\end{MacroCode}
    \begin{macro*}{\theequation}
\begin{MacroCode}{class}
\renewcommand\theequation{\@arabic\c@equation}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\newcounter{figure}\renewcommand\thefigure{\@arabic\c@figure}
\def\fps@figure{tb}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename~\thefigure}
\end{MacroCode}
    \begin{environment}{figure}
    \begin{environment*}{figure*}
\begin{MacroCode}{class}
\newenvironment{figure}{\@float{figure}}{\end@float}
\newenvironment{figure*}{\@dblfloat{figure}}{\end@dblfloat}
\end{MacroCode}
    \end{environment*}
    \end{environment}
\begin{MacroCode}{class}
\newcounter{table}\renewcommand\thetable{\@arabic\c@table}
\def\fps@table{tb}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename~\thetable}
\end{MacroCode}
    \begin{environment}{table}
    \begin{environment*}{table*}
\begin{MacroCode}{class}
\newenvironment{table}{\@float{table}}{\end@float}
\newenvironment{table*}{\@dblfloat{table}}{\end@dblfloat}
\end{MacroCode}
    \end{environment*}
    \end{environment}

    Captions.
\begin{MacroCode}{class}
\let\@captionstyle\relax
\newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}
\newlength\belowcaptionskip\setlength\belowcaptionskip{10\p@}
\end{MacroCode}
    \begin{macro*}{\@makecaption}
\begin{MacroCode}{class}
\long\def\@makecaption#1#2{%
    \vskip\abovecaptionskip
    \sbox\@tempboxa{\small{\bfseries#1:} \itshape#2}%
    \ifdim \wd\@tempboxa >\hsize
        \small{\bfseries\@captionstyle#1:} \itshape#2\par
    \else
        \global \@minipagefalse
        \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
    \fi
    \vskip\belowcaptionskip}
\end{MacroCode}
    \end{macro*}

    \subsubsection{Table of contents}
\begin{MacroCode}{class}
\newcommand\@pnumwidth{1.55em}
\newcommand\@tocrmarg{2em}
\newcommand\@dotsep{1.7}
\setcounter{tocdepth}{5}
\end{MacroCode}
    \begin{macro}{\tableofcontents}
\begin{MacroCode}{class}
\newcommand\tableofcontents{%
  \section*{\contentsname
    \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}
  }%
    \vskip\baselineskip%
  \@starttoc{toc}%
}
\end{MacroCode}
    \end{macro}
    \begin{macro*}{\l@section}
    \begin{macro*}{\l@subsection}
    \begin{macro*}{\l@subsubsection}
    \begin{macro*}{\l@paragraph}
    \begin{macro*}{\l@subparagraph}
\begin{MacroCode}{class}
\newcommand*\l@section{\@dottedtocline{1}{0em}{1.3em}}
\newcommand*\l@subsection{\@dottedtocline{2}{1.3em}{2em}}
\newcommand*\l@subsubsection{\@dottedtocline{3}{3.3em}{3.15em}}
\newcommand*\l@paragraph{\@dottedtocline{4}{6.45em}{4.15em}}
\newcommand*\l@subparagraph{\@dottedtocline{5}{10.6em}{5.15em}}
\end{MacroCode}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \end{macro*}
    \end{macro*}

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

    \subsubsection{Basic bibliography support}
\begin{MacroCode}{class}
\newdimen\bibindent
\setlength\bibindent{2em}
\end{MacroCode}
    \begin{environment}{thebibliography}
\begin{MacroCode}{class}
\newenvironment{thebibliography}[1]
    {\section*{\refname}%
        \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
        \list{\@biblabel{\@arabic\c@enumiv}}%
            {\settowidth\labelwidth{\@biblabel{#1}}%
                \leftmargin\labelwidth
                \advance\leftmargin\labelsep
                \@openbib@code
                \usecounter{enumiv}%
                \let\p@enumiv\@empty
                \renewcommand\theenumiv{\@arabic\c@enumiv}}%
        \sloppy
        \clubpenalty4000
        \@clubpenalty \clubpenalty
        \widowpenalty4000}%
    {\def\@noitemerr
        {\@latex@warning{Empty ‘thebibliography’ environment}}%
        \endlist}
\end{MacroCode}
    \end{environment}
    \begin{macro*}{\newblock}
\begin{MacroCode}{class}
\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
\end{MacroCode}
    \end{macro*}
\begin{MacroCode}{class}
\let\@openbib@code\@empty
\end{MacroCode}
    \begin{environment}{theindex}
\begin{MacroCode}{class}
\newenvironment{theindex}
    {\twocolumn[\section*{\indexname}]%
        \@mkboth{\MakeUppercase\indexname}%
            {\MakeUppercase\indexname}%
        \thispagestyle{plain}\parindent\z@
        \parskip\z@ \@plus .3\p@\relax
        \columnseprule \z@
        \columnsep 35\p@
        \let\item\@idxitem}
    {\onecolumn}
\end{MacroCode}
    \end{environment}
    \begin{macro*}{\@idxitem}
\begin{MacroCode}{class}
\newcommand\@idxitem{\par\hangindent 40\p@}
\end{MacroCode}
    \end{macro*}
    \begin{macro}{\subitem}
\begin{MacroCode}{class}
\newcommand\subitem{\@idxitem \hspace*{20\p@}}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\subsubitem}
\begin{MacroCode}{class}
\newcommand\subsubitem{\@idxitem \hspace*{30\p@}}
\end{MacroCode}
    \end{macro}
    \begin{macro*}{\indexspace}
\begin{MacroCode}{class}
\newcommand\indexspace{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
\end{MacroCode}
    \end{macro*}

    \subsubsection{Two-column mode}
    The twocolumn hacks implemented.
\begin{MacroCode}{class}
\ifskrapport@twocolumn
    \AtBeginDocument{
\end{MacroCode}
    We include the \pkg{grid} package in two-column mode, because
    it looks way better that way.
\begin{MacroCode}{class}
        \IfStrEq{\skrapport@paper}{a4paper}
            {\def\@@@lines{40}}{\def\@@@lines{28}}
        \IfStrEq{\skrapport@ptsize}{10pt}{
            \RequirePackage[fontsize=10pt,%
                            baseline=12pt,%
                            lines=\@@@lines]{grid}
        }{
            \IfStrEq{\skrapport@ptsize}{11pt}{
                \RequirePackage[fontsize=11pt,%
                                baseline=13.2pt,%
                                lines=\@@@lines]{grid}
            }{
                \RequirePackage[fontsize=12pt,%
                                baseline=14.4pt,%
                                lines=\@@@lines]{grid}
            }   
        }
\end{MacroCode}
    Now, we patch commands. First up is \env{abstract}.
\begin{MacroCode}{class}
        \renewenvironment{abstract}{\section*{\abstractname}}{}
\end{MacroCode}
    Then \env{document} and \cs{maketitle}.
\begin{MacroCode}{class}
        \AfterEndPreamble{\begin{multicols}{2}}
        \AtEndDocument{\end{multicols}}
        \pretocmd{\maketitle}{\end{multicols}}{}{}
        \apptocmd{\maketitle}{\begin{multicols}{2}}{}{}
\end{MacroCode}
    Always typeset \env{equation} and friends outside the grid:
\begin{MacroCode}{class}
        \BeforeBeginEnvironment{equation}{\begin{gridenv}}
        \AfterEndEnvironment{equation}{\end{gridenv}}
        \BeforeBeginEnvironment{equation*}{\begin{gridenv}}
        \AfterEndEnvironment{equation*}{\end{gridenv}}
        \BeforeBeginEnvironment{multline}{\begin{gridenv}}
        \AfterEndEnvironment{multline}{\end{gridenv}}
        \BeforeBeginEnvironment{multline*}{\begin{gridenv}}
        \AfterEndEnvironment{multline*}{\end{gridenv}}
        \BeforeBeginEnvironment{gather}{\begin{gridenv}}
        \AfterEndEnvironment{gather}{\end{gridenv}}
        \BeforeBeginEnvironment{gather*}{\begin{gridenv}}
        \AfterEndEnvironment{gather*}{\end{gridenv}}
        \BeforeBeginEnvironment{align}{\begin{gridenv}}
        \AfterEndEnvironment{align}{\end{gridenv}}
        \BeforeBeginEnvironment{align*}{\begin{gridenv}}
        \AfterEndEnvironment{align*}{\end{gridenv}}
        \BeforeBeginEnvironment{flalign}{\begin{gridenv}}
        \AfterEndEnvironment{flalign}{\end{gridenv}}
        \BeforeBeginEnvironment{flalign*}{\begin{gridenv}}
        \AfterEndEnvironment{flalign*}{\end{gridenv}}
        \BeforeBeginEnvironment{alignat}{\begin{gridenv}}
        \AfterEndEnvironment{alignat}{\end{gridenv}}
        \BeforeBeginEnvironment{alignat*}{\begin{gridenv}}
        \AfterEndEnvironment{alignat*}{\end{gridenv}}
\end{MacroCode}
    The \env{figure} environment is patched...
\begin{MacroCode}{class}
        \expandafter\let\expandafter
                    \old@figurest\csname figure*\endcsname
        \expandafter\let\expandafter
                    \old@endfigurest\csname endfigure*\endcsname
        \RenewDocumentEnvironment{figure}{o}{%
            \begin{gridenv}%
            \vspace{\intextsep}%
            \begin{minipage}{\linewidth}%
            \def\@captype{figure}%
        }{%
            \end{minipage}%
            \vspace{\intextsep}%
            \end{gridenv}%
        }
        \RenewDocumentEnvironment{figure*}{o}{\old@figurest}%
                                             {\old@endfigurest}
\end{MacroCode}
    ...as is \env{table}.
\begin{MacroCode}{class}
        \expandafter\let\expandafter
                    \old@tablest\csname table*\endcsname
        \expandafter\let\expandafter
                    \old@endtablest\csname endtable*\endcsname
        \RenewDocumentEnvironment{table}{o}{%
            \begin{gridenv}%
            \vspace{\intextsep}%
            \begin{minipage}{\linewidth}%
            \def\@captype{table}%
            \let\@old@caption\caption%
            \renewcommand{\caption}[1]{%
                \setlength{\@tempdima}{\abovecaptionskip}%
                \setlength{\abovecaptionskip}{\belowcaptionskip}%
                \setlength{\belowcaptionskip}{\@tempdima}%
                \@old@caption{##1}%
                \vspace{\belowcaptionskip}%
            }%
        }{%
            \end{minipage}%
            \vspace{\intextsep}%
            \end{gridenv}%
        }
        \let\oldoldtablest\oldtablest
        \renewcommand{\oldtablest}{%
            \oldoldtablest%
            \let\@old@caption\caption%
            \renewcommand{\caption}[1]{%
                \setlength{\@tempdima}{\abovecaptionskip}%
                \setlength{\abovecaptionskip}{\belowcaptionskip}%
                \setlength{\belowcaptionskip}{\@tempdima}%
                \@old@caption{##1}%
                \vspace{\belowcaptionskip}%
            }%
        }
        \RenewDocumentEnvironment{table*}{o}{\old@tablest}%
                                            {\old@endtablest}
\end{MacroCode}
    \begin{environment}{onecol}
    \changes{0.10}{Fixed, now not completely broken}
    Finally, we define an environment \env{onecol} that typesets
    arbitrary material in a single column. This is a bit tricky to
    do, and probably cargo-cult as well. We define the start of the
    environment to immediately end itself (with the empty ending),
    then end the \env{multiols} environment, redefine our end macro
    to start \env{multicols} as well as redefining the start of
    \env{onecol} to simply reset itself, then start the environment
    again only to have it ended at once.

    Basically, we trick \LaTeX\ into thinking that we have an empty
    \env{onecol} environment at the end of the first \env{multicols},
    then some content inside a fake \env{onecol}, then an empty
    \env{onecol} at the start of the next \env{multicols}. Voilá, no
    wierd group errors!
\begin{MacroCode}{class}
        \newenvironment{onecol}{
            \end{onecol}
            \end{multicols}
            \begingroup
            \def\endonecol{
                \endgroup
                \begin{multicols}{2}
                \let\old@onecol\onecol
                \def\onecol{
                    \let\onecol\old@onecol
                }
                \begin{onecol}
            }
            \def\onecol{}
            \begin{onecol}
        }{}
    }
\end{MacroCode}
    \end{environment}
\begin{MacroCode}{class}
\fi
\end{MacroCode}

    \subsubsection{Miscellaneous}
    A macro \cs{comment} (alias \cs{com}/\cs{note}) is defined to let 
    the user add comments and notes to the document.
    \begin{macro}{\@comment}
\begin{MacroCode}{class}
\NewDocumentCommand\@comment{m}{%
    {\textbf{Comment:} #1}%
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\comment}
    \changes{0.10}{Added macro for comments}
\begin{MacroCode}{class}
\NewDocumentCommand\comment{sm}{%
    \IfBooleanTF{#1}%
        {\colorbox{red!50}{\@comment{#2}}}%
        {\marginpar{\@comment{#2}}}%
}
\end{MacroCode}
    \end{macro}
    \begin{macro}{\com}
    \begin{macro}{\note}
    \changes{0.10b}{Fixed a silly error in \cs{com} and \cs{note}}
\begin{MacroCode}{class}
\ProvideDocumentCommand\com{sm}%
    {\IfBooleanTF{#1}{\comment*{#2}}{\comment{#2}}}
\ProvideDocumentCommand\note{sm}%
    {\IfBooleanTF{#1}{\comment*{#2}}{\comment{#2}}}
\end{MacroCode}
    \end{macro}
    \end{macro}

    \subsubsection{Color theme support}
    Color theme setup. Start by patching commands and declaring
    default colors. Not implemented: background colors for e.g.
    quote environments and sections headings, different colors
    for the different sectioning levels.
\begin{MacroCode}{class}
\ifskrapport@color
    \apptocmd{\bfseries}{\color{skrapport@boldcolor}}{}{\ClassError{skrapport}{Could not patch \protect\bfseries}{}}
    \apptocmd{\itshape}{\color{skrapport@italiccolor}}{}{\ClassError{skrapport}{Could not patch \protect\itshape}{}}
    \if\@titstyle\relax
        \def\@titstyle{\color{skrapport@titlecolor}}
    \else
        \apptocmd{\@titstyle}{\color{skrapport@titlecolor}}{}{\ClassError{skrapport}{Could not patch \protect\@titstyle}{}}
    \fi
    \def\@smallprintstyle{\color{skrapport@smallprintcolor}}
    \AtBeginDocument{%
        \let\@abstractname\abstractname
        \def\abstractname{\color{skrapport@titlecolor}\@abstractname}
    }
    \apptocmd{\quote}{\color{skrapport@quotecolor}}{}{}
    \def\@captionstyle{\color{skrapport@captioncolor}}
    \def\@emstyle{\color{skrapport@emphcolor}}
    \ifskrapport@twocolumn\AtBeginDocument{%
        \renewcommand\section{\@startsection {section}{1}{\z@}%
            {-.999\baselineskip}{0.001\baselineskip}{\bfseries\mathversion{bold}\color{skrapport@titlecolor}}}
        \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
            {\baselineskip}{-.35\baselineskip}{\bfseries\color{skrapport@titlecolor}\unskip}}
        \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
            {\baselineskip}{-.35\baselineskip}{\itshape\color{skrapport@titlecolor}\unskip}}
    }\fi
    \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
        {1ex \@plus .25ex \@minus -.25ex}{-1em}{\normalfont\normalsize\bfseries\color{skrapport@titlecolor}}}
    \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
        {1ex \@plus .25ex \@minus -.25ex}{-1em}{\normalfont\normalsize\itshape\color{skrapport@titlecolor}}}
    \AtBeginDocument{\@ifpackageloaded{hyperref}{%
        \hypersetup{%
            citebordercolor=skrapport@citecolor,citecolor=skrapport@citecolor,%
            filebordercolor=skrapport@filecolor,filecolor=skrapport@filecolor,%
            linkbordercolor=skrapport@linkcolor,linkcolor=skrapport@linkcolor,%
            menubordercolor=skrapport@menucolor,menucolor=skrapport@menucolor,%
            urlbordercolor=skrapport@urlcolor,urlcolor=skrapport@urlcolor,%
            runbordercolor=skrapport@runcolor,runcolor=skrapport@runcolor%
        }
    }{}}
    \AtBeginDocument{\color{skrapport@defaultcolor}}
\end{MacroCode}
    \begin{macro}{\colortheme}
    The \cs{colortheme} macro allows the end-user to load color themes
    (described later) to customize the colors of the document when the
    class is loaded with the \opt{color} option.
\begin{MacroCode}{class}
    \newcommand\colortheme[1]{\usepackage{skrapport-colortheme-#1}}
\end{MacroCode}
    \end{macro}
\begin{MacroCode}{class}
    \colortheme{default}
\fi
\end{MacroCode}

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

    \subsection{Color themes}
    As described earlier, the user can load color themes to customize
    the appearance of the document if the class was loaded with the
    \opt{color} option. Four themes are available by default.
    
    \subsubsection{Default color theme}
    \begin{theme}{Default}
    \changes{0.09}{Added default color theme}
\begin{MacroCode}{theme-default}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{skrapport-colortheme-default}%
    [2012/06/07 v1.0 skrapport color theme default]
\definecolor{skrapport@citecolor}{named}{green}
\definecolor{skrapport@filecolor}{named}{teal}
\definecolor{skrapport@linkcolor}{named}{red}
\definecolor{skrapport@menucolor}{named}{red}
\definecolor{skrapport@urlcolor}{named}{cyan}
\definecolor{skrapport@runcolor}{named}{teal}
\definecolor{skrapport@boldcolor}{named}{black}
\definecolor{skrapport@titlecolor}{named}{black}
\definecolor{skrapport@italiccolor}{named}{black}
\definecolor{skrapport@smallprintcolor}{named}{black}
\definecolor{skrapport@quotecolor}{named}{black}
\definecolor{skrapport@captioncolor}{named}{black}
\definecolor{skrapport@emphcolor}{named}{black}
\definecolor{skrapport@defaultcolor}{named}{black}
\endinput
\end{MacroCode}
    \end{theme}

    \subsubsection{Unscathed color theme}
    \begin{theme}{Unscathed}
    \changes{0.09}{Added ``Unschathed'' color theme}
\begin{MacroCode}{theme-unscathed}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{skrapport-colortheme-unscathed}%
    [2012/06/07 v1.0 skrapport color theme unscathed]
\definecolor{skrapport@citecolor}{named}{skrapport@defaultcolor}
\definecolor{skrapport@filecolor}{named}{skrapport@defaultcolor}
\definecolor{skrapport@menucolor}{named}{skrapport@defaultcolor}
\definecolor{skrapport@runcolor}{named}{skrapport@defaultcolor}
\definecolor{skrapport@emphcolor}{HTML}{463335}
\definecolor{skrapport@linkcolor}{HTML}{CF5D3B}
\definecolor{skrapport@urlcolor}{named}{skrapport@linkcolor}
\definecolor{skrapport@titlecolor}{HTML}{B34430}
\definecolor{skrapport@captioncolor}{named}{skrapport@titlecolor}
\definecolor{skrapport@quotecolor}{HTML}{70524A}
\definecolor{skrapport@smallprintcolor}{named}{skrapport@quotecolor}
\endinput
\end{MacroCode}
    \end{theme}

    \subsubsection{Cruelwater color theme}
    \begin{theme}{Cruelwater}
    \changes{0.09}{Added ``Cruelwater'' color theme}
\begin{MacroCode}{theme-cruelwater}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{skrapport-colortheme-cruelwater}%
    [2012/06/07 v1.0 skrapport color theme cruelwater]
\definecolor{skrapport@citecolor}{named}{black}
\definecolor{skrapport@filecolor}{named}{black}
\definecolor{skrapport@linkcolor}{named}{black}
\definecolor{skrapport@menucolor}{named}{black}
\definecolor{skrapport@urlcolor}{named}{black}
\definecolor{skrapport@runcolor}{named}{black}
\definecolor{skrapport@boldcolor}{HTML}{030C22}
\definecolor{skrapport@titlecolor}{HTML}{20293F}
\definecolor{skrapport@italiccolor}{named}{black}
\definecolor{skrapport@smallprintcolor}{HTML}{A9B0B3}
\definecolor{skrapport@quotecolor}{HTML}{404749}
\definecolor{skrapport@captioncolor}{HTML}{030C22}
\definecolor{skrapport@emphcolor}{HTML}{20293F}
\definecolor{skrapport@defaultcolor}{named}{black}
\endinput
\end{MacroCode}
    \end{theme}

    \subsubsection{Violet color theme}
    \begin{theme}{Violet}
\changes{0.09}{Added ``Violet'' color theme}
\begin{MacroCode}{theme-violet}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{skrapport-colortheme-violet}%
    [2012/06/07 v1.0 skrapport color theme violet]
\definecolor{skrapport@citecolor}{HTML}{932444}
\definecolor{skrapport@filecolor}{HTML}{932444}
\definecolor{skrapport@linkcolor}{HTML}{932444}
\definecolor{skrapport@menucolor}{HTML}{932444}
\definecolor{skrapport@urlcolor}{HTML}{932444}
\definecolor{skrapport@runcolor}{HTML}{932444}
\definecolor{skrapport@boldcolor}{HTML}{311A2A}
\definecolor{skrapport@titlecolor}{HTML}{311A2A}
\definecolor{skrapport@italiccolor}{named}{black}
\definecolor{skrapport@smallprintcolor}{HTML}{D6CBCF}
\definecolor{skrapport@quotecolor}{HTML}{463335}
\definecolor{skrapport@captioncolor}{HTML}{311A2A}
\definecolor{skrapport@emphcolor}{HTML}{98758D}
\definecolor{skrapport@defaultcolor}{named}{black}
\endinput
\end{MacroCode}
    \end{theme}

    \Finale
    \PrintChanges
    \PrintIndex
    \printbibliography
\end{document}