. 2
( 2)

x n + y n = z n ∀n = 2
\mathit n/a
xn + y n = z n ∀n = 
\mathnormal n/a
§\ + †\ = ‡\ ∀\ = ∈
\mathcal n/a

Table 3: Font attributes.

5 THE FORMAT MENU 5.2 Format/Character

5.2 Format/Character
Standard character properties are listed in Table 3, font sizes in Table 4.
Please note the di¬erence between italics and emphasised text. For example, this portion of
text is typeset in italics, and these words are emphasised in upright. As you can see, \emph is a
logical rather than typographic command.
Also, please note that underscript is normally used in math mode only. The trick to use it in
normal text is:
this is
this is subscript

Font size Example
tiny sample text

scriptsize sample text
footnotesize sample text
sample text
sample text
sample text
sample text
sample text
sample text
sample text

Table 4: Font sizes

5.2.1 Underline styles

Normally, underline is not used. It™s just a relic of the old teletype era, and it doesn™t look really
good. If you still want to use underline, the ulem package provides some fancy styles:
important urgent boat wrong // // //
/// ///
\uwave{boat} :::::
Beware: ulem rede¬nes the \emph command, which will be replaced by underline. To avoid this
behaviour, use this declaration:


5.2.2 Format/Character Size

If the standard font sizes aren™t enough for you, the package extsizes may be handy. It provides
˜extended™ versions of the standard document classes, with support for sizes 8“12, 14, 17, and
20 pt.

5 THE FORMAT MENU 5.2 Format/Character

For example, let™s suppose you want to typeset an article using a 17 pt font. You™ll use this
document preamble:


Another way to get big fonts is to use the package type1cm, which provides commands like the

No Smoking

(The example above is way too large to ¬t on this page. . . )
Parameters are font size and baseline. Yet another approach is this:

1-cm tall
\resizebox{!}{1cm}{1-cm tall}

5.2.3 Format/Character Font

L TEX uses its own fonts, automatically generated when needed by the METAFONT subsystem.
This ensures portability and yields very good results. However, many of us are accustomed to
other fonts: Times, Helvetica, Sans Serif. . .
Fortunately, L TEX can use PostScript fonts. Try using one of the following packages: avant,
avangar, bookman, chancery, charter, courier, helvet, helvetic, ncntrsbk, newcent, palatcm, palatino,
pifont, times, utopia, zapfchan. Insert \usepackage{times} and enjoy the results. The only
caveat is that L TEX handles maths at its best only with Computer Modern fonts: using
PostScript fonts might render your formulas slightly less appealing.
The packages above set the font for the whole document. To use a PostScript font for a region
of text only, specify the font family as in the example below. Common font families are listed
in Table 5.

Z Beware, some font shapes may be unavailable on some systems!

This is Computer Modern Roman,
This is Computer Modern Roman, this is Hel-
this is Helvetica!}

Yet another possibility is replacing a standard L TEX font with a PostScript one: for example,
you may want to use Avantgarde whenever Computer Modern Sans Serif would appear. These
commands can be renewed as in the example below:

• \rmdefault (roman)

• \sfdefault (sans serif)

5 THE FORMAT MENU 5.2 Format/Character

Family Name
Computer Modern Roman
Computer Modern Sans Serif
cmtt Computer Modern Typewriter
New Century Schoolbook

Table 5: Common font families.

• \ttdefault (typewriter)

• \bfdefault (boldface)

• \mddefault (medium)

• \itdefault (italics)

• \sldefault (slanted)

• \scdefault (small caps)

• \updefault (upright)

% Avantgarde replaces sans serif

5.2.4 Format/Character Colour

You can colour words using the package color and appropriate commands. Prede¬ned colours
are black, white, red, green, blue, cyan, magenta, and yellow; you can also de¬ne your own.
\textcolor{red}{This is red.}\\
This text is blue!\\ This is red.
So is this. Let™s change.\\
This text is blue!
So is this. Let™s change.
This is my shade of green!
A cyan box
This is my shade of green!\\
\color{black} A green box in a blue frame
\colorbox{cyan}{A cyan box}\\
{A green box in a blue frame}

