Latex work shop - PowerPoint PPT Presentation

About This Presentation
Title:

Latex work shop

Description:

the for LaTEX workshop provided by DR. Mohamed AL-rshah – PowerPoint PPT presentation

Number of Views:574
Slides: 52
Provided by: abulibya

less

Transcript and Presenter's Notes

Title: Latex work shop


1
LATEX Workshop
  • By
  • Mohamed A. Alrshah

15 November, 2015
2
TEX?
  • TEX is a typesetting system that incorporates a
    macro processor.
  • A TEX source document specifies a number of macro
    definitions that instruct the TEX engine how to
    typeset the document. 
  • Its implementations are governed by the principle
    that the same input should produce the same
    output.

3
LATEX?.. LATEX2e?.. MiKTEX?..
  • LATEX is a macro package which enables authors to
    typeset and print their work at the highest
    typographical quality, using a predefined,
    professional layout. It uses the TEX formatter as
    its typesetting engine.
  • LATEX2e includes all the patches which had
    cropped up since the release of LATEX 2.09.
  • MiKTEX is an up-to-date implementation of TEX and
    related programs (installation package).

4
The Concept
5
How does LATEX works?
6
LATEX vs WYSIWYG
Criterion WYSIWYG LATEX
Document Editing Users need to use the same tool. Users can arbitrary use any text editor.
Changing format The entire document needs to be checked for any unwanted results. The class and some commands need to be changed.
Layout quality High quality layout can be reached by professional users only. The standard Layout is already high quality.
Huge contents program crashes and instability likely happen with large documents especially if high-quality graphics incorporated. Faster since only text and formatting commands merged and the separate typesetting steps are only done.
Citation Requires additional tool such as Mendeley or Endnote. It is professionally handled using the free and built-in BibTeX tool.
compatibility Low compatibility with all editors OSs. High compatibility with all editors OSs.
Backward compatibility Is not fully supported. Is not fully supported.
Split work into many files Usually no practicable solution available. Available.
Cost Some are free with limited features. Free
7
Installation Packages
  • 1- The TeX engine
  • basic-miktex-2.9.5105-x64.exe
  • 2- The TeX editor
  • texstudio-2.10.2-win-qt5.5.0.exe
  • 3- Postscript and PDF interpreter/renderer
  • gs916w64.exe
  • 4- Postscript and PDF viewer
  • gsv50w64.exe
  • Note all packages are FREE.

8
Installation MikTeX
  • Instructions
  • Download Link http//www.miktex.org/download/
  • Which version fits your OS (x32 or x64)?

9
MikTeX Options
10
MikTeX Update Wizard
11
MikTeX Package Manager (ADD/Remove)
12
Installation TeXstudio
  • Download Link http//texstudio.sourceforge.net/
  • Which version fits your OS (x32 or x64)?

13
TeXstudio Dictionary Setting.
  • TeXstudiogtOptionsgtGeneralgt Dictionaries

14
TeXstudio Commands Configurations.
  • TeXstudiogtOptionsgtCommands

15
TeXstudio Compiler Configurations.
  • TeXstudiogtOptionsgtBuild

