% !TEX root = ../manual.tex
% !TEX program = xelatexmk
% !TEX spellcheck = en_GB

\section{Packages}
\label{sec:packages}
By default, \LaTeX\ is pretty basic: you can't do much. Many of the advanced features of \LaTeX\ are provided through \emph{packages}.

A package is loaded in your preamble. Packages are loaded in one of the following three ways:

\begin{lstlisting}
\usepackage{packagename}
\usepackage[package-arguments]{packagename}
\usepackage{packageone,packagetwo}
\end{lstlisting}

Now let's go over some widely used packages:

\subsection{geometry}
The \emph{geometry} package can change margins and other dimensions of your layout. Most of the time one uses it with the \texttt{a4paper} option. This can also be done when defining your \emph{document class}.

\begin{minipage}[t]{.48\linewidth}%
\begin{lstlisting}
\documentclass[a4paper]{article}
\usepackage{geometry}
\end{lstlisting}
\end{minipage}%
\hfill
\begin{minipage}[t]{.48\linewidth}%
\begin{lstlisting}
\documentclass{article}
\usepackage[a4paper]{geometry}
\end{lstlisting}
\end{minipage}

\subsection{babel}
The \emph{babel} package is a very nifty package that translates and changes hyphenation  when a language is specified. Usage is very much like \emph{geometry}:

\begin{multicols}{2}
\begin{lstlisting}
\documentclass[dutch]{article}
\usepackage{babel}
\end{lstlisting}
\columnbreak
\begin{lstlisting}
\documentclass{article}
\usepackage[dutch]{babel}
\end{lstlisting}
\end{multicols}

\subsection{hyperref}

The \emph{hyperref} package makes all internal links such as references and the table of contents clickable.
It also adds the metadata to your PDF like the table of contents, the title and the author.
It also provides clickable links to the internet.
This package is a bit more complex.
Loading it is simple though:

\begin{lstlisting}
\usepackage[ocgcolorlinks]{hyperref} % the ocgcolorlinks argument tries to make the link-colors non-printable.
\end{lstlisting}

You can also customize the appearance of the links:

\begin{lstlisting}
\usepackage[usenames,dvipsnames,table,svgnames]{xcolor}
\hypersetup{
    colorlinks,
    citecolor=Goldenrod!80!Black,
    filecolor=Cerulean,
    linkcolor=BrickRed,
    urlcolor=Blue
}
\end{lstlisting}

It also adds the |\url| and |\href| commands:

\begin{multicols}{2}
\begin{lstlisting}[aboveskip=-10pt]
\url{www.google.com} \\
\href{www.google.com}{Google}
\end{lstlisting}
\columnbreak
\url{www.google.com} \\
\href{www.google.com}{Google}
\end{multicols}
