Introduction To LaTeX

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

LaTeX

This page is about the basics of LaTeX.


LaTeX is a formatting language that helps making beautifully laid out documents with ease.

The Skeleton
This is the basic skeleton of a LaTeX document. For most cases the documentClass will be
article . The space between the \documentClass{article} and \begin{document} is called the

prologue of the document.

\documentClass{article}

\begin{document}
Hello World
\end{document}

The Title
The title defined can have several attributes. The common ones are:

\title{My first \LaTeX Document}


\author{Dhruv Kapur}
\date{April 2020}

These are written above the \begin{document} tag. The title is then injected into the document
using:

\begin{document}
\maketitle
\end{document}

Text Decoration
Bold → \textbf{}

Italic → \textit{}

Underline → \underline{}

Lists
Unordered List

\begin{itemize}
\item Item1
\item Item2
\end{itemize}

LaTeX 1
Ordered List

\begin{enumerate}
\item Item1
\item Item2
\end{enumerate}

Math
Several Math symbols require the amsmath package. So be sure to include it in the prologue of
the document:

\usepackage{amsmath}

Inline

The mass-energy equivalence \(E=mc^2\) was stated by Albert Einstein in 1905.

Display Block

The mass-energy equivalence is described by the famous formula \[E=mc^2\]

Numbered Equations

The mass-energy equicalence is described by the famous equation \begin{equation}E=mc^2\end{equation}

Subscripts and Superscripts


Subscript is given by _ , for example a_b translates to a subscript b.

Superscript is given by ^ , for example a^b translates to a superscript b.

These can be nested, like

a^b_c gives:

abc

a^{b_c} gives:

abc

And so on.

Dots and Fractions

LaTeX 2
Dots are very important when writing equations with unknown or even infinite terms.
Fractions also show up in several equations and should be represented properly For example:

n(n − 1)
1+2+⋯+n =
2
The above is achieved using the code:

\[1+2+\dots+n=\frac{n(n-1)}{2}\]

Vertical and Diagonal dots can also be introduced using the \vdots and \ddots tags
respectively.

Greek Letters
Greek letters can be used in LaTex by prefixing them with a \ and enclosing them in the
inline syntax, like \(\...\) (replace the dots with the name of the letter. If the name is in all
lowercase, it will get translated into a lowercase letter, while a capitalized name will get
translated into an uppercase letter. For example:

\(\sigma\)\(\Sigma\)

Gets translated to

σΣ

Mathematical Operators
Math Operators are prefixed with a \ and enclosed in the inline syntax, just like the Greek
Letters. For example, \(\log(x) ), \(\sin(\alpha)) . Or, if they are to be in a line of their own,
they can be enclosed with the display block syntax instead.

\[\log(\alpha+\beta)\]

log(α + β)

Important Math Symbols

LaTeX 3
LaTeX 4
LaTeX 5
LaTeX 6
Sums and Products
Sums and Products are also pretty commonly used. These can be achieved in LaTex as:

\[\sum_{i=0}^{\infty}i\]


∑i
i=0

\[\prod_{i=1}^{n}i\]

n
∏i
i=1

Number Sets
The special letters for number sets can also be used in LaTeX. However firstly, add
\usepackage{amsfonts} to the prologue. Now, any number set can be enclosed in \(\mathbb{.}\)

LaTeX 7
(replace the dot with the letter N, Z, R or C for Natural, Integers, Rational or Complex
Numbers respectively).

\(\mathbb{C}\) is the set of all complex numbers

C is the set of all complex numbers

Matrices
Here, we have several types of matrices, but we'll look at only Square Bracket and Round
Bracket matrices.

\begin{bmatrix}
1 & 2 & 3 \\
a & b & c
\end{bmatrix}

1 2 3
[ ]
a b c

\begin{pmatrix}
1 & 2 & 3 \\
a & b & c
\end{pmatrix}

1 2 3
( )
a b c

We can also show the determinant matrix:

\begin{vmatrix}
1 & 2 \\
2 & 1
\end{vmatrix}

∣1 2∣∣

∣2 1∣∣

Matrices can also be made inline using the inline syntax:

This is an inline 2\times2 matix: \(\begin{pmatrix}a&b\\c&d\end{pmatrix}\)

)
a b
T his is an inline 2 × 2 matrix :  (
c d

New Lines and Spaces

LaTeX 8
A new line can be added to the document by physically leaving a line in between the two
lines that you want to break.

This is line 1.

This line will be on a new line.

Spaces show up as they are typed in LaTeX. However, inside the inline math block \(\) and
the display math block \[\] , regular spaces don't register, and they must be explicitly
declared using the \space tag.

LaTeX 9

You might also like