General LaTeX tips and tricks → Packages

## 7. What LaTeX packages do you use?

I use the following third-party packages written for LaTeX: babel, type1cm, courier, sectsty, fncychap, url, graphicx, relsize, geometry, crop, fancyhdr, caption, tocbibind, tocloft, natbib, and amsthhm.

Except for fncychap all these packages are included in the teTeX 2.0 distribution, and the most recent versions of all of them can be found on CTAN.

Overall, my experience with these packages is extremely positive. I have found them to be bugfree and stable, their documentation is excellent, and most importantly, they play well with each other if you want to use a whole bunch of them together.

Below, I reproduce the entire LaTeX preamble section of my thesis.tex master file, just to give an overview of what will be discussed in more detail (with example screenshots) in subsequent tips pages dealing with the effects of the individual packages.

### My thesis.tex preamble


%% thesis.tex - main LaTeX file for Leo's PhD thesis.
%%

%% A thesis is a book. No kidding, Sherlock...
\documentclass[10pt]{book}

%% We want UK-english and Dutch hyphenation patterns.
\usepackage[dutch,british]{babel}

%% Use scalable, PostScript Type 1 versions of the Computer Modern fonts.
\usepackage{type1cm}

%% Replace the standard Computer Modern Typewriter font LaTeX uses
%% for monospace text with the PostScript font Adobe Courier.
\usepackage{courier}

%% Redefine the font used for the section headings to
%% Helvetica-Narrow Bold.
\usepackage{sectsty}
\allsectionsfont{\usefont{OT1}{phv}{bc}{n}\selectfont}

%% Use fancy chapter headers, with Jos Dingjan's modifications,
%% plus my own tweaks. This style is not part of teTeX,
%% so we are using a local (and renamed) copy.
\usepackage[Lenny]{sty/fncychapleo}

%% Nicely format and linebreak URLs in the bibliography (and elsewhere).
\usepackage{url}
%% Define a new 'leo' style for the package that will use a smaller font.
\makeatletter
\def\url@leostyle{%
\@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\small\ttfamily}}}
\makeatother
%% Now actually use the newly defined style.
\urlstyle{leo}

%% Standard graphics support. Always use this package
%% instead of the older 'graphics' package.
\usepackage{graphicx}

%% Allow relative font size specifications (e.g. \smaller, \larger).
\usepackage{relsize}

%% For defining all text/page measurements. 170x240mm is the
%% standard thesis page size Ponsen & Looijen require. 124x185mm is
%% simply a text body size that resulted in margins that pleased me.
%% The dvips option will be superceded if pdflatex is used, but is
%% necessary in order to generate a correct PostScript bounding box
%% under standard LaTeX.
\usepackage[vcentering,dvips]{geometry}
\geometry{papersize={170mm,240mm},total={124mm,185mm}}

%% For printing crop-marks in a final a4 version. This is not used
%% in the final 170x240mm-sized version to be delivered to Ponsen & Looijen.
%\usepackage[a4,cam,center]{crop}
%\crop[font=\upshape\mdseries\small\textsf]

%% We will completely define our own header strings, so switch the fancy
%% headers on, but nuke all the default values. (Note that this package
%% *has* to load after the geometry package!)
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
%% Now begin customising things. See the fancyhdr docs for more info.
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\MakeUppercase{#1}}{}}

%% Nicer formatting of figure captions.
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption}

\usepackage[nottoc]{tocbibind}

\usepackage[titles]{tocloft}
%% Use Helvetica-Narrow Bold for Chapter entries
\renewcommand{\cftchapfont}{%
\fontsize{11}{13}\usefont{OT1}{phv}{bc}{n}\selectfont
}
%% Because of the font change, the page number becomes too large for the
%% horizontal space LaTeX reserves for it by default. Without the following
%% redefines to fix it, this would cause the Chapter entry page numbers
%% to extend a few points into the right margin. The horror!
\makeatletter
\renewcommand{\@pnumwidth}{1.75em}
\renewcommand{\@tocrmarg}{2.75em}
\makeatother
%% Aesthetic spacing redefines that look nicer to me than the defaults.
\setlength{\cftbeforechapskip}{2ex}
\setlength{\cftbeforesecskip}{0.5ex}

%% Support for more complex bibiography handling.
\usepackage[square,authoryear,sort&compress]{natbib}
%% Custom bibliography style defined using the Makebst utility
%% that comes with the natbib package.
\bibliographystyle{bib/bibleo}

%% Include entire AMS Theorem package, just because we want to use the
%% unnumbered \newtheorem* environment it provides.
\usepackage{amsthm}
\newtheorem*{definition}{Definition}

%% Thesis-specific, self-defined grammar styles, based on originals by
%% Kees van Reeuwijk. These styles work just fine, but have one problem
%% and that is that they cause lots of "underfull hbox" errors during
%% compilation. I have never had the time to look into a way of fixing this.
\usepackage{sty/vnusgrammar}
\usepackage{sty/rlgrammar}

%% Other thesis-specific macros and redefines.
\input{defs}

%% The actual manuscript starts here.

\begin{document}

...



Leo Breebaart (leo@lspace.org)
Last updated: 27 June 2016