We use cookies to ensure that we give you the best experience on our website. You can change your cookie settings at any time. Otherwise, we'll assume you're OK to continue.

Department of Mathematical Sciences

LaTeX sample

The file below is a simple example explaining how many of the basic LaTeX things work. If you want to play with it on your own computer, you can download it as a LaTeX source file latex_sample.tex (also download the lion.png image). If all is installed correctly, you should be able to produce the latex_sample.pdf file from it.


% To set margin width, text height, space for footnotes and all sorts
% of other settings related to the geometry of the pages in your
% report, use the 'geometry' package.


% For inclusion of figures, use the 'graphicx' package. This allows
% you to later include a figure using '\includegraphics{filename}' and
% it will also for simple sizing of the figure in your text.


% You may want to add hyperlinks to your document, which can be tricky
% to typeset because they often have weird symbols in them which LaTeX
% interprets in its own way. Use 'hyperref' for this. It also has many
% options to add e.g. a list of thumbnails to your pdf file.


% Finally, for various useful tools for mathematics typesetting, use
% the 'amsmath' package with a few assorted companion packages which
% provide extra symbols.


% For figure/table caption settings.



% The 'article' document class provides a simple way to make a title
% page:

\title{A report}

% A table of contents can be generated automatically as well:


% Now comes the true content.

\chapter{A chapter on something}
\section{A section}
\subsection{A sub-section}

Some text here. You can \emph{emphasise it} or {\bfseries make it
  bold-face} or {\large larger} or \emph{\bfseries\large combine those
  settings}. A random equation:
E=mc^2 \,.
If you want to align equations, use either {\tt align} or {\tt
  aligned}. See the examples below. The difference is the way in which
the equation numbers are added. Here is the option with the two
equations receiving only one number:
E &= mc^2  \\
i\hbar \frac{\partial}{\partial t} |\psi, t\rangle
  &= \hat{H} |\psi,t\rangle\,,
and here is the one where every equation gets its own number:
E &= mc^2  \\
i\hbar \frac{\partial}{\partial t} |\psi, t\rangle
  &= \hat{H} |\psi,t\rangle\,,

\chapter{Another chapter}
\section{Again a section}

You can cite any paper or book which is in your bibliography list
(see below). Papers everyone should read are~\cite{Einstein:1935rr}
and \cite{Feynman:1948ur}.

You can refer to equations, such as~\eqref{e:Einstein3}, or to
chapters, such as~\ref{c:intro}, or figures, such as figure~\ref{f:lion}.

\caption{This is the lion which is the \TeX{} mascotte.\label{f:lion}}

And here is a link to a web page: \url{}.

% Finally the bibliography. You can cut and paste these entries
% straight from e.g. the inSpire database at 
% (select one of the 'LaTeX' output options) or many other maths
% databases. % % A better but more complicated way to do references is to use BiBTeX. \begin{thebibliography}{50} \bibitem{Einstein:1935rr} A.~Einstein, B.~Podolsky and N.~Rosen, ``Can quantum mechanical description of physical reality be considered complete?,'' Phys.\ Rev.\ {\bf 47} (1935) 777. %%CITATION = PHRVA,47,777;%% %\cite{Feynman:1948ur} \bibitem{Feynman:1948ur} R.~P.~Feynman, ``Space-time approach to nonrelativistic quantum mechanics,'' Rev.\ Mod.\ Phys.\ {\bf 20} (1948) 367. %%CITATION = RMPHA,20,367;%% \end{thebibliography} \end{document}