%% chscite Skånings rapportklass %% %% Copyright (C) 2012 by Simon Sigurdhsson %% %% 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{} 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{} 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[]{} 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*{} \DescribeMacro\com*{} \DescribeMacro\note*{} 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[]{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{} 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}