SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
Workshop on Latex
Dept. of Electrical Engineering UET Lahore
Mamoon Rizwan
May 12, 2015
Introduction
Latex is used for writing reports , research papers, articles, books and general
purpose documents. Almost everything you can do in word can be accom-
plished using Latex. In the academic community Latex is used more often
than word and those who get used to it stick to it for life long. Unlike word,
the presentation of the document is explicitly specified using commands in
Latex. Most probably you would write your FYP reports in Latex. you can
also write your semester project reports in Latex.
Compiling Procedure
word documents have an extension of doc. Latex documents have an exten-
sion of tex. these tex files are processed by the latex processor (MikTex in
our case) and produces output with extension dvi . These DVI files are not
pdf files yet. These are converted into pdf using pdflatex. you can compile
using command line. Texmakaer provides a graphical interface so the editing
and compiling procedure is very smooth for writers. Texmaker also provides
a pdf viewer so the output can be viewed instantly.
Latex Document Structure
Just like a book is divided into chapters, sections and paragraphs, a latex
documents is divided into chapters, sections and paragraphs at the basic
level. sections can have sub sections.
Chapters
the chapter is inserted using chapter{} command. the argument to the
chapter command is the title of the chapter. the chapter command creates
a chapter with a title given in the argument and gives it a number. All the
subsequent chapters would have a number increased by one. there is a starred
version of the chapter command which gives the chapter a title but removes
the chapter number from it. A chapter remains in continuation until a new
chapter command is encountered where latex creates a new chapter. The
content of the chapter goes after the chapter command. A chapter can have
lists, tables, sections and other environments that are supported by latex. to
1
include mathematical content latex provides the math modes. math modes
are covered in the mathematics part of this booklet.
Sections
sections are inserted using section{} command. a section can have a sub-
section which can be inserted using subsection{} command. the argument
to the section is the title of the section. latex gives a number to the section
which is prefixed by the the number of the chapter to which it belongs, if
any. the content of the section comes after the section command. similar
to chapter command, starred version of the section command section*{}
exists as well which removed the section number.
Paragraphs
a paragraph can be inserted using paragraph{} command. a paragraph
can have its own styling. Normally content is added to the document without
specially using paragraph command
Latex Basics
document types
the top level command is latex is documentclass[]{}. it specifies the type
of the document. i.e. an article, report, book, paper, etc. there are two
arguments to it. the arguments in the square brackets are optional and those
in the curly brackets are mandatory. the mandatory argument is usually one
of
• article
• book
• report
in the optional argument the user specifies the font, size of paper, etc
2
preamble
the portion of the document between the documentclass[]{} and the
begin{document}end{document} is called the preamble of the document.
Here the style commands and the package import declarations are made. the
packages are imported(included) using usepackage[]{} command. we will
have more to say about it in the packages section.
commands format
LATEXcommands are case sensitive they are defined as:
• They start with a backslash and then have a name consisting of letters
only
• Many commands exist in a starred variant where a star is appended to
the command name
environments
begin{environment } content end{environment }
Where environment is the name of the environment. Environments can
be nested within each other as long as the correct nesting order is maintained.
begin{aaa}...begin{bbb}...end{bbb}...end{aaa}
spacing
latex by default ignores any white spaces. if two paragraphs in the text are
separated by a line, a line separates them in the output. a blank line can be
inserted using double backslash . the content appearing after  would
appear in the next line. a new line can also be inserted using newline. a
new page can be inserted using newpage command.
text alignment
The environments flushleft and flushright generate paragraphs that are either
left- or right-aligned. The center environment generates centered text. If you
do not issue  to specify line breaks, LATEXwill automatically determine line
breaks.
3
begin{flushleft}
This text is left-aligned.
LaTeX{} is not trying to make
each line the same length.
end{flushleft}
This text is
left-aligned. LATEX is not trying to make each line the same length.
begin{flushright}
This text is right-aligned.
LaTeX{} is not trying to make
each line the same length.
end{flushright}
This text is right-
aligned. LATEX is not trying to make each line the same length.
begin{center}
At the centerof the earth
end{center}
At the center
of the earth
special characters
the table below shows a few special characters commonly used
4
command meaning
LaTeX LATEX
slash /
~ ˜
$sim$ ∼
today May 12, 2015
ldots . . .
font styles
you can perform the following basic font styling in LATEX
command description
textbf{} bolds the content given in the argument
emph{} emphasizes the content in the argument
textit{} italicizes the content in the argument
text inside a box
you can place a text inside a box using the framed environment
begin{framed} end{framed}
for this you have to use the framed package
usepackage{framed}
footnotes
With the command footnote{footnote text } a footnote is printed at
the foot of the current page. the argument to the footnote command is the
footnote to be printed. Footnotes should always be put after the word or
sentence they refer to. Footnotes referring to a sentence or part of it should
therefore be put after the comma or period
Footnotesfootnote{This is
a footnote.} are often used
by people using LaTeX.
5
Footnotes1
are often used by people using LATEX.
Verbatim
Text that is enclosed between begin{verbatim} and end{verbatim} will
be directly printed with all line breaks and spaces, without any LATEXcommand
being executed. Within a paragraph, similar behavior can be accessed with
verb+text+ .The + is just an example of a delimiter character. Use any
character except letters, * or space
Quotations
Quotations can be inserted using the quote environment
. begin{quote} quotation text end{quote}
begin{quote}
begin{center}
War is like opening the door of a dark room. You font know what lies inside
end{center}
end{quote}
War is like opening the door of a dark room. You font know
what lies inside
Packages
packages are used to enhance the features and capabilities of LATEX. packages
are included in a latex document using the usepackage{} command. the
name of the package goes into the argument of the usepackage command. the
usepackage command in included in the preamble portion of the document.
Lists
lists in latex are defined by itemize and enumerate environments.
6
begin{itemize}
list items come here
end{itemize}
begin{enumerate}
list items come here
end{enumerate}
itemized lists are not numbered. each list element in an itemized list is
added into a billeted list. we can use a character of our own choice instead of
bullets .enumerated lists are numbered lists. each list item is specified using
list command. the content of a list item goes after the list command
begin{itemize}
item Digital Signal Processing
item Power Electronics
item Power System Analysis
item High Voltage Engineering
item Microwave Engineering
end{itemize}
• Digital Signal Processing
• Power Electronics
• Power System Analysis
• High Voltage Engineering
• Microwave Engineering
7
begin{enumerate}
item Digital Signal Processing
item Power Electronics
item Power System Analysis
item High Voltage Engineering
item Microwave Engineering
end{enumerate}
1. Digital Signal Processing
2. Power Electronics
3. Power System Analysis
4. High Voltage Engineering
5. Microwave Engineering
A List can be nested inside another list
begin{itemize}
item Digital Signal Processing
begin{itemize}
item an introductory course in signal processing
item signals and systems , control system and probability are pre-requisites
end{itemize}
item Microwave engineering
begin{enumerate}
item Electromagnetic theory is pre-requisite.
item offered only to telecom specialization students
end{enumerate}
end{itemize}
8
• Digital Signal Processing
– an introductory course in signal processing
– signals and systems , control system and probability are pre-
requisites
• Microwave engineering
1. Electromagnetic theory is pre-requisite.
2. offered only to telecom specialization students
Tables
Tables are inserted using the tabular environment.
begin{tabular}{}
end{tabular}
the structure of the table is defined in the arguments to the tabular en-
vironment. the content of the table goes inside the tabular environment. a
column can be inserted in a table by adding l,r or c in the arguments which
that the contents of the table would be either left justified, right justified or
center justified. a table by default has only one row. a new row is inserted
by . in a row the contents are specified starting form the first column. to
move to the next column use & .
there are no row and column margins in a table by default. to insert
a column margin use — in the column definitions in the argument of the
tabular environment. To insert row margins use the hline command.
Country independence
Pakistan 1947
India 1947
China 1948
UAE 1971
9
Mathematics in Latex
Mathematics in latex can be inserted in two ways
• inline math mode
it is used when a mathematical content is part of paragraph. it begins
with $ sign and ends with a $ sign. all the content goes between the
the square brackets
• display math mode
it is used for mathematics rich content. it begins with [ and ends
with ] . all the content goes between the the square brackets
• equation environment
a mathematics content can also go into the equation environment
begin{equation} content here end{equation}
Examples
begin{equation}
lim_{n to infty}
sum_{k=1}^n frac{1}{k^2}
= frac{pi^2}{6}
end{equation}
lim
n→∞
n
k=1
1
k2
=
π2
6
begin{equation*}
|x| = left{
begin{array}{rl}
-x & text{if } x < 0,
0 & text{if } x = 0,
x & text{if } x > 0.
end{array} right.
10
end{equation*}
|x| =



−x if x < 0,
0 if x = 0,
x if x > 0.
Add $a$ squared and $b$ squared
to get $c$ squared. Or, using
a more mathematical approach
begin{equation}
a^2 + b^2 = c^2
end{equation}
Einstein says
begin{equation}
E = mc^2 label{clever}
end{equation
Add a squared and b squared to get c squared. Or, using a more
mathematical approach
a2
+ b2
= c2
(1)
Einstein says
E = mc2
(2)
in the equation environment note that the equations are numbered.
to avoid numbering of equations use starred equation environment
begin{equation*} equation comes here end{equation*}
Including Graphics
to include graphics, you have to use graphicx package. usepackage{graphicx}
11
to include graphics in your document use the includegraphics[]{} com-
mand. the mandatory argument to this command is the name of the picture
you wan to use in your document. the optional arguments specify the size
of the picture. the type of the picture must be EPS, PDF, JPG or PNG.
the file must be located in the same directory as the tex file including the
picture.
optional arguments to a includegraphics[]{} command can be
• width
• height
• scale
• angle
includegraphics[scale = 4]{uetlogo}
Case Studies
Report
Resume
Adding a Bibliography
References are one of the most important sections of a document. an author
is required to mentioned the source of the information to avoid plagiarism.
references are also necessary to avoid any copyrights violation. References in
latex can be separated into a re fences database. the references are stored in
a special file with an extension .bib. This file would be processed by BibTex,
Latex for bibliography management.
inside the bibliography database, each reference is mentioned separately
which can be referenced into the main document using a citation key. cita-
tions are made using cite{} command. the argument to the cite command
is the citation key of the reference. citation keys must be unique.
12
In the main text document you specify a bibliography using bibliographystyle{}
and bibliography{} commands. Since there can be more than one bibli-
ography databases, the argument to the bibliography command must be the
name of the bibliography database being referenced. after that the entries
inside the bibliography database can be referenced using cite command
13
Bibliography
[1] John F. Wakerly. Digital Design, Principles and Practices. Pearson, 2010.
[2] John F. Wakerly. Digital Design, Principles and Practices. Pearson, 2010.
[3] John F. Wakerly. Digital Design, Principles and Practices. Pearson, 2010.
[1] [2] [3]
14

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Technical writing using LaTeX
Technical writing using LaTeXTechnical writing using LaTeX
Technical writing using LaTeX
 
Introduction to LaTeX
Introduction to LaTeXIntroduction to LaTeX
Introduction to LaTeX
 
A gentle introduction to Latex
A gentle introduction to LatexA gentle introduction to Latex
A gentle introduction to Latex
 
Latex Tutorial by Dr. M. C. Hanumantharaju
Latex Tutorial by Dr. M. C. HanumantharajuLatex Tutorial by Dr. M. C. Hanumantharaju
Latex Tutorial by Dr. M. C. Hanumantharaju
 
Introduction to Latex
Introduction to Latex Introduction to Latex
Introduction to Latex
 
documents writing with LATEX
documents writing with LATEXdocuments writing with LATEX
documents writing with LATEX
 
Chap16 scr
Chap16 scrChap16 scr
Chap16 scr
 
LaTeX Part 1
LaTeX Part 1LaTeX Part 1
LaTeX Part 1
 
LaTeX Tutorial
LaTeX TutorialLaTeX Tutorial
LaTeX Tutorial
 
LaTeX Introduction for Word Users
LaTeX Introduction for Word UsersLaTeX Introduction for Word Users
LaTeX Introduction for Word Users
 
Tutorial on LATEX: A Computer Program for Typesetting Documents
Tutorial on LATEX: A Computer Program for Typesetting DocumentsTutorial on LATEX: A Computer Program for Typesetting Documents
Tutorial on LATEX: A Computer Program for Typesetting Documents
 
Latex slides
Latex slidesLatex slides
Latex slides
 
Chap15 scr
Chap15 scrChap15 scr
Chap15 scr
 
ADT STACK and Queues
ADT STACK and QueuesADT STACK and Queues
ADT STACK and Queues
 
Join operation
Join operationJoin operation
Join operation
 
Linked Lists
Linked ListsLinked Lists
Linked Lists
 
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHIBCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
 
Linked List
Linked ListLinked List
Linked List
 
SQL Joins and Query Optimization
SQL Joins and Query OptimizationSQL Joins and Query Optimization
SQL Joins and Query Optimization
 
Bca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothiBca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothi
 

Andere mochten auch

탱양의후예『SX797』『СOM』모바일카지노
탱양의후예『SX797』『СOM』모바일카지노탱양의후예『SX797』『СOM』모바일카지노
탱양의후예『SX797』『СOM』모바일카지노
hijhfkjdsh
 
vip카지노 ''SX797.COM'' 바카라사이트
vip카지노 ''SX797.COM'' 바카라사이트vip카지노 ''SX797.COM'' 바카라사이트
vip카지노 ''SX797.COM'' 바카라사이트
ajshdajsh
 
라이브벳 ''SX797.COM'' 홀덤
라이브벳 ''SX797.COM'' 홀덤라이브벳 ''SX797.COM'' 홀덤
라이브벳 ''SX797.COM'' 홀덤
ajshdajsh
 
SIRE Life Sciences - Brochure
SIRE Life Sciences - BrochureSIRE Life Sciences - Brochure
SIRE Life Sciences - Brochure
Paul Beglinger
 
Irina Udrea CRMI march 2016
Irina Udrea CRMI march 2016Irina Udrea CRMI march 2016
Irina Udrea CRMI march 2016
IRINA UDREA
 

Andere mochten auch (10)

Paco Rabane
Paco RabanePaco Rabane
Paco Rabane
 
BASE DE DATOS
BASE DE DATOSBASE DE DATOS
BASE DE DATOS
 
탱양의후예『SX797』『СOM』모바일카지노
탱양의후예『SX797』『СOM』모바일카지노탱양의후예『SX797』『СOM』모바일카지노
탱양의후예『SX797』『СOM』모바일카지노
 
vip카지노 ''SX797.COM'' 바카라사이트
vip카지노 ''SX797.COM'' 바카라사이트vip카지노 ''SX797.COM'' 바카라사이트
vip카지노 ''SX797.COM'' 바카라사이트
 
Feldman Feldman & Associates PC
Feldman Feldman & Associates PCFeldman Feldman & Associates PC
Feldman Feldman & Associates PC
 
Gut
GutGut
Gut
 
Feldman Feldman & Associates PC
Feldman Feldman & Associates PCFeldman Feldman & Associates PC
Feldman Feldman & Associates PC
 
라이브벳 ''SX797.COM'' 홀덤
라이브벳 ''SX797.COM'' 홀덤라이브벳 ''SX797.COM'' 홀덤
라이브벳 ''SX797.COM'' 홀덤
 
SIRE Life Sciences - Brochure
SIRE Life Sciences - BrochureSIRE Life Sciences - Brochure
SIRE Life Sciences - Brochure
 
Irina Udrea CRMI march 2016
Irina Udrea CRMI march 2016Irina Udrea CRMI march 2016
Irina Udrea CRMI march 2016
 

Ähnlich wie Latex Tutorial

Ähnlich wie Latex Tutorial (20)

LaTeX_tutorial_Syed_Jan09.ppt
LaTeX_tutorial_Syed_Jan09.pptLaTeX_tutorial_Syed_Jan09.ppt
LaTeX_tutorial_Syed_Jan09.ppt
 
Latex Introduction for Beginners
Latex Introduction for BeginnersLatex Introduction for Beginners
Latex Introduction for Beginners
 
latex-workshop Dr: Mohamed A. Alrshah
latex-workshop Dr: Mohamed A. Alrshahlatex-workshop Dr: Mohamed A. Alrshah
latex-workshop Dr: Mohamed A. Alrshah
 
La tex basics
La tex basicsLa tex basics
La tex basics
 
A Hitchhiker S Guide To LaTex (Or How I Learned To Stop Worrying And Love Wri...
A Hitchhiker S Guide To LaTex (Or How I Learned To Stop Worrying And Love Wri...A Hitchhiker S Guide To LaTex (Or How I Learned To Stop Worrying And Love Wri...
A Hitchhiker S Guide To LaTex (Or How I Learned To Stop Worrying And Love Wri...
 
Introduction to latex by Rouhollah Nabati
Introduction to latex by Rouhollah NabatiIntroduction to latex by Rouhollah Nabati
Introduction to latex by Rouhollah Nabati
 
Latex ppt copy
Latex ppt   copyLatex ppt   copy
Latex ppt copy
 
Latex Notes
Latex NotesLatex Notes
Latex Notes
 
latex.pptx
latex.pptxlatex.pptx
latex.pptx
 
Latex for beginners
Latex for beginnersLatex for beginners
Latex for beginners
 
Latex Tuitorial
Latex TuitorialLatex Tuitorial
Latex Tuitorial
 
Latex workshop
Latex workshopLatex workshop
Latex workshop
 
Learn Latex
Learn LatexLearn Latex
Learn Latex
 
Algorithm2e package for Latex
Algorithm2e package for LatexAlgorithm2e package for Latex
Algorithm2e package for Latex
 
LaTeX for B.Sc. Mathematics,an introduction
LaTeX for B.Sc. Mathematics,an introductionLaTeX for B.Sc. Mathematics,an introduction
LaTeX for B.Sc. Mathematics,an introduction
 
LATEX.ppt
LATEX.pptLATEX.ppt
LATEX.ppt
 
Chap05 scr
Chap05 scrChap05 scr
Chap05 scr
 
Latex intro
Latex introLatex intro
Latex intro
 
example.pdf
example.pdfexample.pdf
example.pdf
 
Example
ExampleExample
Example
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Latex Tutorial

  • 1. Workshop on Latex Dept. of Electrical Engineering UET Lahore Mamoon Rizwan May 12, 2015
  • 2. Introduction Latex is used for writing reports , research papers, articles, books and general purpose documents. Almost everything you can do in word can be accom- plished using Latex. In the academic community Latex is used more often than word and those who get used to it stick to it for life long. Unlike word, the presentation of the document is explicitly specified using commands in Latex. Most probably you would write your FYP reports in Latex. you can also write your semester project reports in Latex. Compiling Procedure word documents have an extension of doc. Latex documents have an exten- sion of tex. these tex files are processed by the latex processor (MikTex in our case) and produces output with extension dvi . These DVI files are not pdf files yet. These are converted into pdf using pdflatex. you can compile using command line. Texmakaer provides a graphical interface so the editing and compiling procedure is very smooth for writers. Texmaker also provides a pdf viewer so the output can be viewed instantly. Latex Document Structure Just like a book is divided into chapters, sections and paragraphs, a latex documents is divided into chapters, sections and paragraphs at the basic level. sections can have sub sections. Chapters the chapter is inserted using chapter{} command. the argument to the chapter command is the title of the chapter. the chapter command creates a chapter with a title given in the argument and gives it a number. All the subsequent chapters would have a number increased by one. there is a starred version of the chapter command which gives the chapter a title but removes the chapter number from it. A chapter remains in continuation until a new chapter command is encountered where latex creates a new chapter. The content of the chapter goes after the chapter command. A chapter can have lists, tables, sections and other environments that are supported by latex. to 1
  • 3. include mathematical content latex provides the math modes. math modes are covered in the mathematics part of this booklet. Sections sections are inserted using section{} command. a section can have a sub- section which can be inserted using subsection{} command. the argument to the section is the title of the section. latex gives a number to the section which is prefixed by the the number of the chapter to which it belongs, if any. the content of the section comes after the section command. similar to chapter command, starred version of the section command section*{} exists as well which removed the section number. Paragraphs a paragraph can be inserted using paragraph{} command. a paragraph can have its own styling. Normally content is added to the document without specially using paragraph command Latex Basics document types the top level command is latex is documentclass[]{}. it specifies the type of the document. i.e. an article, report, book, paper, etc. there are two arguments to it. the arguments in the square brackets are optional and those in the curly brackets are mandatory. the mandatory argument is usually one of • article • book • report in the optional argument the user specifies the font, size of paper, etc 2
  • 4. preamble the portion of the document between the documentclass[]{} and the begin{document}end{document} is called the preamble of the document. Here the style commands and the package import declarations are made. the packages are imported(included) using usepackage[]{} command. we will have more to say about it in the packages section. commands format LATEXcommands are case sensitive they are defined as: • They start with a backslash and then have a name consisting of letters only • Many commands exist in a starred variant where a star is appended to the command name environments begin{environment } content end{environment } Where environment is the name of the environment. Environments can be nested within each other as long as the correct nesting order is maintained. begin{aaa}...begin{bbb}...end{bbb}...end{aaa} spacing latex by default ignores any white spaces. if two paragraphs in the text are separated by a line, a line separates them in the output. a blank line can be inserted using double backslash . the content appearing after would appear in the next line. a new line can also be inserted using newline. a new page can be inserted using newpage command. text alignment The environments flushleft and flushright generate paragraphs that are either left- or right-aligned. The center environment generates centered text. If you do not issue to specify line breaks, LATEXwill automatically determine line breaks. 3
  • 5. begin{flushleft} This text is left-aligned. LaTeX{} is not trying to make each line the same length. end{flushleft} This text is left-aligned. LATEX is not trying to make each line the same length. begin{flushright} This text is right-aligned. LaTeX{} is not trying to make each line the same length. end{flushright} This text is right- aligned. LATEX is not trying to make each line the same length. begin{center} At the centerof the earth end{center} At the center of the earth special characters the table below shows a few special characters commonly used 4
  • 6. command meaning LaTeX LATEX slash / ~ ˜ $sim$ ∼ today May 12, 2015 ldots . . . font styles you can perform the following basic font styling in LATEX command description textbf{} bolds the content given in the argument emph{} emphasizes the content in the argument textit{} italicizes the content in the argument text inside a box you can place a text inside a box using the framed environment begin{framed} end{framed} for this you have to use the framed package usepackage{framed} footnotes With the command footnote{footnote text } a footnote is printed at the foot of the current page. the argument to the footnote command is the footnote to be printed. Footnotes should always be put after the word or sentence they refer to. Footnotes referring to a sentence or part of it should therefore be put after the comma or period Footnotesfootnote{This is a footnote.} are often used by people using LaTeX. 5
  • 7. Footnotes1 are often used by people using LATEX. Verbatim Text that is enclosed between begin{verbatim} and end{verbatim} will be directly printed with all line breaks and spaces, without any LATEXcommand being executed. Within a paragraph, similar behavior can be accessed with verb+text+ .The + is just an example of a delimiter character. Use any character except letters, * or space Quotations Quotations can be inserted using the quote environment . begin{quote} quotation text end{quote} begin{quote} begin{center} War is like opening the door of a dark room. You font know what lies inside end{center} end{quote} War is like opening the door of a dark room. You font know what lies inside Packages packages are used to enhance the features and capabilities of LATEX. packages are included in a latex document using the usepackage{} command. the name of the package goes into the argument of the usepackage command. the usepackage command in included in the preamble portion of the document. Lists lists in latex are defined by itemize and enumerate environments. 6
  • 8. begin{itemize} list items come here end{itemize} begin{enumerate} list items come here end{enumerate} itemized lists are not numbered. each list element in an itemized list is added into a billeted list. we can use a character of our own choice instead of bullets .enumerated lists are numbered lists. each list item is specified using list command. the content of a list item goes after the list command begin{itemize} item Digital Signal Processing item Power Electronics item Power System Analysis item High Voltage Engineering item Microwave Engineering end{itemize} • Digital Signal Processing • Power Electronics • Power System Analysis • High Voltage Engineering • Microwave Engineering 7
  • 9. begin{enumerate} item Digital Signal Processing item Power Electronics item Power System Analysis item High Voltage Engineering item Microwave Engineering end{enumerate} 1. Digital Signal Processing 2. Power Electronics 3. Power System Analysis 4. High Voltage Engineering 5. Microwave Engineering A List can be nested inside another list begin{itemize} item Digital Signal Processing begin{itemize} item an introductory course in signal processing item signals and systems , control system and probability are pre-requisites end{itemize} item Microwave engineering begin{enumerate} item Electromagnetic theory is pre-requisite. item offered only to telecom specialization students end{enumerate} end{itemize} 8
  • 10. • Digital Signal Processing – an introductory course in signal processing – signals and systems , control system and probability are pre- requisites • Microwave engineering 1. Electromagnetic theory is pre-requisite. 2. offered only to telecom specialization students Tables Tables are inserted using the tabular environment. begin{tabular}{} end{tabular} the structure of the table is defined in the arguments to the tabular en- vironment. the content of the table goes inside the tabular environment. a column can be inserted in a table by adding l,r or c in the arguments which that the contents of the table would be either left justified, right justified or center justified. a table by default has only one row. a new row is inserted by . in a row the contents are specified starting form the first column. to move to the next column use & . there are no row and column margins in a table by default. to insert a column margin use — in the column definitions in the argument of the tabular environment. To insert row margins use the hline command. Country independence Pakistan 1947 India 1947 China 1948 UAE 1971 9
  • 11. Mathematics in Latex Mathematics in latex can be inserted in two ways • inline math mode it is used when a mathematical content is part of paragraph. it begins with $ sign and ends with a $ sign. all the content goes between the the square brackets • display math mode it is used for mathematics rich content. it begins with [ and ends with ] . all the content goes between the the square brackets • equation environment a mathematics content can also go into the equation environment begin{equation} content here end{equation} Examples begin{equation} lim_{n to infty} sum_{k=1}^n frac{1}{k^2} = frac{pi^2}{6} end{equation} lim n→∞ n k=1 1 k2 = π2 6 begin{equation*} |x| = left{ begin{array}{rl} -x & text{if } x < 0, 0 & text{if } x = 0, x & text{if } x > 0. end{array} right. 10
  • 12. end{equation*} |x| =    −x if x < 0, 0 if x = 0, x if x > 0. Add $a$ squared and $b$ squared to get $c$ squared. Or, using a more mathematical approach begin{equation} a^2 + b^2 = c^2 end{equation} Einstein says begin{equation} E = mc^2 label{clever} end{equation Add a squared and b squared to get c squared. Or, using a more mathematical approach a2 + b2 = c2 (1) Einstein says E = mc2 (2) in the equation environment note that the equations are numbered. to avoid numbering of equations use starred equation environment begin{equation*} equation comes here end{equation*} Including Graphics to include graphics, you have to use graphicx package. usepackage{graphicx} 11
  • 13. to include graphics in your document use the includegraphics[]{} com- mand. the mandatory argument to this command is the name of the picture you wan to use in your document. the optional arguments specify the size of the picture. the type of the picture must be EPS, PDF, JPG or PNG. the file must be located in the same directory as the tex file including the picture. optional arguments to a includegraphics[]{} command can be • width • height • scale • angle includegraphics[scale = 4]{uetlogo} Case Studies Report Resume Adding a Bibliography References are one of the most important sections of a document. an author is required to mentioned the source of the information to avoid plagiarism. references are also necessary to avoid any copyrights violation. References in latex can be separated into a re fences database. the references are stored in a special file with an extension .bib. This file would be processed by BibTex, Latex for bibliography management. inside the bibliography database, each reference is mentioned separately which can be referenced into the main document using a citation key. cita- tions are made using cite{} command. the argument to the cite command is the citation key of the reference. citation keys must be unique. 12
  • 14. In the main text document you specify a bibliography using bibliographystyle{} and bibliography{} commands. Since there can be more than one bibli- ography databases, the argument to the bibliography command must be the name of the bibliography database being referenced. after that the entries inside the bibliography database can be referenced using cite command 13
  • 15. Bibliography [1] John F. Wakerly. Digital Design, Principles and Practices. Pearson, 2010. [2] John F. Wakerly. Digital Design, Principles and Practices. Pearson, 2010. [3] John F. Wakerly. Digital Design, Principles and Practices. Pearson, 2010. [1] [2] [3] 14