LATEX and MiKTEX Introduction

http://www.win.tue.nl/∼jknopper/latex/intro

Februari 2012 Jan Willem Knopper ([email protected]) Where innovation starts Contents 2/87

Introduction3 Text, Symbols and Commands 22 Exercise 36 Document Layout 37 Displaying Text 46 Exercise 53 Mathematics 54 Tables 56 Graphics 68 Including programming statements 79 Exercise 82

/ department of mathematics and computer science Februari 2012 Introduction 3/87 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 system, free of charge. • platform independent.

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

/ department of mathematics and computer science Februari 2012 Introduction 4/87

/ department of mathematics and computer science Februari 2012 Introduction 5/87

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 like HTML). • the commands \begin{} and \end{} create environments.

/ department of mathematics and computer science Februari 2012 Introduction 6/87

A . file \documentclass[options]{document_class}

% preamble

\begin{document}

% document

\end{document}

/ department of mathematics and computer science Februari 2012 Introduction 7/87

A .tex file: 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}

/ department of mathematics and computer science Februari 2012 Introduction 8/87

MiKTEX MiKTEX is an up-to-date TEX implementation for the Windows . • can be downloaded from http://www.miktex.org • contains all LATEX related binaries, like .exe, pdflatex.exe, yap.exe, .exe, dvips.exe, ps2pdf.exe • contains all standard packages (will be discussed later)

/ department of mathematics and computer science Februari 2012 LAT X Related Programs E 9/87

• 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 • Libre Office.org Draw – Create and export EPS Images

/ department of mathematics and computer science Februari 2012 WinEdt 10/87

/ department of mathematics and computer science Februari 2012 WinEdt 11/87

/ department of mathematics and computer science Februari 2012 WinEdt 12/87

/ department of mathematics and computer science Februari 2012 WinEdt 13/87

/ department of mathematics and computer science Februari 2012 WinEdt 14/87

/ department of mathematics and computer science Februari 2012 15/87

runs LATEX on the current document. If no errors are found, the re- sulting DVI file 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 document. starts BibTEX(for bibliographies). generates a master index. removes all generated auxiliary files (DVI, LOG, PDF, BIB, ...). Only the PostScript file will not be deleted.

/ department of mathematics and computer science Februari 2012 WinEdt 16/87

/ department of mathematics and computer science Februari 2012 Yap 17/87

/ department of mathematics and computer science Februari 2012 Yap 18/87

double-click on text for inverse search

/ department of mathematics and computer science Februari 2012 GSView 19/87

/ department of mathematics and computer science Februari 2012 WinEdt 20/87

/ department of mathematics and computer science Februari 2012 WinEdt 21/87

/ department of mathematics and computer science Februari 2012 Text, Symbols and Commands 22/87 A command is an instruction to LATEX to do something special. Three types of command 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 first non-letter: \large \Large \bfseries

Some commands have a so-called *-form to modify their functionality some- how. Example: \section*{Introduction}

/ department of mathematics and computer science Februari 2012 Text, Symbols and Commands 23/87 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 Februari 2012 Text, Symbols and Commands 24/87

Environments 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 Februari 2012 Text, Symbols and Commands 25/87

Declarations A declaration is a command that changes the values or meanings of certain parameters 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 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 Februari 2012 Text, Symbols and Commands 26/87

Loading Packages A 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 want to include graphics in our document, we should load the package graphicx which defines a new command \includegraphics.

/ department of mathematics and computer science Februari 2012 Text, Symbols and Commands 27/87

Special Characters – Spaces LATEX takes care of spacing in your document. The following two texts appear exactly the same in the DVI file: \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 Februari 2012 Text, Symbols and Commands 28/87

Special Characters – Spaces Some 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 force a new line: \newline or \\

/ department of mathematics and computer science Februari 2012 Text, Symbols and Commands 29/87

Special Characters – Spaces 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 Februari 2012 Text, Symbols and Commands 30/87

Lengths and units Lengths consist of a decimal number, followed by a dimensional unit. Some units: 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

/ department of mathematics and computer science Februari 2012 Text, Symbols and Commands 31/87

Special Characters – Command Characters 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 Februari 2012 Text, Symbols and Commands 32/87

