Introduction To L TEX: Suraj Patil Dhananjay Takalkar

You might also like

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

Introduction to LATEX

Suraj Patil
Dhananjay Takalkar

March 11, 2016


What is LATEX

I LATEXis a high-quality typesetting (composition of text by


means of types) system.
I It is specially good for typesetting mathematical formulae and
expressions.
I Features the production of professional-looking technical and
scientific documentations.
I Pronunciation is la-tech and not la-tex.
I Donald Knuth started writing a TEX typesetting engine in
1977 for mathematical equations.
I Leslie Lamport started to write LaTex in 1985 as an extension
to TEX engine.
I Nowadays,widely used in technical and science research work
Why LATEX?

I LATEX is free(open source) and runs on any platform (any OS).

I LATEX is the best tool for available for mathematical layout.

I LATEX focuses on structures that helps document development.

I LATEXautomatically generates List of figures, table of


contents, list of tables, index, bibliography.
Types of Softwares Required

TexLive : This is a main LATEX software. First, need to install


this software.

Editors : Different types of editors Texmaker,Winedit,


TeXnicCenter, Winshell etc. Install any one of the
editors.
After installing TexLive, need to install any editor. Once installed,
open the editor and observe the contents.
Important Steps

I First line in editor will be


always-\documentclass[option]{class}

I class is the class of the document to be prepared. The


different types of classes are:
report: To prepare thesis.
letter: To prepare a letter.
article: To prepare a paper.
book: To prepare a book.
beamer: To prepare a presentation.
Option
option is the optional argument.
I Font size
I 10pt-10 pt font-size.
I 11pt-11pt font-size.
I 12pt-12pt font-size.
I Default is 10pt.
I Paper Size:
I a4paper- A4-size paper-11 × 8.5in.
I onea5paper- legalpaper-14 × 8.5in.
I b5paper- executivepaper-10.5 × 7.5in.
I Page-format:
I single column document.
I twocolumn-Two column document.
I openany or openright-To start the new chapter from any
new-page (Used for the book or thesis).
First document in LATEX

\documentclass[a4paper]{report}
\begin{document}
This is my first document
\end{document}
Formatting document in LATEX

I Required Text can be bold using: {\bf REQUIRED TEXT}.


I Required Text can be Italic using: {\it Required Text} OR.
I Text can be Italic using \ emph{Required Text}.
I Required Text can be underlined using: \underline { Required
Text}
Different size of the Text
I \tiny{Required Text}-Required Text.
I \scriptsize{Required Text}-Required Text.
I \footnotesize{Required Text}-Required Text.
I \small{Required Text}-Required Text.
I \normalsize{Required Text}-Required Text.
I \large{Required Text}-Required Text.
I \Large{Required Text}-Required Text.
I \LARGE{Required Text}-Required Text.
I \huge{Required Text}-Required Text.
I \HUGE{Required Text}-
Required Text.
Different alignment of the Text

I Text can be centered using commands:


\begin{center}· · · \end{center}
I Text can be Right aligned using commands:
\begin{flushright}· · · \end{flushright}
I Text can be Left aligned using commands:
\begin{flushleft}· · · \end{flushleft}
List Environment

Text can be listed using commands:\begin{itemize}· · ·


\end{itemize} e.g.
\begin{itemize} Output is:
\item Introduction
I Introduction
\item Related work
\end{itemize} I Related work

Text can be listed using number by command:


\begin{enumerate}· · · \end{enumerate} e.g.
\begin{enumerate} Output is:
\item Introduction
1. Introduction
\item Related work
\end{enumerate} 2. Related work
Use of Section, Sub-sections Headings in papers, thesis,
books

I Section: command is \section{DFT}


I Sub-section: command is \subsection{Properties of DFT}
I Sub-subsection: command is \subsubsection{Time-shifting
property of DFT}
To make Title Page
I \title{Project Topic}.
I \author{Author 1}.
I \date{Month date Year}.
I Next, it is compulsory to
include \maketitle
command.
Output is: .
Project Topic

Author 1

March 7 2015
Spacing
Between blocks:

\hspace{__ cm/mm/in} -> For horizontal space


\vspace{__ cm/mm/in} -> For vertical space

To fill white space:

\hfill -> For horizontal space


\vfill -> For vertical space

More spacing commands:

Positive space-> \quad \, \: \; \ (space after the \ sign)


Negative space-> \!
(1 em = width of’M’, 1 mu= 1/18 em, 1 quad=18 mu)
Spacing

\vspace{-ve}

Block A

\hspace{-ve} Text B \hspace{+ve}


Image C

\vspace{+ve}
Figure environment

I Need to use packages


