Vous êtes sur la page 1sur 4

LATEX 2 Cheat Sheet

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.

Common documentclass options


Font size.
Paper size.
Use two columns.
Set margins for two-sided.
Landscape orientation. Must use dvips
-t landscape.
draft
Double-space lines.
Usage: \documentclass[opt,opt]{class}.

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

\begin{enumerate} Numbered list.


\begin{itemize}
Bulletted list.
\begin{description}Description list.
\item text
Add an item.
\item[x ] text
Use x instead of normal bullet or number.
Required for descriptions.

\begin{verbatim} Verbatim environment.


\begin{verbatim*} Spaces are shown as .
\verb!text!
Text between the delimiting characters (in
this case !) is verbatim.

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

These are declarations and should be used in the form {\small


. . . } or without braces to affect the entire document.

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.

Line and page breaks


\\
\\*
\kill
\pagebreak
\noindent

Begin new line without new paragraph.


Prohibit pagebreak after linebreak.
Dont print current line.
Start new page.
Do not indent current line.

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$
~
\@.

TEX Reference Card

Relations

(for Plain TEX)

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

Symbols of Type Ord

<
=

\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

Most relations can be negated by prefixing them with \not.

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

Left and right delimeters will be enlarged if they are prefixed


with \left or \right. Each \left must have a matching
\right, one of which may be an empty delimeter (\left. or
\right.). To specify a particular size, use the following:
\bigl, \bigr
\Bigl, \Bigr
\biggl, \biggr
You can also say \bigm for a large delimenter in the middle of a
formula, or just \big for one that acts as an ordinary symbol.

Every Time Insertions

Page Layout
\hsize=hdimeni
\vsize=hdimeni
\displaywidth=hdimeni
\hoffset=hdimeni
\voffset=hdimeni

Accents




