Skip to main content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

LaTeX

a guide to using LaTeX document preparation software

Getting Started With LaTeX

About LaTeX

 LaTeX is a document typesetting system that can produce attractive articles, books, and slides. It is especially useful when writing documents that have a lot of mathematical notation. LaTeX is a computer programming language and takes a little bit of time and practice to learn. The purpose of this guide is to provide a basic introduction to LaTeX. If your professors require you to write your thesis in latex, they should have information on more specific resources available to help you out.

LaTeX is a markup language like HTML. Markup languages allow you to tell the computer program (the LaTeX compiler in this case) the structure of the document, and have it generate a document for you. There are pros and cons to using a markup language rather than a word processor to make your document. Some people would argue that using a markdown language allows you to focus on the content and not the formatting of your document, and that LaTeX produces documents that are better looking than word processors. Another advantage to LaTeX is that it is open source, which means that anyone can work on it and improve it. It is also free of charge and available on all of the common operating systems. A con of using LaTeX is that you can't see what the result will look like instatainisly, and also, more people have word processors, so this makes collaborating more difficult. In LaTeX it is sometimes challenging to get the formatting right if you want to move away from the default settings, so if you want to make the document look a certain way, LaTeX might not be the best solution in that case, although templates can help with this.

About This Guide

This guide serves to give an introduction to LaTeX, as well as provide links to resources for more exploration. Use the links on the left to naviagate to the page that is appropriate for you.

Obtaining LaTeX

Accessing LaTeX

To get started with LaTeX, you have a few options. There are a few online LaTeX editors out there, as listed in the next box, if you want to try out some of the code examples in your browser. TeX is installed on Macs in the computer labs around campus and the computers in the library all have TeXworks installed. The other option is to install LaTeX on your computer. The easiest way to get LaTeX on your computer is to install a distribution, which is sort of like a package of LaTeX along with things like font support and a lot of other stuff. It is possible to just install a bare bones LaTeX compiler, but that's a bit harder to do.

LaTeX distributions

These steps will help you to learn the basics of LaTeX. You want to download either proTeXt for Windows or MacTeX for Macs. These can be downloaded as executable files from the LaTeX project website.

Once the executable is downloaded, you can run it to install on your computer. If you need help upon extracting the files (probably to Program Files folder or similar), you can read the install instructions in the PDF file provided in the Install folder upon extraction. As it states in that guide, you have to install MiKTeX but TeXstudio is optional. For now, we recommend forgoing TeXstudio and use TeXworks as your editor instead (which is included in the MiKTeX package already).

You’ll want to be sure to install the MiKTeX in the directory where you plan to create and save your LaTeX documents, such as in the ‘My Documents’ folder or subfolder (we recommend a subfolder such as LaTeX files because you don’t want to overload your My Documents folder with a lot of LaTeX files). The directory you choose is important because it is where all subsequent LaTeX packages and files will need to be stored. However, final LaTeX documents can be published as PDFs and later moved to any folder you’d like.

Online LaTEX Editors

There are websites that allow one to work on LaTeX documents collaboratively, much like Google Docs. They also keep the files on their servers, so you can access them from any computer. All have free and paid plans. If you know of any other sites, please feel free to send me an email.

LaTeX Editors

Unlike a word processor, entering LaTeX code and working with it requires an editor. There are a few editors designed to work specifically with LaTeX, and some of the distributions include editors. There are also plenty of text editors with LaTeX support. In this guide we will be focusing on TeXworks.

Using the LaTeX Editor

The LaTeX editor is the window that pops up when you open TeXworks via the icon or start-menu prompt. This is where you will essentially write and edit your document. The window looks like:

blank TeX editor

 

 

 

 

 

 

 

 

The very top-left provides the name of the document you are currently working in (in this case, ‘untitled-1.tex’. Below you’ll see a number of menu options:

  • The File menu contains general file management tasks such an Open, New, Save, and Print. These you will use frequently.
  • The Edit menu contains general editing tasks such as Cut, Copy, Paste, Select, Undo, and Redo. You can also run spell check from this menu. You will likely use the tasks in this menu on a regular basis.
  • The Search menu contains general file search tasks such as Find and Replace. You may need this from time to time.
  • The Format menu contains LaTeX editor formatting tasks such as font options, line numbering and wrapping options, and coloring options. We recommend you turn on Line Numbers, Wrap Lines, and LaTeX Syntax Coloring options. Line Numbers will add line numbers so that if there are errors in your code, you are able to locate them and fix them. Wrap Lines will wrap your lines to fit in your window, making it easier to read. The LaTeX Syntax Coloring will use coloring to identify certain parts of your syntax; this is discussed later in the guide.
  • The Typeset menu contains typesetting options.
  • The Scripts and Window menus contain scripting and window options. You're unlikely to need the options in these windows.
  • The Help menu contains links to resources to help you create your document and use LaTeX.

Finally, under the menu options you’ll find a green arrow button and a drop-down menu:

Install settings pdfLaTeX MakeIndex BibTeX

 

 

You’ll notice that the box has a drop-down arrow, and when you click it you are given lots of options for how you wish to compile the doument. Depending on your editor version, these options will also be available in the Typeset menu. 

Note: When you first compile the document, use the basic pdfLaTeX compiler first as this will create the scaffolding necessary for the document. After you do this, you can change back to the combined compilers.

pdflatex

 

The pdfLaTeX, MakeIndex, and BibTex compilers will work best for most uses. Depending on your distruibution of  LaTeX, the default is just pdfLaTeX, and you will have to run BibTex separately. The green arrow is the “run” button. When you hit this, LaTeX will read through and run your code in your editor. If there are no errors, it will output your actual document in a new, read-only window. At the same time it will save a PDF of your document, as discussed in the previous section. While it is running, the green button will turn a red ‘X’, which you would click if you wish to stop running the script and cancel the output.

If there is one or more errors, they will display at the bottom of your LaTeX editor. You will have to address these errors before running again; else you’ll just run into the same problems. Sometimes it’s as simple as forgetting a bracket or backslash, while other times it’s a more complicated problem. We don’t go over types of errors here, but the Help option or an online search should be able to help you if you have trouble deciphering the error messages.