grad guide latex

33
The Graduate/Staff Guide to LaTeX on the SUN Computer Network Department of Mathematics and Statistics Written by J. S. Visch, Version 1.0: June 21, 2001 Contents 1 HOW TO CREATE A LATEX FILE 1 1.1 Intr oduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 The Minimum le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Editi ng LaTeX les 2 3 Fonts/Text 2 3.1 Fonts/T ext Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3.2 Using Coloured Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.3 FANCY FONTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.4 Using Postscript Style Fonts . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.5 Computer Modern Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.6 Forma tting Te xt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.7 Itemising . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 .8 Enumerating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4 Inc lud ing Mathemat ics 1 0 4.1 Sample Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.2 Sample Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.3 Sample Equat i on Arra y . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5 Ca se s 1 2 6 Ta b l e s 1 3 6.1 Simple Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6.2 Shading Areas (using pstricks) . . . . . . . . . . . . . . . . . . . . . . . 1 4 6.3 Inserting a multi- page Table . . . . . . . . . . . . . . . . . . . . . . . . . 15 7 Formati ng the Document 16 7.1 Adding a Table of Cont ents . . . . . . . . . . . . . . . . . . . . . . . . . 16 7.2 Adding an Index or Glossary . . . . . . . . . . . . . . . . . . . . . . . . . 16 7.3 Sec tions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 6 7 .4 Chapte rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 6

Upload: nansaw

Post on 10-Apr-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 1/33

The Graduate/Staff

Guide to LaTeXon the

SUN Computer Network

Department of Mathematics and StatisticsWritten by J. S. Visch, Version 1.0: June 21, 2001

Contents

1 HOW TO CREATE A LATEX FILE 11.1 Intr oduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 The Minimum le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Ed i t ing LaTeX le s 2

3 Fon t s /Tex t 23.1 Fonts/Text Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.2 Using Colour ed Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.3 FANCY FONTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.4 Using Postscript Style Fonts . . . . . . . . . . . . . . . . . . . . . . . . . 63.5 Computer Modern Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.6 Forma tt ing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 .7 I temis ing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 .8 Enumera t ing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

4 I n cl u di n g Ma t h e m a ti c s 104.1 Sample Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.2 Sample Equat ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.3 Sample Equat ion Arra y . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

5 Cas es 12

6 Ta bl e s 136.1 Simple Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136.2 Shading Areas (using pstr icks) . . . . . . . . . . . . . . . . . . . . . . . 146.3 Insert ing a mult i-page Table . . . . . . . . . . . . . . . . . . . . . . . . . 15

7 F o rm a t in g t h e D o c u m e n t 167.1 Adding a Table of Cont ents . . . . . . . . . . . . . . . . . . . . . . . . . 167.2 Adding an Index or Glossar y . . . . . . . . . . . . . . . . . . . . . . . . . 167.3 Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 .4 Chap ter s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Page 2: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 2/33

7.5 Abstra ct an d Acknowledgement s . . . . . . . . . . . . . . . . . . . . . . 177.6 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177.7 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177.8 Page Numbering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 .9 Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187.10 Footers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187.11 Pagestyles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187.12 Page Referencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

8 I n cl u di n g P i c t u re s 198.1 Inclusion of colour ph otos . . . . . . . . . . . . . . . . . . . . . . . . . . 208.2 Using the gure environment . . . . . . . . . . . . . . . . . . . . . . . . 208.3 Hints about ta bles and gures in LaTeX . . . . . . . . . . . . . . . . . . 208.4 The Subgure Environment . . . . . . . . . . . . . . . . . . . . . . . . . 22

9 Mak ing S l ides (Ove rheads ) 23

10 Sca l ing anyth ing (us ing ps t r icks) 2310.1 Scaling t o a s pecic size . . . . . . . . . . . . . . . . . . . . . . . . . . . 2310.2 Scaling objects by a xed factor . . . . . . . . . . . . . . . . . . . . . . . 24

11 Sur round ing P i c tu re s w i th Tex t 24

12 Ps t r i cks 2512.1 Flow Char ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

13 PSFRAG 28

14 Thes i s Requ i remen t s 2914.1 Pa ge Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2914.2 Pa ge num bering etc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2914.3 Title page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

15 Latexing in Par t s 30

Page 3: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 3/33

Guid e to Utilities (created on J un e 21, 2001) 1

1 HOW TO CREATE A LATEX FILE

1 .1 In t ro d u c t i on

Latex is a type setting langua ge, an d is easier t o use th an one might t hink from rstappearences.

The depar tm ent is cur rent ly run ning t he version LaTeX 2e, This will ha ndle leswritten in the previous version Latex 2.09, but all references here are in terms of LaTeX 2e. In some cas es th e old form at is incompa tible with t he n ew form at so keepth is in mind when you experiment with th e options.

We will go th rough a few simple examp les in t he n ext few subsections.

1 .2 Th e Mi n i m u m l e

\ documentclass[12pt] article \ begin document In here goes different styles of text, tables,ar ra ys, pictu res, etc. etc. \ en d document

Essen t i a l

To make things easier for you, we have included copies of all sample les on thedepartment web page for easy download. Start off by down loading sample le 1.i.e. netscape http://www.math.canterbury.ac.nz/latex.shtml &

Download Sa mp le le 1 by following th e inst r uctions given on th e web pa ge, it sh ouldbe downloaded as latsa m1.tex.Note a ll lat ex les should ha ve the extension .tex.

Now you will need to run latex via entering the following two commands in anX-window

latex latsam1.tex

dvips latsam1.dvi dvips -f -o latsam1.ps latsam1.dvi 1

You ha ve now processed a lat ex docum ent . Now to view it type

ghostview latsam1.ps &

Now each time you modify the document and wish to view your changes, you willhave to retype th e latex and dvips comma nds. Typing r on the ghostview windowwill update it to the latest postscript le, as will deiconising it.Note 1 : Spaces are ignored by LaTeX, see later lesson as to how to add spaces.Note 2 : Single carriage returns are ignored in LaTeX, double carriage returns areregarded a s being a n ew paragra ph, to creat e a new line use either \\ or \newline .Note 3 : The above dvips command assumes you do not have your printer environ-ment set, otherwise the le will go straight to the printer (the printer environmentis automat ically set in the under gradu at e labs ). To set the print er environment typesetenv PRINTER rm404

1 For using when printer environment set

Page 4: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 4/33

Page 5: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 5/33

Guid e to Utilities (created on J un e 21, 2001) 3

3 .2 U s i n g Co lo u r e d F o n t s

Colour is mainly for present at ions, keep in m ind m ost of our print ers a re grey scaleprinters, an d colour printing is expensive. But using greyscale within a paper orthesis can add aesthetics at no extra printing cost, but note photocopying may notcome out th e way you were expecting, so do test before ru nn ing off 200 copies. As

for send ing a s FAXs don’t both er, some a re set as black a nd white only.

The grayscales - black, darkgray, gray, l ightgray, and white, a nd the colours -red, green, blue, cyan, ma genta, a nd yellow ar e all predened in Pst ricks. Whichmeans that you can use \blue in the same way you might use \large , thesecomm an ds can a lso be combined . They differ from th e norma l font comm an ds in th efollowing ways .

