# Documents With Style

Last edited: 2015/07/10

People have asked me how I create the manuals of my packages, one has even asked me if I would write a document class similar to classicthesis. I am not going to do this but can provide my basic preamble settings. It is not very complicated, actually.

Let’s take a look at it first — here for a PDFLaTeX document:

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel
}

% fonts:
\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath
}
\useosf % lining figures in text after (!) math package has been loaded

% microtypography:
\usepackage{microtype}

% headings:
\renewcommand*\sectionformat{%
\textcolor{base}{\thesection\autodot}\enskip
}
\renewcommand*\subsectionformat{%
\textcolor{base}{\thesubsection\autodot}\enskip
}
\renewcommand*\subsubsectionformat{%
\textcolor{base}{\thesubsubsection\autodot}\enskip
}
\renewcommand*\partformat{%
\textcolor{base}{\partname~\thepart\autodot}%
}

% footnotes:
\usepackage[supstfm=libertinesups]{superiors}
\usepackage{fnpct}
\deffootnote{2em}{1em}{\llap{\thefootnotemark. }
}

% header/footer:
\pagestyle{headings}

% floating environment captions:
\setkomafont{caption}{\normalfont\small\sffamily}
\setkomafont{captionlabel}{\normalfont\small\sffamily\scshape}
\setcapindent{1.5em
}

% colors:
\usepackage{xcolor}
%   color definitions:
\xdefinecolor{cnltxbrown}{rgb}{0.60,0.25,0.15}
\xdefinecolor{cnltxblue}{rgb}{0.02,0.04,0.48}
\xdefinecolor{cnltxred}{rgb}{0.65,0.04,0.07}
\xdefinecolor{cnltxgreen}{rgb}{0.06,0.44,0.08}
\xdefinecolor{cnltxgray}{gray}{0.5}
\colorlet{cnltxyellow}{yellow!40!brown
}
%   color settings:
\colorlet{base}{cnltxred}
\colorlet{link}{black!90
}

% hyperlinks and related stuff:
\usepackage{hyperref}
\hypersetup
{
colorlinks         = true,
allcolors          = link ,
plainpages         = false,
bookmarksopen      = true,
bookmarksopenlevel = 1,
bookmarksnumbered  = true,
pdfauthor          = {Clemens Niederberger},
pdftitle           = {The Document Title},
pdfsubject         = {the Document Subject},
pdfstartview       = FitH

}

% sample document:
\usepackage{blindtext}

\begin{document}

\tableofcontents
\blindmathtrue
\blinddocument
\blindmathpaper

\end{document
}

As you can see there is no magic in there. I’ll give a few comments on some of the packages used. I always use a KOMA-Script class. The first few packages are when I compile with PDFLaTeX:

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc
}

With XeLaTeX or LuaLaTeX I’d use

\usepackage{fontspec}

instead.

In most of my documents I use these fonts:

% fonts:
\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath
}
\useosf % oldstyle figures in text, after (!) math package has been loaded

This loads the Linux Libertine O font as serif and Linux Biolinum O as sans serif. I quite dislike the Libertine teletype font, though, which is why I use Bitstream Vera Sans Mono instead.

About the footnotes part I have written a blog post already:

% footnotes:
\usepackage[supstfm=libertinesups]{superiors}
\usepackage{fnpct}
\deffootnote{2em}{1em}{\llap{\thefootnotemark. }
}

There isn’t much more to say, really. A simple preamble that does not justify the creation of a new document class.

Here is how the example from above looks:

After having said that: when I create manuals for my packages I indeed do use a custom class. I used to use my cnpkgdoc class but it needed a complete overhaul for a long time. This means I now consider it obsolete. I have written a more versatile bundle that provides much more flexibility: and that I will upload to CTAN eventually: cnltx. I haven’t actually any published any manual using the class, yet. The next update of any of my packages will be the first. cnltx.