SlideShare a Scribd company logo
1 of 43
Download to read offline
L
A
TEX tutorial
Jérôme Gilles
Department of Mathematics, UCLA
jegilles@math.ucla.edu
L
ATEX tutorial
Generalities - What is L
A
TEX?
L
ATEX tutorial
L
A
TEX is a “high level” programming language over TEX
⇒ source file (.tex) + “compiler” = document
Generalities - What is L
A
TEX?
L
ATEX tutorial
L
A
TEX is a “high level” programming language over TEX
⇒ source file (.tex) + “compiler” = document
L
ATEX
TEX
DVI
PDF
Postscript
tex
latex
pdflatex
pdftex
pdf2ps
ps2pdf dvi2ps
dvipdfm
Generalities - Tools
L
ATEX tutorial
Unix/Linux
commands: latex, dvi2ps, ps2pdf, bibtex, pdflatex
IDE: Kile
http://kile.sourceforge.net/
Windows
MikTEX+ TEXnicCenter + Ghostview (freeware)
http://www.miktex.org
http://www.texniccenter.org/
http://www.cs.wisc.edu/~ghost/
Mac
MacTEX+ TEXshop + TEXnicscope
http://www.tug.org/mactex/
http://www.uoregon.edu/~koch/texshop/
http://www.software112.com/products/texniscope.html
IPE: http://lamut.informatik.uni-wuerzburg.de/mediawiki/ipe7/index.
php/Main_Page
General structure of a L
A
TEXfile
L
ATEX tutorial
% is a comment
documentclass[11pt,letterpaper]{article}
usepackage{amsmath}
usepackage{amssymb}
usepackage{epsfig}
% define used "variables"
title{My revolutionary algorithm}
author{J’er^ome Gilles}
date{Summer 2012}
% content of the paper
begin{document}
maketitle
Here is the content of my paper
end{document}
My revolutionary algorithm
Jérôme Gilles
Summer 2012
Here is the content of my paper
1
Document Class
L
ATEX tutorial
documentclass[options]{type of document}
Document type
article
letter
report
book
specific (IEEE, SPIE, SIAM,
...)
Options
font size (10pt,11pt,12pt)
paper size (letter,a4paper)
twocolumn
twoside
Packages
L
ATEX tutorial
usepackage[options]{package name}
Common packages:
global:
babel,url,array,fancyheadings,fancybox,fancyhdr,. . .
mathematics:
amsmath,amsfonts,amssymb,theorem,vector,. . .
graphics:
graphicx,epsfig,psboxit,pstricks,rotating,. . .
Merging L
A
TEX files
L
ATEX tutorial
ex2.tex
documentclass[11pt,letterpaper]{report}
usepackage{amsmath}
usepackage{amssymb}
usepackage{epsfig}
% define used "variables"
title{My revolutionary algorithm}
author{J’er^ome Gilles}
date{Summer 2012}
% content of the paper
begin{document}
maketitle
include{chapter1}
include{chapter2}
end{document}
chapter1.tex
chapter{Introduction}
Here is the text corresponding to
my introduction.
chapter2.tex
chapter{Our new approach}
Here I describe my new amazing
algorithm!
See ex2.pdf
Basics
L
ATEX tutorial
Reserved symbols
% Comments  Command
{. . .} Processing block ~ Nonbreaking space
$ Math mode & Alignment tag in arrays
# Macro parameter ^ and _ upperscript and subscript
Basics
L
ATEX tutorial
Reserved symbols
% Comments  Command
{. . .} Processing block ~ Nonbreaking space
$ Math mode & Alignment tag in arrays
# Macro parameter ^ and _ upperscript and subscript
% %  textbackslash
{. . .} {. . .} ~ textasciitilde
$ $ & &
# # ^ and _ textasciicircum and _
Basics: spaces and carriage return
L
ATEX tutorial
documentclass[11pt,letterpaper]{article}
% define used "variables"
title{My revolutionary algorithm}
author{J’er^ome Gilles}
date{Summer 2012}
% content of the paper
begin{document}
maketitle
This
is a test
on spaces
This is an example of carriage return
This is the beginning of a new paragraph.
end{document}
Basics: document structure
L
ATEX tutorial
Command Comment
part{} available only for report or book
chapter{} available only for report or book
section{}
subsection{}
subsubsection{}
paragraph{}
subparagraph{}
appendix indicate the beginning of appendices
Nb: if you want to remove the numbering ⇒ put a star between the
command and the brackets: chapter*{}
Basics: font size
L
ATEX tutorial
tiny this text is tiny
scriptsize this text is scriptsize
footnotesize this text is footnotesize
small this text is small
normalsize this text is normalsize
large this text is large
Large this text is Large
LARGE this text is LARGE
huge this text is huge
Huge this text is Huge
Can be use as large{text} or in an environment:
begin{large}
text
end{large}
Basics: font type
L
ATEX tutorial
textnormal {normalfont . . . } Normal
textbf {bfseries . . . } Bold
textit {itshape . . . } Italic
textrm {rmfamily . . . } Roman font
textsf {sffamily . . . } Sans Serif font
texttt {ttfamily . . . } Typewriter font
emph {em . . . } Emphasize
textup {upshape . . . } Upright
textsl {slshape . . . } Slanted
textsc {scshape . . . } SMALL CAPITAL
Basics: environments
L
ATEX tutorial
Some part of the code is specific or must have a temporary property: environment:
begin{} ... end{}
begin{center}
This text is
begin{LARGE}
centered
end{LARGE}
end{center}
begin{flushleft}
This text is
textit{aligned on left}
end{flushleft}
begin{flushright}
This text is
textsc{aligned on right}
end{flushright}
This text is
centered
This text is
aligned on left
This text is
ALIGNED ON RIGHT
Listing environments
L
ATEX tutorial
itemize: unnumbered listing
enumerate: numbered listing
description: description listing
begin{itemize}
item[−] first element
item[∗] a star
item a nice bullet
end{itemize}
begin{enumerate}
item first property
item second property
end{enumerate}
begin{description}
item[Definition 1:]{the first definition}
item[Definition 2:]{the second definition}
end{description}
Crossreferences
L
ATEX tutorial
Sometimes you want to refer to another section, chapter, equation,
figure . . . ⇒ label{} and ref{} commands
documentclass[11pt,letterpaper]{article}
% define used "variables"
title{My revolutionary algorithm}
author{J’er^ome Gilles}
date{Summer 2012}
% content of the paper
begin{document}
maketitle
section{Introduction}label{sec:intro}
This is the introduction
section{Principle}
As mentioned in section~ref{sec:intro}, it
was the introduction.
end{document}
Table and Figure environments
L
ATEX tutorial
begin{table}[!ht]
centering
% definition of the table
caption{Table legend}
label{tab:myTab}
end{table}
begin{figure}[!ht]
centering
% insert your figure
caption{Figure legend}
label{fig:myFig}
end{figure}
Option Meaning
h “here”: do its best to put the environment closest as possible from the text it is declared
H “HERE”: put the environment exactly here
t “top”: put the environment on top of the page
b “bottom”: put the environment on bottom of the page
p “page of float”: put the environment on an extra page without any text
Including images
L
ATEX tutorial
Needs the package graphicx
Two cases:
use of latex command: accepts only postscript images (.eps)
use of pdflatex command: accepts PNG,JPG and PDF files
The command is:
includegraphics[option]{image_filename}
Options are:
[scale=0.3]: scale the image to 30% of its original size
[width=4cm]: fix the width of the image to 4cm
[height=50mm]: fix the height of the image to 50mm
[angle=45]: rotate the image by an angle of 45 degres
Useful variables:
textwidth,textheight,columnwidth
Including images
L
ATEX tutorial
ex6.tex
documentclass[11pt,letterpaper]{article}
usepackage{graphicx}
title{My revolutionary algorithm}
author{J’er^ome Gilles}
date{Summer 2012}
% content of the paper
begin{document}
maketitle
This an example of how we can include figures! (see
Fig.~ref{fig1} and ref{fig2})
begin{figure}[!t]
centeringincludegraphics[scale=0.3]{lena}
caption{This the first figure}
label{fig1}
end{figure}
begin{figure}[!h]
centeringincludegraphics[width=textwidth]{latex}
caption{This the second figure}
label{fig2}
end{figure}
end{document}
Figure 1: This the first figure
My revolutionary algorithm
Jérôme Gilles
Summer 2012
This an example of how we can include figures! (see Fig. 1 and 2)
Figure 2: This the second figure
1
Including tables
L
ATEX tutorial
Needs the package tabular (array in math mode)
A table is defined from the commands:
begin{tabular}[pos]{columns definition} hline
xxx & xxx & ... & 
yyy & yyy & ... &  hline
end{tabular}
pos ⇔ see table environment
columns can be defined by:
l: element are left justified
r: element are right justified
c: element are centered
|: put a vertical bar
p{w}: a column of width w
hline draw an horizontal line
Each column elements on a
same row are separated by the &
symbol
Including tables
L
ATEX tutorial
ex6.tex
documentclass[11pt,letterpaper]{article}
usepackage{array}
title{My revolutionary algorithm}
author{J’er^ome Gilles}
date{Summer 2012}
% content of the paper
begin{document}
maketitle
begin{table}[!h]
centering
begin{tabular}{|l|c|p{5cm}|} hline
A & B & end of first row  hline
CGHIJ & & D 
E & FKL & end of table  hline
end{tabular}
end{table}
end{document}
My revolutionary algorithm
Jérôme Gilles
Summer 2012
A B end of first row
CGHIJ D
E FKL end of table
Other usefull commands:
multicolumn,multirow,backslashbox
Mathematics in L
A
TEX
L
ATEX tutorial
Needs (at least) packages amsmath,amsfonts,amssymb
Two cases: equation embedded in ($...$) the text or equation on
separate line (begin{equation} ... end{equation}).
documentclass[11pt,letterpaper]{article}
usepackage{amsmath,amsfonts,amssymb}
begin{document}
The Cartesian equation of a straight line is of the form $ax+by+c=0$ where $a,b,c$ are
constants.
end{document}
Mathematics in L
A
TEX
L
ATEX tutorial
Needs (at least) packages amsmath,amsfonts,amssymb
Two cases: equation embedded in the text ($...$) or equation on
separate line (begin{equation} ... end{equation}).
documentclass[11pt,letterpaper]{article}
usepackage{amsmath,amsfonts,amssymb}
begin{document}
The Cartesian equation of a straight line is
of the form
begin{equation}
ax+by+c=0
end{equation}
where $a,b,c$ are constants.
end{document}
Mathematics in L
A
TEX
L
ATEX tutorial
Special fonts
mathbb{...} blackboard alphabet: A, B, N, R, Z
mathcal{...} calligraphied alphabet: A, B, N, R, Z
mathbf{...} bold alphabet: A, B, N, R, Z
mathit{...} italic alphabet: A, B, N, R, Z
Special symbols
hat{a} â acute{a} á bar{a} ā dot{a} ȧ breve{a} ă
check{a} ǎ grave{a} à vec{a} ~
a ddot{a} ä tilde{a} ã
overleftarrow{abc}
←
−
−
abc overrightarrow{abc}
−
−
→
abc
overline{abc} abc underline{abc} abc
widetilde{abc} g
abc widehat{abc} d
abc
xrightarrow{text{abc}}
abc
−
−
→ xleftarrow{text{abc}}
abc
←
−
−
overbrace{abc}
z}|{
abc underbrace{abc} abc
|{z}
Mathematics in L
A
TEX
L
ATEX tutorial
Greek letters
alpha α beta β gamma γ delta δ
theta θ vartheta ϑ iota ι kappa κ
lambda λ mu µ nu ν xi ξ
pi π varpi $ rho ρ varrho %
sigma σ varsigma ς tau τ upsilon υ
phi φ varphi ϕ chi χ psi ψ
omega ω Gamma Γ Delta ∆ Theta Θ
Lambda Λ Xi Ξ Pi Π Sigma Σ
Upsilon Υ Phi Φ Psi Ψ Omega Ω
Variable sized symbols
sum
P
prod
Q
int
R
oint
H
bigcap
T
bigcup
S
Mathematics in L
A
TEX
L
ATEX tutorial
Standard functions
cos, sin, log, ln, arg, inf, sup, . . .
Ex: cos(alpha+beta)=cosalphacosbeta - sinalpha sinbeta
gives cos(α + β) = cos α cos β − sin α sin β
Superscript and subscript
x_i xi x^i xi
x_{i-1}^{j-1} xj−1
i−1 x_{u_n} xun
Fraction
frac{num}{den}, Ex: frac{3x+1}{1-x^2} gives 3x+1
1−x2
Roots
sqrt[n]{arg}, Ex: sqrt[q]{1-x^2} gives
q
√
1 − x2
sqrt{x+3} gives
√
x + 3
Mathematics in L
A
TEX: sums, products and integrals
L
ATEX tutorial
documentclass[11pt,letterpaper]{article}
usepackage{amsmath,amsfonts,amssymb,wasysym}
begin{document}
begin{equation}
sum_{k=1}^n k=frac{n(n+1)}{2}
end{equation}
begin{equation}
prod_{k=1}^m k=m!
end{equation}
begin{equation}
int_0^{+infty} x^n e^{−x}dx=n!
end{equation}
begin{equation}
oiint_{partial Omega}
(mathbf{F}bulletmathbf{n})dS=
iiint_{Omega}(nablabulletmathbf{F})dV
end{equation}
end{document}
Mathematics in L
A
TEX
L
ATEX tutorial
Derivatives
frac{df}{dx} df
dx frac{d^nf}{dx^n} dnf
dxn
frac{partial f}{partial x} ∂f
∂x frac{partial^nf}{partial x^n} ∂nf
∂xn
Absolute values and norms
|x| gives |x| |x| gives kxk
Mathematics in L
A
TEX
L
ATEX tutorial
Matrices
documentclass[11pt,letterpaper]{article}
usepackage{amsmath,amsfonts,amssymb}
begin{document}
begin{equation}
begin{pmatrix}
a_{1,1} & a_{1,2} & dots & a_{1,n} 
a_{2,1} & a_{2,2} & dots & a_{2,n} 
vdots & vdots & ddots & vdots 
a_{m,1} & a_{m,2} & dots & a_{m,n}
end{pmatrix}
end{equation}
begin{equation}
begin{vmatrix}
a_{1,1} & a_{1,2} & dots & a_{1,n} 
a_{2,1} & a_{2,2} & dots & a_{2,n} 
vdots & vdots & ddots & vdots 
a_{m,1} & a_{m,2} & dots & a_{m,n}
end{vmatrix}
end{equation}
end{document}
Mathematics in L
A
TEX
L
ATEX tutorial
Group of equations
documentclass[11pt,letterpaper]{article}
usepackage{amsmath,amsfonts,amssymb}
begin{document}
begin{gather}
frac{d}{dx}(f(x)+g(x))=frac{df}{dx}(x)+frac{dg}{dx}(x)
frac{d}{dx}(f(x)g(x))=f(x)frac{dg}{dx}(x)+g(x)frac{df}{dx}(x)
end{gather}
begin{align}
frac{d}{dx}(f(x)+g(x))&=frac{df}{dx}(x)+frac{dg}{dx}(x)
frac{d}{dx}(f(x)g(x))&=f(x)frac{dg}{dx}(x)+g(x)frac{df}{dx}(x)
end{align}
begin{equation}
chi(x)=
begin{cases}
0 qquad text{if} quad xgeqslant 0
1 qquad text{if} quad x< 0
end{cases}
end{equation}
end{document}
Mathematics in L
A
TEX
L
ATEX tutorial
Theorems
Needs the package theorem. We first specify the different kind of
statements (before the begin{document}) with the command
newtheorem{thm}{Theorem} and then we use the command
begin{thm}. . .end{thm}
documentclass[11pt,letterpaper]{article}
usepackage{amsmath,amsfonts,amssymb}
usepackage{theorem}
newtheorem{thm}{Theorem}
begin{document}
begin{thm}
The sum of the angles of a triangle is $pi$
end{thm}
end{document}
Bibliography
L
ATEX tutorial
Original approach: bibitem
documentclass[11pt,letterpaper]{article}
begin{document}
In cite{les85}, the authors propose to ... while in cite{don89} ...
begin{thebibliography}{99}
bibitem{les85} Leslie Lamport, 1985. emph{LaTeX−−A Document Preparation System−−User’s Guide and
Reference Manual},
Addison−Wesley, Reading.
bibitem{don89} Donald E. Knuth, 1989. emph{Typesetting Concrete Mathematics}, TUGBoat, 10(1):31−36.
end{thebibliography}
end{document}
Bibliography
L
ATEX tutorial
Advanced approach: BIBTEX
References are contained in an external “mybiblio.bib” file which will be called by the
command bibliography{mybiblio}.
We must specify a bibliography style by using bibliographystyle{style} where the most used
styles are
plain: Standard BIBTEX style. Entries sorted alphabetically with numeric labels.
unsrt: Similar to plain, but entries are printed in order of citation, rather than
sorted.
alpha: Similar to plain, but the labels of the entries are formed from the author’s
name and the year of publication.
abbrv: Similar to plain, but entries are more compact, since first names, month,
and journal names are abbreviated.
documentclass[11pt,letterpaper]{article}
begin{document}
In cite{les85}, the authors propose to ...
bibliographystyle{plain}
bibliography{mybiblio}
end{document}
Steps to generate the bibliography
1 Run L
ATEX: list of cite ref in the .aux file,
2 Run BIBTEX: extract the cited ref from the .bib file,
format and save them in the .bbl file,
3 Run L
ATEX again: read the .bbl file,
4 Run L
ATEX a third time to resolve all references.
Bibliography
L
ATEX tutorial
BIBTEX database
Each reference is described in the following way:
@entry_type{key,
field_name = {field text},
...
field_name = {field text}
}
article entry for an article from a journal or magazine
required fields: author, title, journal, year
optional fields: volume, number, pages, month, note.
book entry for a book with a definite publisher
required fields: author or editor, title, publisher, year
optional fields: volume or number, series, address, edition, month, note
conference entry for an article in conference proceedings
required fields: author, title, booktitle, year
optional fields: editor, volume or number, series, pages, address, month, ...
Bibliography
L
ATEX tutorial
.bib file
@ARTICLE{Gilles2010a,
author = {J’er^ome Gilles and Yves Meyer},
title = {Properties of BV−G structures + textures decomposition models. Application
to road detection in satellite images},
journal = {IEEE Transaction in Image Processing},
year = {2010},
volume = {19},
pages = {2793−−2800},
number = {11}
}
@BOOK{Triebel3,
title = {Theory of Function Spaces III},
publisher = {Birkhauser Verlag},
year = {2006},
author = {Hans Triebel},
series = {Monographs in Mathematics}
}
To manage reference databases: JabRef (http://jabref.sourceforge.net/)
Other useful formatting tools
L
ATEX tutorial
Table of Content (ToC)
Just add the command tableofcontents where you want to see
your ToC!
Lists of figures or tables
Just add the command listoffigures or  listoftables
Footnotes
Use footnote{your note}
Page, line break
Use newpage or linebreak
Algorithm - Pseudocode
See packages algorithm, algorithmic,listings
Presentations: the Beamer class
L
ATEX tutorial
documentclass{beamer}
mode<presentation>
usetheme{Warsaw}
title{LaTeX tutorial}
author[]{J’er^ome Gilles}
institute[UCLA]{Department of Mathematics, UCLAjegilles@math.ucla.edu}
date{}
begin{document}
...
end{document}
Presentations: the Beamer class
L
ATEX tutorial
Slides: the frame environment
begin{frame}
titlepage
end{ frame}
begin{frame}{Title}
end{ frame}
Group of elements: the block environment
begin{block}{block title}
Elements of this block
end{block}
Presentations: the Beamer class
L
ATEX tutorial
Positioning: the textblock environment
Need first to define a “virtual” grid (before begin{document})
usepackage[overlay,absolute]{textpos}
TPGrid{20}{20}
textblockorigin{0mm}{0mm}
setlength{parindent}{0pt}
begin{textblock}{width}(x,y)
end{textblock}
Presentations: Overlays
L
ATEX tutorial
The pause command
begin{itemize}
item First item
pause
item Second item
item Third item
pause
item Forth item
end{itemize}
General overlay specifications
We can specify overlay specifications
by associating <spec> to some
commands like:
textbf{Allways bold}
textbf<2−>{Bold from the second slide}
Notations:
<N> ⇔ on slide N only,
<-N> ⇔ from first slide to slide N,
<N-> ⇔ from slide N,
<N-M> ⇔ from slide N to slide M.
begin{itemize}
item<1−> First point
item<2| alert@2> Second
only point
item<3−> Third point
end{itemize}
Presentations: Overlays
L
ATEX tutorial
Incremental specifications
begin{itemize}
item<+−| alert@+> First item
item<+−| alert@+> Second
item
item<+−| alert@+> Third item
item<+−| alert@+> Forth item
end{itemize}
. . . equivalent to
begin{itemize}[<+−| alert@+>]
item First item
item Second item
item Third item
item Forth item
end{itemize}
overlay on a block
only<1−>{
begin{textblock}{15}(2,2)
begin{block}{Top block}
Here is the block I want to see from the first slide
end{block}
end{textblock}}
only<2−>{
begin{textblock}{18}(6,6)
includegraphics[scale=0.3]{lena}
end{textblock}}
Useful links about L
A
TEX
L
ATEX tutorial
L
A
TEX wikibook: http://en.wikibooks.org/wiki/LaTeX
Symbol list: http://mirrors.ctan.org/info/symbols/
comprehensive/symbols-letter.pdf
Beamer manual: http://www.ctan.org/tex-archive/macros/
latex/contrib/beamer/doc/beameruserguide.pdf
L
A
TEX Tutorial: http://www.tug.org.in/tutorials.html

More Related Content

Similar to Latex_Tutorial.pdf

LaTex tutorial with Texstudio
LaTex tutorial with TexstudioLaTex tutorial with Texstudio
LaTex tutorial with TexstudioHossein Babashah
 
latex-workshop Dr: Mohamed A. Alrshah
latex-workshop Dr: Mohamed A. Alrshahlatex-workshop Dr: Mohamed A. Alrshah
latex-workshop Dr: Mohamed A. AlrshahAbdulazim N.Elaati
 
عمل العروض التقديمية باستخدام برنامج مقدمه في استخدام برنامج Latex
عمل العروض التقديمية باستخدام برنامج مقدمه في استخدام برنامج Latexعمل العروض التقديمية باستخدام برنامج مقدمه في استخدام برنامج Latex
عمل العروض التقديمية باستخدام برنامج مقدمه في استخدام برنامج Latexresearchcenterm
 
How to make a presentation with LATEX? Introduction to BeamerPresentation ben...
How to make a presentation with LATEX? Introduction to BeamerPresentation ben...How to make a presentation with LATEX? Introduction to BeamerPresentation ben...
How to make a presentation with LATEX? Introduction to BeamerPresentation ben...researchcenterm
 
LaTeX_tutorial_Syed_Jan09.ppt
LaTeX_tutorial_Syed_Jan09.pptLaTeX_tutorial_Syed_Jan09.ppt
LaTeX_tutorial_Syed_Jan09.pptMichalis33
 
Advanced latex
Advanced latexAdvanced latex
Advanced latexawverret
 

Similar to Latex_Tutorial.pdf (20)

Latex workshop
Latex workshopLatex workshop
Latex workshop
 
LaTex tutorial with Texstudio
LaTex tutorial with TexstudioLaTex tutorial with Texstudio
LaTex tutorial with Texstudio
 
latex-workshop Dr: Mohamed A. Alrshah
latex-workshop Dr: Mohamed A. Alrshahlatex-workshop Dr: Mohamed A. Alrshah
latex-workshop Dr: Mohamed A. Alrshah
 
Latex Tutorial
Latex TutorialLatex Tutorial
Latex Tutorial
 
عمل العروض التقديمية باستخدام برنامج مقدمه في استخدام برنامج Latex
عمل العروض التقديمية باستخدام برنامج مقدمه في استخدام برنامج Latexعمل العروض التقديمية باستخدام برنامج مقدمه في استخدام برنامج Latex
عمل العروض التقديمية باستخدام برنامج مقدمه في استخدام برنامج Latex
 
Learn Latex
Learn LatexLearn Latex
Learn Latex
 
Basic Introduction to LaTeX
Basic Introduction to LaTeXBasic Introduction to LaTeX
Basic Introduction to LaTeX
 
How to make a presentation with LATEX? Introduction to BeamerPresentation ben...
How to make a presentation with LATEX? Introduction to BeamerPresentation ben...How to make a presentation with LATEX? Introduction to BeamerPresentation ben...
How to make a presentation with LATEX? Introduction to BeamerPresentation ben...
 
LaTeX_tutorial_Syed_Jan09.ppt
LaTeX_tutorial_Syed_Jan09.pptLaTeX_tutorial_Syed_Jan09.ppt
LaTeX_tutorial_Syed_Jan09.ppt
 
Introduction to Latex
Introduction to LatexIntroduction to Latex
Introduction to Latex
 
Chap12 scr
Chap12 scrChap12 scr
Chap12 scr
 
LaTeX Survival Guide
LaTeX Survival Guide LaTeX Survival Guide
LaTeX Survival Guide
 
Latex
LatexLatex
Latex
 
Chap03 scr
Chap03 scrChap03 scr
Chap03 scr
 
Latex cheat sheet
Latex cheat sheetLatex cheat sheet
Latex cheat sheet
 
LaTex Workshop
LaTex WorkshopLaTex Workshop
LaTex Workshop
 
Advanced latex
Advanced latexAdvanced latex
Advanced latex
 
Latex g.pradeep reddy
Latex g.pradeep reddyLatex g.pradeep reddy
Latex g.pradeep reddy
 
Technical writing using LaTeX
Technical writing using LaTeXTechnical writing using LaTeX
Technical writing using LaTeX
 
LaTeX-Presentation
LaTeX-PresentationLaTeX-Presentation
LaTeX-Presentation
 

Recently uploaded

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Latex_Tutorial.pdf

  • 1. L A TEX tutorial Jérôme Gilles Department of Mathematics, UCLA jegilles@math.ucla.edu L ATEX tutorial
  • 2. Generalities - What is L A TEX? L ATEX tutorial L A TEX is a “high level” programming language over TEX ⇒ source file (.tex) + “compiler” = document
  • 3. Generalities - What is L A TEX? L ATEX tutorial L A TEX is a “high level” programming language over TEX ⇒ source file (.tex) + “compiler” = document L ATEX TEX DVI PDF Postscript tex latex pdflatex pdftex pdf2ps ps2pdf dvi2ps dvipdfm
  • 4. Generalities - Tools L ATEX tutorial Unix/Linux commands: latex, dvi2ps, ps2pdf, bibtex, pdflatex IDE: Kile http://kile.sourceforge.net/ Windows MikTEX+ TEXnicCenter + Ghostview (freeware) http://www.miktex.org http://www.texniccenter.org/ http://www.cs.wisc.edu/~ghost/ Mac MacTEX+ TEXshop + TEXnicscope http://www.tug.org/mactex/ http://www.uoregon.edu/~koch/texshop/ http://www.software112.com/products/texniscope.html IPE: http://lamut.informatik.uni-wuerzburg.de/mediawiki/ipe7/index. php/Main_Page
  • 5. General structure of a L A TEXfile L ATEX tutorial % is a comment documentclass[11pt,letterpaper]{article} usepackage{amsmath} usepackage{amssymb} usepackage{epsfig} % define used "variables" title{My revolutionary algorithm} author{J’er^ome Gilles} date{Summer 2012} % content of the paper begin{document} maketitle Here is the content of my paper end{document} My revolutionary algorithm Jérôme Gilles Summer 2012 Here is the content of my paper 1
  • 6. Document Class L ATEX tutorial documentclass[options]{type of document} Document type article letter report book specific (IEEE, SPIE, SIAM, ...) Options font size (10pt,11pt,12pt) paper size (letter,a4paper) twocolumn twoside
  • 7. Packages L ATEX tutorial usepackage[options]{package name} Common packages: global: babel,url,array,fancyheadings,fancybox,fancyhdr,. . . mathematics: amsmath,amsfonts,amssymb,theorem,vector,. . . graphics: graphicx,epsfig,psboxit,pstricks,rotating,. . .
  • 8. Merging L A TEX files L ATEX tutorial ex2.tex documentclass[11pt,letterpaper]{report} usepackage{amsmath} usepackage{amssymb} usepackage{epsfig} % define used "variables" title{My revolutionary algorithm} author{J’er^ome Gilles} date{Summer 2012} % content of the paper begin{document} maketitle include{chapter1} include{chapter2} end{document} chapter1.tex chapter{Introduction} Here is the text corresponding to my introduction. chapter2.tex chapter{Our new approach} Here I describe my new amazing algorithm! See ex2.pdf
  • 9. Basics L ATEX tutorial Reserved symbols % Comments Command {. . .} Processing block ~ Nonbreaking space $ Math mode & Alignment tag in arrays # Macro parameter ^ and _ upperscript and subscript
  • 10. Basics L ATEX tutorial Reserved symbols % Comments Command {. . .} Processing block ~ Nonbreaking space $ Math mode & Alignment tag in arrays # Macro parameter ^ and _ upperscript and subscript % % textbackslash {. . .} {. . .} ~ textasciitilde $ $ & & # # ^ and _ textasciicircum and _
  • 11. Basics: spaces and carriage return L ATEX tutorial documentclass[11pt,letterpaper]{article} % define used "variables" title{My revolutionary algorithm} author{J’er^ome Gilles} date{Summer 2012} % content of the paper begin{document} maketitle This is a test on spaces This is an example of carriage return This is the beginning of a new paragraph. end{document}
  • 12. Basics: document structure L ATEX tutorial Command Comment part{} available only for report or book chapter{} available only for report or book section{} subsection{} subsubsection{} paragraph{} subparagraph{} appendix indicate the beginning of appendices Nb: if you want to remove the numbering ⇒ put a star between the command and the brackets: chapter*{}
  • 13. Basics: font size L ATEX tutorial tiny this text is tiny scriptsize this text is scriptsize footnotesize this text is footnotesize small this text is small normalsize this text is normalsize large this text is large Large this text is Large LARGE this text is LARGE huge this text is huge Huge this text is Huge Can be use as large{text} or in an environment: begin{large} text end{large}
  • 14. Basics: font type L ATEX tutorial textnormal {normalfont . . . } Normal textbf {bfseries . . . } Bold textit {itshape . . . } Italic textrm {rmfamily . . . } Roman font textsf {sffamily . . . } Sans Serif font texttt {ttfamily . . . } Typewriter font emph {em . . . } Emphasize textup {upshape . . . } Upright textsl {slshape . . . } Slanted textsc {scshape . . . } SMALL CAPITAL
  • 15. Basics: environments L ATEX tutorial Some part of the code is specific or must have a temporary property: environment: begin{} ... end{} begin{center} This text is begin{LARGE} centered end{LARGE} end{center} begin{flushleft} This text is textit{aligned on left} end{flushleft} begin{flushright} This text is textsc{aligned on right} end{flushright} This text is centered This text is aligned on left This text is ALIGNED ON RIGHT
  • 16. Listing environments L ATEX tutorial itemize: unnumbered listing enumerate: numbered listing description: description listing begin{itemize} item[−] first element item[∗] a star item a nice bullet end{itemize} begin{enumerate} item first property item second property end{enumerate} begin{description} item[Definition 1:]{the first definition} item[Definition 2:]{the second definition} end{description}
  • 17. Crossreferences L ATEX tutorial Sometimes you want to refer to another section, chapter, equation, figure . . . ⇒ label{} and ref{} commands documentclass[11pt,letterpaper]{article} % define used "variables" title{My revolutionary algorithm} author{J’er^ome Gilles} date{Summer 2012} % content of the paper begin{document} maketitle section{Introduction}label{sec:intro} This is the introduction section{Principle} As mentioned in section~ref{sec:intro}, it was the introduction. end{document}
  • 18. Table and Figure environments L ATEX tutorial begin{table}[!ht] centering % definition of the table caption{Table legend} label{tab:myTab} end{table} begin{figure}[!ht] centering % insert your figure caption{Figure legend} label{fig:myFig} end{figure} Option Meaning h “here”: do its best to put the environment closest as possible from the text it is declared H “HERE”: put the environment exactly here t “top”: put the environment on top of the page b “bottom”: put the environment on bottom of the page p “page of float”: put the environment on an extra page without any text
  • 19. Including images L ATEX tutorial Needs the package graphicx Two cases: use of latex command: accepts only postscript images (.eps) use of pdflatex command: accepts PNG,JPG and PDF files The command is: includegraphics[option]{image_filename} Options are: [scale=0.3]: scale the image to 30% of its original size [width=4cm]: fix the width of the image to 4cm [height=50mm]: fix the height of the image to 50mm [angle=45]: rotate the image by an angle of 45 degres Useful variables: textwidth,textheight,columnwidth
  • 20. Including images L ATEX tutorial ex6.tex documentclass[11pt,letterpaper]{article} usepackage{graphicx} title{My revolutionary algorithm} author{J’er^ome Gilles} date{Summer 2012} % content of the paper begin{document} maketitle This an example of how we can include figures! (see Fig.~ref{fig1} and ref{fig2}) begin{figure}[!t] centeringincludegraphics[scale=0.3]{lena} caption{This the first figure} label{fig1} end{figure} begin{figure}[!h] centeringincludegraphics[width=textwidth]{latex} caption{This the second figure} label{fig2} end{figure} end{document} Figure 1: This the first figure My revolutionary algorithm Jérôme Gilles Summer 2012 This an example of how we can include figures! (see Fig. 1 and 2) Figure 2: This the second figure 1
  • 21. Including tables L ATEX tutorial Needs the package tabular (array in math mode) A table is defined from the commands: begin{tabular}[pos]{columns definition} hline xxx & xxx & ... & yyy & yyy & ... & hline end{tabular} pos ⇔ see table environment columns can be defined by: l: element are left justified r: element are right justified c: element are centered |: put a vertical bar p{w}: a column of width w hline draw an horizontal line Each column elements on a same row are separated by the & symbol
  • 22. Including tables L ATEX tutorial ex6.tex documentclass[11pt,letterpaper]{article} usepackage{array} title{My revolutionary algorithm} author{J’er^ome Gilles} date{Summer 2012} % content of the paper begin{document} maketitle begin{table}[!h] centering begin{tabular}{|l|c|p{5cm}|} hline A & B & end of first row hline CGHIJ & & D E & FKL & end of table hline end{tabular} end{table} end{document} My revolutionary algorithm Jérôme Gilles Summer 2012 A B end of first row CGHIJ D E FKL end of table Other usefull commands: multicolumn,multirow,backslashbox
  • 23. Mathematics in L A TEX L ATEX tutorial Needs (at least) packages amsmath,amsfonts,amssymb Two cases: equation embedded in ($...$) the text or equation on separate line (begin{equation} ... end{equation}). documentclass[11pt,letterpaper]{article} usepackage{amsmath,amsfonts,amssymb} begin{document} The Cartesian equation of a straight line is of the form $ax+by+c=0$ where $a,b,c$ are constants. end{document}
  • 24. Mathematics in L A TEX L ATEX tutorial Needs (at least) packages amsmath,amsfonts,amssymb Two cases: equation embedded in the text ($...$) or equation on separate line (begin{equation} ... end{equation}). documentclass[11pt,letterpaper]{article} usepackage{amsmath,amsfonts,amssymb} begin{document} The Cartesian equation of a straight line is of the form begin{equation} ax+by+c=0 end{equation} where $a,b,c$ are constants. end{document}
  • 25. Mathematics in L A TEX L ATEX tutorial Special fonts mathbb{...} blackboard alphabet: A, B, N, R, Z mathcal{...} calligraphied alphabet: A, B, N, R, Z mathbf{...} bold alphabet: A, B, N, R, Z mathit{...} italic alphabet: A, B, N, R, Z Special symbols hat{a} â acute{a} á bar{a} ā dot{a} ȧ breve{a} ă check{a} ǎ grave{a} à vec{a} ~ a ddot{a} ä tilde{a} ã overleftarrow{abc} ← − − abc overrightarrow{abc} − − → abc overline{abc} abc underline{abc} abc widetilde{abc} g abc widehat{abc} d abc xrightarrow{text{abc}} abc − − → xleftarrow{text{abc}} abc ← − − overbrace{abc} z}|{ abc underbrace{abc} abc |{z}
  • 26. Mathematics in L A TEX L ATEX tutorial Greek letters alpha α beta β gamma γ delta δ theta θ vartheta ϑ iota ι kappa κ lambda λ mu µ nu ν xi ξ pi π varpi $ rho ρ varrho % sigma σ varsigma ς tau τ upsilon υ phi φ varphi ϕ chi χ psi ψ omega ω Gamma Γ Delta ∆ Theta Θ Lambda Λ Xi Ξ Pi Π Sigma Σ Upsilon Υ Phi Φ Psi Ψ Omega Ω Variable sized symbols sum P prod Q int R oint H bigcap T bigcup S
  • 27. Mathematics in L A TEX L ATEX tutorial Standard functions cos, sin, log, ln, arg, inf, sup, . . . Ex: cos(alpha+beta)=cosalphacosbeta - sinalpha sinbeta gives cos(α + β) = cos α cos β − sin α sin β Superscript and subscript x_i xi x^i xi x_{i-1}^{j-1} xj−1 i−1 x_{u_n} xun Fraction frac{num}{den}, Ex: frac{3x+1}{1-x^2} gives 3x+1 1−x2 Roots sqrt[n]{arg}, Ex: sqrt[q]{1-x^2} gives q √ 1 − x2 sqrt{x+3} gives √ x + 3
  • 28. Mathematics in L A TEX: sums, products and integrals L ATEX tutorial documentclass[11pt,letterpaper]{article} usepackage{amsmath,amsfonts,amssymb,wasysym} begin{document} begin{equation} sum_{k=1}^n k=frac{n(n+1)}{2} end{equation} begin{equation} prod_{k=1}^m k=m! end{equation} begin{equation} int_0^{+infty} x^n e^{−x}dx=n! end{equation} begin{equation} oiint_{partial Omega} (mathbf{F}bulletmathbf{n})dS= iiint_{Omega}(nablabulletmathbf{F})dV end{equation} end{document}
  • 29. Mathematics in L A TEX L ATEX tutorial Derivatives frac{df}{dx} df dx frac{d^nf}{dx^n} dnf dxn frac{partial f}{partial x} ∂f ∂x frac{partial^nf}{partial x^n} ∂nf ∂xn Absolute values and norms |x| gives |x| |x| gives kxk
  • 30. Mathematics in L A TEX L ATEX tutorial Matrices documentclass[11pt,letterpaper]{article} usepackage{amsmath,amsfonts,amssymb} begin{document} begin{equation} begin{pmatrix} a_{1,1} & a_{1,2} & dots & a_{1,n} a_{2,1} & a_{2,2} & dots & a_{2,n} vdots & vdots & ddots & vdots a_{m,1} & a_{m,2} & dots & a_{m,n} end{pmatrix} end{equation} begin{equation} begin{vmatrix} a_{1,1} & a_{1,2} & dots & a_{1,n} a_{2,1} & a_{2,2} & dots & a_{2,n} vdots & vdots & ddots & vdots a_{m,1} & a_{m,2} & dots & a_{m,n} end{vmatrix} end{equation} end{document}
  • 31. Mathematics in L A TEX L ATEX tutorial Group of equations documentclass[11pt,letterpaper]{article} usepackage{amsmath,amsfonts,amssymb} begin{document} begin{gather} frac{d}{dx}(f(x)+g(x))=frac{df}{dx}(x)+frac{dg}{dx}(x) frac{d}{dx}(f(x)g(x))=f(x)frac{dg}{dx}(x)+g(x)frac{df}{dx}(x) end{gather} begin{align} frac{d}{dx}(f(x)+g(x))&=frac{df}{dx}(x)+frac{dg}{dx}(x) frac{d}{dx}(f(x)g(x))&=f(x)frac{dg}{dx}(x)+g(x)frac{df}{dx}(x) end{align} begin{equation} chi(x)= begin{cases} 0 qquad text{if} quad xgeqslant 0 1 qquad text{if} quad x< 0 end{cases} end{equation} end{document}
  • 32. Mathematics in L A TEX L ATEX tutorial Theorems Needs the package theorem. We first specify the different kind of statements (before the begin{document}) with the command newtheorem{thm}{Theorem} and then we use the command begin{thm}. . .end{thm} documentclass[11pt,letterpaper]{article} usepackage{amsmath,amsfonts,amssymb} usepackage{theorem} newtheorem{thm}{Theorem} begin{document} begin{thm} The sum of the angles of a triangle is $pi$ end{thm} end{document}
  • 33. Bibliography L ATEX tutorial Original approach: bibitem documentclass[11pt,letterpaper]{article} begin{document} In cite{les85}, the authors propose to ... while in cite{don89} ... begin{thebibliography}{99} bibitem{les85} Leslie Lamport, 1985. emph{LaTeX−−A Document Preparation System−−User’s Guide and Reference Manual}, Addison−Wesley, Reading. bibitem{don89} Donald E. Knuth, 1989. emph{Typesetting Concrete Mathematics}, TUGBoat, 10(1):31−36. end{thebibliography} end{document}
  • 34. Bibliography L ATEX tutorial Advanced approach: BIBTEX References are contained in an external “mybiblio.bib” file which will be called by the command bibliography{mybiblio}. We must specify a bibliography style by using bibliographystyle{style} where the most used styles are plain: Standard BIBTEX style. Entries sorted alphabetically with numeric labels. unsrt: Similar to plain, but entries are printed in order of citation, rather than sorted. alpha: Similar to plain, but the labels of the entries are formed from the author’s name and the year of publication. abbrv: Similar to plain, but entries are more compact, since first names, month, and journal names are abbreviated. documentclass[11pt,letterpaper]{article} begin{document} In cite{les85}, the authors propose to ... bibliographystyle{plain} bibliography{mybiblio} end{document} Steps to generate the bibliography 1 Run L ATEX: list of cite ref in the .aux file, 2 Run BIBTEX: extract the cited ref from the .bib file, format and save them in the .bbl file, 3 Run L ATEX again: read the .bbl file, 4 Run L ATEX a third time to resolve all references.
  • 35. Bibliography L ATEX tutorial BIBTEX database Each reference is described in the following way: @entry_type{key, field_name = {field text}, ... field_name = {field text} } article entry for an article from a journal or magazine required fields: author, title, journal, year optional fields: volume, number, pages, month, note. book entry for a book with a definite publisher required fields: author or editor, title, publisher, year optional fields: volume or number, series, address, edition, month, note conference entry for an article in conference proceedings required fields: author, title, booktitle, year optional fields: editor, volume or number, series, pages, address, month, ...
  • 36. Bibliography L ATEX tutorial .bib file @ARTICLE{Gilles2010a, author = {J’er^ome Gilles and Yves Meyer}, title = {Properties of BV−G structures + textures decomposition models. Application to road detection in satellite images}, journal = {IEEE Transaction in Image Processing}, year = {2010}, volume = {19}, pages = {2793−−2800}, number = {11} } @BOOK{Triebel3, title = {Theory of Function Spaces III}, publisher = {Birkhauser Verlag}, year = {2006}, author = {Hans Triebel}, series = {Monographs in Mathematics} } To manage reference databases: JabRef (http://jabref.sourceforge.net/)
  • 37. Other useful formatting tools L ATEX tutorial Table of Content (ToC) Just add the command tableofcontents where you want to see your ToC! Lists of figures or tables Just add the command listoffigures or listoftables Footnotes Use footnote{your note} Page, line break Use newpage or linebreak Algorithm - Pseudocode See packages algorithm, algorithmic,listings
  • 38. Presentations: the Beamer class L ATEX tutorial documentclass{beamer} mode<presentation> usetheme{Warsaw} title{LaTeX tutorial} author[]{J’er^ome Gilles} institute[UCLA]{Department of Mathematics, UCLAjegilles@math.ucla.edu} date{} begin{document} ... end{document}
  • 39. Presentations: the Beamer class L ATEX tutorial Slides: the frame environment begin{frame} titlepage end{ frame} begin{frame}{Title} end{ frame} Group of elements: the block environment begin{block}{block title} Elements of this block end{block}
  • 40. Presentations: the Beamer class L ATEX tutorial Positioning: the textblock environment Need first to define a “virtual” grid (before begin{document}) usepackage[overlay,absolute]{textpos} TPGrid{20}{20} textblockorigin{0mm}{0mm} setlength{parindent}{0pt} begin{textblock}{width}(x,y) end{textblock}
  • 41. Presentations: Overlays L ATEX tutorial The pause command begin{itemize} item First item pause item Second item item Third item pause item Forth item end{itemize} General overlay specifications We can specify overlay specifications by associating <spec> to some commands like: textbf{Allways bold} textbf<2−>{Bold from the second slide} Notations: <N> ⇔ on slide N only, <-N> ⇔ from first slide to slide N, <N-> ⇔ from slide N, <N-M> ⇔ from slide N to slide M. begin{itemize} item<1−> First point item<2| alert@2> Second only point item<3−> Third point end{itemize}
  • 42. Presentations: Overlays L ATEX tutorial Incremental specifications begin{itemize} item<+−| alert@+> First item item<+−| alert@+> Second item item<+−| alert@+> Third item item<+−| alert@+> Forth item end{itemize} . . . equivalent to begin{itemize}[<+−| alert@+>] item First item item Second item item Third item item Forth item end{itemize} overlay on a block only<1−>{ begin{textblock}{15}(2,2) begin{block}{Top block} Here is the block I want to see from the first slide end{block} end{textblock}} only<2−>{ begin{textblock}{18}(6,6) includegraphics[scale=0.3]{lena} end{textblock}}
  • 43. Useful links about L A TEX L ATEX tutorial L A TEX wikibook: http://en.wikibooks.org/wiki/LaTeX Symbol list: http://mirrors.ctan.org/info/symbols/ comprehensive/symbols-letter.pdf Beamer manual: http://www.ctan.org/tex-archive/macros/ latex/contrib/beamer/doc/beameruserguide.pdf L A TEX Tutorial: http://www.tug.org.in/tutorials.html