```
\documentclass[11pt]{article}
% This is a comment to let you leave notes for yourself...
\usepackage{graphicx} % package to include pdf graphics
\usepackage{fancyhdr} % gives headers see below
\usepackage{geometry} % package to give easy control of paper and margin size
\geometry{a4paper}
\usepackage{amsmath} % packages to give lots of maths stuff
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{natbib} % easy reference package
%\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an inden
% Headers...
\pagestyle{fancy}
\lhead{Basic article}
\chead{}
\rhead{Jonathan Tuke}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
% Title page info...
\title{Basic article}
\author{Jonathan Tuke}
\date{\today}
% Start document...
\begin{document}
\maketitle
% Table of contents...
\tableofcontents
% Adding sections...
\section{Mathematics}
\subsection{Maths equations}
% Basic mathematics...
We can put maths, e.g. $\bar{x}$, in a line or separately as so:
$$
\bar{x}=\frac{1}{n}\sum^n_{i=1}x_i.
$$
We can align equations:
\begin{eqnarray*}
\bar{x}&=&\frac 13\left(1+3+5\right)\\
&=&3.
\end{eqnarray*}
If you would like to reference an equation like Eq (\ref{eq:no1}), this can also be done.
\begin{eqnarray}
\int^{\infty}_{-\infty}f(x) dx=1.\label{eq:no1}
\end{eqnarray}
We can also align equations to include comments as so:
\begin{align*}
P(X\leq x \cap Y\leq y) &= P(X\leq x)P(Y\leq y)&\text{by independence}\\
&=\int_{-\infty}^{x}f(x)dx \int_{-\infty}^{y}f(y)dy.
\end{align*}
% Matrices...
\subsection{Matrices}
This is a matrix:
$$
\begin{bmatrix}
1&2&3\\
4&5&6
\end{bmatrix}
$$
and so is this
$$
\begin{pmatrix}
x_{11} & x_{12} & \ldots & x_{1n}\\
x_{21} & x_{22} & \ldots & x_{2n}\\
\vdots & \vdots & \ldots & \vdots\\
x_{n1} & x_{n2} & \ldots & x_{nn}
\end{pmatrix}
$$
% Including and referencing figures and tables...
\section{Images and tables}
\subsection{Images}
The scatter plot is in Figure \ref{fig:no1} % This references the label in the figure below
% Example figure...
\begin{figure}[htbp]
\begin{center}
\includegraphics[width=4in]{example_fig}
\caption{Scatter plot of x and y.}
\label{fig:no1}
\end{center}
\end{figure}
\subsection{Tables}
The five number summary is shown in Table \ref{tab:no1}.
\begin{table}[htp]
\caption{Five number summary.}
\begin{center}
\begin{tabular}{|c|c|c|c|c|} % The c indicates that each column is centered. Other options are r and l.
% The | gives an vertical bar between each column.
\hline
Min&$Q_1$&Median&$Q_3$&Max\\ \hline
1&2&3&4&5\\\hline
\end{tabular}
\end{center}
\label{tab:no1}
\end{table}
% Some examples of formatting text and lists...
\section{Text}
\subsection{Text and lists}
A spectre is haunting Europe -- the {\bf spectre of communism}. % Bold formatting
All the powers of old Europe have entered into a holy alliance to exorcise this spectre: Pope and Tsar, Metternich and Guizot, French Radicals and German {\it police-spies}. %italics
Where is the party in opposition that has not been decried as communistic by its opponents in power? Where is the opposition that has not hurled back the branding reproach of communism, against the more advanced opposition parties, as well as against its reactionary adversaries?
\par % par gives paragraph break can also be achieved by leaving a blank line as above
Two things result from this fact:
\begin{enumerate}
\item Communism is already acknowledged by all European powers to be itself a power.
\item It is high time that Communists should openly, in the face of the whole world, publish their views, their aims, their tendencies, and meet this nursery tale of the spectre of communism with a manifesto of the party itself.
\end{enumerate}
To this end, Communists of various nationalities have assembled in London and sketched the following manifesto, to be published in the English, French, German, Italian, Flemish and Danish languages.
% Including code...
\subsection{Code}
Code can also be inputed with verbatim
\begin{verbatim}
> x<-rnorm(1000)
> y<-rnorm(1000)
> plot(x,y)
> plot(x,y)
\end{verbatim}
% Referencing bibliographies
\section{Referencing}
For an example of self referencing see \cite{tuke2008}.
\bibliographystyle{plainnat}
\bibliography{bibtex_example} % Reference is in bibtex_example.bib which can be edited in a text editor or bibdesk or jabref.
\end{document} % End article
```