Académique Documents
Professionnel Documents
Culture Documents
Document classes
book
Default is two-sided.
report
No \part divisions.
article
No \part or \chapter divisions.
letter
Letter (?).
slides
Large sans-serif font.
Used at the very beginning of a document:
\documentclass{class}. Use \begin{document} to start
contents and \end{document} to end the document.
10pt/11pt/12pt
letterpaper/a4paper
twocolumn
twoside
landscape
Packages
fullpage Use 1 inch margins.
anysize Set margins with \marginsize{l}{r }{t}{b}.
multicol Use n columns with \begin{multicols}{n}.
latexsym Use LATEX symbol font.
Use before \begin{document}. Usage: \usepackage{package}
Title
\author{text} Author of document.
\title{text} Title of document.
\date{text}
Date.
These commands go before \begin{document}. The
declaration \maketitle goes at the top of the document.
Miscellaneous
\pagestyle{empty} Empty header, footer and no page numbers.
Document structure
\part{title}
\subsubsection{title}
\chapter{title}
\paragraph{title}
\section{title}
\subparagraph{title}
\subsection{title}
Section commands can be followed with an *, like
\section*{title}, to supress heading numbers.
\setcounter{secnumdepth}{x} supresses heading numbers of
depth > x, where chapter has depth 0.
Text environments
\begin{comment} Comment block (not printed).
\begin{quote}
Indented quotation block.
\begin{quotation}Like quote with indented paragraphs.
\begin{verse}
Quotation block for verse.
Lists
Verbatim text
References
Set a marker for cross-reference, often of the
form \label{sec:item}.
\ref{marker }
Give section/body number of marker.
\pageref{marker } Give page number of marker.
\footnote{text} Print footnote at bottom of page.
\label{marker }
Environment
\begin{center}
\begin{flushleft}
\begin{flushright}
Declaration
\centering
\raggedright
\raggedleft
Miscellaneous
\linespread{x} changes the line spacing by the multiplier x.
Text-mode symbols
Floating bodies
\begin{table}[place]
Add numbered table.
\begin{figure}[place] Add numbered figure.
\begin{equation}[place] Add numbered equation.
\caption{text}
Caption for the body.
The place is a list valid placements for the body. t=top,
h=here, b=bottom, p=separate page, !=place even if ugly.
Captions and label markers should be within the environment.
Text properties
Font face
Command
Declaration
Effect
\textrm{text}
{\rm text}
Roman family
\textsf{text}
{\sf text}
Sans serif family
\texttt{text}
{\tt text}
Typewriter family
\textmd{text}
{\md text}
Medium series
\textbf{text}
{\bf text}
Bold series
\textup{text}
{\up text}
Upright shape
\textit{text}
{\it text}
Italic shape
\textsl{text}
{\sl text}
Slanted shape
\textsc{text}
{\sc text}
Small Caps shape
\emph{text}
{\em text}
Emphasized
\textnormal{text}{\normalfont text}Document font
\underline{text}
Underline
The command (tttt) form handles spacing better than the
declaration (tttt) form.
Font size
\tiny
tiny
\scriptsize scriptsize
\footnotesize footnotesize
small
\small
\normalsize normalsize
\large
large
Justification
\Large
\LARGE
\huge
\Huge
Large
LARGE
huge
Huge
Symbols
&
$
%
\&
\$
\%
...
|
#
\_
\^{}
\~{}
\ldots
\textbar
\#
\
|
\textbullet
\textbackslash
\textbar
Accents
o
`
o
c
\o
\.o
\c c
\OE
\o
\j
o.
\o
\"o
\d o
\ae
\O
~
\^o
\c o
\b o
\AE
\l
?
[[
]]
((
))
o
o
a
L
\~o
\v o
\t oo
\aa
\L
\=o
\H o
\oe
\AA
\i
Delimiters
{ \{
} \}
< \textless
> \textgreater
Dashes
Name
hyphen
en-dash
em-dash
Source
----
Example
X-ray
15
Yesor no?
Usage
In words.
Between numbers.
Punctuation.
Miscellaneous
May 11, 2002.
Prints instead of \~{}, which makes .
Space, disallow linebreak (W.J.~Clinton).
Indicate that the . ends a sentence when following
an uppercase letter.
\hspace{l} Horizontal space of length l (Ex: l = 20pt).
\vspace{l} Vertical space of length l.
\rule{w}{h} Line of width w and height h.
\today
$\sim$
~
\@.
Relations
Greek Letters
\alpha
\beta
\gamma
\delta
\epsilon
\varepsilon
\zeta
\eta
\theta
\vartheta
\iota
\kappa
\lambda
\mu
\nu
\xi
\o
\pi
\varpi
\rho
\varrho
\sigma
\varsigma
\tau
\upsilon
\phi
\varphi
\chi
\psi
\omega
\Gamma
\Delta
\Theta
\Lambda
\Xi
\Pi
\Sigma
\Upsilon
\Phi
\Psi
\Omega
<
=
\aleph
\hbar
\imath
\jmath
\ell
\wp
\Re
\Im
\partial
\infty
>
k
6
4
\
\prime
\emptyset
\nabla
\surd
\top
\bot
\|
\angle
\triangle
\backslash
Large Operators
P
Q
`
R
H
T
S
F
W
V
\sum
\prod
\coprod
\int
\oint
\bigcap
\bigcup
\bigsqcup
\bigvee
\bigwedge
[
\
]
\forall
\exists
\neg or \lnot
\flat
\natural
\sharp
\clubsuit
\diamondsuit
\heartsuit
\spadesuit
J
N
L
U
\bigodot
\bigotimes
\bigoplus
\biguplus
Binary Operations
?
\pm
\mp
\setminus
\cdot
\times
\ast
\star
\diamond
\circ
\bullet
\div
]
u
t
/
.
o
4
5
\cap
\cup
\uplus
\sqcap
\sqcup
\triangleleft
\triangleright
\wr
\bigcirc
\bigtriangleup
\bigtriangledown
\vee or \lor
\wedge or \land
\oplus
\ominus
\otimes
\oslash
\odot
\dagger
\ddagger
\amalg
\leq or \le
\prec
\preceq
\ll
\subset
\subseteq
\sqsubseteq
\in
\vdash
\smile
\frown
\propto
\not\equiv
/
a
|
k
'
=
./
3
|=
.
=
\geq or \ge
\succ
\succeq
\gg
\supset
\supseteq
\sqsupseteq
\notin
\dashv
\mid
\parallet
\equiv
\sim
\simeq
\asymp
\approx
\cong
\bowtie
\ni or \owns
\models
\doteq
\perp
6=
\notin
\ne
Arrows
l
%
The
mat
\leftarrow or \gets
\longleftarrow
\Leftarrow
= \Longleftarrow
\rightarrow or \to
\longrightarrow
\Rightarrow
= \Longrightarrow
\leftrightarrow
\longleftrightarrow
\Leftrightarrow
\Longleftrightarrow
\mapsto
7 \longmapsto
\hookleftarrow
,
\hookrightarrow
\uparrow
\Uparrow
\downarrow
\Downarrow
\updownarrow
m
\Updownarrow
\nearrow
&
\searrow
\nwarrow
.
\swarrow
\buildrel macro puts one symbol over another. The foris \buildrelhsuperscripti\overhrelationi.
def
f (x) = x + 1
\buildrel\alpha\beta\over\longrightarrow
f(x)\; {\buildrel\rm def\over=} \;x+1
Delimeters
[
]
|
k
[[
]]
\lbrack or [
\rbrack or ]
\vert or |
\Vert or \|
[\![
]\!]
{
}
b
c
((
))
\lbrace or \{
\rbrace or \}
\lfloor
\rfloor
(\!(
)\!)
h
i
d
e
hh
ii
\langle
\rangle
\lceil
\rceil
\langle\!\langle
\rangle\!\rangle
Page Layout
\hsize=hdimeni
\vsize=hdimeni
\displaywidth=hdimeni
\hoffset=hdimeni
\voffset=hdimeni
Accents
`
^
_
\everypar
\everymath
\everydisplay
\everycr
insert
insert
insert
insert
Type
hat
expanding hat
check
tilde
expanding tilde
acute
grave
dot
double dot
breve
bar
vector
Example
a
d
abc
a
g
abc
a
a
`
a
a
~a
In Math
\hat
\widehat
\check
\tilde
\widetilde
\acute
\grave
\dot
\ddot
\breve
\bar
\vec
In Text
\^
none
\v
\~
none
\
\
\.
\"
\u
\=
none
The \skewhnumberi command shifts accents for proper positioning, the larger the hnumberi, the more right the shift. Compare
\hat{\hat A} gives A,
\skew6\hat{\hat A} gives A.
x
+
2
\sqrt{x+2}
n
x+2
\root n\of{x+2}
n+1
{n+1\over 3}
fraction
3
n+1
fraction, no line
{n+1\atop 3}
3
n +
1
binomial coeff.
{n+1\choose 3}
3 o
nn +
1
braced fraction
{n+1\brace 3}
3 i
hn +
1
bracketed fraction
{n+1\brack 3}
3
The following specify a style for typesetting formulas.
\displaystyle \textstyle \scriptstyle \scriptscriptstyle
overline a formula
underline a formula
square root
higher order roots
log2
\log_2
\def\log{\mathop{\rm log}\nolimits}
footnote
insert at top of page
insert on full page
insert middle of page
underline text
\day,\month,\year
\jobname
\romannumeralhnumberi
\uppercase{htoken listi}
\lowercase{htoken listi}
. . . \dots
\cdots
..
. \vdots
..
. \ddots
\dotfill
\parshape=hnumberi
indent
do not indent
set indentation of paragraphs
set indentation of math displays
skip space on left
skip space on right
make paragraph narrower
singly indented itemized list
doubly indented itemized list
hanging indentation for paragraph
start hanging indent after line n.
If n < 0, indent first |n| lines.
general paragraph shaping macro
\nopagenumbers
\pageno
\rm
\sl
Roman
Slant
\bf
\it
Bold
Italic
\tt
\/
Typewriter
italic correction
\magnification=hnumberi
scale document by n/1000
n
\magstephnumberi
scaling factor of 1.2
1000
\magstephalf
scalling factor of 1.2
\font\FN=hfontnamei
load a font, naming it \FN
\font\FN=hfontnamei at hdimeni
load font scaled to dimension
\font\FN=hfontnamei scaled hnumberi
load font scaled by n/1000
true hdimeni
dimension with no scaling
Alignment Displays
set equally spaced tabs
set tabs as per sample line
tabbed text to be typeset
horizontal alignment
horizontal alignment
add space between lines
insert material after any \cr
set glue at tab stops
omit the template for a column
span two columns
span several columns
ignore the width of an entry
insert \cr if one is not present
\settabshnumberi\columns
\settabs\+hsample linei\cr
\+htext1 i&htext2 i& \cr
\halign
\halign tohdimeni
\openuphdimeni
\noalign{hvmode materiali}
\tabskip=hgluei
\omit
\span
\multispanhnumberi
\hidewidth
\crcr
Boxes
\hbox tohdimeni
\vbox tohdimeni
\vtop tohdimeni
\vcenter tohdimeni
\rlap
\llap
Overfull Boxes
\hfuzz
\vfuzz
\overfullrule
\folio
\footline
\headline
Macro Definitions
\def\cs{hreplacement texti}
define the macro \cs
\def\cs#1 #n{hrepl. texti}
macro with parameters
\let\cs=htokeni
give \cs tokens current meaning
Advanced Macro Definition Commands
\long\def
macro whose args may include \par
\outer\def
macro not allowed inside definitions
\global\def or \gdef
definition that transcends grouping
\edef
expand while defining macro
\xdef or \global\edef
global version of \edef
\noexpandhtokeni
do not expand token
\expandafterhtokeni
expand item after token first
\futurelet\cshtok1 ihtok2 i equals \let\cs=htok2 ihtok1 ihtok2 i
\csname. . . \endcsname
create a control sequence name
\string\cs
list characters in name, \ c s
\numberhnumberi
list of characters in number
\thehinternal quantityi
list of tokens giving value of quantity
Conditionals
The general format of a conditional is
\ifhconditionihtrue texti\elsehfalse texti\fi
\ifnumhnum1 ihrelationihnum2 i
compare two integers
\ifdimhdimen1 ihrelationihdimen2 i
compare two dimensions
\ifoddhnumi
test for an odd integer
\ifmmode
test for math mode
\ifhtoken1 ihtoken2 i
test if character codes agree
\ifdim
compare two dimensions
\ifxhtoken1 ihtoken2 i
test if tokens agree
\ifeofhnumberi
test for end of file
\iftrue, \iffalse
always true, always false
\ifcasehnumberihtext0 i\orhtext1 i\or
\orhtextn i\elsehtexti\fi
choose text by hnumberi
\loop \if. . . \repeat
loop until \if is false
\newif\ifblob
create a new conditional called \ifblob
\blobtrue, \blobfalse
set conditional \ifblob true, false
\matrix
rectangular array of entries
\pmatrix
matrix with parentheses
\bordermatrix
matrix with labels on top and left
\overbrace
overbrace, may be superscripted
\underbrace
underbrace, may be subscripted
For small matrices in text, use the following constructions:
a b
{a\,b \choose c\,d}
c d
ab
\left( {a\atop c} {b\atop d} \right)
cd
Displayed Equations
\eqno
\leqno
\eqalign
\eqalignno
\leqalignno
\displaylines
\cases
\noalign
\openuphdimeni
Tabular environments
Citation types
tabbing environment
tabular environment
\begin{array}[pos]{cols}
\begin{tabular}[pos]{cols}
\begin{tabular*}{width}[pos]{cols}
Left-justified column.
Centered column.
Right-justified column.
Same as \parbox[t]{width}.
Insert decl instead of inter-column space.
Inserts a vertical line between columns.
tabular elements
\hline
Horizontal line between rows.
\cline{x-y} Horizontal line across columns x through y.
\multicolumn{n}{cols}{text}
A cell that spans n columns, with cols column
specification.
Math mode
To use math mode, surround text with $ or use
\begin{equation}.
^{x}
Superscriptx
_{x}
Subscript
x
Pn
\frac{x}{y} x
\sum_{k=1}^n
y
k=1
\sqrt[n]{x} n x
Math-mode symbols
\leq
\cdot
\ast
\alpha
\delta
\zeta
\vartheta
\lambda
\xi
\sigma
\phi
\omega
\Theta
\Pi
\Phi
\geq
\times
\circ
\beta
\epsilon
\eta
\iota
\mu
\pi
\tau
\chi
\Gamma
\Lambda
\Sigma
\Psi
6=
\neq
\div
\cdots
\gamma
\varepsilon
\theta
\kappa
\nu
\rho
\upsilon
\psi
\Delta
\Xi
\Upsilon
\Omega
Special symbols
BibTEX fields
Address of publisher. Not necessary for major
publishers.
author
Names of authors, of format ....
booktitle
Title of book when part of it is cited.
chapter
Chapter or section number.
edition
Edition of a book.
editor
Names of editors.
institution Sponsoring institution of tech. report.
journal
Journal name.
key
Used for cross ref. when no author.
month
Month published. Use 3-letter abbreviation.
note
Any additional information.
number
Number of journal or magazine.
organization Organization that sponsors a conference.
pages
Page range (2,6,9--12).
publisher
Publishers name.
school
Name of school (for thesis).
series
Name of series of books.
title
Title of work.
type
Type of tech. report, ex. Research Note.
volume
Volume of a journal or book.
year
Year of publication.
Not all fields need to be filled. See example below.
The LATEX document should have the following two lines just
before \end{document}, where bibfile.bib is the name of the
BibTEX file.
\bibliographystyle{plain}
\bibliography{bibfile}
BibTEX example
The BibTEX database goes in a file called file.bib, which is
processed with bibtex file.
@String{N = {Na\-ture}}
@Article{WC:1953,
author = {James Watson and Francis Crick},
title
= {A structure for Deoxyribose Nucleic Acid},
journal = N,
volume = {171},
pages
= {737},
year
= 1953
}
address
Standard
Standard
Standard
abstract
apa
unsrt
\section{section}
\subsection*{subsection without number}
text \textbf{bold text} text. Some math: $2+2=5$
\subsection{subsection}
text \emph{emphasized text} text. \cite{WC:1953}
discovered the structure of DNA.
A table:
\begin{table}[!th]
\begin{tabular}{|l|c|r|}
\hline
first & row & data \\
second & row & data \\
\hline
\end{tabular}
\caption{This is the caption}
\label{ex:table}
\end{table}
The table is numbered \ref{ex:table}.
\end{document}
c 2002 Winston Chang
Copyright
$Revision: 1.4 $, $Date: 2002/03/18 20:40:59 $.
http://www.stdout.org/winston/latex/