LaTeX Tutorial

Please leave a remark at the bottom of each page with your useful suggestion.

LaTeX Tutorial


  • LaTeX is a document preparation system
  • It is suited to producing long, structured documents, and is very good at type-setting equations
  • A LaTeX document is a plain text file with a .tex file extension.
  • A typesetting system designed by Donald Knuth in 1978 for high quality digital typesetting

Document Structure

The \begin{document} and \end{document} commands enclose the text and commands that make up your document. Anything typed before \begin{document} is known as the preamble, and will affect the whole document. Anything typed after \end{document} is ignored.


\usepackage{amsmath}    % need for subequations
\usepackage{graphicx}   % need for figures
\usepackage{verbatim}   % useful for program listings
\usepackage{color}      % use if color is used in text
\usepackage{subfigure}  % use for side-by-side figures
\usepackage{hyperref}   % use for hypertext links, including those to external documents and URLs

\setlength{\parskip}{3pt plus 2pt}

A sentence of text.

Creating a Title

The \maketitle command creates a title. You need to specify the title of the document. If the date is not specified today’s date is used. Author is optional.


\title{My First Document}
\author{My Name}

A sentence of text.

Table of Contents

Type \tableofcontents where you want the table of contents to appear in your document — often directly after the title page.

The \newpage command inserts a page break so that we can see the effect of the page numbering commands.


\title{My First Document}
\author{My Name}





You should divide your document into chapters (if needed), sections and sub- sections. The following sectioning commands are available for the article class:

  • \section{...}
  • \subsection{...}
  • \subsubsection{...}
  • \paragraph{...}
  • \subparagraph{...}

\title{My First Document}
\author{My Name}

This is the introduction.


\subsection{Stage 1}
The first part of the methods.

\subsection{Stage 2}
The second part of the methods.

Here are my results.



You can label any of the sectioning commands so they can be referred to in other parts of the document. Label the section with \label{labelname}. Then type \ref{labelname} or \pageref{labelname}, when you want to refer to the section or page number of the label.

Type \label{sec1} on a new line directly below \subsection{Stage 1}.

Type Referring to section \ref{sec1} on page \pageref{sec1} in the Results section.


\title{My First Document}
\author{My Name}


Here is the introduction section text, see \ref{sec1} on page \pageref{sec1}.


Font Effects

There are LaTeX commands for a variety of font effects:

\textit{words in italics} 
\textsl{words slanted}
\textsc{words in smallcaps}
\textbf{words in bold}
\texttt{words in teletype}
\textsf{sans serif words}
\textrm{roman words}
\underline{underlined words}
  • words in italics
  • words slanted
  • words in bold
  • words in teletype
  • sans serif words
  • roman words
  • underlined words

Font Sizes

There are LaTeX commands for a range of font sizes:

{\tiny tiny words} 
{\scriptsize scriptsize words}
{\footnotesize footnotesize words}
{\small small words} 
{\normalsize normalsize words}
{\large large words}
{\Large Large words}
{\LARGE LARGE words}
{\huge huge words}
  • tiny words
  • scriptsize words
  • footnotesize words
  • small words
  • normalsize words
  • large words
  • Large words
  • LARGE words
  • huge words

Lists Item

LaTeX supports two types of lists: enumerate produces numbered lists, while itemize is for bulleted lists. Each list item is defined by \item. Lists can be nested to produce sub-lists.

	\item First thing
	\item Second thing
	\item A sub-thing
	\item Another sub-thing
	\item Third thing

	\item[-] First thing
	\item[+] Second thing
	\item[Fish] A sub-thing
	\item[Plants] Another sub-thing
	\item[Q] Third thing
  1. First thing
  2. Second thing
    • A sub-thing
    • Another sub-thing
  3. Third thing

It is easy to change the bullet symbol using square brackets after the \item, for example, \item[-] will give a dash as the bullet. You can even use words as bullets, for example, \item[One].


The tabular command is used to typeset tables.

  • The table data follows the \begin{tabular} command:
  • & is placed between columns.
  • \\ is placed at the end of a row (to start a new one).
  • \hline inserts a horizontal line.
    • l for a column of left-aligned text (letter el, not number one).
    • r for a column of right-aligned text.
    • c for a column of centre-aligned text.
    • | for a vertical line.
  • \cline{1-2} inserts a partial horizontal line between column 1 and column 2.
  • The command \end{tabular} finishes the table.
