Latex Tutorial

Keywords: Latex, Postscript, PDF, how to, tutorial, guide, primer

Motivation

Suppose you're writing a scientific article to be published in
a conference proceeding, journal or book. The publisher
will demand camera-ready quality, meaning the hardcopy's "look" and
page formatting meets the level needed for mass distribution
in magazines, journals and books. Desktop wordprocessors like
Microsoft Word are ill-suited for this. Furthermore, problems
with Word include:

Latex is a computer language for generating scientific documentation
that is camera-ready. This step-by-step tutorial illustrates
Latex'ing an article and creating Postscript and PDF camera-ready
documents and presented as follows:

This tutorial is not a comprehensive guide to Latex. It
does not describe all of Latex's commands - there are
good books and on-line references
for this. Rather, this tutorial provides a simple .tex template,
explains how to both compile it and generate the final
Postscript and PDF document.

TEX file Creation

Latex is a computer language - one creates and compiles
files having names with a .tex extension.
If there are no syntax errors, the resulting output filename
extension is .dvi which stands for device independent.
This dvi file can be processed into a camera-ready format
called a Postscript file, having a .ps extension.
Postscript files are viewed with a program called Ghostview
which also has a PS to PDF converter.

Step 1: Software Download and Install

The following software is needed. They work with Win 95/98/ME
and should work on WinNT/2000 too. This tutorial uses the versions
downloadable from our PRISM Robotics Lab server. You can download
the lastest versions from the original sites. Install the files
on your Windows PC.

Both Ghostview and GSView need to be installed to view
Postscript files. The Ghostview, Ghostscript and GSView
home page provide
the latest versions.

Emacs: available on PRISM
Version 20.6 filename: emacs-20.6-bin-i386.tar.gz (8.9 MB)

Latex only requires an ASCII editor (like Windows Notepad or DOS Edit).
Emacs is a much more powerful and popular editor. The latest version
can be downloaded from the
GNU Emacs web site.

Step 2: Download the template.tex file

Right clicking template.tex
will save it to your hard drive. This TEX file features common
Latex statements like margin and line-spacing to produce an
8.5x11 article. Opening template.tex with an ASCII
editor like Windows Notepad.exe or Emacs will
look like:

If there are no syntax errors, beyond LaTex Warnings,
repeat the latex myFile01.tex two or three
more times. This is needed for Latex to generate the proper
section numbers, bibliographic citations and references.

Step 5: Create and View the Resulting Postscript File

Successful Latex'ing will generate myFile01.dvi.
At the DOS prompt typedvips -o myFile01.ps myFile01.dvi
as shown in the screen shot below.

dvips is a program that converts DVI files to PS. The
option -o is the desired filename (myFile01.ps in this
case).

The resulting myFile01.ps is a Postscript (PS) file.
Within the scientific community, PS rather than Word DOC files
are exchanged. PS files are ASCII and hence can be opened
by any computer (Pentium, 286, Sun Sparc) running any
operating system (Windows, DOS, Linux, BSD, SunOS).

You view PS files using GSView. If you installed GSView on your
Windows PC, launch it and open myFile01.ps. You should see
the following screen shot.

This prepares myFile01.ps for letter size and PDF-compatiable
fonts. Click Media again and click letter size if needed.
Under GSView, click FILE - Convert - pdfwrite to create a
PDF version of myFile01.

Congratulations! You created a camera-ready document!

Mathematics and Images

Latex's real power lies in its ability to typeset mathematical
equations. Unlike Word, Latex does not come equipped with
a point-and-click math editor; one needs to learn Latex'
typesetting commands. Leslie Lamport's book describes
the commands that one learns rather quickly.

examplePaper.tex is a 2-page
paper in 2-column format. The margins, font and header/footer
sizes meet IEEE or ASME paper specifications. Before examining
how math and images are handled, try latex'ing the file and
generate the PS file. Before you begin, download
assemblyWorkcellOverview1_0.eps
into the same directory as examplePaper.tex. Next, perform
the following 3 to 4 times:

latex examplePaper.tex

Next:

dvips -o examplePaper.ps examplePaper.dvi

Viewing the PS file with GSView should show a 2-page double-column paper
with a few math equations a some images.

Images

Latex only handles figures that are PS or EPS. Windows users
are typically used to GIF, JPG or BMP file formats. The problem
is that resizing diminished image quality. PS or EPS files are
vector-scaled meaning that resizing will not
decrease image quality - an essential aspect in camera-quality
documents.

The caption command assigns what text is written below the image
assemblyWorkcellOverview1_0.eps. The label command
is used so that you can reference it within the paper. You'll
notice assemblyWorkcellOverview1_0.eps is repeated twice.
This was done just to show two pictures can be placed side-by-side.
The width variable, set for 3 inches, scales the figures' height
automatically.

Equations

Within examplePaper.tex are several equations. For
example the very first equation is described in Latex as:

which describes a typical linear state-space equation.
The \bf command for bold was used because vectors
are often connoted with darker font than non-vectors.

Once you learn Latex's math commands, you'll be entering
equations much faster than a Word-like
point-and-click method. Nonetheless, point-and-click does
required much of a learning curve and this has motivated
several shareware/commercial GUI-based math editors for
Latex. These include:

Equation Magic Lite which looks much like Word's
math editor. The lite version is free but limits the
number of symbols in a equation.

Final Words

Publishing scientific journals, theses, dissertations,
articles and conference proceedings demand camera-ready
typesetting. Latex, a language for wordprocessing, is the
popular tool for such typesetting. Creating Latex files
only require an ASCII editor - the resulting file sizes
are small, platform-independent and easy to create.

Latex has a loyal and wide following supported under the
GNU public license. This means Latex tools are free and
well-tested. This tutorial guided the reader to these tools,
offers a simple Latex template (template.tex),
describes how math and images are handled (examplePaper.tex).