L TEX Tutorial 2011: Emmanouil Benetos, Iftekharul Mobin, Wenxuan Tang QMUL IEEE Student Branch
L TEX Tutorial 2011: Emmanouil Benetos, Iftekharul Mobin, Wenxuan Tang QMUL IEEE Student Branch
http://ieeesb.elec.qmul.ac.uk/
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 1 / 48
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 2 / 48
Introduction
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 3 / 48
Introduction
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 4 / 48
Introduction
Markup tags
Compiled Language:
1 source file: .tex
2 output file: .pdf (or .dvi and .ps)
Sets the global layout on a finished source file, using
typographical rules.
Asks you to forget one’s old habits taken from WYSIWYG editors:
I don’t try to modify fonts, colors, layout for a single paragraph!
I concentrate on the content, LATEX takes charge of the layout for you!
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 5 / 48
Installation
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 6 / 48
Installation
Installation
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 7 / 48
Installation
Installation
MS Windows:
1 LATEX compiler: MiKTeX http://miktex.org/2.9/setup
2 Preferred LATEX editor: Texmaker
http://www.xm1math.net/texmaker/download.html
3 Advanced packages: installation from MiKTeX option menu
Mac OS X:
1 LATEX compiler: MacTeX http://www.tug.org/mactex/
2 Preferred LATEX editor: Texmaker
3 Advanced packages: most are installed with MacTeX
Linux (Debian, Ubuntu):
1 LATEX compiler: TeXLive-bin
2 Preferred LATEX editor: Texmaker (other good editor: Kile)
3 Advanced packages: in TeXLive and its extensions
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 8 / 48
Installation
Configuration
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 9 / 48
Structure of a document
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 10 / 48
Structure of a document
\documentclass{article}
\begin{document}
Hello World!
\end{document}
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 11 / 48
Structure of a document
Classes
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 12 / 48
Structure of a document
Sections
Notice that there is a very useful menu in Texmaker for the sections:
‘LaTeX -> Sectioning’
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 13 / 48
Structure of a document
Basic Commands
Line break:
I \\ or \newline does a carriage return.
I \\ \\ leaves a blank line without starting a new paragraph
I Leaving a blank line between 2 lines of text begins a new paragraph
(i.e. with indentation)
Page break : \newpage
Font size: It’s also very easy to change the font size:
{\tiny some text} or
\begin{tiny} some text \end{tiny}
Notice that there is a special menu in Texmaker that helps you find
these font size commands: ‘tiny’
Font Style: \textbf{some text}
There is a special menu in Texmaker that helps you find these font
style commands: ‘LaTeX → Font Styles’
Example
Open LaTeXExamples/textExample.tex
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 14 / 48
Equations
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 15 / 48
Equations
Maths Mode
For some operators you will need to include the package
amsmath (simply write \usepackage{amsmath} at the
beginning of your document after \documentclass{})
Inline symbols/equations: use the special character ’$’
The function $e^{x}$ is strictly growing on $\Re$
and $\forall x \in \Re$ we get $e^{x}>0$
Mathematical symbols
Note: you can find them in the menu ‘Math’
Basic symbols:
I subscript: _
example 1: $x_1$ gives x1
example 2: $x_{1,2}$ gives x1,2
example 3: $\sum_{x\in E} f(x)$ gives
X
f (x)
x∈E
I superscript: ^
example 1: $a^{f(x)}$ gives af (x)
example 2: $\int_{0}^{10}f(x)\,dx$ gives
Z 10
f (x) dx
0
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 17 / 48
Equations
Mathematical symbols
Some other basic symbols:
I fraction: \frac{}{}
example: $\frac{x(x-1)}{f(x)e^x}$ gives
x(x − 1)
f (x)ex
I square root: \sqrt{}
example : $\sqrt{\frac{a}{b}}$ gives
r
a
b
I integral: \int
I summation: \sum
I product: \prod
I infinity: \infty
I limit: \lim
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 18 / 48
Equations
Example
$(\frac{a}{b})$ gives
a
( )
b
but $\left(\frac{a}{b}\right)$ gives
a
b
Use the menu ‘(].’ on the left-hand side in Texmaker.
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 19 / 48
Equations
Example
Some examples can be found in LaTeXExamples/equations.tex
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 22 / 48
Tables
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 23 / 48
Tables
Tables
The easiest way is to use the menu ‘Wizard → Quick Tabular’
To write a table:
I use \begin{table} and \end{table}
I use \begin{tabular} and \end{tabular}
I just after \begin{tabular} indicate the number of columns, if
they are separated by vertical lines and the alignment in these
columns.
Example
\begin{tabular}{| c | r | l |} indicates that this tabular will
contain 3 columns all separated by vertical lines symbolized by | and the
content of the first column will be centered (c), the content of the second one
will be aligned on the right (r) and the content of the third one aligned on the
left (l).
I fill in the content of your table row by row
I separate the content of two cells by &
I end a line with \\
I if you want a line separating your rows write \hline between the
content
Benetos, Mobin, Tang of your
(IEEE QMUL StB) lines LaTeX Tutorial March 30, 2011 24 / 48
Tables
Tables
Example
\begin{table}
\begin{tabular}{| l | r | r |}
\hline Town & Temperature & Pluviometry \\
\hline York & 22 & 0mm\\
\hline London & 23 & 10cm\\
\hline Aberdeen & 20 & 5mm\\
\hline
\end{tabular}
\end{table}
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 26 / 48
Lists
Lists
To create lists use itemize or enumerate (in Texmaker in the menu
‘LaTeX → List Environment’)
Example
\begin{enumerate}
\item Open the .tex file
\item Copy and paste the source code LaTeX
\item Compile the file thanks to the compiler
\item Visualize the result
\end{enumerate}
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 27 / 48
Lists
Lists
Example
\begin{itemize}
\item Slackware
\item Debian
\item Redhat
\item Mandrake
\end{itemize}
Slackware
Debian
Redhat
Mandrake
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 28 / 48
Figures
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 29 / 48
Figures
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 30 / 48
Figures
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 32 / 48
References
References
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 33 / 48
Bibliography
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 34 / 48
Bibliography
Bibliography
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 35 / 48
Bibliography
Bibliography
Example
Open the files LaTeXExamples/bibliographyExample.tex and
bibliographyExample.bib
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 36 / 48
Tables of references
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 37 / 48
Tables of references
Tables of references
Example
Open the file LaTeXExamples/referenceTable.tex
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 38 / 48
Using LATEX to...
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 39 / 48
Using LATEX to...
Example
IEEEtran is the official LaTeX class for authors of the IEEE
transactions journals and conferences.
It is included in the directory ‘IEEEtran Folder’ given to you.
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 40 / 48
Using LATEX to...
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 42 / 48
Using LATEX to...
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 43 / 48
Using LATEX to...
Example
2 2 2 2
1 0 0 0
0 0 0 1
Perfect phylogeny
M: 0 0 1 0 Perfect phylogeny
0 2 2 0 χPP (M) = 2.
1 1 0 0
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 44 / 48
Using LATEX to...
Syntax versus
Beobachtungen zu einem ägyptischen Text.
Using LaTeX to give a presentation Semantik
Till Tantau
LOGIK
Outline
1 Introduction
2 Installation
3 Structure of a document
4 Equations
5 Tables
6 Lists
7 Figures
8 References
9 Bibliography
10 Tables of references
11 Using LATEX to...
12 To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 46 / 48
To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 47 / 48
To continue with LATEX
Benetos, Mobin, Tang (IEEE QMUL StB) LaTeX Tutorial March 30, 2011 48 / 48