LaTex Very Short Guide
LaTex Very Short Guide
Example: \tableofcontents
If a command needs text to work with, it goes in curly braces.
Example: \title{Irisches Tagebuch}\author{Heinrich Böll}
If options are used, they go in square brackets first.
Example: \documentclass[a4paper,11pt]{book}
w
Space after commands without braces gets suppressed.
Example: Copyright \copyright 2009 Copyright ©2009 f%
w
To prevent this, put empty curly braces after the command.
f"
Example: Copyright \copyright{} 2009 Copyright © 2009
w
Curly braces are also used to restrict the scope of effects inside them.
Example: Some {\tiny little} word Some little word
Creating and typesetting your document
1. Create your document using any suitable plain-text editor with LATEX
controls, eg TEXshop (Mac), TEXnicCenter (Win), Kile (Linux), Emacs (all);
2. Save the file with a name ending in .tex (never use spaces in filenames!);
3. Use the toolbar buttons or menu items in your editor to typeset and
display the document;
4. Make any changes needed in your original document and repeat step 3.
Note. This guide shows only a tiny fraction of LATEX’s power. For information, visit the
TEX Users Group site (www.tug.org). For help, see the FAQ (www.tex.ac.uk/faq) and the
Usenet newsgroup comp.text.tex. For packages, use the Comprehensive TEX Archive
Network (www.ctan.org). For documentation, use the sources in the References [2].
1 For reasons of space this guide does not cover details of mathematics typesetting.
Basic document structure Leave a blank line between paragraphs as
you type. This means ‘start a new para-
Here’s the skeleton of a LATEX document.
graph’, not ‘leave a blank line’. You can
These three lines are compulsory: your
control spacing and indentation by setting
document will not work without them:
\parskip and \parindent (see examples),
\documentclass{article} or with the parskip package.
your preamble goes here (extra setups, if any)
\begin{document} Sections and cross-references
your document text goes here
Sections get numbered automatically in
\end{document}
bold type, and get included in the Ta-
installed (eg thesis, memoir, etc). package for other languages.
There are paper size options a4paper
(210 mm×297 mm) and letterpaper (Preamble, titling, and abstract as above)
(8½00 ×1100 ) and others (eg a5paper). \tableofcontents
There are base type size options 10pt \section{heading of a section}
(the default), 11pt, and 12pt. text for the section goes here
...as shown in section \ref{blah}.
Front matter \subsubsection{heading of a subsection}
The preamble is where you specify any ex- text for the subsection goes here
tra packages (LATEX plugins) such as type- \section{heading of a new section}
faces or special formatting requirements, \label{blah} make up name for the label
and where you put any changes to stan- text for the section goes here
dard features. \end{document}
\documentclass[a4paper,11pt]{book}
\usepackage{charter,graphicx} For cross-references, use \label{...} to
\setlength{\parindent}{1em} label the target and \ref{...} and/or
\begin{document} \pageref{...} to refer to it. Make up the
\title{your document title} label values: LATEX will use them to work out
\author{your name} the right numbers to print.
w
\date{date of publication} Example: ...section \ref{blah} on p.
\maketitle \pageref{blah}. ...section 3 on p.9.
\begin{abstract}
the paragraphs of the abstract go here Typefaces
\end{abstract}
LATEX’s default typeface is Computer Mod-
\tableofcontents
ern. There is a selection of other typeface
rest of the document goes here
packages (use them in your Preamble):
\end{document}
Times mathptmx Courier courier
Palatino mathpazo Avant Garde avant
In a typical report or article, the title, au- Bookman bookman Helvetica helvet
thor, date, abstract (summary), and table Charter charter Zapf Chancery chancery
of contents (optional) all go at the start, fol- Utopia utopia Pandora pandora
lowed by your text. New Century Schoolbook newcent
Dozens of others are available, including explanation format). Others can be de-
mathematical and decorative fonts. To fined, or downloaded from CTAN [5].
switch to a sans-serif type family (eg Hel-
\begin{itemize} \begin{enumerate} \begin{description}
vetica, Avant Garde), use \sffamily in your \item 1lb Sugar \item Mix together \item[Fudge] is fun...
text. To change font for a word or phrase, \item ½pt Cream \item Boil to 112°C \item[Broccoli] sucks...
\item Chocolate \item Stir and cool \item[Exercise] is good
use these commands (they can be nested— \end{itemize} \end{enumerate} \end{description}
see below):
Italics \textit{Hello} ww Hello
•
•
1lb Sugar
½pt Cream
1.
2.
Mix together
Boil to 112°C
Fudge is fun but not if
made too often.
ww
Broccoli sucks, period.
Boldface \textbf{Hello} Hello • Chocolate 3. Stir and cool
Exercise is good for you
Smallcaps \textsc{Hello} Hello if taken daily and not
w
to extremes.
Sans-serif \textsf{Hello} Hello
Monospace \texttt{Hello} Hello You can nest lists inside each other. See
packages like paralist and mdwlist to control
w
Example: \textit{\textbf{\textsf
list formatting.
{bold ital sans}}} bold ital sans
Font sizing is automatic for titles, head- Tables and figures
ings, and footnotes. There are some named Formal tables and figures float (change po-
step-size commands (in points, relative to sition to fill available space) so they may
the base size): not be printed where you typed them.
\normalsize 10 11 12
* sizes rounded here to save space
\tiny 5 6 7 \begin{table}
\caption{Mean growth rate and intakes
\scriptsize 6 7 8 of supplement, milk, and water for 4
\footnotesize 7 8 9 diets.}
\small 9 10 11 \label{dietgrowth}\centering
\large 11 12 14 \begin{tabular}{|l|r|r|r|r|}\hline
\Large 12 14 17* &Growth&Supplement&Milk&Water\\
\LARGE 14 17* 20* Supplement&rate&intake&intake&intake\\
&(g/day)&(g/day)&(ml/kg$^{0.75}$)&
\huge 17* 20* 24*
(ml/kg$^{0.75}$)\\\hline
\Huge 20* 24* 28* Lucerne &145&450&10.5&144\\\hline
but you can specify an exact size with Sesbania&132&476& 9.2&128\\\hline
Leucaena&128&364& 8.9&121\\\hline
the fix-cm package and the command
None & 89& 0& 9.8&108\\\hline
\fontsize{pp }{bb }\selectfont for any \end{tabular}
point-size (pp) on any baseline (bb). \end{table}
Group (enclose) the command with its
Table 2: Mean growth rate and intakes of supplement,
applicable text in curly braces to pre- milk, and water for four diets (after Sherington, J, undated)
vent it affecting the rest of the document.
Growth Supplement Milk Water
For wider line-spacing (eg in theses) use Supplement rate
(g/day)
intake intake intake
(g/day) (ml/kg0.75 ) (ml/kg0.75 )
the setspace package. You can also use Lucerne 145 450 10.5 144
colour with the
Google
Sesbania 132 476 9.2 128
Leucaena 128 364 8.9 121
xcolor package and None 89 0 9.8 108
the \color{name } command. Packages like longtable and array can help
with more complex table formats.
Lists
For help, see the links on the front and back pages.
There are three basic kinds: itemized lists There is a summary of common commands at
www.stdout.org/~winston/latex/latexsheet.pdf
(bulleted); enumerated lists (numbered or and a comprehensive list at computing.ee.ethz.ch/
lettered); and descriptive lists (topic-and- .soft/latex/green/ltx-2.html.
Tables and Figures, continued
\begin{figure}
\caption{Swiss and Dutch Mennonite migrations of the 1700s and 1800s}\label{lmig}
\centering (graphics must be EPS files for standard LATEX; but JPG, PNG, or PDF for pdfLATEX)
\includegraphics[width=.8\columnwidth]{menno-a}
\\\scriptsize Courtesy of Paul C. Adams, Department of Geography and the
Environment, University of Texas at Austin. \cite{adams}\end{figure}
Figure 1: Swiss and Dutch Mennonite migrations of the 1700s and 1800s
Courtesy of Paul C. Adams, Department of Geography and the Environment, University of Texas at Austin. [1]
References
1. Adams, Paul C. Linguistic Chaos in Montreal, www.utexas.edu/depts/grg/adams/chaos.ppt,
2/59, Oct 2006.
2. Flynn, P. Formatting Information, 2005, at latex.silmaril.ie/formattinginformation/
3. Patashnik, O. BIBTEXing, TEX Users Group, 1988 (distributed with all copies of LATEX).
4. Sherington, J. example table in ‘Informative Presentation of Tables, Graphs and Statistics’, 4.2,
Statistical Services Centre, University of Reading, www.reading.ac.uk/ssc/publications/
guides/toptgs.html
5. TEX Users Group, for TEX Live (www.tug.org/texlive/) and CTAN (Comprehensive TEX
Archive Network) for downloads (www.ctan.org).
Note. Commercial implementations of TEX with business support are available from
Personal TEX, Inc (PCTEX); Blue Sky Research (Textures [Mac]); MacKichan Software, Inc
(Scientific Word); Micropress, Inc (VTEX), TrueTEX Software (TrueTEX), and others.
2 Like this.