\documentclass[10pt, a4paper]{article}

%-----------------------------------------------------------
%----------------------  Packages  -------------------------
%-----------------------------------------------------------

\usepackage{a4wide}
\usepackage{color}
\usepackage{amsmath,amssymb,epsfig,pstricks,xspace}
\usepackage{graphics}
\usepackage{dsfont}
\usepackage{amsfonts}
\usepackage{graphics, psfrag}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{enumitem} 
\usepackage{array,dcolumn,booktabs}
\usepackage{amsthm}
\usepackage{framed}
\usepackage{listings}
\usepackage{algorithm,algorithmicx,algpseudocode}
\usepackage{pifont}
\usepackage{hyperref,url}

%-----------------------------------------------------------
%------------------  Setup/Commands  -----------------------
%-----------------------------------------------------------

\newcounter{task}
\newcommand{\task}{\stepcounter{task}\paragraph{Task \thetask}\ \\}

% setup the listing (pseudocode/source code) environment
\definecolor{commentgreen}{rgb}{0,0.5,0}
\definecolor{stringgray}{rgb}{0.5,0.5,0.5}

\lstset{ %
%  aboveskip=-5pt,                 % position of listing environment in relation to original position
  backgroundcolor=\color{white},   % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}
  basicstyle=\footnotesize,        % the size of the fonts that are used for the code
  belowskip=\medskipamount,
  breakatwhitespace=true,          % sets if automatic breaks should only happen at whitespace
  breaklines=true,                 % sets automatic line breaking
  commentstyle=\color{commentgreen},      % comment style
  deletekeywords={...},            % if you want to delete keywords from the given language
  escapeinside={\%*}{*)},          % if you want to add LaTeX within your code
  extendedchars=true,              % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
  frame=none,                      % adds a frame around the code
  keepspaces=true,                 % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
  keywordstyle=\color{black}\bfseries,       % keyword style
  language=Ada,                    % the language of the code
  mathescape=true,
  morekeywords={*,...},            % if you want to add more keywords to the set
  numbers=left,                    % where to put the line-numbers; possible values are (none, left, right)
  numbersep=5pt,                   % how far the line-numbers are from the code
  numberstyle=\tiny\color{black},  % the style that is used for the line-numbers
  rulecolor=\color{black},         % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
  showlines=true,
  showspaces=false,                % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
  showstringspaces=false,          % underline spaces within strings only
  showtabs=false,                  % show tabs within strings adding particular underscores
  stepnumber=1,                    % the step between two line-numbers. If it's 1, each line will be numbered
  stringstyle=\color{stringgray},        % string literal style
  tabsize=2,                       % sets default tabsize to 2 spaces
%  title=                   		   % show the filename of files included with \lstinputlisting; also try caption instead of title
}


%-----------------------------------------------------------
%--------------------  Document  ---------------------------
%-----------------------------------------------------------

\begin{document}

\pagestyle{plain}

\begin{center}
\fbox{\parbox{11cm}{
  \begin{center}
    {\Large 1. Problem Set -- Solution\\ \vspace{0.2em}
      {\bf Safe and Secure Software}\\ \vspace{0.4em}
      (Summer Term 2015)\\ \vspace{1em}
    \texttt{<first name> <surname> <matr. nr.>}}
  \end{center}
}}
\end{center}


% tasks are automatically enumerated
\task
Example for source code

\begin{lstlisting}
package Vectors is
  type Vector is record
    X: Float = 0.0;
    Y: Float = 0.0;
    Z: Float = 0.0;
  end record;

  function "+"(Left,Right: Vector) return Vector;
  -- Adds two vectors dimension-wise
  function "-"(Left,Right: Vector) return Vector;
  -- Subtracts the right from the left vector dimension-wise
  procedure Put(Item: Vector);
  -- Prints vector in format (X,Y,Z)
end Vectors;

\end{lstlisting}


\task
To write formulas that do not have to be cited, one can use single dollars: $1 +
1 + 2 + 3 = 7$ or double dollars for equations:
$$
1 + 1 + 2 + 3 = 7.
$$
It also work with brackets (equation environment).
\[
  1 + 1 + 2 + 3 = 7.
\]
For multi-line equations, there are the \texttt{align} or \texttt{array}
environments:
\begin{align*}
  c &= k + x \bmod 26, \\
  m &= k - x \bmod 26.
\end{align*}

\task 
Beautiful tables can be created very easily with the tabular and booktabs
packages.
\begin{table}[!ht]
  \centering
  \begin{tabular}{lcr} % c = centered, l = left-aligned, r = right-aligned
  \toprule
  left-aligned & centered & right-aligned\\
  \midrule
  1 & 2 & 3 \\
  4 & 5 & 6 \\
  \bottomrule
  \end{tabular}
\end{table}


\task
For many Linux distributions, \LaTeX can be installed easily using the package
management system. On Windows, \href{http://miktex.org/download}{MiKTeX} is a
good all-in-one solution, including the \LaTeX~programs and a comfortable package
manager. 

A very good starting point on How-to-Use \LaTeX~is, e.g. the
\href{http://en.wikibooks.org/wiki/LaTeX}{Wikibook}. However, there are millions
of documentations. 

\url{http://tex.stackexchange.com/} is the stackoverflow equivalent for
LaTeX-related questions. A good link is also
\href{http://detexify.kirelabs.org/classify.html}{Detexify}, which allows you to
draw a symbol and get a list of potentially matching latex commands.

How to cite a reference from the bibliography~\cite{AuthorYear}.


%-----------------------------------------------------------------------
% Bibliography
%-----------------------------------------------------------------------

\begin{thebibliography}{99}
  \bibitem{AuthorYear} Author, \emph{Title}, Journal/Editor, (year)
\end{thebibliography}

%-----------------------------------------------------------------------

\end{document}



