Top Banner
Introduction to L A T E X Part 1 http://www.win.tue.nl/marko/latex September 2008 Marko Boon ([email protected])
122

Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

Apr 19, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

Introduction to LATEX Part 1

http://www.win.tue.nl/∼marko/latex

September 2008 Marko Boon ([email protected])

Page 2: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

2/82

/ department of mathematics and computer science September 2008

Introduction 3

Text, Symbols and Commands 47

Document Layout 66

Contents

Page 3: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

3/82

/ department of mathematics and computer science September 2008

LATEX is a document preparation system. It is widely used in the fields of math-ematics and natural sciences, but also spreading to many other disciplines.

• LATEX is a set of markup commands used with the powerful typesetting pro-gram TEX.

• totally open software system, free of charge.

• maintained by the LATEX3 Project group. Hundreds of user contributions.

Introduction

Page 4: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

3/82

/ department of mathematics and computer science September 2008

LATEX is a document preparation system. It is widely used in the fields of math-ematics and natural sciences, but also spreading to many other disciplines.

• LATEX is a set of markup commands used with the powerful typesetting pro-gram TEX.

• totally open software system, free of charge.

• maintained by the LATEX3 Project group. Hundreds of user contributions.

• platform independent.

Introduction

Page 5: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

3/82

/ department of mathematics and computer science September 2008

LATEX is a document preparation system. It is widely used in the fields of math-ematics and natural sciences, but also spreading to many other disciplines.

• LATEX is a set of markup commands used with the powerful typesetting pro-gram TEX.

• totally open software system, free of charge.

• maintained by the LATEX3 Project group. Hundreds of user contributions.

• platform independent.

LATEX is no word processor! LATEX stimulates placing emphasis on content (logi-cal markup) instead of appearance (typographical markup).

Introduction

Page 6: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

4/82

/ department of mathematics and computer science September 2008

Introduction

Page 7: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

5/82

/ department of mathematics and computer science September 2008

LATEX editor: WinEdt

Introduction

Page 8: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

6/82

/ department of mathematics and computer science September 2008

DVI previewer: Yap

Introduction

Page 9: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

7/82

/ department of mathematics and computer science September 2008

PostScript viewer: GSView

Introduction

Page 10: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

8/82

/ department of mathematics and computer science September 2008

PDF viewer: Adobe (Acrobat) Reader

Introduction

Page 11: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

9/82

/ department of mathematics and computer science September 2008

Introduction

Page 12: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

10/82

/ department of mathematics and computer science September 2008

The LATEX language• LATEX commands always start with a backslash: \

Introduction

Page 13: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

10/82

/ department of mathematics and computer science September 2008

The LATEX language• LATEX commands always start with a backslash: \

• required command arguments are placed between curly brackets: { }

Introduction

Page 14: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

10/82

/ department of mathematics and computer science September 2008

The LATEX language• LATEX commands always start with a backslash: \

• required command arguments are placed between curly brackets: { }

• optional command arguments are placed between brackets: [ ]

Introduction

Page 15: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

10/82

/ department of mathematics and computer science September 2008

The LATEX language• LATEX 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: %

Introduction

Page 16: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

10/82

/ department of mathematics and computer science September 2008

The LATEX language• LATEX 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: %

• LATEX takes care of the spacing between words and paragraphs (just likeHTML).

Introduction

Page 17: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

10/82

/ department of mathematics and computer science September 2008

The LATEX language• LATEX 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: %

• LATEX takes care of the spacing between words and paragraphs (just likeHTML).

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

Introduction

Page 18: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

11/82

/ department of mathematics and computer science September 2008

A .tex file

\documentclass[options]{document_class}

% preamble

\begin{document}

% document

\end{document}

Introduction

Page 19: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

12/82

/ department of mathematics and computer science September 2008

A .tex file: intro.tex

\documentclass[12pt]{article}\usepackage[english]{babel}

\begin{document}\section{Introduction}

LaTeX is a document preparation system used tocreate documents of high quality typography.

It is mostly used in the fields of mathematicsand natural sciences, but can in fact be usedfor any type of publication.\end{document}

Introduction

Page 20: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

13/82

/ department of mathematics and computer science September 2008

Invoking LaTeX

Page 21: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

14/82

/ department of mathematics and computer science September 2008