Moreover, the command \pagecolor lets you specify. . . guess what?

5 THE FORMAT MENU 5.3 Format/Paragraph

5.3 Format/Paragraph
Let™s remind what a paragraph is according to L TEX: a portion of text that either ends with
\\, or is followed by a blank line.
Environments are L TEX™s way of specifying properties like text alignment or font selection for
a given portion of text. It™s like selecting text with the mouse, then choosing the property you
wish from a menu or clicking on a button. Another way is to enclose the text between brackets.
Environments have this general form:
...text goes here...

For example, if you want to center a paragraph you™ll use the center environment:
this text is centered
this text is centered
Standard environments are listed in Table 6. In the following sections, I™ll show you what to use
and when.

5.3.1 Format/Paragraph Horizontal Alignment

By default, the text is justi¬ed. To get left“aligned, right“aligned or centered text, use the
flushleft, flushright and center environments. The commands \raggedright, \raggedleft,
and \centering are equivalent to their correspondent environments, but they do not start a
new paragraph.

5.3.2 Format/Paragraph Vertical Alignment

The way paragraphs are separated is often puzzling to word processor users. Empty lines
and multiple spaces are treated like a single empty line or space. The commands \smallskip,
\medskip, and \bigskip provide some space between paragraphs.
If you need more space, use the command \vskip{parameter } as in this example:
These paragraphs will be separated by 1.3 cm:
These paragraphs will be
separated by 1.3 cm:\\
\vskip 1.3cm
there is a 1.3 cm gap above me.
there is a 1.3 cm gap above me.

Note that \vskip only works between paragraphs. What if you wanted to start a page after an
additional margin of, say, 1.5 cm? You™ll have to use \null, which sets a ˜mark™ in the text:

\vskip 1.3 cm
This text comes after 1.3 cm...
This text comes after 1.3 cm...

5 THE FORMAT MENU 5.3 Format/Paragraph

Environment Purpose
Math arrays
Centered lines
Labelled lists
Numbered lists
Sequence of aligned equations
Displayed equation
Floating ¬gures
Flushed left lines
Flushed right lines
Bulleted lists
Generic list environment
Miniature page
Picture with text, arrows, lines and circles
Indented environment with paragraph indentation
Indented environment with no paragraph indentation
Align text arbitrarily
Floating tables
Align text in columns
Bibliography or reference list
Theorems, lemmas, etc
For hand crafted title pages
Simulating typed input
For poetry and other things

Table 6: Standard L TEX environments.

5 THE FORMAT MENU 5.4 Format/Paragraph Border and Shade

Finally, the command \vfill is used to add empty lines between two paragraphs so that the
second paragraph goes exactly to the bottom of the page. For example,

This appears at the top of the page. . .
This appears at the top of
the page{\ldots}
{\ldots}and this at the bottom.
. . . and this at the bottom.

5.3.3 Format/Paragraph Margins

Normally, the margins are set for the whole document as seen in Section 2.5. Rede¬ning them
for a section of text will not work: if you want to set a paragraph™s margins, you™ll have to create
a new environment like in the following example:

\begin{list}{} {
} \item }

Then you will use the new environment:

As you can see, this paragraph has normal
As you can see, this paragraph
has normal margins. margins.
But please note that this But please note that this paragraph
paragraph has custom margins. has custom margins.

5.3.4 Format/Paragraph Indentation

To set the amount of indentation of the ¬rst line of a paragraph, use the command \parindent.
In the following example, we set a 1-cm indentation:


The commands \indent and \noindent allow/disallow indentation on the following paragraph.
Finally, the distance between paragraphs is set by \parskip:


5.4 Format/Paragraph Border and Shade
To get framed (bordered) paragraphs or words, you have the choice of using the framed package
or the \parbox command. The package calc is required in the latter case.

5 THE FORMAT MENU 5.4 Format/Paragraph Border and Shade

