Advanced LaTeX
Aubry Verret

October 22, 2013
Macros

Definition

A shorthand command used to abbreviate another
command or series of commands.
A
Fact: LTEX is comprised...
How to write a Macro

Define a macro in the Preamble using:
newcommand{command name}{definition}
How to write a Macro

Define a macro in the Preamble using:
newcommand{command name}{definition}
Example:
newcommand{uva}{Un...
How to write a Macro

Define a macro in the Preamble using:
newcommand{command name}{definition}
Example:
newcommand{uva}{Un...
Macros with Arguments
Specify the number of arguments in square braces:
newcommand{command name}[# args]{definition}
Refer ...
Macros with Arguments
Specify the number of arguments in square braces:
newcommand{command name}[# args]{definition}
Refer ...
Macros with Arguments
Specify the number of arguments in square braces:
newcommand{command name}[# args]{definition}
Refer ...
Macros with Arguments
Specify the number of arguments in square braces:
newcommand{command name}[# args]{definition}
Refer ...
Macros with Math
$$sum_{i=0}^n i^n$$
n

in
i=0

newcommand{sums}{$$sum {i=0}ˆn iˆn$$}
Macros with Math
$$sum_{i=0}^n i^n$$
n

in
i=0

newcommand{sums}{$$sum {i=0}ˆn iˆn$$}
sums
Macros with Math
$$sum_{i=0}^n i^n$$
n

in
i=0

newcommand{sums}{$$sum {i=0}ˆn iˆn$$}
sums
newcommand{sums}[1]{$$sum {i=0}...
Renewcommand

Use renewcommand to redefine an existing command
Renewcommand

Use renewcommand to redefine an existing command
Example:
The emph command italicizes its input.
Renewcommand

Use renewcommand to redefine an existing command
Example:
The emph command italicizes its input.
Suppose you ...
Renewcommand

Use renewcommand to redefine an existing command
Example:
The emph command italicizes its input.
Suppose you ...
Renewcommand

Use renewcommand to redefine an existing command
Example:
The emph command italicizes its input.
Suppose you ...
PerlTeX

PerlTeX allows you to define macros using the Perl programming
language
Download:
http://www.ctan.org/tex-archive/...
Ams-LaTeX
A
Ams-LaTeX is a collection of extensions for LTEX in the form of
document classes and packages designed to enha...
Additional Packages

The Amsthm package provides extensions to the
A
LTEX newtheorem command which include:
Various theore...
Additional Packages

The Amsthm package provides extensions to the
A
LTEX newtheorem command which include:
Various theore...
Additional Packages

The Amsthm package provides extensions to the
A
LTEX newtheorem command which include:
Various theore...
Amsmath Equation Environments - Align

1

begin{align}
x^2 + y^2 & = z^2 nonumber 
x^3 + y^3 & < z^3
end{align}
x2 + y2 = ...
Amsmath Equation Environments - Multline
begin{multline}
lim_{xtoinfty}frac{P(M>x)}{overline{F^s}(x)} 
le limsup_{xtoinfty...
Amsmath Equation Environments - Cases

begin{equation*}
I_A =
begin{cases}
1 & text{if $xin A$}
0 & text{otherwise}
end{ca...
More Environments
Equation - single equation on a single line
Gather - multiple equations with no alignment
Flalign - hori...
Matrix Environments

begin{equation}
begin{matrix}
1 & 0 
0 & 1
end{matrix}
end{equation}
1 0
0 1

(4)
More Matrix Environments
pmatrix
1 0
0 1

(5)

1 0
0 1

(6)

1 0
0 1

(7)

1 0
0 1

(8)

1 0
0 1

(9)

bmatrix

Bmatrix

v...
AMS-LaTeX Assistance

For info on AMS-LaTeX:
http://www.ams.org/tex/amslatex.html
For info on the Amsmath package:
ftp://f...
Headers and Footers
Fancyhdr package creates customizable headers and
footers:
Headers and Footers
Fancyhdr package creates customizable headers and
footers:
 documentclass { a r t i c l e }
 usepackag...
Fancyhdr Output
Fancyhdr Help

You can get assistance with Fancyhdr here:
ftp://ctan.tug.org/tex-archive/macros/latex/
contrib/fancyhdr/fa...
Minipages

The Minipage environment creates miniature pages within
pages.
begin{minipage}...end{minipage}
It is suitable f...
Minipage example
 b e g i n { f i g u r e } [ htbp ]
 centering
 b e g i n { m i n i p a g e } [ b ] { 5 cm}
 centering
 i...
Output

Figure: Science Cat

Figure: Physics Cat
Minipage Example Two
 b e g i n { f i g u r e } [ htbp ]
 centering
 b e g i n { m i n i p a g e } [ b ] { 3 . 3 cm}
 cent...
Figure: Science Cat

Figure: Physics Cat

Figure: Science Cat

Figure: Physics Cat
Fonts
Default Font: Computer modern
Default font size: 10pt
How to change the default font:
Additional fonts are available...
Fonts
Default Font: Computer modern
Default font size: 10pt
How to change the default font:
Additional fonts are available...
Font Size Commands
tiny(5pt)

scriptsize(7pt)

footnotesize(8pt)

small(9pt)

normalsize(10pt)

large(12pt)

Large(14pt)

...
Colored text

Use the xcolor package to add color to your text:
usepackage{xcolor}
Use {color{color name} text} to change ...
Example

{color{red} This text is red!}
This text is red!
Colored Text Background

colorbox{yellow}{This text has a yellow background!}
This text has a yellow background!
More Colors!

Use the [dvipsnames] option when you call the color
environment:
usepackage[dvipsnames]{xcolor}
You can now ...
New Colors
Wrap figure

To wrap text around a figure use the Wrapfig package:
usepackage{wrapfig}
Wrap the figure in the wrapfigure environ...
Wrapfig Example
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam
porttitor rutrum felis eget faucibus. Aliqu...
Output
Compiling multiple .tex files
As your tex file grows, you may find that it becomes more difficult
to manage (compiling starts t...
Compiling multiple .tex files
The problem with input is that the “child” files won’t compile on
their own. The solution is i...
Alternate Output

A
LTEX can directly generate two formats:
dvi Generate using the latex command
pdf Generate using the pd...
Converting from DVI to PDF
Directly (dvi → pdf):

Use dvipdfm.
A
There is a special button for this in most LTEXeditors.
Converting from DVI to PDF
Directly (dvi → pdf):

Use dvipdfm.
A
There is a special button for this in most LTEXeditors.
U...
Converting from DVI to PDF
Directly (dvi → pdf):

Use dvipdfm.
A
There is a special button for this in most LTEXeditors.
U...
Converting from DVI to PDF
Directly (dvi → pdf):

Use dvipdfm.
A
There is a special button for this in most LTEXeditors.
U...
HTML output

A
There are several programs for converting LTEX to HTML:

Hyperlatex Actively maintained to keep up with HTM...
Beamer

It is possible to create sophisticated presentations while
A
harnessing the power of LTEX
The Beamer class produce...
How to Use Beamer

Use beamer as the document class:
documentclass[style]{beamer}
Go here for examples of Beamer styles:
h...
Frames

Beamer uses the Frame environment:
begin{frame}[options]...end{frame}
Frames

Beamer uses the Frame environment:
begin{frame}[options]...end{frame}
Options include:
fragile allows you to inclu...
Example of Frame
How to Make A Table

A
To make a table in LTEX use the tabular environment:

begin{tabular}...end{tabular}
How to Make A Table

A
To make a table in LTEX use the tabular environment:

begin{tabular}...end{tabular}
Separate column...
Tabular Layout

Specify the column layout when you call tabular:
begin{tabular}{l|l|l}
Vertical bars produce vertical line...
Tables
begin{tabular}{ l | l | l }
Class
& Species & Lays eggs? 
mammal & lion
& XSolidBrush 
mammal & tiger
& XSolidBrush...
Tables
Change alignments:
begin{tabular}{| l | r | c | }
Class
& Species & Lays eggs? 
mammal & lion
& XSolidBrush 
mammal...
Tables
Add horizontal lines:
begin{tabular}{| l | r | c | } hline
Class
& Species & Lays eggs?
 hlinehline
mammal & lion
&...
Tables
Not so many:
begin{tabular}{| l | r | c | } hline
Class
& Species & Lays eggs?
 hlinehline
mammal & lion
& XSolidBr...
Tables
Partial hlines
begin{tabular}{| l | r | c | } hline
Class
& Species & Lays eggs?
 hlinehline
mammal & lion
& XSolid...
Tables
Multirow

begin{tabular}{| l | r | c | } hline
Class
& Species & Lays eggs?
 hlinehlin
multirow{3}{*}{mammal}
& lio...
Tables
Color (colortbl package)

begin{tabular}{| l | r | c | } hline
rowcolor[gray]{0.8} Class & Species & Lays eggs?
 hl...
Tables

Better horizontal lines: booktabs package

begin{tabular}{lrc} toprule
Class & Species & Lays eggs?  toprule
multi...
Tables
Better horizontal lines: booktabs package
Class

Species
lion

mammal

tiger
platypus

reptile

iguana
snake

aves
...
Tables

The table enviroment:
begin{table} ... end{table}
allows you to:
Turn a table into a float
Add a caption
Number the...
Tables
table environment

Table: Who lays eggs?

Class

Species
lion

mammal

tiger
platypus

reptile

iguana
snake

aves
...
Tables
Formatting Numbers
begin{tabular}{c r}
Expression & Value  hline
$pi$
&
3.1416  hline
$pi^{pi}$
&
36.46
 hline
$pi^...
Tables
One fix:
begin{tabular}{c r @{.} l}
Expression & multicolumn {2}{c}{Value}  hline
$pi$
&
3 & 1416  hline
$pi^{pi}$
&...
Tables
Another Fix (dcolumn package)
begin{tabular}{cD{,}{.}{5.4}}
Expression & multicolumn {1}{c}{Value}  hline
$pi$
&
3,...
Tables
Another Fix (rccol package)
begin{tabular}{cR[,][.]{5}{3}}
Expression & multicolumn {1}{c}{Value}  hline
$pi$
&
3,1...
Tables
Slashed Boxes (slashbox package)
begin{tabular}{|l|>{$}c<{$}|>{$}c<{$}|} hline
backslashbox{Function}{Argument} & 0...
Tables

Making tables look good...

D
5in
5in
5in
10in
10in
10in

test
test
test
test
test
test

1
2
3
1
2
3

Pu
285
287
2...
Tables
...takes practice.
Table: Maximum load and nominal tension.
D
(in)

Pu
(lbs)

σN
(psi)

5

test 1
test 2
test 3

28...
Where To Get Help

A
Books - LTEXConcisely by Adrian Johnstone
Online - numerous manuals available
Research Computing Lab ...
Upcoming SlideShare
Loading in …5
×

Advanced latex

878 views

Published on

Contains a variety of topics that might be of interest to someone who uses LaTeX frequently including minipages, tables, and Beamer.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
878
On SlideShare
0
From Embeds
0
Number of Embeds
146
Actions
Shares
0
Downloads
29
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Advanced latex

  1. 1. Advanced LaTeX Aubry Verret October 22, 2013
  2. 2. Macros Definition A shorthand command used to abbreviate another command or series of commands. A Fact: LTEX is comprised of numerous macros built on the TEX language.
  3. 3. How to write a Macro Define a macro in the Preamble using: newcommand{command name}{definition}
  4. 4. How to write a Macro Define a macro in the Preamble using: newcommand{command name}{definition} Example: newcommand{uva}{University of Virginia}
  5. 5. How to write a Macro Define a macro in the Preamble using: newcommand{command name}{definition} Example: newcommand{uva}{University of Virginia} Whenever you want ”University of Virginia” to appear you use the uva command.
  6. 6. Macros with Arguments Specify the number of arguments in square braces: newcommand{command name}[# args]{definition} Refer to the arguments as #1, #2, #3, #4 etc. in the definition.
  7. 7. Macros with Arguments Specify the number of arguments in square braces: newcommand{command name}[# args]{definition} Refer to the arguments as #1, #2, #3, #4 etc. in the definition. Example: newcommand{shout}[1]{{Huge{bf {#1}}}
  8. 8. Macros with Arguments Specify the number of arguments in square braces: newcommand{command name}[# args]{definition} Refer to the arguments as #1, #2, #3, #4 etc. in the definition. Example: newcommand{shout}[1]{{Huge{bf {#1}}} Pay Attention!
  9. 9. Macros with Arguments Specify the number of arguments in square braces: newcommand{command name}[# args]{definition} Refer to the arguments as #1, #2, #3, #4 etc. in the definition. Example: newcommand{shout}[1]{{Huge{bf {#1}}} Pay Attention! shout{Pay Attention!}
  10. 10. Macros with Math $$sum_{i=0}^n i^n$$ n in i=0 newcommand{sums}{$$sum {i=0}ˆn iˆn$$}
  11. 11. Macros with Math $$sum_{i=0}^n i^n$$ n in i=0 newcommand{sums}{$$sum {i=0}ˆn iˆn$$} sums
  12. 12. Macros with Math $$sum_{i=0}^n i^n$$ n in i=0 newcommand{sums}{$$sum {i=0}ˆn iˆn$$} sums newcommand{sums}[1]{$$sum {i=0}ˆ#1 iˆ#1$$} sums{5} 5 i5 i=0
  13. 13. Renewcommand Use renewcommand to redefine an existing command
  14. 14. Renewcommand Use renewcommand to redefine an existing command Example: The emph command italicizes its input.
  15. 15. Renewcommand Use renewcommand to redefine an existing command Example: The emph command italicizes its input. Suppose you want to use it instead of the shout command: renewcommand{emph}[1]{{Huge{bf {#1}}}
  16. 16. Renewcommand Use renewcommand to redefine an existing command Example: The emph command italicizes its input. Suppose you want to use it instead of the shout command: renewcommand{emph}[1]{{Huge{bf {#1}}} emph{Pay Attention!}
  17. 17. Renewcommand Use renewcommand to redefine an existing command Example: The emph command italicizes its input. Suppose you want to use it instead of the shout command: renewcommand{emph}[1]{{Huge{bf {#1}}} emph{Pay Attention!} Pay Attention!
  18. 18. PerlTeX PerlTeX allows you to define macros using the Perl programming language Download: http://www.ctan.org/tex-archive/macros/latex/contrib/ perltex/ User Manual: http: //www.tug.org/TUGboat/Articles/tb25-2/tb81pakin.pdf
  19. 19. Ams-LaTeX A Ams-LaTeX is a collection of extensions for LTEX in the form of document classes and packages designed to enhance the typesetting of mathematics. The Amsmath package is an extension of AMS-LaTeX that provides: Superior equation formatting Support for multiline equations Support for better equation numbering Auxilliary packages that provide additional support for displayed equations
  20. 20. Additional Packages The Amsthm package provides extensions to the A LTEX newtheorem command which include: Various theorem styles More control over numbering A proof environment
  21. 21. Additional Packages The Amsthm package provides extensions to the A LTEX newtheorem command which include: Various theorem styles More control over numbering A proof environment The Amssymb package provides additional fonts and symbols:
  22. 22. Additional Packages The Amsthm package provides extensions to the A LTEX newtheorem command which include: Various theorem styles More control over numbering A proof environment The Amssymb package provides additional fonts and symbols:
  23. 23. Amsmath Equation Environments - Align 1 begin{align} x^2 + y^2 & = z^2 nonumber x^3 + y^3 & < z^3 end{align} x2 + y2 = z2 x3 + y3 < z3 (1) Facts: A Better spacing than the LTEX eqnarray environment Use the ”∗” to suppress numbering - begin{array∗} Use nonumber to suppress numbering of individual equations 1 This and all following Amsmath slides adapted from http://www.icms.org.uk/downloads/pgcourses/15october/Zachary.pdf
  24. 24. Amsmath Equation Environments - Multline begin{multline} lim_{xtoinfty}frac{P(M>x)}{overline{F^s}(x)} le limsup_{xtoinfty} frac{P(M>x,,S_{tau_1}>x-R+a-epsilon)}% {overline{F^s}(x)} +gamma left(frac{2-gamma}{(a-epsilon)(1-gamma)^2}right) end{multline} lim x→∞ P(M > x) F s (x) ≤ lim sup x→∞ P(M > x, Sτ1 > x − R + a − ) F s (x) 2−γ +γ (a − )(1 − γ)2 (2)
  25. 25. Amsmath Equation Environments - Cases begin{equation*} I_A = begin{cases} 1 & text{if $xin A$} 0 & text{otherwise} end{cases} end{equation*} IA = 1 0 if x ∈ A otherwise
  26. 26. More Environments Equation - single equation on a single line Gather - multiple equations with no alignment Flalign - horizontally spread version of align Split - split single equations with alignment begin{equation} begin{split} (a + b)^3 &= (a + b) (a + b)^2 &= (a + b)(a^2 + 2ab + b^2) &= a^3 + 3a^2b + 3ab^2 + b^3 end{split} end{equation} (a + b)3 = (a + b)(a + b)2 = (a + b)(a2 + 2ab + b 2 ) = a3 + 3a2 b + 3ab 2 + b 3 (3)
  27. 27. Matrix Environments begin{equation} begin{matrix} 1 & 0 0 & 1 end{matrix} end{equation} 1 0 0 1 (4)
  28. 28. More Matrix Environments pmatrix 1 0 0 1 (5) 1 0 0 1 (6) 1 0 0 1 (7) 1 0 0 1 (8) 1 0 0 1 (9) bmatrix Bmatrix vmatrix Vmatrix
  29. 29. AMS-LaTeX Assistance For info on AMS-LaTeX: http://www.ams.org/tex/amslatex.html For info on the Amsmath package: ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf For info on Amsthm: ftp://ftp.ams.org/pub/tex/doc/amscls/amsthdoc.pdf
  30. 30. Headers and Footers Fancyhdr package creates customizable headers and footers:
  31. 31. Headers and Footers Fancyhdr package creates customizable headers and footers: documentclass { a r t i c l e } usepackage { fancyhdr } pagestyle{ fancyplain } b e g i n { document } l h e a d { Aubry W. V e r r e t } r h e a d { t o d a y } end{ document }
  32. 32. Fancyhdr Output
  33. 33. Fancyhdr Help You can get assistance with Fancyhdr here: ftp://ctan.tug.org/tex-archive/macros/latex/ contrib/fancyhdr/fancyhdr.pdf
  34. 34. Minipages The Minipage environment creates miniature pages within pages. begin{minipage}...end{minipage} It is suitable for: Grouping figures or tables Placement of footnotes attached to images Placing a border around a figure and its title
  35. 35. Minipage example b e g i n { f i g u r e } [ htbp ] centering b e g i n { m i n i p a g e } [ b ] { 5 cm} centering i n c l u d e g r a p h i c s { image 1} c a p t i o n { C a p t i o n 1} end{ m i n i p a g e } b e g i n { m i n i p a g e } [ b ] { 5 cm} centering i n c l u d e g r a p h i c s { image 2} c a p t i o n { C a p t i o n 2} end{ m i n i p a g e } end{ f i g u r e }
  36. 36. Output Figure: Science Cat Figure: Physics Cat
  37. 37. Minipage Example Two b e g i n { f i g u r e } [ htbp ] centering b e g i n { m i n i p a g e } [ b ] { 3 . 3 cm} centering i n c l u d e g r a p h i c s [ s c a l e =.14]{ g r a p h i c s / s c i e n c e c a p t i o n { S c i e n c e Cat } end{ m i n i p a g e } b e g i n { m i n i p a g e } [ b ] { 3 . 3 cm} centering i n c l u d e g r a p h i c s [ s c a l e =.23]{ g r a p h i c s / p h y s i c s c a p t i o n { P h y s i c s Cat } end{ m i n i p a g e } b e g i n { m i n i p a g e } [ b ] { 3 . 3 cm} centering i n c l u d e g r a p h i c s [ s c a l e =.14]{ g r a p h i c s / s c i e n c e c a p t i o n { S c i e n c e Cat } end{ m i n i p a g e } b e g i n { m i n i p a g e } [ b ] { 3 . 3 cm} centering i n c l u d e g r a p h i c s [ s c a l e =.23]{ g r a p h i c s / p h y s i c s c a p t i o n { P h y s i c s Cat } end{ m i n i p a g e } end{ f i g u r e } cat } cat } cat } cat }
  38. 38. Figure: Science Cat Figure: Physics Cat Figure: Science Cat Figure: Physics Cat
  39. 39. Fonts Default Font: Computer modern Default font size: 10pt How to change the default font: Additional fonts are available for installation (http://www.tug.dk/FontCatalogue/)
  40. 40. Fonts Default Font: Computer modern Default font size: 10pt How to change the default font: Additional fonts are available for installation (http://www.tug.dk/FontCatalogue/) How to change the default font size: documentclass command accepts [11pt] and [12pt] as options fix-cm package overrides font size defaults special commands
  41. 41. Font Size Commands tiny(5pt) scriptsize(7pt) footnotesize(8pt) small(9pt) normalsize(10pt) large(12pt) Large(14pt) LARGE(18pt) huge(20pt) Huge(24pt)
  42. 42. Colored text Use the xcolor package to add color to your text: usepackage{xcolor} Use {color{color name} text} to change the text color. Predefined colors include: black, white, red, yellow, blue, green, cyan, magenta
  43. 43. Example {color{red} This text is red!} This text is red!
  44. 44. Colored Text Background colorbox{yellow}{This text has a yellow background!} This text has a yellow background!
  45. 45. More Colors! Use the [dvipsnames] option when you call the color environment: usepackage[dvipsnames]{xcolor} You can now access 68 more colors!
  46. 46. New Colors
  47. 47. Wrap figure To wrap text around a figure use the Wrapfig package: usepackage{wrapfig} Wrap the figure in the wrapfigure environment: begin{wrapfigure}{alignment}{width}...end{wrapfigure} alignment Either l (left) or r (right) width Width of image
  48. 48. Wrapfig Example Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam porttitor rutrum felis eget faucibus. Aliquam erat volutpat. Duis commodo, libero nec adipiscing pellentesque, risus velit faucibus augue, eget molestie nibh risus et augue. b e g i n { w r a p f i g u r e }{ l }{40mm} begin { center } includegraphics { far side } end{ c e n t e r } caption { Einstein } end{ w r a p f i g u r e } Integer quis tristique est. Pellentesque lacinia mi mattis ipsum rutrum egestas. Aliquam vestibulum pharetra felis, in congue eros posuere ac.
  49. 49. Output
  50. 50. Compiling multiple .tex files As your tex file grows, you may find that it becomes more difficult to manage (compiling starts to take a long time, it gets hard to find things, bugs are harder to find, etc.) The solution: write several files sepearately and compile them toether at the end. Use the input command to read each “child” file into your “root” document... input{child1.tex} input{child2.tex} input{child3.tex}
  51. 51. Compiling multiple .tex files The problem with input is that the “child” files won’t compile on their own. The solution is in the subfile package. In the ”root” document the package must be loaded as: usepackage{subfiles} Instead of using input, ”child” documents must be loaded as follows: subfile{child} The ”child” documents must start with the following statements: documentclass[rootdocument.tex]{subfiles} begin{document} and end with: end{document}
  52. 52. Alternate Output A LTEX can directly generate two formats: dvi Generate using the latex command pdf Generate using the pdflatex command dvi supports only the eps image format pdf supports jpg, png, pdf image formats
  53. 53. Converting from DVI to PDF Directly (dvi → pdf): Use dvipdfm. A There is a special button for this in most LTEXeditors.
  54. 54. Converting from DVI to PDF Directly (dvi → pdf): Use dvipdfm. A There is a special button for this in most LTEXeditors. Use this if the original file contains postscript figures
  55. 55. Converting from DVI to PDF Directly (dvi → pdf): Use dvipdfm. A There is a special button for this in most LTEXeditors. Use this if the original file contains postscript figures Indirectly (dvi → ps → pdf): Use dvips, then sp2pdf
  56. 56. Converting from DVI to PDF Directly (dvi → pdf): Use dvipdfm. A There is a special button for this in most LTEXeditors. Use this if the original file contains postscript figures Indirectly (dvi → ps → pdf): Use dvips, then sp2pdf typically ineffecient and can produce larger files of lower quality
  57. 57. HTML output A There are several programs for converting LTEX to HTML: Hyperlatex Actively maintained to keep up with HTML standards TTH Good at formula conversion Heava Good overall, written in O Caml LaTeX2HTML Not well maintained text4ht Difficult to configure but produces good output
  58. 58. Beamer It is possible to create sophisticated presentations while A harnessing the power of LTEX The Beamer class produces presentations that: Can be easily cutomized Contain overlays Can display sophisitcated mathematics Are easily converted to handouts Compile directly to PDF
  59. 59. How to Use Beamer Use beamer as the document class: documentclass[style]{beamer} Go here for examples of Beamer styles: http://mike.depalatis.net/beamerthemes/
  60. 60. Frames Beamer uses the Frame environment: begin{frame}[options]...end{frame}
  61. 61. Frames Beamer uses the Frame environment: begin{frame}[options]...end{frame} Options include: fragile allows you to include text using the verbatim or listings packages on a slide allowframebreaks allows Beamer to create extra slides to handle overflow text shrink shrinks contents to fit on one slide
  62. 62. Example of Frame
  63. 63. How to Make A Table A To make a table in LTEX use the tabular environment: begin{tabular}...end{tabular}
  64. 64. How to Make A Table A To make a table in LTEX use the tabular environment: begin{tabular}...end{tabular} Separate columns with the ”&” symbol Separate rows with the double backslash ””
  65. 65. Tabular Layout Specify the column layout when you call tabular: begin{tabular}{l|l|l} Vertical bars produce vertical lines between columns. Alignment Symbols l - align left r - align right c - centered
  66. 66. Tables begin{tabular}{ l | l | l } Class & Species & Lays eggs? mammal & lion & XSolidBrush mammal & tiger & XSolidBrush mammal & platypus & Checkmark reptile & iguana & Checkmark reptile & snake & Checkmark aves & flamingo & Checkmark end{tabular} Class mammal mammal mammal reptile reptile aves Species lion tiger platypus iguana snake flamingo Lays eggs? % % ! ! ! !
  67. 67. Tables Change alignments: begin{tabular}{| l | r | c | } Class & Species & Lays eggs? mammal & lion & XSolidBrush mammal & tiger & XSolidBrush mammal & platypus & Checkmark reptile & iguana & Checkmark reptile & snake & Checkmark aves & flamingo & Checkmark end{tabular} Class mammal mammal mammal reptile reptile aves Species lion tiger platypus iguana snake flamingo Lays eggs? % % ! ! ! !
  68. 68. Tables Add horizontal lines: begin{tabular}{| l | r | c | } hline Class & Species & Lays eggs? hlinehline mammal & lion & XSolidBrush hline mammal & tiger & XSolidBrush hline mammal & platypus & Checkmark hline reptile & iguana & Checkmark hline reptile & snake & Checkmark hline aves & flamingo & Checkmark hline end{tabular} Class mammal mammal mammal reptile reptile aves Species lion tiger platypus iguana snake flamingo Lays eggs? % % ! ! ! !
  69. 69. Tables Not so many: begin{tabular}{| l | r | c | } hline Class & Species & Lays eggs? hlinehline mammal & lion & XSolidBrush & tiger & XSolidBrush & platypus & Checkmark hline reptile & iguana & Checkmark & snake & Checkmark hline aves & flamingo & Checkmark hline end{tabular} Class mammal reptile aves Species lion tiger platypus iguana snake flamingo Lays eggs? % % ! ! ! !
  70. 70. Tables Partial hlines begin{tabular}{| l | r | c | } hline Class & Species & Lays eggs? hlinehline mammal & lion & XSolidBrush cline{2-3} & tiger & XSolidBrush cline{2-3} & platypus & Checkmark hline reptile & iguana & Checkmark cline{2-3} & snake & Checkmark hline aves & flamingo & Checkmark hline end{tabular} Class mammal reptile aves Species lion tiger platypus iguana snake flamingo Lays eggs? % % ! ! ! !
  71. 71. Tables Multirow begin{tabular}{| l | r | c | } hline Class & Species & Lays eggs? hlinehlin multirow{3}{*}{mammal} & lion & XSolidBrush cline{2-3 & tiger & XSolidBrush cline{2-3} & platypus & Checkmark hline multirow{2}{*}{reptile} & iguana & Checkmark cline{2-3} & snake & Checkmark hline aves & flamingo & Checkmark hl end{tabular} Class mammal reptile aves Species lion tiger platypus iguana snake flamingo Lays eggs? % % ! ! ! !
  72. 72. Tables Color (colortbl package) begin{tabular}{| l | r | c | } hline rowcolor[gray]{0.8} Class & Species & Lays eggs? hlinehl multirow{3}{*}{mammal} & lion & XSolidBrush cline{2-3 & tiger & XSolidBrush cline{2-3} & platypus & Checkmark hline multirow{2}{*}{reptile} & iguana & Checkmark cline{2-3} & snake & Checkmark hline aves & flamingo & Checkmark hl end{tabular} Class mammal reptile aves Species lion tiger platypus iguana snake flamingo Lays eggs? % % ! ! ! !
  73. 73. Tables Better horizontal lines: booktabs package begin{tabular}{lrc} toprule Class & Species & Lays eggs? toprule multirow{3}{*}{mammal} & lion & XSolidBrush cmidrule{2-3 & tiger & XSolidBrush cmidrule{2-3} & platypus & Checkmark midrule multirow{2}{*}{reptile}& iguana& Checkmark cmidrule{2-3} & snake & Checkmark midrule aves & flamingo& Checkmark botto end{tabular}
  74. 74. Tables Better horizontal lines: booktabs package Class Species lion mammal tiger platypus reptile iguana snake aves flamingo Lays eggs? % % ! ! ! !
  75. 75. Tables The table enviroment: begin{table} ... end{table} allows you to: Turn a table into a float Add a caption Number the table for referencing
  76. 76. Tables table environment Table: Who lays eggs? Class Species lion mammal tiger platypus reptile iguana snake aves flamingo Lays eggs? % % ! ! ! !
  77. 77. Tables Formatting Numbers begin{tabular}{c r} Expression & Value hline $pi$ & 3.1416 hline $pi^{pi}$ & 36.46 hline $pi^{pi^{pi}}$ & 80662.7 hline end{tabular} Expression π ππ π ππ Value 3.1416 36.46 80662.7
  78. 78. Tables One fix: begin{tabular}{c r @{.} l} Expression & multicolumn {2}{c}{Value} hline $pi$ & 3 & 1416 hline $pi^{pi}$ & 36 & 46 hline $pi^{pi^{pi}}$ & 80662 & 7 hline end{tabular} Expression π ππ π ππ Value 3.1416 36.46 80662.7
  79. 79. Tables Another Fix (dcolumn package) begin{tabular}{cD{,}{.}{5.4}} Expression & multicolumn {1}{c}{Value} hline $pi$ & 3,1416 hline $pi^{pi}$ & 36,46 hline $pi^{pi^{pi}}$ & 80662,7 hline end{tabular} Expression π ππ π ππ Value 3.1416 36.46 80662.7
  80. 80. Tables Another Fix (rccol package) begin{tabular}{cR[,][.]{5}{3}} Expression & multicolumn {1}{c}{Value} hline $pi$ & 3,1416 hline $pi^{pi}$ & 36,46 hline $pi^{pi^{pi}}$ & 80662,7 hline end{tabular} Expression π ππ π ππ Value 3.142 36.460 80662.700
  81. 81. Tables Slashed Boxes (slashbox package) begin{tabular}{|l|>{$}c<{$}|>{$}c<{$}|} hline backslashbox{Function}{Argument} & 0 & pi/2 hline $sin$ & 0 & 1 hline $cos$ & 1 & 0 hline end{tabular} ``` ``` Argument ``` 0 π/2 ``` Function sin 0 1 cos 1 0
  82. 82. Tables Making tables look good... D 5in 5in 5in 10in 10in 10in test test test test test test 1 2 3 1 2 3 Pu 285 287 230 430 433 431 lb lb lb lb lb lb σN 38.200 psi 38.27 psi 30.67 psi 248.67 psi 28.8 psi 28.7334 psi
  83. 83. Tables ...takes practice. Table: Maximum load and nominal tension. D (in) Pu (lbs) σN (psi) 5 test 1 test 2 test 3 285 287 230 38.00 38.27 30.67 10 test 1 test 2 test 3 430 433 431 28.67 28.87 28.73
  84. 84. Where To Get Help A Books - LTEXConcisely by Adrian Johnstone Online - numerous manuals available Research Computing Lab www2.lib.virginia.edu/brown/rescomp/ help/index.html

×