16
LATEX Basic Document Structure
\documentclassoption1, option2,
class \usepackagepackage1
\usepackageoptionspackage2
\usepackagepackage3, package4
\usepackageoptionspackage5, package6
begindocument ...\enddocument
The preamble
The content
17
LATEX Basic Document Structure
Examples \documentclass10pt,a4paperarticle \t
itleYou must put the title Here \authorThe
name of first author \and The name of second
author \date15/11/2015 \begindocument \maketi
tle You can write anything here. You can write
anything here. You can write anything here. You
can write anything here. You can write anything
here. You can write anything here. You can write
anything here. \enddocument
18
LATEX Document classes
Document Classes Description
article For articles in scientific journals, presentations, short reports, program documentation, invitations, ...
IEEEtran For articles with the IEEE Transactions format.
proc A class for proceedings based on the article class.
report For longer reports containing several chapters, small books, thesis, ...
book For real books.
slides For slides. The class uses big sans serif letters.
memoir For changing sensibly the output of the document. It is based on the book class, but you can create any kind of document with it.
letter For writing letters.
beamer For writing presentations see LaTeX/Presentations).
elsarticle For articles with the Elsevier format.
19
LATEX Document class options
Document Class Options Description
10pt, 11pt, 12pt Sets the size of the main font in the document. If no option is specified, 10pt is assumed.
a4paper, b5paper, letterpaper,... Defines the paper size. The default size is letterpaper However, many European distributions of TeX now come pre-set for A4, not Letter, and this is also true of all distributions of pdfLaTeX. Besides that, a5paper, b5paper, executivepaper, and legalpaper can be specified.
fleqn Typesets displayed formulas left-aligned instead of centered.
leqno Places the numbering of formulas on the left hand side instead of the right.
titlepage, notitlepage Specifies whether a new page should be started after the document title or not. The article class does not start a new page by default, while report and book do.
onecolumn,twocolumn Instructs LaTeX to typeset the document in two columns instead of one.
twoside, oneside Specifies whether double or single sided output should be generated. The classes article and report are single sided and the book class is double sided by default. Note that this option concerns the style of the document only. The option twoside does not tell the printer you use that it should actually make a two-sided printout.
landscape Changes the layout of the document to print in landscape mode.
openright, openany Makes chapters begin either only on right hand pages or on the next page available. This does not work with the article class, as it does not know about chapters. The report class by default starts chapters on the next page available and the book class starts them on right hand pages.
draft, final makes LaTeX indicate hyphenation and justification problems with a small square in the right-hand margin of the problem line so they can be located quickly by a human. It also suppresses the inclusion of images and shows only a frame where they would normally occur.
20
LATEX File types
File extension Description
.tex LATEX or TEX input file.
.sty LATEX Macro package.
.dtx Documented TEX.
.cls Document class files
.dvi Device Independent File (output).
.log Log a detailed of the compilation process
.toc Table of content
.lof List of figures
.lot List of tables
.aux Auxiliary file, store information about the cross-references.
.idx Stores the words that go into the index in this file.
21
LATEX Basic Commands
\documentclassarticle \begindocument \sectio
nSection Name Section body. \subsectionSubsecti
on Name Subsection body. \subsubsectionSubsubSec
tion Name Subsubsection body. \paragraphParagrap
h Name Paragraph body. \subparagraphSubParagraph
Name Subparagraph body. \enddocument
22
LATEX Breaking lines and text
Command Description
\newline, \\ Start a new line
\\ prohibits a page break after the forced line break
\newpage Start a new page
\mboxtext Keep several words together with out breaking between lines
\hyphenationword list, \- \hyphenationhyph-ena-tion anti\-disestablishmentarianism
23
LATEX Font styles
Command Description
\emphtext Emphasis (switches between \textit and \textrm ).
\textmdtext Medium weight (default).
\textbftext Boldface font style.
\textuptext Upright font style
\textsltext Slanted font style.
\textsftext Sans serif.
\textsctext Small caps.
\texttttext Typewriter font style
\textnormaltext Main document font.
24
LATEX Font styles
\documentclass11ptarticle
Command 10pt 11pt 12pt
\tiny 5 6 6
\scriptsize 7 8 8
\footnotesize 8 9 10
\small 9 10 10.95
\normalsize 10 10.95 12
\large 12 12 14.4
\Large 14.4 14.4 17.28
\LARGE 17.28 17.28 20.74
\huge 20.74 20.74 24.88
\Huge 24.88 24.88 24.88
\tiny sample text \large sample text \Huge
sample text
25
LATEX Cross referencing
\documentclassarticle \begindocument \sect
ionSection1\labelsec1 Here is the Section 1
body. \sectionSection2 As mentioned in
Section \refsec1. \subsectionSubsection1 \b
eta is calculated as in Equation
\refeq1. \beginequation \labeleq1 \beta
\leftarrow \frac5 (\pi - 1)\lambda2 \endequa
tion \enddocument
26
LATEX Environments
  • \beginenvironment
  • text
  • \endenvironment
  • List Environment
  • Unnumbered list
  • Numbered list

Unordered list \beginitemize \item An
item. \item another item. \enditemize
Numbered list \beginenumerate \item first
item. \item second item. \endenumerate
27
LATEX Environments
  • Text Justification
  • Flushleft
  • Flushright
  • Center