This is the simplest method, using framed:
this is a framed paragraph!
this is a framed paragraph!
this is a shaded paragraph, do you like it?
this is a shaded paragraph,
do you like it?
Equivalently, use the boxedminipage package and the equally named environment. For those who
want to know more: the commands

text to be framed

are functionally equivalent to the boxedminipage environment.
This example uses \parbox:
again, a framed paragraph!
-2 \fboxsep -2 \fboxrule}
{again, a framed paragraph!}

\linewidth sets the width of the minipage equal to that of the remaining text. Obviously, you
can specify the width as you like.
Finally, to frame something adapting the frame to the width of the text:
this is a
this is a framed word

Modifying the parameter, you can adjust the frame width:
this is another
this is another framed word

Note that the second optional parameter speci¬es the alignment (to the right in this example).

6 THE TABLE MENU 5.5 Format/Colour

5.5 Format/Colour
Now that you have a bordered paragraph, you™ll want to set its colour too. Do this:
I am a minipage, my colour is yellow!
I am a minipage, my colour
is yellow!

More about colours in Section 5.2.4.

5.6 Format/Columns
The commands \twocolumn and \onecolumn start a new page and set the number of columns;
they can also be used as parameters in \documentclass. If this is not enough for you, the
package multicols provides an environment of the same name. I could have set this section in
two columns with these commands:

The commands \cmd{twocolumn} ...

The space between columns is controlled by the parameter \columnsep, and the thickness of the
rule between columns by \columnseprule. The text given as optional parameter in brackets is
excluded from the environment.

6 The Table Menu
Quite a complex subject. . . A table is a ¬‚oat (as explained in Section 4.12) that must ¬t on
one page. It usually contains a tabular environment, even though other possibilities exist. By
default, a table adjusts its width to match the width of its contents.
This is the general format of a table:

\begin{table}[htbp] % placement: here, top, bottom, separate page
% \begin{small} % sets the table font
\begin{center} % optional
% 4-column table; alignment is left, centered, right, fixed width
\hline % horizontal line
\textbf{Left} & \textbf{Centre} & \textbf{Right} & \textbf{4 cm} \\
row 1, col 1 & row 1, col 2 & row 1, col 3 & row 1, col 4 \\
\cline{1-2} % horizontal line spanning columns 1-2
row 2, col 1 & row 2, col 2 & row 2, col 3 & row 2, col 4 \\


\multicolumn{2}{|c|}{spanning two columns} & row 3, col 3 &
row 3, col 4 \\
row 4, col 1 & row 4, col 2 & row 4, col 3 & ˜ \hfill right \\
% force a space with "\ "
row 5, col 1 & row 5, col 2 & row 5, col 3 & left \hfill ˜ \\
row 5, col 1 & row 5, col 2 & row 5, col 3 &
˜ \hfill centre \hfill ˜ \\
\caption{A sample table.}
% labels are used for cross references;
% for example, "see Table˜\ref{tab:sampletab}"
% \end{small}

Table 7 shows the result.

Left Centre Right 4 cm
row 1, col 1 row 1, col 2 row 1, col 3 row 1, col 4
row 2, col 1 row 2, col 2 row 2, col 3 row 2, col 4
spanning two columns row 3, col 3 row 3, col 4
row 4, col 1 row 4, col 2 row 4, col 3 right
row 5, col 1 row 5, col 2 row 5, col 3 left
row 5, col 1 row 5, col 2 row 5, col 3 centre

Table 7: A sample table.

Sometimes, a table is too wide and won™t ¬t on the page. In that case, the rotating package
provides the new environment sidewaystable. Also, rotating makes it possible to rotate the
contents of a cell by a speci¬ed angle. Finally, the tabularx package lets one specify tables of
¬xed width: the X column speci¬er indicates that a column can be spread as needed.
Here™s an example:

6 THE TABLE MENU 6.1 Line Spacing


\textbf{normal} & \textbf{tilted} &
\textbf{wider} \\

! ed

normal & \rotatebox{30}{I™m tilted!} &

I™m wider \\