I The packages required are:
I \usepackage[dvips]{graphicx,color}.OR
I \usepackage {graphicx}
I \usepackage{xcolor}
I \usepackage{subfigure}
I All packages must be included before Preamble
I Figure formats in LATEX
I .jpg
I .jpeg
I .png
I .eps
I Mostly .eps is used.
Process to add figure in LATEX

1. Create figure using any pc based software (eg. Paint,


Microsoft word etc.)

2. Save or convert this image into .eps formats using MATLAB.

3. Process to convert any image into .eps using MATLAB


I First read the image using
syntax:a=imread(’nameoftheimage.bmp’)
I Display the image using syntax:imshow(a)
I File −→save as −→name.eps
4. Save that image in the same folder where you have saved your
text file.

5. Type the syntax for figure in text file with the same image
name that you have saved in folder.
Syntax for Adding Figure

I \begin{figure}
I \{centering}
I \includegraphics[option]{file.eps}
I \end {figure}
I Options are:
width:-width of the graphics (image)
height:-height of the graphics.
scale:-scale factor for the graphics. If scale=2,
size of graphics twice as of natural size.
angle:-angle of rotation (anticlockwise for
positive angle).
Code for including figure

\documentclass{report}
\usepackage{xcolor}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\begin{center}..or Right/left
\includegraphics[scale=0.2]{sin.eps}
\caption{Original figure}
\end{center}
\end{figure}
\end{document}
Output is:

0.8

0.6

0.4

0.2

−0.2

−0.4

−0.6

−0.8

−1
0 2 4 6 8 10

Figure : Original Figure


Output is:for begin{flushleft}

0.8

0.6

0.4

0.2

−0.2

−0.4

−0.6

−0.8

−1
0 2 4 6 8 10

Figure : Original Figure


Output is:begin{flushright}

0.8

0.6

0.4

0.2

−0.2

−0.4

−0.6

−0.8

−1
0 2 4 6 8 10

Figure : Original Figure


Code for Two images side by side using subfigure

\begin{figure}
\subfigure[\label{fig:Img1}]
{
\includegraphics[scale=0.16]{sin.eps}
}
\subfigure[\label{fig:Img2}]
{
\includegraphics[scale=0.16]{sin.eps}
}
\caption{Images (a)Original (b) modified image}
\end{figure}
Output Is:

1 1

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

0 0

−0.2 −0.2

−0.4 −0.4

−0.6 −0.6

−0.8 −0.8

−1 −1
0 2 4 6 8 10 0 2 4 6 8 10

(a) (b)

Figure : Images (a)Original (b) modified image


Code for Four images using subfigure

\begin{figure}
\subfigure[\label{fig:Img1}]
{ \includegraphics[scale=0.16]{Lena.eps} }
\subfigure[\label{fig:Img2}]
{ \includegraphics[scale=0.16]{Lena.eps} }
\subfigure[\label {fig:Img3}]
{ \includegraphics[scale=0.16]{Lena.eps} }
\subfigure[\label{fig:Img4}] {
\includegraphics[scale=0.16]{Lena.eps} }
\caption{Images (a)Original (b) modified image (c) Image3
(d)Image4}
\end{figure}
Two steps to use reference figure in LATEXdocument

1. Define your LATEXfigure with following command:


I \label{fig : Img 1}
I For this,need package named as \usepackage{hyperref}
2. Reference your LaTex figure with following command:
I \ref {fig : Img 1}
I \pageref {fig : Img 1}
1. If you just want to refer to the figure no. , you can get it to
appear by writing LaTex text like this :

I Please see figure \ref {fig : Img 1} for further information


your pdf file will show above command like this :
Please see figure 2 for further information.

2. If you just want to refer to the page no. , you can get it to
appear by writing LaTex text like this :

I Please see figure on page no. \pageref {fig : Img 1} for further
information
your pdf file will show above command like this :
Please see figure on page no. 20 for further information.
Table Environment

I Tabular environment is used to typeset tables with optional


horizontal and vertical lines.
I LATEXdetermines the width of table automatically.
I First line of the environment has the form:
I \begin{tabular}[pos]{table spec}.
I The table spec argument tell the alignment (left, right, or
center) to be used in each column and the vertical line to be
inserted.
I The number of columns does not need to be specified as it is
inferred by looking at the number of arguments provided.
Symbols used to describe the table column

Symbols Description
l Left-justified column.
r Right-justified column
c Center-justified column
p{width cm } paragraph column with text vertically
aligned at the top,width will be any
integer number (2, 3, · · · cm or mm
or in)
m{width cm} paragraph column with text vertically
aligned in the middle.
b{width cm} paragraph column with vertically
aligned at the bottom.
| vertical line.
|| double-vertical line.
Symbols used to describe the table column