1. The colour comma nds can be used in an d out of ma th s mode.

2. The colour comma nds affect what ever is in th eir scope (e.g. lines ), not just

characters.3. The scope of colour s does not exten d a cross pa ges.

4. The colour comman ds a re not as robust as font comman ds when used insidebox m acros.

5. They can become difcult to read wh en pr inting on a gray scale printer 2

For example

\ documentclass[12pt] article \ usepackage pstricks \ begin document \ noindent \ blue This is blue \ darkgray This is dark gray \ en d document

You can dene colour s for your u se th roughout your docum ent via th e comma nds

\ newgray darkergray 0.3 \ newcmykcolor tancmyk 0 0.42 1 0 \ newrgbcolor tanrgb 0.98 0.67 0.33

2 A printer that can only produce shades of gray

Page 6: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 6/33

Guid e to Utilities (created on J un e 21, 2001) 4

for example

\ documentclass[12pt] article \ usepackage pstcol \ newgray darkergray 0.3 \ newcmykcolor t an 0 0.42 1 0 \ newrgbcolor redish 0.98 0.67 0.33 \ begin document \ textcolor darkergray This will show up da rk gray \ textcolor t an This will show up as ta n \ textcolor redish This will show up redish \ end document

gray : One can specify an y sha de of gray from white (denoted as 1 ) a ll the way t oblack (denoted as 0).

c m y k : equals cyan + magenta + yellow + black.

rgb: equals red + green + blueTo crea te your own r gb colour s include a t t he beginn ing of your docum ent

\newrgbcolorcolourrgbnum1,num2,num3

Where num1,num2,num3 is a red-green-blue specicat ion with each nu mber being

between 0 a nd 1. To select the colour you wish you may wish to use xv via thefollowing met h od

1. Type xv &

2. Move the mouse ont o the xv window

3. Hi t the e key on your keyboar d, this will bring up t he gra phics editor

4. Click on

5. Click on one of the colour rectangles which has the colour you want (click onrandom again if necessary ).

6. Select th e nu mbers corr esponding a nd divide those by 255e.g.

146, 46, 3 becomes 0.5725 0.2941 0.0118or \ newrgbcolor brown 0.573 0.294 0.012

A samp le le is a vailable off th e web page.i.e. netscape http://www.math.canterbury.ac.nz/latex.shtml#lesson4

Page 7: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 7/33

Guid e to Utilities (created on J un e 21, 2001) 5

3.3 FANCY FONTS

You can inser t fan cy fonts by includin g th e style les an d text pat h.st y in \usepackage ,tha t i s \usepackageamsfonts,textpath .

Fa ncy Hea din g Meth od

M O U S E ∼

\pssetlinestyle=none\pstextpath[c]\pscurve(0,0)(1,0.3)(2,0.2)(3,-.1)(4,.1)(5,-.3)(6,-.2)%\Huge $\mathbbMOUSE$ $\mathbblas$

Note t he pscurve species t he curvat ure of the word while the mathbb indicates the type of font.

A s s i g n m e n t

\pssetlinestyle=none\pstextpath[c]\pscurve(0,0)(1,0.3)(2,0.2)(3,-.1)(4,.1)(5,-.3)(6,-.2)%

\Huge $\mathfrakAssignment$

Ò Ý Ì Ø Ð

\newcommand\gothfamily\usefontUygothmn\DeclareTextFontCommand\textgoth\gothfamily\begindocument...\huge \textgothFancy Title

Ò Ý Ì Ø Ð

\newcommand\frakfamily\usefontUyfrakmn\DeclareTextFontCommand\textfrak\frakfamily\begindocument...\huge \textfrakFancy Title

Ò Ý Ì Ø Ð

\newcommand\swabfamily\usefontUyswabmn\DeclareTextFontCommand\textswab\swabfamily\begindocument...\huge \textswabFancy Title\\

À Á

\newcommand\initfamily\usefontUyinitmn\DeclareTextFontCommand\textinit\initfamily\begindocument...\textinitHI\\

Note t ext must be all in capitals

Ò Ý Ì Ø Ð

\newcommand\swabfamily\usefontUyswabmn\DeclareTextFontCommand\textswab\swabfamily\begindocument...\huge \textswabFancy Title\\

Page 8: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 8/33

Guid e to Utilities (created on J un e 21, 2001) 6

3 .4 U s i n g P o s t s c ri p t S t y le Fo n t s

If you h ave us ed th e inform at ion so far to print a La TeX docum ent t he pr int er wouldha ve produced out put in cm (compu ter modern ) font s.

Several years ago Mark Hickman set up a font style which is called postscriptwhich is essentially New Centu ry Schoolbook. This is a heavier st yle th an cm a nd

is very useful for docum ents su ch a s th is one, or class notes or h an dout s th at ar e tobe photocopied or r educed, since th e resu lt does not degrade a s m uch a s t he light ercm version.

To pr oduce docum ent s in th is NCS or postscript s tyle include pos tscr ip t intoyour\usepackage s ta tement .

You can make your own postscr ipt fonts , tha t being vector based ra ther thanbitma p, ma king th em easily scaleable t o whatever size you l ike. The a vailableAdobe postscript font s a re Times (pt m ), Helvetica (phv) an d Cour ier (pcr ).

Times Helvetica Courier16pt normal 16pt normal 16pt normal

12pt normal 12pt normal 12pt normal

6pt normal 6pt normal 6pt normal

12pt Bold 12pt Bold 12pt Bold

12pt Bold 12pt Bold 12pt Bold

12pt Bold 12pt Bold 12pt Bold

12pt Bold 12pt Bold 12pt Bold12pt Italics 12pt Italics 12pt Italics

12 PT ITALICS 12 PT ITALICS 12 P T I TA L I C S

12pt Italics 12pt Italics 12pt Italics

Example :

\ documentclass[12pt] article \ DeclareFixedFont \ MyFont T1 pcr m n 16pt \ begin document \ MyFont This is Courier 16pt \ end document

\ DeclareFixedFont \ MyFont T1 pcr m n 16pt

Case SensitiveYour specied name 3

T1, OT1, or OML

ptm,phv, or pcrm(medium), b(bold)n(normal), it(italic), sl(slanted), sc(Caps)Size of font in u nit s e.g. 20pt , 2cm

3 Make sure i t is unique

Page 9: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 9/33

Guid e to Utilities (created on J un e 21, 2001) 7

3 .5 Co m p u t e r Mo d e r n F o n t s

The Computer Modern Fonts that are available areCM Bold ( cmb10 )CM Bold Extended (cmbx5, cmbx6, cmbx7, cmbx8, cmbx9, cmbx10, cmbx12).CM Bold Extended Slanted (cmbxsl10)

