You are on page 1of 142

A LTEX and MiKTEX

Introduction
http://www.win.tue.nl/marko/latex/intro

November 2008

Marko Boon (marko@win.tue.nl)

Contents
Introduction
A LTEX Related Programs

2/98

3 14 31 45 46 55 62 63 65 78 94 97
November 2008

Text, Symbols and Commands Exercise Document Layout Displaying Text Exercise Mathematics Tables Graphics Including programming statements Exercise

department of mathematics and computer science

Introduction

3/98

A LTEX is a document preparation system. It is widely used in the elds of mathematics and natural sciences, but also spreading to many other disciplines. A LTEX is a set of markup commands used with the powerful typesetting program TEX.

totally open software system, free of charge. platform independent.

department of mathematics and computer science

November 2008

Introduction

3/98

A LTEX is a document preparation system. It is widely used in the elds of mathematics and natural sciences, but also spreading to many other disciplines. A LTEX is a set of markup commands used with the powerful typesetting program TEX.

totally open software system, free of charge. platform independent.


A A LTEX is no word processor! LTEX stimulates placing emphasis on content (logical markup) instead of appearance (typographical markup).

department of mathematics and computer science

November 2008

Introduction

4/98

department of mathematics and computer science

November 2008

Introduction

5/98

A LTEX editor: WinEdt

department of mathematics and computer science

November 2008

Introduction

6/98

DVI previewer: Yap

department of mathematics and computer science

November 2008

Introduction

7/98

PostScript viewer: GSView

department of mathematics and computer science

November 2008

Introduction

8/98

PDF viewer: Adobe (Acrobat) Reader

department of mathematics and computer science

November 2008

Introduction

9/98

department of mathematics and computer science

November 2008

Introduction
A The LTEX language

10/98

A LTEX commands always start with a backslash: \

department of mathematics and computer science

November 2008

Introduction
A The LTEX language

10/98

A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }

department of mathematics and computer science

November 2008

Introduction
A The LTEX language

10/98

A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }

optional command arguments are placed between brackets: [ ]

department of mathematics and computer science

November 2008

Introduction
A The LTEX language

10/98

A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }

optional command arguments are placed between brackets: [ ] comments start with a percentage symbol: %

department of mathematics and computer science

November 2008

Introduction
A The LTEX language

10/98

A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }

optional command arguments are placed between brackets: [ ] comments start with a percentage symbol: %
A LTEX takes care of the spacing between words and paragraphs (just like HTML).

department of mathematics and computer science

November 2008

Introduction
A The LTEX language

10/98

A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }

optional command arguments are placed between brackets: [ ] comments start with a percentage symbol: %
A LTEX takes care of the spacing between words and paragraphs (just like HTML).

the commands \begin{ } and \end{ } create environments.

department of mathematics and computer science

November 2008

Introduction
A .tex le
\documentclass[options]{document_class} % preamble \begin{document} % document \end{document}

11/98

department of mathematics and computer science

November 2008

Introduction
A .tex le: intro.tex
\documentclass[12pt]{article} \usepackage[english]{babel} \begin{document} \section{Introduction} LaTeX is a document preparation system used to create documents of high quality typography. It is mostly used in the fields of mathematics and natural sciences, but can in fact be used for any type of publication. \end{document}

12/98

department of mathematics and computer science

November 2008

Introduction
MiKTEX

13/98

MiKTEX is an up-to-date TEX implementation for the Windows operating system. can be downloaded from http://www.miktex.org
A contains all LTEX related binaries, like latex.exe, pdflatex.exe, yap.exe, bibtex.exe, dvips.exe, ps2pdf.exe

contains all standard packages (will be discussed later)

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt editor Yap DVI previewer GSView PS previewer Other useful programs: Adobe Acrobat or Adobe Reader view/edit PDF les Corel Designer or Open Ofce.org Draw Create and export EPS Images

14/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

15/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

16/98

New LaTeX document

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

17/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

18/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

19/98

department of mathematics and computer science

November 2008

A LTEX Related Programs

20/98

A runs LTEX on the current document. If no errors are found, the resulting DVI le will be opened in Yap.

converts DVI to PostScript. opens the PostScript le in GSView.


A runs PDFLTEX on the current document.

opens the document in Yap and jumpt to the current location in the document. starts BibTEX(for bibliographies). generates a master index. removes all generated auxiliary les (DVI, LOG, PDF, BIB, . . .). Only the PostScript le will not be deleted.

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

21/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

22/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

23/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


Yap

24/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


Yap

25/98

double-click on text for inverse search

department of mathematics and computer science

November 2008

A LTEX Related Programs


dvips

26/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


GSView

27/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

28/98

Mathematical symbols

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

29/98

department of mathematics and computer science

November 2008

A LTEX Related Programs


WinEdt

