\documentclass[10pt,a4paper]{article} % {{{
\usepackage{float}
\usepackage{listings}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{appendix}
\usepackage{graphicx}

\usepackage{booktabs}

% Graphviz graph (using tikz)
%\usepackage[x11names, rgb]{xcolor}
%\usepackage{tikz}
%\usetikzlibrary{snakes,arrows,shapes}

% Load code highlighter color scheme
\input{colors}

% Create a box around the code examples
\floatstyle{boxed}
\newfloat{program}{thp}{lop}
\floatname{program}{Program}

% Theorems, lemmas and definitions
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\newenvironment{proof}[1][Proof]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{example}[1][Example]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{remark}[1][Remark]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

\newcommand{\qed}{\nobreak \ifvmode \relax \else
    \ifdim\lastskip<1.5em \hskip-\lastskip
    \hskip1.5em plus0em minus0.5em \fi \nobreak
    \vrule height0.75em width0.5em depth0.25em\fi}

% }}}

\title{\LaTeX{} report assignment}
\author{Sander van Veen, University of Amsterdam}

\begin{document}

\maketitle

\begin{abstract}
This assignment is about practising with the \LaTeX{} typesetting system. This
assignment should at least contain an abstract (this), table of content (below
on this page), different sections, some source code, a graph, a table, a
mathematical equation (including a theorem and proof), footnotes, hyperlinks, a
quotation, a reference to an existing scientific article and, last by not least,
should use BibTeX.
\end{abstract}

\tableofcontents

\pagebreak

