Advancing Engineering with AI through the Next Generation of Strategic Projec...
Tutorial on LATEX: A Computer Program for Typesetting Documents
1. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar
LATEX-Software
Tutorial on LATEX: A Computer Program
for Typesetting Documents
Dr. Mehar Chand
Department of Computer Science
Baba Farid College, Bathinda-151001
March 15, 2020
Mehar Chand Tutorial on LATEX-Software
3. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar
Latex software
LATEX is a high-quality typesetting system; it includes
features designed for the production of technical and
scientific documentation.
It takes a computer file, prepared according to the LATEX
rule and converts it to a form that may be printed on a
high-quality printer, such as a laser writer, to produce a
printed document of a quality comparable with good
quality books and journals.
Simple documents, which do not contain mathematical
formulae or tables may be produced very easily and
effectively.
It is particularly suited to the production of long articles
and books, since it has facilities for the automatic
numbering of chapters, sections, theorems, equations
etc., and also has facilities for cross-referencing.
Mehar Chand Tutorial on LATEX-Software
4. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar
Why LATEX is more important?
TEX math mode is a thing of beauty. Equations come
out looking correct.
TEX is guaranteed to be bug free.
There are no TEX ”macro” viruses. You can safely
receive TEX documents by email and not worry about it
reading your OutLook address book and mailing copies
of itself to all your friends and colleagues.
TEX has no GUID (Globally Unique Identifier). Word
documents are embedded with a code that can be
traced back to your computer
TEX versions are not incompatible. The file format has
never changed. The prepared file can be used in any
system, any version can be used for the same file.
TEX documents are small and lean.
Mehar Chand Tutorial on LATEX-Software
5. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar LATEX Software
LATEX is open source software and is free available. It can
be easily download from internet. The package of LATEX
includes
Basic MikTeX
Tex editor(Texniccenter, Texmaker and Winedit)
Mehar Chand Tutorial on LATEX-Software
6. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Installation of LATEX Software
First install Basic MikTex
Then install Tex editor Texniccenter or Texmaker If
you are installing Texniccenter give path
C:Program FilesMiKTeX 2.9miktexbin.exe
Mehar Chand Tutorial on LATEX-Software
7. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Definition (Preamble of LaTeX)
The preamble is the first section of an input file, before the
text of the document itself, in which you tell LATEX the type of
document, and other information LATEX will need to format
the document correctly.
Mehar Chand Tutorial on LATEX-Software
8. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
documentclass[option]{class}
This part is preamble of LaTeX,
All the supporting packages and
commands are define here...
usepackage{...}
begin{document}
end{document}
The options parameter customises the behaviour of the
document.
Here class specifies the type of document to be created.
Mehar Chand Tutorial on LATEX-Software
9. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Document Options
Paper: a4paper, a5paper, legalpaper, letterpaper,
executivepaper, etc.
Font Size: 10pt, 11pt, 12pt (1 inch = 2.54cm, 1 inch =
72.27pt)
onecolumn, twocolumn
twoside, oneside
landscape
openright, openany (Makes chapters begin either only
on right hand pages or on the next page available)
fleqn (Typesets displayed formulas left-aligned instead
of centred)
leqno (Places the numbering of formulas on the left
hand side instead of the right)
Mehar Chand Tutorial on LATEX-Software
10. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Document Classes
article–for articles in scientific journals, presentations,
short reports, program documentation, invitations etc.
proc–a class for proceedings based on the article
class.
report–for longer reports containing several chapters,
small books, PhD theses etc.
book–for real books.
slides–for slides.
documentclass[a4paper, 11pt, leqno]{article}
documentclass[legalpaper, 12pt, reqno,
twoside, openright]{book}
Mehar Chand Tutorial on LATEX-Software
11. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Page Style
pagestyle{style}
plain–prints the page numbers on the bottom of the
page, in the middle of the footer. This is the default
page style.
headings–prints the current chapter heading and the
page number in the header on each page, while the
footer remains empty.
myheadings-there are more options to modify
page-style
empty–sets both the header and the footer to be empty.
It is possible to change the page style of the current page
with the command
thispagestyle{style} %used for current page
Mehar Chand Tutorial on LATEX-Software
12. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Title Page
The title of the whole document is generated by using the
command
maketitle
command.
documentclass[option]{class}
begin{document}
title{...}
author{...}
date{...}, (optional)
maketitle
TEXT
end{document}
Mehar Chand Tutorial on LATEX-Software
13. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Input File
documentclass[a4paper, 11pt, leqno]{article}
begin{document}
title{Two Day Workshop on LaTeX Software}
author{Mehar Chand
Department of Mathematics
Baba Farid College, Bathinda[0.2cm]
Navneet Garg Department of Mathematics
Baba Farid College, Bathinda}
date{}
maketitle
Today we are here to attend Two day workshop
on LaTeX a computer program for
typesetting...
end{document}
Mehar Chand Tutorial on LATEX-Software
14. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Insert Abstract
To add abstract to your paper, we will use the following
commands:
begin{abstract}
Write here your abstract.....
end{abstract}
It should be noted that this command will be always just
after maketitle command i.e.
maketitle
Mehar Chand Tutorial on LATEX-Software
15. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Insert Sectioning
The following sectioning commands are available for the
article class:
section{Introduction}
subsection{Layout of the document}
subsubsection{Paper size}
paragraph{...}
subparagraph{...}
For books and Thesis
chapter{Chapter title}
Mehar Chand Tutorial on LATEX-Software
16. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar The Layout of document
Give Inputs
documentclass[a4paper, 11pt, leqno]{article}
begin{document}
title{Tutorial on LaTeX Software}
author{Mehar ChandDepartment of Maths
Baba Farid College, Bathinda}
maketitle
begin{abstract}
Today we are here to attend .....
end{abstract}
section{Introduction}
subsection{Layout of the document}
subsubsection{Paper size}
end{document}
Mehar Chand Tutorial on LATEX-Software
17. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Environments
Insert Enumerate
We use the following command for enumerate any where in
the document:
begin{enumerate}
item
item
end{enumerate}
Example
begin{enumerate}
item I love my country
item I love my parents
end{enumerate}
Mehar Chand Tutorial on LATEX-Software
18. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Environments
Insert Itemize
We use the following command for enumerate any where in
the document:
begin{itemize}
item
item
end{itemize}
Example
begin{itemize}
item I love my country
item I love my parents
end{itemize}
Mehar Chand Tutorial on LATEX-Software
19. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Environments
Option Itemize
We use the following command for enumerate any where in
the document:
begin{itemize}
item[option]
item[option]
end{itemize}
Example for different ways to introduce itemize:
begin{itemize}
item[i] I love my country
item[(a)] I love my parents
item[A] I love my School
end{itemize}
Mehar Chand Tutorial on LATEX-Software
21. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Environments
Insert Flush-Left
begin{flushleft}
He is my friendMake new friends with me
end{flushleft}
Insert Flush-Right
begin{flushright}
He is my friendMake new friends with me
end{flushright}
Insert Center-Text
begin{center}
He is my friend Make new friends with me
end{center}
Mehar Chand Tutorial on LATEX-Software
22. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Environments
Insert Theorem
First introduce the following command for theorem
newtheorem{theorem}{Theorem}
Then insert the Theorem statement in the following way
begin{theorem}
State and prove the Pythagorean Theorem.
end{theorem}
Mehar Chand Tutorial on LATEX-Software
23. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Environments
Insert Note
First introduce the following command for theorem
newtheorem{note}{Note}
Then insert the Theorem statement in the following way
begin{note}
Give the proof here....
end{note}
Mehar Chand Tutorial on LATEX-Software
24. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Environments
Insert Lemma
First introduce the following command for theorem
newtheorem{lemma}{Lemma}
Then insert the Theorem statement in the following way
begin{lemma}
Sum of the square of two natural number
is equal to square of third natural
number. Give example?
end{lemma}
Mehar Chand Tutorial on LATEX-Software
25. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Environments
Similarly we can define many statements in preamble and
can be used in the environment of the document i.e.
Acknowledgement, Algorithm, Axiom, Case, Claim, Conclu-
sion, Condition, Conjecture, Corollary, Criterion, Definition,
Example, Exercise, Lemma, Notation, Problem, Proposition,
Remark, Solution, Summary.
Mehar Chand Tutorial on LATEX-Software
26. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Use of packages
Definition (Package)
While writing your document, you will probably find that
there are some areas where basic LATEX cannot solve your
problem. If you want to include mathematical stuff, graphics,
coloured text or source code from a file into your document,
you need to enhance the capabilities of LATEX. Such
enhancements are called packages.
Packages are activated with the command
usepackage[options]{package}
where package is the name of the package and options is a
list of keywords that trigger special features in the package.
Mehar Chand Tutorial on LATEX-Software
27. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Use of packages
Common packages you may want to include are listed below, with
short descriptions.
amsmath provides additional mathematical typesetting
amssymb provides mathematical symbols
amsthm provides theorem formatting for AMS publications
fancyhdr provides customisable headers and footers
graphics provides graphics support
graphicx provides extended graphics support (use instead
of graphics)
hyperref provides navigation support for PDF documents
url provides clickable URL support
times change the font to Times Roman
natbib allows author year type of citations similar to ‘Disney
et al. (2003)’, etc.
Mehar Chand Tutorial on LATEX-Software
28. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Use of packages
For mathematical typesetting, we use these in preamble
these as:
usepackage{amsmath}
usepackage{amsthm}
usepackage{amssymb}
or
usepackage{amsmath,amsthm,amssymb,amstext,
amsfonts,amscd,mathrsfs}
Mehar Chand Tutorial on LATEX-Software
29. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Use of packages
Page Margin
usepackage[option]{geometry}
usepackage[top=1in, bottom=1in,
left=1in, right=1in]{geometry}
Mehar Chand Tutorial on LATEX-Software
30. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Mathematical Typesetting
Mathematical Presentation
Let $x=2$ and $y=3$ then $x+y=5$
but $xtimes yneq 5$, we need to
understand this one.
The above code produce:
Let x = 2 and y = 3 then x + y = 5 but x × y = 5, we need
to understand this one.
Mehar Chand Tutorial on LATEX-Software
31. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Mathematical Typesetting
Mathematical Presentation
Let $axˆ2+bx+c=0$ be a quadratic equation,
then it has two roots say $alpha$ and
$beta$ where
$$alpha=frac{-b+sqrt{bˆ2-4ac}}{2a}$$
and $$beta=frac{-b-sqrt{bˆ2-4ac}}{2a}$$
The above code produce:
Let ax2 + bx + c = 0 be a quadratic equation, then it has
two roots say α and β where
α =
−b +
√
b2 − 4ac
2a
and
β =
−b −
√
b2 − 4ac
2a
Mehar Chand Tutorial on LATEX-Software
32. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Mathematical Typesetting
Mathematical Presentation
Code for Subscript and superscript
$H_aˆb$, $H_{mc}ˆ{kc}$,
${}_a{}ˆbH$
${}_{MC}Fˆ{Mehar}_{Chand}$
The above code produce:
Hb
a , Hkc
mc, a
bH MCFMehar
Chand
Mehar Chand Tutorial on LATEX-Software
33. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Mathematical Typesetting
Mathematical Presentation
Code for square root and n-root
$sqrt{123}$
$frac{sqrt{a+b}}{sqrt{aˆ2-bˆ2}}$
$$sqrt{frac{Num}{den}}$$
$$sqrt[4]{MC}$$
The above code produce:
√
123,
√
a + b
√
a2 − b2
Num
den
4
√
MC
Mehar Chand Tutorial on LATEX-Software
34. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Mathematical Typesetting
Mathematical Presentation
Code for Trigonometric functions
$sintheta$, $costheta$,
$tantheta$, $csctheta$,
$cottheta$, $sectheta$
The above code produce:
sin θ, cos θ, tan θ, csc θ, cot θ, sec θ
Mehar Chand Tutorial on LATEX-Software
35. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Mathematical Typesetting
Mathematical Presentation
Code for Integration
$$
I=int_aˆb(xˆ3+3xˆ2+5)dx
$$
$$
J=int_0ˆinftyfrac{xˆ2+5}{xˆ4-3xˆ2+2}dx
$$
The above code produce:
I =
b
a
(x3
+ 3x2
+ 5)dx
J =
∞
0
x2 + 5
x4 − 3x2 + 2
dx
Mehar Chand Tutorial on LATEX-Software
36. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Mathematical Typesetting
Mathematical Presentation
Code for Differentiation
$$
D=frac{d}{dx}(xˆ2+2x+9)
$$
$$
D=frac{partial}{partial x}(xˆ2+2x+9)
$$
The above code produce:
D =
d
dx
(x2
+ 2x + 9)
D =
∂
∂x
(x2
+ 2x + 9)
Mehar Chand Tutorial on LATEX-Software
42. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Different Font Size
Font Size
tiny % tiny font,
scriptsize % very small font
footnotesize % quite small font
small % small font
normalsize % normal font
large % large font
Large % larger font
LARGE % very large font
huge % huge
Huge % largest
For particular use these as {huge Mehar}
For whole document use directly
Mehar Chand Tutorial on LATEX-Software
43. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Use of URL and Hyper-link
Insert URL
Here we use the following two packages two make Cross-
references, references and additional link for hyperlink and
url
usepackage{url}
usepackage{hyperref}
After using the above packages Cross-references and Ref-
erences will be hyper-linked.
Mehar Chand Tutorial on LATEX-Software
44. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Use of URL and Hyper-link
Insert URL
Command for url link
url{https://scholar.google.ca/citations?
user=O_gSE6oAAAAJ&hl=en}
output of the above command:
https://scholar.google.ca/citations?user=O_
gSE6oAAAAJ&hl=en
Mehar Chand Tutorial on LATEX-Software
45. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Spacing between words
Insert Spacing
1. quad produces a small space
2. qquad produces a medium space
3. hspace{20mm} produces a space of
size 20mm.
4. hfil It carry the letter upto the
tale of that line.
5. dotfill will produce dots.
6. hrulefill will produce a rule.
Mehar Chand Tutorial on LATEX-Software
46. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Spacing between words
For Example
Check the following code in your text and see the output
Mehar quad Jallandhra
Mehar qquad Jallandhra
Mehar hspace{20mm} Jallandhra
Mehar hfill Jallandhra
Mehar dotfill Jallandhra
Mehar hrulefill Jallandhra
Mehar Chand Tutorial on LATEX-Software
47. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Spacing between words
Space Outcome
The following is the output of the spacing used commands:
Mehar Jallandhra
Mehar Jallandhra
Mehar Jallandhra
Mehar Jallandhra
Mehar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jallandhra
Mehar Jallandhra
Mehar Chand Tutorial on LATEX-Software
48. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Spacing between words
Customize Space
The following commands are used for custom space vertical
or horizontal in the document:
hskip 30mm % This command is used for
horizontal space
vskip 40mm % This is used to increase
the vertical space between
two paragraph or two lines
Mehar Chand Tutorial on LATEX-Software
49. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Insert Tables in the document
Tabular Environment
The tabular environment can be used to typeset beautiful
tables with optional horizontal and vertical lines. The com-
mand is
begin{tabular}[pos]{cols}
rows
end{tabular}
pos is the vertical positioning argument and take
values c, t and b.
cols is the column formatting argument.
rows contain the actual entries in the table and
separated from each other by the & symbol.
Mehar Chand Tutorial on LATEX-Software
50. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Insert Tables in the document
Input Example
Use the following input code and check the output in docu-
ment:
begin{tabular}{rlc}
Sr. No. & Name & Marks
1. & Rajeev & 80
2. & Sanjeev & 85
end{tabular}
output of the above command:
Sr. No. Name Marks
1. Rajeev 80
2. Sanjeev 85
Mehar Chand Tutorial on LATEX-Software
51. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Insert Tables in the document
Input Example
Use the following input code and check the output in docu-
ment:
begin{tabular}[c]{|r|l|c|}
hline
Sr. No. & Name & Marks
hline
1. & Rajeev & 80
hline
2. & Sanjeev & 85
hline
end{tabular}
Mehar Chand Tutorial on LATEX-Software
52. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Insert Tables in the document
Input Example
Output in document:
Sr. No. Name Marks
1. Rajeev 80
2. Sanjeev 85
Mehar Chand Tutorial on LATEX-Software
53. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Insert Tables in the document
Use of Command p{width}
Use the following input code and check the output in docu-
ment:
begin{tabular}{|l|p{2.5cm}|p{2.5cm}|c|}
hline
Sr. No. & Name & Father’s Name & Marks
hline
1. & Rajeev Kumar Chaudhary & Ram Prakash
Chaudhary & 80
hline
2. & Sanjeev Kumar Aggarwal & Madan Lal
Aggarwal & 85
hline
end{tabular}
Mehar Chand Tutorial on LATEX-Software
54. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Insert Tables in the document
Input Example
Sr. No. Name Father’s Name Marks
1. Rajeev Kumar
Chaudhary
Ram Prakash
Chaudhary
80
2. Sanjeev Ku-
mar Aggarwal
Madan Lal
Aggarwal
85
Mehar Chand Tutorial on LATEX-Software
57. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Inserting Images in the Document
Insert Images
We can insert the images with extension JPG, JPEG, PNG,
.eps, .pdf. The following packages are required to add in
preamble of the document
usepackage{graphic,graphicx}
Input command
begin{figure}[htb]
includegraphics[width=5cm,height=5cm]{mc-1}
caption{Caption of a figure} label{fig-1}
end{figure}
Mehar Chand Tutorial on LATEX-Software
58. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Inserting Images in the Document
Command Outcome
Figure: Caption of a figure
Mehar Chand Tutorial on LATEX-Software
59. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Inserting Images in the Document
Insert Sub-Figures
To insert sub-figure the following package is required:
usepackage{subfigure}
Input Command:
begin{figure}[htb]
subfigure[]
{includegraphics[width=5cm,height=5cm]{fig-1}}
subfigure[]
{includegraphics[width=5cm,height=5cm]{fig-2}}
caption{Caption of a figure} label{fig}
end{figure}
Mehar Chand Tutorial on LATEX-Software
60. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Inserting Images in the Document
Command Outcome
(a) MC (b) MC-1
Figure: Caption of a figure
Mehar Chand Tutorial on LATEX-Software
61. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Inserting Multi-Column
Multi Column
Use the package:
usepackage{multicol}
use input command:
begin{multicols}{2}
Text should be here
end{multicols}
Mehar Chand Tutorial on LATEX-Software
62. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Insert Tables in the document
Input Example
We use the following text for two column:
The objective of the present
paper is to establish cer-
tain (presumably) new and
useful integral results involv-
ing the generalized Multi-
index Mittag-Leffler function
and the Srivastava polyno-
mial. Next, we obtain certain
new integrals and expansion
formulas by the application of
our theorems. Some inter-
esting special cases of our
main results are also consid-
ered.
Mehar Chand Tutorial on LATEX-Software
63. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar Special Characters
The following symbols are reserved characters which have
a special meaning in LATEX :
# $ % ˆ & _ { } ˜
All of these apart from the backslash can be inserted as
characters in your document by adding a prefix backslash:
# $ % ˆ{} & _ { } ˜{}
The above code will produce:
# $ % ˆ & { }
˜
Mehar Chand Tutorial on LATEX-Software
64. Tutorial on
LATEX-
Software
Mehar Chand
Introduction
SW Inst
Layout of
document
Environments
Packages
Math-typing
Font-size
url-hyper
Spacing
Tables
Insert Image
Multicolumn
Special-Cha
Mehar End of the Session
Thank You
Mehar Chand Tutorial on LATEX-Software