SlideShare a Scribd company logo
1 of 84
Download to read offline
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 of numerous macros built
on the TEX language.
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}{University of Virginia}
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.
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.
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}}}
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!
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!}
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}ˆ#1 iˆ#1$$}
sums{5}
5

i5
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 want to use it instead of the shout command:
renewcommand{emph}[1]{{Huge{bf {#1}}}
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!}
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!
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
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
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
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:
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:
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
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)
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
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)
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

vmatrix

Vmatrix
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
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 }
 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 }
Fancyhdr Output
Fancyhdr Help

You can get assistance with Fancyhdr here:
ftp://ctan.tug.org/tex-archive/macros/latex/
contrib/fancyhdr/fancyhdr.pdf
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
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 }
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}
 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 }
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 for installation
(http://www.tug.dk/FontCatalogue/)
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
Font Size Commands
tiny(5pt)

scriptsize(7pt)

footnotesize(8pt)

small(9pt)

normalsize(10pt)

large(12pt)

Large(14pt)

LARGE(18pt)

huge(20pt)

Huge(24pt)
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
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 access 68 more colors!
New Colors
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
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.
Output
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}
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}
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
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.
Use this if the original file contains postscript figures
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
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
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
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
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/
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 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
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 columns with the ”&” symbol
Separate rows with the double backslash ””
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
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?

%
%
!
!
!
!
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?

%
%
!
!
!
!
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?

%
%
!
!
!
!
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?

%
%
!
!
!
!
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?

%
%
!
!
!
!
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?

%
%
!
!
!
!
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?

%
%
!
!
!
!
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}
Tables
Better horizontal lines: booktabs package
Class

Species
lion

mammal

tiger
platypus

reptile

iguana
snake

aves

flamingo

Lays eggs?

%
%
!
!
!
!
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
Tables
table environment

Table: Who lays eggs?

Class

Species
lion

mammal

tiger
platypus

reptile

iguana
snake

aves

flamingo

Lays eggs?

%
%
!
!
!
!
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
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
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
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
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
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
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
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

More Related Content

What's hot

Lenguaje De Programacion
Lenguaje De ProgramacionLenguaje De Programacion
Lenguaje De Programacionmilko09
 
CIS110 Computer Programming Design Chapter (1)
CIS110 Computer Programming Design Chapter  (1)CIS110 Computer Programming Design Chapter  (1)
CIS110 Computer Programming Design Chapter (1)Dr. Ahmed Al Zaidy
 
Procedimiento Para Utilizar Flex Y Bison
Procedimiento Para Utilizar Flex Y Bison Procedimiento Para Utilizar Flex Y Bison
Procedimiento Para Utilizar Flex Y Bison Raul Hernandez Mayo
 
Features of 'c' program
Features of 'c' programFeatures of 'c' program
Features of 'c' programveer patel
 
Fundamentos de programación.pptx
Fundamentos de programación.pptxFundamentos de programación.pptx
Fundamentos de programación.pptxWaldirOzuna2
 
Conceptos Basicos Programacion
Conceptos Basicos ProgramacionConceptos Basicos Programacion
Conceptos Basicos ProgramacionMichele André
 
Presentación pseudocódigo
Presentación pseudocódigoPresentación pseudocódigo
Presentación pseudocódigoStudent
 
Conceptos basicos de la programacion
Conceptos basicos de la programacionConceptos basicos de la programacion
Conceptos basicos de la programacionyamy matin
 
Programming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f cProgramming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f cRaja Hamid
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practicesfelixbillon
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test frameworkAbner Chih Yi Huang
 

What's hot (20)

3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
 
C language
C languageC language
C language
 
Algorithms KS1 & KS2
Algorithms KS1 & KS2Algorithms KS1 & KS2
Algorithms KS1 & KS2
 
Lenguaje De Programacion
Lenguaje De ProgramacionLenguaje De Programacion
Lenguaje De Programacion
 
