0% found this document useful (0 votes)
8 views20 pages

Latex Introduction

LaTeX is a powerful typesetting system that simplifies the creation of professional-quality documents, particularly those with complex formatting like mathematical equations. The document outlines the structure of a LaTeX document, including the preamble, commands for text formatting, and how to create lists, tables, and manage spacing. It serves as a comprehensive guide for users looking to leverage LaTeX for document preparation.

Uploaded by

Ningombam Jimson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views20 pages

Latex Introduction

LaTeX is a powerful typesetting system that simplifies the creation of professional-quality documents, particularly those with complex formatting like mathematical equations. The document outlines the structure of a LaTeX document, including the preamble, commands for text formatting, and how to create lists, tables, and manage spacing. It serves as a comprehensive guide for users looking to leverage LaTeX for document preparation.

Uploaded by

Ningombam Jimson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

MMSE101A:LATEX UNACCO COLLEGE

LATEX
LATEX, pronounced ”Lah-tech” or ”Lay-tech,” is built on the TeX typesetting system created
by Donald Knuth. LaTeX emerged in the early 1980s as a user-friendly extension of Donald
Knuth’s complex TeX typesetting system. Created by Leslie Lamport, LaTeX aimed to sim-
plify the process of creating professional-quality documents, especially those demanding
intricate formatting like mathematical equations or scientific notations. Its ability to han-
dle 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
creation.
LaTeX is a powerful tool for crafting sophisticated documents, going beyond the capabil-
ities of ordinary word processors. It’s designed for those who demand precise control over
every aspect of their text, from the simplest paragraph to the most intricate mathematical
equation or complex table.
It’s used to create professional-looking documents, especially those with lots of num-
bers, equations, or complicated layouts. Instead of clicking buttons to format text, you
use special codes to tell the computer how you want the document to look. It’s like giving
instructions to a robot designer to create a beautiful document.

Document Structure
In LaTeX, the preamble is the section of the document that comes before the
‘\begin{document}‘ command. It is where the document class is specified, along with
any packages, commands, or settings that are needed to customize the document’s ap-
pearance or behavior.
The preamble typically includes commands that define the document’s overall structure,
such as the title, author, and date, as well as any formatting options, such as font size,
margins, and line spacing. It may also include custom commands or macros that simplify
the process of formatting or entering content.
The preamble is an important part of a LATEXdocument, as it sets the stage for the rest
of the content. It allows the user to customize the document’s appearance and behavior
to suit their needs, and provides a centralized location for managing these settings. The
preamble allows us to set up the document’s overall structure, appearance, and additional
functionality before the main content of the document begins. It plays a crucial role in
defining the document’s characteristics and appearance.

• \documentclass{}: In LATEX, the document class is a fundamental component that


defines the structure and formatting of your document. It is specified using the
\documentclass command at the beginning of the document. Common document
classes include article for academic articles, report for longer documents with chap-
ters, book for books, and beamer for presentations. Each type of document (like
articles, reports, or books) has special features and choices designed for its specific
purpose. These affect how the document looks and what commands we can use.

• \begin{document}...\end{document}: The \begin{document} command in LATEX,


marks the start of the main content of a document. Everything between
\begin{document} and \end{document} is where we write the actual text, equations,
and other elements of a document. It’s the central part where we input the content
that we want to be included in the final document.

• Creating a Title: The title, author, and date of the document are set using commands
such as ‘\title‘, ’\author‘, and ‘\date‘. The ‘\maketitle‘ command is then
used to generate the title page with the provided information.

Page 1
MMSE101A:LATEX UNACCO COLLEGE

• **Chapters and Sections**: LATEXallows for the hierarchical organization of content into
chapters, sections, subsections, and subsubsections using commands like ‘\chapter‘,
‘\section‘, ‘\subsection‘, and ‘\subsubsection‘. This aids in structuring the
document and creating a clear hierarchy of information.

