Latex Guide for CSCI 301

In this class, your written homework solutions will be typeset using LaTeX. Knowing how to typeset formal documents that include mathematics is a valuable skill that will be useful later in your computer science education, and perhaps also in your career.

To get you started, please take a look through Sections 1 through 12 of this LaTeX tutorial. You don’t need to carefully read and memorize everything, but you should be able to remember what’s there so you can refer back when you need it.

Assignments are provided to you as a PDF and a .tex source file. To complete an assignment, use your preferred text editor to edit the .tex source file to include your solutions, compile it into a PDF, and submit that PDF to Canvas.

Compiling your Source File

Different from most document and text editors you’re probably used to, LaTeX is not “what-you-see-is-what-you-get” (WSYWIG). Writing LaTeX is more like writing a program: you write a source file in a text editor, the LaTeX system compiles that program into a nice document (usually, PDF) for you.

You have a few options for compiling your source file:

  1. [This is the officially supported option.] In the CS lab environment, a LaTeX distribution is install which includes the pdflatex command. This command compiles a source file into a PDF, so you should be able to do the following:

    $ pdflatex A1.tex
    This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex)
     restricted \write18 enabled.
    entering extended mode
    (./A1.tex
    LaTeX2e <2022-11-01> patch level 1
    # ...
    # (a whole bunch of output)
    # ...
    Output written on A1.pdf (1 page, 100785 bytes).
    Transcript written on A1.log.
    $ 

    After running this, A1.pdf now contains your beautiful compiled document. The compiler also produces A1.log and A1.aux, both of which can safely be ignored most of the time. These are re-generated each time you compile the document.

  2. You may install a LaTeX distribution on your own computer, which will provide the pdflatex command. You can find installation instructions for varoius platforms here.

  3. You can use an online LaTeX editor, such as Overleaf, that provides an editor, hosts your files and compiles them for you.

Looking up Syntax

You may often find yourself wondering “what’s the code for this symbol?”, which can be trickly to search for because you may not even know what it’s called. You can find various symbol references online, such as this one.

For anything covered in class, you can always look at the source document for the typed notes or assignment to see how I’ve written a symbol. Assignment source files are in LaTeX, and are provided to you with the PDF.

For my (typed) class notes, I write in Markdown format, with embedded LaTeX math expressions. That is, I’m not writing a full LaTeX document, I’m just including syntax like $\mathcal{P}(\{a, b\})$ into the document. Upon rendering to HTML, this is converted into the corresponding math (\(\mathcal{P}(\{a, b\})\)). You can find the source file for my class notes by replacing the .html extension in the URL with .md. For example, the source file the Lecture 1 notes (found at https://facultyweb.cs.wwu.edu/~wehrwes/courses/csci301_24f/lectures/L01/N01.html) can be accessed at https://facultyweb.cs.wwu.edu/~wehrwes/courses/csci301_24f/lectures/L01/N01.md.