(asadpur@ce.sharif.edu) (sattarzadeh@ce.sharif.edu) All about LaTeX Mehdi Asadpur (asadpur@ce.sharif.edu) Behnam Sattarzadeh (sattarzadeh@ce.sharif.edu)

Slides:



Advertisements
Similar presentations
Introduction to FX Equation 4. The Basic Idea FX Equation is DIFFERENT. Most equation editors use a point and click interface that has you searching for.
Advertisements

MLA FORMATTING. What is MLA formatting and why do I need to use it? "MLA (Modern Language Association) style is most commonly used to write papers and.
LaTeX, BibTeX & FarsiTeX Yasser Ganji Saffar Computer Engineering Department Sharif University of Technology.
COE201 – Computer Proficiency Mr. Hamze Msheik
Word Project 2. Introduction  MLA – Modern Language Association of America.
Chapter 10 Formatting a Document.
How to Open Microsoft Word Click Start Click All Programs Click Microsoft Office Click Microsoft Word 2013.
Key Applications Module Lesson 12 — Word Essentials
PowerPoint Add formulae. Course contents Overview: Typing math formulae Lesson1: Type a simple formula Lesson2: Type a complex formula.
Latex A document preparation system All academic staff in Computer Science publish their work using Latex – NOT Microsoft Word. Why? Note to self – press.
For AMS 200, 2009 Dept. of Applied Math & Statistics School of Engineering University of California Santa Cruz, CA A Very Short Introduction to LaTeX.
Introduction to… About Tex & LaTeX What is TeX? What is LaTeX? Advantages - Disadvantages.
How to… APA 12 CP English.
Introduction to Unix – CS 21 Lecture 16. Lecture Overview LaTeX History Running and creating LaTeX documents Documents and Articles Tables Lists Fonts.
Chapter 2 Creating a Research Paper with References and Sources
Introduction to LaTeX Thomas Gorry. What is Latex?  A typesetting system used to produce professional looking documents.  Particularly good at handling.
XP Mohammad Moizuddin Creating Web Pages with HTML Tutorial 1 1 New Perspectives on Creating Web Pages With HTML Tutorial 1: Developing a Basic Web Page.
XP 1 Microsoft Word 2002 Tutorial 1 – Creating a Document.
Computer Technology. Read the definition, think of the answer, then click to see if you are right. An application program which helps you create documents.
June LaTeX " A typesetting package for formatting and creating documents. Created by L. Lamport based on TeX designed by D. Knuth. " Alphanumeric.
Computer Applications I Unit 3 Study Guide 2 Business Documents.
Formatting Documents Lesson 2 Microsoft Word. Apply Paragraph and Character styles Formatting has to do with the appearance of a document. In Word entire.
Copyright 2006 South-Western/Thomson Learning Chapter 12 Tables.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 15 Advanced Tables.
Objectives Set the margins of a document. Align text.
VOCAB REVIEW. process of copying an item from the Clipboard into the document at the location of the insertion point Pasting Click for the answer Next.
McGraw-Hill Career Education© 2008 by the McGraw-Hill Companies, Inc. All Rights Reserved. Office Word 2007 Lab 3 Creating Reports and Tables.
C151 Multiuser Operating Systems Introduction to LaTeX.
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall. 1 Skills for Success with Office 2010 Vol. 1, 2e PowerPoint Lecture to Accompany.
Lecture 3- Microsoft Word COE 201- Computer Proficiency.
 The formatting applied to a document can affect: › How the reader interprets the document › How easily the document is read › The overall impression.