30/98

Jump to line Line numbering on/off Wrapping on/off Line / block selection mode Spelling check on/off

department of mathematics and computer science

November 2008

Text, Symbols and Commands


the single characters # $ & ~ _ ^ % { } all have special meaning

31/98

A A command is an instruction to LTEX to do something special. Three types of command names:

to print one of these characters, precede it with a backslash: \$ \# \% the backslash character \ plus a sequence of letters, ending with the rst non-letter: \large \Large \bfseries

department of mathematics and computer science

November 2008

Text, Symbols and Commands


the single characters # $ & ~ _ ^ % { } all have special meaning

31/98

A A command is an instruction to LTEX to do something special. Three types of command names:

to print one of these characters, precede it with a backslash: \$ \# \% the backslash character \ plus a sequence of letters, ending with the rst non-letter: \large \Large \bfseries Some commands have a so-called *-form to modify their functionality somehow. Example: \section*{Introduction}

department of mathematics and computer science

November 2008

Text, Symbols and Commands

32/98

Many commands operate on some piece of text, which then appears as an argument in curly braces following the command name. Examples: \section{Introduction} \textbf{bold text} \begin{document}

department of mathematics and computer science

November 2008

Text, Symbols and Commands

32/98

Many commands operate on some piece of text, which then appears as an argument in curly braces following the command name. Examples: \section{Introduction} \textbf{bold text} \begin{document} Optional arguments are put into square brackets and mandatory arguments into curly brackets: \documentclass[11pt]{article} \usepackage[dutch]{babel}

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Environments

33/98

An environment affects the text within it treating it differently according to the environment parameters. This text will not appear centered. \begin{center} This text will appear centered. This text will appear centered. This text will appear centered. \end{center} This text will not appear centered.

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Declarations

34/98

A declaration is a command that changes the values or meanings of certain parameters or commands without printing any text. The effect ends when another declaration of the same type is encountered. This text appears normal while \bfseries this text appears boldface.

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Declarations

34/98

A declaration is a command that changes the values or meanings of certain parameters or commands without printing any text. The effect ends when another declaration of the same type is encountered. This text appears normal while \bfseries this text appears boldface. When the declaration occurs within an environment or within a { } block, its scope extends only to until the end of this environment or block. This text appears normal while {\bfseries this text appears boldface}. This text is normal again. \begin{center} \bfseries This text appears bold. \end{center} This text is normal again.

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Loading Packages

35/98

A A package is a set of LTEX commands (or symbols, environments, declarations) stored in a le with the extension .sty. To invoke a package, simply call \usepackage{package_name}

in the preamble! A Example: LTEX does not have a command to include graphics, so if we want to include graphics in our document, we should load the package graphicx which denes a new command \includegraphics.

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Spaces

36/98

A LTEX takes care of spacing in your document. The following two texts appear exactly the same in the DVI le: \section{Introduction}

LaTeX is a document preparation system. It is widely used in the fields of mathematics and natural sciences, but also spreading to many other disciplines. \section{Introduction}LaTeX is a document preparation system. It is widely used in the fields of mathematics and natural sciences, but also spreading to many other disciplines.

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Spaces
Some rules: one blank is the same as a thousand, only the rst one counts. blanks at the beginning of an input line are ignored. blanks terminating a command name are removed. the end of a line is treated as a blank.

37/98

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Spaces
Some rules: one blank is the same as a thousand, only the rst one counts. blanks at the beginning of an input line are ignored. blanks terminating a command name are removed. the end of a line is treated as a blank. To force a space to appear where it would otherwise be ignored: \ . To force a new line: \newline or \\

37/98

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Spaces

38/98

Spacing of any desired size may be inserted into the text with the commands \hspace{10cm} \hspace*{-3mm} \hspace has no effect if it should come at the beginning of a line. The *-form will insert the spacing no matter where it occurs.

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Spaces

38/98

Spacing of any desired size may be inserted into the text with the commands \hspace{10cm} \hspace*{-3mm} \hspace has no effect if it should come at the beginning of a line. The *-form will insert the spacing no matter where it occurs. Vertical spacing is created using the \vspace command: \vspace{10cm} \vspace*{-3mm}

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Spaces

38/98

Spacing of any desired size may be inserted into the text with the commands \hspace{10cm} \hspace*{-3mm} \hspace has no effect if it should come at the beginning of a line. The *-form will insert the spacing no matter where it occurs. Vertical spacing is created using the \vspace command: \vspace{10cm} \vspace*{-3mm} Further commands for increasing the spacing between paragraphs are: \smallskip \medskip \bigskip

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Lengths and units

39/98

Lengths consist of a decimal number, followed by a dimensional unit. Some units: cm centimeter mm millimeter in pt ex inch (= 2.54cm) point (1in = 72.27 pt) font-specic size: the height of the letter x