CIS110 Computer Programming Design Chapter (1)
CIS110 Computer Programming Design Chapter  (1)CIS110 Computer Programming Design Chapter  (1)
CIS110 Computer Programming Design Chapter (1)
 
Procedimiento Para Utilizar Flex Y Bison
Procedimiento Para Utilizar Flex Y Bison Procedimiento Para Utilizar Flex Y Bison
Procedimiento Para Utilizar Flex Y Bison
 
Features of 'c' program
Features of 'c' programFeatures of 'c' program
Features of 'c' program
 
Fundamentos de programación.pptx
Fundamentos de programación.pptxFundamentos de programación.pptx
Fundamentos de programación.pptx
 
Clean code
Clean codeClean code
Clean code
 
Major Java 8 features
Major Java 8 featuresMajor Java 8 features
Major Java 8 features
 
Conceptos Basicos Programacion
Conceptos Basicos ProgramacionConceptos Basicos Programacion
Conceptos Basicos Programacion
 
Etapas de compilacion
Etapas de compilacionEtapas de compilacion
Etapas de compilacion
 
Presentación pseudocódigo
Presentación pseudocódigoPresentación pseudocódigo
Presentación pseudocódigo
 
Conceptos basicos de la programacion
Conceptos basicos de la programacionConceptos basicos de la programacion
Conceptos basicos de la programacion
 
Programming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f cProgramming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f c
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
 
PSeInt
PSeIntPSeInt
PSeInt
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test framework
 
An Introduction To Python - Graphics
An Introduction To Python - GraphicsAn Introduction To Python - Graphics
An Introduction To Python - Graphics
 

Similar to Advanced latex

La tex basics
La tex basicsLa tex basics
La tex basicsawverret
 
Kamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, codeKamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, codeKamil Witecki
 
Latex_Tutorial.pdf
Latex_Tutorial.pdfLatex_Tutorial.pdf
Latex_Tutorial.pdfContactAt1
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...Francesco Casalegno
 
JSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklJSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklChristoph Pickl
 
5.1 Quadratic Functions
5.1 Quadratic Functions5.1 Quadratic Functions
5.1 Quadratic Functionssmiller5
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview QuestionsGradeup
 
Groovy and Grails talk
Groovy and Grails talkGroovy and Grails talk
Groovy and Grails talkdesistartups
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertextfrankieroberto
 
Lecture 6 operators
Lecture 6   operatorsLecture 6   operators
Lecture 6 operatorseShikshak
 
Introduction Latex
Introduction LatexIntroduction Latex
Introduction Latextran dinh
 
Shape Safety in Tensor Programming is Easy for a Theorem Prover -SBTB 2021
Shape Safety in Tensor Programming is Easy for a Theorem Prover -SBTB 2021Shape Safety in Tensor Programming is Easy for a Theorem Prover -SBTB 2021
Shape Safety in Tensor Programming is Easy for a Theorem Prover -SBTB 2021Peng Cheng
 
Tech Days Paris Intoduction F# and Collective Intelligence
Tech Days Paris Intoduction F# and Collective IntelligenceTech Days Paris Intoduction F# and Collective Intelligence
Tech Days Paris Intoduction F# and Collective IntelligenceRobert Pickering
 

Similar to Advanced latex (20)

La tex basics
La tex basicsLa tex basics
La tex basics
 
Kamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, codeKamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, code
 
Perl Presentation
Perl PresentationPerl Presentation
Perl Presentation
 
C Programming Homework Help
C Programming Homework HelpC Programming Homework Help
C Programming Homework Help
 
Latex_Tutorial.pdf
Latex_Tutorial.pdfLatex_Tutorial.pdf
Latex_Tutorial.pdf
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
 
JSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklJSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph Pickl
 
5.1 Quadratic Functions
5.1 Quadratic Functions5.1 Quadratic Functions
5.1 Quadratic Functions
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
 
