Title: LaTeX, BibTeX
1LaTeX, BibTeX FarsiTeX
- Yasser Ganji Saffar
- ganji_at_ce.sharif.edu
- Computer Engineering Department
- Sharif University of Technology
2Outline
- LaTeX
- Bibliographies BibTeX
- TeX tools
- IEEEtran
- FarsiTeX
31.1 Introduction to LaTeX
- The history of TeX
- Donald Knuth, 1978
- Everyone could easily use to typeset documents,
particularly those that include formulae. - Made it freely available.
- The history of LaTeX
- Leslie Lamport, wrote a variant of TeX called
LaTeX. - Focuses on document structure rather than TeX
small details - Strong when working with mathematical symbols
- Currently it is the standard of typesetting.
41.1 Introduction to LaTeX (contd.)
- LaTeX is not a WYSIWYG word processor!
- not to worry too much about the appearance
- but to concentrate on getting the right content.
- For example
- You only need to mention that a statement is the
title of the document. - You dont need to mention the font, size, for
title.
51.2 Documents Components
- Every LaTeX document must contain the following
three components - \documentclassarticle
- \begindocument
- \enddocument
- In Latex commands generally
- required information is included in braces
- optional information is included in square
brackets .
6An Example
- \documentclassa4paper,11ptarticle
- \begindocument
- This is a simple latex file.
- \enddocument
7Document Classes Options
- Classes
- article
- report
- book
- slides
- Options
- 10pt, 11pt, 12pt
- a4paper, letterpaper,
- onecolumn, twocolumn
81.3 Error Messages
- Since LaTeX will stop after any \enddocument
command, a good strategy is to insert
\enddocument temporarily to see if the error is
above its location.
91.4 Verbatim Environment
- Maybe, you have to type LaTeX commands as part of
your text. - Surround any text that you want printed as is
with a \beginverbatim and an \endverbatim
command. - For example
- \beginverbatim
- include
- int main()
- return 0
-
- \endverbatim
10Document Structure
- Page Numbering and Headings
- Creating a Title Page
- Sections
- Cross-References
- Table of Contents
- Abstracts
- Footnote
112.1 Page Numbering and Headings
- The command \pagestyle controls page numbering
and headings. It can take the following forms - \pagestyleplain
- Just a page number
- \pagestyleempty
- Produces empty heads and feet - no page numbers .
- \pagestyleheadings
- Prints the chapter or section name, and the page
number in the heading and footer would be empty - \pagestylemyheadings
- You specify what is to go in the heading with the
\markboth or the \markright commands - These commands can also be applied to a single
page using \thispagestyle instead of \pagestyle.
122.2 Creating a Title Page
- \documentclassarticle
- \titlesome title
- \authorsome name
- \datesome date
- \begindocument
- \maketitle
132.3 Sections
- There are two related commands for creating
sections - \sectionsectiontitle
- \sectionsectiontitle
- They provide information to LaTeX in case you
want to create a Table of Contents. - \subsectiontitle
- \subsubsectiontitle
142.4 Cross-References
- Use \labelname to label the point in your
document with some mnemonic. - Section \refname to refer to that point.
- \refname will be replaced by the number of the
section containing the corresponding \label
command. - You will need to run LaTeX twice to generate
these references.
152.5 Table of Contents
- If you have been using \section commands
throughout your document, then LaTeX has all the
information that it needs to construct one for
you. - Place the command \tableofcontents after your
\begindocument command. - It may be necessary to run LaTeX twice on a
document with a Table of Contents. - If you have question marks instead of page
numbers in your Table of Contents, run LaTeX
again.
162.6 Abstracts
- To create an abstract, place your text in an
abstract environment, i.e., between
\beginabstract and \endabstract commands. - The abstract should come immediately after your
\maketitle command, but before any
\tableofcontents command.
172.7 Footnote
- Using \footnoteyour footnote message
- For example
- in ICMP\footnoteInternet Control Message
Protocol
18Mathematical Typesetting
- Mathematical Formulas
- Greek Letters
- Exponents and Subscripts
- Above and Below
- Fractions
- Functions
- Sums, Integrals, and Limits
- Roots
- Text in Math Displays
- Operators
- Relations
- Negated Symbols
193.1 Mathematical Formulas
- There are two ways to insert mathematical
formulas into your document with LaTeX - Is to have it appear in a paragraph with text().
- Is to have them appear in a separate
paragraph(). - \alpha is the first letter of the Greek
alphabet. -
- \fracxn-1x-1 \sum_k0n-1xk
-
203.2 Greek Letters
213.3 Exponents and Subscripts
- Use the character to create exponents
- If you have an exponent containing more than one
character, group the exponent characters inside
braces. - x21 \ne x21
- Similarly, subscripts are created using the
underscore character. - x_21 \ne x_21
223.4 Above and Below
- \overline
- \overbrace
- \underline
- \underbrace
-
- \left(
- \beginarrayc
- mn\\
- m
- \endarray
- \right)
- \frac(mn)!m!n!
- \frac
- \overbrace(mn)(mn-1)\cdots(n1)\mboxm
factors - \underbracem(m-1)\cdots 1_\mboxm factors
-
- while \overlinex\overliney
\overlinexy
233.5 Fractions
- Diagonal fraction bar a/b
- Horizontal fraction bar written as
\fracnumeratordenominator. -
- \fraca/b-c/de/f-g/h
243.6 Functions
- LaTeX uses italics in math mode.
- Roman (non-italic) for function names.
- Use a backslash in front of function names.
- Here is a list of function names
-
- \arccos \arcsin \arctan \arg
- \cos \cosh \cot \coth
- \csc \deg \det \dim
- \exp \gcd \hom \inf
- \ker \lg \lim \liminf
- \limsup \ln \log \max
- \min \Pr \sec \sin
- \sinh \sup \tan \tanh
253.7 Sums, Integrals, and Limits
- Summations and integrals both have lower and
upper limits, and the commands are similar. - Limits usually have text with an arrow placed
below them. -
- \lim_x\rightarrow 0 \frac\sin xx 1
-
-
- \sum_k0\infty\frac(-1)kk1
\int_01\fracdx1x -
263.8 Roots
- Use the \sqrt command to produce square roots
- \sqrt\fracab
- If you need an nth root, use \sqrtn instead.
- \sqrt10\fracab
273.9 Text in Math Displays
- Use the command \mboxyour text here to include
short phrases in a formula. -
- \int_02\pi\cos(mx)\,dx 0 \hspace1cm
- \mboxif and only if \hspace1cm m\ne 0
-
283.10 Operators
293.11 Relations
303.12 Negated Symbols
31Spacing
- Spacing Between Words
- Double Spacing
- Horizontal Vertical Spacing
324.1 Spacing Between Words
- LaTeX controls the spacing of your document,
trying hard to break lines in places that are
pleasing to the eye. - one blank space a million blank spaces.
- Tabs are treated like blank spaces.
- Blanks at the end of a line are ignored.
- A single Enter is treated like a blank space.
- More than one Enter marks the beginning of a new
paragraph.
334.2 Double Spacing
- There will be times when you will need to submit
a draft that is double-spaced, to permit a grader
or editor to make comments. - To double-space a paper, put this in your paper's
body - \setlength\baselineskip2\baselineskip
344.3 Horizontal Vertical Spacing
- Use \hspacelength for horizontal space.
- Here the length must include a unit, such as
1.5in or 2.3cm. - Use \vspacelength for vertical space.
35Accents and Font Style
- Accents
- Hyphenation
- Quotation Marks
- Changing the Appearance of Words
- Size of Words
365.1 Accents
- \hata,
- \dota,
- \ddota,
- \tildea,
- \bara,
- \veca
- LaTeX can also produce the following accents
375.2 Hyphenation
- There are four hyphens in LaTeX
- - (a single dash) is for hyphenating words.
- -- (two dashes) is for ranges of numbers.
- --- (three dashes) is for an honest-to-goodness
dash between words. - - is a minus sign in math mode.
- For example
- My cousin-in-law lived in Germany in 1995--6 he
speaks French---really, he does. His favorite
number is -2.
385.3 Quotation Marks
- Use (usually on the left side of the keyboard)
to begin a quotation - And (It is two characters that is usually
on the right side of the keyboard) to end a
quotation. - For example, This is a quote.
395.4 Appearance of Words
- Use \underlinephrase to underline a phrase.
- Use \textbfphrase or \bf phrase to print a
phrase in boldface. - Use \emphphrase to italicize a phrase.
405.5 Size of Words
- \Huge Huge
- \huge huge
- \Large Large
- \large large
- normal
- \small small
41Tables Arrays
- Constructing Arrays
- Constructing Tables
426.1 Constructing Arrays
- Surround the entries with a \beginarrayjustific
ation command and an \endarray command. - Separate column entries by an . And end each
line with a \\. - If your array is a matrix, you can surround it
with large parentheses - \left( and \right).
-
- For example
-
- \left(
- \beginarrayrcl
- \alpha\beta\gamma\\
- \delta\epsilon\zeta\\
- \eta\theta\iota\\
- \endarray
- \right)
-
436.2 Constructing Tables
- For example
- \begintabularrcl
- \hline
- Right Center Left\\
- \hline
- alpha beta gamma\\
- delta epsilon zeta\\
- eta theta iota\\
- \hline
- \endtabular
44Multi-line Equations
- Multi-line Equations
- Dots
- Indenting
457.1 Multi-line Equations
- Surround the equations by \begineqnarray and
\endeqnarray. - Surround the equals sign or inequality with 's,
and end each line with \\. - No for with this environment.
- For example,
- \begineqnarray
- 12\ldotsn \frac12((12\ldotsn)(n\l
dots21))\\ - \frac12\underbrace(n1)(n1)\ldots(n
1)_\mboxn copies\\ - \fracn(n1)2\\
- \endeqnarray
467.2 Dots
- \cdots for center height dots.
- \ddots for diagonal dots, which occur in
matrices. - \ldots for lower height dots.
- \vdots for vertical dots.
- For example
-
- \left(
- \beginarrayccc
- a_11\cdotsa_1n\\
- \vdots\ddots\vdots\\
- a_m1\cdotsa_mn
- \endarray
- \right)
-
477.3 Indenting
- The default for a LaTeX document is to indent new
paragraphs unless the paragraph follows a section
heading. - If you want to change the indentation, use the
\indent and \noindent commands respectively, at
the beginning of the paragraph. - If you wish to choose the amount of indentation
for some reason, then use the command - \setlength\parindentsize of indentation
- Since this is a command that affects the whole
document, it should go in the preamble, between
the \documentclass and \begindocument commands.
48Text Formatting
- Centering Text
- Extended Quotation
- Bulleted Lists
- Numbered Lists
- Filling a Line
498.1 Centering Text
- By default, LaTeX will start all text at the left
margin. - If you want to center a title, a table, etc.,
surround what you want centered with the
commands - \begincenter and \endcenter.
508.2 Extended Quotation
- If you are going to include an extended quotation
from another source, it is important to indicate
the difference between the quotation and your
words. - In LaTeX, surround the
- quotation with \beginquote
- and \endquote.
518.3 Bulleted Lists
- To create a bulleted list, surround the
information with a \beginitemize and an
\enditemize, and begin each item with an \item. - For example,
- \beginitemize
- \item A bulleted item.
- \item Another bulleted item.
- \beginitemize
- \item A nested bulleted item.
- \enditemize
- \item You get the idea.
- \enditemize
528.4 Numbered Lists
- To create a numbered list, surround the
information with a \beginenumerate and an
\endenumerate, and begin each item with an
\item. - For example,
- \beginenumerate
- \item A numbered item.
- \item Another numbered item.
- \beginenumerate
- \item A nested numbered item.
- \endenumerate
- \item You get the idea.
- \endenumerate
538.5 Filling a Line
- If you want a spacing in a line that will push
the surrounding words to the left and right
margins, use the \hfill command. - If instead of spacing, you want either dots or a
line, use \dotfill or \hrulefill, respectively.
549. Including Graphics
- Put \usepackagegraphicx before
\begindocument. - \beginfigure
- \centering
- \includegraphicswidth14cmsample.jpg
- \captionA Sample Image
- \labelfigsample
- \endfigure
55Bibliography BibTeX
- Introduction
- Styles
- BibTeX
56Bibliographies
- LaTeX provides a mechanism for automatically
linking citations with items in the bibliography.
- Surround the bibliography with \beginthebibliogra
phy99 and \endthebibliography. - With the bibliography in place, a citation in the
body of the document is made with \citelabel,
where label is the same as what occurs in the
corresponding \bibitemlabel. - What is the 99 in \beginthebibliography99
for? It is a dummy number indicating how many
digits to leave space for in the numbering of the
bibliography.
57BibTeX
- _at_articleGanji2005,
- author Y. Ganji Saffar and H.
Abolhassani", - title "A Sample IEEE document",
- journal IEEE transactions on Web
Services, - volume "20",
- month nov,
- year 2005",
- pages "569-571"
58BibTeX items
- _at_article
- An article from a journal or magazine.
- _at_book
- A book with an explicit publisher.
- _at_booklet
- A work that is printed, but without a named
publisher. - _at_conference
- A conference article.
- _at_phdthesis
- A PhD thesis.
- _at_manual
- A technical documentation.
- _at_misc
- Use this type when nothing else ts.
59BibTeX Collections
- You can have a large BibTeX database and in each
one of your documents reference to some parts of
it. - Use \nocitelabel when you want to have an item
in your bibliography although you do not have a
reference in your document.
60Bibliography Styles
61Bibliography Styles - plain
- Entries are sorted alphabetically and are
labelled with numbers
62Bibliography Styles - alpha
- Like plain, except that entry labels are formed
from the authors' names and the year of
publication.
63Bibliography Styles - unsrt
- Like plain, except that entries appear in the
order of their first citation.
64Bibliography Styles - abbrv
- Like plain, except that entries are more compact
because first names, month names and journal
names are abbreviated
65TeX tools
- Windows
- WinEdt
- TeXnicCenter
- Linux
- Use the following series of commands
- latex filename.tex
- bibtex filename.tex
- latex filename.tex
- latex filename.tex
66WinEdt
67(No Transcript)
68TeXnicCenter
69(No Transcript)
70IEEEtran
- Class Options
- Text size
- 9pt, 10pt, 11pt, 12pt
- Modes
- conference, journal, technote, peerreview,
peerreviewca - Paper size
- letterpaper, a4paper
- Columns
- onecolumn, twocolumn
- Bibliography Style IEEEtran
- IEEEtran.cls and IEEEtran.bst must be on the same
directory of your TeX file (these are available
on the course page).
71\documentclassconferenceIEEEtran 8 pages
\documentclassarticle 19 pages
72conference
73journal
74technote
75peerreview
76FarsiTeX
- Based on LaTeX 2.09 (too old)
- Use \documentstylefarsiarticle instead of
\documentclassarticle - Undo is not supported in the current editor (
- You can not copy the content to Windows
clipboard.
77Inserting Pictures (1/2)
- Convert your picture file to .eps format.
- In Windows
- jpeg2ps.exe sample.jpg sample.eps
- jpeg2ps.exe is available on course page.
- Often the quality of .eps files is dramatically
low, so if you want to have a high quality result
the resolution of your JPG file must be high. - In Linux
- convert sample.jpg sample.eps
- Convert converts an input file using one image
format to an output file with a differing image
format.
78Inserting Pictures (2/2)
- Insert the following codes
79Margins
80Bibliography
- BibTeX is not supported (
81References Links
- LaTeX Tutorial, Jeff Clark, Revised February 26,
2002 - Some Examples of Using LaTeX(first draft) ,
Samuel R. Buss, May 15, 1996 - Introduction to the LaTeX Document Preparation
System, Information Technology Rice University - LaTeX, Henry Stern Carrie Gates, October 22, 2002
- http//abel.math.harvard.edu/computing/latex/manua
l/ - http//www.latex-project.org
- http//www.farsitex.org
- http//ce.sharif.edu/ghodsi
82The End