em font-specic size: the width of the capital M

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Command Characters

40/98

As mentioned before, the characters # $ ~ _ ^ { } % are interpreted as commands. To print them as text, give a command consisting of \ plus that character: \# \$ \~ \_ \^ \{ \} \% #$_{}%

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Command Characters

40/98

As mentioned before, the characters # $ ~ _ ^ { } % are interpreted as commands. To print them as text, give a command consisting of \ plus that character: \# \$ \~ \_ \^ \{ \} \% #$_{}% To print a backslash, use the command \textbackslash: \

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters Accents
A Diacritical marks or accents can be created with LTEX: \e \e \^o \"o \~o \=o \v{s} \c{c} be\"invloeden het re\"ele deel Cura\c{c}ao

41/98

o benvloeden het rele deel Curaao

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters

42/98

Special symbols can be entered directly, but only if the right input encoding is specied. The input encoding depends on the type and language of the operating system. We have to load the package inputenc to specify the correct encoding: \usepackage[ansinew]{inputenc} benvloeden, reel, Curaao C benvloeden, reel, Curaao

department of mathematics and computer science

November 2008

Text, Symbols and Commands


Special Characters

42/98

Special symbols can be entered directly, but only if the right input encoding is specied. The input encoding depends on the type and language of the operating system. We have to load the package inputenc to specify the correct encoding: \usepackage[ansinew]{inputenc} benvloeden, reel, Curaao C benvloeden, reel, Curaao Please note that some of these characters also require the textcomp package.

department of mathematics and computer science

November 2008

Text, Symbols and Commands


The Euro Symbol:

43/98

Adobe created a font containing euro symbols which also contains bold, italic and serif versions. To use these symbols, load the package europs. Now we can use the following commands:

department of mathematics and computer science

November 2008

Text, Symbols and Commands


The Euro Symbol:

43/98

Adobe created a font containing euro symbols which also contains bold, italic and serif versions. To use these symbols, load the package europs. Now we can use the following commands: \EURofc creates the ofcial Euro symbol:

department of mathematics and computer science

November 2008

Text, Symbols and Commands


The Euro Symbol:

43/98

Adobe created a font containing euro symbols which also contains bold, italic and serif versions. To use these symbols, load the package europs. Now we can use the following commands: \EURofc creates the ofcial Euro symbol: \EUR creates a Euro symbol depending on the current text style

department of mathematics and computer science

November 2008

Text, Symbols and Commands


The Euro Symbol:

43/98

Adobe created a font containing euro symbols which also contains bold, italic and serif versions. To use these symbols, load the package europs. Now we can use the following commands: \EURofc creates the ofcial Euro symbol: \EUR creates a Euro symbol depending on the current text style Bold: Italic: Sans-serif:

department of mathematics and computer science

November 2008

Text, Symbols and Commands


The date

44/98

A LTEX contains a macro to print the current date: \today. The format of the date depends on the language set with the package babel.

\today November 17, 2008

department of mathematics and computer science

November 2008

Text, Symbols and Commands


The date

44/98

A LTEX contains a macro to print the current date: \today. The format of the date depends on the language set with the package babel.

\today November 17, 2008 \selectlanguage{dutch}\today 17 november 2008

department of mathematics and computer science

November 2008

Exercise

45/98

A 1. create a new LTEX article. Font size: 11pt. Load the package a4wide to adjust the margins. A 2. copy-paste the text from snowwhite.txt in the document body and run LTEX. Explain what the error message means and x the error.

3. right before the error, a Euro symbol occurs. Verify that the symbol is not A printed in the DVI le. Make sure that LTEX also prints the Euro symbol. 4. the last line (The End) should be large and centered. 5. create sections: Introduction, The evil stepmother, The great forest, The seven dwarfs, The murder of Snow White, The funeral, The prince, and The marriage. 6. create subsections: The cottage, The dwarfs, The encounter, First attempt, Second attempt, and Third attempt

department of mathematics and computer science

November 2008

Document Layout
Document Class

46/98

The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options:

department of mathematics and computer science

November 2008

Document Layout
Document Class

46/98

The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options: font sizes: 10pt 11pt 12pt

department of mathematics and computer science

November 2008

Document Layout
Document Class

46/98

The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options: font sizes: 10pt 11pt 12pt paper size: a4paper letterpaper

department of mathematics and computer science

November 2008

Document Layout
Document Class

46/98

The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options: font sizes: 10pt 11pt 12pt paper size: a4paper letterpaper number of columns: onecolumn twocolumn

department of mathematics and computer science

November 2008

Document Layout
Document Class

46/98

The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options: font sizes: 10pt 11pt 12pt paper size: a4paper letterpaper number of columns: onecolumn twocolumn print style: oneside twoside

