Appendix A: LaTeX, a typesetting System

Return to all notes

LaTeX is a typesetting system or software to create high-quality printed documents. It dates to the 1970s and predates many word-processing programs like Microsoft Word. LaTeX is also the goto software for people in STEM fields to produce mathematics and high-quality graphs.

The system is more like a programming language language in which there is source code which is compiled into a resulting PDF document.

LaTeX Software

Once you learn LaTeX, it is a fantastic typesetting system. Another aspect of it is that it is open-source and free. There are a bunch of different systems that you can install/use on a given computer

Over the web




Since LaTeX is similar to a programming language, the place you write is an editor. As mentioned above, when you download the software, most bundles come with the editor. Here is what to look for:

For the most part, these all are similar. There is a place to type in the LaTeX source; a set of buttons, menu items, and keyboard shortcuts to compile the code; and a console area for information about errors.

Basic Template

The following is a basic template for LaTeX:



This is my first latex document.


The important aspects of this are:

To get the LaTeX into a PDF form:

  1. Take the few lines above, copy them and paste into Overleaf, TeXShop or TeXworks.
  2. Find the “Typeset” button (or menu item) and click or select it. Note: Overleaf does not have a typeset button, but automatically will do so. If there are errors, often a button that says “Recompile from scratch” is helpful to try.
  3. Your PDF should show up in a separate window or part of the program.

Simple math formulas

One main reason for doing LaTeX is the nice mathematical formatting. There are two modes of mathematics:

  1. inline mode. Mathematical commands are surrounded by dollar signs \$ … \$.
  2. Display mode. This is on its own line and centered. Often the size of symbols or layout is different. The basic way to add math in display mode is with \[\]. We will also learn later how to add line numbers.

Here are some basic ideas of mathematical symbols:

Other Standard Formatting

This is the first sentence in a paragraph.  And this is another one to make this paragraph longer.  This is the last sentence of my paragraph.

This is the first sentence of the next paragraph.

Will generate the two paragraphs. Notice that my default paragraphs are not separated by any space and are indented. This behavior can be changed in the geometry package listed below.
* Sections and subsections

Often for a paper, you will have sections and subsections of a paper. To generate a new section, type \section{Section Name} and you will see a numbered section with a larger bold font. To get a subsection, type \subsection{Subsection name}. If you don’t want the sections numbered, use \section*{} or \subsection*{}. For example

\section{Section One}
\subsection{Subsection name}
\item Item 1
\item Item 2
\item Item 3

will generate

\item Item 1
\item Item 2
\item Item 3

will generate

  1. Item 1
  2. Item 2
  3. Item 3

There are various types of bullets and enumeration types. This page gives some additional ideas on lists.


Like other software, additional functionality is located in packages in LaTeX. To load in a package, you will use the \usepackage command in the preamble (above the \begin{document} line).

Here are a few common packages

geometry package

Type \usepackage{geometry} in the preamble. This gives a lot of flexibility on the spacing of margins and paragraphs, etc.

Typically, I will use this package with the following (make sure it is after you have loaded the package):


which sets some margins by defining the area to be printed on (the total option above). The documentation is here

amsmath package

Type \usepackage{amsmath} in the preamble. This has a lot of helpful mathematical formatting. The amsmath documentation has more information that you probably want. Here’s a few ideas:

2x_1 + 3x_2 & =  6, \\
3x_1 + 4x_2 & =  8.

will generate
\begin{array}{rl}2x_1 + 3x_2 =& 6, \newline
3x_1+4x_2 = & 8.

where the two lines line up via the ampersands (&)

1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9

will generate

1 & 2 & 3 \newline
4 & 5 & 6 \newline
7 & 8 & 9

1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9

will generate

1 & 2 & 3 \newline
4 & 5 & 6 \newline
7 & 8 & 9

1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9

will generate

1 & 2 & 3 \newline
4 & 5 & 6 \newline
7 & 8 & 9

and there are other delimiters available.

graphicx package

Type \usepackage{graphicx} in the preamble. This package can load in external graphics (image files and other PDFs). Additional documentation can be found here.

If you have an image that is called my_image.png, then to load it type


and you can change the width to another value or use the height option instead. Note: make sure that the image is in the same directory that your latex source is.

Other Help

There is a huge number of websites available for latex. Some of the more helpful ones are:

Maple with LaTeX

Maple can export mathematics in LaTeX form as well using the latex command. For example typing latex($x^{2}$) returns


which has extra curly braces, but still okay.

However, if you want to latex $\int x^{2} \, dx$, you get


which is true, but perhaps not what you want. Many standard Maple commands have an inert form which doesn’t do anything. For example, typing


$$ \int x^{2} \,dx$$

and note that you can get a nicer version of this by typing Int then hitting escape.

Typing latex(#) on the line number returns:

\int \!{x}^{2}\,{\rm d}x

There are many other commands with inert forms like limits, derivatives, etc.