\beginflushleft This text is\\
left-aligned. force \LaTeX not to make each
line the same length. \endflushleft
\beginflushright This text is right-aligned.
\\ The second line is a also right-aligned \endfl
ushright
\begincenter This text centered. \\ The second
line is a also centered \endcenter
28
LATEX Environments
Placement Description
h here
t at the top of the page
b at the bottom of the page
p on a dedicated page of floats
! override the default float restrictions
  • Tables
  • Table
  • Tabular

\begintableplacement body of the
table \captiontable title \endtable
pos Description
t align on top row
b align on bottom row
c align to the centre
\begintabularposcols entry 1 entry 2...
entry n \\ ... \endtabular
cols Description
l a column of left-aligned items
r a column of right-aligned items
c a column of centered items
pwd a column with specific width
A vertical line
29
Tables
  • Example

\begintableh \centering \caption Simulation
Parameters \begintabularwidth\linewidthp5c
mp2.2cm \hline Parameter Value
\\ \hline Simulation time 500 sec
\\ MAC layer IEEE 802.11e
\\ Preamble length 144 bits \\ PLCP
header length 48 bits \\
\hline \endtabular \labeltabSimPars \endtabl
e
30
Tables (multirows and multicoulmns)
  • Add \usepackagemultirow to the preamble

\begintable \centering \begintabular lll
\hline \multicolumn3
c Something \\ \hline entity 1 entity 2
entity 3 \\ \hline \multirow4Any
thing entity 4 entity 5
\\ entity 6 entity 7
\\ entity 8 entity 9
\\ entity 10 entity 11
\\ \hline endtabular \captionExample
of Multirow and Multicolumn \labeltablabel \en
dtable
31
Including graphics
  • You can include any type of graphs (jpg, png,
    bmp, pdf, eps, ps, etc.)
  • But the most preferable graph types is
    Encapsulated PostScript (EPS)
  • Usable by any vector graphic application
  • Supports transparency
  • Editable file since it contains a description of
    the graphic objects using the PostScript page
    description language.
  • Can be enlarged indefinitely without losing
    quality.
  • Steps to include graphics to LaTeX document
  • prepare the .eps graphic
  • Load the graphics or graphicx package
  • Include the graphic in the .tex file

32
Including graphics
  • Load the graphicx package
  • Put the following command in the preamble
  • \usepackagegraphicx
  • Include the graph
  • The options of \Includegraphics

\beginfigureh \centering \includegraphicswi
dth0.7\linewidthplot \captionFigure Caption
Here \labelfigplot \endfigure
option Description
width change the graphic width
height change the graphic hight
angle rotate graphic counterclockwise with a specific degree
scale scale graphic ( from the original size)
option Description
33
Is there any wizard?
  • Yes there are several wizards in TeXstudio.
  • Wizards can help you quickly to do
  • Quick starting.
  • Quick beamer presentation.
  • Quick letter.
  • Quick tabular.
  • Quick tabbing.
  • Quick array.
  • Insert graphics (but drag and drop is much
    easier).
  • Math assistant.

34
Algorithms Predefined keywords
Command Description
\ End of line
\tcp Comment on the line
\tcp Comment as a separate line
\BlankLine for new blank line
\KwIninput \KwOutoutput \KwDatainput \KwResultoutput Input, output keywords
\KwRetvalue \Returnvalue Return keywords
\If(then comment)condition then block If statement with end keyword
\uIf(then comment)condition then block without end If statement without end keyword
\ElseIf(else comment)elseif block elseIf statement with end keyword
\uElseIf( else comment)elseif block elseIf statement without end keyword
\Switch(switch comment)conditionSwitch block Switch keyword
\Case(case comment)a casecase block case keyword with end keyword
\uCase(case comment)a casecase block without end case keyword without end keyword
\Other(other comment)otherwise block otherwise keyword
\For(for comment)conditiontext loop for loop with end keyword
\lFor(for comment)conditiontext loop for loop without end keyword
\While(while comment)conditiontext loop while loop with end keyword
\ForEach(foreach comment)conditiontext loop for each loop with end keyword
\ForAll(forall comment)conditiontext loop forall loop with end keyword
\Repeat(repeat comment)end conditiontext loop(until comment) repeat until keyword
35
Algorithms
  • Redefine the keywords
  • \SetKwInputKwDataData
  • \SetKwInputKwResultResult
  • \SetKwInputKwInInput
  • \SetKwInputKwOutOutput
  • \SetKwKwToto
  • \SetKwKwRetreturn
  • \SetKwReturnreturn
  • \SetKwBlockBeginbeginend
  • \SetKwCommenttcc//
  • \SetKwCommenttcp//
  • \SetKwIFIfElseIfElseifthenelse
    ifelseendif
  • Example
  • \SetKwForForfordodone