Apples & Green \\
Strawberries & Red \\
Oranges & Orange \\

Apples & Green \\
Strawberries & Red \\
Oranges & Orange \\

8 & here’s \\
86 & stuff \\
\hline \hline
2008 & now \\


This chapter describes how to insert an image in to your LaTeX document, which requires the graphicx package. Images should be PDF, PNG, JPEG or GIF files. The following code will insert an image called myimage:

\caption{Here is my image}

\caption{My test image}


Equations are written in ‘math mode’.

You can enter math mode with an opening and closing dollar sign $. This can be used to write mathematical symbols within a sentence

$ 1 + 2 = 3 $

1 + 2 = 3.

If you want a “displayed” equation on its own line use $$...$$.

$$ 1 + 2 = 3 $$

1 + 2 = 3

For a numbered displayed equation, use \begin{equation}...\end{equation}.

\begin{equation} 1 + 2 = 3 \end{equation}

1 + 2 = 3    (6.1)

The number 6 refers to the chapter number, this will only appear if you are using a document class with chapters, such as report.

Use \begin{eqnarray}...\end{eqnarray} to write equation arrays for a series of equations/inequalities.

23a & = & b + c \\
& = & y - z

For unnumbered equations add the star symbol * after the equation or eqnarray command (i.e. use {equation*} or {eqnarray*}).

Mathematical Symbols

Basic mathematical symbols (+ - = ! / ( ) [ ] :) can be accessed directly from the keyboard

Powers & Indices

  • 'Powers' are inserted using the hat ^ symbol, e.g., $n^2$.
  • 'Indices' are inserted using an underscore _ symbol, e.g. $2_a$.
  • If the power or index includes more than one character, group them using curly brackets {...}, e.g. $b_{a-2}$


Fractions are inserted using \frac{numerator}{denominator}.


Fractions can be nested —


Square root symbols are inserted using \sqrt{...} e.g. $$\sqrt{y^2}$$ and $$\sqrt[x]{y^2}$$.

Sums and Integrals

The command \sum inserts a sum symbol; \int inserts an integral. The upper limit is specified by a hat ˆ and the lower by an underscore _.

$$\sum_{x=1}^5 y^z$$

$$\int_a^b f(x)$$

Greek letters

Greek letters can be typed in math mode using the name of the letter preceded by a backslash \.

$\alpha$ 		= α
$\beta$ 		= β
$\delta, \Delta$ 	= δ, Δ
$\theta, \Theta$ 	= θ, Θ
$\mu$ 			= µ
$\pi, \Pi$ 		= π, Π
$\sigma, \Sigma$ 	= σ, Σ
$\phi, \Phi$ 		= φ, Φ
$\psi, \Psi$ 		= ψ, Ψ
$\omega, \Omega$ 	= ω

Inserting References

To create a bibliography entry the command \bibitem is used. A parameter inside braces is set to label this entry and can later be used as identifier for this reference.





\section{First Section}
This document ...



LaTeX includes features that allow you to easily cite references and create bibliographies in your document. BibTeX file contains all the references you want to cite in your document. It has the file extension .bib.

 Author = {Bird, R. B. and Smith, E. A. and Bird, D. W.},
 Title = {The hunting handicap: costly signaling in human foraging strategies},
 Journal = {Behavioral Ecology and Sociobiology},
 Volume = {50},
 Pages = {9-19},
 Year = {2001} }

Each reference starts with the reference type (@article in the example above). Other reference types include @book, @incollection for a chapter in an edited book and @inproceedings for papers.

Type the following where you want the bibliography to appear in your document (usually at the end): Where references is the name of your .bib file.


Type \cite{citationkey} where you want to cite a reference in your .tex document. If you don’t want an in text citation, but still want the reference to appear in the bibliography, use \nocite{citationkey}.

To include a page number in your in-text citation put it in square brackets before the citation key: \cite[p. 215]{citationkey}.

To cite multiple references include all the citation keys within the curly brackets separated by commas: \cite{citation01,citation02,citation03}.

Use the natbib package if you want to include author-date citations. Natbib uses the command \citep{...} for a citation in brackets (e.g. [Koppe, 2010]) and \citet{...} for a citation where only the year is in brackets (e.g. Koppe [2010]).


Helmut Kopka and Patrick W. Daly, \textit{A Guide to
\LaTeX: Document Preparation for Beginners and Advanced Users},
fourth edition, Addison-Wesley (2004).


Write Your Comments or Suggestion...