department of mathematics and computer science

November 2008

Document Layout
Loading packages

47/98

A Packages are loaded in the preamble. A package is a set of LTEX commands (or symbols, environments, declarations) stored in a le with the extension .sty. Important packages:

a4wide

uses smaller page margins, which means that more text ts on one page. loads hyphenation rules for foreign languages. loads the Euro symbol: .

amsmath contains advanced mathematical symbols. babel europs

fancyhdr is used to customise headers and footers. graphicx denes a command to load external graphics. hyperref adds interactivity (hyperlinks, bookmarks) to your document. listings inserting source code with syntax highlighting

department of mathematics and computer science

November 2008

Document Layout
Paragraph Formatting
The following parameters affect the appearance of a paragraph: \parskip the distance between paragraphs, usually in units of ex

48/98

\parindent the amount of indentation for the rst line of a paragraph Use the \setlength command to change the values of these parameters. \setlength{\parskip}{1ex} \setlength{\parindent}{0mm}

department of mathematics and computer science

November 2008

Document Layout
Paragraph Formatting
The following parameters affect the appearance of a paragraph: \parskip the distance between paragraphs, usually in units of ex

48/98

\parindent the amount of indentation for the rst line of a paragraph Use the \setlength command to change the values of these parameters. \setlength{\parskip}{1ex} \setlength{\parindent}{0mm} To suppress the indentation for one paragraph, or to force it: \noindent \indent

department of mathematics and computer science

November 2008

Document Layout
Parts of the Document Title Page
\title{Title text} \author{Author names and addresses} \date{Date text} \maketitle

49/98

department of mathematics and computer science

November 2008

Document Layout
Parts of the Document Title Page
\title{Title text} \author{Author names and addresses} \date{Date text} \maketitle Use the \and command to dene multiple authors: \author{Marko Boon\\ marko@win.tue.nl \and Anton Stoorvogel\\ a.a.stoorvogel@tue.nl}

49/98

department of mathematics and computer science

November 2008

Document Layout
Parts of the Document Title Page
\title{Title text} \author{Author names and addresses} \date{Date text} \maketitle Use the \and command to dene multiple authors: \author{Marko Boon\\ marko@win.tue.nl \and Anton Stoorvogel\\ a.a.stoorvogel@tue.nl} Use \date{} to omit the date.

49/98

department of mathematics and computer science

November 2008

Document Layout
Parts of the Document Abstract
The abstract is produced with the abstract environment: \begin{abstract} Text for the abstract. \end{abstract}

50/98

In document class report the abstract appears on a separate page (without page number). In document class article the abstract appears below the title.

department of mathematics and computer science

November 2008

Document Layout
Parts of the Document Sections and chapters
The following commands produce automatic, sequential sectioning: \chapter{ } \chapter*{ } \section{ } \section*{ } \subsection{ } \subsection*{ } \subsubsection{ } \subsubsection*{ }

51/98

department of mathematics and computer science

November 2008

Document Layout
Parts of the Document Sections and chapters
The following commands produce automatic, sequential sectioning: \chapter{ } \chapter*{ } \section{ } \section*{ } \subsection{ } \subsection*{ } \subsubsection{ } \subsubsection*{ } Remarks:

51/98

The command \chapter exists in document classes book and report only. A * behind the command results in the unnumbered version which will not be included in the table of contents.

department of mathematics and computer science

November 2008

Document Layout
Parts of the Document Appendix
An appendix is introduced with the declaration \appendix Resets the section/chapter counter Changes the numbering form from numerals to capital letters (A, B, . . . ) Replaces the word Chapter by Appendix.

52/98

Please note that the actual word Appendix is not added to the table of contents!

department of mathematics and computer science

November 2008

Document Layout
Table of Contents

53/98

The table of contents is generated and printed with the command \tableofcontents (normally after title page and abstract). All entries are created automatically, based on the sectioning commands. You have to run latex twice to get all references right!

department of mathematics and computer science

November 2008

Document Layout
Table of Contents

53/98

The table of contents is generated and printed with the command \tableofcontents (normally after title page and abstract). All entries are created automatically, based on the sectioning commands. You have to run latex twice to get all references right!

TeXify and PDFTeXify


If you use the button for (PDF)TeXify instead of (PDF)LaTeX, WinEdt will run LaTeX, BibTeX, makeindex as many times as necessary. TeXify PDFTeXify

department of mathematics and computer science

November 2008

Document Layout
Labels and References

54/98

The command \label{marker} stores the current value of the relevant counter (section, chapter, equation, gure, table etc.) at that point in the text. To refer to a label, use: \ref to print the section, chapter, equation, gure or table number.

\pageref to print the page number on which the \label command was issued.

department of mathematics and computer science

November 2008

Document Layout
Labels and References

54/98

