New Latex Introduction
New Latex Introduction
LATEX
LATEXis a software for typesetting documents. In other words, it’s a document preparation system.
LATEXis not a word processor, but is used as a document markup language. The history of LATEX be-
gins with a program called TEX 1 . In 1978, a computer scientist by the name of Donald Knuth grew
frustrated with the mistakes that his publishers made in typesetting his work. He decided to cre-
ate a typesetting program that everyone could easily use to typeset documents, particularly those
that include formulae, and made it freely available. The result is TEX. LATEXemerged in the early
1980s as a user-friendly extension of Donald Knuth’s complex TeX typesetting system. Created by
Leslie Lamport, LATEXaimed to simplify the process of creating professional-quality documents, es-
pecially those demanding intricate formatting like mathematical equations or scientific notations.
Its ability to handle complex layouts and produce high-quality output has made it a popular choice
among academics, scientists, and engineers. As an open-source project, LaTeX continues to evolve
with new features and improvements, solidifying its position as a leading tool for document cre-
ation.
LATEX Document
Every LaTeX document needs the following parts:
\documentclass{article}:LATEX documents start with a "document class". This tells LATEX what
kind of document we are making (like an article, report, or book). It decides how the doc-
ument looks. LaTeX documents usually use a 10-point font. The default font size for each
class is 10 point. You can use 11 point or 12 point fonts by including this information in
the \documentclass command as \documentclass[11pt]{article}. No need to write 10-
point, as that’s the normal size.
In general, required information is included in LaTeX commands in braces {} while optional
information is included in square brackets []. The \documentclass command must appear
at the very beginning of a LATEX document, before any other LaTeX commands, or we will get
an error message.
If we have commands for LATEX that will affect the whole document, we should include them in
the preamble, which is what the space between the \documentclass and \begin{document}
commands is called.
Document Structure
1. Page Numbering and Headings: The \pagestyle command sets how page numbers and
headings look. It is placed before the main content of your document, typically between the
\documentclass{article} and \begin{document} commands. It controls page number
and heading placement. It can take the following form.
• The default style is \pagestyle{plain}. This puts the page number in the middle of
the bottom of the page and doesn’t have any headings.
• \pagestyle{empty} provides neither page numbers nor headings.
1
TeX is a tool for precise text formatting, especially for complex math and science.
Page 1
MMSE101A:LATEX UNACCO COLLEGE
• \pagestyle{headings} will provide page numbers and headings from any \section's
that we are using.
2. Creating a Title Page: The title, author, and date of our document are information that var-
ious LATEX commands can make use of, if we provide it.It is a good habit to get into to provide
this information in the preamble 2 . The commands are:
• \title{yourtitlehere}
• \author{yournamehere}
• \date{currentdate}
Given that we have provided this information in the preamble, If we want a title heading, add
a \maketitle command right after the \begin{document} command.
Both commands help in organizing the content and can be used to generate a Table of Con-
tents if needed.
5. Table of Contents: In a large document, it’s helpful for our reader to have a Table of Contents.
If we’ve used \section commands to organize our document, LATEX already has the necessary
information to create one. To include a Table of Contents, just add the \tableofcontents
command right after the \begin{document} command. LATEX will automatically generate a
Table of Contents for us, listing all the sections in our document.
6. Abstracts: To create an abstract in our document, place the abstract text between the
\begin{abstract} and \end{abstract} commands. The abstract should appear right af-
ter the \maketitle command (which generates the title of our document) and before any
\tableofcontents command (which generates the Table of Contents). This placement en-
sures that the abstract is properly formatted and positioned at the beginning of our docu-
ment.
2
the preamble refers to any commands between the documentclass command and the begin{document} com-
mand of our document.
Page 2
MMSE101A:LATEX UNACCO COLLEGE
Mathematical Typesetting
In LaTeX, we can insert mathematical formulas into our document in two ways:
• Inline with Text: This method places the formula within a paragraph of text. When we do
this, the formula is compressed to fit within the line of text. For example, limits for integrals
and summations will appear beside the symbol rather than above or below it.
• Displayed Separately: This method places the formula in its own paragraph, separate from
the surrounding text. When done this way, the formula is given more vertical space, allowing
for proper placement of elements like limits above and below symbols.
Using the appropriate method depends on how we want the formula to be presented in your doc-
ument.
For formulas that appear in a paragraph, surround them with $’s. For example,
$\alpha$ is the first letter of Greek alphabet.
becomes
α is the first letter of Greek alphabet.
To make math look bigger and have its own space, put it between two double dollar signs ($$). For
example:$$ x^{2} + y^{2} = r^{2} $$ becomes
x2 + y 2 = r 2
\begin{equation}
y=mx+c
\end{equation}
\begin{eqnarray}
E = mc^2 \\
F = ma \\
v = d/t
\end{eqnarray}
This will create three numbered equations, each on its own line.
E = mc2 (2)
F = ma (3)
v = d/t (4)
To align the equal signs in a set of equations, use the & symbol before and after the equal sign
within the eqnarray environment.
For example:
Page 3
MMSE101A:LATEX UNACCO COLLEGE
\begin{eqnarray}
E &=& mc^2 \\
F &=& ma \\
v &=& d/t
\end{eqnarray}
produce
E = mc2 (5)
F = ma (6)
v = d/t (7)
In case numbering is not desired, the respective commands are to be replaced by \begin{equation*}
and \end{equation*}. For example, the code
\begin{equation*}
y = mx + c
\end{equation*}
will result in
y = mx + c
similarly, the code
\begin{eqnarray*}
y &=& mx + c \\
ax^2 + bx + c &=& 0 \\
x &=& \dfrac{-b\pm \sqrt{b^2-4ac}}{2a}
\end{eqnarray*}
produces
y = mx + c
axˆ2 + bx + c = 0 √
−b ± bˆ2 − 4ac
x =
2a
Page 4
MMSE101A:LATEX UNACCO COLLEGE
Mathematical Symbol
Some of the common mathematical symbols are shown in the table below:
Table 1: List of familiar mathematical symbols, which are to be enclosed in math-mode i.e. $ $.
≃, ∼
= \simeq, \cong ∥, ∦ \parallel, \nparallel
⊕, ⊖ \oplus, \ominus ∈, ∈
/ \in, \notin
Tex-mode Equivalence
Some of the symbols can be written without math-mode. Table below shows the text-mode equiv-
alence of some symbols.
| $|$ \textbar
– $-$ \textendash
— $-$ \textemdash
† $\dagger$ \dag
‡ $\ddagger$ \ddag
â $\hat{a}$ \^a
ã $\tilde{a}$ \~a
ȧ $\dot{a}$ \.a
Page 5
MMSE101A:LATEX UNACCO COLLEGE
ä $\ddot{a}$ \"a
ā $\bar{a}$ \=a
a2 $a^2$ a\textsuperscript 2
a2 $a_2$ a\textsubscript 2
Greek Letters
Some of the Greek letters ans their respective commands are shown in the table below:
Page 6
MMSE101A:LATEX UNACCO COLLEGE
xn
Roots
√
Square root symbols are inserted using the command \sqrt{} as $\sqrt{x}$ produces x.For
the specfication of magnitude, the command is used with optional square brackets as $$\sqrt[y]{x}$$
produces √y
x
.
However, if the same command is written in-line $\sum_{n=1}^3 x^n$ it will look like xn .
P3
n=1
Page 7
MMSE101A:LATEX UNACCO COLLEGE
The in-line look can be changed by using the command $\displaystyle\sum_{n=1}^3 x^n$
X3
which produce xn . Similarly, the product can be written as $$\prod_{n=1}^{3}x^n$$ which
n=1
produce
3
Y
xn
n=1
However, if the same is written in-line $\prod_{n=1}^{3}x^n$ it will look like 3n=1 xn then the
Q
in-line look can be changed by using the command $\displaystyle\prod_{n=1}^{3}x^n$ pro-
Y 3
duces xn
n=1
In case of integration, the command $$\int f(x)$$ produces
Z
f (x)
To write the limits above the integral, the code is to be changed as $$\int\limits_a^b f(x)$$
produce
Zb
f (x)
a
For double and triple integrals, the codes $$\iint f(x)$$ and $$\iiint f(x)$$ produces
ZZ
f (x)
ZZZ
f (x)
Page 8