Using Latex in your Lab Reports

We've put together a set of files to make it easier to use LaTeX to write 6.131 lab reports. We recommend the use of LaTeX, but do not require it.

Our LaTeX package

We have put together an 'everything you need' tarball for use on Athena. It is accessible either from here:


Get ahold of the tarball and untar it somewere in your home directory (tar xzvf latex-package.tgz), and take a look inside. It should contain:

  • report-template.tex - This is a LaTeX source file, which we have set up so you can just fill in the blanks. You will want to copy or rename this to something like 'lab2.tex'.
  • Makefile - Used by GNU make, it contains rules to build .dvi and .ps files from your LaTeX source.
  • README - Brief description of what the package provides.
  • dummy.eps - A graphic provided solely for the purpose of demonstration.

Getting started

You should be able to make a document off of the package we provide right away. Simply type


Make will generate the file report-template.dvi (and a few other files). This file is in the DVI format and can be viewed with xdvi. Note that you have to be in the directory containing the Makefile for Make to do its thing.

Our special TeX

We've defined several useful LaTeX commands that you can use to put together your report. They are

  • \exercise Put this command to start your answer to the next exercise. It automatically increments the exercise number.
  • \bold{<some text>} This does exactly what it sounds like. One thing to note is that it doesn't deal well with linebreaks inside of a code block (see the next entry). So if you're bolding parts of your code, give each line its own \bold. We're working on a fix.
  • \begin{code} ... \end{code} This is a code environment. It sets off the code a little bit from everything else and displays it in a monospaced font so it's easier to read. We've used alltt to accomplish this, so you will be able to use LaTeX commands inside the body of the code. In particular, for exercises when you want to highlight additions you have made to some code, we want you to use \bold to emphasize your contributions.
  • \graphics{<filename>}{<caption>}{<label>} This allows you to insert a graphic from another file as a figure. The file must be in eps format. You can use the label later to refer to the figure number when discussing that figure. You insert the command \ref{<label>} and LaTeX will insert the figure's number. It uses graphicx, so you can pass in graphicx commands as an optional argument.