Introduction To LaTeX
Introduction To LaTeX
Abstract
This is an initial attempt to create a compact introduction to Overleaf
and LATEX in general. Topics and examples are tailored to meet the needs
of The Hudson School. LATEX is a high-quality typesetting system; it
includes features designed for the production of technical and scientific
documentation. LATEX is the de facto standard for the communication
and publication of scientific documents.
1
Contents
1 Introduction 3
2 The Basics 3
2.1 Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Bold, Italic, and Underline . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Sections, Subsections . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4 Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 The Essentials 6
3.1 Figures and Images . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.5 Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.6 Boxes and Frames . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 The Bibliography 19
5.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2 Building the Database . . . . . . . . . . . . . . . . . . . . . . . . 20
A Examples by Subject 28
A.1 Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
A.2 Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
A.3 Chemistry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
A.4 Biology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
List of Figures
1 A funny physics cartoon . . . . . . . . . . . . . . . . . . . . . . . 8
2 A custom blank graph with GeoGebra. . . . . . . . . . . . . . . . 23
3 LATEX code generated with Octave. . . . . . . . . . . . . . . . . . 24
4 Diagram with circuitikz and tikz package. . . . . . . . . . . . . . 26
5 Unit Circle with Tikz . . . . . . . . . . . . . . . . . . . . . . . . 27
6 Branched Molecules . . . . . . . . . . . . . . . . . . . . . . . . . 30
2
1 Introduction
This document was created using the standard article class suitable for most
academic articles and reports. In Overleaf there are two main windows. The
window on the left displays your raw LATEX source code. The window on the
right is the preview window. If the preview window is set to auto then the
window will be updated in real time, however, there is a slight delay. The
preview window shows you what your finished document will look like after you
have exported it to a PDF.
In Overleaf, clicking on an object or section in the preview window will
automatically move your cursor to the corresponding place in the source code
window. The source code window can be viewed as raw source code or as “Rich
Text.” Rich text mode shows a more familiar version of the document similar
to typing into a standard word processor.
Everything in LATEX is done with commands. Commands always start with
a backslash and are case sensitive. Certain commands can only be used with
the inclusion of certain packages or within certain environments. The point of
LATEX is to take the focus off of the formatting of documents so the user can
concentrate on the content. This being said, once you have settled on a format
or template, making small stylistic changes can be difficult.
This document was created in LATEX for a reason. It is much easier to start
with a working example and make adjustments than to create from scratch.
When viewing this document on Overleaf you can view the source code and
output simultaneously. This means any special formatting, tables, and math
that you see can be copied and imported into your own document. Importing
these examples into your LATEX document is as simple as copying the source
code and pasting it into your document. You can then change the values and
adjust as needed.
When viewing this document as a PDF most of the example source code is
included verbatim in the peach colored boxes. As a PDF, you can also click
on hyperlinks to be taken directly to that page on the internet. Clicking on an
item in the table of contents will also bring you to that specific section.
2 The Basics
This is by no means meant to be a comprehensive introduction to LATEX. There
are many document classes and thousands of packages. Extensive documenta-
tion is also available freely online. You can only use one document class per
document but you can import as many packages as you need. Packages add
extra features and capabilities to your document.∗
The bare minimum code needed to create a LATEX document is as follows:
∗ Some packages may not play well with others and some have to be loaded in a particular
order. The packages loaded in the preamble of your lab template should be sufficient for most
cases.
3
\documentclass{...}
\begin{document}
\end{document}
The entire text of the final product is located between the \begin{document}
and the \end{document} command. The space between \documentclass{} and
\begin{document} is called the preamble. The preamble is where you tell LATEX
what kind of document to create. Some well known document classes include
article, book, exam, letter, and beamer. The document class governs the overall
format of the document such as fonts and default margins.
The preamble is also where you import your packages. Certain packages are
mandatory to enable certain features such as the ability to add images to your
document. You can take a look at the preamble of this document to see what
packages are included and for what reason.∗
There is, of course, a way around this. Placing a backslash before most of
the characters will cause them to be displayed as ordinary symbols. The need
to talk about $$ or % understandably comes up often. This works for all of
the symbols except for the backslash since the double backslash is, in itself, a
command. To get a \ to appear in your document type $\backslash$. In most
cases if you really just need a slash in your document a forward slash (/) will
usually suffice.
4
2.3 Sections, Subsections
LATEX automatically handles section numbering and formatting. This allows
the user to concentrate on content rather than formatting. As new sections are
added LATEX will adjust section numbering accordingly. The code for creating
sections and subsections is as follows:
\section{Name of Section}
\subsection{Name of Subsection}
2.4 Spacing
LATEX also handles spacing of words, paragraphs and equations automatically.
This can be confusing, at first, to someone familiar with a word processor. This
is better illustrated with an example:
This
is
the
beginning of a
\LaTeX{}
tutorial.
Produces . . .
This is the beginning of a LATEX tutorial.
Now, suppose for some odd reason you did in fact want the text to show as
written. To force LATEX to end a line you use a double backslash. To achieve
the text as it looks you need to manually end each line.
This \\
is \\
the \\
beginning of a \\
\LaTeX{} \\
tutorial.
Produces . . .
This
is
the
5
beginning of a
LATEX
tutorial.
To tell LATEX to start a new paragraph simply leave a blank line between
your paragraphs in the source code. Basically, type it as you normally would
with an extra line between each paragraph.
This is paragraph one.
If you want to manually add extra horizontal or vertical space into a doc-
ument the easiest way is to use the hspace and vspace commands. Refer to
section 3.1 for other possible units of measure that LATEX understands.
\hspace{2cm}
\vspace{1in}
To equally space multiple objects horizontally or vertically use the hfill and
vfill commands, respectively. For example,
\noindent This \hfill That \hfill The Other Thing \\
Produces . . .
3 The Essentials
3.1 Figures and Images
Similar to section numbering LATEX will automatically adjust numbering for
figures. To include images you have to include the package graphicx by placing
\usepackage{graphicx} in your preamble. In order to keep things simple the
image should be in the same folder as the main LATEX document. In Overleaf
files can be uploaded by pressing the project button on the top toolbar next to
the Overleaf logo.
As a general rule, files and folders should be named with no spaces. An
image is inserted into a document by using the includegraphics command. The
includegraphics command accepts a number of parameters to adjust the size
and appearance of the image.
If the name of our image file is cartoon.jpg, the command to include this
image scaled to 8cm width is as follows:∗
∗ Notice the absence of the file extension and that graphics are by default aligned on the
6
\includegraphics[width=8cm]{cartoon}
In addition to width one can specify length, scale, angle of rotation, and
the resolution of the image. LATEX understands a number of different units
including, but not limited to,
mm Millimeters
cm Centimeters
in Inches
pt A pt is approximately a third of a millimeter
We have included an image but in order to number it we must tell LATEX
that it is indeed a figure. Environments are used to change the formatting of a
block of text without affecting the format of the overall document. In order to
turn our cartoon into a figure we use the figure environment to give it a number
handled by LATEX. To center our figure we use the center environment.
Figures can be referred to later by cross-referencing. The label command al-
lows you to reference the figure later even if the number and page have changed.
Such as refer to Figure 1 on page 8.
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=5cm]{cartoon}
\caption{A funny physics cartoon}
\label{fig:toon}
\end{center}
\end{figure}
7
Figure 1: A funny physics cartoon
With the ref and pageref command you can refer to the figure later with
\ref{fig:toon} and \pageref{fig:toon}
3.2 Lists
Environments are available for making different kinds of lists including bulleted
lists and numbered lists. The enumerate environment is used to create a num-
bered list.
\begin{enumerate}
\item Item 1
\item Item 2
\end{enumerate}
1. Item 1
2. Item 2
A bulleted list can be created with the itemize environment.
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
• Item 1
• Item 2.
A list of definitions can be achieved with the description environment.
\begin{description}
\item[Word] Definition
\item[Concept] Explanation
\item[Idea] Longer explanation
\end{description}
8
Word Definition
Concept Explanation
Idea This is what will happen if your definitions are rather lengthy and take
up multiple lines.
3.3 Tables
Tables are made using the tabular environment. Tables can also be numbered
and cross-referenced as figures such as Table 1 on page 9.
\begin{table}[h!]
\begin{center}
\begin{tabular}{| l || c | c | c |}
\hline
Circuit & Voltage & Resistance & Current \\[2pt] \hline
Circuit 1 & 10 V & 10 Ohms & 1 Amps \\ \hline
Circuit 2 & 50 V & 5 Ohms & 10 Amps \\ \hline
Circuit 3 & 20 V & 2 Ohms & 20 Amps \\ \hline
Circuit 4 & 9 V & 3 Ohms & 3 Amps \\ \hline
\end{tabular}
\end{center}
\caption{Table created using the tabular environment.}
\label{tab:circuitgrid}
\end{table}
Creating tables in LATEX can be daunting as you can tell by the code for
Table 1 . There are, however, online table generators that will create the LATEX
table code for you and are more user friendly. A quick google search for “LATEX
table generator” yielded
9
http://www.tablesgenerator.com/
and
http://truben.no/table/old/
You can always create a table in any way you like and import as a picture
with the includegraphics command.
3.4 Comments
Comments, generally, are used to leave notes for yourself within the source code.
They do not appear in the official document. Most programming languages have
a way of excluding certain text from being executed as normal code.
As projects get large, commenting becomes increasingly necessary. A per-
centage sign is used to designate comments or code which should not be exe-
cuted.
% Find evidence to support this section
Comments are also useful for organizing sections of a larger project to make
the code easier to read.
%---------------------------------------------------
% Section: Introduction
%---------------------------------------------------
3.5 Colors
If you don’t specify a color the comment defaults to the orange seen in the
margin comment. Default colors that can be called by name without the need
for additional packages are white, black, red, green, blue, cyan, magenta, and
yellow.
10
The package xcolor will allow you to specify an additional sixty eight colors
by name. Please see the appendix for a complete list of colors available in the
xcolor package. Colors such as Aquamarine, Maroon, Lime Green, and Fuchsia
(assuming you can remember how to spell it) become available. This is achieved
by placing the following line in the preamble.
\usepackage[usenames,dvipsnames]{xcolor}
Colors can be used to highlight text with the use of the colorbox command.
The opacity of colors can be changed by adding an exclamation point and a
number afterwards. The second set of color boxes are set to fifty percent opacity.
\begin{center}
\colorbox{Aquamarine}{Aquamarine}
\colorbox{Maroon}{Maroon}
\colorbox{LimeGreen}{Lime Green}
\colorbox{Fuchsia}{Fuchsia}\\
\colorbox{Aquamarine!50}{Aquamarine}
\colorbox{Maroon!50}{Maroon}
\colorbox{LimeGreen!50}{Lime Green}
\colorbox{Fuchsia!50}{Fuchsia}\\
\end{center}
Custom Colors
Colors can also be defined manually by their RGB value. That is their percent-
age of red, green, and blue. All colors can be defined in this way. Black is the
absence of any color and white is the inclusion of all colors. You can define your
own custom color names to use later with their RGB values as well.
\definecolor{pukegreen}{rgb}{0.53, 0.66, 0.42}
\definecolor{poopbrown}{rgb}{0.59, 0.44, 0.09}
e = mc2
∗ An extensive list of colors and their RGB values is available at http://latexcolor.com
11
The framebox command can be used in line with text or in the center en-
vironment as demonstrated above. Here it is used in the equation environment
so it can be numbered and referenced later.
\begin{equation}
\framebox{$\vec{F}=m\vec{a}$}
\label{eq:newton2nd}
\end{equation}
F~ = m~a (1)
You can specify the width of a frame box by adding a width param-
eter in square brackets. To create a colored box use the fcolorbox command.
\framebox[3cm]{framebox}
\fcolorbox{Fuchsia}{white}{fcolorbox}
Where fuchsia is the color of the frame and white is the color of the back-
ground. It is possible to change both the thickness of the box and distance
between the box and its contents. Issuing the following commands will change
the look of all frame boxes from that point on.
\setlength{\fboxsep}{3mm}
\setlength{\fboxrule}{1mm}
All frame boxes now appear like this by default. The setting also affects
color boxes . All of our boxes have contained only one line of text although
it is possible to create an itemized or numbered list within a box. Notice the
itemize environment has changed to Bitemize.
\begin{center}
\fbox{Dr. Seuss Titles: \hspace{1cm}
\begin{Bitemize}[t]
\item Green Eggs and Ham
\item The Lorax
\item The Cat in the Hat
\end{Bitemize}}
\end{center}
Once you realize that the rest of your document after this point has been
affected you may want to set these values back to their default settings which
appears to be
12
\setlength{\fboxsep}{3pt}
\setlength{\fboxrule}{0.5pt}
This document also uses two additional packages for creating boxes and
frames: fancybox ∗ and mdframed † . The fancybox package allows four additional
types of boxes. These are shadow box, double box, oval box and a thicker version
of an oval box.
\begin{center}
\shadowbox{This}
\doublebox{that}
\ovalbox{and}
\Ovalbox{the other thing.}
\end{center}
This,
that and the other thing.
Package: mdframed
The other package, called mdframed, is useful for aesthetically pleasing boxes
that hold a lot of text.
The mdframed package is extensive and adds a lot of options for creating
boxes. In this document it was used to set up a default box for the verbatim
environment. The verbatim environment is how the raw latex code is put into
the document without it being executed as commands. The properties of the
box need to be edited only once in the preamble to change their appearance
throughout the document. This could be incredibly useful if you wanted to
have all of your equations wrapped in the same kind of box.
...the text...
\end{mdframed}
macros/latex/contrib/fancybox/fancybox-doc.pdf
† For more information, see the mdframed documentation at http://ctan.math.
washington.edu/tex-archive/macros/latex/contrib/mdframed/mdframed.pdf
13
4 The Good Stuff
Have you ever wondered how text books and some websites get their equations
to show up perfectly? There are numerous environments for typesetting math in
LATEX. The most common are the math environment, the displaymath environ-
ment and the equation environment. The math environment allows you create
equations and functions inline with your text. The displaymath environment
will center an equation on its own line. The equation environment is used to
display important equations you may wish to reference later.
There are short hand methods to enable the math and displaymath environ-
ments. Inline math and the displaymath environments are activated by $ and
$$ respectively. Recall that environments must have a beginning and an end
command so you must wrap the single dollar signs around your inline equation
and the double dollar signs around your displaymath equation.
The equation environment is used to create numbered equations similar to
figures that can be referenced later. There is no shorthand command to enable
this environment and must be invoked with the usual \begin{environment}
and \end{environment} commands. In this case, of course, you would use
\begin{equation} to enable the equation environment.
x=4 and x = −2
∗ http://texblog.org/2014/04/09/whitespace-in-math-mode/
14
Table 3: Spacing in Math Mode.∗
$$
x=4 and x=-2
$$
produces . . .
x = 4andx = −2
To achieve what you want use the text command to make the text appear normal
font and manual spacing to give it some room.
$$
x=4 \quad \text{and} \quad x=-2
$$
15
use. . .
$$
\text{Then} \; n=2k+1, \, \text{where} \, k \in \mathbb{Z}
$$
Still produces . . .
eiπ = −1 (2)
m = (y2 − y1 )/(x2 − x1 )
y2 − y1
m=
x2 − x1
Fractions can, of course, be nested as well...
x=\frac{1+\frac{1}{n}}{n!}
∗ Tokeep an inline math equation from breaking across multiple lines place an extra set of
{ } around the equation.
16
1 + n1
produces, x =
n!
The presence of the curly brackets should not be overlooked as they are used
frequently in all areas of LATEX. They are used like standard parentheses in all
situations where you want a command to apply to multiple characters. There is
a major difference between e2 x and e2x but the difference in the code is subtle
and a matter of remembering to use curly brackets.
$e^2x$ vs. $e^{2x}$
Keep in mind that fractions and certain symbols will either appear distorted
or create additional space in your paragraph when using inline math mode. By
default LATEX will prioritize line spacing and adjust the equation accordingly.
m = xy22 −y
−x1 is the default formatting for inline equations. The best practice is
1
to keep inline math mode reserved for special characters and simple one line
equations. The command displaystyle can be used to change this default behav-
y2 − y1
ior. m = is how inline math equations will look once the displaystyle
x2 − x1
command has been used within math mode. Notice the line spacing has been
adjusted to allow the equation to display properly. To enable this for a single
equation use the command in math mode,
$ \displaystyle m=\frac{y_2-y_1}{x_2-x_1} $
To enable this for every inline equation by default place the following line in
the preamble of the document.
\everymath{\displaystyle}
Care should be taken when assigning labels to equations, figures, and tables.
The purpose of the label and ref commands is that LATEX automatically takes
care of the numbering as changes are made. Therefore, it is foolish to label
∗ Using the split environment within the equation environment will allow for multiple lines.
17
our tables as table1 or table2. A better method is to be descriptive. Such as
the label given to equation 3: “eq:slope.” As another example, the keyword
“eq:einstein” is an easy way to refer to equation 4.
e = mc2 (4)
For equations on multiple lines or derivations use the align environment with
the use of & to define where they are aligned vertically. The align environment,
by default, will number each equation. To avoid this, similar to section number-
ing, use an asterisk after align in the declaration. To align equations vertically
with respect to the equal sign:
\begin{align*}
x^2-x-20 &= 0 \\
(x-5)(x+4) &= 0 \\
x &= 5, -4
\end{align*}
x2 − x − 20 = 0
(x − 5)(x + 4) = 0
x = 5, −4
If no & is used the environment will default to aligning the equations on the
right. The align environment will give a unique number to each equation. The
previous result using the align environment with numbering looks like:
x2 − x − 20 = 0 (5)
(x − 5)(x + 4) = 0 (6)
x = 5, −4 (7)
This is not a good use of the align environment since these are not equations
that are distinct and need to be referred to separately. In most situations you
may want only the result to be numbered. If only one of these lines is to be
numbered then the command nonumber should be used before the end line
command. For example:
\begin{align}
x^2-x-20 &= 0 \nonumber \\
(x-5)(x+4) &= 0 \nonumber \\
x &= 5, -4 \label{eq:quad_solution}
\end{align}
produces . . .
x2 − x − 20 = 0
(x − 5)(x + 4) = 0
x = 5, −4 (8)
18
There is a subtle but important distinction to be made between the number-
ing styles of the equation and the align environments. The equation environment
is used to create a single numbered equation even if this equation spans mul-
tiple lines. Using the split environment within the equation environment will
allow for multiple lines aligned vertically by & as in the align environment. In
the previous example referring to Equation 8 refers specifically to the solution
and not the problem. You can give the group of equations a number using the
equation environment as follows:
\begin{equation}
\begin{split}
x^2-x-20 &= 0 \\
(x-5)(x+4) &= 0 \\
x &= 5, -4
\label{eq:quad_problem}
\end{split}
\end{equation}
x2 − x − 20 = 0
(x − 5)(x + 4) = 0 (9)
x = 5, −4
A more useful example of this type of numbering is to number an equation
or result that is shown as a derivation.
Uppercase greek letters that differ from our normal uppercase letters are
produced by capitalizing the first letter in the name of the symbol. For instance,
alpha, beta and epsilon are simply A, B, and E respectively. Uppercase gamma
and theta are unique and Γ and Θ are produced as follows:
$ \Gamma $ and $ \Theta $
5 The Bibliography
Although LATEX has its own embedded environment for writing bibliographies
it is beneficial in the long run to use BibTeX.∗ BibTeX is a tool and a system
for generating a list of references from a database of sources. The database lives
in a text file which can be centralized and therefore maintained by a person, a
class, or an entire department. More than one file can be used so the sources
can be compartmentalized or organized by subject. This means a source only
has to be typed once.
∗ For more information on BibTeX visit http://en.wikibooks.org/wiki/LaTeX/
Bibliography_Management
19
5.1 Setup
The database is formatted and housed in a separate *.bib file. The bibliogra-
phy will automatically generated and formatted using only the sources cited in
the document.
Each source in the database must be given a unique reference number in
order to be cited. Remembering a reference number for each source may not be
feasible if not planned out in advance. With a little foresight you can systematize
the naming convention to make things easier. An example of such a system is
to use the first three letters of the authors last name and the last two digits of
the year of publication for the reference number.
Once cited, the source will automatically be included in the bibliography.
To cite the source of a quote or a specific paragraph you use the cite command
and the reference number as follows. There are numerous options for formatting
the type of citation. Once a format has been set to default there is no need to
manually format each citation.
\cite{roy01}
This is used when you want the citation to appear visible. For more informa-
tion on finite element analysis refer to [8]. To include a general source in your
bibliography without attributing it to a particular passage, idea or equation
you use the nocite command in the same manner. It is probably good practice
to keep all your nocited sources in a logical place. One such place could be
towards the end of the document before the bibliography in a section separated
by comments.
%------------------------------------------------
% Sources to be included even if not cited
%------------------------------------------------
\nocite{source1}
\nocite{source2}
\nocite{source3}
%------------------------------------------------
20
Search for a source and simply click ”Import into BibTeX” underneath the
article summary on the search page. Copy that text into your class database
and adjust the reference number to conform to the agreed upon system.
There are many online resources that can export citations in BibTeX form
and even create a *.bib file for you upon request. It is left to the reader to
discover what works best for them.
and typing
\lamb{Mary} and \hadlittle{John}{dog}.
Produces, Mary had a little lamb and John had a little dog.
The need to type \begin{environment} and \end{environment} can get
tedious if you use a certain environment often enough. It is possible to define
a custom command that will wrap your input in a particular environment. An
editor with auto-complete is the preferred method but in a pinch:
\newcommand{\bc}[1]{\begin{center} #1 \end{center}}
21
\bc {some centered text.}
Instead of
\begin{center}
some centered text.
\end{center}
to achieve
some centered text.
22
6
−2 −1 0 1 2 3 4 5 6
−1
−2
23
$$
\begin{bmatrix}
2 & -1 & 0 & -1 & 0 & 0 & 0 & 0 & 0 \\
-1 & 3 & -1 & 0 & -1 & 0 & 0 & 0 & 0 \\
0 & -1 & 2 & 0 & 0 & -1 & 0 & 0 & 0 \\
-1 & 0 & 0 & 3 & -1 & 0 & -1 & 0 & 0 \\
0 & -1 & 0 & -1 & 4 & -1 & 0 & -1 & 0 \\
0 & 0 & -1 & 0 & -1 & 3 & 0 & 0 & -1 \\
0 & 0 & 0 & -1 & 0 & 0 & 2 & -1 & 0 \\
0 & 0 & 0 & 0 & -1 & 0 & -1 & 3 & -1 \\
0 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 2 \\
\end{bmatrix}
$$
2 −1 0 −1 0 0 0 0 0
−1 3 −1 0 −1 0 0 0 0
0
−1 2 0 0 −1 0 0 0
−1 0 0 3 −1 0 −1 0 0
0
−1 0 −1 4 −1 0 −1 0
0
0 −1 0 −1 3 0 0 −1
0
0 0 −1 0 0 2 −1 0
0 0 0 0 −1 0 −1 3 −1
0 0 0 0 0 −1 0 −1 2
24
25
Figure 4: Diagram with circuitikz and tikz package.
References
[1] http://bay.uchicago.edu/tex-archive/macros/latex/contrib/fancybox/fancybox-
doc.pdf, feb 2015. fancybox.
26
y
(0, 1)
√ √
− 12 , 23 1
,
2 2
3
√ √ √ √
2 2 2 2
− 2 , 2
π
2 , 2
2
2π π
√ 3 3 √
3 1 3 1
− 2 , 2
3π
90 ◦ π
2 , 2
4 4
120◦ 60◦
5π π
6 6
150◦ 30◦
(−1, 0) (1, 0)
π 180◦ 0◦ ◦
360 2π x
210◦ 330◦
7π 11π
6 6
◦ ◦
√ 240 300 √
5π 7π
− 3 1 270◦ 3 1
2 , −2 4 4 2 , −2
4π 5π
3 3
√ √ 3π √ √
2 2 2 2
− 2 ,− 2
2
2 , − 2
√ √
3 3
− 12 , − 2
1
2 , − 2
(0, −1)
27
A Examples by Subject
A.1 Calculus
To write a definite integral use the int command and a subscript and superscript
for the limits. The fundamental theorem of calculus can be written as
\int_a^b f(x) \; dx = F(b)-F(a)
Problem 1
Z π π
sin(θ) dθ = − cos(θ)
0 0
(11)
= − cos(π) − (− cos(0))
=2
Integration by Parts
Z Z
udv = uv − vdu (12)
lim f (x)
x→∞
∞
X 1
n 2
n=1
A.2 Physics
F~
Fy
Fx
28
F~
Fy Fx = F~ cos θ
Fy = F~ sin θ
θ
Fx
Projectile Motion
Assuming no air resistance the kinematics equations reduce to:
1
hx(t), y(t)i = hxo + vxo t, yo + vyo t − gt2 i
2
A.3 Chemistry
Two packages, mhchem ∗ and chemfig † , were created specifically for creating
chemical formulas and diagrams. Although chemical equations can be typeset
in math mode without additional packages the amount of repetitive typing is
tedious.
The package mhchem uses simple syntax to automate the typesetting of
chemical equations. The command ce is used to denote a chemical equation
and can be used in both text mode and math mode. The code for H2 O is
\ce{H2O}.‡
\ce{CO2 + C -> 2CO} \\[2ex]
\ce{SO4^2- + Ba^2+ -> BaSO4} \\[2ex]
\ce{CH4 + 2O2 -> CO2 + 2H2O}
CO2 + C −−→ 2 CO
∗ Documentation for mhchem package can be found at http://mirror.utexas.edu/ctan/
macros/latex/contrib/mhchem/mhchem.pdf
† Documentation for the chemfig package can be found at http://ftp.math.purdue.edu/
mirrors/ctan.org/macros/generic/chemfig/chemfig_doc_en.pdf
‡ Note that the ‘H’ and ‘O’ are capitalized; A useful template with examples can be found
at http://www.latextemplates.com/template/chemical-equations
29
SO42 – + Ba2+ −−→ BaSO4
C6 H5 −CHO C6 H5 −CHO C6 H5 −
−CHO
Chemical rings can be created with the chemfig package. A single bond is
created with a dash (-), a double bond with an equals sign (=), and a triple
bond with a tilde (∼). An arbitrary ring with 6 vertices and starting with the
letter A is as follows.
\chemfig{A*6(=B-C=D~E=F-)}
E
F D
A C
B
H H
H C C H
H H
Figure 6: Branched Molecules
A.4 Biology
30