Default definition New definition
For condition do for comment text loop end For condition do for comment text loop done
36
Algorithms
  • \usepackagelinesnumbered, ruledalgorithm2e

\SetKwProgInitializeInitialize
end \SetKwProgFunctionFunction
end \SetKwProgEventEvent
doevent-end \SetKwInOutInputinput \beginal
gorithm \captionAgile-SD Congestion
Avoidance.\labelalgo01 \Inputtcp\_status \
InitializeVariables \lambda_min
\leftarrow 1, \lambda_max \leftarrow
3,\\ \beta_1 \leftarrow 0.90, \beta_2
\leftarrow 0.95,\\ cwnd \leftarrow
2\\ \FunctionOn ACK Receiption calculate
gap_current\\ calculate gap_total\\ ca
lculate \lambda\\ \alpha
\frac\lambdacwnd cwnd \leftarrow cwnd
\alpha\\ \EventOn Loss Detection cwnd_los
s \leftarrow cwnd\\ \uIf tcp\_status
SlowStart cwnd \leftarrow cwnd \times
\beta_1\\ \Else cwnd \leftarrow cwnd
\times \beta_2\\ ssthresh \leftarrow cwnd -
1\\ cwnd_degraded \leftarrow
cwnd\\ \endalgorithm
For more information about algorithm2e refer to
http//ctan.mirrorcatalogs.com/macros/latex/contr
ib/algorithm2e/doc/algorithm2e.pdf
37
Theorems
  • (theorems, definitions, propositions, remarks,
    corollaries, lemmas, etc.)
  • \usepackageamsthm
  • Define the environment in the preamble
  • \newtheoremnamedisplay word
  • Examples
  • \newtheoremtheoremTheorem
  • \newtheoremcorollaryCorollary
  • \newtheoremlemma Lemma
  • \newtheorempropProposition
  • Numbering rules
  • \newtheoremtheoremTheoremsection
  • \newtheoremcorollaryCorollarytheorem
  • \newtheoremlemmatheoremLemma
  • \newtheorempropProposition

38
Theorems
\newtheoremtheoremTheoremsection \newtheorem
corollaryCorollarytheorem \newtheoremlemma
theoremLemma \newtheorempropProposition \
sectionIntroduction Introduction to use
\setminus newtheorem command. \begintheoreman
yoption \labeltheo1 Place the theorem
definition here. \endtheorem \beginproof Place
the proof of Theorem \reftheo1
here. \endproof \begincorollary
\labelcor1 Place the corollary definition
here. \endcorollary Refer to your theorem
\reftheo1 or corollary \refcor1 \beginprop
\labelprop1 Place the proposition definition
here. \endprop \beginproof Place the proof of
Proposition \refprop1 here. \endproof
39
Mathematical Formulas
  • \usepackageamsmath
  • in-line mathematical formula
  • inline formula here
  • Example

c squared is calculated as the summation of a
squared and b squared. Or, using more
mathematical approach c2 a2 b2
40
Mathematical Formulas
  • equation environment
  • \beginequation
  • your formulas here
  • \endequation
  • Numbered equation
  • Unnumbered equation

Add a squared and b squared to get c
squared. Or, using a more mathematical
approach \beginequation a2 b2
c2 \endequation
Add a squared and b squared to get c
squared. Or, using a more mathematical
approach \beginequation a2 b2
c2 \endequation
41
Mathematical Formulas
  • multiline
  • align

\beginmultline a b c d e f g h
I \\ j k l m n \endmultline
\beginalign a b c \\ d e f g
h i j k l \nonumber \\ m n o \\
p q r s \endalign
42
Mathematical Formulas
  • IEEEeqnarray
  • Requires IEEEtrantools.sty which can be obtained
    from https//www.ctan.org/tex-archive/macros/latex
    /contrib/IEEEtran/tools
  • \usepackageretainorgcmdsIEEEtrantools
  • Example
  • Fine whitespaces can be added by using \ to
    fix the unaligned entities

