advanced latex
DESCRIPTION
Contains a variety of topics that might be of interest to someone who uses LaTeX frequently including minipages, tables, and Beamer.TRANSCRIPT
![Page 1: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/1.jpg)
Advanced LaTeX
Aubry Verret
October 22, 2013
![Page 2: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/2.jpg)
Macros
Definition
A shorthand command used to abbreviate anothercommand or series of commands.
Fact: LATEX is comprised of numerous macros builton the TEX language.
![Page 3: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/3.jpg)
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 usethe \uva command.
![Page 4: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/4.jpg)
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 usethe \uva command.
![Page 5: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/5.jpg)
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 usethe \uva command.
![Page 6: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/6.jpg)
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 thedefinition.
Example:
\newcommand{\shout}[1]{{\Huge{\bf {#1}}}
Pay Attention!\shout{Pay Attention!}
![Page 7: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/7.jpg)
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 thedefinition.
Example:
\newcommand{\shout}[1]{{\Huge{\bf {#1}}}
Pay Attention!\shout{Pay Attention!}
![Page 8: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/8.jpg)
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 thedefinition.
Example:
\newcommand{\shout}[1]{{\Huge{\bf {#1}}}
Pay Attention!
\shout{Pay Attention!}
![Page 9: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/9.jpg)
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 thedefinition.
Example:
\newcommand{\shout}[1]{{\Huge{\bf {#1}}}
Pay Attention!\shout{Pay Attention!}
![Page 10: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/10.jpg)
Macros with Math
$$\sum_{i=0}^n i^n$$
n∑i=0
in
\newcommand{sums}{$$\sum {i=0}ˆn iˆn$$}
\sums
\newcommand{sums}[1]{$$\sum {i=0}ˆ#1 iˆ#1$$}
\sums{5}5∑
i=0
i5
![Page 11: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/11.jpg)
Macros with Math
$$\sum_{i=0}^n i^n$$
n∑i=0
in
\newcommand{sums}{$$\sum {i=0}ˆn iˆn$$}
\sums
\newcommand{sums}[1]{$$\sum {i=0}ˆ#1 iˆ#1$$}
\sums{5}5∑
i=0
i5
![Page 12: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/12.jpg)
Macros with Math
$$\sum_{i=0}^n i^n$$
n∑i=0
in
\newcommand{sums}{$$\sum {i=0}ˆn iˆn$$}
\sums
\newcommand{sums}[1]{$$\sum {i=0}ˆ#1 iˆ#1$$}
\sums{5}5∑
i=0
i5
![Page 13: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/13.jpg)
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!
![Page 14: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/14.jpg)
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!
![Page 15: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/15.jpg)
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!
![Page 16: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/16.jpg)
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!
![Page 17: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/17.jpg)
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!
![Page 18: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/18.jpg)
PerlTeX
PerlTeX allows you to define macros using the Perl programminglanguage
Download:
http://www.ctan.org/tex-archive/macros/latex/contrib/
perltex/
User Manual:http:
//www.tug.org/TUGboat/Articles/tb25-2/tb81pakin.pdf
![Page 19: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/19.jpg)
Ams-LaTeX
Ams-LaTeX is a collection of extensions for LATEX in the form ofdocument classes and packages designed to enhance thetypesetting of mathematics.
The Amsmath package is an extension of AMS-LaTeX thatprovides:
I Superior equation formatting
I Support for multiline equations
I Support for better equation numbering
I Auxilliary packages that provide additional support fordisplayed equations
![Page 20: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/20.jpg)
Additional Packages
The Amsthm package provides extensions to theLATEX \newtheorem command which include:
I Various theorem styles
I More control over numbering
I A proof environment
The Amssymb package provides additional fonts and symbols:
![Page 21: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/21.jpg)
Additional Packages
The Amsthm package provides extensions to theLATEX \newtheorem command which include:
I Various theorem styles
I More control over numbering
I A proof environment
The Amssymb package provides additional fonts and symbols:
![Page 22: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/22.jpg)
Additional Packages
The Amsthm package provides extensions to theLATEX \newtheorem command which include:
I Various theorem styles
I More control over numbering
I A proof environment
The Amssymb package provides additional fonts and symbols:
![Page 23: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/23.jpg)
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:
I Better spacing than the LATEX eqnarray environment
I Use the ”∗” to suppress numbering - \begin{array∗}I Use \nonumber to suppress numbering of individual equations
1This and all following Amsmath slides adapted fromhttp://www.icms.org.uk/downloads/pgcourses/15october/Zachary.pdf
![Page 24: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/24.jpg)
Amsmath Equation Environments - Multline
\begin{multline}
\lim_{x\to\infty}\frac{P(M>x)}{\overline{F^s}(x)} \\
\le \limsup_{x\to\infty}
\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}
limx→∞
P(M > x)
F s(x)
≤ lim supx→∞
P(M > x , Sτ1 > x − R + a− ε)F s(x)
+ γ
(2− γ
(a− ε)(1− γ)2
)(2)
![Page 25: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/25.jpg)
Amsmath Equation Environments - Cases
\begin{equation*}
I_A =
\begin{cases}
1 & \text{if $x\in A$}\\
0 & \text{otherwise}
\end{cases}
\end{equation*}
IA =
{1 if x ∈ A
0 otherwise
![Page 26: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/26.jpg)
More Environments
I Equation - single equation on a single line
I Gather - multiple equations with no alignment
I Flalign - horizontally spread version of align
I 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 + b2)
= a3 + 3a2b + 3ab2 + b3(3)
![Page 27: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/27.jpg)
Matrix Environments
\begin{equation}
\begin{matrix}
1 & 0 \\
0 & 1
\end{matrix}
\end{equation}
1 00 1
(4)
![Page 28: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/28.jpg)
More Matrix Environments
I pmatrix (1 00 1
)(5)
I bmatrix [1 00 1
](6)
I Bmatrix {1 00 1
}(7)
I vmatrix ∣∣∣∣1 00 1
∣∣∣∣ (8)
I Vmatrix ∥∥∥∥1 00 1
∥∥∥∥ (9)
![Page 29: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/29.jpg)
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
![Page 30: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/30.jpg)
Headers and Footers
Fancyhdr package creates customizable headers andfooters:
\ d o c u m e n t c l a s s { a r t i c l e }\ u s e p a c k a g e { f a n c y h d r }\ p a g e s t y l e { f a n c y p l a i n }
\ b e g i n {document}
\ l h e a d {Aubry W. V e r r e t }\ r h e a d {\ today }
\end{document}
![Page 31: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/31.jpg)
Headers and Footers
Fancyhdr package creates customizable headers andfooters:
\ d o c u m e n t c l a s s { a r t i c l e }\ u s e p a c k a g e { f a n c y h d r }\ p a g e s t y l e { f a n c y p l a i n }
\ b e g i n {document}
\ l h e a d {Aubry W. V e r r e t }\ r h e a d {\ today }
\end{document}
![Page 32: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/32.jpg)
Fancyhdr Output
![Page 33: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/33.jpg)
Fancyhdr Help
You can get assistance with Fancyhdr here:
ftp://ctan.tug.org/tex-archive/macros/latex/
contrib/fancyhdr/fancyhdr.pdf
![Page 34: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/34.jpg)
Minipages
The Minipage environment creates miniature pages withinpages.
\begin{minipage}...\end{minipage}
It is suitable for:
I Grouping figures or tables
I Placement of footnotes attached to images
I Placing a border around a figure and its title
![Page 35: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/35.jpg)
Minipage example
\ b e g i n { f i g u r e } [ htbp ]\ center ing\ b e g i n {min ipage } [ b ]{5 cm}\ center ing\ i n c l u d e g r a p h i c s { image 1}\ c a p t i o n {Capt ion 1}
\end{min ipage }\ b e g i n {min ipage } [ b ]{5 cm}\ center ing\ i n c l u d e g r a p h i c s { image 2}\ c a p t i o n {Capt ion 2}
\end{min ipage }\end{ f i g u r e }
![Page 36: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/36.jpg)
Output
Figure: Science Cat Figure: Physics Cat
![Page 37: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/37.jpg)
Minipage Example Two\ b e g i n { f i g u r e } [ htbp ]\ center ing\ b e g i n {min ipage } [ b ] { 3 . 3 cm}\ center ing\ 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 t }\ c a p t i o n { S c i e n c e Cat}
\end{min ipage }\ b e g i n {min ipage } [ b ] { 3 . 3 cm}\ center ing\ 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 t }\ c a p t i o n { P h y s i c s Cat}
\end{min ipage }\ b e g i n {min ipage } [ b ] { 3 . 3 cm}\ center ing\ 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 t }\ c a p t i o n { S c i e n c e Cat}
\end{min ipage }\ b e g i n {min ipage } [ b ] { 3 . 3 cm}\ center ing\ 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 t }\ c a p t i o n { P h y s i c s Cat}
\end{min ipage }\end{ f i g u r e }
![Page 38: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/38.jpg)
Figure: Science Cat Figure: Physics Cat
Figure: Science Cat Figure: Physics Cat
![Page 39: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/39.jpg)
Fonts
Default Font: Computer modern
Default font size: 10pt
How to change the default font:
I Additional fonts are available for installation(http://www.tug.dk/FontCatalogue/)
How to change the default font size:
I \documentclass command accepts [11pt] and [12pt] as options
I fix-cm package overrides font size defaults
I special commands
![Page 40: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/40.jpg)
Fonts
Default Font: Computer modern
Default font size: 10pt
How to change the default font:
I Additional fonts are available for installation(http://www.tug.dk/FontCatalogue/)
How to change the default font size:
I \documentclass command accepts [11pt] and [12pt] as options
I fix-cm package overrides font size defaults
I special commands
![Page 41: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/41.jpg)
Font Size Commands
\tiny(5pt)
\scriptsize(7pt)
\footnotesize(8pt)
\small(9pt)
\normalsize(10pt)
\large(12pt)
\Large(14pt)
\LARGE(18pt)
\huge(20pt)\Huge(24pt)
![Page 42: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/42.jpg)
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
![Page 43: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/43.jpg)
Example
{\color{red} This text is red!}
This text is red!
![Page 44: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/44.jpg)
Colored Text Background
\colorbox{yellow}{This text has a yellow background!}
This text has a yellow background!
![Page 45: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/45.jpg)
More Colors!
Use the [dvipsnames] option when you call the colorenvironment:
\usepackage[dvipsnames]{xcolor}
You can now access 68 more colors!
![Page 46: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/46.jpg)
New Colors
![Page 47: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/47.jpg)
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
![Page 48: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/48.jpg)
Wrapfig Example
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullamporttitor rutrum felis eget faucibus. Aliquam erat volutpat. Duiscommodo, libero nec adipiscing pellentesque, risus velit faucibusaugue, eget molestie nibh risus et augue.
\ b e g i n {w r a p f i g u r e }{ l }{40mm}\ b e g i n { c e n t e r }\ i n c l u d e g r a p h i c s { f a r s i d e }
\end{ c e n t e r }\ c a p t i o n { E i n s t e i n }
\end{w r a p f i g u r e }
Integer quis tristique est. Pellentesque lacinia mi mattis ipsumrutrum egestas. Aliquam vestibulum pharetra felis, in congue erosposuere ac.
![Page 49: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/49.jpg)
Output
![Page 50: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/50.jpg)
Compiling multiple .tex files
As your tex file grows, you may find that it becomes more difficultto manage (compiling starts to take a long time, it gets hard tofind things, bugs are harder to find, etc.)
The solution: write several files sepearately and compile themtoether 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}
![Page 51: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/51.jpg)
Compiling multiple .tex filesThe problem with \input is that the “child” files won’t compile ontheir 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 asfollows:
\subfile{child}
The ”child” documents must start with the following statements:
\documentclass[rootdocument.tex]{subfiles}
\begin{document}
and end with:
\end{document}
![Page 52: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/52.jpg)
Alternate Output
LATEX 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
![Page 53: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/53.jpg)
Converting from DVI to PDF
Directly (dvi → pdf):
Use dvipdfm.
There is a special button for this in most LATEXeditors.
I Use this if the original file contains postscript figures
Indirectly (dvi → ps → pdf):
Use dvips, then sp2pdf
I typically ineffecient and can produce larger files of lowerquality
![Page 54: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/54.jpg)
Converting from DVI to PDF
Directly (dvi → pdf):
Use dvipdfm.
There is a special button for this in most LATEXeditors.
I Use this if the original file contains postscript figures
Indirectly (dvi → ps → pdf):
Use dvips, then sp2pdf
I typically ineffecient and can produce larger files of lowerquality
![Page 55: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/55.jpg)
Converting from DVI to PDF
Directly (dvi → pdf):
Use dvipdfm.
There is a special button for this in most LATEXeditors.
I Use this if the original file contains postscript figures
Indirectly (dvi → ps → pdf):
Use dvips, then sp2pdf
I typically ineffecient and can produce larger files of lowerquality
![Page 56: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/56.jpg)
Converting from DVI to PDF
Directly (dvi → pdf):
Use dvipdfm.
There is a special button for this in most LATEXeditors.
I Use this if the original file contains postscript figures
Indirectly (dvi → ps → pdf):
Use dvips, then sp2pdf
I typically ineffecient and can produce larger files of lowerquality
![Page 57: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/57.jpg)
HTML output
There are several programs for converting LATEX to HTML:
Hyperlatex Actively maintained to keep up with HTMLstandards
TTH Good at formula conversion
Heava Good overall, written in O Caml
LaTeX2HTML Not well maintained
text4ht Difficult to configure but produces good output
![Page 58: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/58.jpg)
Beamer
It is possible to create sophisticated presentations whileharnessing the power of LATEX
The Beamer class produces presentations that:
I Can be easily cutomized
I Contain overlays
I Can display sophisitcated mathematics
I Are easily converted to handouts
I Compile directly to PDF
![Page 59: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/59.jpg)
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/
![Page 60: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/60.jpg)
Frames
Beamer uses the Frame environment:
\begin{frame}[options]...\end{frame}
Options include:
I fragile allows you to include text using the verbatim orlistings packages on a slide
I allowframebreaks allows Beamer to create extra slides tohandle overflow text
I shrink shrinks contents to fit on one slide
![Page 61: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/61.jpg)
Frames
Beamer uses the Frame environment:
\begin{frame}[options]...\end{frame}
Options include:
I fragile allows you to include text using the verbatim orlistings packages on a slide
I allowframebreaks allows Beamer to create extra slides tohandle overflow text
I shrink shrinks contents to fit on one slide
![Page 62: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/62.jpg)
Example of Frame
![Page 63: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/63.jpg)
How to Make A Table
To make a table in LATEX use the tabular environment:
\begin{tabular}...\end{tabular}
Separate columns with the ”&” symbol
Separate rows with the double backslash ”\\”
![Page 64: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/64.jpg)
How to Make A Table
To make a table in LATEX use the tabular environment:
\begin{tabular}...\end{tabular}
Separate columns with the ”&” symbol
Separate rows with the double backslash ”\\”
![Page 65: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/65.jpg)
Tabular Layout
Specify the column layout when you call tabular:
\begin{tabular}{l|l|l}
Vertical bars produce vertical lines between columns.
Alignment Symbols
I l - align left
I r - align right
I c - centered
![Page 66: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/66.jpg)
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 Species Lays eggs?
mammal lion %
mammal tiger %
mammal platypus !
reptile iguana !
reptile snake !
aves flamingo !
![Page 67: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/67.jpg)
TablesChange 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 Species Lays eggs?
mammal lion %
mammal tiger %
mammal platypus !
reptile iguana !
reptile snake !
aves flamingo !
![Page 68: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/68.jpg)
TablesAdd horizontal lines:
\begin{tabular}{| l | r | c | } \hline
Class & Species & Lays eggs? \\ \hline\hline
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 Species Lays eggs?
mammal lion %
mammal tiger %
mammal platypus !
reptile iguana !
reptile snake !
aves flamingo !
![Page 69: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/69.jpg)
TablesNot so many:
\begin{tabular}{| l | r | c | } \hline
Class & Species & Lays eggs? \\ \hline\hline
mammal & lion & \XSolidBrush \\
& tiger & \XSolidBrush \\
& platypus & \Checkmark \\ \hline
reptile & iguana & \Checkmark \\
& snake & \Checkmark \\ \hline
aves & flamingo & \Checkmark \\ \hline
\end{tabular}
Class Species Lays eggs?
mammal lion %
tiger %
platypus !
reptile iguana !
snake !
aves flamingo !
![Page 70: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/70.jpg)
TablesPartial hlines
\begin{tabular}{| l | r | c | } \hline
Class & Species & Lays eggs? \\ \hline\hline
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 Species Lays eggs?
mammal lion %
tiger %
platypus !
reptile iguana !
snake !
aves flamingo !
![Page 71: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/71.jpg)
TablesMultirow
\begin{tabular}{| l | r | c | } \hline
Class & Species & Lays eggs? \\ \hline\hline
\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 \\ \hline
\end{tabular}
Class Species Lays eggs?
mammallion %
tiger %
platypus !
reptileiguana !
snake !
aves flamingo !
![Page 72: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/72.jpg)
TablesColor (colortbl package)
\begin{tabular}{| l | r | c | } \hline
\rowcolor[gray]{0.8} Class & Species & Lays eggs? \\ \hline\hline
\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 \\ \hline
\end{tabular}
Class Species Lays eggs?
mammallion %
tiger %
platypus !
reptileiguana !
snake !
aves flamingo !
![Page 73: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/73.jpg)
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 \\ \bottomrule
\end{tabular}
![Page 74: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/74.jpg)
Tables
Better horizontal lines: booktabs package
Class Species Lays eggs?
mammallion %
tiger %
platypus !
reptileiguana !
snake !
aves flamingo !
![Page 75: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/75.jpg)
Tables
The table enviroment:
\begin{table} ... \end{table}
allows you to:
I Turn a table into a float
I Add a caption
I Number the table for referencing
![Page 76: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/76.jpg)
Tables
table environment
Table: Who lays eggs?
Class Species Lays eggs?
mammallion %
tiger %
platypus !
reptileiguana !
snake !
aves flamingo !
![Page 77: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/77.jpg)
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
![Page 78: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/78.jpg)
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
![Page 79: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/79.jpg)
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
![Page 80: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/80.jpg)
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
![Page 81: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/81.jpg)
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}
````````````FunctionArgument
0 π/2
sin 0 1cos 1 0
![Page 82: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/82.jpg)
Tables
Making tables look good...
D Pu σN5in test 1 285 lb 38.200 psi5in test 2 287 lb 38.27 psi5in test 3 230 lb 30.67 psi10in test 1 430 lb 248.67 psi10in test 2 433 lb 28.8 psi10in test 3 431 lb 28.7334 psi
![Page 83: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/83.jpg)
Tables
...takes practice.
Table: Maximum load and nominal tension.
D Pu σN(in) (lbs) (psi)
5test 1 285 38.00test 2 287 38.27test 3 230 30.67
10test 1 430 28.67test 2 433 28.87test 3 431 28.73
![Page 84: Advanced latex](https://reader036.vdocuments.site/reader036/viewer/2022082310/540504038d7f729b768b4a3a/html5/thumbnails/84.jpg)
Where To Get Help
I Books - LATEXConcisely by Adrian Johnstone
I Online - numerous manuals available
I Research Computing Lab -www2.lib.virginia.edu/brown/rescomp/
help/index.html