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:

  1. Download a fake Latex version of a homework 0. Save it to a file named sol00.tex.
  2. To ``compile'' this file, enter the command latex sol00.tex . Several files will be produced including sol00.dvi.
  3. To view the typset version of your file, enter the command xdvi sol00.dvi .
  4. To create a postscript version of the file, enter the command dvips sol00 -o. This creates the file sol00.ps.


    Step 2:

    1. 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.
    2. After the heading code enter the line
        \noindent MyName \\
    3. Compile the modified version of sol00.tex and view it in xdvi.


    Step 3:

    1. The next few lines of sol00.tex are general instructions on Tex, followed by the problems.
    2. 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]$
    3. Recompile and view the result.
    4. 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".
    5. 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:

    1. Insert the correct answers to each question.
    2. Recompile and view the results.
    3. Create a postscript version, print it, and you are done.
    4. :)
    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