This work is licenced under a Creative Commons Licence.

# LaTeX formatting - basics

I am virtually clueless in the world of LaTeX. Having said that, I'm liking it a lot due to the power with which you can create fantastic looking documents; even if the learning curve is rather steep.

Below is an approximate layout (with the actual text removed) of my final year project at university:

%Preamble.  Ths stuff is important!
\documentclass[a4paper]{report}
\usepackage{setspace}
\usepackage{a4wide}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage[sort&compress,super,comma]{natbib} %required for bibliography
\usepackage{subfig} %required for figure layouts
\usepackage{textcomp} %required for celcius sign which is typed using \textcelsius
\usepackage{lineno}
\newcommand{\ul}{$\mu$l} %Example, type "\ul\ to get a micro-litre in text,
%rather than typing it out every time.
\renewcommand{\familydefault}{\sfdefault}
%End preamble.

\begin{document}
\begin{large}
%%%%%%%%%%%%%%%
%% F L U F F %%
%%%%%%%%%%%%%%%

%Double spacing is looked down upon by many, but a lot of academic documents want the space
%for markers to write comments, so we have to use it!
\setstretch{2.0} 	%default spacing to be double spaced. To change from this, use:
%begin{doublespace} end{doublespace}
%begin{singlespace} end{singlespace}
\begin{singlespace}
%StartTitlepage
\title{Title here}
\author{Name here}
\date{\today}
\maketitle
%EndTitlepage

\pagenumbering{roman} %use roman numeral numbering for intro stuff
\tableofcontents
\listoffigures
%\listoftables

\chapter*{Acknowledgements}
\end{itemize}

\chapter*{Abbreviations}
\label{ch:abbreviations}
% NOTE: lines longer than a page width do not work nicely here by
%default (no wrapping apparently)
% How-to for table: The &'' separates columns, and \\" indicates the end of a line.
%http://www.andy-roberts.net/misc/latex/latextutorial4.html
\begin{tabular}{ll}
Cell A1 &  Cell B1 \\
Cell A2 & Cell B2
\end{tabular}
%End of Abbreviations
\end{singlespace}

%%%%%%%%%%%%%
%% M E A T %%
%%%%%%%%%%%%%

\begin{abstract}
An abstract would go here
\end{abstract}
\pagenumbering{arabic} %get proper numbers for pages from here on in

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%  I N T R O D U C T I O N %%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\linenumbers  %Useful for when you're editing(but not in the final document), as this puts linenumbers in

\chapter{Introduction}
\label{ch:intro}
\section{Introductory introduction}
\subsection{Citations}
Using a bibtex file (I like using Kbib for this as it can search pubmed to import
references) you can reference items in the file by it's "key" by typing \cite{key} and it will reference in the text correctly, and construct the bibliography as indicated at the end.

\subsection{Referring to figures}
I wish for you to see fig.\ref{fig: short-label}

%%% Single figure
\begin{figure}
\centering
\includegraphics[scale=0.4]{Images/image.jpg}
\caption{Caption goes here, including references or citations\cite{Wikipedia2008})}
\label{fig: short-label} %short label here so that we can refer to it in the text by it's figure number
\end{figure}

%%two images/figures next to each other
\begin{figure}
\centering
\subfloat[Label1]{\includegraphics[scale=0.5]{Images/name-of-image.jpg}}
\subfloat[Label2]{\includegraphics[scale=0.5]{Images/name-of-image2.jpg}}
\caption{Captoin information}
\label{fig: label}
\end{figure}

%% Numbered list
\begin{enumerate}
\item Item 1
\item Item 2
\item Item 3
\end{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% M E T H O D S %%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Methods \& Materials}
\label{ch:methods}

\section{1}
This is top
\subsection{12}
This is a section of above
\subsubsection{123}
This is a section of the one above it
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% R E S U L T S %%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Results}
\label{ch:results}

\subsection{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% D I S C U S S I O N %%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Discussion}
\label{ch:discussion}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% B I B L I O G R A P H Y %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\bibpreamble}{References in the style of Nature}
\bibliographystyle{unsrtnat}
\bibliography{Bibliography-Dissertation}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% A P P E N D I C I E S %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Appendix 1}
\label{ch:appendix}
Use if needed.

\end{large}
\end{document}