Professional Documents
Culture Documents
Introduction
http://www.win.tue.nl/marko/latex/intro
November 2008
Contents
Introduction
A LTEX Related Programs
2/98
3 14 31 45 46 55 62 63 65 78 94 97
November 2008
Text, Symbols and Commands Exercise Document Layout Displaying Text Exercise Mathematics Tables Graphics Including programming statements Exercise
Introduction
3/98
A LTEX is a document preparation system. It is widely used in the elds of mathematics and natural sciences, but also spreading to many other disciplines. A LTEX is a set of markup commands used with the powerful typesetting program TEX.
November 2008
Introduction
3/98
A LTEX is a document preparation system. It is widely used in the elds of mathematics and natural sciences, but also spreading to many other disciplines. A LTEX is a set of markup commands used with the powerful typesetting program TEX.
November 2008
Introduction
4/98
November 2008
Introduction
5/98
November 2008
Introduction
6/98
November 2008
Introduction
7/98
November 2008
Introduction
8/98
November 2008
Introduction
9/98
November 2008
Introduction
A The LTEX language
10/98
November 2008
Introduction
A The LTEX language
10/98
A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }
November 2008
Introduction
A The LTEX language
10/98
A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }
November 2008
Introduction
A The LTEX language
10/98
A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }
optional command arguments are placed between brackets: [ ] comments start with a percentage symbol: %
November 2008
Introduction
A The LTEX language
10/98
A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }
optional command arguments are placed between brackets: [ ] comments start with a percentage symbol: %
A LTEX takes care of the spacing between words and paragraphs (just like HTML).
November 2008
Introduction
A The LTEX language
10/98
A LTEX commands always start with a backslash: \ required command arguments are placed between curly brackets: { }
optional command arguments are placed between brackets: [ ] comments start with a percentage symbol: %
A LTEX takes care of the spacing between words and paragraphs (just like HTML).
November 2008
Introduction
A .tex le
\documentclass[options]{document_class} % preamble \begin{document} % document \end{document}
11/98
November 2008
Introduction
A .tex le: intro.tex
\documentclass[12pt]{article} \usepackage[english]{babel} \begin{document} \section{Introduction} LaTeX is a document preparation system used to create documents of high quality typography. It is mostly used in the fields of mathematics and natural sciences, but can in fact be used for any type of publication. \end{document}
12/98
November 2008
Introduction
MiKTEX
13/98
MiKTEX is an up-to-date TEX implementation for the Windows operating system. can be downloaded from http://www.miktex.org
A contains all LTEX related binaries, like latex.exe, pdflatex.exe, yap.exe, bibtex.exe, dvips.exe, ps2pdf.exe
November 2008
14/98
November 2008
15/98
November 2008
16/98
November 2008
17/98
November 2008
18/98
November 2008
19/98
November 2008
20/98
A runs LTEX on the current document. If no errors are found, the resulting DVI le will be opened in Yap.
opens the document in Yap and jumpt to the current location in the document. starts BibTEX(for bibliographies). generates a master index. removes all generated auxiliary les (DVI, LOG, PDF, BIB, . . .). Only the PostScript le will not be deleted.
November 2008
21/98
November 2008
22/98
November 2008
23/98
November 2008
24/98
November 2008
25/98
November 2008
26/98
November 2008
27/98
November 2008
28/98
Mathematical symbols
November 2008
29/98
November 2008
30/98
Jump to line Line numbering on/off Wrapping on/off Line / block selection mode Spelling check on/off
November 2008
31/98
to print one of these characters, precede it with a backslash: \$ \# \% the backslash character \ plus a sequence of letters, ending with the rst non-letter: \large \Large \bfseries
November 2008
31/98
to print one of these characters, precede it with a backslash: \$ \# \% the backslash character \ plus a sequence of letters, ending with the rst non-letter: \large \Large \bfseries Some commands have a so-called *-form to modify their functionality somehow. Example: \section*{Introduction}
November 2008
32/98
Many commands operate on some piece of text, which then appears as an argument in curly braces following the command name. Examples: \section{Introduction} \textbf{bold text} \begin{document}
November 2008
32/98
Many commands operate on some piece of text, which then appears as an argument in curly braces following the command name. Examples: \section{Introduction} \textbf{bold text} \begin{document} Optional arguments are put into square brackets and mandatory arguments into curly brackets: \documentclass[11pt]{article} \usepackage[dutch]{babel}
November 2008
33/98
An environment affects the text within it treating it differently according to the environment parameters. This text will not appear centered. \begin{center} This text will appear centered. This text will appear centered. This text will appear centered. \end{center} This text will not appear centered.
November 2008
34/98
A declaration is a command that changes the values or meanings of certain parameters or commands without printing any text. The effect ends when another declaration of the same type is encountered. This text appears normal while \bfseries this text appears boldface.
November 2008
34/98
A declaration is a command that changes the values or meanings of certain parameters or commands without printing any text. The effect ends when another declaration of the same type is encountered. This text appears normal while \bfseries this text appears boldface. When the declaration occurs within an environment or within a { } block, its scope extends only to until the end of this environment or block. This text appears normal while {\bfseries this text appears boldface}. This text is normal again. \begin{center} \bfseries This text appears bold. \end{center} This text is normal again.
November 2008
35/98
A A package is a set of LTEX commands (or symbols, environments, declarations) stored in a le with the extension .sty. To invoke a package, simply call \usepackage{package_name}
in the preamble! A Example: LTEX does not have a command to include graphics, so if we want to include graphics in our document, we should load the package graphicx which denes a new command \includegraphics.
November 2008
36/98
A LTEX takes care of spacing in your document. The following two texts appear exactly the same in the DVI le: \section{Introduction}
LaTeX is a document preparation system. It is widely used in the fields of mathematics and natural sciences, but also spreading to many other disciplines. \section{Introduction}LaTeX is a document preparation system. It is widely used in the fields of mathematics and natural sciences, but also spreading to many other disciplines.
November 2008
37/98
November 2008
37/98
November 2008
38/98
Spacing of any desired size may be inserted into the text with the commands \hspace{10cm} \hspace*{-3mm} \hspace has no effect if it should come at the beginning of a line. The *-form will insert the spacing no matter where it occurs.
November 2008
38/98
Spacing of any desired size may be inserted into the text with the commands \hspace{10cm} \hspace*{-3mm} \hspace has no effect if it should come at the beginning of a line. The *-form will insert the spacing no matter where it occurs. Vertical spacing is created using the \vspace command: \vspace{10cm} \vspace*{-3mm}
November 2008
38/98
Spacing of any desired size may be inserted into the text with the commands \hspace{10cm} \hspace*{-3mm} \hspace has no effect if it should come at the beginning of a line. The *-form will insert the spacing no matter where it occurs. Vertical spacing is created using the \vspace command: \vspace{10cm} \vspace*{-3mm} Further commands for increasing the spacing between paragraphs are: \smallskip \medskip \bigskip
November 2008
39/98
Lengths consist of a decimal number, followed by a dimensional unit. Some units: cm centimeter mm millimeter in pt ex inch (= 2.54cm) point (1in = 72.27 pt) font-specic size: the height of the letter x
November 2008
40/98
As mentioned before, the characters # $ ~ _ ^ { } % are interpreted as commands. To print them as text, give a command consisting of \ plus that character: \# \$ \~ \_ \^ \{ \} \% #$_{}%
November 2008
40/98
As mentioned before, the characters # $ ~ _ ^ { } % are interpreted as commands. To print them as text, give a command consisting of \ plus that character: \# \$ \~ \_ \^ \{ \} \% #$_{}% To print a backslash, use the command \textbackslash: \
November 2008
41/98
November 2008
42/98
Special symbols can be entered directly, but only if the right input encoding is specied. The input encoding depends on the type and language of the operating system. We have to load the package inputenc to specify the correct encoding: \usepackage[ansinew]{inputenc} benvloeden, reel, Curaao C benvloeden, reel, Curaao
November 2008
42/98
Special symbols can be entered directly, but only if the right input encoding is specied. The input encoding depends on the type and language of the operating system. We have to load the package inputenc to specify the correct encoding: \usepackage[ansinew]{inputenc} benvloeden, reel, Curaao C benvloeden, reel, Curaao Please note that some of these characters also require the textcomp package.
November 2008
43/98
Adobe created a font containing euro symbols which also contains bold, italic and serif versions. To use these symbols, load the package europs. Now we can use the following commands:
November 2008
43/98
Adobe created a font containing euro symbols which also contains bold, italic and serif versions. To use these symbols, load the package europs. Now we can use the following commands: \EURofc creates the ofcial Euro symbol:
November 2008
43/98
Adobe created a font containing euro symbols which also contains bold, italic and serif versions. To use these symbols, load the package europs. Now we can use the following commands: \EURofc creates the ofcial Euro symbol: \EUR creates a Euro symbol depending on the current text style
November 2008
43/98
Adobe created a font containing euro symbols which also contains bold, italic and serif versions. To use these symbols, load the package europs. Now we can use the following commands: \EURofc creates the ofcial Euro symbol: \EUR creates a Euro symbol depending on the current text style Bold: Italic: Sans-serif:
November 2008
44/98
A LTEX contains a macro to print the current date: \today. The format of the date depends on the language set with the package babel.
November 2008
44/98
A LTEX contains a macro to print the current date: \today. The format of the date depends on the language set with the package babel.
November 2008
Exercise
45/98
A 1. create a new LTEX article. Font size: 11pt. Load the package a4wide to adjust the margins. A 2. copy-paste the text from snowwhite.txt in the document body and run LTEX. Explain what the error message means and x the error.
3. right before the error, a Euro symbol occurs. Verify that the symbol is not A printed in the DVI le. Make sure that LTEX also prints the Euro symbol. 4. the last line (The End) should be large and centered. 5. create sections: Introduction, The evil stepmother, The great forest, The seven dwarfs, The murder of Snow White, The funeral, The prince, and The marriage. 6. create subsections: The cottage, The dwarfs, The encounter, First attempt, Second attempt, and Third attempt
November 2008
Document Layout
Document Class
46/98
The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options:
November 2008
Document Layout
Document Class
46/98
The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options: font sizes: 10pt 11pt 12pt
November 2008
Document Layout
Document Class
46/98
The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options: font sizes: 10pt 11pt 12pt paper size: a4paper letterpaper
November 2008
Document Layout
Document Class
46/98
The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options: font sizes: 10pt 11pt 12pt paper size: a4paper letterpaper number of columns: onecolumn twocolumn
November 2008
Document Layout
Document Class
46/98
The rst command in a .tex le determines the global processing format for the entire document: \documentclass[options]{class} Supported classes are book, report, article, letter or slides. Supported options: font sizes: 10pt 11pt 12pt paper size: a4paper letterpaper number of columns: onecolumn twocolumn print style: oneside twoside
November 2008
Document Layout
Loading packages
47/98
A Packages are loaded in the preamble. A package is a set of LTEX commands (or symbols, environments, declarations) stored in a le with the extension .sty. Important packages:
a4wide
uses smaller page margins, which means that more text ts on one page. loads hyphenation rules for foreign languages. loads the Euro symbol: .
fancyhdr is used to customise headers and footers. graphicx denes a command to load external graphics. hyperref adds interactivity (hyperlinks, bookmarks) to your document. listings inserting source code with syntax highlighting
November 2008
Document Layout
Paragraph Formatting
The following parameters affect the appearance of a paragraph: \parskip the distance between paragraphs, usually in units of ex
48/98
\parindent the amount of indentation for the rst line of a paragraph Use the \setlength command to change the values of these parameters. \setlength{\parskip}{1ex} \setlength{\parindent}{0mm}
November 2008
Document Layout
Paragraph Formatting
The following parameters affect the appearance of a paragraph: \parskip the distance between paragraphs, usually in units of ex
48/98
\parindent the amount of indentation for the rst line of a paragraph Use the \setlength command to change the values of these parameters. \setlength{\parskip}{1ex} \setlength{\parindent}{0mm} To suppress the indentation for one paragraph, or to force it: \noindent \indent
November 2008
Document Layout
Parts of the Document Title Page
\title{Title text} \author{Author names and addresses} \date{Date text} \maketitle
49/98
November 2008
Document Layout
Parts of the Document Title Page
\title{Title text} \author{Author names and addresses} \date{Date text} \maketitle Use the \and command to dene multiple authors: \author{Marko Boon\\ marko@win.tue.nl \and Anton Stoorvogel\\ a.a.stoorvogel@tue.nl}
49/98
November 2008
Document Layout
Parts of the Document Title Page
\title{Title text} \author{Author names and addresses} \date{Date text} \maketitle Use the \and command to dene multiple authors: \author{Marko Boon\\ marko@win.tue.nl \and Anton Stoorvogel\\ a.a.stoorvogel@tue.nl} Use \date{} to omit the date.
49/98
November 2008
Document Layout
Parts of the Document Abstract
The abstract is produced with the abstract environment: \begin{abstract} Text for the abstract. \end{abstract}
50/98
In document class report the abstract appears on a separate page (without page number). In document class article the abstract appears below the title.
November 2008
Document Layout
Parts of the Document Sections and chapters
The following commands produce automatic, sequential sectioning: \chapter{ } \chapter*{ } \section{ } \section*{ } \subsection{ } \subsection*{ } \subsubsection{ } \subsubsection*{ }
51/98
November 2008
Document Layout
Parts of the Document Sections and chapters
The following commands produce automatic, sequential sectioning: \chapter{ } \chapter*{ } \section{ } \section*{ } \subsection{ } \subsection*{ } \subsubsection{ } \subsubsection*{ } Remarks:
51/98
The command \chapter exists in document classes book and report only. A * behind the command results in the unnumbered version which will not be included in the table of contents.
November 2008
Document Layout
Parts of the Document Appendix
An appendix is introduced with the declaration \appendix Resets the section/chapter counter Changes the numbering form from numerals to capital letters (A, B, . . . ) Replaces the word Chapter by Appendix.
52/98
Please note that the actual word Appendix is not added to the table of contents!
November 2008
Document Layout
Table of Contents
53/98
The table of contents is generated and printed with the command \tableofcontents (normally after title page and abstract). All entries are created automatically, based on the sectioning commands. You have to run latex twice to get all references right!
November 2008
Document Layout
Table of Contents
53/98
The table of contents is generated and printed with the command \tableofcontents (normally after title page and abstract). All entries are created automatically, based on the sectioning commands. You have to run latex twice to get all references right!
November 2008
Document Layout
Labels and References
54/98
The command \label{marker} stores the current value of the relevant counter (section, chapter, equation, gure, table etc.) at that point in the text. To refer to a label, use: \ref to print the section, chapter, equation, gure or table number.
\pageref to print the page number on which the \label command was issued.
November 2008
Document Layout
Labels and References
54/98
The command \label{marker} stores the current value of the relevant counter (section, chapter, equation, gure, table etc.) at that point in the text. To refer to a label, use: \ref to print the section, chapter, equation, gure or table number.
\pageref to print the page number on which the \label command was issued. \section{Labels and References\label{labels}} In section \ref{labels} you will find information on how to create labels and references in \LaTeX. The sections starts on page \pageref{labels}.
November 2008
Displaying Text
Changing Font Style
The following commands and declarations change the current font style: Command \emph \textrm \texttt \textsf \textup \textit \textsl \textsc \textbf \textmd Declaration \em \rmfamily \ttfamily \sffamily \upshape \itshape \slshape \scshape \bfseries \mdseries Result emphasised Roman font family Typewriter font family Sans serif font family Normal, upright font shape Italic font shape Slanted font shape S MALL C APS FONT SHAPE Boldface font weight normal (medium) font weight
55/98
November 2008
Displaying Text
Changing Font Style Example
This is normal text with one \textit{italic} word. {\sffamily This whole \itshape line is \textbf{sans} serif.} \textbf{\textit{Bold and italic}} Do you see the difference? \emph{emphasised}, \textit{italic}, \textsl{slanted}
56/98
November 2008
Displaying Text
Changing Font Style Example
This is normal text with one \textit{italic} word. {\sffamily This whole \itshape line is \textbf{sans} serif.} \textbf{\textit{Bold and italic}} Do you see the difference? \emph{emphasised}, \textit{italic}, \textsl{slanted} This is normal text with one italic word. This whole line is sans serif. Bold and italic Do you see the dierence? emphasised, italic, slanted
56/98
November 2008
Displaying Text
Changing Font Style Example
This is normal text with one \textit{italic} word. {\sffamily This whole \itshape line is \textbf{sans} serif.} \textbf{\textit{Bold and italic}} Do you see the difference? \emph{emphasised}, \textit{italic}, \textsl{slanted} This is normal text with one italic word. This whole line is sans serif. Bold and italic Do you see the dierence? emphasised, italic, slanted This is an italic sentence containing an emphasised word.
56/98
November 2008
Displaying Text
Font Size
The font size can be changed using one of the following declarations: Declaration Result \tiny \scriptsize very small \footnotesize smaller \small small \normalsize normal \large large \Large larger \LARGE even larger \huge still larger \Huge largest
smallest
57/98
November 2008
Displaying Text
Lists
58/98
There are three environments available for producing formatted lists: itemize, enumerate and description. \begin{itemize} \item This is the first item \item This is the second item \item This is an item with a nested list: \begin{itemize} \item This list has different labels. \item Another item. \end{itemize} \item the final item? \item[+] it is even possible to change the label \end{itemize}
November 2008
Displaying Text
Lists Itemize
This is the rst item This is the second item This is an item with a nested list: This list has different labels. Another item. the nal item? + it is even possible to change the label
59/98
November 2008
Displaying Text
Lists Enumerate
\begin{enumerate} \item This is the first item \item This is another item \label{lab} \item This is an item with a nested list: \begin{enumerate} \item This list has different labels. \item In this item we refer to item \ref{lab}. \end{enumerate} \item the final item \end{enumerate}
60/98
November 2008
Displaying Text
Lists Enumerate
1. This is the rst item 2. This is another item 3. This is an item with a nested list: (a) This list has different labels. (b) In this item we refer to item 2. 4. the nal item
61/98
November 2008
Exercise
1. add the a4paper option to the document class.
62/98
2. use the paragraph formatting commands to set the default paragraph indent to 0 and the default paragraph skip to 1ex. 3. use the appropriate author and title commands to create the title. 4. create an abstract environment 5. add a table of contents after the abstract. 6. change the font size of the last line (The End) to Huge. 7. add a numbered list in section 4.2 (The Dwarfs)
November 2008
Mathematics
Mathematical environments:
63/98
November 2008
Mathematics
Mathematical environments: $ ... $ mathematics in a line of text (inline).
63/98
November 2008
Mathematics
Mathematical environments: $ ... $ mathematics in a line of text (inline). \[ ... \] mathematics in a separate paragraph.
63/98
November 2008
Mathematics
Mathematical environments: $ ... $ mathematics in a line of text (inline). \[ ... \] mathematics in a separate paragraph. \begin{equation} ... \end{equation} mathematics in a separate paragraph, including equation number.
63/98
November 2008
Mathematics
Mathematical environments: $ ... $ mathematics in a line of text (inline). \[ ... \] mathematics in a separate paragraph. \begin{equation} ... \end{equation} mathematics in a separate paragraph, including equation number. \begin{eqnarray} ... \end{eqnarray} multiline mathematical equations, properly aligned.
63/98
November 2008
Mathematics
Example
Everybody knows that $\sin \pi$ is equal to $0$. \begin{eqnarray*} \lim_{x \rightarrow 0} \frac{\sin x}{x} &=& 1\\ \sum_{k=0}^\infty x^k &=& \frac{1}{1-x} \quad (|x|<1) \end{eqnarray*}
64/98
November 2008
Mathematics
Example
Everybody knows that $\sin \pi$ is equal to $0$. \begin{eqnarray*} \lim_{x \rightarrow 0} \frac{\sin x}{x} &=& 1\\ \sum_{k=0}^\infty x^k &=& \frac{1}{1-x} \quad (|x|<1) \end{eqnarray*} Everybody knows that sin is equal to 0. sin x = 1 x0 x lim
64/98
xk =
k=0
1 1x
(|x| < 1)
November 2008
Tables
65/98
The environments array and tabular create tables and matrices. The usage of array is the same as for tabular, but it can only be used in math mode. \begin{array}[pos]{cols} rows \end{array} \begin{tabular}[pos]{cols} rows \end{tabular} The pos argument denes the vertical positioning for the table: t or b (top or bottom)
November 2008
Tables
l r c the column contents are left justied the column contents are right justied the column contents are centered
66/98
The cols argument denes the column formatting. The possible formatting symbols are:
p{width } the text in this column is set in a paragraph box of the specied width. | || draws a vertical line draws a double vertical line
November 2008
Tables
67/98
The rows contain the actual entries. Each row is terminated with the \\ command. The column entries are separated by a & symbol.
November 2008
Tables
67/98
The rows contain the actual entries. Each row is terminated with the \\ command. The column entries are separated by a & symbol. The command \hline draws a horizontal line over the full width. The command \cline{m-n} draws a horizontal line from the left of column m to the right of column n.
November 2008
Tables
67/98
The rows contain the actual entries. Each row is terminated with the \\ command. The column entries are separated by a & symbol. The command \hline draws a horizontal line over the full width. The command \cline{m-n} draws a horizontal line from the left of column m to the right of column n. The command \multicolumn{n}{col}{text} creates a table cell that extends n columns. The column formatting for this cell is dened by col.
November 2008
Tables
Example 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Stand Eredivisie 26 maart 2008 P W D L Pts PSV 30 19 7 4 64 Ajax 30 16 9 5 57 sc Heerenveen 30 16 6 8 54 Feyenoord 30 16 6 8 54 NAC Breda 30 16 6 8 54 FC Twente 30 14 10 6 52 FC Groningen 30 15 5 10 50 Roda JC 30 11 10 9 43 FC Utrecht 30 12 6 12 42 Vitesse 30 11 7 12 40 NEC 30 11 6 13 39 AZ 30 8 9 13 33 Heracles Almelo 30 8 7 15 31 Sparta Rotterdam 30 8 6 16 30 De Graafschap 30 7 7 16 28 Willem II 30 7 6 17 27 VVV-Venlo 30 6 8 16 26 Excelsior 30 6 5 19 23 +/61 - 23 79 - 40 76 - 38 56 - 34 41 - 35 47 - 31 50 - 48 51 - 49 56 - 50 42 - 51 43 - 49 41 - 49 33 - 56 46 - 68 30 - 55 33 - 41 37 - 67 29 - 67
68/98
November 2008
Tables
Example 1
\begin{tabular}{|l|l|cccc|r|c|} \hline \multicolumn{8}{|c|}{Eredivisie 26 maart 2008} \\ \hline & & P & W & D & L & Pts & +/- \\ \hline 1 & PSV & 30 & 19 & 7 & 4 & 64 & 61 - 23 \\ 2 & Ajax & 30 & 16 & 9 & 5 & 57 & 79 - 40 \\ ... 18 & Excelsior & 30 & 6 & 5 & 19 & 23 & 29 - 67 \\ \hline \end{tabular}
69/98
November 2008
Tables
Example 2
Model Description
RAM, 80 GB Hard disk, 16x DVD drive, 32x CDRW drive, 64 MB TV output, Windows XP, 15" monitor Desktop DeLuxe: Same as FBD 360 but with XP4800+ Processor, 48x CDRW drive, 17" monitor
70/98
Price 999.00
FBD 480
1399.00
November 2008
Tables
Example 2
\begin{tabular}{lp{0.5\textwidth}r} \bfseries Model & \bfseries Description & \bfseries Price \\[1ex] FBD 360 & \small \textbf{Desktop}: XP3600+ Processor, 512~MB DDR-RAM, 80~GB Hard disk, 16x DVD drive, 32x CDRW drive, 64~MB TV output, Windows~XP, 15" monitor & \EUR{} 999.00 \\ FBD 480 & \small \textbf{Desktop DeLuxe}: Same as FBD 360 but with XP4800+ Processor, 48x CDRW drive, 17" monitor & \EUR{} 1399.00 \\ \end{tabular}
71/98
November 2008
Tables
WinEdt has a useful plug-in to insert tables:
72/98
November 2008
Tables
WinEdt has a useful plug-in to insert tables:
73/98
November 2008
Tables
WinEdt has a useful plug-in to insert tables:
74/98
November 2008
Tables
WinEdt has a useful plug-in to insert tables:
75/98
November 2008
Tables
WinEdt has a useful plug-in to insert tables:
76/98
November 2008
Tables
A Excel to LTEX Add-In
77/98
1. download the Excel macro: Excel2LaTeX.xla 2. Start Excel and install the Add-in: Click on the Ofce button (in the upper left corner) Excel Options Add-Ins Go... Browse... Browse for the Add-In and click Ok
3. Restart Excel 4. A button has been added to the Add-Ins tab: 5. Create a table in Excel, select the table and press this button. 6. Copy-paste to WinEdt
November 2008
Graphics
Graphics Inclusion
To include an external graphics le:
78/98
November 2008
Graphics
Graphics Inclusion
To include an external graphics le: Load the package graphicx in the preamble: \usepackage{graphicx}
78/98
November 2008
Graphics
Graphics Inclusion
To include an external graphics le: Load the package graphicx in the preamble: \usepackage{graphicx}
78/98
November 2008
Graphics
Supported File Formats:
79/98
EPS PDF JPG GIF PNG A LTEX yes no yes no yes A PDFLTEX no yes yes no yes
Please notice: only EPS and PDF are scalable. Use JPG and PNG just for photographs! Many programs can generate EPS images. Use Corel Designer to export images created in other programs. Copy/Paste the objects in Corel Designer and export to EPS. Use EPS2PDF (on your desktop) to convert EPS to PDF.
A does not work automatically when working with LTEX. You should enter the coordinates of the bounding box manually.
November 2008
Graphics
\includegraphics[options]{filename}
80/98
November 2008
Graphics
\includegraphics[options]{filename} When including EPS or PDF les, use the le name without extension! A A LTEX will take the EPS, PDFLTEX will take the PDF.
80/98
November 2008
Graphics
\includegraphics[options]{filename} When including EPS or PDF les, use the le name without extension! A A LTEX will take the EPS, PDFLTEX will take the PDF. Supported options are: scale=number width=length height=length angle=number magnies the gure by number over its natural size. species the width to which the gure should be scaled species the height to which the gure should be scaled
80/98
rotates the gure counterclockwise over the specied angle (in degrees)
bb=llx lly urx ury enters the coordinates of the bounding box manually.
November 2008
Graphics
81/98
A You can create a gure environment to create oating gures. LTEX will put the image at the location that you specify, or on the top of the next page if the gure does not t at the current page. In a gure environment you can add a caption and a label to refer to the gure. \begin{figure}[ht] \begin{center} \includegraphics{normal} \end{center} \caption{Two dimensional normal distribution} \label{fig:normal} \end{figure}
November 2008
Graphics
81/98
A You can create a gure environment to create oating gures. LTEX will put the image at the location that you specify, or on the top of the next page if the gure does not t at the current page. In a gure environment you can add a caption and a label to refer to the gure. \begin{figure}[ht] \begin{center} \includegraphics{normal} \end{center} \caption{Two dimensional normal distribution} \label{fig:normal} \end{figure}
November 2008
Graphics
WinEdt had a useful plug-in to insert pictures:
82/98
November 2008
Graphics
WinEdt had a useful plug-in to insert pictures:
83/98
November 2008
Graphics
WinEdt had a useful plug-in to insert pictures:
84/98
November 2008
Graphics
WinEdt had a useful plug-in to insert pictures:
85/98
November 2008
Graphics
WinEdt had a useful plug-in to insert pictures:
86/98
November 2008
Graphics
Scalable and non-scalable graphics
1
87/98
P 7 6 6 O 1
November 2008
Graphics
Scalable and non-scalable graphics
88/98
6 1
Scalable graphics formats: EPS, PDF, WMF, EMF, SVG. Non-scalable graphics formats: JPG, GIF, BMP, PNG. But also: all scalable formats!
November 2008
Graphics
Scalable Graphics Software
Corel Designer, CorelDraw, Adobe Illustrator, Microsoft Visio, Microsoft Ofce Drawing, OpenOfce.org Draw, all computer algebra software (Mathematica, Matlab, Maple)
89/98
November 2008
Graphics
Including JPG/PNG Images
A A LTEX (unlike PDFLTEX) cannot determine the bounding box automatically.
90/98
JPEG Image, 2304 1728 pixels, 72dpi, taken with 4.0 megapixel digital camera
November 2008
Graphics
Including JPG/PNG Images
A A LTEX (unlike PDFLTEX) cannot determine the bounding box automatically.
90/98
JPEG Image, 2304 1728 pixels, 72dpi, taken with 4.0 megapixel digital camera \includegraphics[width=8cm,bb=0 0 2304 1728] {holiday.jpg}
November 2008
Graphics
Corel Designer
91/98
November 2008
Graphics
Corel Designer
92/98
November 2008
Graphics
Corel Designer
93/98
November 2008
94/98
\begin{lstlisting} ... \end{lstlisting} for multi-line listings. \lstinputlisting{filename} imports a complete source le
November 2008
95/98
Using the command \lstset you can customize the language and appearance of the listing: \lstset{ language=Java, basicstyle=\color{black}\ttfamily, commentstyle=\color{green}\itshape\ttfamily, keywordstyle=\color{blue}\bfseries\ttfamily, showstringspaces=false, frame=single, % boxed listings backgroundcolor=\color{white} } Supported languages: too many to mention. Included are Basic, C, C++, Delphi, Fortran, HTML, Java, Mathematica, Matlab, Pascal, Perl, PHP, SAS, SQL, TeX, VBScript, XML.
November 2008
96/98
November 2008
96/98
November 2008
Exercise
1. insert the picture snowwhite.jpg between the title and the abstract.
97/98
November 2008
98/98
The LaTeX manual, written by Piet van Oostrum. This is available at the sales point of TU/e syllabi. PDF version already on your laptop! A Guide to LaTeX, by Helmut Kopka. ISBN 0-321-17385-6. The LaTeX Companion Second Edition, by Mittelbach and Goossens. ISBN 0-201-36299-6.
TU/e LaTeX FAQ: http://www.win.tue.nl/latex information about a package: Start Menu, MiKTeX group, Documentation, LaTeX Packages Help.
November 2008