Typing Your Quiz Solutions: A Tutorial on LaTeX

You can write up your Quiz solutions using any method you'd like. Lots of people use word processors (like Microsoft Word, Works, Open Office, etc.); others hand-write their solutions and scan the pages. Mathematicians write math using a typesetting system called LaTeX (pronounced LAY-tek, or LAH-tek), and we invite you to write up your quiz solutions this way. It will produce a beautifully typeset document, and the solutions will be very easy for us to read. You can use the sample file below or create your own; the rest of this page will tell you about the wonderful world of LaTeXing.

A word of warning: We want you to focus on the math! Please don't let LaTeX distract you from solving the problems. If you're curious about LaTeX but pressed for time, we want you to spend your time on the math. There is no penalty for submitting handwritten or MS Word solutions, nor is there an advantage gained from using LaTeX. We're just including this tutorial as a means of introducing you to a popular tool for mathematicians.

There are many great LaTeX tutorials and guides online; we highly recommend the thorough resources on the Art of Problem Solving's wiki. For basic setup and how-to, the tutorial below should get you started. Happy TeXing!

Step 1: Set Up Your System

The way it works is that you use some text editor to write a LaTeX (.tex) file, and then you feed the .tex file to a compiler, and the compiler produces a human-readable file, like a .pdf. So: what you need on your computer is an editor in which to write your .tex file, and a compiler to turn the code into a pretty document.

This can now be done entirely online! We recommend Overleaf, which is a free online TeX editor (and very popular among mathematicians).

If you would like to set up your own machine, here are platform-specific instructions:

Step 2: Making a File – The Very Basics of LaTeX

LaTeX is a typesetting programming language. The most important thing to know if you want to write your problem sets in LaTeX is that it runs in two modes: normal mode and math mode. In normal mode, only text is handled. You can alter the text (for example, making it bold-face or italic) but generally you can't use any fancy characters or typsetting in normal mode. A new paragraph is started when you leave a blank line in the LaTeX file.

Some normal-mode commands to know:

  • {\bf TEXT} puts TEXT in bold face.
  • {\it TEXT} or {\em TEXT} puts TEXT in italics.
  • \smallskip, \medskip, and \bigskip insert various small amounts of whitespace, in between paragraphs for example.
  • Put \begin{enumerate} if you want to give a numbered list. Start each element in the list with \item, and when the list is finished, put \end{enumerate}.
  • \begin{itemize} with \item will do the same thing without numbering the items – it makes a bulleted list.

In math mode, letters are written in italics (they are assumed to be variables or functions, not words), and more advanced typsetting is allowed. In order to switch back and forth between math mode and normal mode, you use the $ character. That is, if you add $x^2$ in the middle of a bunch of normal mode text, the first '$' changes the mode to math mode, the 'x^2' is interpreted and typset correctly, and then the second '$' changes the mode back to normal mode.

Some math-mode commands to know:

  • $x^a$ will put "a" as an exponent of x.
  • $x^{abc}$ will put "abc" as an exponent of x. If you put $x^abc$ you will get output that looks wrong.
  • $x_a$ will put "a" as a subscript of x. Similarly, $x_{abc}$ should be used for longer subscripts.
  • $x^{y^a}$ and $x^{y_b}$ work, et cetera.
  • $\alpha$ will produce an alpha character. Give the name of a greek letter after a \ (the command character) to get that greek letter.
  • $\ldots$ will produce the '...' such as in "1 + 2 + ... + n"
  • { and } are special characters. To get { or } to show up, use \{ and \}.
  • \text{} will put regular text into your math mode.

There are many other commands you can use in math mode. For a fairly extensive LaTeX reference online, try The Not So Short Introduction to LaTeX 2e (.pdf). For a shorter introduction, check out Getting Started with LaTeX and the Art of Problem Solving's LaTeX Symbols Guide.

One final word about math mode: When you use the single '$' to go into math mode and then back out, this inserts your mathematical type in the middle of the paragraph. If what you want is to give an equation or mathematical phrase on its own, go into math mode with a double '$$' and back out the same way. This will put that incident of math mode on its own line, centered. Some commands will come out looking different if you put them on their own line. For instance, if you use $\sum_{i=0}^{n} i$, the limits on the sum will be to the right of the sum symbol. However, if you use $$\sum_{i=0}^{n} i$$, the limits will be on the top and the bottom.

Step 3: Debugging

When you have finished writing your .tex file, compile it. (See Step 1.) If you had no bugs in your LaTeX code it'll go right through and give you a thumbs up. However, you will often have some errors. Most errors fit into one of these few categories:

  1. You forgot to close something you opened. You forgot to put enough close parentheses or curly braces, or you left off the closing $ to go out of math mode. You could have forgotten to put \end{enumerate} after your numbered list was finished. Remember that if you use $$ to put a math mode block on its own line, you must close with a $$. If you close with a single $, it will cause an error.
  2. Similar to the above, you forgot to open something you closed.
  3. You used a non-existent command.
  4. You used a command in normal mode that is only supposed to be used in math mode. Sometimes this can look like a #3-type problem.

One Final Hint

If you have a LaTeX bug that you can't figure out, if worse comes to worse, use the following time-honored trick: delete the problematic section and put a bunch of \bigskip commands in its place. Print out your file, write the solution down, and scan that page. You can insert the scanned page into your PDF, or simply submit your solution in more than one file.

Here's a good time to remind you: don't forget to write your applicant ID and not your name on your Qualifying Quiz. (You can find your applicant ID in your online application on the welcome page.) Thanks!

Acknowledgements: This tutorial adapted from Yevgeniy Dodis's LaTeX tutorial at NYU.