Professional Documents
Culture Documents
Brij Mohan
Hansraj College
(University of Delhi)
What is LATEX
What is LATEX
What is LATEX
What is LATEX
Advantages of LATEX
Advantages of LATEX
Advantages of LATEX
Advantages of LATEX
Advantages of LATEX
Basic Structure
The LATEX source file, say myDoc.tex has the following basic
structure:
\ documentclass [ options ]{ c l a s s }
\ u s e p a c k a g e { packageName }
\ b e g i n { document }
Put y o u r t e x t h e r e .
\ end { document }
Basic Structure
The LATEX source file, say myDoc.tex has the following basic
structure:
\ documentclass [ options ]{ c l a s s }
\ u s e p a c k a g e { packageName }
\ b e g i n { document }
Put y o u r t e x t h e r e .
\ end { document }
A Simple Example
\ d o c u m e n t c l a s s [ 1 2 p t ] { book }
\ b e g i n { document }
T h i s i s my f i r s t document .
\ end { document }
\large{Text with font size large}. Text with font size large.
\begin{LARGE} Text with font size
Text with font size LARGE.
\end{LARGE} LARGE.
Formatting Text
Formatting Text
Formatting Text
Answer
A \ underline { Latex document } is a \ textbf { high typographical
quality } document which produces \ textit { mathematical
typesetting and research } document .
One or more than one blank space will be treated as single blank space.
A single Enter (from keyboard) is also treated as a single blank space.
More than one Enter (from keyboard) marks the beginning of a new
paragraph.
\textcolor{color_name}{text}
\colorbox{color_name}{text}
Answer
The skilled based papers
\ vspace {0.3 in }
is a good initiative by \ colorbox { yellow }{ UGC }.
Command Purpose
\chapter Starts a new chapter, applicable only in report and book,
not in article.
\part Divide the whole document into the parts.
\section Starts a new section.
\section* Section with no numbering.
\subsection Starts a new subsection.
\subsubsection Starts a new subsubsection.
\ d o c u m e n t c l a s s [ 1 2 p t ] { book }
\ s e t c o u n t e r { s e c n u m d e p t h }{3} Chapter 1
\ b e g i n { document }
\ c h a p t e r { L a t e x and HTML}
Latex and HTML
\ section { Introduction }
1.1 Introduction
\ s u b s e c t i o n { Examples } 1.1.1 Examples
\ s u b s e c t i o n ∗{ S y n t a x }
\ end { document }
Environments
Environment Name Purpose
itemize An unordered list with bullets.
enumerate An ordered list with numbered labels.
tabular To create table.
table Insert a table with caption.
eqnarray Display aligned math formulae.
equation Centered math formula with equation number.
figure Insert a figure with caption.
flushleft Text is aligned on the left, lines end with \\.
flushright Text is aligned on the right, lines end with \\.
theorem Make a numbered theorem.
thebibliography The bibliography or reference section.
titlepage Making a separate title page of your choice.
array Produce arrays in math environment.
\begin{environment_name}
...
\end{environment_name}
\begin{enumerate}
\item First item 1 First item
\item Second item
2 Second item
\item Third item
3 Third item
\end{enumerate}
\ begin { enumerate }
\ i t e m The f i r s t i t e m .
\ begin { enumerate }
\ item F i r s t nested l i s t .
\ begin { enumerate } 1. The first item.
\ i t e m Second n e s t e d l i s t . (a) First nested list
\ begin { enumerate } i. Second nested list
\ item Third nested l i s t . A. Third nested list
\ end { e n u m e r a t e }
2. The second item.
\ end { e n u m e r a t e }
\ end { e n u m e r a t e }
\ i t e m The s e c o n d i t e m .
\ end { e n u m e r a t e }
Unordered List
Unordered List
LATEX provides the environment ‘itemize’ to create an unordered list. Like
ordered list, it can be nested up to four levels.
The default labeling scheme is:
• for Level 1.
− for Level 2.
∗ for Level 3.
· for Level 4.
\begin{itemize}
\item item 1 item 1
\item item 2 item 2
\item item 3
item 3
\end{itemize}
\ begin { itemize }
\ i t e m The f i r s t i t e m .
\ begin { itemize }
\ item F i r s t nested l i s t
\ begin { itemize } • The first item.
\ i t e m Second n e s t e d l i s t – First nested list
\ begin { itemize } ∗ Second nested list
\ item Third nested l i s t · Third nested list
\ end { i t e m i z e }
• The second item.
\ end { i t e m i z e }
\ end { i t e m i z e }
\ i t e m The s e c o n d i t e m .
\ end { i t e m i z e }
Mathematics
Answer
\ d o c u m e n t c l a s s [ 1 1 p t ] { book }
\ b e g i n { document }
Chapter 1
\ c h a p t e r { Mathematics }
\ s e c t i o n { Compulsory Papers } Mathematics
\ s u b s e c t i o n { Core Papers }
\ begin { enumerate }
\ item A n a l y s i s 1 1.1 Compulsory Papers
\ item C a l c u l u s 1
\ end { e n u m e r a t e } 1.1.1 Core Papers
1. Analysis 1
\ s u b s e c t i o n { E l e c t i v e Papers } 2. Calculus 1
\ end { document }
Table of Contents
Table of Contents
Use command ‘\tableofcontents’ after the command ‘\begin{document}’
to create table of contents.
\ d o c u m e n t c l a s s [ 1 1 p t ] { book }
\ b e g i n { document }
\ tableofcontents
\ c h a p t e r { Mathematics }
\ s e c t i o n { Compulsory Papers }
\ s u b s e c t i o n { Core Papers }
\ begin { enumerate }
\ item A n a l y s i s 1
\ item C a l c u l u s 1
\ end { e n u m e r a t e }
\ s u b s e c t i o n { E l e c t i v e Papers }
\ begin { enumerate }
\ item H i s t o r y of I n d i a
\ item Micro Economics
\ end { e n u m e r a t e }
\ s e c t i o n { Optional Papers }
\ begin { itemize }
\ i t e m Number The ory
\ item Bio Mathematics
\ end { i t e m i z e }
Brij Mohan (HRC, DU) LATEX 26 / 64
Environments Making List
Table of Contents
Contents
1 Mathematics 3
1.1 Compulsory Papers . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Core Papers . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2 Elective Papers . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Optional Papers . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Creating Table
Creating Table
Creating Table
\begin{tabular}{|r|c|}
\hline
\textbf{Student Name} & \textbf{Marks} \\
\hline
Student Name Marks
Pawan & 90 \\
Pawan 90
\hline
Naveen 89
Naveen & 89 \\
Deepak 80
\hline
Deepak & 80 \\
\hline
\end{tabular}
\begin{table}
\centering
\begin{tabular}{|r|c|}
\hline
\textbf{Student Name} & \textbf{Marks} \\
\hline Student Name Marks
Pawan & 90 \\ Pawan 90
\hline Naveen 89
Naveen & 89 \\ Deepak 80
\hline
Deepak & 80 \\ Table 1: Marks Details
\hline
\end{tabular}
\caption{Marks Details}
\end{table}
Inserting Images
Inserting Images
To insert images or pdf files, include the package ‘graphicx’ in the preamble of the LATEX
document.
Ensure that the image or pdf file lies in the same folder where the LATEX file lies otherwise
specify the complete path.
\begin{figure}[float]
\includegraphics[options]{image/file}
\caption{captionText}
\label{labelText}
\end{figure}
Float Purpose
h (here) Same location
t (top) Top of the page
b (bottom) Bottom of the page
! (override) Force the specified location
H (precised) Placed at precised location
option Purpose
width To set width (in cm., inches or fraction of line width)
height (top) To set height
trim To crop image/file (trim = l b r t)
rotate to rotate at specified angle
Inserting Figure
\ d o c u m e n t c l a s s { book }
\ usepackage { graphicx }
\ usepackage { caption }
\ b e g i n { document }
\ begin { f i g u r e }[ h ]
\ i n c l u d e g r a p h i c s [ w i d t h=3cm , h e i g h t =3cm ] { b i r d . j p g }
\ caption { Birds }
\ l a b e l { mark1 }
\ end { f i g u r e }
Figure 1: Birds
C o n s i d e r t h e p i c t u r e shown i n f i g u r e \ r e f { mark1 } .
\ end { document }
\ d o c u m e n t c l a s s { book }
\ usepackage { graphicx }
\ usepackage { caption }
\ b e g i n { document }
\ begin { f i g u r e }[ h ]
\ i n c l u d e g r a p h i c s [ t r i m =0 i n 1 i n 0 i n 0 i n , c l i p =t r u e ,
w i d t h= 3 . 5 cm , h e i g h t = 3 . 5 cm , a n g l e = 3 0 ] { b i r d . j p g }
\ caption { Birds }
\ l a b e l { mark2 }
\ end { f i g u r e }
C o n s i d e r t h e p i c t u r e shown i n f i g u r e \ r e f { mark2 } .
\ end { document }
Figure 2: Birds
Cross-Reference
Cross-Reference
In LATEX, you can cross-refer almost everything that is numbered (like chapter,
section, subsection, figure, table etc.).
\label{mark}
Put the command \label after the declaration of object, you want to label.
But in case of environments, it should be placed inside the environment.
\ref{mark}
The command \ref is used for referencing the object that has been labeled
earlier with label ‘mark’. This prints the number that was assigned to the
object.
Cross-Reference Chapter 1
faas
\ s e c t i o n { I n t r o d u c t i o n } \ l a b e l { mark3 }
This s e c t i o n i s i n t r o d u c t o r y . 1.1 Introduction
Mathematical Typesetting
Mathematical Typesetting
For mathematical typesetting, include the package ‘amsmath’ in the preamble of the LATEX
document.
When the mathematical expression appears in the running text, surround the formula
with the dollar sign $.
When the mathematical expression appear in a separate paragraph, surround the formula
with the double dollar sign $$ or within \[ and \].
Equation x + y = 1 and
x +y =1
Mathematical Equation
\begin{equation}\label{mark6}
x^{2}+y^{2} = 1.
x 2 + y 2 = 1. (1)
\end{equation}
\begin{equation*} x/4 + y /9 = 1.
x/4+y/9 = 1.
\end{equation*} The equation 1 represents a circle cen-
The equation \ref{mark6} represents a circle ter at (0,0) with radius 1.
center at (0,0) with radius 1.
Mathematical Equations
\begin{eqnarray}
x + 3y = 2. \label{mark7} \\ x + 3y = 2. (2)
x \leq 3 + 4x + 5y. \nonumber
\end{eqnarray} x ≤ 3 + 4x + 5y .
\begin{eqnarray}
x + 3y &=& 2.\label{mark8} \\
x &\leq& 3 + 4x + 5y. \nonumber x + 3y = 2. (3)
\end{eqnarray}
x ≤ 3 + 4x + 5y .
Consecutive equations are separated by \\ and to align left and right hand side of
equations use &.
Terminate an equation with command \nonumber, if no equation number required.
Creating Matrix
The ‘array’ environment is used to create array. The general syntax is:
\begin{array}{options}.
The options consist of l, r or c for left, right and center aligned text.
Separate each column entry by & and end each row with \\.
$\begin{array}{ccc}
1 & 3 & 2\\
3 & 4 & 1\\
1 3 2
2 & 8 & 2
3 4 1
\end{array}$
2 8 2
1 3 2
$\left( \begin{array}{ccc} 3 4 1
1 & 3 & 2\\
2 8 2
3 & 4 & 1\\
2 & 8 & 2
\end{array}\right)$
Greek Symbols
Mathematical Operators
^{} x^{2} x2
_{} x_{2} x2
1
\frac{}{} \frac{1}{2} 2
√
\sqrt{} \sqrt{2} 2
√
3
\sqrt[n]{} \sqrt[3]{2} 2
P∞
\sum_{}^{} \sum_{x = 0}^{\infty}e^{x} x=0 ex
Qn
\prod_{}^{} \prod_{k=1}^{n} k k=1 k
R1
\int_{}^{} \int_{0}^{1}x dx 0 xdx
Mathematical Functions
n2 + 3n + 2 n+1
( )=( )
n(n + 1) n
.
n2 + 3n + 2
n+1
=
n(n + 1) n
.
Arrows
Command Result Command Result Command Result
\leftarrow ← \rightleftharpoons
\leftleftarrows ⇔
\leftarrowtail \Leftarrow ⇐ \hookrightarrow ,→
\rightrightarrows ⇒ \rightarrowtail \rightarrow →
\rightharpoonup * \leftrightarrows \looparrowleft "
\Rightarrow ⇒ \rightharpoondown + \rightleftarrows
\looparrowright # \leftrightarrow ↔ \uparrow ↑
\Lleftarrow W \curvearrowleft x \Leftrightarrow ⇔
\Uparrow ⇑ \Rrightarrow V \curvearrowright y
\mapsto 7→ \downarrow ↓ \leftrightharpoons
\nleftarrow 8 \hookleftarrow ←- \Downarrow ⇓
\rightleftharpoons
\nrightarrow 9 \leftharpoonup (
\upharpoonleft \upharpoonright \downharpoonleft
\downharpoonright \downharpoonright \Lsh
\Rsh \upuparrows \downdownarrows
\updownarrow l \twoheadleftarrow \nLeftarrow :
\leftharpoondown ) \Updownarrow m \twoheadrightarrow
Brij Mohan (HRC, DU) LATEX 47 / 64
Mathematical Typesetting
Mathematical Formatting
If n = 4, then n2 + 4 = 20.
b4.2c = 4.
The nth term of the sequence is an = n2 + 1.
Let α = 3, β = 4 and γ = 5.
If sin θ = 0, then θ = nπ where n ∈ N.
Mathematical Formatting
It is not always true that $$\frac{a+b}{c+d} = \frac{a}{c} + \frac{b}{d}$$.
x2 x3
ex = 1 + x + + + ···
2! 3!
UseBrijof
Mohan (HRC, DU) 2xy 6= 2x y .
brackets LATEX 49 / 64
Mathematical Typesetting
Mathematical Formatting
n 2
X
3 n(n + 1)
k =
k=1
2
1 1 1 1 1 1 1
1+ + + + + + + +···
2 |3 {z 4} |5 6 {z 7 8}
Mathematical Formatting
$$A_{m,n} =
\left[\begin{array}{cccc}
a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m,1} & a_{m,2} & \cdots & a_{m,n}
\end{array}
\right]$$
a a1,2 · · · a1,n
1,1
a2,1 a2,2 · · · a2,n
Am,n =
.. .. .. ..
.
. . .
am,1 am,2 · · · am,n
Mathematical Formatting
Z x
d
f (u)du = f (x)
dx 0
.
lim exp(−x) = 0
x→∞
.
Creating Block
A ‘block’ environment can be used to create any kind of named block. A block can be of
theorem, lemma, corollary or example.
Include the package ‘amsthm’ in the preamble of the document before using this environment.
The general syntax for defining a new block is:
\newtheorem{key}{blockName}
where key is used to reference the new block and blockName is the name of this block.
\newtheorem{myDef}{Definition}
\begin{myDef} Definition 1
Write definition here. Write definition here.
\end{myDef}
\begin{myDef} Definition 2
Write another definition here.
Write another definition here.
\end{myDef}
Creating Block
To number blocks according to chapter or section or subsection, use the following:
\newtheorem{key}{blockName}[numberBy]
\ d o c u m e n t c l a s s [ a 4 p a p e r , 1 1 p t ] { book }
\ u s e p a c k a g e {amsthm} Chapter 1
\ newtheorem {thm }{ Theorem } [ c h a p t e r ]
\ newtheorem { examp }{ Example } [ s e c t i o n ]
Introduction
\ b e g i n { document }
\ chapter { Introduction }
1.1 Section 1
\ s e c t i o n { S e c t i o n 1} Theorem 1.1. First theorem.
\ b e g i n {thm} F i r s t t h e o r e m . \ end {thm} Example 1.1.1. First example.
\ b e g i n { examp } F i r s t e x a m p l e . \ end { examp }
1.2 Section 2
\ s e c t i o n { S e c t i o n 2}
\ b e g i n {thm} Second t h e o r e m . \ end {thm} Theorem 1.2. Second theorem.
\ b e g i n { examp } Second e x a m p l e . \ end { examp } Example 1.2.1. Second example.
\ end { document }
Brij Mohan (HRC, DU) LATEX 58 / 64
Mathematical Typesetting
Comments
Comments
The symbol % is used to put a comment line.
For multiple line comment, use the environment ‘comment’. To use
this environment include the package ‘verbatim’ in the preamble of
the document.
%This line will not appear in output.
Or you can leave a note for yourself.
%Complete this section later.
Here is multiple line comment. Or you can leave a note for your-
\begin{comment}
These lines will not appear self.
on the final output. Here is multiple line comment.
If a portion of code gives error
one can comment sub portion
to locate the error
\end{comment}
Footnote
Footnote
Footnote can be produced with command, \footnote. The syntax of this command is:
\footnote[number]{text}
The optional argument number is used to change the default footnote number.
1
Computer Code
Computer Code
LATEX provides the environment lslisting to include computer code in the document.
\begin{lstlisting}[backgroundcolor=\color{red}]
\documentclass{article} \documentclass{article}
\begin{document} \begin{document}
This is my first document. This is my first document.
\end{document} \end{document}
\end{lstlisting}
The Bibliography
The Bibliography
The environment, ‘thebibliography’ can be used to create bibliography. The structure is:
\begin{thebibliography}{noOfRef}
\bibitem{citationKey} ...
\bibitem{citationKey} ...
\end{thebibliography}
\begin{thebibliography}{9}
\bibitem{san1}Leslie Lamport, Latex, Addison Wesley Publishing Company, 1994.
\bibitem{san2}Sandeep Kumar, Latex and HTML, Vardhman Publications, 2016.
\end{thebibliography}
Citation
‘\cite{key1}’ command is used to cite any bibliography reference with citation key ‘key1’.
To cite multiple references, include all the citation keys within the curly brackets separated by
comma, for example, \cite{key1, key2, key3}
For s i n g l e c i t a t i o n \ c i t e { san1 } .
For single citation [1].
For multiple citations [1, 2].
For m u l t i p l e c i t a t i o n s \ c i t e { san1 , s a n 2 } .
Thank You !