• **Text Formatting**: LATEXprovides a range of commands for formatting text, includ-


ing specifying font sizes, styles, and effects. This allows for precise control over the
appearance of the text in the document.

• **List and Table of Contents**: Lists and tables of contents can be automatically
generated using commands like ‘\tableofcontents‘ and various list environments.
This feature simplifies the management of document structure and navigation.

• **Page Numbering**: LATEXoffers flexibility in managing page numbering and format-


ting. It allows for the easy customization of page numbering styles and supports the
use of different numbering systems, such as Roman numerals for introductory pages.

Text Formatting
LaTeX typically uses a standard font size of 12pt for regular text, which is standard for
technical documents. However, chapter numbers and titles, sections, subsections, and
subsubsections have default font sizes of 16, 14, 13, and 12, respectively. In certain
situations, you might need different font sizes for regular text. However, in normal text,
different font sizes are required, the following table provides a set of commands.

Font Size Command Output

tiny size tiny{Batman} Batman

script size \scriptsize{Batman} Batman

footnote size \footnotesize{Batman} Batman

small size \small{Batman} Batman

normal size normalsize{Batman} Batman

large size \large{Batman} Batman


larger size \Large{Batman} Batman
largest size \LARGE{Batman} Batman
huge size \huge{Batman} Batman
In technical document, usually no text font effects are applied. However, the two very
common effects i.e. bold and italic are sometimes applied. The following set of commands
are used for reformatting

Page 2
MMSE101A:LATEX UNACCO COLLEGE

Font Effect Command Output

italic \textit{Mathematics} Mathematics

bold \textbf{Mathematics} Mathematics

undeline \underline{Mathematics} Mathematics

small cap \textsc{Mathematics} M ATHEMATICS

slanted \textsl{Mathematics} Mathematics

emphasized \emph{Mathematics} Mathematics

teletype \texttt{Mathematics} Mathematics

san serif \textsf{Mathematics} Mathematics

roman \textrm{Mathematics} Mathematics

Page 3
MMSE101A:LATEX UNACCO COLLEGE

LATEX, by default, uses black color for text. To change the color of specific text, we can add
an extra package \usepackage{color} in the Preamble.

Font Effect Command Output

blue {\color{blue}Mathematics} Mathematics

green {\color{green}Mathematics} Mathematics

yellow {\color{yellow}Mathematics} Mathematics

red {\color{red}Mathematics} Mathematics

Numbered or Bulleted List


To make a numbered list in LATEX, use the \begin{enumerate} and \end{enumerate}
commands. Place the items inside these commands, starting each with \item. If we re-
place {enumerate} with {itemize}, we’ll get a bulleted list instead. Subcategories are
introduced automatically as we enter commands. We can optionally predefine the number-
ing style or use bullets by specifying ”number” or ”bullet” in square brackets with \item[].
For example, a simple numbered list is generated by following command
\begin{enumerate}
\item Radeemson Gangmei
\item Phurailatpam Guiness Sharma
\item Micheal Vashker Thingbaijam
\item Lisham Michael Singh
\end{enumerate}
The above command will generate the output as shown below
1. Radeemson Gangmei

2. Phurailatpam Guiness Sharma

3. Micheal Vashker Thingbaijam

4. Lisham Michael Singh


Similarly, if begin{itemize} and \end{itemize} commands are used, the numbering will
be replaced by bullets. For example, the following command
\begin{itemize}
\item Radeemson Gangmei
\item Phurailatpam Guiness Sharma
\item Micheal Vashker Thingbaijam
\item Lisham Michael Singh
\end{itemize}
will produce the output shown below
• Radeemson Gangmei

• Phurailatpam Guiness Sharma

• Micheal Vashker Thingbaijam

• Lisham Michael Singh


The complete code below includes all the mentioned commands and options:

Page 4
MMSE101A:LATEX UNACCO COLLEGE