Special Characters – Accents Diacritical marks or accents can be created with LATEX: \‘e \’e \^o \"o \~o \=o \v{s} \c{c} be\"invloeden het re\"ele deel Cura\c{c}ao è é ô ö õ o¯ š ç beïnvloeden het reële deel Curaçao

/ department of mathematics and computer science Februari 2012 Text, Symbols and Commands 33/87

Special Characters Special symbols can be entered directly, but only if the right input encoding is specified. 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}

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

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

/ department of mathematics and computer science Februari 2012 Text, Symbols and Commands 34/87

The Euro Symbol: E 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 official Euro symbol: E

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

Bold: E Italic: E Sans-serif: E

/ department of mathematics and computer science Februari 2012 Text, Symbols and Commands 35/87

The date LATEX contains a macro to print the current date: \today. The format of the date depends on the language set with the package babel. \today February 6, 2012

\selectlanguage{dutch}\today 6 februari 2012

/ department of mathematics and computer science Februari 2012 Exercise 36/87

1. create a new LATEX article. Font size: 11pt. Load the package a4wide to adjust the margins. 2. copy-paste the text from snowwhite.txt in the document body and run LATEX. Explain what the error message means and fix the error. 3. right before the error, a Euro symbol occurs. Verify that the symbol is not printed in the DVI file. Make sure that LATEX 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 Februari 2012 Document Layout 37/87

Document Class The first command in a .tex file 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 Februari 2012 Document Layout 38/87

Loading packages Packages are loaded in the preamble. A package is a set of LATEX commands (or symbols, environments, declarations) stored in a file with the extension .sty. Important packages: a4wide uses smaller page margins, which means that more text fits on one page. amsmath contains advanced mathematical symbols. babel loads hyphenation rules for foreign languages. europs loads the Euro symbol: E. fancyhdr is used to customise headers and footers. graphicx defines 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 Februari 2012 Document Layout 39/87

Paragraph Formatting The 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

/ department of mathematics and computer science Februari 2012 Document Layout 40/87

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{Jan Willem Knopper\\ [email protected] \and Marko Boon\\ [email protected]}

Use \date{} to omit the date.

/ department of mathematics and computer science Februari 2012 Document Layout 41/87

Parts of the Document – Abstract The 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 (without page number). In document class article the abstract appears below the title.

/ department of mathematics and computer science Februari 2012 Document Layout 42/87

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

Remarks: • 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 Februari 2012 Document Layout 43/87

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”. Please note that the actual word “Appendix” is not added to the table of con- tents!

/ department of mathematics and computer science Februari 2012 Document Layout 44/87

Table of Contents 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 Februari 2012 Document Layout 45/87

Labels and References The command \label{marker} stores the current value of the relevant counter (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 information on how to create labels and references in \LaTeX. The sections starts on page \pageref{labels}.

/ department of mathematics and computer science Februari 2012 Displaying Text 46/87

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

/ department of mathematics and computer science Februari 2012 Displaying Text 47/87

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 difference? emphasised, italic, slanted

This is an italic sentence containing an emphasised word.

/ department of mathematics and computer science Februari 2012 Displaying Text 48/87

Font Size The font size can be changed using one of the following declarations: Declaration Result

\tiny smallest

\scriptsize very small \footnotesize smaller \small small \normalsize normal \large large \Large larger \LARGE even larger \huge still larger \Huge largest

/ department of mathematics and computer science Februari 2012 Displaying Text 49/87

Lists 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 Februari 2012 Displaying Text 50/87

Lists – Itemize • This is the first item • This is the second item • This is an item with a nested list: – This list has different labels. – Another item. • the final item? + it is even possible to change the label

/ department of mathematics and computer science Februari 2012 Displaying Text 51/87

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}

/ department of mathematics and computer science Februari 2012 Displaying Text 52/87

Lists – Enumerate 1. This is the first 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 item2. 4. the final item

/ department of mathematics and computer science Februari 2012 Exercise 53/87

1. add the a4paper option to the document class. 2. use the paragraph formatting commands to set the default paragraph in- dent 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 Februari 2012 Mathematics 54/87 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.

/ department of mathematics and computer science Februari 2012 Mathematics 55/87

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 lim = 1 x→0 x ∞ X 1 xk = (|x| < 1) 1 − x k=0

/ department of mathematics and computer science Februari 2012 Tables 56/87 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 defines the vertical positioning for the table: t or b (top or bottom)

