CS140:  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. 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 the tex version of homework 0 from the course web page. 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 -o sol00.ps sol00.dvi. 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 instructions 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, and bring to the next class.
    4. :)

    Last updated: August, 2000