Invoking LaTeX

Page 22: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

15/82

/ department of mathematics and computer science September 2008

Invoking LaTeX

Page 23: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

16/82

/ department of mathematics and computer science September 2008

Invoking Yap

Page 24: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

17/82

/ department of mathematics and computer science September 2008

Invoking Yap

Page 25: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

18/82

/ department of mathematics and computer science September 2008

Alternative to LaTeX: PDFLaTeX

Page 26: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

19/82

/ department of mathematics and computer science September 2008

Alternative to LaTeX: PDFLaTeX

Page 27: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

20/82

/ department of mathematics and computer science September 2008

Alternative to LaTeX: PDFLaTeX

Page 28: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

21/82

/ department of mathematics and computer science September 2008

Alternative to LaTeX: PDFLaTeX

Page 29: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

22/82

/ department of mathematics and computer science September 2008

\documentclass[12pt]{article}\usepackage[english]{babel}

\section{Introduction}

LaTeX is a document preparation system.It is widely used in the fields of mathematicsand natural sciences, but also spreading tomany other disciplines.\end{document}

Error Handling

Page 30: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

23/82

/ department of mathematics and computer science September 2008

Error Handling

Page 31: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

24/82

/ department of mathematics and computer science September 2008

Error Handling

Page 32: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

25/82

/ department of mathematics and computer science September 2008

Error Handling

Page 33: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

26/82

/ department of mathematics and computer science September 2008

Error Handling

Page 34: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

27/82

/ department of mathematics and computer science September 2008

\documentclass[12pt]{article}\usepackage[english]{babel}

\begin{document}\section{Introduction}

LaTeX is a document preparation system.It is widely used in the fields of mathematicsand natural sciences, but also spreading tomany other disciplines.

ThisisanextremelylonglinewhichwillhopefullyresultinsomekindofwarningbecauseLaTeXdoesnotknowhowtohyphenatethisword.\end{document}

Error Handling – Warnings

Page 35: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

28/82

/ department of mathematics and computer science September 2008

Error Handling – Warnings

Page 36: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

29/82

/ department of mathematics and computer science September 2008

MiKTEX is an up-to-date TEX implementation for the Windows operating system.

• can be downloaded from http://www.miktex.org

• contains all LATEX related binaries, likelatex.exe, pdflatex.exe, yap.exe, bibtex.exe,dvips.exe, ps2pdf.exe

• contains all standard packages (will be discussed later)

MiKTEX

Page 37: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

30/82

/ department of mathematics and computer science September 2008

• WinEdt – editor

• Yap – DVI previewer

• GSView – PS previewer

Other useful programs:

• Adobe Acrobat or Adobe Reader – view/edit PDF files

• Corel Designer – Create and export EPS Images

• Open Office.org Draw – Create and export EPS Images

LATEX Related Programs

Page 38: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

31/82

/ department of mathematics and computer science September 2008

WinEdt

Page 39: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

32/82

/ department of mathematics and computer science September 2008

New LaTeX document

WinEdt

Page 40: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

33/82

/ department of mathematics and computer science September 2008

WinEdt

Page 41: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

34/82

/ department of mathematics and computer science September 2008

WinEdt

Page 42: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

35/82

/ department of mathematics and computer science September 2008

WinEdt

Page 43: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

36/82

/ department of mathematics and computer science September 2008

runs LATEX on the current document. If no errors are found, the resulting DVIfile will be opened in Yap.

runs Yap on the generated DVI file.

converts DVI to PostScript.

opens the PostScript file in GSView.

runs PDFLATEX on the current document.

opens the PDF document in Adobe Reader.

opens the document in Yap and jumpt to the current location in the docu-ment.

starts BibTEX(for bibliographies).

generates a master index.

removes all generated auxiliary files (DVI, LOG, PDF, BIB, . . .). Only thePostScript file will not be deleted.

Page 44: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

37/82

/ department of mathematics and computer science September 2008

WinEdt

Page 45: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

38/82

/ department of mathematics and computer science September 2008

WinEdt

Page 46: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

39/82

/ department of mathematics and computer science September 2008

WinEdt

Page 47: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

40/82

/ department of mathematics and computer science September 2008

Yap

Page 48: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

41/82

/ department of mathematics and computer science September 2008

double-click on text for inverse search

Yap

Page 49: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

42/82

/ department of mathematics and computer science September 2008

!

dvips

Page 50: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

43/82

/ department of mathematics and computer science September 2008

GSView

Page 51: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

44/82

/ department of mathematics and computer science September 2008

Mathematicalsymbols

WinEdt

Page 52: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

45/82

/ department of mathematics and computer science September 2008

WinEdt

Page 53: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

46/82

/ department of mathematics and computer science September 2008

Line / block selection modeSpelling check on/off

Wrapping on/offLine numbering on/off

Jump to line

WinEdt

Page 54: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

47/82

/ department of mathematics and computer science September 2008

A command is an instruction to LATEX to do something special. Three types ofcommand names:

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

• to print one of these characters, precede it with a backslash: \$ \# \%

• the backslash character \ plus a sequence of letters, ending with the firstnon-letter: \large \Large \bfseries

Text, Symbols and Commands

Page 55: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

47/82

/ department of mathematics and computer science September 2008

A command is an instruction to LATEX to do something special. Three types ofcommand names:

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

• to print one of these characters, precede it with a backslash: \$ \# \%

• the backslash character \ plus a sequence of letters, ending with the firstnon-letter: \large \Large \bfseries

Some commands have a so-called *-form to modify their functionality some-how. Example:

\section*{Introduction}

Text, Symbols and Commands

Page 56: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

48/82

/ department of mathematics and computer science September 2008

Many commands operate on some piece of text, which then appears as anargument in curly braces following the command name. Examples:

\section{Introduction}

\textbf{bold text}

\begin{document}

Text, Symbols and Commands

Page 57: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

48/82

/ department of mathematics and computer science September 2008

Many commands operate on some piece of text, which then appears as anargument in curly braces following the command name. Examples:

\section{Introduction}

\textbf{bold text}

\begin{document}

Optional arguments are put into square brackets and mandatory argumentsinto curly brackets:

\documentclass[11pt]{article}

\usepackage[dutch]{babel}

Text, Symbols and Commands

Page 58: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

49/82

/ department of mathematics and computer science September 2008

EnvironmentsAn environment affects the text within it treating it differently according to theenvironment 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.

Text, Symbols and Commands

Page 59: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

50/82

/ department of mathematics and computer science September 2008

DeclarationsA declaration is a command that changes the values or meanings of certainparameters or commands without printing any text. The effect ends when an-other declaration of the same type is encountered.

This text appears normal while \bfseries this textappears boldface.

Text, Symbols and Commands

Page 60: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

50/82

/ department of mathematics and computer science September 2008

DeclarationsA declaration is a command that changes the values or meanings of certainparameters or commands without printing any text. The effect ends when an-other declaration of the same type is encountered.

This text appears normal while \bfseries this textappears boldface.

When the declaration occurs within an environment or within a { } block, itsscope extends only to until the end of this environment or block.

This text appears normal while {\bfseries this textappears boldface}. This text is normal again.\begin{center}\bfseriesThis text appears bold.\end{center}This text is normal again.

Text, Symbols and Commands

Page 61: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

51/82

/ department of mathematics and computer science September 2008

Loading PackagesA package is a set of LATEX commands (or symbols, environments, declarations)stored in a file with the extension .sty. To invoke a package, simply call

\usepackage{package_name}

in the preamble!Example: LATEX does not have a command to include graphics, so if we wantto include graphics in our document, we should load the package graphicxwhich defines a new command \includegraphics.

Text, Symbols and Commands

Page 62: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

52/82

/ department of mathematics and computer science September 2008

Special Characters – SpacesLATEX takes care of spacing in your document. The following two texts appearexactly the same in the DVI file:

\section{Introduction}

LaTeX is a document preparation system.It is widely used in the fields of mathematicsand natural sciences, but also spreading tomany other disciplines.

\section{Introduction}LaTeX is adocument preparation system. It iswidely used in the fieldsof

mathematics and naturalsciences,but also spreading to many other disciplines.

Text, Symbols and Commands

Page 63: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

53/82

/ department of mathematics and computer science September 2008

Special Characters – SpacesSome rules:

• one blank is the same as a thousand, only the first 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.

Text, Symbols and Commands

Page 64: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

53/82

/ department of mathematics and computer science September 2008

Special Characters – SpacesSome rules:

• one blank is the same as a thousand, only the first 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 create a smaller space: \,A protected space: ~ ensures that certain words remain together.To force a new line: \newline or \\

Text, Symbols and Commands

Page 65: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

53/82

/ department of mathematics and computer science September 2008

Special Characters – SpacesSome rules:

• one blank is the same as a thousand, only the first 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 create a smaller space: \,A protected space: ~ ensures that certain words remain together.To force a new line: \newline or \\

But you should never use \\, but start a new paragraph instead.

Text, Symbols and Commands

Page 66: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

54/82

/ department of mathematics and computer science September 2008

Special Characters – SpacesSpacing 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 *-formwill insert the spacing no matter where it occurs.

Text, Symbols and Commands

Page 67: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

54/82

/ department of mathematics and computer science September 2008

Special Characters – SpacesSpacing 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 *-formwill insert the spacing no matter where it occurs.

\hfill

The command \hfill is an abbreviation for \hspace{\fill} which in-serts enough space at that point to force the text on either side to be pushedto the left and right margins:

Left \hfill Right

Left Right

Text, Symbols and Commands

Page 68: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

55/82

/ department of mathematics and computer science September 2008

Special Characters – SpacesVertical spacing is created using the \vspace or \vfill command:

\vspace{10cm}\vspace*{-3mm}\vfill

Further commands for increasing the spacing between paragraphs are:

\smallskip\medskip\bigskip

Text, Symbols and Commands

Page 69: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

56/82

/ department of mathematics and computer science September 2008

Lengths and unitsLengths consist of a decimal number, followed by a dimensional unit. Someunits:

cm centimeter

mm millimeter

in inch (= 2.54cm)

pt point (1in = 72.27 pt)

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

ex font-specific size: the height of the letter x

Text, Symbols and Commands

Page 70: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

56/82

/ department of mathematics and computer science September 2008

Lengths and unitsLengths consist of a decimal number, followed by a dimensional unit. Someunits:

cm centimeter

mm millimeter

in inch (= 2.54cm)

pt point (1in = 72.27 pt)

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

ex font-specific size: the height of the letter x

Using \setlength{length_variable}{length_value} you canmodify length variables in LATEX.

\setlength{\textwidth}{10cm}

Text, Symbols and Commands

Page 71: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

57/82

/ department of mathematics and computer science September 2008

Special Characters – Quotation MarksSingle quotes are produced with: ‘ ’Double quotes are produced with: ‘‘ ’’Avoid using the double quote character "

Text, Symbols and Commands

Page 72: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

57/82

/ department of mathematics and computer science September 2008

Special Characters – Quotation MarksSingle quotes are produced with: ‘ ’Double quotes are produced with: ‘‘ ’’Avoid using the double quote character "

He said: ‘Hello world’.He said: ‘‘Hello world’’.He said: "Hello world".

He said: ‘Hello world’.He said: “Hello world”.He said: "Hello world".

Text, Symbols and Commands

Page 73: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

58/82

/ department of mathematics and computer science September 2008

Special Characters – Hyphens and DashesTo create – characters of different length, just repeat the - character:

- is called hyphen-- is called en dash--- is called em dash

- is called hyphen– is called en dash— is called em dash

Text, Symbols and Commands

Page 74: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

58/82

/ department of mathematics and computer science September 2008

Special Characters – Hyphens and DashesTo create – characters of different length, just repeat the - character:

- is called hyphen-- is called en dash--- is called em dash

- is called hyphen– is called en dash— is called em dash

The minus sign is obtained by entering math mode (which will be discussedlater):

$3 - 4 = -1$

3− 4 = −1

Text, Symbols and Commands

Page 75: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

59/82

/ department of mathematics and computer science September 2008

Special Characters – Command CharactersAs mentioned before, the characters # $ ~ _ ^ { } % are interpreted ascommands.To print them as text, give a command consisting of \ plus that character:

\# \$ \~ \_ \^ \{ \} \%

# $ ˜ _ ˆ { } %

Text, Symbols and Commands

Page 76: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

59/82

/ department of mathematics and computer science September 2008

Special Characters – Command CharactersAs mentioned before, the characters # $ ~ _ ^ { } % are interpreted ascommands.To print them as text, give a command consisting of \ plus that character:

\# \$ \~ \_ \^ \{ \} \%

# $ ˜ _ ˆ { } %

To print a backslash, use the command \textbackslash: \

Text, Symbols and Commands

Page 77: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

60/82

/ department of mathematics and computer science September 2008

Special Characters – AccentsDiacritical marks or accents can be created with LATEX:

\‘e \’e \^o \"o \~o \=o \v{s} \c{c}be\"invloedenhet re\"ele deelCura\c{c}ao

è é ô ö õ o š çbeïnvloedenhet reële deelCuraçao

Text, Symbols and Commands

Page 78: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

61/82

/ department of mathematics and computer science September 2008

Special CharactersThe package textcomp defines a lot of special characters. First we have to loadthis package in the preamble:

\usepackage{textcomp}

Now we can use all the special characters:

\texteuro \copyright \textcelsius

€ © ℃

Text, Symbols and Commands

Page 79: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

62/82

/ department of mathematics and computer science September 2008

Special CharactersSpecial symbols can be entered directly, but only if the right input encodingis specified. The input encoding depends on the type and language of theoperating system. We have to load the package inputenc to specify the correctencoding:

\usepackage[ansinew]{inputenc}

beïnvloeden, reëel, CuraçaoC ƒ © ¥ §

beïnvloeden, reëel, Curaçao€ ƒ © ¥ §

Text, Symbols and Commands

Page 80: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

62/82

/ department of mathematics and computer science September 2008

Special CharactersSpecial symbols can be entered directly, but only if the right input encodingis specified. The input encoding depends on the type and language of theoperating system. We have to load the package inputenc to specify the correctencoding:

\usepackage[ansinew]{inputenc}

beïnvloeden, reëel, CuraçaoC ƒ © ¥ §

beïnvloeden, reëel, Curaçao€ ƒ © ¥ §

Please note that some of these characters also require the textcomp package.

Text, Symbols and Commands

Page 81: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

63/82

/ department of mathematics and computer science September 2008

The Euro Symbol: €

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

Text, Symbols and Commands

Page 82: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

63/82

/ department of mathematics and computer science September 2008

The Euro Symbol: €

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

\EURofc – creates the official Euro symbol: €

Text, Symbols and Commands

Page 83: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

63/82

/ department of mathematics and computer science September 2008

The Euro Symbol: €

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

\EURofc – creates the official Euro symbol: €

\EUR – creates a Euro symbol depending on the current text style

Text, Symbols and Commands

Page 84: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

63/82

/ department of mathematics and computer science September 2008

The Euro Symbol: €

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

\EURofc – creates the official Euro symbol: €

\EUR – creates a Euro symbol depending on the current text style

Bold: €

Italic: €

Sans-serif: €

Text, Symbols and Commands

Page 85: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

64/82

/ department of mathematics and computer science September 2008

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

\todayOctober 7, 2008

Text, Symbols and Commands

Page 86: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

64/82

/ department of mathematics and computer science September 2008

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

\todayOctober 7, 2008

\selectlanguage{dutch}\today7 oktober 2008

Text, Symbols and Commands

Page 87: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

65/82

/ department of mathematics and computer science September 2008

HyphenationLATEX determines how to hyphenate words based on the language set in thepackage babel:

\usepackage[dutch]{babel}

However, it is possible to tell LATEX how to hyphenate a word:

\hyphenation{man-u-script com-pu-ter re-sus-ci-tate}

Text, Symbols and Commands

Page 88: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

65/82

/ department of mathematics and computer science September 2008

HyphenationLATEX determines how to hyphenate words based on the language set in thepackage babel:

\usepackage[dutch]{babel}

However, it is possible to tell LATEX how to hyphenate a word:

\hyphenation{man-u-script com-pu-ter re-sus-ci-tate}

It is possible in LATEX to turn hyphenation off. If you want to turn it off for thecomplete document, put the command \sloppy in the preamble.If you want to turn hyphenation off temporarily, use the environment

\begin{sloppypar}

\end{sloppypar}

Text, Symbols and Commands

Page 89: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

66/82

/ department of mathematics and computer science September 2008

Document ClassThe first command in a .tex file determines the global processing format forthe entire document:

\documentclass[options]{class}

Supported classes are book, report, article, letter or slides.

Supported options:

Document Layout

Page 90: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

66/82

/ department of mathematics and computer science September 2008

Document ClassThe first command in a .tex file determines the global processing format forthe entire document:

\documentclass[options]{class}

Supported classes are book, report, article, letter or slides.

Supported options:

• font sizes: 10pt 11pt 12pt

Document Layout

Page 91: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

66/82

/ department of mathematics and computer science September 2008

Document ClassThe first command in a .tex file determines the global processing format forthe 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

Document Layout

Page 92: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

66/82

/ department of mathematics and computer science September 2008

Document ClassThe first command in a .tex file determines the global processing format forthe 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

Document Layout

Page 93: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

66/82

/ department of mathematics and computer science September 2008

Document ClassThe first command in a .tex file determines the global processing format forthe 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

Document Layout

Page 94: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

66/82

/ department of mathematics and computer science September 2008

Document ClassThe first command in a .tex file determines the global processing format forthe 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

• formula style: leqno fleqn

Document Layout

Page 95: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

67/82

/ department of mathematics and computer science September 2008

Loading packagesPackages are loaded in the preamble. A package is a set of LATEX commands (orsymbols, environments, declarations) stored in a file with the extension .sty.Important packages:

a4wide uses smaller page margins, which means that more text fits on onepage.

amsmath contains advanced mathematical symbols.

babel loads hyphenation rules for foreign languages.

europs loads the Euro symbol: €.

fancyhdr is used to customise headers and footers.

graphicx defines a command to load external graphics.

hyperref adds interactivity (hyperlinks, bookmarks) to your document.

Document Layout

Page 96: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

68/82

/ department of mathematics and computer science September 2008

Page StyleThe page style is controlled by the command:

\pagestyle{style}\thispagestyle{style}

Most common styles are:

empty page head and footer is empty.

plain empty page head, centred page number in the foot. Default forarticle and report.

headings the head contains the page number as well as title information. Thefoot is empty. Default for book.

Document Layout

Page 97: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

69/82

/ department of mathematics and computer science September 2008

Page StyleThe package fancyhdr defines a new page style: fancy that the user can easilyredefine. Now it is possible to specify the headers and footers manually:

\lhead{...} \chead{...} \rhead{...}

\lfoot{...} \cfoot{...} \rfoot{...}

If you want to distinguish between odd and even pages, it becomes slightlymore complicated:

\fancyhead[RO, LE]{...}

\fancyfoot[C]{...}

L = Left, C = left, R = right, O = odd, E = even.

Document Layout

Page 98: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

69/82

/ department of mathematics and computer science September 2008

Page StyleThe package fancyhdr defines a new page style: fancy that the user can easilyredefine. Now it is possible to specify the headers and footers manually:

\lhead{...} \chead{...} \rhead{...}

\lfoot{...} \cfoot{...} \rfoot{...}

If you want to distinguish between odd and even pages, it becomes slightlymore complicated:

\fancyhead[RO, LE]{...}

\fancyfoot[C]{...}

L = Left, C = left, R = right, O = odd, E = even. The command \fancyhf{}clears all headers and footers.

Document Layout

Page 99: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

70/82

/ department of mathematics and computer science September 2008

fancyhdr - Example

\pagestyle{fancy}\fancyhf{}\fancyhead[CE]{\bfseries\leftmark}\fancyhead[CO]{\bfseries\rightmark}\fancyfoot[RO]{\thepage}\fancyfoot[LE]{\thepage}

The command \thepage displays the page number. The commands\leftmark and \rightmark contain the automatic texts for the headings.

Document Layout

Page 100: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

71/82

/ department of mathematics and computer science September 2008

Page NumberingYou can set the page number manually:

\setcounter{page}{14}

Document Layout

Page 101: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

71/82

/ department of mathematics and computer science September 2008

Page NumberingYou can set the page number manually:

\setcounter{page}{14}

You can also control the style of the page numbering:

\pagenumbering{style}

The allowed styles are:

arabic normal (Arabic) numerals: 1, 2, 3, 4

roman lowercase Roman numerals: i, i i, i i i, iv

Roman uppercase Roman numerals: I, I I, I I I, I V

alph for lowercase letters: a, b, c, d

Alph for uppercase letters: A, B, C, D