\begin{enumerate}
\item Introduction
\begin{enumerate}
\item Calculus
\item Algebra
\end{enumerate}
\item Skill Enhancement Course
\begin{itemize}
\item Article class
\item Book class
\end{itemize}
\item AECC
\begin{itemize}
\item [+] Bachelor of Arts
\item [+] Bachelor of Science
\begin{itemize}
\item[-] Mathematics
\item[-] Computer Science
\item[-] Physics
\end{itemize}
\end{itemize}
\item First Semester
\end{enumerate}

The code above will produce the output below:

1. Introduction

(a) Calculus
(b) Algebra

2. Skill Enhancement Course

• Article class
• Book class

3. AECC

+ Bachelor of Arts
+ Bachelor of Science
- Mathematics
- Computer Science
- Physics

4. First Semester

Comment and Spacing


In order not to include a phrase, sentence or a paragraph, use of a ”%” exclude it from the
print. For example, the following sentence;
The Einstein’s general theory of relativity nullified the concept of
Newtons’s law of universal gravitation. %This never mean that Newton’s
calculations were wrong but the concept of gravity was not right.
will be printed as

Page 5
MMSE101A:LATEX UNACCO COLLEGE

The Einstein’s general theory of relativity nullified the concept of Newtons’s law of universal
gravitation.

Horizontal Spacing
In LATEX, multiple consecutive spaces are treated as single space. In order to intention-
ally give a space, this symbol ”˜” is to be used as ”absolutely˜˜˜˜˜˜free” will generate
”absolutely free”.

Vertical Spacing
Several empty lines are treated as on empty line in LATEX. Double ”Enter” is required to
start a new paragraph. for a specified vertical space, the \vspace{} command is used. For
example, the following sentence

The Einstein’s general theory of relativity nullified the concept of \vspace{5pt}

Newtons’s law of universal gravitation. This never mean that Newton’s \vspace{1in}

calculations were wrong but the concept of gravity was not right.

will produce

The Einstein’s general theory of relativity nullified the concept of Newtons’s law of universal
gravitation. This never mean that Newton’s calculations were wrong but the concept of

gravity was not right.

Line Spacing
The setspace package simplifies the process of adjusting line spacing in LaTeX documents.
It provides commands and options to set different spacing values, such as singlespacing,
one-and-a-half spacing, and doublespacing.
To use the setspace package, we need to include it in the preamble of our LaTeX
document. The preamble is the section before \begin{document} where we set up the
overall formatting and configuration of the document. The package provides options for
different line spacing settings:

1. \usepackage[singlespacing]{setspace}: This sets the line spacing to a single


line.

2. \usepackage[onehalfspacing]{setspace}: This sets the line spacing to one-and-


a-half lines.

3. \usepackage[doublespacing]{setspace}: This sets the line spacing to double lines.

In LATEX, \hfill is like a flexible space command used to spread content horizontally. It’s
often used to push elements apart within a line. For example, if you want something on the
left and something else on the right, \hfill fills the space between them evenly. Another
command, \vfill is a way to spread things out vertically. It helps to create space between
elements, pushing them to the top and bottom of the available area.

Page 6
MMSE101A:LATEX UNACCO COLLEGE

Some of the symbols are reserved characters in LATEX. In order to insert these symbols,
the following format is to be followed:

Table 1: Inverted Quotations

Input Output

‘Mathematics’ ‘Mathematics’

‘‘Mathematics" “Mathematics”

Mathematics’s Mathematics’s

,,Mathematics" ,,Mathematics”

Table 2: Dashes and Hyphen format

Label Input Output

hyphen sofa-cum-bed sofa-cum-bed

en dash Pages 16--17 Pages 16–17

em dash yes---no yes—no

minus $-1$ −1

Table 3: Special Character insetion formula

Symbol Input Output

$ \$ $

% \% %

# \# #

ˆ \ˆ{} ˆ

