Nothing Special   »   [go: up one dir, main page]

LaTeX Cheat Sheet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

LATEX cheat sheet

May 1, 2009
All the LATEX commands you know and love. . . now gathered into one convenient reference!
For more information, see http://tug.ctan.org/tex-archive/info/lshort/
english/lshort.pdf.

General
All LATEX commands start with a backslash. Command arguments go
in {curly braces}.
LATEX ignores anything from a precent sign (%) to the end of the line
(comments).
Paragraphs are separated by a blank line.
Use two backticks to make an opening quotation mark and two apostrophes to make a closing one: quotation marks.
\section{Foo} starts a new section titled Foo, and likewise for
\subsection and so on.
You can give any numbered or lettered thing (section, equation, list
item, etc.) a label with \label{foo} and then later refer to it using
\ref{foo} to automatically insert the correct number. For example:
\begin{equation}
\label{eq:pythagorean}
a^2 + b^2 = c^2
\end{equation}
As shown in equation \ref{eq:pythagorean}...
1

You can define your own commands in the preamble (the part of the
file before the \begin{document}) with \newcommand{\com}{blah}.
From now on, everywhere you write \com it will be replaced with \blah.

Environments
Creating a LATEX document:
\documentclass{article}
% setup goes here
\begin{document}
% content goes here
\end{document}
Make a bulleted list with \begin{itemize} ... \end{itemize}, and
a numbered list with \begin{enumerate} ... \end{enumerate}. Each
list item starts with \item.
In general, the environment foo starts with \begin{foo} and ends
with \end{foo}.
Make a table with the tabular environment. For example:
\begin{tabular}{cc|c}
$A$ & $B$ & $A \land B$
\hline
$T$ & $T$ & $T$ \\
$T$ & $F$ & $F$ \\
$F$ & $T$ & $T$ \\
$F$ & $F$ & monkey
\end{tabular}

\\

Mathematics
Mathematics in the middle of text should be surrounded by dollar signs.
For example:
Since we know that $x^2 - 5 \leq f(z)$, we can
substitute for $f$ to obtain...
Make an equation by itself on a separate line with an equation environment. If you dont want a number next to the equation, use equation*
instead, or use \[ ... \]. You dont need to use dollar signs inside
an equation environment; it is in math mode automatically.
Make superscripts with ^ (carat) and subscripts with _ (underscore).
If your superscript or subscript is more than one character, be sure to
enclose it in curly brackets. For example, 2^i (2i), x_{99} (x99 ).
You can make a multi-line equation (for example, to show the steps in
solving an equation) using an align* environment. Put the alignment
character & before the place in the equations that you want aligned,
and put \\ at the end of each line except the last. For example:
\begin{align*}
x &= y + 4 \\
z &= 2 + \sqrt{x} \\
&= 2 + 1 + \sqrt{x} - 1
\end{align*}
You can make matrices with a pmatrix environment (use vmatrix for
determinants). For example, you can typeset the following matrix:

4
5 x+2
9

0
6 + 5i
3 2
with this code:

\[
\begin{pmatrix}
4 & 5 & x + 2 \\
9 & 0 & \pi \\
6 + 5i & \sqrt{3} & -2
\end{pmatrix}
\]
You can create sigma notation using the \sum command, followed by a
subscript and a superscript for the parts below and above the . For
example, \sum_{k=1}^{20} (k^2 + 3) produces
20
X

(k 2 + 3).

k=1

You can write modular equivalences with \equiv and \pmod. For example, the equation
12 17 (mod 5)
can be typeset with 12 \equiv 17 \pmod{5}.

Symbols

4.1

General mathematical symbols

All of the commands listed below are standard LATEX commands except those
marked with an asterisk , which are defined in precalc.sty.
Symbol

command

LATEX

5
x
...

\LaTeX
\leq
\geq
\sqrt{x}
\sqrt[5]{x}
\dots

Symbol

command

{
|
}

N
Z
Q
R
I
C

\
S

\{
\mid, \suchthat
\}
\in
\not \in
\emptyset
\N
\Z
\Q
\R
\I
\C
\cup, \union
\cap, \intersect
\setminus
\overline{S}
\infty
\subseteq
\subset
\times

\to
\mapsto
\circ

\land
\lor
\neg
\implies
\iff
\forall
\exists
\oplus

Symbol

command

sin
cos
cis
tan
csc
sec
cot
50
arcsin
arccos
arctan

\sin
\cos
\cis
\tan
\csc
\sec
\cot
50^\circ
\arcsin
\arccos
\arctan

det

\det

4.2

Greek alphabet

Name
\alpha
\beta
\gamma
\delta
\epsilon
\zeta
\eta
\theta
\iota
\kappa
\lambda
\mu
\nu
\xi
\pi
\rho
\sigma
\tau
\upsilon
\phi
\chi
\psi
\omega

Lowercase

Uppercase

You might also like