Chapter 5 More About LaTex. Packages A package, which takes the form of a file with a sty extension, can be used to alter formatting parameters, create.
1 Obj Business Documents: Research Report and Table of Contents.
MS WORD INFORMATION TECHNOLOGY MANAGEMENT SERVICE Training & Research Division.
Department of Mathematics, Jazan University, Jazan.
Key Applications Module Lesson 12 — Word Essentials Computer Literacy BASICS.
MANAGING TEXT FLOW Lesson 5. OBJECTIVES SOFTWARE ORIENTATION The Page Layout tab contains groups of commands that will produce a formatted document’s.
LaTex -Computer scientist named Donald Knuth developed the program called Tex, in 1978.(mainly focused on formulae) -Later a mathematician and computer.
APA Format Formatting Running Heads and Title Pages Catherine M. Parisian.
LATEX By GerardoVela 3/27/2015.
Lesson 16 Enhancing Documents
Tutorial 2 – Editing and Formatting a Document
Microsoft Office 2007-Illustrated
Lesson 16 Enhancing Documents
Microsoft Word 2016 Lesson 4 Prepared 2/13/11.
Unit 2 Terms Word Processing.
Word Processing.
Tutorial 1 – Creating a Document
By Rajyalakshmi Divi IIT Bombay
BU 102YB: Advanced Business Documents
Introduction to LaTeX David and Lucas CS 173 Fall 2009
Word Processing & Desktop Publishing Software
Word Processing & Desktop Publishing Software
Formatting and Editing Skills
Formatting Paragraphs
Paragraph Formatting Lesson 4.
Word processing review
Key Applications Module Lesson 12 — Word Essentials
Benchmark Series Microsoft Word 2016 Level 2
APA Style Tutorial.
A Very Short Introduction to LaTeX
Microsoft Official Academic Course, Microsoft Word 2013
Outline Basic English Information Inquiry Reading Technical Materials
Skills for Success with Microsoft Office 2010
Key Applications Module Lesson 12 — Word Essentials
Making Math Look Pretty – or How to Use LaTeX
Formatting and Editing Skills
Unit G: Using Complex Formulas, Functions, and Tables
Welcome To Microsoft Word 2016
Presentation transcript:

(asadpur@ce.sharif.edu) (sattarzadeh@ce.sharif.edu) All about LaTeX Mehdi Asadpur (asadpur@ce.sharif.edu) Behnam Sattarzadeh (sattarzadeh@ce.sharif.edu) Yaser Ganji Saffar (ganji@ce.sharif.edu)

Outline Introduction Document Structure Mathematical Typesetting Spacing Accents and Font Style Tables, Arrays, and Lists Multi-line Equations Text Formatting Bibliography and Compound Expressions Slides Including Graphics Business Letters 12/2/2018

Introduction Introduction to LaTeX Required Components of a LaTeX Document Error Messages Typing LaTeX Commands 12/2/2018

1.1 Introduction to LaTeX The history of TeX The history of LaTeX Donald Knuth, 1978 Everyone could easily use to typeset documents, particularly those that include formulae. Make 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 12/2/2018

1.2 Documents Components Every LaTeX document must contain the following three components: \documentclass{article} \begin{document} \end{document} In general, required information is included in LaTeX commands in braces {}, while optional information is included in square brackets []. The default font size for each class is 10 point. The \documentclass command must appear at the very beginning of your LaTeX document, before any other LaTeX commands, or you will get an error message. 12/2/2018

1.3 Error Messages A common error is not to close braces for a command. Another one that occurs frequently is to use math commands outside of math mode (described later). Since LaTeX will stop after any \end{document} command, a good strategy is to insert \end{document} temporarily to see if the error is above its location. 12/2/2018

1.4 Typing LaTeX Commands Maybe, you having to type LaTeX commands as part of your text. How do you do that without LaTeX taking them seriously and following them? Surround any text that you want printed as is with a \begin{verbatim} and an \end{verbatim} command. 12/2/2018

Document Structure Page Numbering and Headings Creating a Title Page Creating a Title Page, Continued Sections Cross-References Table of Contents Abstracts Footnote 12/2/2018

2.1 Page Numbering and Headings The command \pagestyle controls page numbering and headings. It can take the following forms: \pagestyle{plain} \pagestyle{empty} \pagestyle{headings} \pagestyle{myheadings} These commands can also be applied to a single page using \thispagestyle instead of \pagestyle. 12/2/2018