/ department of mathematics and computer science Februari 2012 Tables 57/87 The cols argument defines the column formatting. The possible formatting symbols are: l the column contents are left justified the column contents are right justified c the column contents are centered p{width} the text in this column is set in a paragraph box of the specified width. | draws a vertical line || draws a double vertical line

/ department of mathematics and computer science Februari 2012 Tables 58/87 The rows contain the actual entries. Each row is terminated with the \\ com- mand. 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 defined by col.

/ department of mathematics and computer science Februari 2012 Tables 59/87

Example 1 Stand Eredivisie 6 februari 2011 PWDL Pts +/- 1 PSV 22 14 5 3 47 58-21 2 FC Twente 22 14 5 3 47 45-24 3 Ajax 22 13 5 4 44 44-20 4 FC Groningen 22 13 4 5 43 49-28 5 ADO Den Haag 22 11 5 6 38 40-32 6 AZ 22 10 7 5 37 34-23 7 Roda JC 22 9 8 5 35 37-30 8 FC Utrecht 22 10 4 8 34 36-28 9 Heerenveen 22 8 7 7 31 42-33 10 NAC Breda * 22 9 4 9 30 31-36 11 NEC 22 6 9 7 27 36-38 12 Graafschap 22 6 7 9 25 22-39 13 Heracles Almelo 22 6 6 10 24 32-40 14 Vitesse 22 5 7 10 22 27-37 15 Feyenoord 22 5 6 11 21 25-39 16 Excelsior 22 5 4 13 19 25-45 17 VVV-Venlo 22 4 1 17 13 22-51 18 Willem II 22 1 4 17 7 19-60

/ department of mathematics and computer science Februari 2012 Tables 60/87

Example 1 \begin{tabular}{|l|l|cccc|r|c|} \hline \multicolumn{8}{|c|}{Eredivisie 6 februari 2011} \\ \hline & & P & W & D & L & Pts & +/- \\ \hline 1 & PSV & 22 & 14 & 5 & 3 & 47 & 58-21 \\ 2 & FC Twente & 22 & 14 & 5 & 3 & 47 & 45-24 \\

...

18 & Willem II & 22 & 1 & 4 & 17 & 7 & 19-60 \\ \hline \end{tabular} / department of mathematics and computer science Februari 2012 Tables 61/87

Example 2 Model Description Price

APV Desktop: Intel Core i3 530 processor, 3 GB E 399.00 memory, 500 GB Hard disk, Onboard HD video- card, Dual Layer DVD±ReWriter, excl. OS APP5 Desktop DeLuxe: Intel Core i5 750 proces- E 699.00 sor, 4 GB memory, 1000 GB Hard disk, ATI Radeon HD5670 with 512 MB, Dual Layer DVD±ReWriter, excl. OS

/ department of mathematics and computer science Februari 2012 Tables 62/87

Example 2 \begin{tabular}{lp{0.5\textwidth}r} \bfseries Model & \bfseries Description & \bfseries Price \\[1ex]

APV & \small \textbf{Desktop}: Intel Core i3 530 processor, 3~GB memory, 500~GB Hard disk, Onboard HD videocard, Dual Layer DVD$\pm$ReWriter, excl. OS & \EUR{} 399.00 \\

APP5 & \small \textbf{Desktop DeLuxe}: Intel Core i5 750 processor, 4~GB memory, 1000~GB Hard disk, ATI Radeon HD5670 with 512~MB, Dual Layer DVD$\pm$ReWriter, excl. OS & \EUR{} 699.00 \\ \end{tabular}

/ department of mathematics and computer science Februari 2012 Tables 63/87 WinEdt has a useful plug-in to insert tables:

/ department of mathematics and computer science Februari 2012 Tables 64/87 WinEdt has a useful plug-in to insert tables:

/ department of mathematics and computer science Februari 2012 Tables 65/87 WinEdt has a useful plug-in to insert tables:

/ department of mathematics and computer science Februari 2012 Tables 66/87 WinEdt has a useful plug-in to insert tables:

/ department of mathematics and computer science Februari 2012 Tables 67/87

Excel to LATEX Add-In 1. download the Excel macro: Excel2LaTeX.xla 2. Start Excel and install the Add-in: • Tools −→ Add-Ins... • Browse... • Browse for the Add-In and click Ok 3. Restart Excel

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