The command \label{marker} stores the current value of the relevant counter (section, chapter, equation, gure, table etc.) at that point in the text. To refer to a label, use: \ref to print the section, chapter, equation, gure or table number.

\pageref to print the page number on which the \label command was issued. \section{Labels and References\label{labels}} In section \ref{labels} you will find information on how to create labels and references in \LaTeX. The sections starts on page \pageref{labels}.

department of mathematics and computer science

November 2008

Displaying Text
Changing Font Style
The following commands and declarations change the current font style: Command \emph \textrm \texttt \textsf \textup \textit \textsl \textsc \textbf \textmd Declaration \em \rmfamily \ttfamily \sffamily \upshape \itshape \slshape \scshape \bfseries \mdseries Result emphasised Roman font family Typewriter font family Sans serif font family Normal, upright font shape Italic font shape Slanted font shape S MALL C APS FONT SHAPE Boldface font weight normal (medium) font weight

55/98

department of mathematics and computer science

November 2008

Displaying Text
Changing Font Style Example
This is normal text with one \textit{italic} word. {\sffamily This whole \itshape line is \textbf{sans} serif.} \textbf{\textit{Bold and italic}} Do you see the difference? \emph{emphasised}, \textit{italic}, \textsl{slanted}

56/98

department of mathematics and computer science

November 2008

Displaying Text
Changing Font Style Example
This is normal text with one \textit{italic} word. {\sffamily This whole \itshape line is \textbf{sans} serif.} \textbf{\textit{Bold and italic}} Do you see the difference? \emph{emphasised}, \textit{italic}, \textsl{slanted} This is normal text with one italic word. This whole line is sans serif. Bold and italic Do you see the dierence? emphasised, italic, slanted

56/98

department of mathematics and computer science

November 2008

Displaying Text
Changing Font Style Example
This is normal text with one \textit{italic} word. {\sffamily This whole \itshape line is \textbf{sans} serif.} \textbf{\textit{Bold and italic}} Do you see the difference? \emph{emphasised}, \textit{italic}, \textsl{slanted} This is normal text with one italic word. This whole line is sans serif. Bold and italic Do you see the dierence? emphasised, italic, slanted This is an italic sentence containing an emphasised word.

56/98

department of mathematics and computer science

November 2008

Displaying Text
Font Size
The font size can be changed using one of the following declarations: Declaration Result \tiny \scriptsize very small \footnotesize smaller \small small \normalsize normal \large large \Large larger \LARGE even larger \huge still larger \Huge largest
smallest

57/98

department of mathematics and computer science

November 2008

Displaying Text
Lists

58/98

There are three environments available for producing formatted lists: itemize, enumerate and description. \begin{itemize} \item This is the first item \item This is the second item \item This is an item with a nested list: \begin{itemize} \item This list has different labels. \item Another item. \end{itemize} \item the final item? \item[+] it is even possible to change the label \end{itemize}

department of mathematics and computer science

November 2008

Displaying Text
Lists Itemize
This is the rst item This is the second item This is an item with a nested list: This list has different labels. Another item. the nal item? + it is even possible to change the label

59/98

department of mathematics and computer science

November 2008

Displaying Text
Lists Enumerate
\begin{enumerate} \item This is the first item \item This is another item \label{lab} \item This is an item with a nested list: \begin{enumerate} \item This list has different labels. \item In this item we refer to item \ref{lab}. \end{enumerate} \item the final item \end{enumerate}

60/98

department of mathematics and computer science

November 2008

Displaying Text
Lists Enumerate
1. This is the rst item 2. This is another item 3. This is an item with a nested list: (a) This list has different labels. (b) In this item we refer to item 2. 4. the nal item

61/98

department of mathematics and computer science

November 2008

Exercise
1. add the a4paper option to the document class.

62/98

2. use the paragraph formatting commands to set the default paragraph indent to 0 and the default paragraph skip to 1ex. 3. use the appropriate author and title commands to create the title. 4. create an abstract environment 5. add a table of contents after the abstract. 6. change the font size of the last line (The End) to Huge. 7. add a numbered list in section 4.2 (The Dwarfs)

department of mathematics and computer science

November 2008

Mathematics
Mathematical environments:

63/98

department of mathematics and computer science

November 2008

Mathematics
Mathematical environments: $ ... $ mathematics in a line of text (inline).

63/98

department of mathematics and computer science

November 2008

Mathematics
Mathematical environments: $ ... $ mathematics in a line of text (inline). \[ ... \] mathematics in a separate paragraph.

63/98

department of mathematics and computer science

November 2008

Mathematics
Mathematical environments: $ ... $ mathematics in a line of text (inline). \[ ... \] mathematics in a separate paragraph. \begin{equation} ... \end{equation} mathematics in a separate paragraph, including equation number.

63/98

department of mathematics and computer science