The standard tabular environment cannot span more than one page. There are some packages
that overcome this limitation: you will want to try out longtable, supertabular, and xtab.
To enable colours in tables, you use the colortbl package:
Colour by row:\\\vskip 2mm
Colour by row:
one & two & three\\
one two three
one & two & three\\ one two three
\rowcolor{yellow} one two three
one & two & three\\

Colour by column:\\\vskip 2mm
Colour by column:
one two three
one two three
one & two & three\\
one two three
one & two & three\\
one & two & three\\

6.1 Line Spacing
A line adjusts itself to the height of the text it contains. To add some space before a line, the
trick is to start it with a \rule of 0 length and speci¬ed height. To add space after a line, use

6 THE TABLE MENU 6.2 Aligning Numbers

\\ followed by optional space. Here is an example:

\begin{tabular}{lll} one two three
one & two & three\\
0.3 centimeters after this line
0.3 centimeters & \textbf{after} &
this line\\[0.3cm] one two three
one & two & three\\
one two three
one & two & three\\
\rule{0pt}{1.2cm}1.2 centimeters &
\textbf{before} & this line\\
1.2 centimeters before this line

6.2 Aligning Numbers
A special case of a tabular environment is when we want to align numbers with respect to the
decimal positions.
The simplest method is using the @ column speci¬er, which in practice is useful in tables con-
taining only numbers. The column separator & is replaced by the decimal dot:
100&00000 100.00000

Alternatively, use the dcolumn package, which adds the D column speci¬er. D has three argu-
ments: the separator to use in the L TEX source and in output (usually the same, ˜.™), and the
number of digits to the right of the decimal place indicator. Optionally, the third argument can
specify the number of digits to the left and to the right of the decimal place indicator, separated
by a dot. Lastly, if the third argument is -1, the material of the column is centered around the
All material in the table is typeset in math mode. To insert headings, you™ll have to put the
text in an \mbox.
One Two Three
\mbox{One} & \mbox{Two} &
10,33 10.33 10.33
\mbox{Three} \\
1000 1000 1000
10.33 & 10.33 & 10.33 \\
5,1 5.1 5.1
1000 & 1000 & 1000 \\
5.1 & 5.1 & 5.1 \\ 3,14 3.14159 3.14159
3.14 & 3.14159 & 3.14159 \\

6.3 Using slashbox
This package add the \backslashbox command:

6 THE TABLE MENU 6.4 Importing Data in L TEX Tables

\backslashbox[2cm]{Lesson}{Date} & PP
Monday Tuesday
Monday & Tuesday \\ P
Lesson PP P
\hline P
Stratigraphy room A room A
Stratigraphy & room A & room A \\
Chemistry room B Lab ±
Chemistry & room B & Lab $\alpha$ \\
Physics room C Lab β
Physics & room C & Lab $\beta$ \\
TODO: mention \newcolumntype and ¬‚oat¬‚t

6.4 Importing Data in L TEX Tables

For many people, data ¬les are the bread and butter of everyday™s work. Most data ¬les are
simply ASCII text with columns of numbers, but some people use spreadsheets. Nearly all
spreadsheet applications can export sheets in the ASCII-based .cvf ¬le format; values are
separated by the ˜;™ character.
Converting a data ¬le into a L TEX table is quite a tedious process. The following script for
Unix will convert a data¬le with an arbitrary number of columns to a table. It will also work
on .cvf ¬les.


# dat2tex: converts tabular data to a tabular environment

