. 1( 2) >>
L TEX for Word Processor Users
A

version 1.0.6
Guido Gonzato, Ph.D.
<guido.gonzato@univr.it>

Universit di Verona (Italy)
a
Facolt di Scienze MM. FF. NN.†
a
December 9, 2003

Abstract
Text processing with L TEX o¬ers several advantages over word processing. However, it
A

is often hard for beginners to ¬gure out how to perform common tasks and obtain certain
features. This manual attempts to ease the transition by drawing comparisons between word
processing and L TEX typesetting. The main word processor capabilities are listed, along with
A

their equivalent L TEX commands. Lots of examples are provided.
A

Contents
1 Introduction 1
1.1 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.1 Editor-Supported Features .................................... 3
1.1.2 Adding Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 The Golden Rules ............................................. 5

2.1 File/New . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 File/Save As. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 File/Save As Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 File/Import ................................................. 6
2.5 File/Page Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.5.1 Page Setup/Headers and Footers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.6 File/Printer Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.7 File/Print Preview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.8 File/Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.9 File/Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.1 Edit/Autotext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Ca™ Vignal II, Strada Le Grazie 15, 37134 Verona (Italy)

i
4.1 Insert/Breaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 Insert/Enumerated List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3 Insert/Special Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
The ¤ Sign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.1 13
4.4 Insert/Formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.5 Insert/Footnote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.5.1 Footnotes at End of Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.6 Insert/Indices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.7 Insert/Vertical and Horizontal Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.8 Insert/Tabs ................................................. 15
4.9 Insert/Cross Reference ........................................... 15
4.10 Insert/Margin Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.11 Insert/Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.12 Insert/Figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.12.1 Wrapping Floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.13 Insert/Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.14 Insert/Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.15 Insert/Hyperlink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.16 Insert/Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

5.1 Format/Line Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.2 Format/Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2.1 Underline styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2.2 Format/Character Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2.3 Format/Character Font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2.4 Format/Character Colour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.3 Format/Paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.3.1 Format/Paragraph Horizontal Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.3.2 Format/Paragraph Vertical Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.3.3 Format/Paragraph Margins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3.4 Format/Paragraph Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.4 Format/Paragraph Border and Shade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.5 Format/Colour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.6 Format/Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

6.1 Line Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.2 Aligning Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.3 Using slashbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.4 Importing Data in L TEX Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
A

7.1 Tools/Mail Merges ............................................. 35

ii
1 INTRODUCTION

7.2 Tools/Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7.3 Tools/Default Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.4 Tools/Hyphenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
7.5 Tools/Spell Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

9 The End 39

A Document Templates 40

List of Tables
1 Useful key bindings for Emacs, Vim, and Jed in IDE mode. . . . . . . . . . . . . . . . . . . . . . . 4
2 How to obtain some special characters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3 Font attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4 Font sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5 Common font families. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6 Standard L TEX environments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
A

7 A sample table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

List of Figures
1 A smiley representing the author of this guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2 A Gnuplot graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3 Book template. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4 Report template. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5 Letter template. .............................................. 41
6 How to write a notice. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7 How to write a poster. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

1 Introduction
First of all, let me state that this is not a L TEX primer! If you™re reading this, I assume that you
A
have at least a smattering of L TEX and its basic commands. In this document, I™ll explain why
A
L TEX is a viable alternative to word processors. One may even think that L TEX is better than
A A
any word processor. . . and this is de¬nitely true, especially if you write complex documents
with lots of maths.
Nevertheless, word processors are the ˜killer app™ in modern o¬ce automation. They™re perceived
to be easier than L TEX as they have a friendly WYSIWYG interface, and the average secretary
A
will learn to use them in a relatively short time. The problem is, these beasts keep growing slow,
bloated1 , buggy, expensive, virus ridden, and incompatible with each other.
1
once upon a time, I wrote my thesis on a 128k, Z80-based home computer. The word processor WordStar
and my thesis ¬t on a single CP/M-bootable 720K ¬‚oppy, with lots of room to spare!

1
1 INTRODUCTION 1.1 Preliminaries

L TEX might be a good alternative. It actually is, but if you try to write casual, unstructured
A
documents, L TEX will rightly stand in the way. You could resort to plain TEX, but you would
A
lose many facilities that L TEX provides.
A