& \& &

{} \{\} {}

˜ \˜{} ˜

\ \textbackslash \

Page 7
MMSE101A:LATEX UNACCO COLLEGE

Table
In LATEX, tables are a useful way to organize and present information. Tables in LATEX are
typically created using the table and tabular environments. To insert a table, a command
environment begin{tabular}{....} and \end{tabular} is used.
• Inside the curly brackets {....}, “l”, “r” and “c” are used for left, right and centered
aligned texts, respectively. For example {lll} produce 3 columns with left aligned
text.

• {lcrl} produces 4 column with left-, centered-, right- and left-aligned texts.

• Vertical line in the table is inserted by “|”, while horizontal line by the command
\hline.

• To join two columns, the command \cline{1-2} inserts a partial horizontal line
between column 1 and column 2.

• & is used to seperate data between two columns.

• \\ is used to start new row.

Example
The following command
\begin{tabular}{lcr}
10&2& 3 \\
100&4& 9 \\
10000&16& 81 \\
100000000&256& 6561 \\
10000000000000000&65536& 43046721 \\
\end{tabular}
will produce the table as follows.

10 2 3

100 4 9

10000 16 81

100000000 256 6561

10000000000000000 65536 43046721


To put the above table at the center, label it and give a caption to it, the tabular{} com-
mands are to be enclosed in the \begin{table} and end{table} commands. For example
the following code
\begin{table}
\centering
\caption{Example of a table with label and caption. \label{tab:LC}}
\begin{tabular}{|l|l|l|}
\hline
1 & 2 & 3 \\
\hline
1 & 4 & 9 \\

Page 8
MMSE101A:LATEX UNACCO COLLEGE

1 & 16 & 81 \\
1 & 256 & 6561 \\
1 & 65536 & 43046721 \\
\hline
\end{tabular}
\end{table}
will produce the table

Table 4: Example of a table with label and caption.

1 2 3

1 4 9

1 16 81

1 256 6561

1 65536 43046721

The following commands


\begin{tabular}{|c|c|c|}
\hline
1 & 2 & 3 \\
\cline{1-2}
1 & 4 & 9 \\
\hline
1 & 16 & 81 \\
\hline
1 & 256 & 6561 \\
\cline{2-3}
1 & 65536 & 43046721 \\
\hline
\end{tabular}
will produce the table as follows:

1 2 3

1 4 9

1 16 81

1 256 6561

1 65536 43046721

Combining rows and columns


The \multicolumn command in LATEXis used to merge cells horizontally in a table. It is
particularly useful when you want to create a table with cells spanning multiple columns.
The syntax for \multicolumn is as follows:
\multicolumn{number_of_column}{alignment}{content}
where

Page 9
MMSE101A:LATEX UNACCO COLLEGE

• ‘number of column’: Specifies the number of column to merge.

• ‘alignment’: Specifies the alignment of the content within the merged cell (c for cen-
ter, l for left, r for right).

• ‘content’: The content to be place in the merged cell.

Example
\begin{tabular}{|p{3cm}|p{3cm}|p{3cm}|}
\hline
\multicolumn{3}{c}{Mathematics} \\
\hline
\textbf{First Name} & \textbf{Last Name} & \textbf{Roll No} \\
\hline
Redeemson & Gangmei & UC/23/73 \\
\hline
Phurailatpham & Guiness Sharma & UC/23/74 \\
\hline
Micheal Vashkher & Thingbaijam & UC/23/75 \\
\hline
Lisham & Michael Singh & UC/23/76
\end{tabular}

Output of the above code

Mathematics

First Name Last Name Roll No

Redeemson Gangmei UC/23/73

Phurailatpham Guiness UC/23/74


Sharma

Micheal Thingbaijam UC/23/75


Vashkher

Lisham Michael Singh UC/23/76