2.2 Creating a Title Page (Remember that the preamble refers to any commands between the \documentclass command and the \begin{document} command.) Provide this information in the preamble of your document: \title{yourtitlehere} \author{yournamehere \date{currentdate} 12/2/2018

2.3 Creating a Title Page (cont.) Place a \maketitle command immediately after the \begin{document} command. The \documentclass command can take a titlepage option: \documentclass[titlepage]{article}. 12/2/2018

2.4 Sections One of the most important ways of creating structure in a document is to split it into logical sections. There are two related commands for creating sections: \section{sectiontitle} \section*{sectiontitle}. They provide information to LaTeX in case you want to create a Table of Contents. 12/2/2018

2.5 Cross-References Use \label{name} to label the point in your document with some mnemonic. Section \ref{name} to refer to that point. \ref{name} 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. 12/2/2018

2.6 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 \begin{document} 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. 12/2/2018

2.7 Abstracts To create an abstract, place your text in an abstract environment, i.e., between \begin{abstract} and \end{abstract} commands. The abstract should come immediately after your \maketitle command, but before any \tableofcontents command. 12/2/2018

2.8 Footnote Using \footnote{your footnote message} For example: … in ICMP\footnote{Internet Control Message Protocol} … 12/2/2018

Mathematical 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 More Symbols 12/2/2018

3.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. $$ \frac{x^n-1}{x-1} = \sum_{k=0}^{n-1}x^k 12/2/2018

3.2 Greek Letters 12/2/2018

3.2 Greek Letters (cont.) 12/2/2018

3.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. $x^21 \ne x^{21}$ Similarly, subscripts are created using the _(underscore character). Again, for subscripts of more than one character, use braces to indicate where the subscript starts and stops. $x_21 \ne x_{21}$ 12/2/2018

3.4 Above and Below \overline \overbrace \underline \underbrace $$ \left( \begin{array}{c} m+n\\ m \end{array} \right) = \frac{(m+n)!}{m!n!} = \frac {\overbrace{(m+n)(m+n-1)\cdots(n+1)}^\mbox{$m$ factors} {\underbrace{m(m-1)\cdots 1}_\mbox{$m$ factors}} ${ while $\overline{x+\overline{y}} = \overline{x}+y$ 12/2/2018

3.5 Fractions Diagonal fraction bar Horizontal fraction bar $a/b$ written as \frac{numerator}{denominator}. $$ \frac{a/b-c/d}{e/f-g/h} 12/2/2018

3.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 12/2/2018

3.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. $$ \sum_{k=0}^\infty\frac{(-1)^k}{k+1} = \int_0^1\frac{dx}{1+x} \lim_{x\rightarrow 0} \frac{\sin x}{x} = 1 12/2/2018

3.8 Roots Use the \sqrt{} command to produce square roots: $\sqrt{\frac{a}{b}}$ If you need an nth root, use \sqrt[n]{} instead. $\sqrt[10]{\frac{a}{b}}$ 12/2/2018

3.9 Text in Math Displays Use the command \mbox{your text here} to include short phrases in a formula. (If your phrase isn't short, then you should consider embedding your formula in a text paragraph instead of your text in a formula paragraph.) $$ \int_0^{2\pi}\cos(mx)\,dx = 0 \hspace{1cm} \mbox{if and only if} \hspace{1cm} m\ne 0 12/2/2018

3.10 Operators You will probably not need most of the binary operators listed here, but it should be a handy reference: 12/2/2018

3.11 Relations Again, here are more relations than you will ever need. You may want to print this for reference: 12/2/2018

3.12 Negated Symbols 12/2/2018

3.13 More Symbols For \therefore you will need to include the line \usepackage{amssymb} in your preamble. Similarly, for using \mathbb{Z}, etc., you will need to include the line \usepackage{amssymb} in your preamble. 12/2/2018

Spacing Spacing Between Words Fine-Tuning Spacing in Math-Mode Double Spacing Sloppy Line Breaks Enlarging Pages 12/2/2018

4.1 Spacing Between Words LaTeX controls the spacing of your document, trying hard to break lines in places that are pleasing to the eye. As a consequence, one blank space is the same as 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. 12/2/2018

4.2 Spaces in Math-Mode \, produces a small space \: produces a medium space \; produces a large space \! produces a small negative space 12/2/2018

4.3 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 \renewcommand{\baselinestretch}{2} in your paper's preamble. 12/2/2018

4.4 Sloppy Line Breaks Surround the offending paragraph with \begin{sloppypar} and \end{sloppypar} commands. Then LaTeX will not break words up but rather will allow more spacing between words in the given paragraph. 12/2/2018

4.5 Enlarging Pages LaTeX works very hard to find the best place to break between pages. If you are unhappy with the result, you can change it with the following two commands: \newpage will force the start of a new page. \enlargethispage{size} will increase the number of lines added to a page. 12/2/2018

Accents and Font Style Accents Hyphenation The Logo Quotation Marks Changing the Appearance of Words 12/2/2018

5.1 Accents LaTeX can produce the following accents. (The letter \u" is only used for the purposes of this example. The accents work with any letter.) 12/2/2018

5.2 Hyphenation There are four hyphens in LaTeX : For example: - (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$. 12/2/2018

5.3 The LaTeX Logo You can typeset the LATEX logo with the \LaTeX command. As with most commands, it consumes any space behind it, so if it isn't at the end of a sentence, use \LaTeX\ instead. 12/2/2018

5.4 Quotation Marks Use `` (usually on the left side of the keyboard) to begin a quotation And '' (usually on the right side of the keyboard) to end a quotation: 12/2/2018

5.5 Appearance of Words \underline{phrase} to underline a phrase, \textbf{phrase} to print a phrase in boldface, and \emph{phrase} to italicize a phrase. 12/2/2018

Tables, Arrays, and Lists Constructing Arrays Constructing Tables 12/2/2018

6.1 Constructing Arrays Surround the entries with a \begin{array}{justification} command and an \end{array} 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( \begin{array}{rcl} \alpha&\beta&\gamma\\ \delta&\epsilon&\zeta\\ \eta&\theta&\iota\\ \end{array} \right) 12/2/2018

6.2 Constructing Tables For example: \begin{tabular}{|r|c|l|} \hline Right & Center & Left\\ alpha&beta&gamma\\ delta&epsilon&zeta\\ eta&theta&iota\\ \end{tabular} 12/2/2018

Multi-line Equations Multi-line Equations Accents Dots Indenting 12/2/2018

7.1 Multi-line Equations Surround the equations by \begin{eqnarray*} and \end{eqnarray*}. Surround the equals sign or inequality with &'s, and end each line with \\. Note: you do not need to use $$'s with this environment. For example, \begin{eqnarray*} 1+2+\ldots+n &=& \frac{1}{2}((1+2+\ldots+n)+(n+\ldots+2+1))\\ &=& \frac{1}{2}\underbrace{(n+1)+(n+1)+\ldots+(n+1)}_{\mbox{$n$ copies}}\\ &=& \frac{n(n+1)}{2}\\ \end{eqnarray*} 12/2/2018

7.2 Accents We use several different kinds of accents in mathematics: a hat, bar, dot, and arrow over a variable all have different meanings. LaTeX uses commands that surround the variable: $\hat{a}, \dot{a}, \ddot{a}, \tilde{a}, \bar{a}, \vec{a}$ 12/2/2018

7.3 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( \begin{array}{ccc} a_{11}&\cdots&a_{1n}\\ \vdots&\ddots&\vdots\\ a_{m1}&\cdots&a_{mn} \end{array} \right) $$ 12/2/2018

7.4 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{\parindent}{size of indentation with unit}. Since this is a command that affects the whole document, it should go in the preamble, between the \documentclass and \begin{document} commands. 12/2/2018

Text Formatting Centering Text Special Headers Extended Quotation Bulleted Lists Numbered Lists Filling a Line 12/2/2018

8.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: \begin{center} and \end{center}. 12/2/2018

8.2 Special Headers A header is the text automatically included at the top of each document. If you use \pagestyle{myheadings}, then you will need some way to indicate what your heading is. The command \markright{Your Header Text Here} will do the job for you. 12/2/2018

8.3 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. The least obtrusive way to do so is to indent. In LaTeX, surround the quotation with \begin{quote} and \end{quote}. 12/2/2018

8.4 Bulleted Lists \begin{itemize} To create a bulleted list, surround the information with a \begin{itemize} and an \end{itemize}, and begin each item with an \item. For example, \begin{itemize} \item A bulleted item. \item Another bulleted item. \item A nested bulleted item. \end{itemize} \item You get the idea. 12/2/2018

8.5 Numbered Lists To create a numbered list, surround the information with a \begin{enumerate} and an \end{enumerate}, and begin each item with an \item. For example, \begin{enumerate} \item A numbered item. \item Another numbered item. \item A nested numbered item. \end{enumerate} \item You get the idea. 12/2/2018

8.6 Filling a Line You can insert an arbitrary amount of space into a line with the \hspace{length} command. Here the length must include a unit, such as 1.5in or 2.3cm. 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. 12/2/2018

9 Bibliography Bibliographies Using BibTex 12/2/2018

9.1 Bibliographies LaTeX provides a mechanism for automatically linking citations with items in the bibliography. Surround the bibliography with \begin{thebibliography}{9} and \end{thebibliography}. With the bibliography in place, a citation in the body of the document is made with \cite{label}, where label is the same as what occurs in the corresponding \bibitem{label}. What is the 9 in \begin{thebibliography}{9} for? It is a dummy number indicating how many digits to leave space for in the numbering of the bibliography. 12/2/2018

9.2 Using BibTex 12/2/2018

Slides The Slide Class How to Use the Slides Class 12/2/2018

10.1 The Slide Class LaTeX does not want to be Microsoft PowerPoint. If you have mathematical formulae to display on transparencies, LaTeX is there to help with the slides document class. The slide class uses a larger font that is designed to be legible at a distance. 12/2/2018

10.2 How to Use the Slides Class Start with \documentclass{slides}. Surround the document with \begin{document} and \end{document} commands. Surround the text that you want to appear on each slide with \begin{slide} and \end{slide} commands. Preview the slides to see where best to break the material between slides. 12/2/2018

Including Graphics Graphic File Formats Graphics Package Including Graphics Within Your Document 12/2/2018

11.1 Graphic File Formats There are a number of graphics formats out there, such as: bmp eps Gif Jpg PDF ps LaTeX works best with the postscript formats (eps, ps) which were around 12/2/2018

11.2 Graphics Package Picture environment \begin{picture} & \end{picture} If you are going to include graphics in your document, you will need to ask LaTeX to use a package of graphics commands: place \usepackage{graphicx} in the preamble. For example: 12/2/2018

11.3 Including Graphics You use the \includegraphics{graphicfile} command to include your graphic file in your document. If you wish to control the size of the document, you can also specify the height and width: \includegraphics[height=2in, width =3in]{graphicfile}. 12/2/2018

Business Letters The Letter Class Letter Commands for the Preamble Commands for Each Letter 12/2/2018

12.1 The Letter Class Aside from the article class, LaTeX provides a letter class for formal letters. To use the class, Start with a \documentclass{letter}. Include the commands that apply to all letters in the file. Begin with a \begin{document} command. Include the commands for each letter. End with a \end{document} command. 12/2/2018

12.2 Preamble’s Letter Commands The following commands apply to each letter in the file: \address{youraddress} for your return address. \signature{yournameandtitle} for your printed name in the signature block. \date{letterdate} if you want to x the date on the letter; otherwise the date will default to the current date when the letter is printed. 12/2/2018

12.3 Commands for Each Letter Start with \begin{letter}. On the next line, type the addressee's address in braces. Separate lines with \\’s. Put your opening greeting in \opening{dearjohndoe}. Put the text of your letter. Put your closing in \closing{sincerely}. If their are carbon copies, use \cc{names}. If their are enclosures, use \encl{docs}. If their is a postscript, use \ps. End with \end{letter}. 12/2/2018

Summary Introduction Document Structure Mathematical Typesetting Spacing Accents and Font Style Tables, Arrays, and Lists Multiline Equations Text Formatting Bibliography and Compound Expressions Slides Including Graphics in Your Document Business Letters 12/2/2018

References & 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/manual/ http://www.iam.ubc.ca/~newbury/tex/ http://cs.usask.cagradswew036latex.html http://www.latex-project.org 12/2/2018

The End