http://www.comp.leeds.ac.

uk/andyr
Learning Latex
before it´s too late!
Session 3
Andrew Roberts
andy¡0comp.]eeds.ac.uk
http://www.comp.leeds.ac.uk/andyr
Overview
1 Tables
2 Structure
2 Formatting
2 Spanning rows and columns
1 !mages
2 !mporting
2 Simple operations
1 Floats
2 Dynamically positioning tables and images
2 Captions
http://www.comp.leeds.ac.uk/andyr
Tables - Basics
1 Example:
\beg1n|fabu]a¡}| c | c }
\h]1ne
lfem 1 & lfem 2 \\
lfem 3 & lfem 4
\end|fabu]a¡}
http://www.comp.leeds.ac.uk/andyr
Tables - Basics (2)
1 Use the 1234526 environment.
1 Argument specifies alignment of
columns.
1 vertical bars in between column
declaration for vertical lines.
1 \\ (new line) - ends the current row.
1 \hline - draws an horizontal line.
http://www.comp.leeds.ac.uk/andyr
Tables - Wrapping Text
1 Latex doesn't automatically wrap text
if it overruns the page!
1 Use paragraph column types:
2 p{width} - top aligned
2 m{width} - middle aligned
2 b{width} - bottom aligned
. on columns that require it.
http://www.comp.leeds.ac.uk/andyr
Tables - Spanning Columns
1 \mu]11co]umn|numco]s}|a]1gnmen1}|con1en1s}
2 num_cols - number of subsequent
columns to span
2 alignment - pretty obvious!
2 contents - the data
http://www.comp.leeds.ac.uk/andyr
Tables - Spanning Rows
1 Use the 12345678 package.
1 \mu]f1¡oW{num¡oWs}{W1dfh}{confenfs}
2 num_rows - number of subsequent
rows to span.
2 width - use * for natural width,
otherwise specify a length.
2 contents - the data.
http://www.comp.leeds.ac.uk/andyr
Images
1 Nany ways to do this. The 12345678
package is my preferred method.
1 Images should be in Encapsulated
Postscript (EPS) format.
2 Can easily convert to from ma]ority of
graphics utilities, eg Paint Shop Pro,
Photoshop, Corel Draw, etc.
http://www.comp.leeds.ac.uk/andyr
Importing Images
1 \includegraphics|options|{imagefile}
2 Can omit the file extension.
1 Options:
2 width=xx (e.g., 5cm)
2 height=xx (e.g, 2.5in)
2 keepaspectratio=true!false
2 scale=xx (e.g., 0.5)
2 angle=xx (e.g, 90)
2 trim=l b r t
2 crop=true!false
http://www.comp.leeds.ac.uk/andyr
Floats
1 Floats are elements that cannot be
broken over a page (e.g., tables and
figures).
1 Floats are positioned by Latex at the
most suitable spot.
1 Will rearrange text accordingly.
http://www.comp.leeds.ac.uk/andyr
Floating Tables and Figures
1 Simply put your table (tabular) into a
12345 environment.
1 Similarly, to float material that
constitutes a figure, embed in the
67895 environment.
http://www.comp.leeds.ac.uk/andyr
Placement Specifiers
1 Options that give user control of
where floats are placed.
Override internal parameters for `good´ positioning. !
Place on a special page of floats only. p
Position at bottom of page. b
Position at top of page. t
Place the float 1232. h
1234566578 925523
http://www.comp.leeds.ac.uk/andyr
Captions
1 Use the \caption{text} command to
add a caption to your floats.
1 To ensure it appears after the float,
use the command after the element
being floated.
1 Latex will take care of the counting.
2 Each float type has its own
independent counter.
http://www.comp.leeds.ac.uk/andyr
Labels and Cross-refs
1 To cross reference (eg figure, section,
etc) you must first add a label within
the thing to be referenced:
\]abe]|ma¡ke¡}
1 To then reference:
\¡ef|ma¡ke¡}
(\page¡ef|ma¡ke¡} is also useful)
http://www.comp.leeds.ac.uk/andyr
Other tips
1 Ouotes:
s1ng]e quofes` ‘single quotes’
doub]e quofes¨ “double quotes”
1 Dashes:
- inter-word
- - page range
- - - punctuation dash
http://www.comp.leeds.ac.uk/andyr
1223456
http://www.comp.leeds.ac.uk/andyr
Babel
1 The babel package is responsible for
Latex language support (US is
default), including date format.
\documen1c]ass|eng]1sh]|a¡11c]e}
\usepackage|babe]}
Will format auto-generated dates in
day/month/year order.
http://www.comp.leeds.ac.uk/andyr
Nore.
1 Goto:
http://www.comp.leeds.ac.uk/andyr/misc/latex
and
http://www.comp.leeds.ac.uk/andyr/misc

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.