The \multirow command in LATEXis used to merge cells vertically in a table. We need
to include \usepackage{multirow} to used the \multirow in LATEX. It is especially use-
ful when we want to create a table with cells spanning multiple rows. The syntax for
\multirow is as follows:

\multirow{number_of_row}{width}{content}

• number_of_row: Specifies the no of rows to merge.

• width: Specifies the width of the cell. We can use ‘*’ for automated width.

• content: The content to be placed in the merge cell.

Page 10
MMSE101A:LATEX UNACCO COLLEGE

Example
\begin{tabular}{|c|c|c|}
\hline
a & b & c \\
\hline
\multirow{2}{4em}{ABC} & B & C\\
\cline{2-3}
& d & e \\ \hline
f & g & h \\
\hline
\end{tabular}

Output

a b c

B C
ABC
d e

f g h

Positioning of Table
To specify the position of a table in LATEX, you use the table environment along with
placement parameters. One common parameter is h!. Additional parameters include:

• h: Place the table here.

• t: Place the table at the top of the page.

• b: Place the table at the bottom of the page.

• p: Place the table on a separate page.

• H: Place the table at a precise location.

• !: Override external LATEX parameter.

So,h! essentially means ”here, and if that’s not possible, do the best you can.” Adjust these
parameters based on our preferences and document layout.

Mathematics and Equations


An in-line equation in LATEX can be written by enclosing the equation in $ symbols. A
straight line equation is written as; $y = mx + c$ which will produce y = mx + c. In order
to insert the same equation in a separate line, it is to be enclosed in double $$ symbols, as
$$y = mx +c $$ will produce
y = mx + c

\begin{equation}
y=mx+c
\end{equation}

Page 11
MMSE101A:LATEX UNACCO COLLEGE

produce a numbered equation


y = mx + c (1)
In order to write more than one numbered equation, the equation is to be written inside
another equation environment i.e. \begin{eqnarray} and \end{eqnarray}. For example,
the following 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 (2)
2
ax + bx + c = 0 (3)

−b ± b2 − 4ac
x= (4)
2a
To write the same set of equation in way that equalities symbol ($=$) of all equations are
aligned, then the symbol & is to be used before and after the ($=$) symbol inside the
equation. For example, the following 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 (5)
2
ax + bx + c = 0 (6)

2
−b ± b − 4ac
x = (7)
2a
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*}
produces
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
2
ax + bx + c = 0

−b ± b2 − 4ac
x=
2a

Page 12
MMSE101A:LATEX UNACCO COLLEGE

Symbols
To starts with mathematics, the command \usepackage{amsmath}, \usepackage{amssymb},
and \usepackage{gensymb} are to be inserted in the Preamble. Some of the commands
like +, -, = ! / () [] : etc. can be directly entered through keypad, while most of the
symbols are inserted through commands.

Mathematical Symbols
Some of the common mathematical symbols are shown in the table below:

Table 5: List of familiar mathematical symbols, which are to be enclosed in math-mode i.e.
$ $.

Symbol Command Symbol Command

≤, ≥ \leq, \geq ≪, ≫ \ll, \qq

̸=, ≡ \neq, \equiv ∼, ≈ \sim, \approx

≃, ∼
= \simeq, \cong ∥, ∦ \parallel, \nparallel

⊥, ⊢ \perp, \vdash ±, ∓ \pm, \mp

×, ÷ \times, \div ∗, ⋆ \ast, \star

†, ‡ \dagger, \ddagger ·, ⊙ \cdot, \odot

⊕, ⊖ \oplus, \ominus ∈, ∈
/ \in, \notin

→, ← \rightarrow, \leftarrow 7→, ↔ \mapsto, \leftrightarrow

=⇒ , ⇐⇒ \implies, \iff ↑, ↓ \uparrow, \downarrow

∧, ∨ \land, \lor ⇑, ⇓ \Uparrow, \Downarrow

Tex-mode Equivalence
Some of the symbols can be written without math-mode. Table below shows the text-mode
equivalence of some symbols.