Computational Assignment Help
Computational Assignment HelpComputational Assignment Help
Computational Assignment Help
 
Groovy and Grails talk
Groovy and Grails talkGroovy and Grails talk
Groovy and Grails talk
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertext
 
Lecture 6 operators
Lecture 6   operatorsLecture 6   operators
Lecture 6 operators
 
Introduction Latex
Introduction LatexIntroduction Latex
Introduction Latex
 
Shape Safety in Tensor Programming is Easy for a Theorem Prover -SBTB 2021
Shape Safety in Tensor Programming is Easy for a Theorem Prover -SBTB 2021Shape Safety in Tensor Programming is Easy for a Theorem Prover -SBTB 2021
Shape Safety in Tensor Programming is Easy for a Theorem Prover -SBTB 2021
 
Matlab1
Matlab1Matlab1
Matlab1
 
Tres Gemas De Ruby
Tres Gemas De RubyTres Gemas De Ruby
Tres Gemas De Ruby
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
 
Tech Days Paris Intoduction F# and Collective Intelligence
Tech Days Paris Intoduction F# and Collective IntelligenceTech Days Paris Intoduction F# and Collective Intelligence
Tech Days Paris Intoduction F# and Collective Intelligence
 

Recently uploaded

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Recently uploaded (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

Advanced latex

  • 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. How to write a Macro Define a macro in the Preamble using: newcommand{command name}{definition}
  • 4. How to write a Macro Define a macro in the Preamble using: newcommand{command name}{definition} Example: newcommand{uva}{University of Virginia}
  • 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. 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. 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. 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. 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. Macros with Math $$sum_{i=0}^n i^n$$ n in i=0 newcommand{sums}{$$sum {i=0}ˆn iˆn$$}
  • 11. Macros with Math $$sum_{i=0}^n i^n$$ n in i=0 newcommand{sums}{$$sum {i=0}ˆn iˆn$$} sums
  • 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. Renewcommand Use renewcommand to redefine an existing command
  • 14. Renewcommand Use renewcommand to redefine an existing command Example: The emph command italicizes its input.
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Matrix Environments begin{equation} begin{matrix} 1 & 0 0 & 1 end{matrix} end{equation} 1 0 0 1 (4)
  • 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. 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. Headers and Footers Fancyhdr package creates customizable headers and footers:
  • 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 }
  • 33. Fancyhdr Help You can get assistance with Fancyhdr here: ftp://ctan.tug.org/tex-archive/macros/latex/ contrib/fancyhdr/fancyhdr.pdf
  • 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. 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 }
  • 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. Figure: Science Cat Figure: Physics Cat Figure: Science Cat Figure: Physics Cat
  • 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. 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
  • 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. Example {color{red} This text is red!} This text is red!
  • 44. Colored Text Background colorbox{yellow}{This text has a yellow background!} This text has a yellow background!
  • 45. More Colors! Use the [dvipsnames] option when you call the color environment: usepackage[dvipsnames]{xcolor} You can now access 68 more colors!
  • 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. 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.
  • 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. 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. 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. Converting from DVI to PDF Directly (dvi → pdf): Use dvipdfm. A There is a special button for this in most LTEXeditors.
  • 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. 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. 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. 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. 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. 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. Frames Beamer uses the Frame environment: begin{frame}[options]...end{frame}
  • 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
  • 63. How to Make A Table A To make a table in LTEX use the tabular environment: begin{tabular}...end{tabular}
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Tables Better horizontal lines: booktabs package Class Species lion mammal tiger platypus reptile iguana snake aves flamingo Lays eggs? % % ! ! ! !
  • 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. Tables table environment Table: Who lays eggs? Class Species lion mammal tiger platypus reptile iguana snake aves flamingo Lays eggs? % % ! ! ! !
  • 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. 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. 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. 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. 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. 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. 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. 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