CM Bold Ext ended Text I ta lic (ccmbxti10)CM Caps an d Sma ll Caps (cmcsc10)CM Dunhill (cmdunh10)CM Fun ny Roman (cmff10)CM Fibonacci (cmb8)CM Italic Typewriter (cmitt10)CM Roma n (cmr5, cmr6, cmr 7, cmr 8, cmr 9, cmr 10, cmr 12, cmr 17)CM Slan ted (cmsl8, cmsl9, cmsl10, cmsl12 )CM Slan ted Typewriter (cmsltt 10)CM San s Ser if (cmss8, cmss9, cmss 10, cmss 12, cmss 17)CM Sans Serif Bold Extended (cmssbx10)CM Sans Serif Demibold Condensed (cmssdc10)CM San s Ser if Italic (cmssi8, cmss i9, cmss i10, cmss i12, cmssi17 )CM Sans Serif Quotat ion Style (cmssq8)CM San s Ser if Quotat ion Ita lic Style (cmssqi8)CM Typewriter Caps a nd Small Caps (cmt csc10)CM Typewriter Extended (cmtex8, cmtex9, cmtex10)CM Text Ita lic (cmt i7, cmt i8, cmt i9, cmt i10, cmt i12)CM Typewriter (cmt t8, cmt t9, cmtt10, cmtt12)CM Unslan ted Text Ita lic (cmu 10)CM Variable Typewriter (cmvtt10)CM Bold Symbols (cmbsy10)CM Inch (cminch )CM Math Extension (cmex10)CM Mat h Ita lic (cmmi5, cmm i6, cmm i7, cmm i8, cmm i9, cmm i10, cmm i12)CM Symbols (cmsy5, cmsy6, cmsy7, cmsy8, cmsy9, cmsy10)

Example : \ font \ ts=cminch \ t s \ par DON’T KNOCK IT, IT WORKS but this bit wil l n ot DONT KNOCK IT IT WORKS(due to font size, I scaled it down to 20%, it is important to note that for the cminchfont in pa rt icula r t he font is str ictly upper case, an d comm as an d apostr oph es do not.)

You also ma ke u se of th e dingbat fonts by

using \usepackagepifont

seeing t he LaTeX compa nion for a full list of them .

usin g th e LaTeX int erface in Xema cs.

£ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £

\begindinglist43 %Similar to \beginitemize\item using \verb# \usepackagepifont#\item seeing the LaTeX companion for a full list of them.\item using the LaTeX interface in Xemacs.\enddinglist

Page 10: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 10/33

Guid e to Utilities (created on J un e 21, 2001) 8

\dingline36 %creates a line of a repeated dingbat font, in this case%dingbat36

3 .6 Fo rma t t ing Tex t

Form a tt in g LaTe X c ode

Pa ragra ph ing Empty line

New line \\

New line \newline

New line \breakline

New page \newpage

Horizont al Space (2cm) \hspace*2cm

Horizontal Space (2 Characters) \hspace*2ex

Note further options are available for hspace, see a manual for details

Vert ical Spa ce (2cm) \vspace*2cm

Vertical Space (2 Cha ra cters ) \vspace*2ex

Note further options are available for vspace, see a manual for details

Spacing between lines \renewcommand\baselinestretch2.5

Maths S pac ingForm a tt in g LaTe X c ode

Thin spa ce \, (backslash comma)Negative thin spa ce \!

Medium space \:

Thick spa ce \;

Note : If you use \\ or \newline and latex gives an error, saying there is noline h ere to end, then u se \vspace instead.

Page 11: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 11/33

Guid e to Utilities (created on J un e 21, 2001) 9

3.7 It e m is i n g

You can itemise in form at ion as in t he following exam ple

Latex

\ begin itemize \ i tem First I tem \ item Second Item \ en d itemize

³

Output

• First I tem• Second It em

See example les at http://www.math.canterbury.ac.nz/latex.shtml#lesson5

You can also repla ce th e default item symbol via\renewcommand\labelitemi$\square$You can also place the i temise environment within another. See a text book forfurther examples.

3.8 E n u m e ra t in g