Symbol Math-mode Text-mode

| $|$ \textbar

< $<$ \textless

> $>$ \textgreater

– $-$ \textendash

— $-$ \textemdash

† $\dagger$ \dag

‡ $\ddagger$ \ddag

Page 13
MMSE101A:LATEX UNACCO COLLEGE

â $\hat{a}$ \ˆa

ã $\tilde{a}$ \˜a

ȧ $\dot{a}$ \.a

ä $\ddot{a}$ \"a

ā $\bar{a}$ \=a

a2 $aˆ2$ a\textsuperscript 2

a2 $a_2$ a\textsubscript 2

a12 $aˆ{12}$ a\textsuperscript {12}

a12 $a_{12}$ a\textsubscript {12}

Greek Letters
Some of the Greek letters ans their respective commands are shown in the table below:

Symbol Command Symbol Command Symbol Command

α \alpha β \beta γ \gamma

Γ \Gamma π \pi Π \Pi

ϕ \phi φ \varphi Φ \Phi

ϵ $\epsilon$ ε $\varepsilon$ σ $\sigma$

ς $\varsigma$ Σ $\Sigma$ ϱ \varrho

δ \delta ∆ $\Delta$ θ \theta

ϑ \vartheta Θ \Theta µ \mu

ν \nu ξ \xi Ξ \Xi

η \eta ζ \zeta ι \iota

χ \chi τ \tau ℏ \hbar

κ \kappa ∂ \partial λ \lambda

Λ \Lambda ψ \psi Ψ \Psi

ω \omega Ω \Omega ∇ \nabla

∞ \infty ℜ \Re ℑ \Im

Page 14
MMSE101A:LATEX UNACCO COLLEGE

Power and Indices


To write power, the code $$xˆn$$ produces
xn
. Similarly, the code $$a_n$$ produces
an
. If power or index is more than one number, curly brackets are used as, $xˆ{10}$ and
$a_{11}$ produces x10 and a11 , respectively. If both subscript are associated with a letter,
then it can be written both ways as; $x_nˆ2$ or xˆ2_n produce x2n . As an example, the
code $n_1 + nˆ2 = k_{n+1} + k_nˆ2 - kˆ{n-1}$ produces n1 + n2 = kn+1 + kn2 − k n−1 .
Similarly, the code f (x) = x5 + 4x2 |x=0 + 2|x=12 generate
f (x) = x5 + 4x2 |x=10 + 2|x=12

Fractions and Binomial


The common \frac{}{} and \binom{}{} are used for fraction and binomial, respectively.
The code $$ \frac{a}{b} produces
a
b
.
For example, the following code $$\frac{n!}{k!(n-k)!} = \binom{n}{k}$$ gener-
ates  
n! n
=
k!(n − k)! k
n!
= nk , it seems as collapsed.

If the same command is used as in-line with text as k!(n−k)!
To resolve this, another command \dfrac{}{} is used as the command $\dfrac{n!}{k!(n-k)!}$
n!
will generate . It is to be noted for \frac{}{} no extra package is required while
k!(n − k)!
for \dfrac{}{} the package \usepackage{amsmath} must be used.

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
.

Sum and Integral


The command \sum and \int are used for sum and integral, respectively. The code
$$\sum_{n=1}ˆ3 xˆn$$ produces
X3
xn
n=1
However, if the same command is written in-line $\sum_{n=1}ˆ3 xˆn$ it will look like
P3 n
n=1 x .
The in-line look can be changed by using the command $\displaystyle\sum_{n=1}ˆ3 xˆn$
3
X
which produce xn . Similarly, the product can be written as $$\prod_{n=1}ˆ{3}xˆn$$
n=1
which produce
3
Y
xn
n=1

Page 15
MMSE101A:LATEX UNACCO COLLEGE