Document Layout

Page 102: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

72/82

/ department of mathematics and computer science September 2008

Paragraph FormattingThe following parameters affect the appearance of a paragraph:

\parskip the distance between paragraphs, usually in units of ex

\parindent the amount of indentation for the first line of a paragraph

Use the \setlength command to change the values of these parameters.

\setlength{\parskip}{1ex}\setlength{\parindent}{0mm}

Document Layout

Page 103: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

72/82

/ department of mathematics and computer science September 2008

Paragraph FormattingThe following parameters affect the appearance of a paragraph:

\parskip the distance between paragraphs, usually in units of ex

\parindent the amount of indentation for the first 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

Document Layout

Page 104: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

73/82

/ department of mathematics and computer science September 2008

Page FormatEach page consists of a head, a body (containing the actual text) and a foot.All dimensions can be controlled using the \setlength command.

Header

Body

Footer

MarginNotes

i8� -

i7

?

6

i1� -

�-i3 i10� -

�-i9

6

?

i11

i2?

6

6?

i46

?

i56

?

i6

1 one inch + \hoffset 2 one inch + \voffset3 \oddsidemargin = 0pt 4 \topmargin = 0pt5 \headheight = 12pt 6 \headsep = 19pt7 \textheight = 621pt 8 \textwidth = 460pt9 \marginparsep = 7pt 10 \marginparwidth = 54pt11 \footskip = 30pt \marginparpush = 7pt (not shown)

\hoffset = 0pt \voffset = 0pt\paperwidth = 597pt \paperheight = 845pt

1 one inch + \hoffset 2 one inch + \voffset3 \oddsidemargin = 0pt 4 \topmargin = 0pt5 \headheight = 12pt 6 \headsep = 19pt7 \textheight = 621pt 8 \textwidth = 460pt9 \marginparsep = 7pt 10 \marginparwidth = 54pt11 \footskip = 30pt \marginparpush = 7pt (not shown)

\hoffset = 0pt \voffset = 0pt\paperwidth = 614pt \paperheight = 794pt

1 one inch + \hoffset 2 one inch + \voffset3 \oddsidemargin = 0pt 4 \topmargin = 0pt5 \headheight = 12pt 6 \headsep = 19pt7 \textheight = 621pt 8 \textwidth = 460pt9 \marginparsep = 7pt 10 \marginparwidth = 54pt11 \footskip = 30pt \marginparpush = 7pt (not shown)

\hoffset = 0pt \voffset = 0pt\paperwidth = 614pt \paperheight = 794pt

Document Layout

Page 105: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

74/82

/ department of mathematics and computer science September 2008

Multicolumn Text

Document Layout

Page 106: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

74/82

/ department of mathematics and computer science September 2008

Multicolumn Text

• The document class option twocolumn sets the entire document in twocolumns per page

Document Layout

Page 107: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

74/82

/ department of mathematics and computer science September 2008

Multicolumn Text

• The document class option twocolumn sets the entire document in twocolumns per page

• Individual pages may be output in one or two columns:

\onecolumn\twocolumn[header text]

Please note that these commands start a new page.

Document Layout

Page 108: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

74/82

/ department of mathematics and computer science September 2008

Multicolumn Text

• The document class option twocolumn sets the entire document in twocolumns per page

• Individual pages may be output in one or two columns:

\onecolumn\twocolumn[header text]

Please note that these commands start a new page.

• To select a different number of columns within one page, use the multicolsenvironment which is defined in the package multicol:

\usepackage{multicol}...\begin{multicols}{3}[header text]Text set in 3 columns.\end{multicols}

Document Layout

Page 109: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

75/82

/ department of mathematics and computer science September 2008

Parts of the Document – Title Page

\title{Title text}\author{Author names and addresses}\date{Date text}\maketitle

Document Layout

Page 110: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

75/82

/ department of mathematics and computer science September 2008

Parts of the Document – Title Page

\title{Title text}\author{Author names and addresses}\date{Date text}\maketitle

Use the \and command to define multiple authors:

\author{Marko Boon\\ [email protected] \andAnton Stoorvogel\\ [email protected]}

Document Layout

Page 111: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

75/82

/ department of mathematics and computer science September 2008

Parts of the Document – Title Page