November 2008

Mathematics
Mathematical environments: $ ... $ mathematics in a line of text (inline). \[ ... \] mathematics in a separate paragraph. \begin{equation} ... \end{equation} mathematics in a separate paragraph, including equation number. \begin{eqnarray} ... \end{eqnarray} multiline mathematical equations, properly aligned.

63/98

department of mathematics and computer science

November 2008

Mathematics
Example
Everybody knows that $\sin \pi$ is equal to $0$. \begin{eqnarray*} \lim_{x \rightarrow 0} \frac{\sin x}{x} &=& 1\\ \sum_{k=0}^\infty x^k &=& \frac{1}{1-x} \quad (|x|<1) \end{eqnarray*}

64/98

department of mathematics and computer science

November 2008

Mathematics
Example
Everybody knows that $\sin \pi$ is equal to $0$. \begin{eqnarray*} \lim_{x \rightarrow 0} \frac{\sin x}{x} &=& 1\\ \sum_{k=0}^\infty x^k &=& \frac{1}{1-x} \quad (|x|<1) \end{eqnarray*} Everybody knows that sin is equal to 0. sin x = 1 x0 x lim

64/98

xk =
k=0

1 1x

(|x| < 1)

department of mathematics and computer science

November 2008

Tables

65/98

The environments array and tabular create tables and matrices. The usage of array is the same as for tabular, but it can only be used in math mode. \begin{array}[pos]{cols} rows \end{array} \begin{tabular}[pos]{cols} rows \end{tabular} The pos argument denes the vertical positioning for the table: t or b (top or bottom)

department of mathematics and computer science

November 2008

Tables
l r c the column contents are left justied the column contents are right justied the column contents are centered

66/98

The cols argument denes the column formatting. The possible formatting symbols are:

p{width } the text in this column is set in a paragraph box of the specied width. | || draws a vertical line draws a double vertical line

department of mathematics and computer science

November 2008

Tables

67/98

The rows contain the actual entries. Each row is terminated with the \\ command. The column entries are separated by a & symbol.

department of mathematics and computer science

November 2008

Tables

67/98

The rows contain the actual entries. Each row is terminated with the \\ command. The column entries are separated by a & symbol. The command \hline draws a horizontal line over the full width. The command \cline{m-n} draws a horizontal line from the left of column m to the right of column n.

department of mathematics and computer science

November 2008

Tables

67/98

The rows contain the actual entries. Each row is terminated with the \\ command. The column entries are separated by a & symbol. The command \hline draws a horizontal line over the full width. The command \cline{m-n} draws a horizontal line from the left of column m to the right of column n. The command \multicolumn{n}{col}{text} creates a table cell that extends n columns. The column formatting for this cell is dened by col.

department of mathematics and computer science

November 2008

Tables
Example 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Stand Eredivisie 26 maart 2008 P W D L Pts PSV 30 19 7 4 64 Ajax 30 16 9 5 57 sc Heerenveen 30 16 6 8 54 Feyenoord 30 16 6 8 54 NAC Breda 30 16 6 8 54 FC Twente 30 14 10 6 52 FC Groningen 30 15 5 10 50 Roda JC 30 11 10 9 43 FC Utrecht 30 12 6 12 42 Vitesse 30 11 7 12 40 NEC 30 11 6 13 39 AZ 30 8 9 13 33 Heracles Almelo 30 8 7 15 31 Sparta Rotterdam 30 8 6 16 30 De Graafschap 30 7 7 16 28 Willem II 30 7 6 17 27 VVV-Venlo 30 6 8 16 26 Excelsior 30 6 5 19 23 +/61 - 23 79 - 40 76 - 38 56 - 34 41 - 35 47 - 31 50 - 48 51 - 49 56 - 50 42 - 51 43 - 49 41 - 49 33 - 56 46 - 68 30 - 55 33 - 41 37 - 67 29 - 67

68/98

department of mathematics and computer science

November 2008

Tables
Example 1
\begin{tabular}{|l|l|cccc|r|c|} \hline \multicolumn{8}{|c|}{Eredivisie 26 maart 2008} \\ \hline & & P & W & D & L & Pts & +/- \\ \hline 1 & PSV & 30 & 19 & 7 & 4 & 64 & 61 - 23 \\ 2 & Ajax & 30 & 16 & 9 & 5 & 57 & 79 - 40 \\ ... 18 & Excelsior & 30 & 6 & 5 & 19 & 23 & 29 - 67 \\ \hline \end{tabular}

69/98

department of mathematics and computer science

November 2008

Tables
Example 2
Model Description
RAM, 80 GB Hard disk, 16x DVD drive, 32x CDRW drive, 64 MB TV output, Windows XP, 15" monitor Desktop DeLuxe: Same as FBD 360 but with XP4800+ Processor, 48x CDRW drive, 17" monitor