However, if the same is written in-line $\prod_{n=1}ˆ{3}xˆn$ it will look like 3n=1 xn then
Q
the in-line look can be changed by using the command $\displaystyle\prod_{n=1}ˆ{3}xˆn$
Y 3
produces xn
n=1
In case of integration, the command $$\int f(x)$$ produces
Z
f (x)

For definite integral, the code $$\int_aˆb f(x)$$ produce


Z b
f (x)
a

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 a close loop integral, the code $$\oint f(x)$$ produces
I
f (x)

For double and triple integrals, the codes $$\iint f(x)$$ and $$\iiint f(x)$$ pro-
duces ZZ
f (x)
ZZZ
f (x)

Some complex integral are$$\int \limits_0ˆR \int \limits_0ˆ\pi \int \limits_0ˆ{2\pi}f(x


result in
ZR Zπ Z2π
f (x)
0 0 0

Matrices
A basic matrix can be created using the matrix environment, which is just like a table en-
vironment. For example, to start with simple matrix, the following command is used

\begin{matrix}
a & b & c \\
d & e & f \\
g & h & i \\
\end{matrix}

will produce

a b c

d e f

g h i
In order to enclosed the matrix in brackets, the following environment is used.

Page 16
MMSE101A:LATEX UNACCO COLLEGE

\begin{pmatrix}
a & b & c \\
d & e & f \\
g & h & i \\
\end{pmatrix}

will produce
 
a b c 
 
 
d e f 
 
 
g h i

This way, to enclosed in square bracket [ ] bmatrix, for curli bracket {} \Bmatrix, and
for vertical lines as in a determinant || vmatrix are used.

Array Environment
The LATEX array environment is used frequently to create tables in LATEX documents and
serves the purpose for the presentation of structured data. Data can be arranged into
rows, columns, and cells with this feature, which also offers customization choices for
height, width, alignment, and padding. When the array environment is used properly, it
may provide visually pleasing and well-organized tables that are appropriate for a variety of
information, such as tables, statistical data, and equations.The basic syntax is as follows:

$$
\begin{array}{|c|c|c|}
\hline
\text{First column} & \text{Second column} & \text{Third column} \\
\hline
& & \\
\hline
\end{array}
$$

produces the following output

First column Second column Third column

This is like eqnarray but with flexible rows and columns. It has one equation num-
ber for the entire formula and must be nested within another math environment, such
as equation or displaymath. An example of using the array environment within the
equation environment to create a system of equations:

2x + 3y − z = 5

−3x + 4y + 2z = −7 (8)

x − y + 3z = 10

LATEX provides different tools to write cases and piecewise functions. The array environment
can be used to produce arrays of cases, while the cases environment is more user-friendly

Page 17
MMSE101A:LATEX UNACCO COLLEGE

and can be used in other situations. The amsmath and amssymb packages are required for
these tools.The array environment can be used to typeset a definition by cases. for example
writing the below code

\begin{equation}
Y(i,k) =
\left\lbrace
\begin{array}{lr}
||R_{k}-R_{i}||ˆ{2}, & \text{if } i \neq k\\
||\triangle_{i}||ˆ{2}, & \text{if } i\leq k
\end{array}
\end{equation}

will produce 
||Rk − Ri ||2 , if i ̸= k


Y (i, k) =

||△i ||2 , if i ≤ k

This array environment is very useful and flexible, is not the easiest way to produce this
kind of case situation. As it is usual, the amsmath package provides an easier and more
user-friendly way to typeset piecewise-defined functions, that can also be used in other
situations. Writing the simple code

\begin{equation*}
\chi_{\mathbb{Q}}(x)=
\begin{cases}
1 & \text{if } x \in \mathbb{Q}\\
0 & \text{if } x \in \mathbb{R}\setminus\mathbb{Q}
\end{cases}
\end{equation*}

will produce



1 if x ∈ Q
χQ (x) =


0 if x ∈ R \ Q

Ellipsis
Mathematical equations and textual contents sometimes contain a row of dots (· · ·). These
dots’ meaning together is “ and so on”. These three dots refer to ellipsis points. Ellipses are
exactly three dots, not less or more. In LATEX, if we would only type a period (.) three times
in a row, it will generate undesirable results such as . . . , In the output, those dots are too
close together. LATEX provides several commands to space the Ellipses correctly:

Ellipsis LATEX Command Output

Low 3 dots \ldots ...

Center 3 dots \cdots ···


..
Vertical 3 dots \vdots .
..
Diagonal 3 dots \ddots .

Page 18
MMSE101A:LATEX UNACCO COLLEGE

Examples
A low ellipsis: $x_1, x_2, \ldots, x_n$
A centered ellipsis: $a_1, a_2, \cdots, a_n$
compiling these codes yield
A low ellipsis: x1 , x2 , . . . , xn
A centered ellipsis: a1 , a2 , · · · , an

The command \ldots is usable both in text and math mode; the remaining three kinds
of ellipsis are only allowed in math mode.

Changing style in Math mode


In LaTeX, you can change the style of mathematical expressions, such as the font, size, or
appearance of certain symbols, within math mode. Here are some common ways to achieve
this:
1. Changing Font Style:

• Use commands like ‘\mathbf{}‘, ‘\mathrm{}‘, ‘\mathit{}‘, ‘\mathsf{}‘,


‘\mathtt{}‘ to change the font style.
• Example: The commands \(\mathbf{Bold}\)‘, \(\mathrm{Roman}\),
\(\mathit{Italic}\), \(\mathsf{Sans-serif}\), \(\mathtt{Typewriter}\)‘
will produce Bold, Roman, Italic, Sans − serif, Typewriter‘.

2. Changing Font Size:

• Use commands like ‘\displaystyle‘, ‘\textstyle‘, ‘\scriptstyle‘,


‘\scriptscriptstyle‘ to change the size.
• Example: The command ‘\(\displaystyle \sum_{i=1}ˆ{n} x_i\)‘ or
Xn
‘\(\textstyle \frac{1}{2}\)‘ will produce ‘ xi ‘ or ‘ 21 ‘
i=1

3. Changing Symbols:

• Use specific commands for symbols, e.g., ‘\mathbb{}‘ for blackboard bold,
‘\mathcal{}‘ for calligraphy, ‘\mathfrak{}‘ for Fraktur, etc.
• Example:Giving the command \(\mathbb{R}\), \(\mathcal{ABC}\),
\(\mathfrak{abc}\) will produce R, ABC, abc

4. Coloring Text:

• Use the ‘xcolor‘ package to add color to your math expressions.



• Example: command ‘\textcolor{red}{\(\sqrt{x}\)}‘ produce ‘ x‘

5. Using Different Environments:

• Use different math environments for specific styles, such as ‘align‘, ‘eqnarray‘,
or ‘cases‘.
• Example:

f (x) = x2 (9)

g(x) = x (10)

Remember to use these commands and environments appropriately within math mode
‘$ ... $‘ for in-line math, or ‘\[ ... \]‘ for display math).

Page 19
MMSE101A:LATEX UNACCO COLLEGE

Footnote
In LATEX, footnotes are used to provide additional information or comments at the bottom
of a page. They are typically used to explain, elaborate, or cite sources for specific points
in the main text. Here’s a simple explanation of how footnotes work in LATEX:
In LATEX, we can insert a footnote using the \footnote{} command. The content we
want to appear as a footnote goes inside the curly braces. Here’s a basic example:

\documentclass{article}
\begin{document}
This is some text with a footnote.\footnote{This is a footnote with
additional information.}
\end{document}

will give the following output This is some text with a footnote.1 See the lower part of the
this page we will see what we have written inside the curly brackets.

1
This is a footnote with additional information.

Page 20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy