A Practical Introduction to the Lout Document Formatting System - - PDF document

a practical introduction to the lout document formatting
SMART_READER_LITE
LIVE PREVIEW

A Practical Introduction to the Lout Document Formatting System - - PDF document

lout 1 A Practical Introduction to the Lout Document Formatting System Jeffrey H. Kingston Basser Dept. of Computer Science The University of Sydney lout 2 A simple input file @SysInclude { doc } @Doc @Text @Begin Hello, world @End


slide-1
SLIDE 1

lout 1

A Practical Introduction to the Lout Document Formatting System

Jeffrey H. Kingston Basser Dept. of Computer Science The University of Sydney

slide-2
SLIDE 2

lout 2

A simple input file

@SysInclude { doc } @Doc @Text @Begin Hello, world @End @Text

How to format it

lout filename > out.ps ghostview out.ps mpr out.ps

slide-3
SLIDE 3

lout 3

Hello, world

slide-4
SLIDE 4

lout 4

Headings and paragraphs

@SysInclude { doc } @Doc @Text @Begin @Heading { Introduction } @PP The design of the Lout formatting system was undertaken with the needs of the @I { ordinary user } very much in mind. @End @Text

slide-5
SLIDE 5

lout 5

Introduction The design of the Lout formatting system was undertaken with the needs of the ordinary user very much in mind.

slide-6
SLIDE 6

lout 6

Displays

You certainly don’t want to return to his office and report: @IndentedDisplay @I { ‘I can’t find an efficient algorithm, I guess I’m just too dumb.’ } To avoid serious damage to your position in the company, it would be better if ...

slide-7
SLIDE 7

lout 7

You certainly don’t want to return to his office and report: ‘I can’t find an efficient algorithm,I guess I’m just too dumb.’ To avoid serious damage to your position in the company, it would be better if …

slide-8
SLIDE 8

lout 8

Paragraph breaking styles

You certainly don’t want to return to his office and report: @ID { ragged nohyphen } @Break @I { ‘I can’t find an efficient algorithm, I guess I’m just too dumb.’ } To avoid serious damage to your position in the company, it would be better if ...

slide-9
SLIDE 9

lout 9

You certainly don’t want to return to his office and report: ‘I can’t find an efficient algorithm,I guess I’m just too dumb.’ To avoid serious damage to your position in the company, it would be better if …

slide-10
SLIDE 10

lout 10

Lists

@Heading { Operating Instructions } @NumberedList @ListItem { Press small green lever. } @ListItem { Wait approximately 10 seconds until red light flashes. } @ListItem { If smoke emerges from rear of unit, call Service Department. } @EndList

slide-11
SLIDE 11

lout 11

Operating Instructions 1. Press small green lever. 2. Wait approximately 10 seconds until red light flashes. 3. If smoke emerges from rear of unit, call Service Department.

slide-12
SLIDE 12

lout 12

Technical reports

@SysInclude { report } @Report @Title { ... } @Author { ... } @Institution { ... } @DateLine { ... } // @Abstract { ... } @Section { ... } @Section { ... } @Section { ... } @Appendix { ... } @Appendix { ... }

slide-13
SLIDE 13

lout 13

Sections

@Section @Tag { dfs } @Title { Depth-first search } @Begin @PP We turn now to our first algorithm

  • n general graphs ...

@End @Section

slide-14
SLIDE 14

lout 14

10.6. Depth-first search We turn now to our first algorithm on general graphs …

slide-15
SLIDE 15

lout 15

Cross references

For further information, consult Section @NumberOf dfs on page @PageOf { dfs }.

slide-16
SLIDE 16

lout 16

For further information, consult Section 10.6 on page 245.

slide-17
SLIDE 17

lout 17

References

@Database @Reference { myrefs } ... For the details, consult the User’s Guide @Cite { $kingston1995lout.user }.

slide-18
SLIDE 18

lout 18

For the details, consult the User’s Guide [1]. … References 1. Jeffrey H. Kingston. A User’s Guide to the Lout Document Formatting System (Version 3). Basser Department of Computer Science, University

  • f Sydney, 1995.

2. …

slide-19
SLIDE 19

lout 19

Database file myrefs.ld

{ @Reference @Tag { kingston1995lout.user } @Type { Book } @Author { Jeffrey H. Kingston } @Title { A User’s Guide to the Lout Document Formatting System (Version 3) } @Institution { Basser Department of Computer Science } @Address { University of Sydney 2006, Australia } @Year { 1994 } }

slide-20
SLIDE 20

lout 20

Books (and theses)

  • Title page, preface, introduction
  • Automatic table of contents
  • Prefatory pages numbered in Roman numerals
  • Chapters, sections, subsections, appendices
  • References at end of chapters or book
  • Running page headers
  • Odd-even page formats
  • Sorted index
slide-21
SLIDE 21

lout 21

Making a sorted index

@PP There are several possible ways to implement the @I Partition procedure, partition @Index { @I Partition (in {@I Quicksort}) } but the following seems to be the best. Starting ...

slide-22
SLIDE 22

lout 22

Index … partial order, 227 Partition (in Quicksort), 189 postorder traversal

  • f binary tree, 19

topological ordering, 229 …

slide-23
SLIDE 23

lout 23

Equation formatting

@SysInclude { eq } ... Since @Eq { T(n-i) = T(0) = 0 } we have @IndentedDisplay @Eq { T(n) = big sum from i=0 to n-1 2 sup i = 2 sup n - 1 } for the number of disk moves made by the Towers

  • f Hanoi algorithm, given @Eq { n } disks.
slide-24
SLIDE 24

lout 24

Since T(n − i) = T(0) = 0 we have T(n) =

n−1

i=0 i

2 =

n

2 − 1 for the number of disk moves made by the Towers of Hanoi algorithm, given n disks.

slide-25
SLIDE 25

lout 25

Another equation

@CenteredDisplay @Eq { big int supp 1 on 0 ‘ dx over sqrt { 1 - x sup 2 } = pi over 2 }

slide-26
SLIDE 26

lout 26

1

dx

√1 −

2

x = π 2

slide-27
SLIDE 27

lout 27

Tables

@SysInclude { tab } ... @Tab @Fmta { @Col @I A ! @Col B } { @Rowa A { Fortran } B { The first ... language } @Rowa A { Algol-60 } B { Said to be ... successors } @Rowa A { Pascal } B { The famous ... successors } }

slide-28
SLIDE 28

lout 28

Fortran The first high-level programming language Algol-60 Said to be a better language than most of its successors Pascal The most famous of Algol-60’s successors

slide-29
SLIDE 29

lout 29

Another table

@Tab hmargin { 0.4c } vmargin { 0.3v } side { single } @Fmta { @Col @B @CC X @Over A,B,C } @Fmtb { @Col @I A ! @Col B !! @Col C } { @Rowa above { single } X { Value of mathematical ... dollars) } @Rowb above { double } A { Quadratic formula } B { @Eq { x ^= { ... } over 2a } } C { 3^.5 } @Rowb below { single } A { Binomial theorem } B { @Eq { ( a + b ) sup n ^= ... b sup n-k } } C { 12^ } }

slide-30
SLIDE 30

lout 30

Value of mathematical formulae (millions of dollars) Quadratic formula x = −b ± √

2

b − 4ac 2a 3.5 Binomial theorem (a + b n ) =

k =0(

n k)

k

a

n−k

b 12

slide-31
SLIDE 31

lout 31

Pascal programs

@SysInclude { pas } ... @ID @Pas { procedure DoPriAbstract(root: PriEntry); begin if root^.leftchild <> nil then begin DoPriAbstract(root^.leftchild); write(’, ’); end; PriKeyAbstract(root^.key); write(’:’); PriValueAbstract(root^.value); if root^.rightchild <> nil then begin write(’, ’); DoPriAbstract(root^.rightchild); end; end; }

slide-32
SLIDE 32

lout 32

procedure DoPriAbstract(root: PriEntry); begin if root↑.leftchild ≠ nil then begin DoPriAbstract(root↑.leftchild); write(’, ’); end; PriKeyAbstract(root↑.key); write(’:’); PriValueAbstract(root↑.value); if root↑.rightchild ≠ nil then begin write(’, ’); DoPriAbstract(root↑.rightchild); end; end;

slide-33
SLIDE 33

lout 33

Basic graphics

45d @Rotate 1.5 @Scale @Box { Hello, world }

slide-34
SLIDE 34

lout 34

H e l l

  • ,

w

  • r

l d

slide-35
SLIDE 35

lout 35

Advanced graphics

@SysInclude { fig } ... @Fig { @Box margin { 0c } paint { black } @Ellipse linestyle { noline } paint { white } { Hello, world } }

slide-36
SLIDE 36

lout 36

Hello, world

slide-37
SLIDE 37

lout 37

Point labelling

@Fig { A:: { 1:: @Ellipse { 3c @Wide 2c @High } //3c 2:: @Box { 3c @Wide 2c @High } } @ShowLabels }

slide-38
SLIDE 38

lout 38 A@1@NW A@2@SE A@1@NE A@1@N A@2@E A@2@W A@1@SE A@2@CTR A@2@SW A@1@W A@1@E A@2@S A@1@CTR A@1@SW A@2@NW A@2@N A@1@S A@2@NE

slide-39
SLIDE 39

lout 39

Graphs

@Graph abovecaption { New South Wales road deaths (per 100 million vehicle km) } { @Data points { plus } pairs { dashed } { 1963 5.6 1971 4.3 1976 3.7 1979 3.4 1982 2.9 1985 2.3 1988 2.0 } }

slide-40
SLIDE 40

lout 40

New South Wales road deaths (per 100 million vehicle km) 1960 1970 1980 1990 2 3 4 5 6

slide-41
SLIDE 41

lout 41

  • 2p @Font @Graph

style { axes } xorigin { 0 } yorigin { 0 } xticks { 10@ 50@ 100@ 200@ 500@ }

  • bjects { @NE at { 300 2 } @I { Exponential }

@SE at { ... } @I { Uniform } } belowcaption { @I n } { @Data points { filledcircle } { ... } @Data points { filledcircle } { ... } @Data pairs { dashed } { 10 2 500 2 } @Data pairs { dashed } { xloop from { 10 } to { 500 } by { 20 } do { x sqrt { pi*x / 4 } + 1 } } }

slide-42
SLIDE 42

lout 42

10 50 100 200 500 10 20 30 Exponential Uniform n