70/98

Price 999.00

FBD 360 Desktop: XP3600+ Processor, 512 MB DDR-

FBD 480

1399.00

department of mathematics and computer science

November 2008

Tables
Example 2
\begin{tabular}{lp{0.5\textwidth}r} \bfseries Model & \bfseries Description & \bfseries Price \\[1ex] FBD 360 & \small \textbf{Desktop}: XP3600+ Processor, 512~MB DDR-RAM, 80~GB Hard disk, 16x DVD drive, 32x CDRW drive, 64~MB TV output, Windows~XP, 15" monitor & \EUR{} 999.00 \\ FBD 480 & \small \textbf{Desktop DeLuxe}: Same as FBD 360 but with XP4800+ Processor, 48x CDRW drive, 17" monitor & \EUR{} 1399.00 \\ \end{tabular}

71/98

department of mathematics and computer science

November 2008

Tables
WinEdt has a useful plug-in to insert tables:

72/98

department of mathematics and computer science

November 2008

Tables
WinEdt has a useful plug-in to insert tables:

73/98

department of mathematics and computer science

November 2008

Tables
WinEdt has a useful plug-in to insert tables:

74/98

department of mathematics and computer science

November 2008

Tables
WinEdt has a useful plug-in to insert tables:

75/98

department of mathematics and computer science

November 2008

Tables
WinEdt has a useful plug-in to insert tables:

76/98

department of mathematics and computer science

November 2008

Tables
A Excel to LTEX Add-In

77/98

1. download the Excel macro: Excel2LaTeX.xla 2. Start Excel and install the Add-in: Click on the Ofce button (in the upper left corner) Excel Options Add-Ins Go... Browse... Browse for the Add-In and click Ok

3. Restart Excel 4. A button has been added to the Add-Ins tab: 5. Create a table in Excel, select the table and press this button. 6. Copy-paste to WinEdt

department of mathematics and computer science

November 2008

Graphics
Graphics Inclusion
To include an external graphics le:

78/98

department of mathematics and computer science

November 2008

Graphics
Graphics Inclusion
To include an external graphics le: Load the package graphicx in the preamble: \usepackage{graphicx}

78/98

department of mathematics and computer science

November 2008

Graphics
Graphics Inclusion
To include an external graphics le: Load the package graphicx in the preamble: \usepackage{graphicx}

78/98

Include the graphics using this command: \includegraphics[width=0.7\linewidth]{filename}

department of mathematics and computer science

November 2008

Graphics
Supported File Formats:

79/98

EPS PDF JPG GIF PNG A LTEX yes no yes no yes A PDFLTEX no yes yes no yes

Please notice: only EPS and PDF are scalable. Use JPG and PNG just for photographs! Many programs can generate EPS images. Use Corel Designer to export images created in other programs. Copy/Paste the objects in Corel Designer and export to EPS. Use EPS2PDF (on your desktop) to convert EPS to PDF.
A does not work automatically when working with LTEX. You should enter the coordinates of the bounding box manually.

department of mathematics and computer science

November 2008

Graphics
\includegraphics[options]{filename}

80/98

department of mathematics and computer science

November 2008

Graphics
\includegraphics[options]{filename} When including EPS or PDF les, use the le name without extension! A A LTEX will take the EPS, PDFLTEX will take the PDF.

80/98

department of mathematics and computer science

November 2008

Graphics
\includegraphics[options]{filename} When including EPS or PDF les, use the le name without extension! A A LTEX will take the EPS, PDFLTEX will take the PDF. Supported options are: scale=number width=length height=length angle=number magnies the gure by number over its natural size. species the width to which the gure should be scaled species the height to which the gure should be scaled

80/98

rotates the gure counterclockwise over the specied angle (in degrees)

bb=llx lly urx ury enters the coordinates of the bounding box manually.

department of mathematics and computer science

November 2008

Graphics

81/98

A You can create a gure environment to create oating gures. LTEX will put the image at the location that you specify, or on the top of the next page if the gure does not t at the current page. In a gure environment you can add a caption and a label to refer to the gure. \begin{figure}[ht] \begin{center} \includegraphics{normal} \end{center} \caption{Two dimensional normal distribution} \label{fig:normal} \end{figure}

department of mathematics and computer science

November 2008

Graphics

81/98

A You can create a gure environment to create oating gures. LTEX will put the image at the location that you specify, or on the top of the next page if the gure does not t at the current page. In a gure environment you can add a caption and a label to refer to the gure. \begin{figure}[ht] \begin{center} \includegraphics{normal} \end{center} \caption{Two dimensional normal distribution} \label{fig:normal} \end{figure}

Now we can refer to the image: See figure \ref{fig:normal}.

department of mathematics and computer science

November 2008

