CS256: Algorithms
Getting Started with LaTex
These brief instructions on LaTex are intended to get you started. If you
want a thorough treatment of LaTex, I suggest you purchase Leslie Lamport's book
LaTex .
These instructions assume an X-Windows/Unix environment.
OzTex for the
Macintosh is a very nice product that works very nicely with the Alpha text
editor. Williams has paid the shareware fee, so you can download and use it
legally.
There is a freeware version
of LaTex available for the PC but it is non-trivial to install. For more information
go to EMTEXGI Home Page .
Step 1:
-
Download a fake Latex version of a homework 0. Save it to a file
named sol00.tex.
-
To ``compile'' this file, enter the command latex sol00.tex . Several files will
be produced including sol00.dvi.
-
To view the typset version of your file, enter the command xdvi sol00.dvi .
-
To create a postscript version of the file, enter the command dvips sol00 -o. This creates
the file sol00.ps.
Step 2:
-
Open sol00.tex in a text editor. The first two lines of text establish the document style and open the document;
you should not change these lines. The next seven lines of text print a heading.
-
After the heading code enter the line
-
Compile the modified version of sol00.tex and view it in xdvi.
Step 3:
-
The next few lines of sol00.tex are general instructions on Tex, followed by the problems.
-
In the text for problem one, find the line that reads "$f(n)=10$ and $g(n)=3^n$".
Insert a new line
-
$f(n)>g(n)$ for $n$ in the range $[1 \ldots 3]$
-
Recompile and view the result.
-
Text delimited by the $ are interpreted in math mode . You should see a difference in the type style
between the two versions of of the letter "n".
- Some mathematical symbols that are only available in math mode.
For example the \ldots command produces an ellipse in math mode. If you remove the $ delimiters the
the document will not compile.
Step 4:
-
Insert the correct answers to each question.
-
Recompile and view the results.
-
Create a postscript version, print it, and you are done.
-
:)
An online reference that you might find helpful can be found at
www.maths.tcd.ie/~dwilkins/LaTeXPrimer/.
Last updated:
February, 2001
This sheet is based -- with
minimal changes -- on a very
similar document by Z Sweedyk at Harvey Mudd College