if [ $# != 1 ]; then
echo "Usage: $0 <datafile>"
exit 1

# is this a cvs file?
grep ";" $1 > /dev/null
if [ $? = 0 ]; then
AWK="awk -F;"

# ok awk, make my day
$AWK ™{if (1 == FNR) { \
printf "\\begin\{tabular\}\{"; \
for (i = 1; i <= NF; i++) {printf "l"}; \
printf "\}\n"
for (i = 1; i < NF; i++) \
{printf $i" & "} printf $NF" \\\\ \n"} \
END {printf "\\end\{tabular\}\n"}™ $1

# end of dat2tex


7 The Tools Menu
7.1 Tools/Mail Merges
This useful and time-saving tool is implemented in L TEX by the textmerg package. Let™s consider
a simple document, in which the name, surname, and title of people we™re writing to may vary.
The remaining text does not change.
We™ll de¬ne three ¬elds, which are the variable part of the text: \Name, \Surname, and \Title.
Their values will be gathered from an external ¬le, data.dat.

% let™s declare the variable fields:
% \Void is for empty lines
Dear \Title{} \Surname,\\
may I call you \Name?\\

The fourth ¬eld, \Void, isn™t really necessary and it™s there for illustration. It™s preceded by
a minus sign, which indicates that it can be empty in the data ¬le. Simply put, we want to
separate the records using empty lines.
The ¬le data.dat reads:



John-Paul II

That™s it: the resulting output will contain the merged text, one page for each recipient.

7.2 Tools/Labels
If making mail merges was easy, making labels is even trivial. Let™s suppose you want to make
20 equal labels on a 3—8 peel“o¬ label sheet. The package to use, predictably, is called labels.
In this example, we™ll make 10 plain labels and 10 boxed labels:

7 THE TOOLS MENU 7.2 Tools/Labels

\LabelCols=3 % n. of columns of labels
\LabelRows=8 % n. of rows of labels
\LeftBorder=8mm % borders of each label
\LabelGridtrue % show the grid
\numberoflabels=10 % number of labels of each type to print
% the text of the label is specified by
% the \addresslabel[]{} macro:
\addresslabel[\large] % optional arguments
{\textbf{Guido Gonzato}, Ph.D.\\
\textsl{Linux system manager}}
% now on to the boxed labels
{\textbf{Guido Gonzato}, Ph.D.\\
\textsl{Linux system manager}}

To make labels containing di¬erent addresses, you may use either an external ¬le or insert the
addresses in the main ¬le:

% use either this environment:
1$^{st}$ name
1$^{st}$ address
1$^{st}$ city, state, zipcode

2$^{nd}$ name
2$^{nd}$ address
2$^{nd}$ city, state, zipcode

3$^{rd}$ name
3$^{rd}$ address
3$^{rd}$ city, state, zipcode
% or an external file containing exactly the same text:
% \labelfile{addresses.dat}

7 THE TOOLS MENU 7.3 Tools/Default Language

It is left to you to combine textmerg and labels!

7.3 Tools/Default Language
L TEX default language is English, but other languages are supported. By language support I
mean the translation of terms like ˜Chapter™ or ˜Index™, correct hyphenation, and the possibility
of inserting characters like ˜¸™ or ˜´™ directly via your keyboard. (The normal way being typing
c e
\c c and \™e.)
Your L TEX distribution contains a ¬le called language.dat (teTEX places it in $TEXMF/tex/
generic/config/language.dat that contains a list of languages. Editing this ¬le you choose
the languages for which you want hyphenation patterns.
If you are not a native English speaker, you™ll want to use the package babel like in the following


In addition, to type accented letters and in general non-standard ASCII characters3 you may
want to use the package isolatin1. However, this is not a recommended practice, because it
reduces the legibility and portability of your ¬le: you had better stick to the TEX way.
If you just can™t stand typying all those three- or four-letter clusters, then you could con¬gure
your editor to type those for you. For example, I set up my editor of choice (jed) to have it
insert \™e whenever I type ˜´™. I included this in my .jedrc:

define latex_mode_hook ()
set_abbrev_mode (1);
if ( () = abbrev_table_p ("LaTeX") )
use_abbrev_table ("LaTeX");
#ifdef WIN32
% prevent clash with movement keys
undefinekey ("``", "LaTeX-Mode");
definekey (" \\˜a", "``", "LaTeX-Mode");
local_setkey (" \\˜a", "`");
local_setkey (" \\™e", "´");
local_setkey (" \\˜e", "`");
local_setkey (" \\˜\\i{}", "`");
local_setkey (" \\˜o", "`");
local_setkey (" \\˜u", "`");

Please consult your editor™s documentation.
in computer jargon, ˜standard ASCII characters™ are the characters whose code is included between 32 (space)
and 126 (tilde).

8 THE HELP MENU 7.4 Tools/Hyphenation

7.4 Tools/Hyphenation
Although L TEX does a good job at hyphenating words, sometimes manual intervention may
yield better results. Manual hyphens are speci¬ed inserting \- where we want the word to be
broken. A better way is to declare hyphenation rules:

\hyphenation{ge-o-phy-sics, ge-o-lo-gy, earth}

The above declaration instructs L TEX not to hyphen the word ˜earth™. Another way to prevent
a word to be hyphenated is to put it in \mbox:

Do not hyphen \mbox{internationalisation}, please.

7.5 Tools/Spell Check
L TEX is not aware of spell spelling. This task is done using external tools like ispell, aspell
or others. Under Unix, you can use ispell this way:

shell> ispell -t mydocument.tex

The -t switch instructs ispell to ignore TEX and L TEX commands. If your language is not
English, specify the appropriate dictionary with the -d switch:

shell> ispell -d italiano -t mydocument.tex

8 The Help Menu
There are many ways of getting help with L TEX, both online and o¬„ine. The best place to start
is the CTAN site, http://www.ctan.org/tex-archive/info/.

• info latex (Unix systems) gives a concise but very complete on-line summary of com-
mands and concepts;

• http://www.giss.nasa.gov/latex/ is a comprehensive on-line reference. Lots of useful

• http://www.ctan.org/tex-archive/info/LatexHelpBook/ is a very nice help system
for L TEX, fully integrated with Windows.

• don™t forget the news:comp.text.latex newsgroup: it™s an invaluable source of help.

Many GNU/Linux distributions ship with teTeX, one of the most complete TEX/L TEX systems.
A lot of documentation is provided, and is usually found in TEXMF/doc. Point your browser
there, and be happy.


9 The End
This document is copyright c Guido Gonzato, 2001“2003, and released under the GNU General
Public Licence. I really hope you™ll ¬nd this guide useful. For any suggestions or comments,
please feel free to contact me.


A Document Templates
A template for the class article was presented in Section 2.1. More examples are shown in the
following ¬gures.
\title{The Book of Mine}
\author{John B. Smith}
\part{The Beginning}
\section{Let™s Start}
The book starts here.
\part{The End}
Thank you for reading this book.

Figure 3: Book template.


% tables and figures at the end:
\title{Final Report}
\author{John B. Smith}
\date{London, \today}
This is the final report.
The report starts here.

Figure 4: Report template.

\address{My address}
\begin{letter}{John™s address}
\opening{Dear John,}
Thank you for being my friend.
\closing{Hope to see you soon,}
\ps{P.S. Say hello to granny!}
\encl{My son™s photographs!}

Figure 5: Letter template.


\vskip 1cm
\centerline{\textcolor{red}{DO NOT}}
\vskip 1cm
\centerline{\textcolor{magenta}{If you do,}}
\centerline{\textcolor{magenta}{you™ll be \emph{deboned!}}}

Figure 6: How to write a notice.


\setlength{\TPHorizModule}{10mm} % standard unit of length
\setlength{\TPboxrulesize}{1pt} % box line width
% start everything near the top-left corner

% this block is 5 modules wide; height is
% automatically determined
\begin{minipage}[c]{0.8 \linewidth}
This block is placed with its top left corner at the ˜origin™
on the page, which has been set to (0mm,0mm). The internal
margin and the shading are provided by the \texttt{minipage}
and \texttt{shaded} environments.
This picture is at (10,1). Note that rotating it
by -90 makes it overflow the margin.
This block is at position (2.5,8), but because the optional
argument [0.5,0.5] has been given, it is the centre of the block
which is located at that point, rather than the top-left corner.
The dimensions of this block are 3$\times$4 cm.
Its origin is position (6,4) on the page. Note that the text
overflows the margin in some cases; you™ll want to
use the \texttt{minipage} environment to prevent that.

Figure 7: How to write a poster.



. 2
( 2)