\title{Title text}\author{Author names and addresses}\date{Date text}\maketitle

Use the \and command to define multiple authors:

\author{Marko Boon\\ [email protected] \andAnton Stoorvogel\\ [email protected]}

Use the \thanks command to create a footnote:

\author{Marko Boon\thanks{E-mail: [email protected]}}

Document Layout

Page 112: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

75/82

/ department of mathematics and computer science September 2008

Parts of the Document – Title Page

\title{Title text}\author{Author names and addresses}\date{Date text}\maketitle

Use the \and command to define multiple authors:

\author{Marko Boon\\ [email protected] \andAnton Stoorvogel\\ [email protected]}

Use the \thanks command to create a footnote:

\author{Marko Boon\thanks{E-mail: [email protected]}}

Use \date{} to omit the date.

Document Layout

Page 113: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

76/82

/ department of mathematics and computer science September 2008

Parts of the Document – AbstractThe abstract is produced with the abstract environment:

\begin{abstract}Text for the abstract.\end{abstract}

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

Document Layout

Page 114: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

77/82

/ department of mathematics and computer science September 2008

Parts of the Document – Sections and chaptersThe following commands produce automatic, sequential sectioning:

\chapter{ } \chapter*{ }\section{ } \section*{ }\subsection{ } \subsection*{ }\subsubsection{ } \subsubsection*{ }

Document Layout

Page 115: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

77/82

/ department of mathematics and computer science September 2008

Parts of the Document – Sections and chaptersThe following commands produce automatic, sequential sectioning:

\chapter{ } \chapter*{ }\section{ } \section*{ }\subsection{ } \subsection*{ }\subsubsection{ } \subsubsection*{ }

Remarks:

• The command \chapter exists in document classes book and reportonly.

• A * behind the command results in the unnumbered version which will notbe included in the table of contents.

• The book class also provides a \part command.

Document Layout

Page 116: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

78/82

/ department of mathematics and computer science September 2008

Parts of the Document – AppendixAn 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”.

Please note that the actual word “Appendix” is not added to the table of con-tents!

Document Layout

Page 117: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

79/82

/ department of mathematics and computer science September 2008

Book StructureTo simplify the structuring of the book, use the commands:

\frontmatter\mainmatter\backmatter

Front matter: preface, table of contentsMain matter: main body of textBack matter: bibliography, index

Front matter has Roman page numbering and suppresses the numbering ofchapters. Back matter also has unnumbered chapters. The page number isreset for the main matter.

Document Layout

Page 118: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

80/82

/ department of mathematics and computer science September 2008

Table of ContentsThe 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. Youhave to run latex twice to get all references right! It is recommended to usethe texify command.

Document Layout

Page 119: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

80/82

/ department of mathematics and computer science September 2008

Table of ContentsThe 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. Youhave to run latex twice to get all references right! It is recommended to usethe texify command.

To create additional entries manually, use the command:\addcontentsline{toc}{section type}{entry text}

\appendix\addcontentsline{toc}{chapter}{\noindent Appendix}\chapter{Statistical Tables}

Document Layout

Page 120: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

81/82

/ department of mathematics and computer science September 2008

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

TeXify

PDFTeXify

TeXify and PDFTeXify

Page 121: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

82/82

/ department of mathematics and computer science September 2008

Labels and ReferencesThe command \label{marker} stores the current value of the relevantcounter (section, chapter, equation, figure, table etc.) at that point in the text.To refer to a label, use:

\ref to print the section, chapter, equation, figure or table number.

\pageref to print the page number on which the \label command was is-sued.

Document Layout

Page 122: Introduction to LATEX Part 1 - Eindhoven University of ...marko/latex/part1.pdfWinEdt – editor Yap – DVI previewer GSView – PS previewer Other useful programs: Adobe Acrobat

82/82

/ department of mathematics and computer science September 2008

Labels and ReferencesThe command \label{marker} stores the current value of the relevantcounter (section, chapter, equation, figure, table etc.) at that point in the text.To refer to a label, use:

\ref to print the section, chapter, equation, figure or table number.

\pageref to print the page number on which the \label command was is-sued.

\section{Labels and References\label{labels}}

In section \ref{labels} you will find informationon how to create labels and references in \LaTeX.The sections starts on page \pageref{labels}.

Document Layout