`
^
_

set width of page


set height of page
set width of math displays
move page horizontally
move page vertically

\everypar
\everymath
\everydisplay
\everycr

insert
insert
insert
insert

whenever a paragraph begins


whenever math in text begins
whenever displayed math begins
after every \cr

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.

Elementary Math Control Sequences


x+y
\overline{x+y}
x+y
\underline{x+y}

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

Non-Italic Function Names


\arccos \cos
\arcsin \cosh
\arctan \cot
\arg
\coth
a \pmod{m}
a \bmod m

\csc \exp \ker


\limsup \min \sinh
\deg \gcd \lg
\ln
\Pr \sup
\det \hom \lim
\log
\sec \tan
\dim \inf \liminf \max
\sin \tanh
a (mod m)
mod with parentheses
a mod m
mod without parentheses

The following examples use \mathop to create function names.


Example Command
Plain TEX Definition
lim
\lim_{x\to2} \def\lim{\mathop{\rm lim}}
x2

log2

\log_2

\def\log{\mathop{\rm log}\nolimits}

Footnotes, Insertions, and Underlines


\footnotehmarkeri{htexti}
\topinserthvmode materiali\endinsert
\pageinserthvmode materiali\endinsert
\midinserthvmode materiali\endinsert
\underbar{htexti}

footnote
insert at top of page
insert on full page
insert middle of page
underline text

c 1998 J.H. Silverman, Permissions on back. v1.3



Send comments and corrections to J.H. Silverman, Math. Dept., Brown
Univ., Providence, RI 02912 USA. hjhs@math.brown.edui

Useful Parameters and Conversions


the current day, month, year
name of current job
convert to lower case roman nums.
convert to upper case
convert to lower case

\day,\month,\year
\jobname
\romannumeralhnumberi
\uppercase{htoken listi}
\lowercase{htoken listi}

Fills, Leaders and Ellipses


Text or Math:
Math: . . . \ldots

. . . \dots
\cdots

..
. \vdots

The following fill space with the indicated item.


\hrulefill \rightarrowfill \leftarrowfill

..

. \ddots

Indentation and Itemized Lists


\indent
\noindent
\parindent=hdimeni
\displayindent=hdimeni
\leftskip=hdimeni
\rightskip=hdimeni
\narrower
\item{hlabeli}
\itemitem{hlabeli}
\hangindent=hdimeni
\hangafter=hnumberi

\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

The general format for constructing leaders is


\leadershbox or rulei\hskiphgluei repeat box or rule
\leadershbox or rulei\hfill
fill space with box or rule

Headers, Footers, and Page Numbers

TEX Fonts and Magnification

\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

hbox of given dimension


vbox, bottom justified
vbox, top justified
vbox, center justified (math only)
right overlap material
left overlap material

Overfull Boxes
\hfuzz
\vfuzz
\overfullrule

allowable excess in hboxes


allowable excess in vboxes
width of overfull box marker. To eliminate
entirely, set \overfullrule=0pt.

\folio
\footline
\headline

turn off page numbering


current page number. To get roman nums,
set \pageno=hnegative numberi
current page number, roman num if < 0
material to put at foot of page
material to put at top of page. To leave
space, set \voffset=2\baselineskip, make
room with \advance\vsize by-\voffset.

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

Dimensions, Spacing, and Glue


Dimensions are specified as hnumberihunit of measurei.
Glue is specified as hdimeni plushdimeni minushdimeni.
pc
inch
in centimeter cm
point
pt pica
math unit mu millimeter mm
m width em x height ex
1 pc = 12 pt 1 in = 72.72 pt 2.54 cm = 1 in 18 mu = 1 em
Horizontal Spacing:
\quad (skip 1em) \qquad
Horizontal Spacing (Text): \thinspace \enspace \enskip
\hskiphgluei \hfil \hfill \hfilneg
Horizontal Spacing (Math): thin space \, medium space \>
thick space \; neg. thin space \! \mskiphmugluei
Vertical Spacing:
\vskiphgluei \vfil \vfill
\strut
box w/ ht and depth of (, zero width
\phantom{htexti}
invisible box with dim of htexti
\vphantom{htexti} box w/ ht & depth of htexti, zero width
\hphantom{htexti} box w/ width of htexti, zero ht & depth
\smash{htexti}
typeset htexti, set ht & depth to zero
\raisehdimeni\hbox{htexti}
raise box up
\lowerhdimeni\hbox{htexti}
lower box down
\movelefthdimeni\vbox{htexti}
move box left
\moverighthdimeni\vbox{htexti} move box right
Skip Space Between Lines: \smallskip \medskip \bigskip
encourage a break
\smallbreak \medbreak \bigbreak
break if no room
\filbreak
Set Line Spacing:
\baselineskip = hgluei
single space
\baselineskip = 12pt
1 1/2 space
\baselineskip = 18pt
double space
\baselineskip = 24pt
Increase Line Spacing
\openuphdimeni
use \jots
1\jot = 3pt
Allow Unjustified Lines
\raggedright
Allow Unjustified Pages
\raggedbottom

Braces and Matrices

\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

equation number at right


equation number at left
display several aligned equations
display aligned equations numbered at right
display aligned equations numbered at left
display several equations, centered
case by case definitions
to insert space between lines in displays,
use \noalign{\vskiphgluei} after any \cr
add space between all lines in a display

c 1998 J.H. Silverman, November 1998 v1.3


Copyright
Math. Dept., Brown Univ., Providence, RI 02912 USA
TEX is a trademark of the American Mathematical Society
Permission is granted to make and distribute copies of this card provided the copyright notice and this permission notice are preserved on
all copies.
Published by Ford & Mason Ltd, GL19 3JB, UK. Further copies of this
card can be ordered through our web site: http://www.refcards.com.

Tabular environments

Citation types

tabbing environment

Full author list and year. (Watson and Crick


1953)
\citeA{key}
Full author list. (Watson and Crick)
\citeN{key}
Full author list and year. Watson and Crick
(1953)
\shortcite{key} Abbreviated author list and year. ?
\shortciteA{key} Abbreviated author list. ?
\shortciteN{key} Abbreviated author list and year. ?
\citeyear{key}
Cite year only. (1953)
All the above have an NP variant without parentheses; Ex.
\citeNP.
\cite{key}

\= Set tab stop.


\> Go to tab stop.
Tab stops can be set on invisible lines with \kill at the end
of the line. Normally \\ is used to separate lines.

tabular environment
\begin{array}[pos]{cols}
\begin{tabular}[pos]{cols}
\begin{tabular*}{width}[pos]{cols}

tabular column specification


l
c
r
p{width}
@{decl}
|

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

^{\circ} Ex: 22 C: $22^{\circ}\mathrm{C}$.

Bibliography and citations


When using BibTEX, you need to run latex, bibtex, and
latex twice more to resolve dependencies.

BibTEX entry types


@article
@book
@booklet
@conference
@inbook
@incollection
@manual
@mastersthesis
@misc
@phdthesis
@proceedings
@techreport
@unpublished

Journal or magazine article.


Book with publisher.
Book without publisher.
Article in conference proceedings.
A part of a book and/or range of pages.
A part of book with its own title.
Technical documentation.
Masters thesis.
If nothing else fits.
PhD. thesis.
Proceedings of a conference.
Tech report, usually numbered in series.
Unpublished.

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
}

Sample LATEX document


\documentclass[11pt]{article}
\usepackage{fullpage}
\title{Template}
\author{Name}
\begin{document}
\maketitle

address

Common BibTEX style files


abbrv
alpha
plain

Standard
Standard
Standard

abstract
apa
unsrt

alpha with abstract


APA
Unsorted

\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/

Vous aimerez peut-être aussi