Symbols Description
& Column Separator
\\ Start new row or additional space can add
after this \\ symbol by square bracket e.g.
\\[6pt]
\hline Horizontal line.
\newline Start a new line within a cell only.
\cline{i-j} partial horizontal line beginning from col-
umn i and ending at column j.
Examples

\begin{tabular}{ l c r }
1 & 2 & 3 \\
4 & 5 & 6 \\
1 2 3
7 & 8 & 9 \\
Output is: 4 5 6
\end{tabular}
7 8 9
1 2 3
\begin{tabular}{l|c||r}
4 5 6
1 & 2 & 3 \\
7 8 9
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{tabular}
Examples

\begin{tabular}{l c r } \hline
1 & 2 & 3 \\ \hline
4 & 5 & 6 \\ \hline 1 2 3
7 & 8 & 9 \\ \hline
Output is: 4 5 6
\end{tabular}
7 8 9
1 2 3
\begin{tabular}{|l|c|r|} \hline
4 5 6
1 & 2 & 3 \\ \hline
4 & 5 & 6 \\ \hline 7 8 9
7 & 8 & 9 \\ \hline
\end{tabular}
List of symbols

Symbol code
α \alpha
β \ beta
γ \gamma
δ \delta
 \epsilon
ε \varepsilon
θ \theta
φ \phi
ω \omega
µ \mu
η \eta
Equation Environment

\begin{equation}
a^2 + b^2 = c^2
\end{equation}
a2 + b 2 = c 2 (1)
Einstein says
\begin{equation} Einstein says
E = mc^2 \label{clever}
\end{equation} E = mc 2 (2)

He didnt say
He didnt say
\begin{equation} 1+1=3 (dumb)
1 + 1 = 3 \tag{dumb}
\end{equation} This is a reference to (2).
This is a reference to
\eqref{clever}.
Equation Environment

If you dont want LATEXto number the equations, use the starred
version of equation using an asterisk, equation*, or even easier,
enclose the equation

\begin{equation*}
a^2 + b^2 = c^2 a2 + b 2 = c 2
\end{equation*}
a2 + b 2 = c 2
or you can type less for the
same effect: sin x
lim =1
\[ a^2 + b^2 = c^2 \] x→0 x

\begin{equation*}
\lim_{x \rightarrow 0}
\frac{\sin x}{x}=1
\end{equation*}
Equation Environment

Difference in typesetting style between text style and display style


equations:
$\lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2}
2
= \frac{\pi^2}{6}$. limn→∞ nk=1 k12 = π6 .
P
And this is display style: And this is display style:
\begin{equation}
n
\lim_{n \to \infty} X 1 π2
\sum_{k=1}^n \frac{1}{k^2} lim = (3)
n→∞ k2 6
k=1
= \frac{\pi^2}{6}
\end{equation}
eqnarray

H = p1 x 2 + p2 x 4 + p 6 (4)
Y (ω)
K (ω) =
X (ω)
eqnarray

\begin{eqnarray}

H &=& p_1x^2+p_2x^4+p^6\\

K(\omega) &=& \frac {Y( \omega)} {X( \omega)}\nonumber

\end{eqnarray}
gather

H = p1 x 2 + p2 x 4 + p 6 (5)
Y (ω)
K (ω) =
X (ω)
gather

\begin{gather}

H = p_1x^2+p_2x^4+p^6\\

K({ \omega}) = \frac {Y({ \omega})} {X({ \omega})}


\nonumber

\end{gather}
List of Mathematical symbols

Symbol code
−→
AB \overrightarrow{AB}
AB \underleftarrow{AB}
R←−
\int
P
\sum
± \pm
≡ \equiv
∀ \forall
∞ \infty
∠ \angle
∅ \emptyset
⇐⇒ \iff
REPORT STRUCTURE

I Define the margins, height and width of the document.


I Define the scheme of page numbering.
I To include the title page,declaration,certificate and ack, use
\input { filename.tex} command.
I Add all the files on new page using \newpage command.
I Add chapter files using \include{chap1.tex} command.
Table of contents

\tableofcontents
\addcontentsline{toc}{chapter}{Table Of Contents}

\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}

\listoftables
\addcontentsline{toc}{chapter}{List of Tables}
BIBLIOGRAPHY

\begin{thebibliography}{10}

\bibitem{label1}
F. Gross, {\it Smart Antennas For Wireless Communication},
September 14, 2005.

\bibitem{label2}
L. Godara.{\enquote{Application of antenna arrays to
mobile communications, part II: Beamforming and direction
of arrival considerations.}} {\it Proceedings of the IEEE,
85(8): 1195-1245, August 1997.

\end{thebibliography}
Thank You

You might also like