\documentclass[a4paper]{article}
% Import packages.tex
\input{packages}
\begin{document}
\title{\LaTeX\ Science Template}
\author{Author 1 \and Author 2}
\maketitle
\pagebreak
\tableofcontents
\pagebreak
\section{Useful snippets}
\subsection{Math}
Let's write some random math.
% Some math on a new line
\[ \bigcup_{i=0}^{n} x_i \indent n \in \mathbb{N} \]
And an aligned equation.
% Aligned equation
\begin{equation}
\begin{split}
P &= NP\\
&\vee \\
P&\neq NP
\end{split}
\end{equation}
\subsection{Algorithm}
\begin{algorithm}[H]
$R:=\emptyset$\;
$L(a):=0$\;
$\forall v\neq a:L(v):=\infty$\;
\While{$z\notin R$}{
choose $v\in V\backslash R$ with lowest $L(v)$\;
$R:=R\cup\{v\}$\;
\ForEach{edge $(v,v')\in E$ with $v'\in V\backslash R$}{
$L(v'):=min\{L(v)+w(v,v'),L(v')\}$
}
}
\caption{Dijkstra's shortest path algorithm}
\end{algorithm}
\subsection{Definition \& proof}
\begin{leftbar}
\begin{definition}[Example definition]
A definition, nicely wrapped by a \texttt{leftbar} environment.
\end{definition}
\end{leftbar}
\begin{proof}
Of course, we can't leave the proof out.
\end{proof}
\subsection{Figure}
Let's see what \autoref{fig:plots} looks like. ``Figure 1" in the previous sentence is a clickable reference.
% Using the H modifier from the float package to include the figure HERE.
\begin{figure}[H]
% Center figure
\centering
% Center caption
\captionsetup{justification=centering}
% The actual figure
\includegraphics[scale=0.2]{assets/plots}
% And a nice caption
\caption{Example of including an image in a \LaTeX\ document, centered and positioned exactly where it's included in the code.\label{fig:plots}}
\end{figure}
\end{document}

PDF Preview
Create an account to compile and preview