\section{Basic typography} % {{{
\label{sec:Basic typography}

\subsection{Ordered and unordered list} % {{{
\label{sub:Ordered and unordered list}

Let's start with an example of an unordered list containing the names of some
``randomly chosen'' countries.

\begin{itemize}
    \item The Netherlands.
    \item Belgium.
    \item Germany.
    \item England.
    \item France.
\end{itemize}

\noindent And an ordered list, which is used when the order matters.

\begin{enumerate}
    \item First item.
    \item Second item.
    \item Third item, which is \\
          splitted into two lines.
    \item Fourth and last item.
\end{enumerate}

% }}}

\subsection{Footnotes and hyperlinks} % {{{
\label{sub:Footnotes and hyperlinks}

When writing an article, it is sometimes unclear if the audience of the article
understands every detail. Therefore, it is wise to add additional information
(or the address of a web page containing additional information) about details
inside footnotes\footnote{This is an example of a footnote in \LaTeX{}.}.
Manuals contain often hyperlinks to introduce a subject, which is out of the
scope of the manual. This is a hyperlink to Google's homepage:
\url{http://www.google.com}, which will help while writing an advanced \LaTeX{}
document.

% }}}

\subsection{Quotation and references} % {{{
\label{sub:Quotation and references}

It is possible that another author wrote a brilliant text about your subject. It
is even so brilliant that describes everything and your description would be
fuzzy compared to his description. That could be a reason to quote the relevant
part of his text. \footnote{Note: Plagiarism looks like quoting but is in fact
very different. Plagiarism is when someone is quoting, for example, an entire
article, without mentioning the source of the article. I would call it stealing,
but that is just my humble opinion.}

This a quote of the famous Linus Torvalds, which is one the reason why I choose
to study Computer Science:

\begin{quote} \emph{``Most good programmers do programming not because they
expect to get paid or get adulation by the public, but because it is fun to
program.'' $-$ Linus Torvalds} \end{quote}

% reference to existing article.
% BibTex

This sentence will demonstrate references to other articles or books: Use
\LaTeX{}, it will make writing less time consuming. \cite{lamport94}.

% }}}

% }}}

\section{Pseudo code} % {{{
\label{sec:Pseudo-code}

One of the requirements of this assignment is demonstrating some (highlighted)
pseudo code, therefore I took the initiative to write some example python code
used for this demonstration.

\begin{program}[H] % {{{

\label{lst-example-foo}

\input{foo}

\caption{ Python code containing one lambda expression and three definitions (in
other languages known as ``methods'') wrapped in a class.}

\end{program} % }}}

\noindent The code given in code example above is stored in an external file
called \texttt{foo.py}. The syntax highlighting is generated by Pygments
\footnote{Pygments is a general purpose syntax highlighter for various source
code formats and is available at \url{http://pygments.org/}} and is stored in
\texttt{foo.tex}. The pre-generated color scheme is also part of Pygments
(compilation with \texttt{-O style=colorful,full,preamble}) and is saved as
\texttt{colors.tex}. The color scheme is pre-generated to reduce the overall
compilation process.

% }}}

\section{Graph and table} % {{{
\label{sec:Graph and table}

\subsection{Look all those tables!} % {{{
\label{sub:Look, it's a table!}

\begin{table}[H] \centering
\begin{tabular}{|l|l|l|} \hline
$r_1c_1$ & $r_1c_2$ & $r_1c_3$ \\ \hline
$r_2c_1$ & $r_2c_2$ & $r_2c_3$ \\ \hline
$r_3c_1$ & $r_3c_2$ & $r_3c_3$ \\ \hline
\end{tabular}
\caption{Basic table with three columns and rows.}
\end{table}

\begin{table}[H] \centering
\begin{tabular}{|l|ll|} \hline
$r_1c_1$ & $r_1c_2$ & $r_1c_3$ \\ \hline
$r_2c_1$ & $r_2c_2$ & $r_2c_3$ \\ \cline{2-3}
$r_3c_1$ & $r_3c_2$ & $r_3c_3$ \\ \hline
\end{tabular}
\caption{Basic table with three columns and rows.}
\end{table}

\begin{table}[H]
\begin{tabular}{@{}rrrrcrrrcrrr@{}}\toprule
& \multicolumn{3}{c}{$w = 8$} & \phantom{abc}& \multicolumn{3}{c}{$w = 16$} \\
\cmidrule{2-4} \cmidrule{6-8} \cmidrule{10-12}
& $t=0$ & $t=1$ & $t=2$ && $t=0$ & $t=1$ & $t=2$ \\\midrule
$dir=1$\\
$c$ & 0.0790 & 0.1692 & 0.2945 && 0.3670 & 0.7187 & 3.1815 \\
$c$ & -0.8651& 50.0476& 5.9384&& -9.0714& 297.0923& 46.2143 \\
$c$ & 124.2756& -50.9612& -14.2721&& 128.2265& -630.5455& -381.0930 \\
$dir=0$\\
$c$ & 0.0357& 1.2473& 0.2119&& 0.3593& -0.2755& 2.1764 \\
$c$ & -17.9048& -37.1111& 8.8591&& -30.7381& -9.5952& -3.0000 \\
$c$ & 105.5518& 232.1160& -94.7351&& 100.2497& 141.2778& -259.7326 \\
\bottomrule
\end{tabular}
\caption{Example table using the \texttt{booktabs} package.}
\end{table}

% }}}

\subsection{Graph (using GraphViz to PSTikz)} % {{{
\label{sub:Graph-using-GraphViz-to-PSTikz}

\begin{figure}[H]
\includegraphics[width=8cm,height=5cm]{graph.png}
\caption{Two graphs, written in GraphViz' \texttt{dot} and generated using \texttt{dot2tex}.}
\end{figure}

% }}}

% }}}

\section{Mathematics} % {{{
\label{sec:Mathematics}

\subsection{Example matrix} % {{{
\label{sub:Example matrix}

Matrix A is an $M \times N$ matrix, which is written as
\[
    \left(
    \begin{array}{cccc}
    \alpha_{0,0}   & \alpha_{0,1}   & \cdots & \alpha_{0,n-1}   \\
    \alpha_{1,0}   & \alpha_{1,1}   & \cdots & \alpha_{1,n-1}   \\
    \vdots         & \vdots         & \ddots & \vdots           \\
    \alpha_{m-1,0} & \alpha_{m-1,1} & \cdots & \alpha_{m-1,n-1}
    \end{array}
    \right)
\]
% }}}

\subsection{Equations} % {{{
\label{sub:Equations}

\LaTeX{} makes it possible to write equations (with for example sub and
superscript, braces and summations) easily.

\[
    \left|\sum_{i=1}^n a_ib_i\right|
    \le
    \left(\sum_{i=1}^n a_i^2\right)^{1/2}
    \left(\sum_{i=1}^n b_i^2\right)^{1/2}
\]

And it is possible to break the equation into smaller, numbered parts.

\begin{align}
(a+b)^3 &= (a+b)^2(a+b)\\
&=(a^2+2ab+b^2)(a+b)\\
&=(a^3+2a^2b+ab^2) + (a^2b+2ab^2+b^3)\\
&=a^3+3a^2b+3ab^2+b^3
\end{align}

% }}}

\subsection{Mathematical Theorem} % {{{
\label{sub:Mathematical Theorem}

The following definition, lemma and proof are copied from
\url{http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Theorems.html}.

\begin{definition}
Let $H$ be a subgroup of a group~$G$.  A \emph{left coset} of $H$ in $G$ is a
subset of $G$ that is of the form $xH$, where $x \in G$ and $xH = \{ xh : h \in
H \}$.  Similarly a \emph{right coset} of $H$ in $G$ is a subset of $G$ that is
of the form $Hx$, where $Hx = \{ hx : h \in H \}$
\end{definition}

Note that a subgroup~$H$ of a group $G$ is itself a left coset of $H$ in $G$.

\begin{lemma}
\label{LeftCosetsDisjoint}
Let $H$ be a subgroup of a group $G$, and let $x$ and $y$ be elements of $G$.
Suppose that $xH \cap yH$ is non-empty.  Then $xH = yH$.
\end{lemma}

\begin{proof}
Let $z$ be some element of $xH \cap yH$.  Then $z = xa$ for some $a \in H$, and
$z = yb$ for some $b \in H$.  If $h$ is any element of $H$ then $ah \in H$ and
$a^{-1}h \in H$, since $H$ is a subgroup of $G$.  But $zh = x(ah)$ and $xh =
z(a^{-1}h)$ for all $h \in H$.  Therefore $zH \subset xH$ and $xH \subset zH$,
and thus $xH = zH$.  Similarly $yH = zH$, and thus $xH = yH$, as required.\qed
\end{proof}

% }}}

% }}}

\begin{appendices}

\section{Example appendix} % {{{
\label{sec:Example}

Additional information (or information which will fill many pages) is in most
cases added at the end of a document in the Appendix. This is just an example,
but without any additional information :-).

% }}}

\end{appendices}

\bibliographystyle{plain}
\bibliography{report}

\end{document}
% vim: foldmethod=marker:
