% TEMPLATE.TEX
%
% Time-stamp: <2013-03-26 11:09 olenz>
%
% This is an extensively documented LaTeX file that shows how to
% produce a good-looking document with current LaTeX (11/2012).
%
% IMPORTANT!
%
%   Some obsolete commands and packages
% ----------|-------------------------------
% obsolete  |     Replacement in LATEX 2ε
% ----------|-------------------------------
%           | local            global/switch
% ----------|-------------------------------
% {\bf ...} | \textbf{...}     \bfseries
%     -     | \emph{...}       \em
% {\it ...} | \textit{...}     \itshape
%     -     | \textmd{...}     \mdseries
% {\rm ...} | \textrm{...}     \rmfamily
% {\sc ...} | \textsc{...}     \scshape
% {\sf ...} | \textsf{...}     \sffamily
% {\sl ...} | \textsl{...}     \slshape
% {\tt ...} | \texttt{...}     \ttfamily
%     -     | \textup{...}     \upshape
%
% DON'T USE \\ TO MAKE LINEBREAKS, INSTEAD JUST LEAVE A BLANK LINE!
%
\RequirePackage[l2tabu,orthodox]{nag} % turn on warnings because of bad style
\documentclass[a4paper,11pt,bibtotoc]{scrartcl}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% KOMA CLASSES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The class "scrartcl" is one of the so-called KOMA-classes, a set of
% very well done LaTeX-classes that produce a very European layout
% (e.g. titles with a sans-serif font).
% 
% The KOMA classes have extensive documentation that you can access
% via the commands:
%   texdoc scrguide # in German
%   texdoc scrguien # in English
%   
%
% The available classes are:
%
% scrartcl - for "articles", typically for up to ~20 pages, the
%            highest level sectioning command is \section
%
% scrreprt - for "reports", typically for up to ~200 pages, the
%            highest level sectioning command is \chapter
%
% scrbook  - for "books", for more than 200 pages, the highest level
%            sectioning command is \part.
%
% USEFUL OPTIONS
%
% a4paper  - Use a4 paper instead of the default american letter
%            format.
%
% 11pt, 12pt, 10pt 
%          - Use a font with the given size.
%
% bibtotoc - Add the bibliography to the table of contents
%
% The KOMA-script classes have plenty of options to modify

% This allows to type UTF-8 characters like ä,ö,ü,ß
\usepackage[utf8]{inputenc}

\usepackage[T1]{fontenc}        % Tries to use Postscript Type 1 Fonts for better rendering
\usepackage{lmodern}            % Provides the Latin Modern Font which offers more glyphs than the default Computer Modern
\usepackage[intlimits]{amsmath} % Provides all mathematical commands

\usepackage{hyperref}           % Provides clickable links in the PDF-document for \ref
\usepackage{grffile}            % Allow you to include images (like graphicx). Usage: \includegraphics{path/to/file}

% Allows to set units
\usepackage[ugly]{units}        % Allows you to type units with correct spacing and font style. Usage: $\unit[100]{m}$ or $\unitfrac[100]{m}{s}$

% Additional packages
\usepackage{url}                % Lets you typeset urls. Usage: \url{http://...}
\usepackage{breakurl}           % Enables linebreaks for urls
\usepackage{xspace}             % Use \xpsace in macros to automatically insert space based on context. Usage: \newcommand{\es}{ESPResSo\xspace}
\usepackage{xcolor}             % Obviously colors. Usage: \color{red} Red text
\usepackage{booktabs}           % Nice rules for tables. Usage \begin{tabular}\toprule ... \midrule ... \bottomrule

% Source code listings
\usepackage{listings}           % Source Code Listings. Usage: \begin{lstlisting}...\end{lstlisting}
\lstloadlanguages{python}       % Default highlighting set to "python"

\begin{document}

\titlehead{Simulation Methods in Physics I \hfill WS 2014/2015}
\title{Template for a nice \LaTeX{} document}
\author{Olaf Lenz}
\date{\today}
\publishers{Institute for Computational Physics, University of
  Stuttgart}
\maketitle

\tableofcontents

\section{Math}

The package \verb|amsmath| is available for typesetting math. Execute \verb|texdoc amsmath| in your terminal for additional information.

Here is an equation typeset using commands from \verb|amsmath|.
%
\begin{equation}
	\begin{pmatrix}
		D_1t       & -a_{12}t_2 & \dots & -a_{1n}t_n \\
		-a_{21}t_1 & D_2t       & \dots & -a_{2n}t_n \\
		\hdotsfor[2]{4} \\
		-a_{n1}t_1 & -a_{n2}t_2 & \dots & D_nt
	\end{pmatrix}
\end{equation}
%
Furthermore don't use \verb|eqnarray| and use \verb|align| instead! (If you don't know what \verb|eqnarray| is, nevermind)

\subsection{Units}

Typesetting units by hand is extermely annoying because you have to take care of spacing and font style, for example
%
\begin{verbatim}
100 \; \mathrm{m} \text{ or } 100 \; \mathrm{\frac{m}{s}}
\end{verbatim}
%
to produce \[ 100 \; \mathrm{m} \text{ or } 100 \; \mathrm{\frac{m}{s}} \]
That's why we use the package \verb|units|! See:
%
\begin{verbatim}
\unit[100]{m} \text{ or } \unitfrac[100]{m}{s}
\end{verbatim}
%
to produce \[ \unit[100]{m} \text{ or } \unitfrac[100]{m}{s} \]

Execute \verb|texdoc units| in your terminal for additional information.

\section{Paragraphs}

To begin a new paragraph (alias newline) just insert a blank line in your code.
%
\begin{verbatim}
old paragraph

new paragraph
\end{verbatim}
%
\rule{0.3\textwidth}{1pt}\\
old paragraph

new paragraph
\\\rule{0.3\textwidth}{1pt}\\
%
\emph{Do not use} \verb|\\|!
%
\begin{verbatim}
old paragraph \\
new paragraph
\end{verbatim}
%
\rule{0.3\textwidth}{1pt}\\
old paragraph \\
new paragraph
\\\rule{0.3\textwidth}{1pt}\\
%
As you can see this screws up the indentation. If you don't want new paragraphs to be indented consider using the \verb|parskip| option in \verb|documentclass|.

\section{Some obsolete commands}

\begin{table}[ht]
  \centering
  \caption{Comparison of obsolete and up-to-date commands for changing font styles.}
  \begin{tabular}{lll}
    \toprule
    \multicolumn{1}{c}{obsolete}&
    \multicolumn{2}{c}{Replacement in \LaTeXe}\\
    \cmidrule(l){2-3}
    &
    \multicolumn{1}{c}{local} &
    \multicolumn{1}{c}{global/switch}\\
    \cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(l){3-3}
    \verb|{\bf ...}| & \verb|\textbf{...}| & \verb|\bfseries|\\
    ---              & \verb|\emph{...}|   & \verb|\em| \\
    \verb|{\it ...}| & \verb|\textit{...}| & \verb|\itshape| \\
    ---              & \verb|\textmd{...}| & \verb|\mdseries| \\
    \verb|{\rm ...}| & \verb|\textrm{...}| & \verb|\rmfamily| \\
    \verb|{\sc ...}| & \verb|\textsc{...}| & \verb|\scshape| \\
    \verb|{\sf ...}| & \verb|\textsf{...}| & \verb|\sffamily| \\
    \verb|{\sl ...}| & \verb|\textsl{...}| & \verb|\slshape| \\
    \verb|{\tt ...}| & \verb|\texttt{...}| & \verb|\ttfamily| \\
    ---              & \verb|\textup{...}| & \verb|\upshape|\\
    \bottomrule
  \end{tabular}
\end{table}

Execute \verb|texdoc l2tabu-english| in your terminal for additional information.

% - Units
% - \hfill, \vfill
% - empty lines: paragraph
% \textbf{Bla} vs. {\bfseries Bla}
% \xspace

\end{document}