To sum up, sometimes you may want to use word processor-like features”but using L TEX. It
A
would be nice to know how to obtain some e¬ects with L TEX when you know how to get them
A
with your once-favourite :-) word processor.
That™s why I wrote this quick reference. As I said, it assumes that you already have a basic
understanding of L TEX; if not, I suggest that you go to http://www.ctan.org/starter.html
A
and download ˜The (Not So) Short Introduction to L TEX2e™ (and possibly ˜A Gentle Introduction
A
to TEX™).
In the following sections, we shall navigate through the menus and menu items of an imaginary
word processor, ¬nding out the corresponding L TEX way of doing the same work. If you™re a
A
L TEX purist and this approach makes you sick. . . don™t hurt yourself, please stop here.
A

1.1 Preliminaries
Many word processor features are implemented by the editor; others by standard L TEX com-
A
mands; others still are obtained using packages. These are sets of macros that extend L TEX
A
providing new commands and environments. There are lots of packages around: the only prob-
lem is knowing where they are, what they do, and how to install them. More about packages in
Section 1.1.2.
Packages and other TEX-related material are available at many sites that constitute the CTAN,
the Comprehensive TeX Archive Network. I already mentioned http://www.ctan.org; this site
has a comprehensive list of mirrors. From now on, CTAN: means ˜your favourite CTAN mirror
here, starting from the TEX directory™. For instance, you can get L TEX for your platform from
A
CTAN://systems (e.g. http://www.tex.ac.uk/tex-archive/systems/).
Another obvious question is this: L TEX will typeset the text for me, but what should I use
A
to write it? The answer is: a good editor ”a L TEX-aware one, if possible. There exist editors
A
dedicated to writing L TEX source, and some are WYSIWYG or nearly so.
A

Although any editor capable of saving plain text will do (even Windows™ notepad), most
TEXnicians will recommend that you use one of the following:

• GNU Emacs (http://www.gnu.org/software/emacs/emacs.html) or Xemacs (http://
www.xemacs.org) with AUC TEX, CTAN://support/auctex/;