/ department of mathematics and computer science Februari 2012 Graphics 68/87

Graphics Inclusion To include an external graphics file:

• Load the package graphicx in the preamble: \usepackage{graphicx}

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

/ department of mathematics and computer science Februari 2012 Graphics 69/87 EPS PDF JPG GIF PNG ∗ ∗ Supported File Formats: LATEX yes no yes no yes PDFLATEX no yes yes no yes Please notice: only EPS and PDF are scalable. Use JPG and PNG just for pho- tographs!

Many programs can generate EPS images. Use Corel Designer to export im- ages 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.

∗ does not work automatically when working with LATEX. You should enter the coordinates of the bounding box manually.

/ department of mathematics and computer science Februari 2012 Graphics 70/87 \includegraphics[options]{filename}

When including EPS or PDF files, use the file name without extension! LATEX will take the EPS, PDFLATEX will take the PDF.

Supported options are: scale=number magnifies the figure by number over its natural size. width=length specifies the width to which the figure should be scaled height=length specifies the height to which the figure should be scaled angle=number rotates the figure counterclockwise over the specified angle (in degrees) bb=llx lly urx ury enters the coordinates of the bounding box manually.

/ department of mathematics and computer science Februari 2012 Graphics 71/87 You can create a figure environment to create “floating” figures. LATEX will put the image at the location that you specify, or on the top of the next page if the figure does not fit at the current page. In a figure environment you can add a caption and a label to refer to the figure. \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 Februari 2012 Graphics 72/87 WinEdt has a useful plug-in to insert pictures:

/ department of mathematics and computer science Februari 2012 Graphics 73/87 WinEdt has a useful plug-in to insert pictures:

/ department of mathematics and computer science Februari 2012 Graphics 74/87 WinEdt has a useful plug-in to insert pictures:

Remove absolute path and extension

/ department of mathematics and computer science Februari 2012 Graphics 75/87

Scalable and non-scalable graphics

1

P 7 Π €€€€€€€€€€ 6 Π €€€€€€ 6 O 1

Q

/ department of mathematics and computer science Februari 2012 1

Graphics 76/87

Scalable and non-scalable graphics P 7 Π €€€€€€€€€€ 6 Π €€€€€€ 6 O 1 Scalable graphics formats: Non-scalable graphics formats: EPS, PDF, WMF, EMF, SVG. JPG, GIF, BMP, PNG. But also: all scalable formats!

Q / department of mathematics and computer science Februari 2012 Graphics 77/87

Scalable Graphics Software • Corel Designer, • CorelDraw, • Adobe Illustrator, • Microsoft Visio, • Microsoft Office Drawing, • OpenOffice.org Draw, • all computer algebra software (Mathematica, Matlab, Maple) Non-scalable Graphics Software • Adobe PhotoShop, • Paint Shop Pro, • MS Paint, • all digital photo editing software!

/ department of mathematics and computer science Februari 2012 Graphics 78/87

Including JPG/PNG Images LATEX (unlike PDFLATEX) cannot determine the bounding box automatically.

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 Februari 2012 Including programming statements 79/87 The package listings formats listings. It defines the following commands: • \lstlisting{...} for inline programming statements. • \begin{lstlisting} ... \end{lstlisting} for multi-line list- ings. • \lstinputlisting{filename} imports a complete source file

/ department of mathematics and computer science Februari 2012 Including programming statements 80/87

Customizing listings Using the command \lstset you can customize the language and appear- ance 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++, Del- phi, Fortran, HTML, Java, Mathematica, Matlab, Pascal, Perl, PHP, SAS, SQL, TeX, VBScript, XML.

/ department of mathematics and computer science Februari 2012 Including programming statements 81/87

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

/ department of mathematics and computer science Februari 2012 Exercise 82/87

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

/ department of mathematics and computer science Februari 2012 I want to know more about LAT X!!! E 83/87

• 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 Februari 2012 LAT X Related Programs E 84/87 WinEdt

/ department of mathematics and computer science Februari 2012 LAT X Related Programs E 85/87 WinEdt

/ department of mathematics and computer science Februari 2012 LAT X Related Programs E 86/87 WinEdt

/ department of mathematics and computer science Februari 2012 LAT X Related Programs E 87/87 WinEdt

/ department of mathematics and computer science Februari 2012