You can nu mber items as in t he following example(see further examples at http://www.math.canterbury.ac.nz/latex.shtml#lesson6 )

Latex

\ begin enumerate \

item First Item \ item Second Item \ en d enumerate

³

Output

1. First I tem

2. Second It em

Latex

\ renewcommand \ theenumi \ Roman enumi

\ renewcommand \ labelenumi \ blue \ theenumi

\ begin enumerate

\ i tem First I tem

\ item Second Item

\ en d enumerate

³

Output

I First I tem

II Second Item

See a text book for further examples.

Page 12: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 12/33

Guid e to Utilities (created on J un e 21, 2001) 10

4 In c lu d i n g Ma th e m a t ic s

Within LaTeX you can use highly complicated formu las by inclosing them in amathematics environment. See http://www.math.canterbury.ac.nz/latex.shtml#lesson7e.g. In t he cases where you wan t t he ma th s to be on t he sam e line t ype

$ \ mu=n*p $ ³ µ = n ∗p

or

\ ( \ mu=n*p \ ) ³ µ = n ∗p .

And if you wish for th e mat hema tics to be on a separa te line t ype

\[ \mu=n*p \]

µ = n ∗ p

$$ \mu=n*p $$ µ = n ∗ p

The ful l l is t of m athemat ica l opera t ions is conta ined within the manua ls , ingeneral you will nd that al l commands tend to be logical in their names e.g α is $\alpha$ , β is $\beta$ and so on. An example of the ma thema tics capa-bilities is as follows.

\[ \lim_n \rightarrow \infty \int_0 t \beta \sum_i=1ˆn\frac\alpha_n*(x+1)ˆn\sqrty-1 dx \le \int_0ˆt \tau\frac(x-1)\sqrty+1 dx, \forall x \in \\gamma,\Omega\ \]

limn →∞

t

0 β

n

i=1

α n ∗( x + 1)n

y − 1dx ≤

t

( x − 1)

y + 1dx ,∀ x∈ γ , Ω

When u sin g xema cs in writ ing your la tex le, you will nd a collect ion of greek let t erson t he r ight side of th e window as shown on th e right . Clicking on t he t op icon a llowsyou a ccess t o fur th er collections of icons a ll of which you can click a n d h ave t hecorresponding latex code appear in your document. This will save you havingto remem ber t hem all initially.

Page 13: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 13/33

Guid e to Utilities (created on J un e 21, 2001) 11

4 .1 S a m p le Ar ra y

Arrays are considered as mathematics hence they must be within a mathematicsmode environement e.g. between \[ \]

\[\beginarray|[email protected]|\hline123.45 & 123.45 & 123.45 & 123 & 45 \\5.6 & 5.6 & 5.6 & 5 & 6\\\hline\endarray\]

123.45 123.45 123.45 123.45

5.6 5.6 5.6 5.6

Note: |lcr| is broken down into

- , indicat es a vertical line on t he left side of the a rr ay, if th is ha d been omittedthere would be no line on the left side of the array.

- l , indicat es th at you wan t a column an d it is to be left just ied.

- c, indicat es th at you wan t a column an d it is to be centr ed.

- r, indicat es th at you wan t a column an d it is to be right justied.

- , indicat es a vert ical line on t he right side of th e ar ra y, if th is ha d been omit tedth ere would be n o line on th e right side of the a rr ay.

In addition extra ma y ha ve been add ed between the colum ns, for inst an ce |l|c|r| .Should you wish to alter t he height of th e rows of th e arr ay, use eith er \def\arraystretch1.5\setlength\extrarowheight5mm .

Th e \hline provides the horizontal lines.

4 .2 S a m p le E qu a t i o n

\beginequationeˆi*pi+1=0\endequation

ei∗ pi + 1 = 0 (1)

Note: The equat ion is a ut oma tically num bered. To remove the n um bering you m ustuse equa tion*, an d cha nge th e sta rt of your docum ent to

\ documentclass[12pt] article \ usepackage amsmath

Note : The usepa ckage sta tem ent a llows you to add addit iona l mar cos to th e existinglat ex set. You can add more a s long a s t hey don’t conict.

Page 14: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 14/33

Guid e to Utilities (created on J un e 21, 2001) 12

4 .3 Sample Equa t ion Ar ray

\begineqnarrayF(X_2|X_1) & = & \fracSSR(X_2|X_1)MSE(X_1,X_2) \\& & \nonumber \\

F(X_3|X_1,X_2) & = & \fracSSR(X_3|X_1,X_2)MSE(X_1,X_2,X_3)\endeqnarray

F ( X 2 X 1 ) =S S R ( X 2 X 1 )

MSE ( X 1 , X 2 )(2)

F ( X 3 X 1 , X 2 ) =S S R ( X 3 X 1 , X 2 )

MSE ( X 1 , X 2 , X 3 )(3)

The eqnar ra y is in t hr ee part s separ at ed by &’s, and each line nished via a \\ .The “& & \nonumber \\ ” is to give more of a gap bet ween t he t wo equa tions.Note: Th e \ nonum ber just before th e \\ suppresses t he n umbering.

5 Case s

For situ at ions like t he below

Latex

\ [ f(x) = \ begin cases

sin(x), & \ text if 0 \ leq x \ leq \ pi

cos( x), & \ text if pi < x \ leq 2* \ pi \ en d cases \ ]

Output

f ( x) =sin ( x), if 0 ≤ x ≤ π

cos ( x), if pi < x ≤ 2 ∗π

³

Page 15: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 15/33

Guid e to Utilities (created on J un e 21, 2001) 13

6 Ta ble s

I t should be noted that tables are primarily for let ters and words, and al thoughmathematics can be included arrays are more suited to this purpose.

6 .1 S imp le Tab le

To star t off with , we will look a t a simple u nlined t able

Latex

\ begin tabular lcr

left & centred & right \ \

alignm ent & alignm ent & alignment \ en d tabular

Output

left cen t r ed r igh t

a lignment a lignment a lignment

³

Note lcr informs LaTeX that you wish to have three columns, with the rst left justied (l), the second centred (c), an d th e th ird right justied (r ). Th e & betweenth e items inform s LaTeX where t he border is between column s whilst t he \\ in -forms LaTeX that you wish to start a new row.

Now to look at a more complicated table where use is made of borders, spacingan d special forma ting.

Universities

North Island:

Auckland

Massey

Victoria

Waikato

City - Aucklan d

City - Palmerst on Nort h

City - Wellington

City - Waika to

South Island

Canterbury

Lincoln

Otago

City - Christchur ch

City - Christchur ch

City - Dunedin

The complete program is not listed here due t o its size, but a n explan at ion of thekey points are mentioned below, and the complete program can be down loaded assam ple le ??. Should you wish to kn ow more deta ils consu lt t he La TeX referenceguides mentioned at the star t of this chapt er. Note t his is to show you what latexcan do, most people just stick to simple tables.

1 Speci fy ing of co lour in tab lesThere are two methods you can use, one is easier to use but depends on yourprinter driver being supported by pstr icks (al l the department printers are)an d does not work with a ll table packa ges, while th e second is not so easy bu t issupported by all printers an d is compa tible with oth er ta ble packages. The rst

Page 16: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 16/33

Guid e to Utilities (created on J un e 21, 2001) 14

is called colortab see page 14 th e second called colort bl, ha s docum enta tionava ilable online in colort bl.dvi, found in t he directory /usr /local/tex/texmf/doclat ex/car lisle or from th e book “The Lat ex Gra phicsCompanion” by Goossens, Rahtz and Mittelbach, which gives a number of examples.

2 Se lec t ing mu l t i p l e co lumnsIf you wa nt to span someth ing over more tha n one column , then u se th e multi-column comma nd, e.g. if you want to span someth ing over th ree column s youcan do that via \multicolumn3cLarge title . See a manual formore deta ils.

3 Inser t ing with in a tab leThis was done by having a tabular wi th in another, and via the use of thedelimiter \ (see a ma nu al for a complete list of delimiters )

$ \left\ \begintabularl x \\ y \endtabular \right.$

xy

Not a ll options h ave been covered h ere, th e reference guides will show you more.

6 .2 Shad ing Areas (u s ing ps t r icks )

You can ma ke an y ar ea become sh ad ed one colour as in t he following example wher eI shade the area enclosing a table

Table of Sta t is t icsA B C

Mean 15.25 13.55 16.63Std 12 .54 1 7.4 1 0.3 6

Minimum 0 0 0.57

Maximum 3 3.6 3 45.6 35.22

\[\psframebox[fillstyle=solid,fillcolor=lightgray]\beginarray|c|c|c|c|\hline\multicolumn4|c|\mbox\large \textbfTable of Statistics \\\hline& \textbfA & \textbfB &\textbfC \\\hline\textbfMean & 15.25 & 13.55 & 16.63 \\\hline\textbfStd & 12.54 & 17.4 & 10.36 \\

\hline\textbfMinimum & 0 & 0 & 0.57 \\\hline\textbfMaximum & 33.63 & 45.6 & 35.22 \\\hline\endarray\]

You can also creat e a ta ble with each cell shaded according to your desires. Firstyou will need t o add color tab to your \usepackage statement, then you need toinclude within your LaTeX le denitions for the various shadings.

e.g.

\newgraywh1 % white\newgraylg0.9 % light gray\newgraylmg0.8 % light-medium gray\newgraymg0.7 % medium gray

Page 17: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 17/33

Guid e to Utilities (created on J un e 21, 2001) 15

\newgraymdg0.6 % medium-dark gray\newgraydg0.5 % dark gray

As you can guess the closer the number is to 1, the lighter the colour, and the closerth e num ber is towards 0, th e dark er th e colour.One can pr oduce a mu lti-sha ded ta ble like th e one below

White Ligh t Gra y

Light Medium Gray Medium Gray

Med iu m Da r k Gr a y Da r k Gr a y

see th e sam ple le ??The ta ble just ha s th e additions of

\LCC\mdg & \dg \\

... & ... \\\ECC

ar oun d th e rows of the ta bles

6 .3 In se r ti ng a mu l ti -page Tab le

To insert a mu ltiple page ta ble you mu st rst ly include

\usepackagelongtable

then within the document

\beginlongtable[c]|l|c|c|\hline

You can inser t a tit le on your rs t pa ge which differs from subs equen t pa ges via

\hline \multicolumn3|c|\large \textbfMaths and Stats Dept\\

\hline \\ \textbfLecturer&\textbfRoom&\textbfExtension\\\hline \endfirsthead

Next you may wish to dene a heading which wi l l appear a t the top of the ta-bles on ea ch p age, if so then you m us t pla ce it before t he m ain body of th e ta ble, an dit n eeds t o be of th e form

\hline \textbfLecturer&\textbfRoom&\textbfExtension\\\hline \endhead

Your heading can be for more tha n one row. If for example you want two rowsthen jus t add \endhead at the end of the second row and not at the end of therst row.Similarly you can add rows to the bottom of the table on each page via

\multicolumn3|l|\textbf(*) = Stats, ($\ddagger$) = bio\\

Page 18: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 18/33

Guid e to Utilities (created on J un e 21, 2001) 16

\hline \endfoot

There is a \endlastfoot comma nd wh ich works similar to \endfirsthead

You then include t he table i t se lf in t he s tan dard format and then end wi th a\endlongtable comma nd. To force a t able break, just insert \newpage a t t h eplace in t he t able you wish t o break .

Note : longta ble is for ta bles t ha t ar e mu lti-page lengthwise, not widthwise.Note : You ma y ha ve to LaTeX more t ha n once to get your longt able looking corr ect,th is is similar t o when m aking a cont ents le.

7 F orm a ti n g t he D oc u m e n t

7 .1 Add ing a Tab le o f Con ten t s

To prepare a contents page include the command \tableofcontents . This willcreat e a le called lename.aux, so for insta nce with th is docum enta tion th e le iscalled guide2.aux, which is due the the LaTeX le being called guide2.tex. Examin-ing the le guide2.aux, one nds

\relax\@writefiletoc\contentsline section\numberline 1INTRODUCTION1\@writefiletoc\contentsline section\numberline 2WORD PROCESSING1e.t.c.

When you run latex it will rst search for a .aux le, use it to create a contents page and at the same

time exam ine th e LaTeX le and creat e a n ew .aux le. H ence in gener al you will have to ru n LaTeXtwice before t he ta ble of content s will appear.

7 .2 Add ing an Index o r Glos sa ryFor indexing include a \makeindex stat ement before your \begindocument , create youritems for your index by th e use of a \indexitem command,e.g. factorials\indexfactorials , now ru n La TeX and a le index.idx will appear. This leneeds to converted into a different format which one achieves by typing m a k e i n d e x l e n a m e e.g.for this document I typed m a k e i n d e x g u i d e 2 this will create the le guide2.ind. The le with the.ind sufx you will then include int o your docum ent with somet hing of the form

\newpage\inputguide2.ind

Note : For Glossaries replace index with glossary, as the syntax is the same.

7.3 S e ct io n sTo start a n ew sections type \section th e section t itle . Similar you can create subsections with

\subsectionSome title and subsubsections with\subsubsectionSome title

7.4 Ch a p te r sChapters are not available in article style, but you can use them in report style. e.g.

\documentclass[12pt]report\begindocument\tableofcontents\chapterIntroduction

Page 19: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 19/33

Guid e to Utilities (created on J un e 21, 2001) 17

Some text\sectionThe Achievements of Mary HardingSome further texte.t.c\enddocument

This will result in t he following

ContentsIn t roduc t ion1.1 The Achievements of Mary H ar ding . 1

Chapte r 1

In t roduct ionSome text

The Ach ievements o f Mary Hard ingSome more text

7 .5 Ab s tr a ct a n d Ac k n o w l e d g e m e n t sThese can be placed as you would a ny text.

7.6 Ap p e n d ixTo add appendices one only needs to do the following

\addcontentslinetocsection\LARGE \textbfAppendices

\appendix\sectionRoads Travelled on Routes\sectionRiccarton RoadGosh what a busy road.

Note : Wh en in ser tin g La TeX com ma nds wit hin a n a ddcon ten tslin e, a\protect statement may need to be inserted.

Note : You can modify th e forma t of the appendix label but tha t may require constan t modica-tion of th e .aux le.e.g. \renewcommand\thesectionAppendix \protect\hspace*4cm \thesection whichmay look great in the contents page but will look odd on the page the appendix is on.

7 .7 B i bl io g ra p h yWhen creating a bibliography there are several steps

1 Creat e a le (e.g. m ybooks) cont aining your r eferences in t he form at below

@book regress,author = David G. Kleinbaum, Lawrence L. Kupper,

Keith E. Muller,year = 1992,ti tle = Applied Regression Analysis and Other

Multivariate Methods,series = ,volume = ,publisher = PWS-KENT Publishing Company,address = ,note = Second Edition

Page 20: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 20/33

Guid e to Utilities (created on J un e 21, 2001) 18

@mastersthesis alistairswork,author = Alistair K. Storm,title = Computational Techniques for Polynomial

and Linear Regression,school = Canterbury University,year = 1982

Where th e rst line contain s th e type of reference e.g. book, ma ster sth esis, Art icle, phdth esis.(for furt her types of references see a ma nu al. The second pa rt of th e line is t he r eference name,e.g. regress, alistairswork. This is so that we can distinguish it from other references. Therest of th e labels sh ould be self explana tory.Note : the labels vary according to the type of reference, so consult a manual if unsure.

2 Insert the references in your document in the formsee page 3 Ref. \citealistairswork

3 At the point you wish your bibliography to occur specify your bibtex le as per above i.e.“mybooks”

\bibliographymybooks

4 J ust below add t he style you wish your bibliograph y to be in, e.g. plain. For other styles see amanual . \bibliographystyleplain

5 Now you mu st ru n LaTeX, i.e. latex yourle.tex

6 Now you must ru n bibtex, i.e. bibtex your le.tex

7 Then rerun LaTeX.

7.8 P a g e N u m be r in gPa ge num bering requires you specifying what type of nu mbering you want for t he pa ges e.g.

\pagenumberingroman - Gives you roman digits (I, II, II I,...)\pagenumberingarabic - Gives you arabic digits (1, 2, 3,...)

And which page num ber less 1 tha t you wish t o star t at.\setcounterpage0

7.9 H ea d ersTo creat e a head er specify th e page st yle you wa nt e.g.

\pagestylemyheadingsAnd what you want included in the header e.g.

\markrightGuide to Utilities (created on \today)When double siding your pages you can u se

\pagestylemyheadings\markbothLeft headerright header

7.1 0 F o o te r sWhen a dding a footer (generally frowned upon when doing a Thesis), nd th e portion of text an d adda footnote statement. e.g. the Wizard and his S taff 4

\textitthe Wizard and his Staff\footnoteA long bent thing ...

7.11 P a g e s ty le s\pagestyleempty - No page numbers\pagestyleplain - The default.\pagestylemyheadings - Used when including headers

4 A long bent thing with a sort of lump on the end

Page 21: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 21/33

Guid e to Utilities (created on J un e 21, 2001) 19

7 .1 2 P a g e R e fe r e n c i n gThere ar e two part s t o page referencing,

1 Label what you want to refer to.e.g. It w as Bill Cosby’s Birth day

It was Bill Cosby’s Birthday \labelBirthday

2 Then you have your reference using that label.e.g. Whose birthday is 12 th July? Answer see page 19

Whose birthday is 12$ th$ July?Answer see page ˜\pagerefBirthday

8 In c lu d i n g P i c tu re sBefore you can include a picture the le must be generic postscript format, unless you import yourle from Microsoft or from an outside source, you will nd all our postscript to be generic.Packages like matlab allow you print to several types of postscript les, the one you will want isencapsulat ed postscript so in ma tlab you would type

print -deps filename.ps

Some software packages either st ore t he postscript a s a compact image (desirable) or as a n imageon a n A4 page (un desireable), this you will need to keep in mind. There ar e severa l ways of importin gpostscript in to your les, we will only look at one met hod, tha t being usin g \ usepackage pstcol,graphicx

% Note must have \usepackagepstcol,graphicx at the% begining of the document.\beginpspicture(0,0)(6cm,6cm) % This specifies the boundary for the

% picture environment with the (0,0)% indicating the bottom left% corner and the (6,6) indicating% the top right corner

\rput(3,3)\includegraphics[height=6cm]view1.ps% The \rput(3,3) specifies where you% wish the centre of the picture to% lie within the boundaries. The% [height=6cm] specifies the height you% wish the picture to be, the width is% then scaled accordingly, you can% similarly specify only the width and% the height will then be scaled% accordingly. view1.ps specifies the

% name of the postscript file you% wish to include.

\endpspicture

You can also stret ch pictu res via specifying width s a s well as h eight s.You can also take a sub-portion of a pictur e by r educing the size of the bounda ries an d replacingpspictu re with pspictu re*, i.e.

Page 22: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 22/33

Guid e to Utilities (created on J un e 21, 2001) 20

\beginpspicture*(2,2.5)(4,4.6)\rput(3,3)\includegraphics[height=6cm]view1.ps\endpspicture*

8 .1 In c l u s i on o f c o lo u r p h o t o sWhenever possible reduce it down t o grayscale. But should you wish to ha ve them in full colourbe aware that to get good quality printing one needs about 300 dpi which for a 10cm wide imagetr an slates t o around 7 megabytes. As your disk quota is limited, use one of th e scra tch ar eas for yourphotos. An easier alternative is to just leave a gap in your document and take the pages and photosto the library where they will copy them on for you. Should you be determined to proceed with thepostscript option you can either print them using our colour printer, or take them elsewhere on a zipdisk or CD, they will not t on a oppy.

8.2 U s in g t h e g u re e n v i ro n m e n tThe gure en vironm ent is designed for easy a dding of capt ions, t he down side is th at frequently yourgraphic is placed where it wants rat her t han where you. The alternat ive is that you insert all yourown captions manually. But the syntax is as

\ documentclass[12pt] article \ usepackage graphicx

\ begin document \ begin gure [h] \ includegraphics[width=6cm] normalcurve.ps \ caption This is a caption \ en d gure \ en d document

8 .3 H in t s abou t t ab le s and gu res i n LaTeXMoving tables and gures in LaTeX (adapted from the TeX Users Group FAQ by Donald Arseneau,

Piet van Oostrum et al from comp.text.tex )

Tables and gures have a tendency to surprise, by oating away from where they were speciedto appear. This is in fact perfectly ordinary document design; any professional typesetting packagewill oat gures an d ta bles to where th ey’ll t without violat ing th e cert ain t ypograph ic ru les. E venif you use th e placement specier h for ‘her e’, th e gure or ta ble will not be prin ted ‘her e’if doing sowould brea k t he r ules. LaTeX uses t he following order of test s un til a pla cement is foun d. th emselvesare pr etty simple,

1 If ! is specied, ignore most rest rictions as described above and continu e.

2 If h is specied, try to place the oat at the exact position. If this fails and no other positionwas specied, cha nge th e specier to t (for a possible placement on th e next pa ge).

3 If t is specied, try t o place it on t he t op of cur rent page.

4 If b is specied, try to place it on th e bott om of the curren t pa ge (or column ) has ended.

5 If p is specied, try to place it on a oat page (or oat column) when the current page (orcolumn ) ha s ended.

Page 23: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 23/33

Guid e to Utilities (created on J un e 21, 2001) 21

6 Sta ge 3 and 4 ar e repeat ed if necessary at th e beginn ing of each subsequent page, followed by5 at its end.

In t he worst case, LaTeX’s r ules can cause t he oating items to pile up to th e extent th at you getan error message saying "Too many unprocessed oats"; this means that the limited set of registersin which LaTeX stores oating items is full. What follows is a simple checklist of things to do to solvethese problems (the checklist talks throughout about gures, but applies equally well to tables).

• Are th e placement par ameters on your gures right? The default (tbp) is reasonable; youshould n ever simply say ‘h’, for examp le, since tha t sa ys "if it can ’t go her e, it can ’t go an ywher e",and a s a result all subsequent oats pile up behind it .

• Can you per ha ps prevent your gures from oat ing by adjusting LaTeX’s placement par am e-ters? Again, the defaults are reasonable, but can be overridden in case of problems.

• There is an additional parameter [H] which comes with the oats package which really forcesthe gure to appear next, but this could result in the gure appearing on the bottom of thenext page and the gure after appearing above it, so do check.

• Are there places in your document where you could ‘naturally’put a \ clearpage command? If so, do: the backlog of oats is cleared after a \ clearpage. (Note that the \ chapter comma ndimplicitly executes \ clear page, so you can ’t oat past th e end of a chapt er.)

• To clear th e backlog, but n ot cau se an ugly gap, u se th e LaTeX afterp age package (fra gile butimproving). i.e. \ afterpage \ clearpage . This will result in the current page being lled withtext as usual, but then a \ clearpage command will ush out all the oats before the next textwill begin.

• You m ay nd wh en u sing th e comm an d [H] that you m eant “somewher e close”inst ead of “her e”.This can be achieved by \ afterpage \ clearpage \ begin gure [H]... \ en d gure This ensures that the gure appearsa t the top of the next page . (The \ clearpage stops any other gures drifting past the [H]gure).

• As a last resort, try the package moreoats; this ‘simply’ increases t he num ber of oatinginserts th at LaTeX can han dle at one time (from 18 to 36), but t hat may suit your needs.

• If you a ctually want ed all your gures t o oat to th e end (e.g., for su bmitt ing a dra ft copy of apap er ), don’t r ely on La TeX’s m echan ism: get t he pa ckage endoat to do the job for you.

By defau lt, LaTeX only allows up to 3 oats t akin g up t o 0.7 of th e page to be on a pa ge with text.There a re n o such limits on gur es placed on a ‘oat page’ (a pa ge with oat s but no regular t ext),but LaTeX will not creat e a oat page un less it can cover h alf of it with oat s. This beha viour can bechanged by placing lines like the following before \ begin document

\ renewcommand \ oatpagefraction .9 \ renewcommand \ topfraction .9 \ renewcommand \ bottomfraction .9 \ renewcommand \ textfraction .1 \ setcounter totalnumber 50 \ setcounter topnumber 50 \ setcounter bottomnumber 50

The following variables cont rol the vertical spacing with gures

\ oatsep separat ion between oats on a page with text

\ intextsep separation between oats and the text

plus the hidden parameters for oat pages:

\ @fptop space at top of oat page

\ @fpbot space at bottom of oat page \ @fpsep space between oat s on a oat page

The vertical space between a graphic and the caption below it is \ abovecaptionskip (10pt default)an d th e vertical space below a capt ion is \ belowcapt ionskip (0pt ).

Page 24: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 24/33

Guid e to Utilities (created on J un e 21, 2001) 22

8 .4 Th e S u b g u r e E n v i ro n m e n tTo han dle the situa tion where you have subgures i .e. gure 1a, 1b etc, the subgure environmentis set up to han dle it .

\ documentclass[12pt] article \ usepackage graphicx,subgure \ begin document \ begin gure [h] \ begin center \ subgure[Roo] \ begin pspicture (0,0)(5,5) \ scalebox 0.5 \ Kangaroo red \ en d pspicture \ subgure[Kanga] \ Kangaroo blue \ en d center \ caption The Kan gar oos of A. A. Milne \ en d gure \ en d document

(a ) Roo (b) Kanga

Figur e 1: The Kan gar oos of A. A. Milne

Page 25: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 25/33

Guid e to Utilities (created on J un e 21, 2001) 23

9 Ma k i n g S li d e s (Ov e r h e a d s )When preparing overheads you can either specify for yourself the font-size you would like, or use theslide class in LaTeX. The les will need to be of the form

\documentclass[10pt]slides\begindocument

\setcounterslide0 % Sets first slide to be numbered slide 1.\beginslideThis is your first slide\endslide\beginslideThis is the second slide\endslide\enddocument

The slide class au tomat ically centr es your t ext an d pictu res on th e page, and increases th e size of the font to the right size. The \beginslide \endslide is for creating seperately numberedslides, and if one slide has too much on it, the text etc. will ow on to a new page but with the sameslide number.Whenever you include graphics in, tr y and have th e fonts on your graphs the same size as t he t ext.This can be done in matlab by typing set(gca,’fontsize’,20) , where gca is th e cur rent axis. Th is youmu st t ype after t he rst plot, an d before any subsequent plots or legends. I f adding additional text t oth e graph , you m ust specify the font size as par t of the comm an d e.g. text(0,0,’Spon’,’fontsize’,20) .In matlab you can also adjust the line thickness via plot(x,y,’linewidth’,2) With other packagesthere are similar means of adjusting the font size, if you only have t he postscript le, t hen psfragdetailed elsewhere in t his booklet sh ould be able to help you.

10 S c a li n g a n y t h i n g (u s i n g p s t ri c k s )

1 0.1 S c a li n g t o a s p e c i c s i zeYou can also create your own sizes as in the following exampleFor width of 6cm and height 0.5cm

Height at 0.5cm an d rest scaled a ccordingly\scaleboxto(6,0.5)For width of 6cm and height 0.5cm \\\scaleboxto(0,0.5)Height at 0.5cm and rest scaled accordingly

Page 26: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 26/33

Guid e to Utilities (created on J un e 21, 2001) 24

Or should you wish to create a pretty picture

\documentclass[12pt]article\usepackagepstricks,amssymb\begindocument\unitlength=1cm\scaleboxto(2,0)\KillGlue\pspicture*(0,0)(5,5)\pssetxunit=1cm\pssetyunit=1cm\rput(2.5,2.5)\scaleboxto(5,0)$\bigstar$\rput(2,3)\white \scaleboxto(0,.25)$\backsim$\rput(3,3)\white \scaleboxto(0,.25)$\backsim$\rput(2.5,1.75)\white \scaleboxto(1,0.5)$\smallsmile$\rput(2,2.5)\white \scaleboxto(1,0.5)$\circleddash$\rput(3,2.5)\white \scaleboxto(1,0.5)$\circledcirc$\endpspicture\DontKillGlue\enddocument

10.2 Sca l ing ob jec t s by a xed fac to rTo scale an ything by a xed factor use t he comm an d \scaleboxe.g.1 \scalebox2This is scaled by a factor of 2

This is sca led by a factor of 2e.g.2 \scalebox0.5This is scaled by a factor of 0.5This is scaled by a factor of 0.5

11 S u r ro u n d i n g P i c t u re s w i th Te x tYou must put \usepackagegraphicx,picinpar before th e \begindocument statement .The rst line starts with a begin statement, then after the square brackets you must specify howman y lines you wish to include the pictur e, in t his case 2. Next you must specify the horizonta lposition you wish t he pictur e to be at c(centred), l(left ), or r(r ight ). Follow this with an includegraphics statement , insert your text and nish it with an end statement .

\beginfigwindow[2,r,%\includegraphics[width=6cm,height=4cm]colbuild.ps,%Our Building]While mathematics and statistics are enjoyable and interesting\linebreak subjects, they also have many important...and statistics to advanced fourth year courses in exciting new\endfigwindow

While mathematics and statistics are enjoyable and interesting subjects, they also have manyimporta nt practical applications. These are not limited to engineers and scientists. There is in

Page 27: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 27/33

Guid e to Utilities (created on J un e 21, 2001) 25

fact, much in ma thema tics an d stat istics t ointer est a wide ra nge of stu dents. If you en- joyed th ese subjects at school th en n o mat -ter what degree you are thinking of taking,th ey will have somethin g to offer you.At Canterbury, the Department of Mathe-matics and Statistics offers a wide variety

and choice of courses, ran ging from corelevel 100 papers in algebra, calculus andstatistics to advanced fourth year coursesin exciting new areas

Figure 2: Our Building12 P s tric ksPstricks is a collection of tools for producing graphics

Start off by specifying the area youwish to use (defau l t un i t s a re cm)and insert a grid (psgrid)

\ begin pspicture (0,0)(6,6) \ psgrid \ en d pspicture

³

0 1 2 3 4 5 6

0

1

2

3

4

5

6

Now you ca n specify poin tswhere you wish to p lace ob ject s \ begin pspicture (0,0)(6,6) \ psgrid \ rput(1,2) \ pscircle 1 \ rput(4,3) \ pswedge 2545 \ en d pspicture

³

0 1 2 3 4 5 6

0

1

2

3

4

5

6

Using the psplot utility you can plot graphs using reverse polish notation

← \ psplot -55x 180 mu l 3.14159 div sin

Page 28: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 28/33

Guid e to Utilities (created on J un e 21, 2001) 26

0 1 2 3−1−2−3

\ radians \ psset xunit=2cm,yun it=10cm,plotpoints=200 \ begin pspicture (-3.1415,0)(3.1415,0.5) \ psaxes[linewidth=1pt] <-> (0,0)(-3.14,0)(3.14,0.5) \

psplot[linecolor=blue,linewidth=2pt] -3.1415 3.1415 2.71828 x d upmul neg 2 div exp 2 3.1415 mul sqrt div \ pscustom[llstyle=crosshatch,hatchcolor=red,linecolor=green,linewidth=2pt] \ psline(2,0)(-2,0) \ psplot[linecolor=blue,linewidth=2pt] -222.71828 x dup mu l neg 2 divexp 2 3.1415 mul sqrt div \ psline(2,0)(-2,0) \ en d pspicture

Page 29: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 29/33

Guid e to Utilities (created on J un e 21, 2001) 27

1 2.1 F lo w Ch a r tsIncluding pstricks an d pst-node in your \usepackage sta temen t allows you t o creat e nice owcha rt s su ch as t he one below.

A distribution is binomial when

• There is a xed number of trials, n

• Each t rial h as only two out comes, usually denoted success an dfailure.

• The probability of a success, p, remains constant from trial totrial,

• The trials ar e independent

Is n >30 and p <0.1

Is n*p >5 and n*(1-p) >5

Use P oisson a pproxima tion

Use Normal approximation

Use Binomial

No

No

Yes

Yes

A simple example is

Study

Pa ss Test

Yes

\rput(3cm,-8cm)\rnodeX\psframeboxStudy % Specifies that "Study"% is to be surrounded by a box% and placed at (3cm,-8cm) along% from the pencil to the% centre of "Study".

\rput(7,-6.7)\ovalnodeYPass Test % Specifies that "Pass Test"% is to be surrounded by a% circular node and placed% at (7,-6.7) along from% pencil to the centre of% Pass Test.

\nccurve[angleB=180]->XY % Specifies that there is to% be a curve between X and Y% such that the curve touches

% node Y at 180 degrees. The% -> signifies that you% which to include an arrow.

\lput*0Yes % Specifies to put "Yes"% within the line.

Page 30: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 30/33

Guid e to Utilities (created on J un e 21, 2001) 28

13 P S FRAGPsfrag is a program tha t allows you to modify the text in existing postscript pictur es. The docu-ment at ion for th is pa ckage can be foun d in “/usr/local/tex/texmf/doc/lat ex/psfrag”. You m ust add toyour \ usepackage psfrag and you can then modify the existing text in your postscript to producetransformations as illustrated below, the corresponding LaTeX code follows

The Original Picture The Modied Pictur e

6 2040

6080

100

−2.75 −1.5

−0.25 1

20

1

2

3

VelocityAcceleration

F u e l

C o n s u m p

t i o n

Plot of Smoothed (once) average fuel consumption

6 2040

6080

100

−2.75 −1.5

−0.25 1

20

1

2

3

Plot of Smoothed (once) average fuel consumption

Ac c e l e r a t i o n ( m / s 2 )

V e l o c i t y ( k m / h r )

F u e

l C o n s u

m p t i o n

( m l / s )

\documentclass[12pt]article\usepackagegraphicx,psfrag\begindocument\pspicture*(0,0)(17,8)\rput(4,4)\includegraphics[height=4cm]mesh.eps % ORIGINAL PICTURE\psfragAcceleration[b][br][0.8][335]\beginminipage[h]5cm\textbf Acceleration ( $\mathbfm/sˆ2$) \endminipage\psfragVelocity[b][t][0.8][15]\beginminipage[h]5cm\hspace*1.25cmVelocity (km/hr) \endminipage\psfragPlot of Smoothed (once) average fuel consumption[b][t][1][0]Plot of Smoothed average fuel consumption\psfragFuel Consumption[b][t][0.8]\beginminipage[h]5cm\vspace*-1cm Fuel Consumption (ml/s)\endminipage\rput(12,4)\includegraphics[height=7cm]mesh.eps % MODIFIED PICTURE

\enddocument

A psfra g stat ement consists of 5 par ts. Pa rt 1 is the t ext you wan t t o modify, part 2 is the positionof existing text, pa rt 3 is th e position of th e modied text, pa rt 4 is th e an gle of the m odied text, an dpart 5 is the modied text.

Page 31: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 31/33

Guid e to Utilities (created on J un e 21, 2001) 29

14 Th e s i s R e qu i re m e n t s

14 .1 P a g e B o rd e rsThe spacing ar ound your text on t he pa ge by latex has by default odd page left mar gin of 3cm, a neven page left m ar gin of 4.5cm a nd a top ma rgin of 4.5cm. To obta in th e required m ar gins for a th esisinclude before your “ \begindocument ”

\documentclass[12pt]article\usepackagepostscript,twoside\setlength\textwidth16.2cm\setlength\textheight24.4cm\setlength\oddsidemargin0cm\setlength\evensidemargin-0.5cm\topmargin -0.5cm \headsep 1.3cm

14 .2 P a g e n u m b e ri n g e t c .\markbothLeft headerright header

e.g. \markboth\thesection\thesubsection

1 4.3 Ti t le p a g e\begintitlepage\begincenter\large \textbfUniversity of Canterbury\\Department of Mathematics and Statistics\endcenter\includegraphics[width=3cm]coat1.ps\begincenter

\LARGE \textbf Fuel Consumption Models \\\LARGE \textbf for Traffic Modelling by\\\LARGE \textbf the Canterbury Regional Council\\\endcenter\begincenter\textbf\rule[1ex]6cm1pt\\A thesis submitted in\\partial fulfilment\\of the requirements of\\the Degree for\\Master of Science in Statistics\\at the\\University of Canterbury\\by\\Julian Silvester Visch\\\rule[1ex]6cm1pt\\Supervisor: Dr Easaw Chacko\\1995\endcenter\endtitlepage

Page 32: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 32/33

Guid e to Utilities (created on J un e 21, 2001) 30

15 La te x i n g i n P a r tsWith a large paper or thesis one can break it down into parts

e.g.

\ documentclass[12pt] article \ usepackage postscript,twoside \ setlength \ textwidth 16.2cm \ setlength \ textheight 24.4cm \ setlength \ oddsidemargin 0cm \ setlength \ evensidemargin -0.5cm \ topmargin -0.5cm \ headsep 1.3cm \ includeonly introduction,conclusion \ begin document \ include title \ tableofcontents \ include introduction

\ include section1 \ include section2 \ include section3 \ include conclusion \ en d document

This is the introduct ion, note there is nodocumentclass or begin document s tate-ment as these a re a l l p resen t in the mas-ter le, th e same goes for t he end documentstat ement. The introduction is just a chap-ter literally cut and pasted into a new le.This will mak e reading easier a s well as pr o-cessing as one can process all or a selectionvia the \ includeonly statement.

introduction.tex

Page 33: Grad Guide Latex

8/8/2019 Grad Guide Latex

http://slidepdf.com/reader/full/grad-guide-latex 33/33

Indexabstra ct, 17acknowledgements, 17append ix, 17Area, shaded, 14ar ra y, 11arr aystretch, 11

chapt ers, 16colortab, 13, 14colortbl, 13colour, 4content s, 16

enumerating, 9equation, 11equation array, 12

owcha rt s, 27font , sizes, 2font, styles, 2fonts, 2fonts, fancy, 5fonts, colour, 4font s, gr ay, 3font s, postscript, 6footers, 18

glossary, 16gra y, 3, 14

headers, 18horizont al, spa ce, 8

index, 16itemising, 9

longtable, 15

makeindex, 16mat hemat ics, 10

overhead s, 23

page, numbering, 18page, numbering none, 18pagestyles, 18pictu res, 19psfrag, 28

report, 16

scaling, 23slides, 23space, horizont al, 8space, vertical, 8symbols, 10

ta bles, 13

vertical, space, 8

wrapping text, 24