• vi or one of its clones, Vim (http://www.vim.org) being the most popular;

• my personal choice is Jed (http://www.jedsoft.org/jed/), a light Emacs clone that
also supports emulation of other editors. I wrote a L TEX mode for Jed, available from
A
CTAN://support/jed;

• Kile (http://kile.sourceforge.net), a very nice and complete L TEX shell for the KDE;
A

• Texmaker (http://perso.club-internet.fr/pascal.brachet/texmaker/index.html)
is very similar to Kile, but doesn™t require KDE;

2
1 INTRODUCTION 1.1 Preliminaries

• LyX (http://www.lyx.org), a nearly-WYSIWYG text processor, less advanced as an
editor but undoubtedly easier for beginners;

• GNU TEXmacs (http://www.texmacs.org), an impressive WYSIWYG L TEX word pro-
A
cessor for Unix;

• WinEdt (http://www.winedt.com), probably the most popular L TEX shell for Windows.
A
Unlike all of the free software above, it™s shareware;

• a comprehensive list of L TEX shells for Windows can be found at http://home.arcor.
A
de/itsfd/texwin.htm. I suggest that you have a look at TeXnicCenter and WinShell;

• ¬nally, information about L TEX on the Mac can be found at http://www.esm.psu.edu/
A
mac-tex/.

These editors boast syntax highlighting and many other helpful features that help write L TEX
A
source code.

1.1.1 Editor-Supported Features

L TEX is just a formatter: things like cut and paste, search and replace etc. are delegated to the
A
editor. Table 1 summarises the main commands of popular editors for geeks: GNU emacs and
vim with their native key bindings, and jed con¬gured for Borland IDE key bindings.

The following applies to teTeX, which ships with most GNU/Linux distributions. Directions for
MiKTEX below.

1. get the package (typically as a gzip-compressed tar archive) from your favourite CTAN
mirror;

2. ¬nd out the location of L TEX packages; most likely, $TEXMF/tex/latex; A 3. as root, unpack the package under that directory; 4. If no .sty ¬le exists, run the command latex newstyle.ins or latex newstyle.dtx to create it; 5. run the command texhash so that teTeX recognises the new package. The exact location of$TEXMF depends on the system; in most GNU/Linux distributions, it™s
/usr/share/texmf.
If you don™t have root privileges, you can install packages in a subdirectory of your $HOME: say,$HOME/texmf. All you have to do is put the .sty ¬les there, and add this line in your
$HOME/.bash profile: export TEXINPUTS="˜/texmf:" 3 1 INTRODUCTION 1.1 Preliminaries Action Emacs Vim Jed command mode Alt-X ESC Alt-X insert mode n/a n/a iaoO line editor mode n/a n/a : ¬le operations open ¬le Ctrl-X Ctrl-F :e Ctrl-KE insert ¬le Ctrl-Xi :r Ctrl-KR save ¬le Ctrl-X Ctrl-S :w Ctrl-KD save as Ctrl-X Ctrl-W name :w name Ctrl-KS close ¬le Ctrl-XK :q Ctrl-KQ change bu¬er Ctrl-XB bN Ctrl-KN undo Ctrl-XU u Ctrl-U redo Ctrl-^ Ctrl-R Ctrl-G Ctrl-U exit Ctrl-X Ctrl-C :qa! Ctrl-KX moving around word left Alt-B b Ctrl-A word right Alt-F w Ctrl-F start of line Ctrl-A 0 Ctrl-QS end of line Ctrl-E$ Ctrl-QD
page up Alt-V Ctrl-U Ctrl-R
page down Ctrl-V Ctrl-D Ctrl-C
start of bu¬er Alt-< 1G Ctrl-QR
end of bu¬er Alt-> G Ctrl-QC
line n. Alt-G n. n.G Ctrl-QI
deleting
character left Ctrl-H X BS
character right Ctrl-D x Alt-G
word left Alt-DEL db Alt-BS
word right Alt-D dw Ctrl-T
I like math: $x^n + y^n \neq I like math: xn +y n = z n ∀n = 2 is my favourite z^n \forall n \neq 2$
theorem.
is my favourite theorem.

The environments displaymath and equation typeset formulae aside from the text. The latter
adds an equation number for later reference:
Fermat™s Last Theorem is
defined as:
Fermat™s Last Theorem is de¬ned as:

x^n + y^n \neq z^n
xn + y n = z n ∀n = 2 (1)
\forall n \neq 2
\label{eq:fermat}
Can you prove Eq. 1?

Can you prove
Eq.˜\ref{eq:fermat}?

4.5 Insert/Footnote
The command \footnote[n]{footnote text} is all you need; the optional parameter [n]
modi¬es the footnote number. To use a symbol or arbitrary text instead of a number, rede¬ne
the counter associated with \footnote:
This footnoteread me! says it all.
This footnote\footnote
{I mean this one.} read me!
I mean this one.
says it all.
Using this method, you can get footnote numbers in roman numerals, or replaced by nice sym-
bols:

13
4 THE INSERT MENU 4.6 Insert/Indices

\renewcommand{\thefootnote}
{\Roman{footnote}}
ThisII is the ¬rst footnote, and thisII is the
This\footnote{The first.}
second. The end.†
is the first footnote,
and this\footnote{The second.} II
The ¬rst.
is the second. II
The second.
\renewcommand{\thefootnote} †
At last!
{\fnsymbol{footnote}}
The end.\footnote[8]{At last!}
Note the \fnsymbol{footnote} thing. It uses 9 symbols associated with the values 1. . . 9 of
the footnote counter: — † ‡ § ¶ —— †† ‡‡.
To make several references to the same footnote, don™t write its number explicitly. Rather, do
this:
This\footnote{the first.}
\newcounter{\myfootnote}
\setcounter{\myfootnote}
note1 again.
{\value{footnote}}
and that\footnote{the second.} 1
the ¬rst.
the second.
\footnotemark
[\value{\myfootnote}] again.
Warning: minipages use their own counters, mpfootnote and thempfootnote.

4.5.1 Footnotes at End of Document

The endnotes package lets you move all footnotes at the end of the document. You™ll have to
add this line to the preamble:

\let\footnote=\endnote

and these lines as the last thing in your document:

\newpage
\begingroup
\parindent 0pt
\parskip 2ex
\def\enotesize{\normalsize}
\theendnotes
\endgroup

4.6 Insert/Indices
L TEX. All you have to do is insert these lines before the ¬rst \section or \chapter of your
A
document:

14
4 THE INSERT MENU 4.7 Insert/Vertical and Horizontal Space

\tableofcontents
\listoffigures
\listoftables

4.7 Insert/Vertical and Horizontal Space
This entry doesn™t actually exist in any word processor I am aware of. This is in fact a limitation
that L TEX ¬lls in a very elegant way.
A

Space ¬lling is used to center text horizontally, vertically, or both; this is a di¬cult task to
perform with any word processor, and requires a lot of trial end error. Use a combination of
\null or ˜ to set ¬xed marks, followed by \vfill and \hfill like in this example:
one \hfill two\\ one two
\vfill
˜ \hfill three \hfill ˜\\
three
\vfill
four \hfill five
four ¬ve
\null
Normally, L TEX won™t let you insert blank spaces at your will. However, if you do want to make
A
your document look messy, use ˜ to make a non-breakable space.
Also, use the command \hspace like in this example:
This is a \hspace{2cm}
This is a 2-cm-wide hole.
2-cm-wide hole.

4.8 Insert/Tabs
The tabbing environment provides a rough equivalent to the action of the TAB key. See this
example:
\begin{tabbing}
% let™s set the tab positions
˜ \hspace{1cm} \= ˜ \hspace{2cm} \=
Zero One Two Three
˜ \hspace{3cm} \= \kill % discard text
Zero One Three
Zero \> One \> Two \> Three \\
Zero Two Three
Zero \> One \> \> Three \+ \\ % go right
Zero One Two
Zero \> Two \> Three \- \\ % go left
Zero \> One \> Two \\ new tab 1. . . new tab 2
\pushtabs % save tab positions new tab
new tab 1{\ldots} \= new tab 2 \\
Zero One Two Three
new \> tab \\
\poptabs % restore tab positions
Zero \> One \> Two \> Three
\end{tabbing}

4.9 Insert/Cross Reference
The commands \label, \ref, and \pageref are all you need to insert labels in the text and do
cross referencing. The standard format of labels is the prefix:suffix form, where prefix is

15
4 THE INSERT MENU 4.10 Insert/Margin Notes

one of the following: cha for chapters, eq for equations, fig for ¬gures, sec for (sub)sections,
and tab for tables.
References to a page (section, table, ¬gure, etc.) number can be obtained using \label and
\ref as in this example:
\paragraph{Example.}
\label{par:example}
Example. This paragraph appears in Sec-
This paragraph appears
tion 4.9 on page 16.
in Section˜\ref{par:example}
on page \pageref{par:example}.

Of course, you may use your own pre¬xes. For example, take this enumerated list:
\begin{enumerate}
\ref{item:end} \label{item:start}}
2. another step (unreferenced)
\item{another step (unreferenced)}
\item{end: go back to
3. end: go back to 1
\ref{item:start} \label{item:end}}
\end{enumerate}

4.10 Insert/Margin Notes
Very simple: use \marginpar{text}.

4.11 Insert/Frame
Let™s imagine you want to typeset a poster or a sign: you™ll need a way to put text and ¬gures on
¬xed position on the page. Use the textpos package, as shown in the example listed in Figure 7
(see Appendix A).
A simpler approach is using minipages: literally, minia-
ture pages. This text is included in a minipage environ-
ment. Actually, to be more precise, a boxedminipage,
courtesy of the boxedminipage package. I used this dec-
laration:

\begin{boxedminipage}[c]{0.6\linewidth}
... text ...
\end{boxedminipage}

4.12 Insert/Figure
(The reference guide for graphic inclusion in L TEX is ˜Using Imported Graphics in L TEX2e™,
A A
a.k.a. epslatex.ps.)
A ˜¬gure™ can be not only a picture, but also a portion of text, a table, etc. that you put in a
figure environment. This is an example:
b
Please note that ¬gures are not guaranteed to appear exactly where you write the code! In fact,

16
4 THE INSERT MENU 4.12 Insert/Figure

\begin{figure}[htbp]
% [htbp] specifies the
% preferred placement: here, top,
=8-)
% bottom, or separate page.
\begin{center}
\texttt{=8-)}
Figure 1: A smiley representing the
\end{center}
author of this guide.
\caption{A smiley representing
the author of this guide.}
\label{fig:mysmiley}
\end{figure}

the main di¬erence with word processors is that ¬gures don™t have a ¬xed placement; they ˜¬‚oat™
to the optimal position that L TEX ¬nds for them. So, the text shouldn™t refer to a ¬gure like
A
˜the ¬gure below™ or ˜the ¬gure above™; rather, use ˜see Figure˜\ref{fig:label}™.
Owing to this property, ¬gures and tables are called ¬‚oats. If you do need to position a ¬‚oat
exactly, use the here package that provides an optional placement argument H.
Given a picture in Encapsulated PostScript (.eps) format, you insert it in a L TEX source ¬le
A
using the graphicx package and commands like those shown in Figure 2.

Gnuplot 3D graph

sin(x*x + y*y)/(x*x + y*y)
\begin{figure}
Z
\begin{center}
1
\fbox{\includegraphics 0.8
0.6
0.4
[width=0.5\textwidth, angle=-90] 0.2
0

{gnuplot.ps}} -0.2
-0.4

\caption{A Gnuplot graph.} 4
3
2
1
\label{fig:gnuplot} -4 0
-3
-2 Y
-1
-1
-2
0
1 -3
2
\end{center} X 3
4 -4

\end{figure}

Figure 2: A Gnuplot graph.

When you typeset your document with \latex then dvips, graphic inclusion only works with
EPS ¬les; pdflatex accepts JPG, PNG, and of course PDF ¬les.
There are several packages that convert common graphic formats like .jpg, .gif, .png etc. to
.eps; for example, ImageMagik (http://www.imagemagik.org) and The GIMP (http://www.
gimp.org). However, these applications produce huge PostScript ¬les.
Best results are obtained using applications that wrap the bitmap, turning it into a compact
PostScript ¬le. You™ll want to use jpeg2ps (http://www.pdflib.com/jpeg2ps/index.html)
or bmeps (CTAN://support/bmeps). The former is often the best choice for wrapping .jpg ¬les,
but the latter handles more graphics formats.

Z If you use PDFL TEX, you must convert your pictures to .pdf with the command epstopdf
A
and modify the source accordingly!

17
4 THE INSERT MENU 4.12 Insert/Figure

If you wish to make both .pdf and .ps from the same source ¬le, include these commands:

% define the variable \ifpdf
\newif\ifpdf
\ifx\pdfoutput\undefined
\pdffalse
\else
\pdfoutput=1
\pdftrue
\fi
...
% include the right options
\ifpdf
\usepackage[pdftex]{graphicx}
\pdfcompresslevel=9
\else
\usepackage{graphicx}
\fi
...
% include the right graphic file
\ifpdf
\includegraphics{file.pdf}
\else
\includegraphics{file.eps}
\fi

Z If you have more than 18 ¬gures without text between them, you™ll get the ˜Too many unpro-
cessed ¬‚oats™ L TEX error. The quickest way to solve this problem is to put \clearpage after
A
three or four ¬gures.

4.12.1 Wrapping Floats

For a magazine-like layout, use the wrap¬g package:
If you meet this guy, give him some money.

\begin{wrapfigure}[4]{l}[5pt]{2cm}
{\Huge If you meet this guy, give him some money.
\texttt{=8-)} The reason may not be apparent
}
to you, but I can assure that your
=8-)
\end{wrapfigure}
money will end up in good hands.
I say again, if you meet this guy,
The reason may not be apparent to you,
give him some money: he knows how to use it
but I can assure that your money
properly. OK?
will end up in good hands.
I say again, if you meet this guy,
give him some money: he knows how to
use it properly. OK?

18
4 THE INSERT MENU 4.13 Insert/Shapes

The parameters are the number of lines to be narrowed, the ¬gure placement, the overhang, and
the ¬gure width.
Another package to perform the same action is ¬‚oat¬‚t:
Sator arepo tenet opera rotas.
Sator arepo tenet opera rotas.
\begin{floatingtable}{
\small
Sator arepo tenet opera rotas. Sator arepo
\begin{tabular}{l}
tenet opera rotas.
\hline
Sator arepo tenet
\textbf{Floating table}\\ Floating table
opera rotas. Sator
Text flows around.\\ Text ¬‚ows around.
\hline arepo tenet opera
\end{tabular}} rotas. Sator arepo tenet opera rotas. Sator
\end{floatingtable}
arepo tenet opera rotas.
Sator arepo tenet opera rotas.
Sator arepo tenet opera rotas.
Sator arepo tenet opera rotas.
Sator arepo tenet opera rotas.

4.13 Insert/Shapes
L TEX provides a picture environment whithin which you use commands like \circle, \oval
A
and so on. In my opinion, drawing pictures without a graphical environment is just too hard,
and picture has several limitations too. It™s much better to use the epic and eepic packages
(include them in that order), together with the drawing program X¬g (http://www.xfig.org).
It™s only available for Unix.
X¬g looks ugly, but is very powerful. One of its greatest advantages is that it exports draw-
ings in several formats, among which is eepic macros. These, in turn, produce very compact
PostScript ¬les. Another bonus is that text objects will be rendered by L TEX if their ˜special
A
¬‚ag™ ¬eld is set, letting you enter ordinary L TEX formulae and symbols in drawings.
A

So, let™s suppose you made a drawing called small.fig. Select File/Export. . . and choose ˜LaTeX
picture + eepic macros™ from the Language menu. You™ll obtain another ¬le, small.eepic. To
include the drawing in a document:

This is a picture drawn with X¬g:

This is a picture ¨¥¦¤¢
£¡
§
drawn with Xfig:\\
\input{small.eepic}


 


Unfortunately, eepic doesn™t work with pdflatex. As an alternative, you should export the draw-
ing as ˜Combined PS/LaTeX (both parts)™. You™ll get two ¬les, small.pstex and small.pstex t.
Rename the latter to small.tex and edit it to insert these lines at the top:

\documentclass{article}
\usepackage{graphicx}

19
4 THE INSERT MENU 4.14 Insert/Line

\pagestyle{empty}
\begin{document}

and this line at the bottom:

\end{document}

Compile it as usual, convert the .ps to .eps and include it as explained in 4.12.
If you wish to do real magic, then check out pstricks: http://www.tug.org/applications/
PSTricks/. It lets you make ¬ne PostScript drawings in L TEX. Another wonderful pro-
A
gram is ePiX (http://mathcs.holycross.edu/˜ahwang/current/ePiX.html), specialised in
producing scienti¬c plots and ¬gures for inclusion in L TEX documents.
A

4.14 Insert/Line
Draw lines of any length and thickness with \rule:
This is a page-wide
This is a page-wide rule:
rule:\\
\rule{\linewidth}{1pt}
but this one is shorter but this one is shorter and thicker:
and thicker:\\
\rule{2cm}{2mm}

Another interesting ˜line™ is that made of dots (\dotfill), often used to relate things. This is
how it™s done:

Total price . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ¤ 10
Total price \dotfill \EUR˜10

The url package lets you write URLs and have them hyphenated correctly. When used to-
gether with the package hyperref and dvipdf or pdflatex, url lets you make browseable .pdf
documents! For instance, this document uses this declaration:

\usepackage{url}

Let™s see an example:
The \hypertarget{ctan}{CTAN} main site
is \url{http://www.ctan.org}, a.k.a
\href{http://www.ctan.org}{CTAN://}. The CTAN main site is http://www.ctan.
org, a.k.a CTAN://.
Listen to \href{run:midifile.mid}
Listen to this MIDI ¬le.
{this MIDI file}.
back to the top.

20
5 THE FORMAT MENU 4.16 Insert/Comment

The \hypertarget and \hyperlink commands provide internal links, just like HTML; \href
creates links to URLs or external ¬les. Note the run: parameter: you can run external programs
like multimedia players, o¬ce applications, whatever. As far as I know, this feature only works
On Linux and possibly other Unix variants, you™ll have to instruct Acrobat what to run when
an external ¬le is referenced. Insert lines like the following in your .mailcap or /etc/mailcap:

audio/midi;/usr/bin/timidity %s
audio/*; xmms %s
video/*; xine -pfhq %s

4.16 Insert/Comment
This is done inserting % before each line, or by using the package comment that provides the
environment of the same name.

In general, the main format properties of a document are set with parameters in \documentclass:
default font size (10, 11, or 12pt), paper (a4paper, a5paper, b5paper, letterpaper, legalpaper,
executivepaper), and orientation (portrait, landscape). For example,

\documentclass[a5paper,landscape,12pt]{article}

Alternative font sizes can be speci¬ed as explained in Section 5.2.2.

5.1 Format/Line Spacing
The package setspace provide the environments singlespace, onehalfspace, and doublespace.
In addition, the environment/command \spacing{amount} will set the spacing to the speci¬ed
amount:
\begin{spacing}{2.5} These two lines
These two lines \\
are crazily spaced!
are crazily spaced!
\end{spacing}
\begin{spacing}{1}
Much better, these lines\\
Much better, these lines
have a pretty space.
have a pretty space.
\end{spacing}

21
5 THE FORMAT MENU 5.1 Format/Line Spacing

Text attribute Environment form Example
\textnormal main document font
textnormal
\textrm roman
rmfamily
\textit italics
itshape
\emph n/a emphasis
\textmd medium weight (default)
mdseries
\textbf boldface
bfseries
\textup upright (default)
upshape
\textsl slanted
slshape
\textsf sans serif
sffamily
\textsc scshape small caps
\texttt ttfamily typewriter
\underline underline
underline
this is superscript
\textsuperscript n/a
xn + yn = zn ∀n = 2
\mathrm n/a
xn + yn = zn ∀n = 2
\mathbf n/a
xn + yn = zn ∀n = 2
\mathsf n/a
xn + yn = zn ∀n = 2
\mathtt n/a
 . 1( 2) >>