Graphics
WinEdt had a useful plug-in to insert pictures:

82/98

department of mathematics and computer science

November 2008

Graphics
WinEdt had a useful plug-in to insert pictures:

83/98

department of mathematics and computer science

November 2008

Graphics
WinEdt had a useful plug-in to insert pictures:

84/98

department of mathematics and computer science

November 2008

Graphics
WinEdt had a useful plug-in to insert pictures:

85/98

department of mathematics and computer science

November 2008

Graphics
WinEdt had a useful plug-in to insert pictures:

86/98

Position: Here, Top (of next page)

Remove absolute file path remove file extension

department of mathematics and computer science

November 2008

Graphics
Scalable and non-scalable graphics
1

87/98

P 7 6 6 O 1

department of mathematics and computer science

November 2008

Graphics
Scalable and non-scalable graphics

88/98

6 1
Scalable graphics formats: EPS, PDF, WMF, EMF, SVG. Non-scalable graphics formats: JPG, GIF, BMP, PNG. But also: all scalable formats!

department of mathematics and computer science

November 2008

Graphics
Scalable Graphics Software
Corel Designer, CorelDraw, Adobe Illustrator, Microsoft Visio, Microsoft Ofce Drawing, OpenOfce.org Draw, all computer algebra software (Mathematica, Matlab, Maple)

89/98

Non-scalable Graphics Software


Adobe PhotoShop, Paint Shop Pro, MS Paint, all digital photo editing software!

department of mathematics and computer science

November 2008

Graphics
Including JPG/PNG Images
A A LTEX (unlike PDFLTEX) cannot determine the bounding box automatically.

90/98

JPEG Image, 2304 1728 pixels, 72dpi, taken with 4.0 megapixel digital camera

department of mathematics and computer science

November 2008

Graphics
Including JPG/PNG Images
A A LTEX (unlike PDFLTEX) cannot determine the bounding box automatically.

90/98

JPEG Image, 2304 1728 pixels, 72dpi, taken with 4.0 megapixel digital camera \includegraphics[width=8cm,bb=0 0 2304 1728] {holiday.jpg}

department of mathematics and computer science

November 2008

Graphics
Corel Designer

91/98

department of mathematics and computer science

November 2008

Graphics
Corel Designer

92/98

department of mathematics and computer science

November 2008

Graphics
Corel Designer

93/98

department of mathematics and computer science

November 2008

Including programming statements


The package listings formats listings. It denes the following commands: \lstlisting{...} for inline programming statements.

94/98

\begin{lstlisting} ... \end{lstlisting} for multi-line listings. \lstinputlisting{filename} imports a complete source le

department of mathematics and computer science

November 2008

Including programming statements


Customizing listings

95/98

Using the command \lstset you can customize the language and appearance of the listing: \lstset{ language=Java, basicstyle=\color{black}\ttfamily, commentstyle=\color{green}\itshape\ttfamily, keywordstyle=\color{blue}\bfseries\ttfamily, showstringspaces=false, frame=single, % boxed listings backgroundcolor=\color{white} } Supported languages: too many to mention. Included are Basic, C, C++, Delphi, Fortran, HTML, Java, Mathematica, Matlab, Pascal, Perl, PHP, SAS, SQL, TeX, VBScript, XML.

department of mathematics and computer science

November 2008

Including programming statements


Customizing listings
Alternatively, you can specify options like this: \definecolor{myyellow}{rgb}{1.00,1.00,0.50} \begin{lstlisting}[language=Pascal, backgroundcolor=\color{myyellow}] readln(N); for i := 1 to N do begin writeln(random) end \end{lstlisting}

96/98

department of mathematics and computer science

November 2008

Including programming statements


Customizing listings
Alternatively, you can specify options like this: \definecolor{myyellow}{rgb}{1.00,1.00,0.50} \begin{lstlisting}[language=Pascal, backgroundcolor=\color{myyellow}] readln(N); for i := 1 to N do begin writeln(random) end \end{lstlisting} readln(N); for i := 1 to N do begin writeln(random) end

96/98

department of mathematics and computer science

November 2008

Exercise
1. insert the picture snowwhite.jpg between the title and the abstract.

97/98

department of mathematics and computer science

November 2008

A I want to know more about LTEX!!!

98/98

The LaTeX manual, written by Piet van Oostrum. This is available at the sales point of TU/e syllabi. PDF version already on your laptop! A Guide to LaTeX, by Helmut Kopka. ISBN 0-321-17385-6. The LaTeX Companion Second Edition, by Mittelbach and Goossens. ISBN 0-201-36299-6.

TU/e LaTeX FAQ: http://www.win.tue.nl/latex information about a package: Start Menu, MiKTeX group, Documentation, LaTeX Packages Help.

department of mathematics and computer science

November 2008

You might also like