\beginIEEEeqnarrayrCl a b c \\
d e f g h \nonumber\\ l m n o
\\ p q r s \endIEEEeqnarray
43
Mathematical Formulas
  • Arrays
  • Example1
  • Example2

\beginequation \mathbfX \left( \beginarray
ccc x_1 x_2 \ldots \\ x_3 x_4 \ldots
\\ \vdots \vdots \ddots \endarray
\right) \endequation
\beginequation x \left\ \beginarrayrl
-x \textif x lt 0,\\ 0 \textif x
0,\\ x \textif x gt 0. \endarray
\right. \endequation
44
Mathematical Formulas
  • Matrices
  • Example
  • practice TeXstudiogtWizardsgtQuick Array for more
    matrix types

\beginequation \mathbfP \beginbmatrix p_11
p_12 \ldots p_1n \\ p_21 p_22
\ldots p_2n \\ \vdots \vdots \ddots
\vdots \\ p_m1 p_m2 \ldots
p_mn\endbmatrix \endequation
45
Mathematical Formulas
  • Spacing
  • \, \ \quad \qquad
  • Delimiter sizes
  • Without \left and \right macros
  • With \left and \right macros

\beginequation 1 (\frac11-x2)3
\endequation
\beginequation 1 \left(\frac11-x2 \rig
ht)3 \endequation
46
Bibliography
  • Bibliography database (.bib)

_at_ARTICLEruscelli2012, author Anna
Lina Ruscelli and Gabriele Cecchetti and
Angelo Alifano and Giuseppe Lipari,
title Enhancement of QoS support of
HCCA schedulers using EDCA function in
IEEE 802.11e networks, journal Ad Hoc
Networks, year 2012, volume 10,
pages 147 - 161, number 2, doi
10.1016/j.adhoc.2010.09.014, issn
1570-8705, opturl http//www.sciencedirect.
com/science/article/pii/S157087051000154X
47
Bibliography
  • Steps to deal with citation
  • Prepare the bibliography file (.bib), perhaps
    using jabRef
  • Add the following command in the end of the
    (.tex) document file, where the references
    section is
  • Example
  • Cite the reference in you text using the
    following command

\bibliographystylebibliography
style\bibliographybibliograpy database file
\bibliographystyleIEEEtran \bibliographyyour-bi
b-database
\citeruscelli2012
48
Bibliography
  • List of bibliography styles

Style Name Author Name Format Sorting
unsrt Homer Jay Simpson as referenced
plain Homer Jay Simpson by author
named Homer Jay Simpson
authordate1 Simpson, Homer Jay
apa Simpson, H. J. (1995)
alpha Homer Jay Simpson by author
acm Simpson, H. J.
abstract Homer Jay Simpson
abbrv H. J. Simpson by author
49
Bibliography
  • Multiple citation

Several approaches such as \citeLee2009,
Jansang2011, Cecchetti2012, cecchettielAL2012,
ruscelli2012 have been presented in the
literature attempting to remedy the deficiency of
the HCCA reference scheduler in supporting QoS
for VBR traffics.
50
Getting things together
  • applying latex template
  • Get the IEEEtrans template from
    https//www.ctan.org/ or https//www.ieee.org/co
    nferences_events/conferences/publishing/templates.
    html
  • Extract the template file (which includes
    IEEEtran.cls)into a folder
  • Copy images files
  • Copy reference.bib
  • add your material in the given templates places
  • Compile
  • Done!

51
References
  • https//en.wikibooks.org/wiki/LaTeX
  • LaTeX Tutorial, Je Clark, Revised February 26,
    2002
  • Learning LATEX by Doing, Andre Heck, March 2005,
    AMSTEL Institute
  • The Not So Short Introduction to LATEX2E, Tobias
    Oetiker,Hubert Partl, Irene Hyna and Elisabeth
    Schlegl, Version 5.05, July 18, 2015
  • Latex Workshop, Mohammed A. Al-maqri, April 2015,
    UPM.
Write a Comment
User Comments (0)
About PowerShow.com