Learn LaTeX in 30 Minutes
Learn LaTeX in 30 Minutes
Learn LaTeX in 30 Minutes
Ahmad Lotfi∗
School of Science and Technology
Nottingham Trent University,
Nottingham, NG11 8NS, United Kingdom
January 6, 2011
Abstract
This report should help you to understand and learn LATEXin less
that 30 minutes. If you follow the instruction in this paper, you should
be able to install and create a sample LATEXfile with all important
features. Please feel free to use this document and simply steal from
this document! More information available from [1], [2].
1 Introduction
LATEX(pronounced La-Tech) is a document mark-up language and document
preparation system for the TeX typesetting program. LATEXis a flexible
typesetting package. Various fonts and sizes of font are available. For
example typewriter, italic, emphasised, san serif, bold as well as the default
roman. Combinations of some are possible emphasised san serif, for example.
LATEXis an excellent package to deal with equations and graphics.
2 What Do I Need?
To start working with LATEX, you will need LATEXcompiler and a text editor!
2.1 LATEXCompiler
To convert your LATEXsource file, you will need a compiler to make real
documents out of your LATEXsource file. MiKTeX is a free LATEXcompiler for
windows and its installation is extremely simple. LaTeX compiler produces
so called DVI file or PDF which can be then inspected and printed by YAP
viewer or Adobe Reader.
Download the package from: http://miktex.org/2.9/setup
∗
[email protected]
1
2.2 LATEXEditor
You will also need a LATEXEditor to write your text in, because you cannot
just write it in MS Word or OpenOffice Writer and compile it from there.
Just to set the record straight, LATEXis a markup language, which uses com-
mands to make your text look bold, coloured or any other text alignments
you want to put it in. Assuming that you are using Windows, you might
want to TeXnicCenter available from:
http://www.texniccenter.org/resources/downloads
\documentclass[a4,12pt]{article}
\begin{document}
Hello World.
\end{document}
3.2 Sections
Articles are usually structured into sections, and books into chapters and
chapter sections. To create a new section use \section{Section Title}.
2
Subsection or Sub-sub-section can also be used. Sections can be cross ref-
erenced, if you \label them. For example the Introduction is section 1 in
this document.
If you prefer a section without a number, then you should use * after
the section i.e. \section*{Title}.
\documentclass[a4,12pt]{article}
\begin{document}
\section{Introduction}
Hello World.\\
\section{More Text}
More Text here.
\end{document}
4 Equations
The real beauty of LATEXis equations. For inline equations like, µ(x1 , x2 ) =
2x1 +2x2 , simply insert the instructions defining the equation between single
$ signs. If you want a display equation without a number put the instructions
between $$’s like this:
3
Figure 1: Figure Caption.
5 Figures
You will need to include figures. It is best to use .jpg, .eps or .pdf files.
Save images in a folder and include them into your document.
\begin{figure}[h]
\centering
\includegraphics[width=8cm]{images/image1}
\caption{Figure Caption.}
\label{fig:image1}
\end{figure}
4
(a) Rectangle (b) Circle
You can control size of figure and by adding a label, they can be referenced
any any point. Figure 1 is saved in folder images.
Before using \includegraphics you should add graphics package. To add
a package, add the following line after \documentclass.
\documentclass[a4,12pt]{article}
\usepackage{graphicx,epsfig,subfig}
\begin{document}
Hello World.
\end{document}
To add sub-figures use the following format which and the results are shown
in Figure 2.
\begin {figure}
\centering
\subfloat[Rectangle]{\includegraphics [height=3cm]{images/image1}}
\hspace{2cm}
\subfloat[Circle]{\includegraphics [height=3cm]{images/image2}}
\caption{Image caption. a) Rectangle, b) Circle.}
\label {fig:image2}
\end {figure}
6 Tables
Nicely placed tables with captions, numbers and labels like table 1, can be
produced with \begin{table} and \end{table}.
7 Lists
Devotees of the bullet point:
• Should use the \begin{itemize} command to start a bulleted list.
5
• Should use the \item command to add items to the list.
• Little snippets can be included with the \verb command. The first
character after \verb is taken as a marker for the beginning of the
characters to be reproduced verbatim, the second occurance of this
character is taken as the end of the verbatim text. For example
\verb+q1<-1:4+ will yield q1<-1:4.
• Bigger sections of code require the use of \begin{verbatim} and
\end{verbatim} like this:
Orbits in Ω3 Orbits in Ω4
Orbit type multiplicity Orbit type multiplicity
{(i)} 1 {(i, i)} 1
{(i)} 3 {(i, j)} 4
{(i)} 1 {(i, j)} 3
{(i, i)} 6
{(i, l)} 1
Total 5 Total 15
6
gam<-function (formula, family = gaussian(), data = list(),
min.sp = NULL, H = NULL, gamma = 1, ...)
{
gp <- gam.parser(formula)
mf <- match.call(expand.dots = FALSE)
ff1 <- paste(gp$v.names[2:n], collapse = "+")
ff <- paste(ff, "+", ff1)
}
.
}
\bibliographystyle{plain}
%You can aslo use alpha, unstr, abbrv, IEEE, ...
%You can aslo use IEEEE.bst or Springer.bst or any other publisher.
\bibliography{mybib}
%mybib.bib is your bibliography file.
%Use mybib.bib as your
To create a ‘bib’ file, use your RefWorks and export references in BibTex
format. You can format your references using different publishers style. You
need a ‘bst’ file and you have to replace the default plain style with the
publisher bibliography style file.
\usepackage{natbib}
Also, you need to change the bibliography style file to be used, so edit the ap-
propriate line at the bottom of the file so that it reads: \bibliographystyle{plainnat}.
Once done, it is basically a matter of altering the existing \cite commands
to display the type of citation you want.
7
\citet{lotfi09} for Lotfi et al. (2009)
\citep{lotfi09} for (Lotfi et al., 2009)
\citet*{lotfi09} for Lotfi and Langensiepen (2009)
\bibpunct{(}{)}{;}{a}{,}{,}
\usepackage{natbib}
\bibpunct{(}{)}{;}{a}{,}{,}
10 Misc.
A table of contents can be inserted anywhere with the command \tableofcontents.
You can also use \listoffigures or \listoftables.
8
Contents
1 Introduction 1
2 What Do I Need? 1
2.1 LATEXCompiler . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2.2 LATEXEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
4 Equations 3
5 Figures 4
6 Tables 5
7 Lists 5
10 Misc. 8
References
[1] Wikipedia, “Latex — Wikipedia, the free encyclopedia”, 2010, [Online;
accessed 15-Dec-2010].
[2] Wikibooks http://upload.wikimedia.org/wikipedia/commons/2/2d/LaTeX.pdf,
“Latex”, 2010, [Online; accessed 15-Dec-2010].
[3] M. J. Akhlaghinia, A. Lotfi, C. Langensiepen, and N. Sherkat, “A fuzzy
predictor model for the occupancy prediction of an intelligent inhabited
environment”, in 2008 IEEE 16th International Conference on Fuzzy
Systems (FUZZ-IEEE), Piscataway, NJ, USA, 1-6 June 2008 2008, pp.
939–46, IEEE.
[4] M. J. Akhlaghinia, A. Lotfi, C. Langensiepen, and N. Sherkat, “Occu-
pancy monitoring in intelligent environment through integrated wireless
localizing agents”, in 2009 IEEE Symposium on Intelligent Agents, Pis-
cataway, NJ, USA, 30 March-2 April 2009 2009, p. 7, IEEE.