\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{url}
\usepackage{listings}
\usepackage{color}
\usepackage{appendix}
\usepackage{caption}
\usepackage{xpatch}
\usepackage{graphicx}
\usepackage{subfig}

\usepackage{hyperref}

%% Commands and definitions related to
%% writing code directly into LaTeX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codebrown}{rgb}{0.47, 0.27, 0.23}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstdefinestyle{mystyle}{
    backgroundcolor=\color{backcolour},
    commentstyle=\color{codegreen},
    keywordstyle=\color{blue},
    numberstyle=\tiny\color{codebrown},
    stringstyle=\color{codegreen},
    basicstyle=\footnotesize,
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=left,
    numbersep=5pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    tabsize=2
}

\lstset{style=mystyle}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Content starts here %%
\title{TMA4320 --- Guide to Report Layout for Projects}
\title{Project 1, TMA4320: Gravity Surveying}
% \subtitle{Project 1, TMA4320} % Can be used with the scrartcl class
\author{Student name, student number, student username\\
		Student name, student number, student username}
\date{\today}

\begin{document}

	\maketitle

	\section{Introduction}
	This document serves as a template for how to write a project report in TMA4320. You may use this and the corresponding tex-file, but you are also free to, if you prefer, use a different report layout, either by choosing a different template of tweaking this one.

	\section{The report layout and content}
	The report should preferably be written in \LaTeX, but this is not a requirement. What you should focus on is writing a clear and organized report, and having a layout that supports this. More important than the layout is the organization and structure of the report. Most important of all is your ability to answer the questions stated in the project description, that is, the content of the report.
	\subsection{Subsections}
	Use of subsections can make the report more structured.

  \subsection{Mathematics}
  Equations can either be included inline in the text,
  as \(\sum_{i=0}^{N_q-1} f(x_i^q) w_i \),
  or ``displayed'' as
  \[
    \int_a^b K(x,y) u(y) \,\mathrm{d}y = 0.
  \]

	\subsection{References and appendices}
	You will probably not have a lot of references in these reports, but if you want to refer to e.g. \cite{Sauer}, you could do that. You could also include an appendix with code you could not fit in the report, but only include code you are referring to in the report.

	\section{How to include code}
	The following shows how you could include code directly in the document. (There are other ways to do this, of course.)

	The environment used here is the one called ``python'', defined towards the top of the file (in the preamble). It is used in the following way:

	\begin{verbatim}
	\begin{lstlisting}[language=Python, caption=Python code example]
	import SomePythonModule as SPM

	if __name__ == "__main__":
	    Master_Flag = {
	    -1: 'TestSpace',
	    0: 'Some_other_name'
	    }[0]

	    if Master_Flag == 'Some_other_name':
	        SPM.main()
	\end{lstlisting}
	\end{verbatim}

	\begin{lstlisting}[language=Python, caption=Python code example]
		import SomePythonModule as SPM

		if __name__ == "__main__":
		    Master_Flag = {
			    -1: 'TestSpace',
			    0: 'Some_other_name'
		    }[0]

		    if Master_Flag == 'Some_other_name':
		    SPM.main()
	\end{lstlisting}

	The first mandatory argument (called ``caption'') is the caption of the code snippet, and should give a very brief description of what that snippet is about.

	\section{How to include figures}
	There are many options for how to include figures, and perhaps you already have a preferred way of doing this. Included here is a suggestion which includes subfigures, displayed in Figure \ref{fig:figurelabel}.
	\begin{figure}
        \centering
        \subfloat{
                \centering
                \includegraphics[width=0.46\textwidth]{example-image-a}
        }\quad
        \subfloat{
                \centering
                \includegraphics[width=0.46\textwidth]{example-image-b}
        }
        \caption{\textit{Left:} The left figure. \textit{Right:} The right figure.}
        \label{fig:figurelabel}
\end{figure}

\begin{thebibliography}{1}
\bibitem{Sauer}
 T. Sauer, \textit{Numerical Analysis}, Addison-Wesley Publishing Company, 2nd ed., 2011.

\bibitem{Book}
 Author, \textit{Book Title in italics}, Publisher, edition, year.

\bibitem{Baber}
 Author,``Report title in quote'', \textit{Journal name in italics}, volume, number, pp. xx--yy, year.
\end{thebibliography}

\begin{appendices}
\section{Code}
    It is important that you here only include code you refer to in the report. Since you will also send in a .zip-file with your code, you do not need to overfill the appendix, if you choose to even have one.
\end{appendices}

\end{document}
