aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeffrey H. Kingston <jeff@it.usyd.edu.au>2010-09-14 19:21:41 +0000
committerJeffrey H. Kingston <jeff@it.usyd.edu.au>2010-09-14 19:21:41 +0000
commit71bdb35d52747e6d7d9f55df4524d57c2966be94 (patch)
tree480ee5eefccc40d5f3331cc52d66f722fd19bfb9 /include
parentb41263ea7578fa9742486135c762803b52794105 (diff)
downloadlout-71bdb35d52747e6d7d9f55df4524d57c2966be94.tar.gz
Lout 3.17.
git-svn-id: http://svn.savannah.nongnu.org/svn/lout/trunk@2 9365b830-b601-4143-9ba8-b4a8e2c3339c
Diffstat (limited to 'include')
-rw-r--r--include/README73
-rw-r--r--include/book376
-rw-r--r--include/bookf1263
-rw-r--r--include/bsf1563
-rw-r--r--include/bsf.lpg140
-rw-r--r--include/cprint70
-rw-r--r--include/cprintf383
-rw-r--r--include/diag193
-rw-r--r--include/diagf3845
-rw-r--r--include/diagf.etc627
-rw-r--r--include/diagf.lpg2706
-rw-r--r--include/doc353
-rw-r--r--include/docf779
-rw-r--r--include/dsf4644
-rw-r--r--include/eq27
-rw-r--r--include/eqf1643
-rw-r--r--include/fig27
-rw-r--r--include/figf909
-rw-r--r--include/figf.lpg1003
-rw-r--r--include/fontdefs156
-rw-r--r--include/graph27
-rw-r--r--include/graphf1084
-rw-r--r--include/graphf.etc295
-rw-r--r--include/graphf.lpg768
-rw-r--r--include/init34
-rw-r--r--include/langdefs16
-rw-r--r--include/latin29
-rw-r--r--include/latin2.fd143
-rw-r--r--include/modula27
-rw-r--r--include/modulaf137
-rw-r--r--include/mydefs9
-rw-r--r--include/pas27
-rw-r--r--include/pasf110
-rw-r--r--include/picture254
-rw-r--r--include/picturef37
-rw-r--r--include/report372
-rw-r--r--include/reportf895
-rw-r--r--include/russian10
-rw-r--r--include/russian.fd38
-rw-r--r--include/slides299
-rw-r--r--include/slidesf371
-rw-r--r--include/tab29
-rw-r--r--include/tabf936
-rw-r--r--include/tabf.lpg115
-rw-r--r--include/tbl79
-rw-r--r--include/tblf3127
-rw-r--r--include/tblf.lpg41
-rw-r--r--include/ts105
48 files changed, 30174 insertions, 0 deletions
diff --git a/include/README b/include/README
new file mode 100644
index 0000000..0204b0c
--- /dev/null
+++ b/include/README
@@ -0,0 +1,73 @@
+Directory lout/include
+
+This directory contains Lout source files for the standard packages.
+The following listing classifies them into types of files.
+
+Setup files (containing mainly lists of options settable by the user)
+---------------------------------------------------------------------
+
+ Setup files for basic document types (choose one):
+
+ doc The OrdinarySetup package
+ report The ReportSetup package
+ book The BookSetup package
+ slides The OverheadsSetup package
+ picture The IllustrationSetup package
+
+ Setup files for special-purpose packages (choose any combination):
+
+ tbl The Tbl table formatting package
+ tab The Tab table formatting package (OBSOLETE, use tbl)
+ eq The Eq equation formatting package
+ diag The Diag diagram drawing package
+ fig The Fig advanced graphics package (OBSOLETE, use diag)
+ graph The Graph graph drawing package
+ cprint The cprint C and C++ program printing package
+ pas The Pas Pascal progam printing package
+ modula The Modula Modula-2 progam printing package
+ latin2 The Latin2 (Eastern European characters) package
+ russian The Russian language package
+
+Source files (containing Lout and PostScript source code for the packages)
+--------------------------------------------------------------------------
+
+ bsf The BasicSetup package
+ bsf.lpg A PostScript prepend file needed by BasicSetup
+ dsf The DocumentSetup package
+ docf The OrdinarySetup package
+ reportf The ReportSetup package
+ bookf The BookSetup package
+ slidesf The OverheadsSetup package
+ picturef The IllustrationSetup package
+
+ tabf The Tab table formatting package (OBSOLETE)
+ tabf.lpg A PostScript prepend file needed by tabf (OBSOLETE)
+ tblf The Tbl table formatting package
+ tblf.lpg A PostScript prepend file needed by tblf
+ eqf The Eq equation formatting package
+ figf The Fig advanced graphics package (OBSOLETE)
+ figf.lpg A PostScript prepend file needed by figf (OBSOLETE)
+ diagf The Diag diagram drawing package
+ diagf.etc A file included by diagf
+ diagf.lpg A PostScript prepend file needed by diagf
+ graphf The Graph graph drawing package
+ graphf.etc A file included by graphf
+ graphf.lpg A PostScript prepend file needed by graphf
+ cprintf The cprint C and C++ program printing package
+ pasf The Pas Pascal progam printing package
+ modulaf The Modula Modula-2 progam printing package
+ latin2.fd Latin2 font definitions file (placeholder file)
+ russian.fd Russian font definitions file (placeholder file)
+
+Miscellaneous
+-------------
+
+ fontdefs Standard font definitions file
+ langdefs Standard language definitions file
+ mydefs Empty file for if the user doesn't have one
+ ts The ToySetup package (an expert users' intro. example)
+ init A Lout source file used during installation (lout -x)
+
+
+Jeffrey H. Kingston
+26 May 1999
diff --git a/include/book b/include/book
new file mode 100644
index 0000000..2d28f62
--- /dev/null
+++ b/include/book
@@ -0,0 +1,376 @@
+###############################################################################
+# #
+# Lout setup file for books #
+# #
+# Jeffrey H. Kingston #
+# 17 September 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# @SysInclude commands for standard packages. #
+# #
+###############################################################################
+
+ @SysInclude { fontdefs } # font definitions
+ @SysInclude { langdefs } # language definitions
+ @SysInclude { bsf } # BasicSetup package
+ @SysInclude { dsf } # DocumentSetup package
+ @SysInclude { bookf } # BookSetup extension
+
+
+###############################################################################
+# #
+# @Include command for reading personal definitions from current directory. #
+# #
+###############################################################################
+
+ @Include { mydefs }
+
+###############################################################################
+# #
+# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @BasicSetup
+ # @InitialFont { Times Base 12p } # initial font
+ # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}}
+ # @InitialSpace { lout } # initial space style
+ # @InitialLanguage { English } # initial language
+ # @InitialColour { black } # initial colour
+ # @OptimizePages { No } # optimize page breaks?
+ # @HeadingFont { Bold } # font for @Heading
+ # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs
+ # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP
+ # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays
+ # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent
+ # @DefaultIndent { 0.5rt } # @Display indent
+ # @DisplayNumStyle { (num) } # style of display numbers
+ # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent
+ # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent
+ # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists
+ # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items
+ # @ListIndent { 0s } # indent of list items
+ # @ListRightIndent { 0s } # right indent of list items
+ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags
+ # @NumberSeparator { . } # separates nums like 2.3.7
+}
+
+
+###############################################################################
+# #
+# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @DocumentSetup
+ # @PageType { A4 @OrIfPlain Other} # page type (width, height)
+ # @PageWidth { 80s } # page width if type Other
+ # @PageHeight { 66f } # page height if type Other
+ # @PageOrientation { Portrait } # Portrait, Landscape, etc.
+ # @PageBackground { } # background of each page
+ # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages
+ # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages
+ # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages
+ # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages
+ # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages
+ # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages
+ # @PageBoxType { None } # None Box CurveBox ShadowBox
+ # @PageBoxMargin { 1.00c } # page box margin
+ # @PageBoxLineWidth { } # page box line thickness
+ # @PageBoxPaint { none } # page box paint
+ # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox
+ # @ColumnNumber { 1 } # number of columns (1 to 10)
+ # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap
+ # @FigureLocation { PageTop } # default figure location
+ # @TableLocation { PageTop } # default table location
+ # @FigureFormat { @CC @Body } # default figure format
+ # @TableFormat { @CC @Body } # default table format
+ # @FigureWord { figure } # "Figure" word else anything
+ # @TableWord { table } # "Table" word else anything
+ # @FigureNumbers { Arabic } # method of numbering figures
+ # @TableNumbers { Arabic } # method of numbering tables
+ # @FigureCaptionPos { Below } # Above or Below
+ # @TableCaptionPos { Below } # Above or Below
+ # @CaptionFont { } # figure, table caption font
+ # @CaptionBreak { } # figure, table caption break
+ # @CaptionFormat { @B { number @DotSep @OneCol } } # figure, table caption format
+ # @MakeFigureContents { No } # list of figures at start
+ # @MakeTableContents { No } # list of tables at start
+ # @MakeContents { No } # make contents? Yes or No
+ @MakeContents { Yes } # make contents? Yes or No
+ # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry
+ # @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry
+ # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry
+ # @ContentsFont { Bold } # font for major entry
+ # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry
+ # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry
+ # @ContentsFormat { number @DotSep title } # contents entry format
+ # @ContentsLeader { .. } # leader symbol in contents
+ # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders
+ # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width
+ # @MakeReferences { Yes } # make references? Yes or No
+ # @RefCiteStyle { [cite] } # citation style
+ # @RefCiteLabels { @RefNum } # citation items
+ # @RefNumbers { Arabic } # reference numbers
+ # @RefListFormat { Labels } # NoLabels, Labels, etc.
+ # @RefListLabels { [@RefNum] } # ref list label format
+ # @RefListTitle { references } # title of reference list
+ # @ChapRefListTitle { references } # title of chapter ref list
+ # @RefListIndent { 0s } # indent to left of labels
+ # @RefListRightIndent { 0s } # indent to right of items
+ # @RefListGap { @ListGap } # gap between ref list items
+ # @RefListFont { } # font used in reference list
+ # @RefListBreak { } # break style of ref list
+ # @RefListLabelWidth { @ListLabelWidth } # Labels column width
+ # @RefListSortKey { @Tag } # sorting key
+ # @MakeIndex { No } # make index? Yes or No
+ @MakeIndex { Yes } # make index? Yes or No
+ # @IndexFont { } # index entries font
+ # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexColumnNumber { 2 } # index columns (1 to 10)
+ # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap
+ # @MakeIndexA { No } # make index A? Yes or No
+ # @IndexAFont { } # index A entries font
+ # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexAColumnNumber { 2 } # index A columns (1 to 10)
+ # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap
+ # @MakeIndexB { No } # make index B? Yes or No
+ # @IndexBFont { } # index B entries font
+ # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexBColumnNumber { 2 } # index B columns (1 to 10)
+ # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap
+ # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures
+ # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text
+ # @FootNoteNumbers { Arabic } # footnote numbers
+ # @FootNoteThrough { No } # numbered through chapter?
+ # @FootNoteLocation { ColFoot } # where the footnote appears
+ # @FootNoteFont { 0.80f } # font for footnotes
+ # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes
+ # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format
+ # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line
+ # @FootAboveGap { @DisplayGap } # gap above footnote line
+ # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes
+ # @MarginNoteFont { 0.80f } # font of margin notes
+ # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes
+ # @MarginNoteHGap { 0.5c } # horizontal gap to notes
+ # @MarginNoteVGap { @DisplayGap } # min vertical gap between
+ # @MarginNoteWidth { 1.50c } # width of margin notes
+ # @EndNoteNumbers { Arabic } # endnote numbers
+ # @EndNoteFont { 0.80f } # font of endnotes
+ # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes
+ # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format
+ # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes
+ # @TheoremWord { theorem } # "Theorem" word, etc.
+ # @TheoremTitleFormat { (title) } # only if title present
+ # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @DefinitionWord { definition } # "Definition" word, etc.
+ # @DefinitionTitleFormat { (title) } # only if title present
+ # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ClaimWord { claim } # "Claim" word, etc.
+ # @ClaimTitleFormat { (title) } # only if title present
+ # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @PropositionWord { proposition } # "Proposition" word, etc.
+ # @PropositionTitleFormat { (title) } # only if title present
+ # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @LemmaWord { lemma } # "Lemma" word, etc.
+ # @LemmaTitleFormat { (title) } # only if title present
+ # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @CorollaryWord { corollary } # "Corollary" word, etc.
+ # @CorollaryTitleFormat { (title) } # only if title present
+ # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ExampleWord { example } # "Example" word, etc.
+ # @ExampleTitleFormat { (title) } # only if title present
+ # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ProofWord { proof } # "Proof" word, etc.
+ # @PageHeaders { Simple } # None Simple Titles NoTitles
+ @PageHeaders { Titles } # None Simple Titles NoTitles
+ # @PageNumbers { Arabic } # page numbers
+ # @FirstPageNumber { 1 } # number of first page
+ # @IntroPageNumbers { Roman } # intro page numbers
+ # @IntroFirstPageNumber{ 1 } # number of first intro page
+ # @StructPageNums { No } # make structured page numbers
+
+ # @OddTop { @Centre{- @PageNum -} } # Simple page headers
+ # @OddFoot { @Null }
+ # @EvenTop { @Centre{- @PageNum -} }
+ # @EvenFoot { @Null }
+ # @StartOddTop { @Null }
+ # @StartOddFoot { @Null }
+ # @StartEvenTop { @Null }
+ # @StartEvenFoot { @Null }
+ # @IntroOddTop { @Null }
+ # @IntroOddFoot { @Centre @PageNum }
+ # @IntroEvenTop { @Null }
+ # @IntroEvenFoot { @Centre @PageNum }
+ # @IntroStartOddTop { @Null }
+ # @IntroStartOddFoot { @Null }
+ # @IntroStartEvenTop { @Null }
+ # @IntroStartEvenFoot { @Null }
+
+ # Titles, NoTitles headers
+ # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum }
+ # @RunningOddFoot { @Null }
+ # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} }
+ # @RunningEvenFoot { @Null }
+ # @RunningStartOddTop { @Null }
+ # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ # @RunningStartEvenTop { @Null }
+ # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ # @RunningIntroOddTop { @Null }
+ # @RunningIntroOddFoot { @Right @PageNum }
+ # @RunningIntroEvenTop { @Null }
+ # @RunningIntroEvenFoot { @PageNum }
+ # @RunningIntroStartOddTop { @Null }
+ # @RunningIntroStartOddFoot { @Null }
+ # @RunningIntroStartEvenTop { @Null }
+ # @RunningIntroStartEvenFoot { @Null }
+}
+
+
+###############################################################################
+# #
+# The @BookSetup @Use clause - options specific to books. #
+# #
+###############################################################################
+
+@Use { @BookSetup
+ # @TitlePageFont { Helvetica Base} # title page font (not size)
+ # @SeparateIntroNumbering { Yes } # separate intro page numbers
+ # @PrefaceAfterContents { No } # Yes or No
+ # @ChapterStartPages { Any } # Any, Odd, or Even
+ # @ReferencesBeforeAppendices { No } # references before appendices
+ # @PrefaceWord { preface } # word for "Preface"
+ # @ContentsWord { contents } # word for "Contents"
+ # @FigureListWord { figurelist } # word for "List of Figures"
+ # @TableListWord { tablelist } # word for "List of Tables"
+ # @IntroductionWord { introduction } # word for "Introduction"
+ # @ChapterWord { chapter } # word for "Chapter"
+ # @AppendixWord { appendix } # word for "Appendix"
+ # @IndexWord { index } # word for "Index"
+ # @IndexAWord { index } # word for "Index" (A)
+ # @IndexBWord { index } # word for "Index" (B)
+ # @ChapterNumbers { Arabic } # kind of chapter numbers
+ # @FirstChapterNumber { 1 } # first chapter number (Arabic)
+ # @SectionNumbers { Arabic } # kind of section numbers
+ # @FirstSectionNumber { 1 } # first section number (Arabic)
+ # @SubSectionNumbers { Arabic } # kind of subsection numbers
+ # @FirstSubSectionNumber { 1 } # first subsect number (Arabic)
+ # @SubSubSectionNumbers { Arabic } # kind of sub-subs. numbers
+ # @FirstSubSubSectionNumber { 1 } # first sub-sub number (Arabic)
+ # @AppendixNumbers { UCAlpha } # kind of appendix numbers
+ # @FirstAppendixNumber { 1 } # first appendix num (Arabic)
+ # @SubAppendixNumbers { Arabic } # kind of subappendix numbers
+ # @FirstSubAppendixNumber { 1 } # first sub-app num (Arabic)
+ # @SubSubAppendixNumbers { Arabic } # kind of sub-subapp. numbers
+ # @FirstSubSubAppendixNumber { 1 } # first sub-sub num (Arabic)
+ # @PartHeadingFont { Helvetica Base 2.50f } # part head font
+ # @PartHeadingBreak { clines 1.2fx nohyphen } # part head break
+ # @PartHeadingFormat { @CD number @DP @CD title } # part head format
+ # @ChapterHeadingFont { Bold 2.00f } # chapter head font
+ # @ChapterHeadingBreak { ragged 1.2fx nohyphen } # chapter head break
+ # @ChapterHeadingFormat { number @DotSep title } # format of chap. head
+ # @SectionHeadingFont { Bold } # section head font
+ # @SectionHeadingBreak { ragged 1.2fx nohyphen } # section head break
+ # @SectionHeadingFormat { number @DotSep title } # section head fmt
+ # @SubSectionHeadingFont { Bold } # subs. head font
+ # @SubSectionHeadingBreak { ragged 1.2fx nohyphen } # subs. head break
+ # @SubSectionHeadingFormat { number @DotSep title } # subs. head fmt
+ # @SubSubSectionHeadingFont { Slope } # sub-subs. head font
+ # @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } # sub-subs. head break
+ # @SubSubSectionHeadingFormat { number @DotSep title } # sub-subs. head fmt
+ # @AppendixHeadingFont { Bold 2.00f } # appendix head font
+ # @AppendixHeadingBreak { ragged 1.2fx nohyphen } # appendix head break
+ # @AppendixHeadingFormat { number @DotSep title } # appendix head fmt
+ # @SubAppendixHeadingFont { Bold } # subapp. head font
+ # @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } # subapp. head break
+ # @SubAppendixHeadingFormat { number @DotSep title } # subapp. head fmt
+ # @SubSubAppendixHeadingFont { Slope } # sub-suba. head font
+ # @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } # sub-suba. head break
+ # @SubSubAppendixHeadingFormat{ number @DotSep title } # sub-suba. head fmt
+ # @AbovePartGap { 4.00f } # gap above part title
+ # @AboveChapterGap { 3.00f } # above major titles
+ # @SectionGap { 2.0v @OrIfPlain 3f } # between sections
+ # @SubSectionGap { 1.5v @OrIfPlain 2f } # between subsects
+ # @SubSubSectionGap { 1.5v @OrIfPlain 2f } # between sub-subs.
+ # @SubAppendixGap { 2.0v @OrIfPlain 3f } # between subappendices
+ # @SubSubAppendixGap { 1.5v @OrIfPlain 2f } # between sub-subapps
+ # @AbbreviationsInContents { Yes } # add abbreviations to contents
+ # @IntroductionInContents { Yes } # add introduction to contents
+ # @PartInContents { Yes } # add parts to contents
+ # @ChapterInContents { Yes } # add chapters to contents
+ # @SectionInContents { Yes } # add sections to contents
+ # @SubSectionInContents { Yes } # add subsections to contents
+ # @SubSubSectionInContents { No } # add sub-subsects to contents
+ # @AppendixInContents { Yes } # add appendices to contents
+ # @SubAppendixInContents { Yes } # add subappendices to contents
+ # @SubSubAppendixInContents { No } # add sub-subapps to contents
+ # @ReferencesInContents { Yes } # add ref. section to contents
+ # @IndexInContents { Yes } # add index to contents
+ # @IndexAInContents { Yes } # add index A to contents
+ # @IndexBInContents { Yes } # add index B to contents
+ # @PartContentsIndent { 0.5rt } # indent of part contents entry
+ # @ChapterNumInTheorems { Yes } # theorem num has chapter num
+ # @SectionNumInTheorems { No } # theorem num has section num
+ # @SubSectionNumInTheorems { No } # theorem num has subsect num
+ # @SubSubSectionNumInTheorems { No } # theorem num has sub-ss. num
+ # @AppendixNumInTheorems { Yes } # theorem num has appendix num
+ # @SubAppendixNumInTheorems { No } # theorem num has sub-app num
+ # @SubSubAppendixNumInTheorems{ No } # theorem num has sub-sa. num
+ # @ChapterNumInDisplays { Yes } # display num has chapter num
+ # @SectionNumInDisplays { Yes } # display num has section num
+ # @SubSectionNumInDisplays { No } # display num has subsect num
+ # @SubSubSectionNumInDisplays { No } # display num has sub-ss. num
+ # @AppendixNumInDisplays { Yes } # display num has appendix num
+ # @SubAppendixNumInDisplays { Yes } # display num has sub-app num
+ # @SubSubAppendixNumInDisplays{ No } # display num has sub-sa. num
+ # @ChapterNumInFigures { Yes } # figure num has chapter num
+ # @SectionNumInFigures { No } # figure num has section num
+ # @SubSectionNumInFigures { No } # figure num has subsect num
+ # @SubSubSectionNumInFigures { No } # figure num has sub-ss. num
+ # @AppendixNumInFigures { Yes } # figure num has appendix num
+ # @SubAppendixNumInFigures { No } # figure num has sub-app num
+ # @SubSubAppendixNumInFigures { No } # figure num has sub-sa. num
+ # @ChapterNumInTables { Yes } # table num has chapter num
+ # @SectionNumInTables { No } # table num has section num
+ # @SubSectionNumInTables { No } # table num has subsect num
+ # @SubSubSectionNumInTables { No } # table num has sub-ss. num
+ # @AppendixNumInTables { Yes } # table num has appendix num
+ # @SubAppendixNumInTables { No } # table num has sub-app num
+ # @SubSubAppendixNumInTables { No } # table num has sub-sa. num
+ # @SectionNumInRunners { Yes } # runners have section num
+ # @SubSectionNumInRunners { No } # runners have subsect num
+ # @SubSubSectionNumInRunners { No } # runners have sub-ss. num
+ # @SubAppendixNumInRunners { Yes } # runners have sub-app num
+ # @SubSubAppendixNumInRunners { No } # runners have sub-sa. num
+ # @PrefacePrefix { } # for structured page nums
+ # @ContentsPrefix { } # for structured page nums
+ # @FigureContentsPrefix { } # for structured page nums
+ # @TableContentsPrefix { } # for structured page nums
+ # @AbbreviationsPrefix { } # for structured page nums
+ # @IntroductionPrefix { } # for structured page nums
+ # @ChapterPrefix { } # for structured page nums
+ # @AppendixPrefix { } # for structured page nums
+ # @ReferencesPrefix { } # for structured page nums
+ # @IndexPrefix { } # for structured page nums
+ # @IndexAPrefix { } # for structured page nums
+ # @IndexBPrefix { } # for structured page nums
+}
+
+
+###############################################################################
+# #
+# @Database (and @SysDatabase) clauses go here. #
+# #
+###############################################################################
+
+@SysDatabase @RefStyle { refstyle } # reference printing styles
diff --git a/include/bookf b/include/bookf
new file mode 100644
index 0000000..fe5ab72
--- /dev/null
+++ b/include/bookf
@@ -0,0 +1,1263 @@
+
+###########################################################################
+# #
+# @BookSetup extension to @DocumentSetup. #
+# #
+# Jeffrey H. Kingston #
+# 17 September 1999 #
+# #
+# This package extends DocumentSetup with definitions for books. #
+# #
+###########################################################################
+
+extend @BasicSetup @DocumentSetup
+export @Book @Preface @Abbreviations @Introduction @Chapter @Appendix
+def @BookSetup
+ named @TitlePageFont { Helvetica Base }
+ named @SeparateIntroNumbering { Yes }
+ named @PrefaceAfterContents { No }
+ named @ChapterStartPages { Any }
+ named @ReferencesBeforeAppendices { No }
+
+ named @PrefaceWord { preface }
+ named @ContentsWord { contents }
+ named @FigureListWord { figurelist }
+ named @TableListWord { tablelist }
+ named @IntroductionWord { introduction }
+ named @AbbreviationsWord { abbreviations }
+ named @ChapterWord { chapter }
+ named @AppendixWord { appendix }
+ named @IndexWord { index }
+ named @IndexAWord { index }
+ named @IndexBWord { index }
+
+ named @ChapterNumbers { Arabic }
+ named @FirstChapterNumber { 1 }
+ named @SectionNumbers { Arabic }
+ named @FirstSectionNumber { 1 }
+ named @SubSectionNumbers { Arabic }
+ named @FirstSubSectionNumber { 1 }
+ named @SubSubSectionNumbers { Arabic }
+ named @FirstSubSubSectionNumber { 1 }
+ named @AppendixNumbers { UCAlpha }
+ named @FirstAppendixNumber { 1 }
+ named @SubAppendixNumbers { Arabic }
+ named @FirstSubAppendixNumber { 1 }
+ named @SubSubAppendixNumbers { Arabic }
+ named @FirstSubSubAppendixNumber { 1 }
+
+ named @PartHeadingFont { Helvetica Base 2.50f }
+ named @PartHeadingBreak { clines 1.2fx nohyphen }
+ named @PartHeadingFormat
+ left number right title { @CD number @DP @CD title }
+
+ named @ChapterHeadingFont { Bold 2.00f }
+ named @ChapterHeadingBreak { ragged 1.2fx nohyphen }
+ named @ChapterHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SectionHeadingFont { Bold }
+ named @SectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SectionHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SubSectionHeadingFont { Bold }
+ named @SubSectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSectionHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SubSubSectionHeadingFont { Slope }
+ named @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSubSectionHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @AppendixHeadingFont { Bold 2.00f }
+ named @AppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @AppendixHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SubAppendixHeadingFont { Bold }
+ named @SubAppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubAppendixHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SubSubAppendixHeadingFont { Slope }
+ named @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSubAppendixHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @AbovePartGap { 4.00f }
+ named @AboveChapterGap { 3.00f }
+ named @SectionGap { 2.0v @OrIfPlain 3f }
+ named @SubSectionGap { 1.5v @OrIfPlain 2f }
+ named @SubSubSectionGap { 1.5v @OrIfPlain 2f }
+ named @SubAppendixGap { 2.0v @OrIfPlain 3f }
+ named @SubSubAppendixGap { 1.5v @OrIfPlain 2f }
+
+ named @PrefaceInContents { No }
+ named @AbbreviationsInContents { Yes }
+ named @IntroductionInContents { Yes }
+ named @PartInContents { Yes }
+ named @ChapterInContents { Yes }
+ named @SectionInContents { Yes }
+ named @SubSectionInContents { Yes }
+ named @SubSubSectionInContents { No }
+ named @AppendixInContents { Yes }
+ named @SubAppendixInContents { Yes }
+ named @SubSubAppendixInContents { No }
+ named @ReferencesInContents { Yes }
+ named @IndexInContents { Yes }
+ named @IndexAInContents { Yes }
+ named @IndexBInContents { Yes }
+ named @PartContentsIndent { 0.5rt }
+
+ named @ChapterNumInTheorems { Yes }
+ named @SectionNumInTheorems { No }
+ named @SubSectionNumInTheorems { No }
+ named @SubSubSectionNumInTheorems { No }
+ named @AppendixNumInTheorems { Yes }
+ named @SubAppendixNumInTheorems { No }
+ named @SubSubAppendixNumInTheorems { No }
+
+ named @ChapterNumInDisplays { Yes }
+ named @SectionNumInDisplays { Yes }
+ named @SubSectionNumInDisplays { No }
+ named @SubSubSectionNumInDisplays { No }
+ named @AppendixNumInDisplays { Yes }
+ named @SubAppendixNumInDisplays { Yes }
+ named @SubSubAppendixNumInDisplays { No }
+
+ named @ChapterNumInFigures { Yes }
+ named @SectionNumInFigures { No }
+ named @SubSectionNumInFigures { No }
+ named @SubSubSectionNumInFigures { No }
+ named @AppendixNumInFigures { Yes }
+ named @SubAppendixNumInFigures { No }
+ named @SubSubAppendixNumInFigures { No }
+
+ named @ChapterNumInTables { Yes }
+ named @SectionNumInTables { No }
+ named @SubSectionNumInTables { No }
+ named @SubSubSectionNumInTables { No }
+ named @AppendixNumInTables { Yes }
+ named @SubAppendixNumInTables { No }
+ named @SubSubAppendixNumInTables { No }
+
+ named @SectionNumInRunners { Yes }
+ named @SubSectionNumInRunners { No }
+ named @SubSubSectionNumInRunners { No }
+ named @SubAppendixNumInRunners { Yes }
+ named @SubSubAppendixNumInRunners { No }
+
+ named @PrefacePrefix { }
+ named @ContentsPrefix { }
+ named @FigureContentsPrefix { }
+ named @TableContentsPrefix { }
+ named @AbbreviationsPrefix { }
+ named @IntroductionPrefix { }
+ named @ChapterPrefix { }
+ named @AppendixPrefix { }
+ named @ReferencesPrefix { }
+ named @IndexPrefix { }
+ named @IndexAPrefix { }
+ named @IndexBPrefix { }
+
+@Begin
+
+ #######################################################################
+ # #
+ # Lists of chapters, sections, sub(-sub)sections, and appendices. #
+ # #
+ #######################################################################
+
+ export num
+ def @ChapterList named @Tag {} right num
+ {
+ @Galley
+ // @ChapterList @Next num
+ }
+
+ export num
+ def @SectionList named @Tag {} right num
+ {
+ @Galley
+ //@SectionGap @SectionList @Next num
+ }
+
+ export num
+ def @SubSectionList named @Tag {} right num
+ {
+ @Galley
+ //@SubSectionGap @SubSectionList @Next num
+ }
+
+ export num
+ def @SubSubSectionList named @Tag {} right num
+ {
+ @Galley
+ //@SubSubSectionGap @SubSubSectionList @Next num
+ }
+
+ export num
+ def @AppendixList named @Tag {} right num
+ {
+ @Galley
+ // @AppendixList @Next num
+ }
+
+ export num
+ def @SubAppendixList named @Tag {} right num
+ {
+ @Galley
+ //@SubAppendixGap @SubAppendixList @Next num
+ }
+
+ export num
+ def @SubSubAppendixList named @Tag {} right num
+ {
+ @Galley
+ //@SubSubAppendixGap @SubSubAppendixList @Next num
+ }
+
+ def @PrefacePlace { @Galley }
+ def @AbbreviationsPlace { @Galley }
+ def @IntroductionPlace { @Galley }
+
+
+ #######################################################################
+ # #
+ # @Full - this sends text to a full-width place. #
+ # #
+ #######################################################################
+
+ def @Full right x
+ {
+ def @Any force into { @FullPlace&&following } right x { x }
+ def @Odd force into { @OddFullPlace&&following } right x { x }
+ def @Even force into { @EvenFullPlace&&following } right x { x }
+
+ @ChapterStartPages @Case {
+ Any @Yield @Any x
+ Odd @Yield @Odd x
+ Even @Yield @Even x
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # @NoForceFull - this sends text to a full-width place. #
+ # #
+ #######################################################################
+
+ def @NoForceFull right x
+ {
+ def @Any into { @FullPlace&&following } right x { x }
+ def @Odd into { @OddFullPlace&&following } right x { x }
+ def @Even into { @EvenFullPlace&&following } right x { x }
+
+ @ChapterStartPages @Case {
+ Any @Yield @Any x
+ Odd @Yield @Odd x
+ Even @Yield @Even x
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # @IntroFull - this sends text to a full-width intro place. #
+ # #
+ #######################################################################
+
+ def @IntroFull right x
+ {
+ def @Any force into { @IntroFullPlace&&following } right x { x }
+ def @Odd force into { @IntroOddFullPlace&&following } right x { x }
+ def @Even force into { @IntroEvenFullPlace&&following } right x { x }
+
+ @ChapterStartPages @Case {
+ Any @Yield @Any x
+ Odd @Yield @Odd x
+ Even @Yield @Even x
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # @ChooseFull - this sends either to introfull or ordinary full #
+ # #
+ #######################################################################
+
+ def @ChooseFull right x
+ {
+ @SeparateIntroNumbering @Case {
+ No @Yield @Full x
+ Yes @Yield @IntroFull x
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # Book. #
+ # #
+ #######################################################################
+
+ def @Book
+ named @Tag {}
+ named @Title {}
+ named @Author {}
+ named @Edition {}
+ named @Publisher {}
+ named @BeforeTitlePage {}
+ named @OnTitlePage {}
+ named @AfterTitlePage {}
+ named @AtEnd { dft }
+ named @AtAfter { dft }
+ named @InitialFont { @InitialFont }
+ named @InitialBreak { @InitialBreak }
+ named @InitialSpace { @InitialSpace }
+ named @InitialLanguage { @InitialLanguage }
+ named @PageOrientation { @PageOrientation }
+ named @PageHeaders { @PageHeaders }
+ named @ColumnNumber { @ColumnNumber }
+ named @FirstPageNumber { @FirstPageNumber }
+ named @IntroFirstPageNumber { @IntroFirstPageNumber }
+ named @OptimizePages { @OptimizePages }
+ {
+ def @Before
+ {
+ @BeforeTitlePage @Case {
+ "" @Yield @Null
+ else @Yield @BeforeTitlePage
+ }
+ }
+
+ def @On
+ {
+ @OnTitlePage @Case {
+ "" @Yield {
+ //1i |0.5rt 2.5f @Font {1.2fx clines} @Break @Title |
+ //2i |0.5rt clines @Break @Author |
+ //1i |0.5rt clines @Break @Edition |
+ //1rt @OneRow @Publisher
+ }
+ else @Yield @OnTitlePage
+ }
+ }
+
+ def @After
+ {
+ @AfterTitlePage @Case {
+ "" @Yield @Null
+ else @Yield { @AfterTitlePage // None @Runner }
+ }
+ }
+
+ def @ContentsPart
+ named @Tag {}
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { ExtraMajorIntro }
+ initiallanguage { @InitialLanguage }
+ title { contents @WordVal @ContentsWord }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { No }
+ pnprefix { @ContentsPrefix }
+ inrunners { Yes }
+ majortitle { contents @WordVal @ContentsWord }
+ sendheader { @ChooseFull @Body }
+ innergap { @SectionGap }
+ @ContentsSection
+ }
+
+ def @FigureContentsPart
+ named @Tag {}
+ {
+ @LargeScaleStructure
+ tag { @Tag }
+ type { ExtraMajorIntro }
+ initiallanguage { @InitialLanguage }
+ title { figurelist @WordVal @FigureListWord }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { No }
+ pnprefix { @FigureContentsPrefix }
+ inrunners { Yes }
+ majortitle { figurelist @WordVal @FigureListWord }
+ sendheader { @ChooseFull @Body }
+ innergap { @SectionGap }
+ @FigureContentsSection
+ }
+
+ def @TableContentsPart
+ named @Tag {}
+ {
+ @LargeScaleStructure
+ tag { @Tag }
+ type { ExtraMajorIntro }
+ initiallanguage { @InitialLanguage }
+ title { tablelist @WordVal @TableListWord }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { No }
+ pnprefix { @TableContentsPrefix }
+ inrunners { Yes }
+ majortitle { tablelist @WordVal @TableListWord }
+ sendheader { @ChooseFull @Body }
+ innergap { @SectionGap }
+ @TableContentsSection
+ }
+
+ def @ReferencesPart
+ named @Tag {}
+ {
+ @LargeScaleStructure
+ tag { @Tag }
+ type { ExtraMajor }
+ initiallanguage { @InitialLanguage }
+ title { @RefHeading @RefListTitle }
+ majortitle { @RefHeading @RefListTitle }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @ReferencesInContents }
+ pnprefix { @ReferencesPrefix }
+ inrunners { Yes }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ @ReferencesSection
+
+ }
+
+ def @IndexPart
+ named @Tag {}
+ {
+ def @Run
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexWord }
+ @MinorNum {}
+ @MinorTitle { index @WordVal @IndexWord }
+ @Owner { @Tag }
+ @Prefix { @IndexPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexWord }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @IndexInContents }
+ pnprefix { @IndexPrefix }
+ inrunners { Yes }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexSection @Run
+ }
+
+ def @IndexAPart
+ named @Tag {}
+ {
+ def @RunA
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexAWord }
+ @MinorNum {}
+ @MinorTitle { index @WordVal @IndexAWord }
+ @Owner { @Tag }
+ @Prefix { @IndexAPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexAWord }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @IndexAInContents }
+ pnprefix { @IndexAPrefix }
+ inrunners { Yes }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexASection @RunA
+ }
+
+ def @IndexBPart
+ named @Tag {}
+ {
+ def @RunB
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexBWord }
+ @MinorNum {}
+ @MinorTitle { index @WordVal @IndexBWord }
+ @Owner { @Tag }
+ @Prefix { @IndexBPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexBWord }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @IndexBInContents }
+ pnprefix { @IndexBPrefix }
+ inrunners { Yes }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexBSection @RunB
+ }
+
+ def @BookIntro force into { @IntroColPlace&&preceding }
+ named @Optimize { @OptimizePages }
+ {
+ @PageMark @Tag
+ // @Before
+ //1.1b @TitlePageFont @Font @On
+ //1.1b @After
+ // Start @Runner @Owner { @Tag }
+ //1.1b @PrefaceAfterContents @NoDo @PrefacePlace
+ // @MakeContents @Case {
+ { Yes Bypass } @Yield @ContentsPart
+ else @Yield @Null
+ }
+ // @MakeFigureContents @Case {
+ { Yes Bypass } @Yield @FigureContentsPart
+ else @Yield @Null
+ }
+ // @MakeTableContents @Case {
+ { Yes Bypass } @Yield @TableContentsPart
+ else @Yield @Null
+ }
+ //1.1b @PrefaceAfterContents @Do @PrefacePlace
+ }
+
+ def @BookBody force into { @ColPlace&&preceding }
+ named @Optimize { @OptimizePages }
+ {
+ # The first component of @BookBody must be indefinite, so that
+ # its flushing is delayed until we reach the body galleys, either
+ # @Introduction or @Chapter. If not, @BookBody will free up
+ # @PrefacePlace etc. too soon, producing a "no @PrefacePlace
+ # precedes this @PrefacePLace&&preceding" error message.
+
+ @AbbreviationsPlace
+ // @IntroductionPlace
+ // @ChapterList @FirstChapterNumber
+ // @ReferencesBeforeAppendices @Do {
+ @MakeReferences @Do @ReferencesPart
+ }
+ // @AppendixList @FirstAppendixNumber
+ // @ReferencesBeforeAppendices @NoDo {
+ @MakeReferences @Do @ReferencesPart
+ }
+ // @MakeIndexA @Do @IndexAPart
+ // @MakeIndexA @Case {
+ Bypass @Yield @BypassBeginIndexAPlace
+ else @Yield @Null
+ }
+ // @MakeIndexB @Do @IndexBPart
+ // @MakeIndexB @Case {
+ Bypass @Yield @BypassBeginIndexBPlace
+ else @Yield @Null
+ }
+ // @MakeIndex @Do @IndexPart
+ // @MakeIndex @Case {
+ Bypass @Yield @BypassBeginIndexPlace
+ else @Yield @Null
+ }
+ }
+
+ def @BookCombined force into { @ColPlace&&preceding }
+ named @Optimize { @OptimizePages }
+ {
+ @PageMark @Tag
+ // @Before
+ //1.1b @TitlePageFont @Font @On
+ //1.1b @After
+ // Start @Runner @Owner { @Tag }
+ //1.1b @PrefaceAfterContents @NoDo @PrefacePlace
+ // @MakeContents @Case {
+ { Yes Bypass } @Yield @ContentsPart
+ else @Yield @Null
+ }
+ // @MakeFigureContents @Case {
+ { Yes Bypass } @Yield @FigureContentsPart
+ else @Yield @Null
+ }
+ // @MakeTableContents @Case {
+ { Yes Bypass } @Yield @TableContentsPart
+ else @Yield @Null
+ }
+ //1.1b @PrefaceAfterContents @Do @PrefacePlace
+ // @AbbreviationsPlace
+ // @IntroductionPlace
+ // @ChapterList @FirstChapterNumber
+ // @ReferencesBeforeAppendices @Do {
+ @MakeReferences @Do @ReferencesPart
+ }
+ // @AppendixList @FirstAppendixNumber
+ // @ReferencesBeforeAppendices @NoDo {
+ @MakeReferences @Do @ReferencesPart
+ }
+ // @MakeIndexA @Do @IndexAPart
+ // @MakeIndexA @Case {
+ Bypass @Yield @BypassBeginIndexAPlace
+ else @Yield @Null
+ }
+ // @MakeIndexB @Do @IndexBPart
+ // @MakeIndexB @Case {
+ Bypass @Yield @BypassBeginIndexBPlace
+ else @Yield @Null
+ }
+ // @MakeIndex @Do @IndexPart
+ // @MakeIndex @Case {
+ Bypass @Yield @BypassBeginIndexPlace
+ else @Yield @Null
+ }
+ }
+
+ @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language
+ @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour
+ {
+
+ @SeparateIntroNumbering @Case {
+
+ No @Yield {
+ Yes @BeginAllCounters {}
+ Yes @BeginDisplayCounter {}
+ Yes @BeginFigureCounter {}
+ Yes @BeginTableCounter {}
+ // @PageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @PageOrientation }
+ @FirstPageNumber
+ // @BookCombined
+ // NonStart @Runner @Owner { @Tag }
+ // @AtEnd @Case {
+ dft @Yield @Null
+ else @Yield
+ @EvenPage @Orient { @PageOrientation } @AtEnd
+ }
+ }
+
+ Yes @Yield {
+ Yes @BeginAllCounters {}
+ Yes @BeginDisplayCounter {}
+ Yes @BeginFigureCounter {}
+ Yes @BeginTableCounter {}
+ // @IntroPageList
+ @ColumnNumber { 1 }
+ @PageHeaders { @PageHeaders }
+ @Orient { @PageOrientation }
+ @IntroFirstPageNumber
+ // NonStart @Runner @Owner { @Tag }
+ // @PageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @PageOrientation }
+ extra { Yes }
+ @FirstPageNumber
+ // @BookIntro
+ // @BookBody
+ // NonStart @Runner @Owner { @Tag }
+ // @AtEnd @Case {
+ dft @Yield @Null
+ else @Yield
+ @EvenPage @Orient { @PageOrientation } @AtEnd
+ }
+ }
+ }
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # Preface. #
+ # #
+ #######################################################################
+
+ def @Preface force into { @PrefacePlace&&preceding }
+ named @Tag {}
+ named @Title { preface @WordVal @PrefaceWord }
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { ExtraMajorIntro }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @PrefaceInContents }
+ pnprefix { @PrefacePrefix }
+ sendheader { @ChooseFull @Body }
+ innergap { @SectionGap }
+ inrunners { Yes }
+ @Body
+
+ }
+
+
+ #######################################################################
+ # #
+ # Abbreviations. #
+ # #
+ #######################################################################
+
+ def @Abbreviations force into { @AbbreviationsPlace&&preceding }
+ named @Tag {}
+ named @Title { abbreviations @WordVal @AbbreviationsWord }
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @AbbreviationsInContents }
+ pnprefix { @AbbreviationsPrefix }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ inrunners { Yes }
+ @Body
+
+ }
+
+
+ #######################################################################
+ # #
+ # Introduction. #
+ # #
+ #######################################################################
+
+ def @Introduction force into { @IntroductionPlace&&preceding }
+ named @Tag {}
+ named @Title { introduction @WordVal @IntroductionWord }
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @IntroductionInContents }
+ pnprefix { @IntroductionPrefix }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ inrunners { Yes }
+ @Body
+
+ }
+
+
+ #######################################################################
+ # #
+ # Chapters containing sections and subsections. #
+ # #
+ #######################################################################
+
+ export @BeginSections @EndSections @Section
+ def @Chapter force into { @ChapterList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ named @PartNumber {}
+ named @PartTitle {}
+ named @PartText {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSectionsPlace { @Galley }
+
+ def @EndSections force into { @EndSectionsPlace&&preceding }
+ {}
+
+ macro @BeginSections
+ { //@SectionGap @SectionList @FirstSectionNumber
+ // @EndSectionsPlace //
+ }
+
+ def @ChapterShortNum
+ {
+ @ChapterNumbers @Then {
+ @BypassNumber @Dft {
+ @ChapterNumbers @Num @ChapterList&&@Tag @Open { num }
+ }
+ }
+ }
+
+ def @MajorNum
+ {
+ @ChapterNumbers @Then @InitialLanguage @Language {
+ chapter @WordVal @ChapterWord @ChapterShortNum
+ }
+ }
+
+ def @MajorTitle
+ {
+ @InitialLanguage @Language {
+ @RunningTitle @Dft @Title
+ }
+ }
+
+ export @BeginSubSections @EndSubSections @SubSection
+ def @Section force into { @SectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSectionsPlace { @Galley }
+
+ def @EndSubSections force into { @EndSubSectionsPlace&&preceding }
+ {}
+
+ macro @BeginSubSections
+ { //@SubSectionGap @SubSectionList @FirstSubSectionNumber
+ // @EndSubSectionsPlace //
+ }
+
+ def @SectionShortNum
+ {
+ @SectionNumbers @Then {
+ @BypassNumber @Dft {
+ @ChapterShortNum @Join @SectionNumbers @Num
+ { @SectionList&&@Tag @Open { num } }
+ }
+ }
+ }
+
+ export @BeginSubSubSections @EndSubSubSections @SubSubSection
+ def @SubSection force into { @SubSectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSubSectionsPlace { @Galley }
+
+ def @EndSubSubSections force into
+ { @EndSubSubSectionsPlace&&preceding }
+ {}
+
+ macro @BeginSubSubSections
+ { //@SubSubSectionGap @SubSubSectionList @FirstSubSubSectionNumber
+ // @EndSubSubSectionsPlace //
+ }
+
+ def @SubSectionShortNum
+ {
+ @SubSectionNumbers @Then {
+ @BypassNumber @Dft {
+ @SectionShortNum @Join @SubSectionNumbers @Num
+ { @SubSectionList&&@Tag @Open { num } }
+ }
+ }
+ }
+
+ def @SubSubSection force into { @SubSubSectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSubSectionHeadingFont }
+ headingbreak { @SubSubSectionHeadingBreak }
+ headingformat { @Num @SubSubSectionHeadingFormat @Body }
+ incontents { @SubSubSectionInContents }
+ contentsindent { 9f }
+ numbers { @SubSubSectionNumbers }
+ attachnum { @SubSubSectionList&&preceding @Tagged @Tag }
+ retrievenum { @SubSubSectionList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SubSectionShortNum }
+ majornum { @MajorNum }
+ majortitle { @MajorTitle }
+ intheorems { @SubSubSectionNumInTheorems }
+ indisplays { @SubSubSectionNumInDisplays }
+ infigures { @SubSubSectionNumInFigures }
+ intables { @SubSubSectionNumInTables }
+ inrunners { @SubSubSectionNumInRunners }
+ @Body
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSectionHeadingFont }
+ headingbreak { @SubSectionHeadingBreak }
+ headingformat { @Num @SubSectionHeadingFormat @Body }
+ incontents { @SubSectionInContents }
+ contentsindent { 6f }
+ numbers { @SubSectionNumbers }
+ attachnum { @SubSectionList&&preceding @Tagged @Tag }
+ retrievenum { @SubSectionList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SectionShortNum }
+ majornum { @MajorNum }
+ majortitle { @MajorTitle }
+ intheorems { @SubSectionNumInTheorems }
+ indisplays { @SubSectionNumInDisplays }
+ infigures { @SubSectionNumInFigures }
+ intables { @SubSectionNumInTables }
+ inrunners { @SubSectionNumInRunners }
+ @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SectionHeadingFont }
+ headingbreak { @SectionHeadingBreak }
+ headingformat { @Num @SectionHeadingFormat @Body }
+ incontents { @SectionInContents }
+ contentsindent { 3f }
+ numbers { @SectionNumbers }
+ attachnum { @SectionList&&preceding @Tagged @Tag }
+ retrievenum { @SectionList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @ChapterShortNum }
+ majornum { @MajorNum }
+ majortitle { @MajorTitle }
+ intheorems { @SectionNumInTheorems }
+ indisplays { @SectionNumInDisplays }
+ infigures { @SectionNumInFigures }
+ intables { @SectionNumInTables }
+ inrunners { @SectionNumInRunners }
+ @Body
+
+ }
+
+ def @Part
+ named @Tag {}
+ {
+ @LargeScaleStructure
+ type { VeryMajor }
+ initiallanguage { @InitialLanguage }
+ title { @PartTitle }
+ aboveheadinggap { @AbovePartGap }
+ headingfont { @PartHeadingFont }
+ headingbreak { @PartHeadingBreak }
+ headingformat { @Num @PartHeadingFormat @Body }
+ bypassnumber { @PartNumber }
+ incontents { @PartInContents }
+ sendheader { @Full @Body }
+ inrunners { Yes }
+ tag { @Tag }
+ @PartText
+ }
+
+ @PartNumber @Case {
+ "" @Yield @Null
+ else @Yield @Part
+ }
+ //
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @ChapterInContents }
+ contentsindent { 0f }
+ word { chapter @WordVal @ChapterWord }
+ numbers { @ChapterNumbers }
+ attachnum { @ChapterList&&preceding @Tagged @Tag }
+ retrievenum { @ChapterList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ pnprefix { @ChapterPrefix }
+ intheorems { @ChapterNumInTheorems }
+ indisplays { @ChapterNumInDisplays }
+ infigures { @ChapterNumInFigures }
+ intables { @ChapterNumInTables }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ inrunners { Yes }
+ @Body
+
+ }
+
+
+ #######################################################################
+ # #
+ # Appendices. #
+ # #
+ #######################################################################
+
+ export @BeginSubAppendices @EndSubAppendices @SubAppendix
+ def @Appendix force into { @AppendixList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ named @PartNumber {}
+ named @PartTitle {}
+ named @PartText {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubAppendicesPlace { @Galley }
+
+ def @EndSubAppendices force into { @EndSubAppendicesPlace&&preceding }
+ {}
+
+ macro @BeginSubAppendices
+ { //@SubAppendixGap @SubAppendixList @FirstSubAppendixNumber
+ // @EndSubAppendicesPlace //
+ }
+
+ def @AppendixShortNum
+ {
+ @AppendixNumbers @Then {
+ @BypassNumber @Dft {
+ @AppendixNumbers @Num @AppendixList&&@Tag @Open { num }
+ }
+ }
+ }
+
+ def @MajorNum
+ {
+ @AppendixNumbers @Then @InitialLanguage @Language {
+ appendix @WordVal @AppendixWord @AppendixShortNum
+ }
+ }
+
+ def @MajorTitle
+ {
+ @InitialLanguage @Language {
+ @RunningTitle @Dft @Title
+ }
+ }
+
+ export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix
+ def @SubAppendix force into { @SubAppendixList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSubAppendicesPlace { @Galley }
+
+ def @EndSubSubAppendices force into { @EndSubSubAppendicesPlace&&preceding }
+ {}
+
+ macro @BeginSubSubAppendices
+ { //@SubSubAppendixGap @SubSubAppendixList @FirstSubSubAppendixNumber
+ // @EndSubSubAppendicesPlace //
+ }
+
+ def @SubAppendixShortNum
+ {
+ @SubAppendixNumbers @Then {
+ @BypassNumber @Dft {
+ @AppendixShortNum @Join @SubAppendixNumbers @Num
+ { @SubAppendixList&&@Tag @Open { num } }
+ }
+ }
+ }
+
+ def @SubSubAppendix force into { @SubSubAppendixList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSubAppendixHeadingFont }
+ headingbreak { @SubSubAppendixHeadingBreak }
+ headingformat { @Num @SubSubAppendixHeadingFormat @Body }
+ incontents { @SubSubAppendixInContents }
+ contentsindent { 6f }
+ numbers { @SubSubAppendixNumbers }
+ attachnum { @SubSubAppendixList&&preceding @Tagged @Tag }
+ retrievenum { @SubSubAppendixList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SubAppendixShortNum }
+ majornum { @MajorNum }
+ majortitle { @MajorTitle }
+ intheorems { @SubSubAppendixNumInTheorems }
+ indisplays { @SubSubAppendixNumInDisplays }
+ infigures { @SubSubAppendixNumInFigures }
+ intables { @SubSubAppendixNumInTables }
+ inrunners { @SubSubAppendixNumInRunners }
+ @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubAppendixHeadingFont }
+ headingbreak { @SubAppendixHeadingBreak }
+ headingformat { @Num @SubAppendixHeadingFormat @Body }
+ incontents { @SubAppendixInContents }
+ contentsindent { 3f }
+ numbers { @SubAppendixNumbers }
+ attachnum { @SubAppendixList&&preceding @Tagged @Tag }
+ retrievenum { @SubAppendixList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @AppendixShortNum }
+ majornum { @MajorNum }
+ majortitle { @MajorTitle }
+ intheorems { @SubAppendixNumInTheorems }
+ indisplays { @SubAppendixNumInDisplays }
+ infigures { @SubAppendixNumInFigures }
+ intables { @SubAppendixNumInTables }
+ inrunners { @SubAppendixNumInRunners }
+ @Body
+
+ }
+
+ def @Part
+ named @Tag {}
+ {
+ @LargeScaleStructure
+ type { VeryMajor }
+ initiallanguage { @InitialLanguage }
+ title { @PartTitle }
+ aboveheadinggap { @AbovePartGap }
+ headingfont { @PartHeadingFont }
+ headingbreak { @PartHeadingBreak }
+ headingformat { @Num @PartHeadingFormat @Body }
+ bypassnumber { @PartNumber }
+ incontents { @PartInContents }
+ sendheader { @Full @Body }
+ inrunners { Yes }
+ tag { @Tag }
+ @PartText
+ }
+
+ @PartNumber @Case {
+ "" @Yield @Null
+ else @Yield @Part
+ }
+ //
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @AppendixHeadingFont }
+ headingbreak { @AppendixHeadingBreak }
+ headingformat { @Num @AppendixHeadingFormat @Body }
+ incontents { @AppendixInContents }
+ contentsindent { 0f }
+ word { appendix @WordVal @AppendixWord }
+ numbers { @AppendixNumbers }
+ attachnum { @AppendixList&&preceding @Tagged @Tag }
+ retrievenum { @AppendixList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ pnprefix { @AppendixPrefix }
+ intheorems { @AppendixNumInTheorems }
+ indisplays { @AppendixNumInDisplays }
+ infigures { @AppendixNumInFigures }
+ intables { @AppendixNumInTables }
+ sendheader { @Full @Body }
+ innergap { @SubAppendixGap }
+ inrunners { Yes }
+ @Body
+
+ }
+
+
+@End @BookSetup
diff --git a/include/bsf b/include/bsf
new file mode 100644
index 0000000..726058f
--- /dev/null
+++ b/include/bsf
@@ -0,0 +1,1563 @@
+
+###############################################################################
+# #
+# Lout @BasicSetup package (Version 3.13) #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+# Based on the first part of the @DocumentLayout package, version 3.11. #
+# #
+# This package contains basic symbols used widely throughout many #
+# documents, for font changes, particular characters, standard words in #
+# the current language, date and time, paragraphs, lists, colours, #
+# rules, and boxes. #
+# #
+###############################################################################
+
+@SysPrependGraphic { "bsf.lpg" } # rules, boxes, margin note setup
+
+
+###############################################################################
+# #
+# The following symbols are defined outside @BasicSetup so that #
+# they can be invoked when setting its parameters in the @Use clause. #
+# #
+###############################################################################
+
+def @OrIfPlain
+ precedence 80
+ left x
+ right y
+{
+ @BackEnd @Case {
+ PlainText @Yield y
+ else @Yield x
+ }
+}
+
+ export i c p m s v f
+ def @LengthUnits
+ {
+ def i left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" in" }
+ PDF @Yield { "__mul(__in, "x")" }
+ PlainText @Yield ""
+ }
+ }
+
+ def c left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" cm" }
+ PDF @Yield { "__mul(__cm, "x")" }
+ PlainText @Yield ""
+ }
+ }
+
+ def p left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" pt" }
+ PDF @Yield { "__mul(__pt, "x")" }
+ PlainText @Yield ""
+ }
+ }
+
+ def m left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" em" }
+ PDF @Yield { "__mul(__em, "x")" }
+ PlainText @Yield ""
+ }
+ }
+
+ def s left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" sp" }
+ PDF @Yield { "__mul(__louts, "x")" }
+ PlainText @Yield ""
+ }
+ }
+
+ def v left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" vs" }
+ PDF @Yield { "__mul(__loutv, "x")" }
+ PlainText @Yield ""
+ }
+ }
+
+ def f left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" ft" }
+ PDF @Yield { "__mul(__loutf, "x")" }
+ PlainText @Yield ""
+ }
+ }
+ }
+
+
+###############################################################################
+# #
+# Symbols exported by @BasicSetup. #
+# #
+###############################################################################
+
+export
+
+ @InitialFont @InitialBreak @InitialSpace @InitialLanguage @InitialColour
+ @OptimizePages @HeadingFont
+ @ParaGap @ParaIndent @DisplayGap @DisplayIndent @DefaultIndent
+ @DisplayNumStyle @WideIndent @VeryWideIndent
+ @ListGap @ListIndent @ListRightIndent @ListLabelWidth
+ @NumberSeparator
+
+ @Word @Roman @UCRoman @Alpha @UCAlpha @Months @ShortMonths @WeekDays
+ @ShortWeekDays @TwelveHours @ShortHours @MeriDiems @ShortMeriDiems
+
+ @Sym @R @I @B @BI @S @F @II
+ "~" "~~" "``" "''" ",," "--" "---" "..."
+
+ @Bullet @ParSym @SectSym @Dagger @DaggerDbl @CDot @Sterling @Yen @Florin
+ @Star @Degree @Minute @Second @Multiply @Divide @Lozenge @Register
+ @CopyRight @TradeMark @Euro
+
+ @Date @Time @DateTimeFormat @DropCapTwo @DropCapThree @Centre @Right
+ @NoDotSep @NoDotJoin @Join @Sep @DotSep @DotJoin @DashJoin @NumSep
+ @OverStrike @Sup @Sub @Colour @FullWidthRule @LocalWidthRule
+ @Box @CurveBox @ShadowBox @BoundaryMarks @NumberMarker @NumberOf
+ @PageMarker @PageMark @PageOf
+
+ @BeginDisplayCounter
+
+ @Heading "^" "&-" @If @Not @And @Or @True
+ @PP @LP @LLP @DP @LOP @NP @CNP
+
+ @BeginAlignedDisplays
+ @EndAlignedDisplays
+
+ @Display
+ @LeftDisplay
+ @IndentedDisplay
+ @QuotedDisplay
+ @CentredDisplay
+ @RightDisplay
+ @AlignedDisplay
+ @LeftAlignedDisplay
+ @IndentedAlignedDisplay
+ @QuotedAlignedDisplay
+ @CentredAlignedDisplay
+ @RightAlignedDisplay
+ @NumberedDisplay
+ @LeftNumberedDisplay
+ @IndentedNumberedDisplay
+ @QuotedNumberedDisplay
+ @CentredNumberedDisplay
+ @RightNumberedDisplay
+ @AlignedNumberedDisplay
+ @LeftAlignedNumberedDisplay
+ @IndentedAlignedNumberedDisplay
+ @QuotedAlignedNumberedDisplay
+ @CentredAlignedNumberedDisplay
+ @RightAlignedNumberedDisplay
+
+ @RawDisplay
+ @RawLeftDisplay
+ @RawIndentedDisplay
+ @RawQuotedDisplay
+ @RawCentredDisplay
+ @RawRightDisplay
+ @RawAlignedDisplay
+ @RawLeftAlignedDisplay
+ @RawIndentedAlignedDisplay
+ @RawQuotedAlignedDisplay
+ @RawCentredAlignedDisplay
+ @RawRightAlignedDisplay
+ @RawNumberedDisplay
+ @RawLeftNumberedDisplay
+ @RawIndentedNumberedDisplay
+ @RawQuotedNumberedDisplay
+ @RawCentredNumberedDisplay
+ @RawRightNumberedDisplay
+ @RawAlignedNumberedDisplay
+ @RawLeftAlignedNumberedDisplay
+ @RawIndentedAlignedNumberedDisplay
+ @RawQuotedAlignedNumberedDisplay
+ @RawCentredAlignedNumberedDisplay
+ @RawRightAlignedNumberedDisplay
+
+ @ListItem
+ @ListInterruptItem
+ @ListNewPage
+ @DropListItem
+ @TagItem
+ @DropTagItem
+
+ @EndList
+ @RawEndList
+
+ @RawList
+ @RawLeftList
+ @RawIndentedList
+ @RawQuotedList
+ @RawCentredList @RawCenteredList
+ @RawNumberedList
+ @RawParenNumberedList
+ @RawRomanList
+ @RawParenRomanList
+ @RawUCRomanList
+ @RawParenUCRomanList
+ @RawAlphaList
+ @RawParenAlphaList
+ @RawUCAlphaList
+ @RawParenUCAlphaList
+ @RawBulletList
+ @RawStarList
+ @RawDashList
+ @RawTaggedList
+ @RawWideTaggedList
+ @RawVeryWideTaggedList
+
+ @List
+ @LeftList
+ @IndentedList
+ @QuotedList
+ @CentredList @CenteredList
+ @NumberedList
+ @ParenNumberedList
+ @RomanList
+ @ParenRomanList
+ @UCRomanList
+ @ParenUCRomanList
+ @AlphaList
+ @ParenAlphaList
+ @UCAlphaList
+ @ParenUCAlphaList
+ @BulletList
+ @StarList
+ @DashList
+ @TaggedList
+ @WideTaggedList
+ @VeryWideTaggedList
+
+
+###############################################################################
+# #
+# The @BasicSetup package. #
+# #
+###############################################################################
+
+def @BasicSetup
+ named @InitialFont { Times Base 12p } # initial font
+ named @InitialBreak { {adjust 1.20fx hyphen} @OrIfPlain
+ {ragged 1fx nohyphen} } # initial break
+ named @InitialSpace { lout } # initial space style
+ named @InitialLanguage{ English } # initial language
+ named @InitialColour { black } # initial colour
+ named @OptimizePages { No } # optimize page breaks?
+ named @HeadingFont { Bold } # font for @Heading
+ named @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs
+ named @ParaIndent { 2.0f @OrIfPlain 5s } # first-line indent for @PP
+ named @DisplayGap { 1.0v @OrIfPlain 1f } # gap above, below displays
+ named @DisplayIndent { 2.0f @OrIfPlain 5s } # @IndentedDisplay indent
+ named @DefaultIndent { 0.5rt } # @Display indent
+ named @DisplayNumStyle
+ right num { (num) } # display number style
+ named @WideIndent { 4.0f @OrIfPlain 10s } # @WideTaggedList indent
+ named @VeryWideIndent { 8.0f @OrIfPlain 20s } # @VeryWideTaggedList indent
+ named @ListOuterGap { 1.0v @OrIfPlain 1f } # gap before, after list
+ named @ListGap { 1.0v @OrIfPlain 1f } # gap between list items
+ named @ListIndent { 0s } # indent of list items
+ named @ListRightIndent{ 0s } # right indent of list items
+ named @ListLabelWidth { 2.0f @OrIfPlain 5s } # width allowed for list tags
+ named @NumberSeparator{ . } # separates numbers like 2.3.7
+@Begin
+
+ ###########################################################################
+ # #
+ # @Sym, font symbols, and miscellaneous special characters. #
+ # #
+ ###########################################################################
+
+ def @Sym right x { { Symbol Base } @Font @Char x }
+
+ def @R right x { Base @Font x }
+ def @I right x { Slope @Font x }
+ def @B right x { Bold @Font x }
+ def @BI right x { BoldSlope @Font x }
+ def @S right x { smallcaps @Font x }
+ def @F right x { { Courier Base -1p } @Font x }
+
+ def @II
+ right x
+ {
+ { @CurrFace @Case {
+ Bold @Yield BoldSlope
+ else @Yield Slope
+ } } @Font x
+ }
+
+ def "~" left x right y { x &1su y }
+ def "~~" left x right y { x &2s y }
+
+ def "``" { @Char "quotedblleft" @OrIfPlain "``" }
+ def "''" { @Char "quotedblright" @OrIfPlain "''" }
+ def ",," { @Char "quotedblbase" @OrIfPlain ",," }
+ def "--" { @Char "endash" @OrIfPlain "--" }
+ def "---" { @Char "emdash" @OrIfPlain "---"}
+ def "..." { @Char "ellipsis" @OrIfPlain "..."}
+ def @Bullet { @Char "bullet" @OrIfPlain "o" }
+ def @ParSym { @Char "paragraph" @OrIfPlain "P" }
+ def @SectSym { @Char "section" @OrIfPlain "$" }
+ def @Dagger { @Char "dagger" @OrIfPlain "+" }
+ def @DaggerDbl { @Char "daggerdbl" @OrIfPlain "++" }
+ def @CDot { @Char "periodcentered" @OrIfPlain "." }
+ def @Sterling { @Char "sterling" @OrIfPlain "&" }
+ def @Yen { @Char "yen" @OrIfPlain "Y" }
+ def @Florin { @Char "florin" @OrIfPlain "f" }
+
+ def @Star { @Sym "asteriskmath" @OrIfPlain "*" }
+ def @Degree { @Sym "degree" @OrIfPlain "o" }
+ def @Minute { @Sym "minute" @OrIfPlain "'" }
+ def @Second { @Sym "second" @OrIfPlain "''" }
+ def @Multiply { @Sym "multiply" @OrIfPlain "x" }
+ def @Divide { @Sym "divide" @OrIfPlain "/" }
+ def @Lozenge { @Sym "lozenge" @OrIfPlain "O" }
+ def @Register { @Sym "registersans" @OrIfPlain "R" }
+ def @CopyRight { @Sym "copyrightsans" @OrIfPlain "C" }
+ def @TradeMark { @Sym "trademarksans" @OrIfPlain "TM" }
+
+ def @Euro
+ {
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ 0.65w @VShift @VContract @HContract
+ "xsize ysize ysize 0.07 mul louteuro" @Graphic {
+ 0.7f @High 0.735f @Wide
+ }
+ }
+
+ PDF @Yield { EUR }
+
+ PlainText @Yield { EUR }
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Symbols stored in the "standard" database #
+ # #
+ # @Word language-spacific words such as Chapter, etc. #
+ # @Roman lower case Roman numerals i, ii, ... , cc #
+ # @UCRoman upper case Roman numerals I, II, ... , CC #
+ # @Alpha lower case Roman alphabet a, b, ... , z #
+ # @UCAlpha upper case Roman alphabet A, B, ... , Z #
+ # @Months months of the year: January, ... , December #
+ # @ShortMonths months of the year, abbreviated: Jan, ..., Dec #
+ # @WeekDays days of the week: Sunday, ... , Saturday #
+ # @ShortWeekDays days of the week, abbreviated: Sun, ... , Sat #
+ # @TwelveHours hours, from 1 to 12 #
+ # @ShortHours hours, from 0 to 23 #
+ # @DateTimeFormat format of results of @Date and @Time #
+ # #
+ ###########################################################################
+
+ def @Word left @Tag right @Val { @Val }
+ def @Roman left @Tag right @Val { @Val }
+ def @UCRoman left @Tag right @Val { @Val }
+ def @Alpha left @Tag right @Val { @Val }
+ def @UCAlpha left @Tag right @Val { @Val }
+ def @Months left @Tag right @Val { @Val }
+ def @ShortMonths left @Tag right @Val { @Val }
+ def @WeekDays left @Tag right @Val { @Val }
+ def @ShortWeekDays left @Tag right @Val { @Val }
+ def @TwelveHours left @Tag right @Val { @Val }
+ def @ShortHours left @Tag right @Val { @Val }
+ def @MeriDiems left @Tag right @Val { @Val }
+ def @ShortMeriDiems left @Tag right @Val { @Val }
+
+ export @Value
+ def @DateTimeFormat left @Tag
+ named @Value
+ named @Year {}
+ named @ShortYear {}
+ named @Month {}
+ named @ShortMonth {}
+ named @MonthNum {}
+ named @Day {}
+ named @ShortDay {}
+ named @DayNum {}
+ named @MeriDiem {}
+ named @ShortMeriDiem {}
+ named @Hour {}
+ named @TwelveHour {}
+ named @ShortHour {}
+ named @Minute {}
+ named @Second {}
+ {}
+ {}
+
+ @SysDatabase @Word @Roman @UCRoman @Alpha @UCAlpha @Months
+ @ShortMonths @WeekDays @ShortWeekDays @TwelveHours
+ @ShortHours @MeriDiems @ShortMeriDiems @DateTimeFormat
+ { standard }
+
+
+ ###########################################################################
+ # #
+ # @Date and @Time: the date and time now. #
+ # #
+ ###########################################################################
+
+ def @Date
+ named @Format
+ named @Year { @Moment&&now @Open { {@Century}@Year }}
+ named @ShortYear { @Moment&&now @Open { @Year }}
+ named @Month { @Moment&&now @Open { @Months&&@Month }}
+ named @ShortMonth { @Moment&&now @Open { @ShortMonths&&@Month }}
+ named @MonthNum { @Moment&&now @Open { @Month }}
+ named @Day { @Moment&&now @Open { @WeekDays&&@WeekDay }}
+ named @ShortDay { @Moment&&now @Open { @ShortWeekDays&&@WeekDay}}
+ named @DayNum { @Moment&&now @Open { @Day }}
+ named @MeriDiem { @Moment&&now @Open { @MeriDiems&&@Hour }}
+ named @ShortMeriDiem{ @Moment&&now @Open { @ShortMeriDiems&&@Hour }}
+ named @Hour { @Moment&&now @Open { @Hour }}
+ named @TwelveHour { @Moment&&now @Open { @TwelveHours&&@Hour }}
+ named @ShortHour { @Moment&&now @Open { @ShortHours&&@Hour }}
+ named @Minute { @Moment&&now @Open { @Minute }}
+ named @Second { @Moment&&now @Open { @Second }}
+ {
+ @DateTimeFormat&&date @Open { @Value
+ @Year { @Year }
+ @ShortYear { @ShortYear }
+ @Month { @Month }
+ @ShortMonth { @ShortMonth }
+ @MonthNum { @MonthNum }
+ @Day { @Day }
+ @ShortDay { @ShortDay }
+ @DayNum { @DayNum }
+ @MeriDiem { @MeriDiem }
+ @ShortMeriDiem { @ShortMeriDiem }
+ @Hour { @Hour }
+ @TwelveHour { @TwelveHour }
+ @ShortHour { @ShortHour }
+ @Minute { @Minute }
+ @Second { @Second }
+ }
+ }
+ { @Format }
+
+ def @Time
+ named @Format
+ named @Year { @Moment&&now @Open { {@Century}@Year }}
+ named @ShortYear { @Moment&&now @Open { @Year }}
+ named @Month { @Moment&&now @Open { @Months&&@Month }}
+ named @ShortMonth { @Moment&&now @Open { @ShortMonths&&@Month }}
+ named @MonthNum { @Moment&&now @Open { @Month }}
+ named @Day { @Moment&&now @Open { @WeekDays&&@WeekDay }}
+ named @ShortDay { @Moment&&now @Open { @ShortWeekDays&&@WeekDay}}
+ named @DayNum { @Moment&&now @Open { @Day }}
+ named @MeriDiem { @Moment&&now @Open { @MeriDiems&&@Hour }}
+ named @ShortMeriDiem{ @Moment&&now @Open { @ShortMeriDiems&&@Hour }}
+ named @Hour { @Moment&&now @Open { @Hour }}
+ named @TwelveHour { @Moment&&now @Open { @TwelveHours&&@Hour }}
+ named @ShortHour { @Moment&&now @Open { @ShortHours&&@Hour }}
+ named @Minute { @Moment&&now @Open { @Minute }}
+ named @Second { @Moment&&now @Open { @Second }}
+ {
+ @DateTimeFormat&&time @Open { @Value
+ @Year { @Year }
+ @ShortYear { @ShortYear }
+ @Month { @Month }
+ @ShortMonth { @ShortMonth }
+ @MonthNum { @MonthNum }
+ @Day { @Day }
+ @ShortDay { @ShortDay }
+ @DayNum { @DayNum }
+ @MeriDiem { @MeriDiem }
+ @ShortMeriDiem { @ShortMeriDiem }
+ @Hour { @Hour }
+ @TwelveHour { @TwelveHour }
+ @ShortHour { @ShortHour }
+ @Minute { @Minute }
+ @Second { @Second }
+ }
+ }
+ { @Format }
+
+
+ ###########################################################################
+ # #
+ # @DropCapTwo and @DropCapThree #
+ # #
+ ###########################################################################
+
+ def @DropCapTwo
+ left y
+ named height { 1.5v }
+ right x
+ {
+ def @ParPlace { @Galley }
+ def @EndParPlace { @Galley }
+
+ def @LineList
+ {
+ @PAdjust @ParPlace
+ //1vx @LineList
+ }
+
+ def @ParGalley horizontally into { @ParPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+ def @EndPar force into { @EndParPlace&&following } { @Null }
+
+ def @Cap
+ {
+ -0.25f @VShift 1.0w @VShift {
+ -90d @Rotate height @Wide @Scale 90d @Rotate y
+ }
+ }
+
+ |1s @PAdjust @ParPlace
+ /1vo @Cap @ParGalley {x & @EndPar &1rt } | @PAdjust @ParPlace
+ //1vx @LineList
+ // @EndParPlace
+ }
+
+ def @DropCapThree
+ left y
+ named height { 2.5v }
+ right x
+ {
+ def @ParPlace { @Galley }
+ def @EndParPlace { @Galley }
+
+ def @LineList
+ {
+ @PAdjust @ParPlace
+ //1vx @LineList
+ }
+
+ def @ParGalley force horizontally into { @ParPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+ def @EndPar force into { @EndParPlace&&following } { @Null }
+
+ def @Cap
+ {
+ -0.25f @VShift 1.0w @VShift {
+ -90d @Rotate height @Wide @Scale 90d @Rotate y
+ }
+ }
+
+ |1s @PAdjust @ParPlace
+ /1vo @ParGalley { x & @EndPar &1rt } | @PAdjust @ParPlace
+ /1vo @Cap | @PAdjust @ParPlace
+ //1vx @LineList
+ // @EndParPlace
+ }
+
+
+ ###########################################################################
+ # #
+ # @Centre, @Center, @Right, @NoDotSep, @NoDotJoin, @DotSep, #
+ # @DotJoin, @DashJoin, @NumSep #
+ # #
+ ###########################################################################
+
+ macro @Centre @Center { |0.5rt @HContract }
+
+ def @Right
+ precedence 50
+ left x
+ right y
+ { x |1.0rt @OneCol { 2f @Wide {} | y } }
+
+ def @NoDotSep left x right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield {
+ y @Case {
+ {} @Yield x
+ else @Yield { x |2s y }
+ }
+ }
+ }
+ }
+
+ def @NoDotJoin left x right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield {
+ y @Case {
+ {} @Yield x
+ else @Yield { x{y} }
+ }
+ }
+ }
+ }
+
+ def @DotSep left x right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield {
+ y @Case {
+ {} @Yield x
+ else @Yield { x. |2s y }
+ }
+ }
+ }
+ }
+
+ def @DotJoin left x right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield {
+ y @Case {
+ {} @Yield x
+ else @Yield { x.y }
+ }
+ }
+ }
+ }
+
+ def @DashJoin left x right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield {
+ y @Case {
+ {} @Yield x
+ else @Yield { x--y }
+ }
+ }
+ }
+ }
+
+ def @NumSep left x right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield {
+ y @Case {
+ {} @Yield x
+ else @Yield {
+ @CurrLang @Case {
+ Hungarian @Yield { y. x }
+ else @Yield { x y }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # @OverStrike, @Sup and @Sub #
+ # #
+ ###########################################################################
+
+ def @OverStrike left x right y
+ {
+ @OneRow { @HContract @VContract x /0io @HContract @VContract y }
+ }
+
+ def @Sup
+ left x
+ named gap { 0.40fk }
+ right y
+ {
+ @HContract @VContract
+ {
+ | 0.7f @Font y ^/gap x
+ }
+ }
+
+ def @Sub
+ left x
+ named gap { 0.40fk }
+ right y
+ {
+ @HContract @VContract
+ {
+ x /gap | 0.7f @Font y
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Colour, @Color, @AddPaint, @LineWidth #
+ # #
+ ###########################################################################
+
+ def @ColourCommand right col
+ {
+ def @ColourCoords
+ {
+ col @Case {
+ darkblue @Yield { 0.0 0.0 0.5 }
+ blue @Yield { 0.0 0.0 1.0 }
+ lightblue @Yield { 0.5 0.5 1.0 }
+ darkgreen @Yield { 0.0 0.5 0.0 }
+ green @Yield { 0.0 1.0 0.0 }
+ lightgreen @Yield { 0.5 1.0 0.5 }
+ darkred @Yield { 0.5 0.0 0.0 }
+ red @Yield { 1.0 0.0 0.0 }
+ lightred @Yield { 1.0 0.5 0.5 }
+ darkcyan @Yield { 0.0 0.5 0.5 }
+ cyan @Yield { 0.0 1.0 1.0 }
+ lightcyan @Yield { 0.5 1.0 1.0 }
+ darkmagenta @Yield { 0.5 0.0 0.5 }
+ magenta @Yield { 1.0 0.0 1.0 }
+ lightmagenta @Yield { 1.0 0.5 1.0 }
+ darkyellow @Yield { 0.5 0.5 0.0 }
+ yellow @Yield { 1.0 1.0 0.0 }
+ lightyellow @Yield { 1.0 1.0 0.5 }
+ darkgray @Yield { 0.2 0.2 0.2 }
+ gray @Yield { 0.5 0.5 0.5 }
+ lightgray @Yield { 0.8 0.8 0.8 }
+ darkgrey @Yield { 0.2 0.2 0.2 }
+ grey @Yield { 0.5 0.5 0.5 }
+ lightgrey @Yield { 0.8 0.8 0.8 }
+ black @Yield { 0.0 0.0 0.0 }
+ white @Yield { 1.0 1.0 1.0 }
+ }
+ }
+
+ col @Case {
+ nochange @Yield { nochange }
+ else @Yield { @BackEnd @Case {
+ PostScript @Yield { @ColourCoords setrgbcolor }
+ PDF @Yield { @ColourCoords rg @ColourCoords RG }
+ PlainText @Yield ""
+ } }
+ }
+ }
+
+ def @Colour @Color left col right y { {@ColourCommand col} @SetColour y }
+
+ def @AddPaint right col
+ {
+ col @Case {
+ none @Yield ""
+ nochange @Yield {
+ @BackEnd @Case {
+ PostScript @Yield "gsave fill grestore"
+ PDF @Yield "q f Q"
+ PlainText @Yield ""
+ }
+ }
+ else @Yield {
+ @BackEnd @Case {
+ PostScript @Yield {"gsave" @ColourCommand col "fill grestore"}
+ PDF @Yield { "q" @ColourCommand col "f Q" }
+ PlainText @Yield ""
+ }
+ }
+ }
+ }
+
+ def @LineWidth right lw
+ {
+ lw @Case {
+ "" @Yield ""
+ else @Yield {
+ @BackEnd @Case {
+ PostScript @Yield { lw "setlinewidth" }
+ PDF @Yield { lw "w" }
+ PlainText @Yield ""
+ }
+ }
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # @FullWidthRule, @Box, @CurveBox, and @ShadowBox #
+ # #
+ ###########################################################################
+
+ def @FullWidthRule
+ import @LengthUnits named linewidth {}
+ {
+ @BackEnd @Case {
+
+ PostScript @Yield @HExpand {
+ { "LoutRule" @LineWidth linewidth "stroke" } @Graphic { 0.5p @High }
+ }
+
+ PDF @Yield @HExpand {
+ { "0 0 m __xsize 0 l" @LineWidth linewidth "S" } @Graphic { 0.5p @High }
+ }
+
+ PlainText @Yield { "-" @PlainGraphic 1f @High }
+ }
+ }
+
+ def @LocalWidthRule
+ import @LengthUnits named linewidth {}
+ {
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ { "LoutRule" @LineWidth linewidth "stroke" } @Graphic { 0.5p @High }
+ }
+
+ PDF @Yield {
+ { "0 0 m __xsize 0 l" @LineWidth linewidth "S" } @Graphic { 0.5p @High }
+ }
+
+ PlainText @Yield { "-" @PlainGraphic 1f @High }
+ }
+ }
+
+ def @Box
+ named margin { 0.3f }
+ import @LengthUnits named linewidth {}
+ named paint { none }
+ right x
+ {
+ @BackEnd @Case {
+
+ PostScript @Yield @VContract @HContract 0c @HShift {
+ {"LoutBox" @AddPaint paint @LineWidth linewidth "stroke"}
+ @Graphic
+ { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin }
+ }
+
+ PDF @Yield @VContract @HContract 0c @HShift {
+ { "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h"
+ @AddPaint paint @LineWidth linewidth "S" } @Graphic
+ { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin }
+ }
+
+ PlainText @Yield @VContract @HContract 0c @HShift {
+ ^/margin ^|margin 0c @HShift @OneRow x |margin /margin
+ }
+ }
+ }
+
+ def @CurveBox
+ named margin { 0.3f }
+ import @LengthUnits named linewidth {}
+ named paint { none }
+ right x
+ {
+ def @PDFStuff
+ {
+ "__xmark 0 m"
+ "__sub(__xsize, __xmark) 0 l"
+ "__sub(__xsize, __div(__mul(11, __xmark), 24)) 0"
+ "__xsize __div(__mul(11, __xmark), 24)"
+ "__xsize __xmark c"
+ "__xsize __sub(__ysize, __xmark) l"
+ "__xsize __sub(__ysize, __div(__mul(11, __xmark), 24))"
+ "__sub(__xsize, __div(__mul(11, __xmark), 24)) __ysize"
+ "__sub(__xsize, __xmark) __ysize c"
+ "__xmark __ysize l"
+ "__div(__mul(11, __xmark), 24) __ysize"
+ "0 __sub(__ysize, __div(__mul(11, __xmark), 24))"
+ "0 __sub(__ysize, __xmark) c"
+ "0 __xmark l"
+ "0 __div(__mul(11, __xmark), 24)"
+ "__div(__mul(11, __xmark), 24) 0"
+ "__xmark 0 c"
+ "h"
+ @AddPaint paint @LineWidth linewidth "S"
+ }
+
+ @VContract @HContract 0c @HShift @BackEnd @Case {
+
+ PostScript @Yield {
+ {"LoutCurveBox" @AddPaint paint @LineWidth linewidth "stroke"}
+ @Graphic
+ { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin }
+ }
+
+ PlainText @Yield {
+ ^/margin ^|margin 0c @HShift @OneRow x |margin /margin
+ }
+
+ PDF @Yield {
+ @PDFStuff @Graphic
+ { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin }
+ }
+ }
+ }
+
+ def @ShadowBox
+ named margin { 0.3f }
+ import @LengthUnits named linewidth {}
+ named paint { none }
+ named shadow { 0.2f }
+ right x
+ {
+ @VContract @HContract 0c @HShift @BackEnd @Case {
+
+ PostScript @Yield {
+ "LoutShadowBox fill" @Graphic
+ { ^/shadow ^|shadow 0c @HShift
+ @Box margin {margin} paint {paint} linewidth {linewidth} x
+ |shadow /shadow
+ }
+ }
+
+ PlainText @Yield {
+ ^/shadow ^|shadow 0c @HShift
+ @Box margin {margin} paint {paint} linewidth {linewidth} x
+ |shadow /shadow
+ }
+
+ PDF @Yield {
+ {
+ "__mul(__xmark, 2) 0 m __xsize 0 l"
+ "__xsize __sub(__ysize, __mul(__xmark, 2)) l"
+ "__sub(__xsize, __xmark) __sub(__ysize, __mul(__xmark, 2)) l"
+ "__sub(__xsize, __xmark) __xmark l"
+ "__mul(__xmark, 2) __xmark l h f"
+ }
+ @Graphic
+ { ^/shadow ^|shadow 0c @HShift
+ @Box margin {margin} paint {paint} linewidth {linewidth} x
+ |shadow /shadow
+ }
+ }
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # @BoundaryMarks #
+ # #
+ ###########################################################################
+
+ def @BoundaryMarks
+ import @LengthUnits named linewidth { 0.2p }
+ import @LengthUnits named length { 0.5c }
+ import @LengthUnits named gap { 0.5c }
+ import @LengthUnits named lout { 0c }
+ import @LengthUnits named rout { 0c }
+ import @LengthUnits named uout { 0c }
+ import @LengthUnits named dout { 0c }
+ {
+ def @UpStroke { "0" gap "rmoveto" "0" length "rlineto" }
+ def @DownStroke { "0" gap "neg" "rmoveto" "0" length "neg rlineto" }
+ def @LeftStroke { gap "neg" "0" "rmoveto" length "neg" "0 rlineto" }
+ def @RightStroke { gap "0" "rmoveto" length "0 rlineto" }
+
+ def @LLSpot { lout "neg" dout "neg" moveto }
+ def @LRSpot { xsize rout "add" dout "neg" moveto }
+ def @ULSpot { lout "neg" ysize uout "add" moveto }
+ def @URSpot { xsize rout "add" ysize uout "add" moveto }
+
+ def @PDFStuff {
+ "__sub(-"gap", "lout") __sub(0, "dout") m "
+ "__sub(__sub(-"gap", "lout"), "length") __sub(0, "dout") l"
+ "__sub(0, "lout") __sub(-"gap", "dout") m "
+ "__sub(0, "lout") __sub(__sub(-"gap", "dout"), "length") l"
+ "__add(__xsize,"rout") __sub(-"gap", "dout") m "
+ "__add(__xsize,"rout") __sub(__sub(-"gap", "dout"), "length") l"
+ "__add(__add(__xsize,"rout"),"gap") __sub(0, "dout") m "
+ "__add(__add(__add(__xsize,"rout"),"gap"),"length") __sub(0, "dout") l"
+ " __sub(__sub(0, "lout"), "gap") __add(__ysize, "uout") m "
+ "__sub(__sub(__sub(0, "lout"), "gap"), "length") __add(__ysize, "uout") l"
+ "__sub(0, "lout") __add(__add(__ysize, "uout"), "gap") m "
+ "__sub(0, "lout") __add(__add(__add(__ysize, "uout"), "gap"), "length") l"
+ " __add(__add(__xsize, "rout"), "gap") __add(__ysize, "uout") m "
+ "__add(__add(__add(__xsize, "rout"), "gap"), "length") __add(__ysize, "uout") l"
+ "__add(__xsize, "rout") __add(__add(__ysize, "uout"), "gap") m "
+ "__add(__xsize, "rout") __add(__add(__add(__ysize, "uout"), "gap"), "length") l"
+
+ linewidth "w S"
+ }
+
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ {
+ @LLSpot @LeftStroke
+ @LLSpot @DownStroke
+ @LRSpot @DownStroke
+ @LRSpot @RightStroke
+ @ULSpot @LeftStroke
+ @ULSpot @UpStroke
+ @URSpot @RightStroke
+ @URSpot @UpStroke
+
+ linewidth "setlinewidth stroke"
+ } @Graphic {}
+ }
+
+ PlainText @Yield ""
+
+ PDF @Yield { @PDFStuff @Graphic {} }
+ }
+ }
+
+ ##########################################################################
+ # #
+ # @NumberMarker, @NumberOf, @PageMarker, @PageMark, and @PageOf #
+ # #
+ ##########################################################################
+
+ export @Tag @Value
+ def @NumberMarker
+ named @Tag {}
+ named @Value { "??" }
+ {
+ @Null
+ }
+
+ def @NumberOf
+ right x
+ {
+ @NumberMarker&&x @Open { @Value }
+ }
+
+
+ export num rawnum @Tag
+ def @PageMarker
+ named @Tag {}
+ named num {}
+ named rawnum {}
+ {
+ @PageLabel num
+ }
+
+ def @PageMark
+ right x
+ {
+ @PageMarker&&preceding @Tagged x
+ }
+
+ def @PageOf
+ right x
+ {
+ @PageMarker&&x @Open { num }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Join and @Sep #
+ # #
+ # Join two objects together with @NumberSeparator, unless one is #
+ # empty in which case just return the other. #
+ # #
+ ###########################################################################
+
+ def @Join left x right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield {
+ y @Case {
+ {} @Yield x
+ else @Yield { x{@NumberSeparator}y }
+ }
+ }
+ }
+ }
+
+ def @Sep left x right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield {
+ y @Case {
+ {} @Yield x
+ else @Yield { x{@NumberSeparator} |2s y }
+ }
+ }
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Miscellaneous. #
+ # #
+ ###########################################################################
+
+ def @Heading right x { ragged @Break @HeadingFont @Font x }
+ def "^" { {} ^& {} }
+ def "&-" left x right y { x &0ch y }
+
+
+ ###########################################################################
+ # #
+ # @If @Not @And @Or @True #
+ # #
+ # Used in databases to make optional fields format nicely. #
+ # #
+ ###########################################################################
+
+ def @If
+ precedence 97
+ left x
+ right y
+ {
+ y @Case {
+ {} @Yield @Null
+ else @Yield { @Null{x} }
+ }
+ }
+
+ def @Not
+ precedence 100
+ right y
+ {
+ y @Case {
+ {} @Yield "*"
+ else @Yield ""
+ }
+ }
+
+ def @And
+ precedence 99
+ left x
+ right y
+ {
+ x @Case {
+ {} @Yield {}
+ else @Yield y
+ }
+ }
+
+ def @Or
+ precedence 98
+ left x
+ right y
+ {
+ x @Case {
+ {} @Yield y
+ else @Yield x
+ }
+ }
+
+ def @True { "*" }
+
+
+ ###########################################################################
+ # #
+ # Paragraphs. #
+ # #
+ ###########################################################################
+
+ macro @PP { //@ParaGap @ParaIndent @Wide &{0i} }
+ macro @LP { //{@ParaGap} }
+ macro @LLP { //{1vx} }
+ macro @DP { //{@DisplayGap} }
+ macro @LOP { //{@ListOuterGap} }
+ macro @NP { //{1.1b} }
+ macro @CNP { // 3.2v @High //0io //{} }
+
+
+ ###########################################################################
+ # #
+ # Beginning and ending of aligned displays. #
+ # #
+ ###########################################################################
+
+ def @APlace { @Galley }
+ def @EndAlignedPlace { @Galley }
+ def @AlignedPlace { @Galley }
+
+ def @BAligned into { @APlace&&preceding }
+ {
+ def @AlignedList { @AlignedPlace /1.1b @AlignedList }
+
+ //1.1b @AlignedList
+ // @EndAlignedPlace
+ }
+
+ macro @BAD @BeginAlignedDisplays { // @APlace | @BAligned }
+ def @EAD @EndAlignedDisplays force into { @EndAlignedPlace&&preceding } {}
+
+
+ ###########################################################################
+ # #
+ # New code for numbered displays that will cross section boundaries #
+ # #
+ ###########################################################################
+
+ export @Tag val
+ def @NumDispCounterMarker
+ named @Tag {}
+ named val {}
+ {
+ @Null
+ }
+
+ def @NumDispNum right tag
+ {
+ @NumDispCounterMarker&&tag @Open { @Next val }
+ }
+
+ def @NumDispCounterIncrement
+ right tag
+ {
+ @NumDispCounterMarker&&preceding @Tagged tag
+ @NumDispCounterMarker val { @NumDispNum tag }
+ @NumberMarker @Tag { tag } @Value { @NumDispNum tag }
+ }
+
+ def @NN
+ {
+ @NumDispCounterMarker&&preceding @Open { @DisplayNumStyle val }
+ }
+
+ def @Do
+ left x
+ right y
+ {
+ x @Case {
+ { No None } @Yield @Null
+ else @Yield y
+ }
+ }
+
+ def @BeginDisplayCounter
+ left condition
+ right prefix
+ {
+ condition @Do @NumDispCounterMarker val { prefix @Join 0 }
+ }
+
+
+ ###########################################################################
+ # #
+ # Galleys that carry displays to their places. #
+ # #
+ ###########################################################################
+
+ def @DispPlace { @Galley }
+
+ def @Disp into { @DispPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+ def @NDisp into { @DispPlace&&preceding }
+ named @Tag {}
+ right x
+ {
+ @OneRow {
+ @NumDispCounterIncrement @Tag
+ @PageMark @Tag
+ ^//
+ @OneRow x
+ }
+ }
+
+ def @ADisp into { @AlignedPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+ def @ANDisp into { @AlignedPlace&&preceding }
+ named @Tag {}
+ right x
+ {
+ @OneRow {
+ @NumDispCounterIncrement @Tag
+ @PageMark @Tag
+ ^/
+ @OneRow x
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Displays and raw displays. #
+ # #
+ ###########################################################################
+
+ macro @G { |@DefaultIndent }
+ macro @LG { | }
+ macro @IG { |@DisplayIndent }
+ macro @CG { |0.5rt }
+ macro @RG { |1.0rt }
+ macro @QR { @DisplayIndent @Wide { |1rt @NN } }
+ macro @DX { @DispPlace }
+ macro @DY { @Disp }
+ macro @AX { @APlace }
+ macro @AY { @ADisp }
+ macro @NY { @NDisp }
+ macro @MY { @ANDisp }
+
+ macro @D @Display { @DP @G @DX | @DP // @DY }
+ macro @LD @LeftDisplay { @DP @LG @DX | @DP // @DY }
+ macro @ID @IndentedDisplay { @DP @IG @DX | @DP // @DY }
+ macro @QD @QuotedDisplay { @DP @IG @DX @IG @DP // @DY }
+ macro @CD @CentredDisplay
+ @CenteredDisplay { @DP @CG @DX | @DP // @DY }
+ macro @RightDisplay { @DP @RG @DX | @DP // @DY }
+
+
+ macro @AD @AlignedDisplay { @DP @G @AX | @DP // @AY }
+ macro @LAD @LeftAlignedDisplay { @DP @LG @AX | @DP // @AY }
+ macro @IAD @IndentedAlignedDisplay { @DP @IG @AX | @DP // @AY }
+ macro @QAD @QuotedAlignedDisplay { @DP @IG @AX @IG @DP // @AY }
+ macro @CAD @CentredAlignedDisplay
+ @CenteredAlignedDisplay { @DP @CG @AX | @DP // @AY }
+ macro @RightAlignedDisplay { @DP @RG @AX | @DP // @AY }
+
+ macro @ND @NumberedDisplay { @DP @G @DX |1rt @NN @DP // @NY }
+ macro @LND @LeftNumberedDisplay { @DP @LG @DX |1rt @NN @DP // @NY }
+ macro @IND @IndentedNumberedDisplay { @DP @IG @DX |1rt @NN @DP // @NY }
+ macro @QND @QuotedNumberedDisplay { @DP @IG @DX |1rt @QR @DP // @NY }
+ macro @CND @CentredNumberedDisplay
+ @CenteredNumberedDisplay { @DP @CG @DX |1rt @NN @DP // @NY }
+ macro @RightNumberedDisplay { @DP @RG @DX |1rt @NN @DP // @NY }
+
+ macro @AND @AlignedNumberedDisplay { @DP @G @AX |1rt @NN @DP // @MY }
+ macro @LAND @LeftAlignedNumberedDisplay { @DP @LG @AX |1rt @NN @DP // @MY }
+ macro @IAND @IndentedAlignedNumberedDisplay{ @DP @IG @AX |1rt @NN @DP // @MY }
+ macro @QAND @QuotedAlignedNumberedDisplay { @DP @IG @AX |1rt @QR @DP // @MY }
+ macro @CAND @CentredAlignedNumberedDisplay
+ @CenteredAlignedNumberedDisplay{ @DP @CG @AX |1rt @NN @DP // @MY }
+ macro @RightAlignedNumberedDisplay { @DP @RG @AX |1rt @NN @DP // @MY }
+
+
+ macro @RD @RawDisplay { @G @DX | // @DY }
+ macro @RLD @RawLeftDisplay { @LG @DX | // @DY }
+ macro @RID @RawIndentedDisplay { @IG @DX | // @DY }
+ macro @RQD @RawQuotedDisplay { @IG @DX @IG | // @DY }
+ macro @RCD @RawCentredDisplay
+ @RawCenteredDisplay { @CG @DX | | // @DY }
+ macro @RRD @RawRightDisplay { @RG @DX | // @DY }
+
+
+ macro @RAD @RawAlignedDisplay { @G @AX | // @AY }
+ macro @RLAD @RawLeftAlignedDisplay { @LG @AX | // @AY }
+ macro @RIAD @RawIndentedAlignedDisplay { @IG @AX | // @AY }
+ macro @RQAD @RawQuotedAlignedDisplay { @IG @AX @IG | // @AY }
+ macro @RCAD @RawCentredAlignedDisplay
+ @RawCenteredAlignedDisplay { @CG @AX | // @AY }
+ macro @RRAD @RawRightAlignedDisplay { @RG @AX | // @AY }
+
+ macro @RND @RawNumberedDisplay { @G @DX |1rt @NN // @NY }
+ macro @RLND @RawLeftNumberedDisplay { @LG @DX |1rt @NN // @NY }
+ macro @RIND @RawIndentedNumberedDisplay { @IG @DX |1rt @NN // @NY }
+ macro @RQND @RawQuotedNumberedDisplay { @IG @DX |1rt @QR // @NY }
+ macro @RCND @RawCentredNumberedDisplay
+ @RawCenteredNumberedDisplay { @CG @DX |1rt @NN // @NY }
+ macro @RRND @RawRightNumberedDisplay { @RG @DX |1rt @NN // @NY }
+
+ macro @RAND @RawAlignedNumberedDisplay { @G @AX |1rt @NN // @MY }
+ macro @RLAND @RawLeftAlignedNumberedDisplay { @LG @AX |1rt @NN // @MY }
+ macro @RIAND @RawIndentedAlignedNumberedDisplay { @IG @AX |1rt @NN // @MY }
+ macro @RQAND @RawQuotedAlignedNumberedDisplay { @IG @AX |1rt @QR // @MY }
+ macro @RCAND @RawCentredAlignedNumberedDisplay
+ @RawCenteredAlignedNumberedDisplay { @CG @AX |1rt @NN // @MY }
+ macro @RRAND @RawRightAlignedNumberedDisplay{ @RG @AX |1rt @NN // @MY }
+
+
+ ###########################################################################
+ # #
+ # Lists and raw lists. #
+ # #
+ ###########################################################################
+
+
+ def @ItemPlace { @Galley }
+ def @InterruptItemPlace { @Galley }
+ def @NewPageItemPlace { @Galley }
+ def @TagPlace { @Galley }
+ def @EndListPlace { @Galley }
+
+ def @RawList
+ named style right num { num }
+ named type right num { num }
+ named gap { @ListGap }
+ named indent { @ListIndent }
+ named itemindent { 0c }
+ named rightindent { @ListRightIndent }
+ named labelwidth { @ListLabelWidth }
+ named start { 1 }
+ {
+ def @MakeList right num
+ {
+ def @NormalItem
+ {
+ |indent
+ labelwidth @Wide {
+ # @NumberMarker @Value {style num} {style num} &0io
+ @NumberMarker @Value {num} {style type num} &0io
+ }
+ |itemindent @ItemPlace |rightindent
+ //gap @MakeList @NotRevealed @Next num
+ }
+
+ def @InterruptItem
+ {
+ @InterruptItemPlace
+ //gap @MakeList @NotRevealed num
+ }
+
+ def @NewPageItem
+ {
+ @NewPageItemPlace
+ //1.1b @MakeList @NotRevealed num
+ }
+
+ @OneOf
+ {
+ @NormalItem
+ @InterruptItem
+ @NewPageItem
+ }
+ }
+
+ def @ListGalleyPlace { @Galley }
+
+ def @ListGalley into { @ListGalleyPlace&&preceding }
+ {
+ @MakeList start // @EndListPlace
+ }
+
+ @ListGalleyPlace
+ //
+ @ListGalley
+ }
+
+ def listitem into { @ItemPlace&&preceding }
+ named @Tag {}
+ right x
+ {
+ @NumberMarker&&preceding @Tagged @Tag
+ // @PageMark @Tag
+ // x
+ }
+
+ def droplistitem into { @ItemPlace&&preceding }
+ named @Tag {}
+ right x
+ {
+ @NumberMarker&&preceding @Tagged @Tag
+ // @PageMark @Tag
+ //
+ //1vx x
+ }
+
+ def tagitem into { @ItemPlace&&preceding }
+ named tag {}
+ right x
+ {
+ def sendtag into { @TagPlace&&preceding } { tag }
+
+ sendtag // x
+ }
+
+ def droptagitem into { @ItemPlace&&preceding }
+ named tag {}
+ right x
+ {
+ def sendtag into { @TagPlace&&preceding } { tag }
+
+ sendtag // //1vx x
+ }
+
+ def endlist force into { @EndListPlace&&preceding } {}
+
+ def listnewpage into { @NewPageItemPlace&&preceding } {}
+
+ def listinterruptitem into { @InterruptItemPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+
+ macro @LI @ListItem { // listitem }
+ macro @LII @ListInterruptItem { // listinterruptitem }
+ macro @LNP @ListNewPage { // listnewpage }
+ macro @DLI @DropListItem { // droplistitem }
+ macro @TI @TagItem { // tagitem tag }
+ macro @DTI @DropTagItem { // droptagitem tag }
+ macro @REL @RawEndList { // & endlist // }
+ macro @EL @EndList { // & endlist @LOP }
+
+
+ macro @RLL @RawLeftList { @RawList style {}
+ labelwidth { 0c } }
+ macro @RIL @RawIndentedList { @RawList style {} }
+ macro @RQL @RawQuotedList { @RawList style {}
+ rightindent {@DisplayIndent}}
+ macro @RCL @RawCentredList { @RawList style {}
+ labelwidth {0c}
+ itemindent {0.5rt} }
+ macro @RawCenteredList { @RawCentredList }
+ macro @RNL @RawNumberedList { @RawList style { num. } }
+ macro @RPNL @RawParenNumberedList { @RawList style { (num) } }
+ macro @RRL @RawRomanList { @RawList type { @Roman&&num }
+ style { num. } }
+ macro @RPRL @RawParenRomanList { @RawList type { @Roman&&num }
+ style { (num) } }
+ macro @RUCRL @RawUCRomanList { @RawList type { @UCRoman&&num }
+ style { num. } }
+ macro @RPUCRL @RawParenUCRomanList { @RawList type { @UCRoman&&num }
+ style { (num) } }
+ macro @RAL @RawAlphaList { @RawList type { @Alpha&&num }
+ style { num. } }
+ macro @RPAL @RawParenAlphaList { @RawList type { @Alpha&&num }
+ style { (num) } }
+ macro @RUCAL @RawUCAlphaList { @RawList type { @UCAlpha&&num }
+ style { num. } }
+ macro @RPUCAL @RawParenUCAlphaList { @RawList type { @UCAlpha&&num }
+ style { (num) } }
+ macro @RBL @RawBulletList { @RawList style { @Bullet } }
+ macro @RSL @RawStarList { @RawList style { @Star } }
+ macro @RDL @RawDashList { @RawList style { -- } }
+ macro @RTL @RawTaggedList { @RawList type { @TagPlace } }
+ macro @RWTL @RawWideTaggedList { @RawList type { @TagPlace }
+ labelwidth { @WideIndent } }
+ macro @RVWTL @RawVeryWideTaggedList{ @RawList type { @TagPlace }
+ labelwidth { @VeryWideIndent } }
+
+
+ macro @L @List { @LOP @RawList }
+ macro @LL @LeftList { @LOP @RawLeftList }
+ macro @IL @IndentedList { @LOP @RawIndentedList }
+ macro @QL @QuotedList { @LOP @RawQuotedList }
+ macro @CL @CentredList { @LOP @RawCentredList }
+ macro @CenteredList { @LOP @RawCenteredList }
+ macro @NL @NumberedList { @LOP @RawNumberedList }
+ macro @PNL @ParenNumberedList { @LOP @RawParenNumberedList }
+ macro @RL @RomanList { @LOP @RawRomanList }
+ macro @PRL @ParenRomanList { @LOP @RawParenRomanList }
+ macro @UCRL @UCRomanList { @LOP @RawUCRomanList }
+ macro @PUCRL @ParenUCRomanList { @LOP @RawParenUCRomanList }
+ macro @AL @AlphaList { @LOP @RawAlphaList }
+ macro @PAL @ParenAlphaList { @LOP @RawParenAlphaList }
+ macro @UCAL @UCAlphaList { @LOP @RawUCAlphaList }
+ macro @PUCAL @ParenUCAlphaList { @LOP @RawParenUCAlphaList }
+ macro @BL @BulletList { @LOP @RawBulletList }
+ macro @SL @StarList { @LOP @RawStarList }
+ macro @DL @DashList { @LOP @RawDashList }
+ macro @TL @TaggedList { @LOP @RawTaggedList }
+ macro @WTL @WideTaggedList { @LOP @RawWideTaggedList }
+ macro @VWTL @VeryWideTaggedList { @LOP @RawVeryWideTaggedList }
+
+@End @BasicSetup
diff --git a/include/bsf.lpg b/include/bsf.lpg
new file mode 100644
index 0000000..8eb6c02
--- /dev/null
+++ b/include/bsf.lpg
@@ -0,0 +1,140 @@
+%%BeginResource: procset LoutBasicSetup
+
+% width height linethickness louteuro -
+% draw a Euro symbol of this width and height with this line thickness
+% Author: Jeff Kingston, based on code from Andrew Beardsley
+/louteuro {
+ 20 dict begin
+ /eurothick exch def
+ /euroheight exch def
+ /eurowidth exch def
+ /eurostrokewidth euroheight 0.8 mul def
+ /eurostep eurothick 60 cos mul 60 sin div def
+ /eurotheta 40 def
+
+ % llx lly width thickness louteurobox -
+ % draw angled box starting at (llx, lly) with given width and thickness
+ /louteurobox
+ {
+ /euroboxthick exch def
+ /euroboxwidth exch def
+ newpath moveto euroboxwidth 0 rlineto
+ eurostep euroboxthick rlineto
+ euroboxwidth neg 0 rlineto closepath fill
+ } def
+
+ % lower cross stroke
+ 0 euroheight 2 div eurothick 1.5 mul sub
+ eurostrokewidth eurothick louteurobox
+
+ % upper cross stroke
+ 0 euroheight 2 div eurothick 0.5 mul add
+ eurostrokewidth eurostep 2 mul add eurothick louteurobox
+
+ % circular part
+ /eurohctr eurowidth euroheight 2 div eurotheta cos mul sub def
+ /eurovctr euroheight 2 div def
+ newpath
+ eurohctr eurovctr eurovctr eurotheta 350 eurotheta sub arc
+ eurohctr eurovctr eurovctr eurothick sub 365 eurotheta sub eurotheta arcn
+ closepath fill
+ end
+} def
+
+% path for @FullWidthRule symbol
+/LoutRule
+{ 0 0 moveto xsize 0 lineto
+} def
+
+% path for @Box symbol
+/LoutBox
+{ 0 0 moveto xsize 0 lineto
+ xsize ysize lineto 0 ysize lineto
+ closepath
+} def
+
+% path for @CurveBox symbol
+/LoutCurveBox
+{ xmark 0 moveto
+ xsize xmark sub xmark xmark 270 360 arc
+ xsize xmark sub ysize xmark sub xmark 0 90 arc
+ xmark ysize xmark sub xmark 90 180 arc
+ xmark xmark xmark 180 270 arc
+ closepath
+} def
+
+% path for @ShadowBox symbol
+/LoutShadowBox
+{ xmark 2 mul 0 moveto xsize 0 lineto
+ xsize ysize xmark 2 mul sub lineto
+ xsize xmark sub ysize xmark 2 mul sub lineto
+ xsize xmark sub xmark lineto
+ xmark 2 mul xmark lineto
+ closepath
+} def
+
+% set up dictionary containing margin note data: parity LoutMargSet -
+/LoutMargSet
+{ /LoutMargDict 12 dict def
+ LoutMargDict begin
+ /parity exch def
+ /matr matrix currentmatrix def
+ /rightx xsize def
+ /lefty ysize def % highest allowable point for top of next left note
+ /righty ysize def % highest allowable point for top of next right note
+ /max { 2 copy gt { pop } { exch pop } ifelse } def
+ /min { 2 copy lt { pop } { exch pop } ifelse } def
+ end
+} def
+
+%translate coordinate system for marginal notes: type LoutMargShift -
+% where type 0 is left margin, 1 is right margin, 2 is outer, 3 is inner
+/LoutMargShift
+{ LoutMargDict begin
+
+ % y coordinate of top of note, in margin coords, before vertical adjust
+ 0 ysize transform matr itransform exch pop
+
+ % decide whether left or right margin based on type and parity
+ exch [ 0 1 parity 1 parity sub ] exch get 0 eq
+ {
+ % left margin: adjust top of note downwards if overlaps previous note
+ lefty min
+
+ % bottom of note is new lefty position and also translate position
+ ysize sub dup /lefty exch def
+
+ % want right edge of note at coordinate zero
+ xsize neg exch
+ }
+ {
+ % right margin: adjust top of note downwards if overlaps previous note
+ righty min
+
+ % bottom of note is new righty position and also translate position
+ ysize sub dup /righty exch def
+
+ % want left edge of note at coordinate rightx
+ rightx exch
+ } ifelse
+
+ % stack now contains coord of bottom left corner in margin coordinates
+ matr setmatrix translate
+ end
+} def
+
+% create LoutPageDict with left, right, foot, top for @Place symbol users
+/LoutPageSet
+{
+ /LoutPageDict 5 dict def
+ LoutPageDict begin
+ /matr matrix currentmatrix def
+ /left 0 def
+ /right xsize def
+ /foot 0 def
+ /top ysize def
+ end
+
+} def
+
+%%EndResource
diff --git a/include/cprint b/include/cprint
new file mode 100644
index 0000000..d7acb06
--- /dev/null
+++ b/include/cprint
@@ -0,0 +1,70 @@
+###############################################################################
+# #
+# Lout setup file for C and C++ program printing #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# The @SysInclude { cprintf } line #
+# #
+# This line causes Lout to read the definitions for C printing, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { cprintf }
+
+
+###############################################################################
+# #
+# The @CPSetup @Use clause #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @CPSetup
+ # style { fixed } # fixed, varying, or symbol
+
+ # fixedfont { Courier } # font family if fixed
+ # fixedstrings { Base } # string face if fixed
+ # fixedidentifiers { Base } # identifier face if fixed
+ # fixedcomments { Base } # comment face if fixed
+ # fixedkeywords { Base } # keyword face if fixed
+ # fixednumbers { Base } # number face if fixed
+ # fixedoperators { Base } # operator face if fixed
+ # fixedsize { -1.0p } # font size if fixed
+ # fixedline { 1.0vx } # line-space if fixed
+ # fixedtabin { 8 } # tab interval if fixed
+ # fixedtabout { 8s } # tab width if fixed
+
+ # varyingfont { } # font family if varying
+ # varyingstrings { Slope } # string face if varying
+ # varyingidentifiers { Slope } # identifier face if varying
+ # varyingcomments { Base } # comment face if varying
+ # varyingkeywords { Bold } # keyword face if varying
+ # varyingnumbers { Base } # number face if varying
+ # varyingoperators { Base } # operator face if varying
+ # varyingsize { 1.0f } # font size if varying
+ # varyingline { 1.0vx } # line-space if varying
+ # varyingtabin { 8 } # tab interval if varying
+ # varyingtabout { 3f } # tab width if varying
+
+ # symbolfont { } # font family if symbol
+ # symbolstrings { Slope } # string face if symbol
+ # symbolidentifiers { Slope } # identifier face if symbol
+ # symbolcomments { Base } # comment face if symbol
+ # symbolkeywords { Bold } # keyword face if symbol
+ # symbolnumbers { Base } # number face if symbol
+ # symboloperators { Base } # operator face if symbol
+ # symbolsize { 1.0f } # font size if symbol
+ # symbolline { 1.0vx } # line-space if symbol
+ # symboltabin { 8 } # tab interval if symbol
+ # symboltabout { 3f } # tab width if symbol
+}
diff --git a/include/cprintf b/include/cprintf
new file mode 100644
index 0000000..fca806e
--- /dev/null
+++ b/include/cprintf
@@ -0,0 +1,383 @@
+
+###############################################################################
+# #
+# Lout @CPSetup package for formatting C and C++ programs (Version 1.1) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, March 1994. #
+# Version 1.1 by Jeffrey H. Kingston, November 1998 (name change only) #
+# #
+# This package uses a filtered body parameter to convert C and C++ source #
+# code into Lout source. The filter program is c2lout which is distributed #
+# with Basser Lout Version 3. The list of keywords and tokens is from #
+# Stroustrup, 2nd Edition. See "User's Guide to the Lout Document #
+# Formatting System" for user information. #
+# #
+###############################################################################
+
+export @CP
+def @CPSetup
+ named style { fixed } # print style
+
+ named fixedfont { Courier } # font family if fixed
+ named fixedstrings { Base } # string face if fixed
+ named fixedidentifiers { Base } # identifier face if fixed
+ named fixedcomments { Base } # comment face if fixed
+ named fixedkeywords { Base } # keyword face if fixed
+ named fixednumbers { Base } # number face if fixed
+ named fixedoperators { Base } # operator face if fixed
+ named fixedsize { -1.0p } # font size if fixed
+ named fixedline { 1.0vx } # line-space if fixed
+ named fixedtabin { 8 } # tab interval if fixed
+ named fixedtabout { 8s } # tab width if fixed
+
+ named varyingfont { } # font family if varying
+ named varyingstrings { Slope } # string face if varying
+ named varyingidentifiers { Slope } # identifier face if varying
+ named varyingcomments { Base } # comment face if varying
+ named varyingkeywords { Bold } # keyword face if varying
+ named varyingnumbers { Base } # number face if varying
+ named varyingoperators { Base } # operator face if varying
+ named varyingsize { 1.0f } # font size if varying
+ named varyingline { 1.0vx } # line-space if varying
+ named varyingtabin { 8 } # tab interval if varying
+ named varyingtabout { 3f } # tab width if varying
+
+ named symbolfont { } # font family if symbol
+ named symbolstrings { Slope } # string face if symbol
+ named symbolidentifiers { Slope } # identifier face if symbol
+ named symbolcomments { Base } # comment face if symbol
+ named symbolkeywords { Bold } # keyword face if symbol
+ named symbolnumbers { Base } # number face if symbol
+ named symboloperators { Base } # operator face if symbol
+ named symbolsize { 1.0f } # font size if symbol
+ named symbolline { 1.0vx } # line-space if symbol
+ named symboltabin { 8 } # tab interval if symbol
+ named symboltabout { 3f } # tab width if symbol
+
+@Begin
+
+ export
+
+ "$$" "$>" "`" @L @S @C
+
+ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
+
+ "!" "%" "^" "&" "*" "(" ")" "-" "+" "=" "${" "$}" "|" "~"
+ "[" "]" ";" "'" ":" "<" ">" "?" "," "." "/"
+
+ "->" "++" "--" ".*" "->*" "<<" ">>" "<=" ">=" "==" "!=" "&&"
+ "||" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" "&=" "^=" "|=" "::"
+
+ asm continue float new signed try
+ auto default for operator sizeof typedef
+ break delete friend private static union
+ case do goto protected struct unsigned
+ catch double if public switch virtual
+ char else inline register template void
+ class enum int return this volatile
+ const extern long short throw while
+
+ @EvaluateCp
+
+ def @CP
+ named style { style } # style
+ named font { dft } # font family
+ named strings { dft } # string font
+ named identifiers { dft } # ident. font
+ named comments { dft } # comment font
+ named keywords { dft } # keyword font
+ named numbers { dft } # number font
+ named operators { dft } # operator font
+ named size { dft } # font size
+ named line { dft } # line-space
+ named tabin { dft } # tab interval
+ named tabout { dft } # tab width
+ body @Body # filtered, see below
+ @Begin
+
+ def @Test # returns x unless x is dft
+ left x
+ named iffixed {}
+ named ifvarying {}
+ named ifsymbol {}
+ {
+ x @Case {
+ dft @Yield {
+ style @Case {
+ fixed @Yield { iffixed }
+ varying @Yield { ifvarying }
+ symbol @Yield { ifsymbol }
+ }
+ }
+ else @Yield x
+ }
+ }
+
+ def @InitTab
+ {
+ tabin @Test
+ iffixed { fixedtabin }
+ ifvarying { varyingtabin }
+ ifsymbol { symboltabin }
+ }
+
+ def @InitTabWidth
+ {
+ tabout @Test
+ iffixed { fixedtabout }
+ ifvarying { varyingtabout }
+ ifsymbol { symboltabout }
+ }
+
+ def @Filter
+ {
+ c2lout -r -i{@FilterIn} -o{@FilterOut} -e{@FilterErr}
+ -t{@InitTab} -T{@InitTabWidth}
+ }
+
+ def @InitFontFamily
+ {
+ font @Test
+ iffixed { fixedfont }
+ ifvarying { varyingfont }
+ ifsymbol { symbolfont }
+ }
+
+ def @InitSize
+ {
+ size @Test
+ iffixed { fixedsize }
+ ifvarying { varyingsize }
+ ifsymbol { symbolsize }
+ }
+
+ def @InitLine
+ {
+ line @Test
+ iffixed { fixedline }
+ ifvarying { varyingline }
+ ifsymbol { symbolline }
+ }
+
+ def @S # for formatting C strings
+ right x
+ {
+ "\"" &
+ strings @Test
+ iffixed { fixedstrings }
+ ifvarying { varyingstrings }
+ ifsymbol { symbolstrings }
+ @Font x
+ & "\""
+ }
+
+ def "`"
+ {
+ style @Case {
+ symbol @Yield { "`" }
+ else @Yield { "'" }
+ }
+ }
+
+ def @L # for formatting C character literals
+ right x
+ {
+ ` &
+ strings @Test
+ iffixed { fixedstrings }
+ ifvarying { varyingstrings }
+ ifsymbol { symbolstrings }
+ @Font x
+ & '
+ }
+
+ def @Ident # for formatting C identifiers
+ {
+ identifiers @Test
+ iffixed { fixedidentifiers }
+ ifvarying { varyingidentifiers }
+ ifsymbol { symbolidentifiers }
+ }
+
+ def @C # for formatting C comments
+ right x
+ {
+ comments @Test
+ iffixed { fixedcomments }
+ ifvarying { varyingcomments }
+ ifsymbol { symbolcomments }
+ @Font x
+ }
+
+ def @K # for formatting C keywords
+ right x
+ {
+ keywords @Test
+ iffixed { fixedkeywords }
+ ifvarying { varyingkeywords }
+ ifsymbol { symbolkeywords }
+ @Font x
+ }
+
+ def @N # for formatting C numbers
+ right x
+ {
+ numbers @Test
+ iffixed { fixednumbers }
+ ifvarying { varyingnumbers }
+ ifsymbol { symbolnumbers }
+ @Font x
+ }
+
+ def @O # for formatting C operators
+ right x
+ {
+ operators @Test
+ iffixed { fixedoperators }
+ ifvarying { varyingoperators }
+ ifsymbol { symboloperators }
+ @Font x
+ }
+
+ def @A # get characters from the Adobe Symbol font
+ left sym
+ right x
+ {
+ style @Case {
+ symbol @Yield { { Symbol Base } @Font @Char sym }
+ else @Yield { x }
+ }
+ }
+
+ macro "$>" { {} & }
+
+ def "$$" { "#" }
+
+ def "0" { @N "0" }
+ def "1" { @N "1" }
+ def "2" { @N "2" }
+ def "3" { @N "3" }
+ def "4" { @N "4" }
+ def "5" { @N "5" }
+ def "6" { @N "6" }
+ def "7" { @N "7" }
+ def "8" { @N "8" }
+ def "9" { @N "9" }
+
+ def "!" { @O "!" }
+ def "%" { @O "%" }
+ def "^" { @O "^" }
+ def "&" { @O "&" }
+ def "*" { asteriskmath @A @O "*" }
+ def "(" { @O "(" }
+ def ")" { @O ")" }
+ def "-" { minus @A @O "-" }
+ def "+" { plus @A @O "+" }
+ def "=" { equal @A @O "=" }
+ def "${" { @O "{" }
+ def "$}" { @O "}" }
+ def "|" { @O "|" }
+ def "~" { @O "~" }
+ def "[" { @O "[" }
+ def "]" { @O "]" }
+ def ";" { @O ";" }
+ def "'" { @O "'" }
+ def ":" { @O ":" }
+ def "<" { less @A @O "<" }
+ def ">" { greater @A @O ">" }
+ def "?" { @O "?" }
+ def "," { @O "," }
+ def "." { @O "." }
+ def "/" { @O "/" }
+ def "->" { arrowright @A @O "->" }
+ def "++" { { + }{ + } }
+ def "--" { { - }{ - } }
+ def ".*" { { . }{ * } }
+ def "->*" { { ->}{ * } }
+ def "<<" { { < }{ < } }
+ def ">>" { { > }{ > } }
+ def "<=" { lessequal @A @O "<=" }
+ def ">=" { greaterequal @A @O ">=" }
+ def "==" { { = }{ = } }
+ def "!=" { notequal @A @O "!=" }
+ def "&&" { { & }{ & } }
+ def "||" { { | }{ | } }
+ def "*=" { { * }{ = } }
+ def "/=" { { / }{ = } }
+ def "%=" { { % }{ = } }
+ def "+=" { { + }{ = } }
+ def "-=" { { - }{ = } }
+ def "<<=" { { <<}{ = } }
+ def ">>=" { { >>}{ = } }
+ def "&=" { { & }{ = } }
+ def "^=" { { ^ }{ = } }
+ def "|=" { { | }{ = } }
+ def "::" { { : }{ : } }
+
+ def asm { @K "asm" }
+ def auto { @K "auto" }
+ def break { @K "break" }
+ def case { @K "case" }
+ def catch { @K "catch" }
+ def char { @K "char" }
+ def class { @K "class" }
+ def const { @K "const" }
+
+ def continue { @K "continue" }
+ def default { @K "default" }
+ def delete { @K "delete" }
+ def do { @K "do" }
+ def double { @K "double" }
+ def else { @K "else" }
+ def enum { @K "enum" }
+ def extern { @K "extern" }
+
+ def float { @K "float" }
+ def for { @K "for" }
+ def friend { @K "friend" }
+ def goto { @K "goto" }
+ def if { @K "if" }
+ def inline { @K "inline" }
+ def int { @K "int" }
+ def long { @K "long" }
+
+ def new { @K "new" }
+ def operator { @K "operator" }
+ def private { @K "private" }
+ def protected { @K "protected" }
+ def public { @K "public" }
+ def register { @K "register" }
+ def return { @K "return" }
+ def short { @K "short" }
+
+ def signed { @K "signed" }
+ def sizeof { @K "sizeof" }
+ def static { @K "static" }
+ def struct { @K "struct" }
+ def switch { @K "switch" }
+ def template { @K "template" }
+ def this { @K "this" }
+ def throw { @K "throw" }
+
+ def try { @K "try" }
+ def typedef { @K "typedef" }
+ def union { @K "union" }
+ def unsigned { @K "unsigned" }
+ def virtual { @K "virtual" }
+ def void { @K "void" }
+ def volatile { @K "volatile" }
+ def while { @K "while" }
+
+ def @EvaluateCp right x
+ {
+ { @InitFontFamily Base } @Font
+ { @Ident @InitSize } @Font
+ { @InitLine lines } @Break x
+ }
+
+ { @InitFontFamily Base } @Font { @Ident @InitSize } @Font
+ { @InitLine lines } @Break @Body
+
+ @End @CP
+
+@End @CPSetup
diff --git a/include/diag b/include/diag
new file mode 100644
index 0000000..b4ffdb2
--- /dev/null
+++ b/include/diag
@@ -0,0 +1,193 @@
+###############################################################################
+# #
+# Lout setup file for diagram printing #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# The @SysInclude { diagf } line #
+# #
+# This line causes Lout to read the definitions for diagrams, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { diagf }
+
+
+###############################################################################
+# #
+# The @DiagSetup @Use clause #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @DiagSetup
+ # save { no }
+ # maxlabels { 200 }
+ # outline { box }
+ # margin { 0.6f }
+ # shadow { 0.4f }
+ # sides { 3 }
+ # angle { "dup 180 exch div" } # 180d / sides
+ # translate { }
+ # outlinestyle { solid }
+ # outlinedashlength { 0.2f }
+ # outlinewidth { 0.02f }
+ # paint { nopaint }
+ # font { }
+ # break { }
+ # format { @Body }
+ # valign { ctr }
+ # vsize { }
+ # vindent { ctr }
+ # vstrut { no }
+ # vmargin { }
+ # topmargin { }
+ # footmargin { }
+ # halign { ctr }
+ # hsize { }
+ # hindent { ctr }
+ # hstrut { no }
+ # hmargin { }
+ # leftmargin { }
+ # rightmargin { }
+ # nodelabel { }
+ # nodelabelmargin { 0.2f }
+ # nodelabelfont { "-2p" }
+ # nodelabelbreak { ragged nohyphen }
+ # nodelabelformat { @Body }
+ # nodelabelpos { }
+ # nodelabelprox { outside }
+ # nodelabelangle { horizontal }
+ # nodelabelctr { no }
+ # nodelabeladjust { 0 0 }
+ # alabel { }
+ # alabelmargin { }
+ # alabelfont { }
+ # alabelbreak { }
+ # alabelformat { }
+ # alabelpos { NE }
+ # alabelprox { }
+ # alabelangle { }
+ # alabelctr { }
+ # alabeladjust { }
+ # blabel { }
+ # blabelmargin { }
+ # blabelfont { }
+ # blabelbreak { }
+ # blabelformat { }
+ # blabelpos { NW }
+ # blabelprox { }
+ # blabelangle { }
+ # blabelctr { }
+ # blabeladjust { }
+ # clabel { }
+ # clabelmargin { }
+ # clabelfont { }
+ # clabelbreak { }
+ # clabelformat { }
+ # clabelpos { SW }
+ # clabelprox { }
+ # clabelangle { }
+ # clabelctr { }
+ # clabeladjust { }
+ # dlabel { }
+ # dlabelmargin { }
+ # dlabelfont { }
+ # dlabelbreak { }
+ # dlabelformat { }
+ # dlabelpos { SE }
+ # dlabelprox { }
+ # dlabelangle { }
+ # dlabelctr { }
+ # dlabeladjust { }
+ # path { line }
+ # from { 0, 0 }
+ # to { 1, 1 }
+ # bias { 2.0f }
+ # fbias { 2.0f }
+ # tbias { 2.0f }
+ # radius { 1.0f }
+ # xindent { 0.8f }
+ # zindent { 0.8f }
+ # pathstyle { solid }
+ # pathdashlength { 0.2f }
+ # pathwidth { 0.02f }
+ # pathgap { 0.04f }
+ # arrow { no }
+ # arrowstyle { solid }
+ # arrowwidth { 0.45f }
+ # arrowlength { 0.6f }
+ # linklabel { }
+ # linklabelmargin { 0.2f }
+ # linklabelfont { "-2p" }
+ # linklabelbreak { ragged nohyphen }
+ # linklabelformat { @Body }
+ # linklabelpos { }
+ # linklabelprox { above }
+ # linklabelangle { horizontal }
+ # linklabelctr { no }
+ # linklabeladjust { 0 0 }
+ # xlabel { }
+ # xlabelmargin { }
+ # xlabelfont { }
+ # xlabelbreak { }
+ # xlabelformat { }
+ # xlabelpos { LFROM }
+ # xlabelprox { }
+ # xlabelangle { }
+ # xlabelctr { }
+ # xlabeladjust { }
+ # ylabel { }
+ # ylabelmargin { }
+ # ylabelfont { }
+ # ylabelbreak { }
+ # ylabelformat { }
+ # ylabelpos { LMID }
+ # ylabelprox { }
+ # ylabelangle { }
+ # ylabelctr { yes }
+ # ylabeladjust { }
+ # zlabel { }
+ # zlabelmargin { }
+ # zlabelfont { }
+ # zlabelbreak { }
+ # zlabelformat { }
+ # zlabelpos { LTO }
+ # zlabelprox { }
+ # zlabelangle { }
+ # zlabelctr { }
+ # zlabeladjust { }
+ # fromlabel { }
+ # fromlabelmargin { 0f }
+ # fromlabelfont { "-2p" }
+ # fromlabelbreak { ragged nohyphen }
+ # fromlabelformat { @Body }
+ # fromlabelpos { FROM }
+ # fromlabelprox { E }
+ # fromlabelangle { antiparallel }
+ # fromlabelctr { no }
+ # fromlabeladjust { 0 0 }
+ # tolabel { }
+ # tolabelmargin { 0f }
+ # tolabelfont { "-2p" }
+ # tolabelbreak { ragged nohyphen }
+ # tolabelformat { @Body }
+ # tolabelpos { TO }
+ # tolabelprox { E }
+ # tolabelangle { parallel }
+ # tolabelctr { no }
+ # tolabeladjust { 0 0 }
+ # treehsep { 0.5f }
+ # treevsep { 0.5f }
+ # treehindent { ctr }
+ # treevindent { ctr }
+}
diff --git a/include/diagf b/include/diagf
new file mode 100644
index 0000000..18b888a
--- /dev/null
+++ b/include/diagf
@@ -0,0 +1,3845 @@
+
+###############################################################################
+# #
+# Lout @Diag package for drawing diagrams #
+# Version 1.0 (July 1996) #
+# Jeffrey H. Kingston #
+# #
+# Based on Version 2.0 of the @Fig package (Jeffrey H. Kingston, Dec 1992). #
+# #
+###############################################################################
+
+@SysPrependGraphic { diagf.lpg }
+@SysInclude { diagf.etc }
+
+export @Diag
+def @DiagSetup
+ named save { no }
+ named maxlabels { 200 }
+
+ import @Geometry named outline
+ named margin {}
+ named shadow {}
+ named sides {}
+ named angle {}
+ { box }
+ named margin { 0.6f }
+ import @Geometry named shadow { 0.4f }
+ import @Geometry named sides { 3 }
+ import @Geometry named angle { "dup 180 exch div" }
+ named translate { }
+ named outlinestyle
+ named solid { "/ldiagsolid" }
+ named dashed { "/ldiagdashed" }
+ named cdashed { "/ldiagcdashed" }
+ named dotted { "/ldiagdotted" }
+ named noline { "/ldiagnoline" }
+ { solid }
+ import @Geometry named outlinedashlength { 0.2f }
+ import @Geometry named outlinewidth
+ named thin { 0.04 ft }
+ named medium { 0.08 ft }
+ named thick { 0.12 ft }
+ { thin }
+ named paint { nopaint }
+ named font { }
+ named break { }
+ named format right @Body { @Body }
+
+ named valign { ctr }
+ named vsize { }
+ named vindent { ctr }
+ named vstrut
+ named no { 0.0f }
+ named yes { 1.0f }
+ { no }
+ named vmargin { }
+ named topmargin { }
+ named footmargin { }
+
+ named halign { ctr }
+ named hsize { }
+ named hindent { ctr }
+ named hstrut
+ named no { 0.0f }
+ named yes { 1.0f }
+ { no }
+ named hmargin { }
+ named leftmargin { }
+ named rightmargin { }
+
+ named nodelabel { }
+ named nodelabelmargin { 0.2f }
+ named nodelabelfont { -2p }
+ named nodelabelbreak { ragged nohyphen }
+ named nodelabelformat right @Body { @Body }
+ import @Geometry named nodelabelpos { }
+ named nodelabelprox { outside }
+ import @Geometry named nodelabelangle { horizontal }
+ named nodelabelctr { no }
+ import @Geometry named nodelabeladjust { 0 0 }
+
+ named alabel { }
+ named alabelmargin { }
+ named alabelfont { }
+ named alabelbreak { }
+ named alabelformat right @Body { }
+ import @Geometry named alabelpos { NE }
+ named alabelprox { }
+ import @Geometry named alabelangle { }
+ named alabelctr { }
+ import @Geometry named alabeladjust { }
+
+ named blabel { }
+ named blabelmargin { }
+ named blabelfont { }
+ named blabelbreak { }
+ named blabelformat right @Body { }
+ import @Geometry named blabelpos { NW }
+ named blabelprox { }
+ import @Geometry named blabelangle { }
+ named blabelctr { }
+ import @Geometry named blabeladjust { }
+
+ named clabel { }
+ named clabelmargin { }
+ named clabelfont { }
+ named clabelbreak { }
+ named clabelformat right @Body { }
+ import @Geometry named clabelpos { SW }
+ named clabelprox { }
+ import @Geometry named clabelangle { }
+ named clabelctr { }
+ import @Geometry named clabeladjust { }
+
+ named dlabel { }
+ named dlabelmargin { }
+ named dlabelfont { }
+ named dlabelbreak { }
+ named dlabelformat right @Body { }
+ import @Geometry named dlabelpos { SE }
+ named dlabelprox { }
+ import @Geometry named dlabelangle { }
+ named dlabelctr { }
+ import @Geometry named dlabeladjust { }
+
+ import @Geometry named path
+ named from {}
+ named to {}
+ named bias {}
+ named fbias {}
+ named tbias {}
+ named radius {}
+ named xindent {}
+ named zindent {}
+ named frompt {}
+ named topt {}
+ named arrow {}
+ named arrowlength {}
+ { line }
+ import @Geometry named from { 0,0 }
+ import @Geometry named to { 1,1 }
+ import @Geometry named bias { 2.0f }
+ import @Geometry named fbias { 2.0f }
+ import @Geometry named tbias { 2.0f }
+ import @Geometry named radius { 1.0f }
+ import @Geometry named xindent { 0.8f }
+ import @Geometry named zindent { 0.8f }
+ import @Geometry named frompt { 0 0 }
+ import @Geometry named topt { 0 0 }
+ named pathstyle
+ named solid { "/ldiagsolid" }
+ named dashed { "/ldiagdashed" }
+ named cdashed { "/ldiagcdashed" }
+ named dotted { "/ldiagdotted" }
+ named noline { "/ldiagnoline" }
+ { solid }
+ import @Geometry named pathdashlength { 0.2f }
+ import @Geometry named pathwidth
+ named thin { 0.04 ft }
+ named medium { 0.08 ft }
+ named thick { 0.12 ft }
+ { thin }
+ import @Geometry named pathgap
+ named thin { 0.08 ft }
+ named medium { 0.16 ft }
+ named thick { 0.24 ft }
+ { thin }
+ named arrow { no }
+ named arrowstyle { solid }
+ named arrowwidth { 0.3f }
+ named arrowlength { 0.5f }
+
+ named linklabel { }
+ named linklabelmargin { 0.2f }
+ named linklabelfont { -2p }
+ named linklabelbreak { ragged nohyphen }
+ named linklabelformat right @Body { @Body }
+ import @Geometry named linklabelpos { }
+ named linklabelprox { above }
+ import @Geometry named linklabelangle { horizontal }
+ named linklabelctr { no }
+ import @Geometry named linklabeladjust { 0 0 }
+
+ named xlabel { }
+ named xlabelmargin { }
+ named xlabelfont { }
+ named xlabelbreak { }
+ named xlabelformat right @Body { }
+ import @Geometry named xlabelpos { LFROM }
+ named xlabelprox { }
+ import @Geometry named xlabelangle { }
+ named xlabelctr { }
+ import @Geometry named xlabeladjust { }
+
+ named ylabel { }
+ named ylabelmargin { }
+ named ylabelfont { }
+ named ylabelbreak { }
+ named ylabelformat right @Body { }
+ import @Geometry named ylabelpos { LMID }
+ named ylabelprox { }
+ import @Geometry named ylabelangle { }
+ named ylabelctr { yes }
+ import @Geometry named ylabeladjust { }
+
+ named zlabel { }
+ named zlabelmargin { }
+ named zlabelfont { }
+ named zlabelbreak { }
+ named zlabelformat right @Body { }
+ import @Geometry named zlabelpos { LTO }
+ named zlabelprox { }
+ import @Geometry named zlabelangle { }
+ named zlabelctr { }
+ import @Geometry named zlabeladjust { }
+
+ named fromlabel { }
+ named fromlabelmargin { 0f }
+ named fromlabelfont { }
+ named fromlabelbreak { ragged nohyphen }
+ named fromlabelformat right @Body { @Body }
+ import @Geometry named fromlabelpos { FROM }
+ named fromlabelprox { W }
+ import @Geometry named fromlabelangle { antiparallel }
+ named fromlabelctr { no }
+ import @Geometry named fromlabeladjust { 0 0 }
+
+ named tolabel { }
+ named tolabelmargin { 0f }
+ named tolabelfont { }
+ named tolabelbreak { ragged nohyphen }
+ named tolabelformat right @Body { @Body }
+ import @Geometry named tolabelpos { TO }
+ named tolabelprox { W }
+ import @Geometry named tolabelangle { parallel }
+ named tolabelctr { no }
+ import @Geometry named tolabeladjust { 0 0 }
+
+ named treehsep { 0.5f }
+ named treevsep { 0.5f }
+ named treehindent
+ named left { 0.0rt }
+ named ctr { 0.5rt }
+ named right { 1.0rt }
+ { ctr }
+ named treevindent
+ named top { 0.0rt }
+ named ctr { 0.5rt }
+ named foot { 1.0rt }
+ { ctr }
+
+{
+
+ export "::" @ShowPoints @ShowTags @ShowDirections @CatchTags @Transform
+
+ @Tree @HTree
+
+ @Node
+ @Box @CurveBox @ShadowBox @Square @Diamond @Polygon
+ @Isosceles @Ellipse @Circle
+ @ArrowHead @SolidArrowHead @OpenArrowHead @HalfOpenArrowHead
+ @SolidCurvedArrowHead @OpenCurvedArrowHead @HalfOpenCurvedArrowHead
+ @CircleArrowHead @BoxArrowHead
+
+ @Link
+ @Line @DoubleLine @Arrow @DoubleArrow @Curve @CurveArrow
+ @ACurve @ACurveArrow @CCurve @CCurveArrow
+ @Bezier @BezierArrow
+ @HVLine @HVArrow @VHLine @VHArrow
+ @HVCurve @HVCurveArrow @VHCurve @VHCurveArrow
+ @LVRLine @LVRArrow @RVLLine @RVLArrow
+ @LVRCurve @LVRCurveArrow @RVLCurve @RVLCurveArrow
+ @DWrapLine @DWrapArrow @UWrapLine @UWrapArrow
+ @DWrapCurve @DWrapCurveArrow @UWrapCurve @UWrapCurveArrow
+
+ def @Diag
+ named save { save }
+ named maxlabels { maxlabels }
+
+ import @Geometry named outline
+ named margin {}
+ named shadow {}
+ named sides {}
+ named angle {}
+ { outline
+ margin { margin }
+ shadow { shadow }
+ sides { sides }
+ angle { angle }
+ }
+ named margin { margin }
+ import @Geometry named shadow { shadow }
+ import @Geometry named sides { sides }
+ import @Geometry named angle { angle }
+ named translate { translate }
+ named nodetag { }
+ named outlinestyle
+ named solid { "/ldiagsolid" }
+ named dashed { "/ldiagdashed" }
+ named cdashed { "/ldiagcdashed" }
+ named dotted { "/ldiagdotted" }
+ named noline { "/ldiagnoline" }
+ { outlinestyle }
+ import @Geometry named outlinedashlength{ outlinedashlength }
+ import @Geometry named outlinewidth
+ named thin { 0.04 ft }
+ named medium { 0.08 ft }
+ named thick { 0.12 ft }
+ { outlinewidth }
+ named paint { paint }
+ named font { font }
+ named break { break }
+ named format right @Body { format @Body }
+ named valign { valign }
+ named vsize { vsize }
+ named vindent { vindent }
+ named vstrut
+ named no { 0.0f }
+ named yes { 1.0f }
+ { vstrut }
+ named vmargin { vmargin }
+ named topmargin { topmargin }
+ named footmargin { footmargin }
+ named halign { halign }
+ named hsize { hsize }
+ named hindent { hindent }
+ named hstrut
+ named no { 0.0f }
+ named yes { 1.0f }
+ { hstrut }
+ named hmargin { hmargin }
+ named leftmargin { leftmargin }
+ named rightmargin { rightmargin }
+
+ import @Geometry named path
+ named from {}
+ named to {}
+ named bias {}
+ named fbias {}
+ named tbias {}
+ named radius {}
+ named xindent {}
+ named zindent {}
+ named frompt {}
+ named topt {}
+ named arrow {}
+ named arrowlength {}
+ { path
+ from { from }
+ to { to }
+ bias { bias }
+ fbias { fbias }
+ tbias { tbias }
+ radius { radius }
+ xindent { xindent }
+ zindent { zindent }
+ frompt { frompt }
+ topt { topt }
+ arrow { arrow }
+ arrowlength { arrowlength }
+ }
+ import @Geometry named from { from }
+ import @Geometry named to { to }
+ import @Geometry named bias { bias }
+ import @Geometry named fbias { fbias }
+ import @Geometry named tbias { tbias }
+ import @Geometry named radius { radius }
+ import @Geometry named xindent { xindent }
+ import @Geometry named zindent { zindent }
+ import @Geometry named frompt { frompt }
+ import @Geometry named topt { topt }
+ named pathstyle
+ named solid { "/ldiagsolid" }
+ named dashed { "/ldiagdashed" }
+ named cdashed { "/ldiagcdashed" }
+ named dotted { "/ldiagdotted" }
+ named noline { "/ldiagnoline" }
+ { pathstyle }
+ import @Geometry named pathdashlength { pathdashlength }
+ import @Geometry named pathwidth
+ named thin { 0.04 ft }
+ named medium { 0.08 ft }
+ named thick { 0.12 ft }
+ { pathwidth }
+ import @Geometry named pathgap
+ named thin { 0.08 ft }
+ named medium { 0.16 ft }
+ named thick { 0.24 ft }
+ { pathgap }
+ named arrow { arrow }
+ named arrowstyle { arrowstyle }
+ named arrowwidth { arrowwidth }
+ named arrowlength { arrowlength }
+
+ named nodelabel { nodelabel }
+ named nodelabelmargin { nodelabelmargin }
+ named nodelabelfont { nodelabelfont }
+ named nodelabelbreak { nodelabelbreak }
+ named nodelabelformat right @Body { nodelabelformat @Body }
+ import @Geometry named nodelabelpos { nodelabelpos }
+ named nodelabelprox { nodelabelprox }
+ import @Geometry named nodelabelangle { nodelabelangle }
+ named nodelabelctr { nodelabelctr }
+ import @Geometry named nodelabeladjust { nodelabeladjust }
+
+ named alabel { alabel }
+ named alabelmargin { alabelmargin }
+ named alabelfont { alabelfont }
+ named alabelbreak { alabelbreak }
+ named alabelformat right @Body { alabelformat @Body }
+ import @Geometry named alabelpos { alabelpos }
+ named alabelprox { alabelprox }
+ import @Geometry named alabelangle { alabelangle }
+ named alabelctr { alabelctr }
+ import @Geometry named alabeladjust { alabeladjust }
+
+ named blabel { blabel }
+ named blabelmargin { blabelmargin }
+ named blabelfont { blabelfont }
+ named blabelbreak { blabelbreak }
+ named blabelformat right @Body { blabelformat @Body }
+ import @Geometry named blabelpos { blabelpos }
+ named blabelprox { blabelprox }
+ import @Geometry named blabelangle { blabelangle }
+ named blabelctr { blabelctr }
+ import @Geometry named blabeladjust { blabeladjust }
+
+ named clabel { clabel }
+ named clabelmargin { clabelmargin }
+ named clabelfont { clabelfont }
+ named clabelbreak { clabelbreak }
+ named clabelformat right @Body { clabelformat @Body }
+ import @Geometry named clabelpos { clabelpos }
+ named clabelprox { clabelprox }
+ import @Geometry named clabelangle { clabelangle }
+ named clabelctr { clabelctr }
+ import @Geometry named clabeladjust { clabeladjust }
+
+ named dlabel { dlabel }
+ named dlabelmargin { dlabelmargin }
+ named dlabelfont { dlabelfont }
+ named dlabelbreak { dlabelbreak }
+ named dlabelformat right @Body { dlabelformat @Body }
+ import @Geometry named dlabelpos { dlabelpos }
+ named dlabelprox { dlabelprox }
+ import @Geometry named dlabelangle { dlabelangle }
+ named dlabelctr { dlabelctr }
+ import @Geometry named dlabeladjust { dlabeladjust }
+
+ named fromlabel { fromlabel }
+ named fromlabelmargin { fromlabelmargin }
+ named fromlabelfont { fromlabelfont }
+ named fromlabelbreak { fromlabelbreak }
+ named fromlabelformat right @Body { fromlabelformat @Body }
+ import @Geometry named fromlabelpos { fromlabelpos }
+ named fromlabelprox { fromlabelprox }
+ import @Geometry named fromlabelangle { fromlabelangle }
+ named fromlabelctr { fromlabelctr }
+ import @Geometry named fromlabeladjust { fromlabeladjust }
+
+ named linklabel { linklabel }
+ named linklabelmargin { linklabelmargin }
+ named linklabelfont { linklabelfont }
+ named linklabelbreak { linklabelbreak }
+ named linklabelformat right @Body { linklabelformat @Body }
+ import @Geometry named linklabelpos { linklabelpos }
+ named linklabelprox { linklabelprox }
+ import @Geometry named linklabelangle { linklabelangle }
+ named linklabelctr { linklabelctr }
+ import @Geometry named linklabeladjust { linklabeladjust }
+
+ named xlabel { xlabel }
+ named xlabelmargin { xlabelmargin }
+ named xlabelfont { xlabelfont }
+ named xlabelbreak { xlabelbreak }
+ named xlabelformat right @Body { xlabelformat @Body }
+ import @Geometry named xlabelpos { xlabelpos }
+ named xlabelprox { xlabelprox }
+ import @Geometry named xlabelangle { xlabelangle }
+ named xlabelctr { xlabelctr }
+ import @Geometry named xlabeladjust { xlabeladjust }
+
+ named ylabel { ylabel }
+ named ylabelmargin { ylabelmargin }
+ named ylabelfont { ylabelfont }
+ named ylabelbreak { ylabelbreak }
+ named ylabelformat right @Body { ylabelformat @Body }
+ import @Geometry named ylabelpos { ylabelpos }
+ named ylabelprox { ylabelprox }
+ import @Geometry named ylabelangle { ylabelangle }
+ named ylabelctr { ylabelctr }
+ import @Geometry named ylabeladjust { ylabeladjust }
+
+ named zlabel { zlabel }
+ named zlabelmargin { zlabelmargin }
+ named zlabelfont { zlabelfont }
+ named zlabelbreak { zlabelbreak }
+ named zlabelformat right @Body { zlabelformat @Body }
+ import @Geometry named zlabelpos { zlabelpos }
+ named zlabelprox { zlabelprox }
+ import @Geometry named zlabelangle { zlabelangle }
+ named zlabelctr { zlabelctr }
+ import @Geometry named zlabeladjust { zlabeladjust }
+
+ named tolabel { tolabel }
+ named tolabelmargin { tolabelmargin }
+ named tolabelfont { tolabelfont }
+ named tolabelbreak { tolabelbreak }
+ named tolabelformat right @Body { tolabelformat @Body }
+ import @Geometry named tolabelpos { tolabelpos }
+ named tolabelprox { tolabelprox }
+ import @Geometry named tolabelangle { tolabelangle }
+ named tolabelctr { tolabelctr }
+ import @Geometry named tolabeladjust { tolabeladjust }
+
+ named treehsep { treehsep }
+ named treevsep { treevsep }
+ named treehindent
+ named left { 0.0rt }
+ named ctr { 0.5rt }
+ named right { 1.0rt }
+ { treehindent }
+ named treevindent
+ named top { 0.0rt }
+ named ctr { 0.5rt }
+ named foot { 1.0rt }
+ { treevindent }
+ body @Body
+ @Begin
+
+ # Like @Graphic, but affects the graphics state of right parameter
+ def @InnerGraphic
+ left ps
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ { ps gsave // grestore } @Graphic x
+ }
+ PDF @Yield {
+ { ps q // Q } @Graphic x
+ }
+ }
+ }
+
+ def @BoxLabels right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "[ ldiagbox ] pop" @Graphic x
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @IfNonEmpty
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield @Null
+ else @Yield y
+ }
+ }
+
+ def @Else
+ precedence 20
+ associativity right
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield y
+ else @Yield x
+ }
+ }
+
+ def @ShowTags
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {
+ "() ldiagpushtagdict"
+ // "ldiagshowtags ldiagpopuptagdict"
+ } @Graphic x
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @ShowPoints
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {
+ "() ldiagpushtagdict"
+ // "ldiagshowpoints ldiagpopuptagdict"
+ } @Graphic x
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @ShowDirections
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "() ldiagpushtagdict"
+ // "ldiagshowangles ldiagpopuptagdict" } @Graphic x
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def "::"
+ precedence 33
+ associativity right
+ left name
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "("name") ldiagpushtagdict"
+ // "ldiagpopuptagdict" } @Graphic x
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @CatchTags
+ precedence 33
+ associativity right
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {
+ "() ldiagpushtagdict"
+ // "ldiagpoptagdict"
+ }
+ @Graphic x
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @ZeroWidth right x
+ {
+ @HContract @VContract {
+ ^|0io @HContract @VContract x |0io
+ }
+ }
+
+ def @ZeroSize right x
+ {
+ @HContract @VContract {
+ ^/0io ^|0io @HContract @VContract x |0io /0io
+ }
+ }
+
+ def @FromArrowLength
+ left arrow
+ right arrowlength
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ arrow @Case {
+ { no yes forward } @Yield 0
+ { back both } @Yield {"("arrowlength") ldiagdecodelength"}
+ }
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @ToArrowLength
+ left arrow
+ right arrowlength
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ arrow @Case {
+ { no back } @Yield 0
+ { yes forward both } @Yield {"("arrowlength") ldiagdecodelength"}
+ }
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @AddMargins
+ named mtop {}
+ named mfoot {}
+ named mleft {}
+ named mright {}
+ right x
+ {
+
+ @HContract @VContract {
+ ^|mleft |mright
+ ^/mtop | x |
+ /mfoot | |
+ }
+ }
+
+ def @Transform
+ precedence 32
+ import @Geometry named translate
+# named to precedence 10 left x right y { x y "ldiagpsub" }
+ named to precedence 10 left x right y {
+ @BackEnd @Case {
+ PostScript @Yield { x y "ldiagpsub" }
+ PDF @Yield {""}
+ }
+ }
+ {}
+ import @Geometry named rotate { 0d }
+ named scale { 1 1 }
+ right x
+ {
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ { rotate "rotate" scale "scale newpath clip" }
+ @InnerGraphic
+ {
+ @ZeroSize x
+ }
+ //
+ # { rotate "rotate" scale "scale" translate "translate" }
+ { translate "translate" rotate "rotate" scale "scale" }
+ @InnerGraphic
+ {
+ @ZeroSize x
+ }
+ }
+
+ PDF @Yield { # presume that "rotate", "scale" and "translate" are not matrices
+ { "__cos("rotate") __sin("rotate") __sub(0, __sin("rotate")) __cos("rotate") 0 0 cm"
+ "__pick(1, "scale") 0 0 __pick(2, "scale") 0 0 cm n W" }
+ @InnerGraphic
+ {
+ @ZeroSize x
+ }
+ //
+ # { rotate "rotate" scale "scale" translate "translate" }
+ { "1 0 0 1 "translate" cm"
+ "__cos("rotate") __sin("rotate") __sub(0, __sin("rotate")) __cos("rotate") 0 0 cm"
+ "__pick(1, "scale") 0 0 __pick(2, "scale") 0 0 cm" }
+ @InnerGraphic
+ {
+ @ZeroSize x
+ }
+ }
+
+ }
+ }
+
+ def @DoLabel
+ named which {}
+ named labeltag { LABEL }
+ named label {}
+ named labelmargin {}
+ named labelfont {}
+ named labelbreak {}
+ named labelformat right @Body {}
+ named labelpos {}
+ named labelprox {}
+ named labelangle {}
+ named labelctr {}
+ named labeladjust {}
+ {
+
+ import @Geometry
+ def alignedangle
+ {
+ labelpos??"ANGLE" quadcase
+ 0 { labelpos??"ANGLE" }
+ 0-90 { labelpos??"ANGLE" }
+ 90 { labelpos??"ANGLE" }
+ 90-180 { labelpos??"ANGLE" + 180d }
+ 180 { labelpos??"ANGLE" + 180d }
+ 180-270 { labelpos??"ANGLE" + 180d }
+ 270 { labelpos??"ANGLE" + 180d }
+ 270-360 { labelpos??"ANGLE" }
+ }
+
+ import @Geometry
+ def perpalignedangle
+ {
+ labelpos??"ANGLE" quadcase
+ 0 { labelpos??"ANGLE" - 90d }
+ 0-90 { labelpos??"ANGLE" - 90d }
+ 90 { labelpos??"ANGLE" - 90d }
+ 90-180 { labelpos??"ANGLE" - 90d }
+ 180 { labelpos??"ANGLE" + 90d }
+ 180-270 { labelpos??"ANGLE" + 90d }
+ 270 { labelpos??"ANGLE" + 90d }
+ 270-360 { labelpos??"ANGLE" + 90d }
+
+ }
+
+ import @Geometry
+ def finalangle
+ {
+ labelangle @Case {
+
+ "horizontal" @Yield { 0d }
+ "aligned" @Yield { alignedangle }
+ "perpendicular" @Yield { perpalignedangle }
+ "parallel" @Yield { labelpos??"ANGLE" }
+ "antiparallel" @Yield { labelpos??"ANGLE" + 180d }
+ else @Yield labelangle
+ }
+ }
+
+ import @Geometry
+ def @AlignedAboveProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SW) }
+ 90 { (SW) }
+ 90-180 { (SE) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (SE) }
+ 270-360 { (SW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (SE) }
+ 90-180 { (SW) }
+ 180 { (SW) }
+ 180-270 { (SW) }
+ 270 { (SW) }
+ 270-360 { (SE) }
+ }
+ else @Yield (S)
+ }
+ }
+
+ import @Geometry
+ def @AlignedBelowProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (NW) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (NE) }
+ 180 { (NE) }
+ 180-270 { (NE) }
+ 270 { (NE) }
+ 270-360 { (NW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NE) }
+ 0-90 { (NE) }
+ 90 { (NE) }
+ 90-180 { (NW) }
+ 180 { (NW) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (NE) }
+ }
+ else @Yield (N)
+ }
+ }
+
+ import @Geometry
+ def @AlignedLeftProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SW) }
+ 90 { (SW) }
+ 90-180 { (NE) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (SE) }
+ 270-360 { (NW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (SE) }
+ 90-180 { (NW) }
+ 180 { (SW) }
+ 180-270 { (SW) }
+ 270 { (SW) }
+ 270-360 { (NE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (S) }
+ 0-90 { (S) }
+ 90 { (S) }
+ 90-180 { (N) }
+ 180 { (S) }
+ 180-270 { (S) }
+ 270 { (S) }
+ 270-360 { (N) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @AlignedRightProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (SE) }
+ 180 { (SE) }
+ 180-270 { (NE) }
+ 270 { (NE) }
+ 270-360 { (SW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (NE) }
+ 90 { (NE) }
+ 90-180 { (SW) }
+ 180 { (SW) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (SE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (S) }
+ 0-90 { (N) }
+ 90 { (N) }
+ 90-180 { (S) }
+ 180 { (S) }
+ 180-270 { (N) }
+ 270 { (N) }
+ 270-360 { (S) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @AlignedInsideProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SW) }
+ 90 { (SW) }
+ 90-180 { (NE) }
+ 180 { (NE) }
+ 180-270 { (NE) }
+ 270 { (NE) }
+ 270-360 { (SW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (SE) }
+ 90-180 { (NW) }
+ 180 { (NW) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (SE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (S) }
+ 0-90 { (S) }
+ 90 { (S) }
+ 90-180 { (N) }
+ 180 { (N) }
+ 180-270 { (N) }
+ 270 { (N) }
+ 270-360 { (S) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @AlignedOutsideProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (NW) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (SE) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (SE) }
+ 270-360 { (NW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NE) }
+ 0-90 { (NE) }
+ 90 { (NE) }
+ 90-180 { (SW) }
+ 180 { (SW) }
+ 180-270 { (SW) }
+ 270 { (SW) }
+ 270-360 { (NE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (N) }
+ 0-90 { (N) }
+ 90 { (N) }
+ 90-180 { (S) }
+ 180 { (S) }
+ 180-270 { (S) }
+ 270 { (S) }
+ 270-360 { (N) }
+ }
+ }
+ }
+
+
+ import @Geometry
+ def @PerpendicularAboveProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (SE) }
+ 90-180 { (SW) }
+ 180 { (NE) }
+ 180-270 { (NE) }
+ 270 { (NE) }
+ 270-360 { (NW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NE) }
+ 0-90 { (NE) }
+ 90 { (NE) }
+ 90-180 { (NW) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (SE) }
+ 270-360 { (SW) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (E) }
+ 0-90 { (E) }
+ 90 { (E) }
+ 90-180 { (W) }
+ 180 { (E) }
+ 180-270 { (E) }
+ 270 { (E) }
+ 270-360 { (W) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @PerpendicularBelowProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SW) }
+ 90 { (SW) }
+ 90-180 { (SE) }
+ 180 { (NW) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (NE) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NW) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (NE) }
+ 180 { (SW) }
+ 180-270 { (SW) }
+ 270 { (SW) }
+ 270-360 { (SE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (W) }
+ 0-90 { (W) }
+ 90 { (W) }
+ 90-180 { (E) }
+ 180 { (W) }
+ 180-270 { (W) }
+ 270 { (W) }
+ 270-360 { (E) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @PerpendicularLeftProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (SE) }
+ 90-180 { (SE) }
+ 180 { (NE) }
+ 180-270 { (NE) }
+ 270 { (NE) }
+ 270-360 { (NE) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NE) }
+ 0-90 { (NE) }
+ 90 { (NE) }
+ 90-180 { (NE) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (SE) }
+ 270-360 { (SE) }
+ }
+ else @Yield (E)
+ }
+ }
+
+ import @Geometry
+ def @PerpendicularRightProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SW) }
+ 90 { (SW) }
+ 90-180 { (SW) }
+ 180 { (NW) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (NW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NW) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (NW) }
+ 180 { (SW) }
+ 180-270 { (SW) }
+ 270 { (SW) }
+ 270-360 { (SW) }
+ }
+ else @Yield (W)
+ }
+ }
+
+ import @Geometry
+ def @PerpendicularInsideProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (SE) }
+ 90-180 { (SE) }
+ 180 { (NW) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (NW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NE) }
+ 0-90 { (NE) }
+ 90 { (NE) }
+ 90-180 { (NE) }
+ 180 { (SW) }
+ 180-270 { (SW) }
+ 270 { (SW) }
+ 270-360 { (SW) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (E) }
+ 0-90 { (E) }
+ 90 { (E) }
+ 90-180 { (E) }
+ 180 { (W) }
+ 180-270 { (W) }
+ 270 { (W) }
+ 270-360 { (W) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @PerpendicularOutsideProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SW) }
+ 90 { (SW) }
+ 90-180 { (SW) }
+ 180 { (NE) }
+ 180-270 { (NE) }
+ 270 { (NE) }
+ 270-360 { (NE) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NW) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (NW) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (SE) }
+ 270-360 { (SE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (W) }
+ 0-90 { (W) }
+ 90 { (W) }
+ 90-180 { (W) }
+ 180 { (E) }
+ 180-270 { (E) }
+ 270 { (E) }
+ 270-360 { (E) }
+ }
+ }
+ }
+
+
+ import @Geometry
+ def @OtherAboveProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SE) }
+ 90 { (SW) }
+ 90-180 { (SW) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (NW) }
+ 270-360 { (SW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (NW) }
+ 90-180 { (SW) }
+ 180 { (SW) }
+ 180-270 { (SE) }
+ 270 { (SW) }
+ 270-360 { (SW) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (S) }
+ 0-90 { (SE) }
+ 90 { (W) }
+ 90-180 { (SW) }
+ 180 { (S) }
+ 180-270 { (SE) }
+ 270 { (W) }
+ 270-360 { (SW) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @OtherBelowProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (NW) }
+ 0-90 { (NW) }
+ 90 { (SW) }
+ 90-180 { (NE) }
+ 180 { (NE) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (NE) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NE) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (NE) }
+ 180 { (NW) }
+ 180-270 { (NW) }
+ 270 { (SW) }
+ 270-360 { (NE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (N) }
+ 0-90 { (NW) }
+ 90 { (W) }
+ 90-180 { (NE) }
+ 180 { (N) }
+ 180-270 { (NW) }
+ 270 { (W) }
+ 270-360 { (NE) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @OtherLeftProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SE) }
+ 90 { (SE) }
+ 90-180 { (NE) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (NE) }
+ 270-360 { (NE) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (NE) }
+ 90-180 { (NE) }
+ 180 { (SW) }
+ 180-270 { (SE) }
+ 270 { (SE) }
+ 270-360 { (NE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (S) }
+ 0-90 { (SE) }
+ 90 { (E) }
+ 90-180 { (NE) }
+ 180 { (S) }
+ 180-270 { (SE) }
+ 270 { (E) }
+ 270-360 { (NE) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @OtherRightProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (NW) }
+ 90 { (SW) }
+ 90-180 { (SW) }
+ 180 { (SE) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (SW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (SW) }
+ 180 { (SW) }
+ 180-270 { (NW) }
+ 270 { (SW) }
+ 270-360 { (SW) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (S) }
+ 0-90 { (NW) }
+ 90 { (W) }
+ 90-180 { (SW) }
+ 180 { (S) }
+ 180-270 { (NW) }
+ 270 { (W) }
+ 270-360 { (SW) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @OtherInsideProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (SW) }
+ 0-90 { (SE) }
+ 90 { (SE) }
+ 90-180 { (NE) }
+ 180 { (NE) }
+ 180-270 { (NW) }
+ 270 { (NW) }
+ 270-360 { (SW) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (SE) }
+ 0-90 { (SE) }
+ 90 { (NE) }
+ 90-180 { (NE) }
+ 180 { (NW) }
+ 180-270 { (NW) }
+ 270 { (SW) }
+ 270-360 { (SW) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (S) }
+ 0-90 { (SE) }
+ 90 { (E) }
+ 90-180 { (NE) }
+ 180 { (N) }
+ 180-270 { (NW) }
+ 270 { (W) }
+ 270-360 { (SW) }
+ }
+ }
+ }
+
+ import @Geometry
+ def @OtherOutsideProximity
+ {
+ which @Case {
+ { x f } @Yield { labelpos??ANGLE quadcase
+ 0 { (NW) }
+ 0-90 { (NW) }
+ 90 { (SW) }
+ 90-180 { (SW) }
+ 180 { (SE) }
+ 180-270 { (SE) }
+ 270 { (NE) }
+ 270-360 { (NE) }
+ }
+ { z t } @Yield { labelpos??ANGLE quadcase
+ 0 { (NE) }
+ 0-90 { (NW) }
+ 90 { (NW) }
+ 90-180 { (SW) }
+ 180 { (SW) }
+ 180-270 { (SE) }
+ 270 { (SE) }
+ 270-360 { (NE) }
+ }
+ else @Yield { labelpos??ANGLE quadcase
+ 0 { (N) }
+ 0-90 { (NW) }
+ 90 { (W) }
+ 90-180 { (SW) }
+ 180 { (S) }
+ 180-270 { (SE) }
+ 270 { (E) }
+ 270-360 { (NE) }
+ }
+ }
+ }
+
+
+ import @Geometry
+ def @AboveProximity
+ {
+ labelangle @Case {
+ "aligned" @Yield @AlignedAboveProximity
+ "perpendicular" @Yield @PerpendicularAboveProximity
+ else @Yield @OtherAboveProximity
+ }
+ }
+
+ import @Geometry
+ def @BelowProximity
+ {
+ labelangle @Case {
+ "aligned" @Yield @AlignedBelowProximity
+ "perpendicular" @Yield @PerpendicularBelowProximity
+ else @Yield @OtherBelowProximity
+ }
+ }
+
+ import @Geometry
+ def @LeftProximity
+ {
+ labelangle @Case {
+ "aligned" @Yield @AlignedLeftProximity
+ "perpendicular" @Yield @PerpendicularLeftProximity
+ else @Yield @OtherLeftProximity
+ }
+ }
+
+ import @Geometry
+ def @RightProximity
+ {
+ labelangle @Case {
+ "aligned" @Yield @AlignedRightProximity
+ "perpendicular" @Yield @PerpendicularRightProximity
+ else @Yield @OtherRightProximity
+ }
+ }
+
+ import @Geometry
+ def @InsideProximity
+ {
+ labelangle @Case {
+ "aligned" @Yield @AlignedInsideProximity
+ "perpendicular" @Yield @PerpendicularInsideProximity
+ else @Yield @OtherInsideProximity
+ }
+ }
+
+ import @Geometry
+ def @OutsideProximity
+ {
+ labelangle @Case {
+ "aligned" @Yield @AlignedOutsideProximity
+ "perpendicular" @Yield @PerpendicularOutsideProximity
+ else @Yield @OtherOutsideProximity
+ }
+ }
+
+ import @Geometry
+ def proximity
+ {
+ labelprox @Case {
+ above @Yield @AboveProximity
+ below @Yield @BelowProximity
+ left @Yield @LeftProximity
+ right @Yield @RightProximity
+ inside @Yield @InsideProximity
+ outside @Yield @OutsideProximity
+ else @Yield { "("labelprox")" }
+ }
+ }
+
+ import @Geometry
+ def dorotate
+ left point
+ right angle
+ {
+ { {0 0} distance point } atangle { {0 0} angleto point + angle }
+ }
+
+ import @Geometry
+ def translation
+ {
+ labelctr @Case {
+ { no No } @Yield {
+ labelpos -- labeltag?!?proximity
+ }
+ { yes Yes } @Yield {
+ #P0 := labelpos
+ #P1 := labeltag?!?proximity -- P0
+ #P2 := labeltag??CTR -- P0
+ #TH := labelpos??ANGLE
+ #P1A := P1 dorotate { 0 - TH }
+ #P2A := P2 dorotate { 0 - TH }
+ #PRA := { 0 - xcoord P2A 0 - ycoord P1A }
+ #PRA dorotate TH ++ P0
+ XP1 := labeltag?!?proximity
+ XP2 := labeltag??CTR
+ XANG := labelpos??ANGLE
+ XTH := XANG - 90d - { XP1 angleto XP2 }
+ XDIST := { XP1 distance XP2 } * sin XTH
+ labelpos -- XP1 ++ XDIST atangle XANG
+ }
+ }
+ }
+
+ @CatchTags @ZeroSize @Transform
+ translate { translation ++ labeladjust }
+ rotate { finalangle }
+ scale { 1 1 }
+ labeltag:: @BoxLabels @CatchTags @AddMargins
+ mtop { labelmargin }
+ mfoot { labelmargin }
+ mleft { labelmargin }
+ mright { labelmargin }
+ labelfont @Font labelbreak @Break labelformat label
+ }
+
+
+ def @Node
+ import @Geometry named translate
+# named to precedence 10 left x right y { x y "ldiagpsub" }
+ named to precedence 10 left x right y {
+ @BackEnd @Case {
+ PostScript @Yield { x y "ldiagpsub" }
+ PDF @Yield {""}
+ }
+ }
+ {}
+ import @Geometry named rotate { 0d }
+ import @Geometry named outline
+ named margin {}
+ named shadow {}
+ named sides {}
+ named angle {}
+ { outline
+ margin { margin }
+ shadow { shadow }
+ sides { sides }
+ angle { angle }
+ }
+ named margin { margin }
+ import @Geometry named shadow { shadow }
+ import @Geometry named sides { sides }
+ import @Geometry named angle { angle }
+ named nodetag { nodetag }
+ named outlinestyle
+ named solid { "/ldiagsolid" }
+ named dashed { "/ldiagdashed" }
+ named cdashed { "/ldiagcdashed" }
+ named dotted { "/ldiagdotted" }
+ named noline { "/ldiagnoline" }
+ { outlinestyle }
+ import @Geometry named outlinedashlength { outlinedashlength}
+ import @Geometry named outlinewidth
+ named thin { 0.04 ft }
+ named medium { 0.08 ft }
+ named thick { 0.12 ft }
+ { outlinewidth }
+ named paint { paint }
+ named font { font }
+ named break { break }
+ named format right @Body { format @Body }
+ named valign { valign }
+ named vsize { vsize }
+ named vindent { vindent }
+ named vstrut
+ named no { 0.0f }
+ named yes { 1.0f }
+ { vstrut }
+ named vmargin { vmargin }
+ named topmargin { topmargin }
+ named footmargin { footmargin }
+
+ named halign { halign }
+ named hsize { hsize }
+ named hindent { hindent }
+ named hstrut
+ named no { 0.0f }
+ named yes { 1.0f }
+ { hstrut }
+ named hmargin { hmargin }
+ named leftmargin { leftmargin }
+ named rightmargin { rightmargin }
+
+ named nodelabel { nodelabel }
+ named nodelabelmargin { nodelabelmargin }
+ named nodelabelfont { nodelabelfont }
+ named nodelabelbreak { nodelabelbreak }
+ named nodelabelformat right @Body { nodelabelformat @Body }
+ import @Geometry named nodelabelpos { nodelabelpos }
+ named nodelabelprox { nodelabelprox }
+ import @Geometry named nodelabelangle { nodelabelangle }
+ named nodelabelctr { nodelabelctr }
+ import @Geometry named nodelabeladjust { nodelabeladjust }
+
+ named alabel { alabel }
+ named alabelmargin { alabelmargin }
+ named alabelfont { alabelfont }
+ named alabelbreak { alabelbreak }
+ named alabelformat right @Body { alabelformat @Body }
+ import @Geometry named alabelpos { alabelpos }
+ named alabelprox { alabelprox }
+ import @Geometry named alabelangle { alabelangle }
+ named alabelctr { alabelctr }
+ import @Geometry named alabeladjust { alabeladjust }
+
+ named blabel { blabel }
+ named blabelmargin { blabelmargin }
+ named blabelfont { blabelfont }
+ named blabelbreak { blabelbreak }
+ named blabelformat right @Body { blabelformat @Body }
+ import @Geometry named blabelpos { blabelpos }
+ named blabelprox { blabelprox }
+ import @Geometry named blabelangle { blabelangle }
+ named blabelctr { blabelctr }
+ import @Geometry named blabeladjust { blabeladjust }
+
+ named clabel { clabel }
+ named clabelmargin { clabelmargin }
+ named clabelfont { clabelfont }
+ named clabelbreak { clabelbreak }
+ named clabelformat right @Body { clabelformat @Body }
+ import @Geometry named clabelpos { clabelpos }
+ named clabelprox { clabelprox }
+ import @Geometry named clabelangle { clabelangle }
+ named clabelctr { clabelctr }
+ import @Geometry named clabeladjust { clabeladjust }
+
+ named dlabel { dlabel }
+ named dlabelmargin { dlabelmargin }
+ named dlabelfont { dlabelfont }
+ named dlabelbreak { dlabelbreak }
+ named dlabelformat right @Body { dlabelformat @Body }
+ import @Geometry named dlabelpos { dlabelpos }
+ named dlabelprox { dlabelprox }
+ import @Geometry named dlabelangle { dlabelangle }
+ named dlabelctr { dlabelctr }
+ import @Geometry named dlabeladjust { dlabeladjust }
+
+ right @Body
+ {
+
+ def @LabelPos
+ left x
+ right y
+ {
+ nodelabelpos @Case {
+ x @Yield y
+ else @Yield ""
+ }
+ }
+
+ def @If
+ left cond
+ right x
+ {
+ cond @Case {
+ { yes Yes } @Yield x
+ else @Yield ""
+ }
+ }
+
+
+ def @Strut right x
+ {
+ def vs { 0.5w @VShift { vstrut @High } }
+ def hs { hstrut @Wide }
+
+ @HContract @VContract {
+ @HContract @VContract x | vs / hs |
+ }
+ }
+
+ def @Indent right x
+ {
+ x @Case {
+ { top left } @Yield 0.0rt
+ { ctr } @Yield 0.5rt
+ { foot right } @Yield 1.0rt
+ { mctr } @Yield 0.5bx
+ else @Yield x
+ }
+ }
+
+ def @VSize right x
+ {
+ vsize @Case {
+ "" @Yield x
+ else @Yield { vsize @High { /{@Indent vindent} x / } }
+ }
+ }
+
+ def @HSize right x
+ {
+ hsize @Case {
+ "" @Yield x
+ else @Yield { hsize @Wide { |{@Indent hindent} x | } }
+ }
+ }
+
+ def @Align right x
+ {
+ x @Case {
+ { top left } @Yield 0.0w
+ { ctr } @Yield 0.5w
+ { foot right } @Yield 1.0w
+ { mark } @Yield "+0i"
+ else @Yield x
+ }
+ }
+
+ def @ALabel
+ {
+ @DoLabel
+ which { "a" }
+ label { alabel @Else nodelabel }
+ labelmargin { alabelmargin @Else nodelabelmargin }
+ labelfont { alabelfont @Else nodelabelfont }
+ labelbreak { alabelbreak @Else nodelabelbreak }
+ labelformat { alabelformat @Body @Else nodelabelformat @Body}
+ labelpos { alabelpos @Else nodelabelpos }
+ labelprox { alabelprox @Else nodelabelprox }
+ labelangle { alabelangle @Else nodelabelangle }
+ labelctr { alabelctr @Else nodelabelctr }
+ labeladjust { alabeladjust @Else nodelabeladjust }
+ }
+
+ def @BLabel
+ {
+ @DoLabel
+ which { "b" }
+ label { blabel @Else nodelabel }
+ labelmargin { blabelmargin @Else nodelabelmargin }
+ labelfont { blabelfont @Else nodelabelfont }
+ labelbreak { blabelbreak @Else nodelabelbreak }
+ labelformat { blabelformat @Body @Else nodelabelformat @Body}
+ labelpos { blabelpos @Else nodelabelpos }
+ labelprox { blabelprox @Else nodelabelprox }
+ labelangle { blabelangle @Else nodelabelangle }
+ labelctr { blabelctr @Else nodelabelctr }
+ labeladjust { blabeladjust @Else nodelabeladjust }
+ }
+
+ def @CLabel
+ {
+ @DoLabel
+ which { "c" }
+ label { clabel @Else nodelabel }
+ labelmargin { clabelmargin @Else nodelabelmargin }
+ labelfont { clabelfont @Else nodelabelfont }
+ labelbreak { clabelbreak @Else nodelabelbreak }
+ labelformat { clabelformat @Body @Else nodelabelformat @Body}
+ labelpos { clabelpos @Else nodelabelpos }
+ labelprox { clabelprox @Else nodelabelprox }
+ labelangle { clabelangle @Else nodelabelangle }
+ labelctr { clabelctr @Else nodelabelctr }
+ labeladjust { clabeladjust @Else nodelabeladjust }
+ }
+
+ def @DLabel
+ {
+ @DoLabel
+ which { "d" }
+ label { dlabel @Else nodelabel }
+ labelmargin { dlabelmargin @Else nodelabelmargin }
+ labelfont { dlabelfont @Else nodelabelfont }
+ labelbreak { dlabelbreak @Else nodelabelbreak }
+ labelformat { dlabelformat @Body @Else nodelabelformat @Body}
+ labelpos { dlabelpos @Else nodelabelpos }
+ labelprox { dlabelprox @Else nodelabelprox }
+ labelangle { dlabelangle @Else nodelabelangle }
+ labelctr { dlabelctr @Else nodelabelctr }
+ labeladjust { dlabeladjust @Else nodelabeladjust }
+ }
+
+ import @Geometry
+ def @OutLine
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ outline @Case {
+ box @Yield { "ldiagbox" }
+ curvebox @Yield { "("margin") ldiagcurvebox" }
+ shadowbox @Yield { shadow "ldiagshadow ldiagbox" }
+ square @Yield { "ldiagsquare" }
+ diamond @Yield { "ldiagdiamond" }
+ polygon @Yield { sides angle "ldiagpolygon" }
+ isosceles @Yield { "ldiagisosceles" }
+ ellipse @Yield { "ldiagellipse" }
+ circle @Yield { "ldiagcircle" }
+ else @Yield {
+ outline
+ margin { "("margin") ldiagdecodelength" }
+ shadow { shadow }
+ sides { sides }
+ angle { angle }
+ }
+ }
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @Value
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ @HContract @VContract
+ {
+ {
+ "ldiagnodebegin [" @OutLine "]"
+ outlinedashlength "[" outlinestyle "]"
+ outlinewidth "/ldiag"paint "ldiagnodeend"
+ "(IN) ldiagpushtagdict"
+ //
+ "ldiagpopuptagdict"
+ }
+ @Graphic
+ {
+ {@Align valign} @VShift {@Align halign} @HShift
+ @AddMargins
+ mtop { topmargin @Else vmargin @Else margin }
+ mfoot { footmargin @Else vmargin @Else margin }
+ mleft { leftmargin @Else hmargin @Else margin }
+ mright { rightmargin @Else hmargin @Else margin }
+ @HSize @VSize @HContract @VContract
+ font @Font break @Break format @Strut @Body
+ }
+ / {alabel @Else nodelabel} @IfNonEmpty @ALabel
+ / {blabel @Else nodelabel} @IfNonEmpty @BLabel
+ / {clabel @Else nodelabel} @IfNonEmpty @CLabel
+ / {dlabel @Else nodelabel} @IfNonEmpty @DLabel
+ }
+ }
+ PDF @Yield {}
+ }
+ }
+
+ def @TValue
+ {
+ nodetag @Case {
+ "" @Yield @Value
+ else @Yield { nodetag:: @Value }
+ }
+ }
+
+ translate @Case {
+ "" @Yield @TValue
+ else @Yield {
+ @Null & # so that preceding space gets chewed up
+ @Transform translate { translate } rotate { rotate } @TValue
+ }
+ }
+ }
+
+ macro @@Node { @Node }
+ macro @Box { @Node outline { box } }
+ macro @CurveBox { @Node outline { curvebox } }
+ macro @ShadowBox { @Node outline { shadowbox } }
+ macro @Square { @Node outline { square } }
+ macro @Diamond { @Node outline { diamond } }
+ macro @Polygon { @Node outline { polygon } }
+ macro @Isosceles { @Node outline { isosceles } }
+ macro @Ellipse { @Node outline { ellipse } }
+ macro @Circle { @Node outline { circle } }
+
+
+ macro @InsulatedNode {
+ @Node
+ topmargin { 0i }
+ footmargin { 0i }
+ leftmargin { 0i }
+ rightmargin { 0i }
+ alabel {}
+ blabel {}
+ clabel {}
+ dlabel {}
+ hsize {}
+ vsize {}
+ vstrut { no }
+ hstrut { no }
+ }
+
+ def @SolidArrowHead
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ @InsulatedNode
+ paint { nochange }
+ outlinestyle { noline }
+ outlinewidth { pathwidth }
+ outline {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "ldiagsolidarrowhead"
+ # 0 0 xsize ysize * 0.5 0 ysize
+ }
+ PDF @Yield {}
+ }
+ }
+ {
+ length @Wide width @High
+ }
+ }
+
+ def @OpenArrowHead
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ @InsulatedNode
+ outlinewidth { pathwidth }
+ outlinestyle { noline }
+ paint { nochange }
+ outline {
+ @BackEnd @Case {
+ PostScript @Yield {
+ pathwidth "ldiagopenarrowhead"
+
+ # PSW := { 0 0 }
+ # PNW := { 0 ysize }
+ # PE := { xsize ysize*0.5 }
+ # REL := pathwidth atangle { PE angleto PNW + 90d }
+ # PNA := { 0 ysize*0.5 + pathwidth*0.5 }
+ # PSA := { 0 ysize*0.5 - pathwidth*0.5 }
+ # PNI := {
+ # PNA PNA ++ { xsize 0 }
+ # PNW ++ REL PE ++ REL ldiaglineintersect
+ # }
+ # PSI := PNI -- { 0 pathwidth }
+ #
+ # PSW PE PNW PNI PNA PSA PSI PSW
+ }
+ PDF @Yield {}
+ }
+ }
+ {
+ length @Wide width @High
+ }
+ }
+
+ def @HalfOpenArrowHead
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ @InsulatedNode
+ paint { nochange }
+ outlinestyle { noline }
+ outlinewidth { pathwidth }
+ outline {
+ @BackEnd @Case {
+ PostScript @Yield {
+ pathwidth "ldiaghalfopenarrowhead"
+
+ # 0 0
+ # xsize ysize * 0.5
+ # 0 ysize
+ # xsize*0.3 ysize*0.5 + pathwidth*0.5
+ # 0 ysize*0.5 + pathwidth*0.5
+ # 0 ysize*0.5 - pathwidth*0.5
+ # xsize*0.3 ysize*0.5 - pathwidth*0.5
+ # 0 0
+ }
+ PDF @Yield {}
+ }
+ }
+ {
+ length @Wide width @High
+ }
+ }
+
+ def @SolidCurvedArrowHead
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ @InsulatedNode
+ outlinestyle { noline }
+ paint { nochange }
+ outlinewidth { pathwidth }
+ outline {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "ldiagsolidcurvedarrowhead"
+ # 0 0
+ # [0 0 xsize ysize * 0.5 "ldiaglinebetween"
+ # xsize 0 xsize ysize "ldiaglineintersect" clockwise]
+ # xsize ysize * 0.5
+ # [xsize ysize * 0.5 0 ysize "ldiaglinebetween"
+ # xsize 0 xsize ysize "ldiaglineintersect" clockwise]
+ # 0 ysize
+ }
+ PDF @Yield {}
+ }
+ }
+ {
+ length @Wide width @High
+ }
+ }
+
+ def @OpenCurvedArrowHead
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ @InsulatedNode
+ outlinestyle { noline }
+ paint { nochange }
+ outlinewidth { pathwidth }
+ outline {
+ @BackEnd @Case {
+ PostScript @Yield {
+ pathwidth "ldiagopencurvedarrowhead"
+ # LR:= { 0 0 xsize ysize * 0.5 "ldiaglinebetween"
+ # xsize 0 xsize ysize "ldiaglineintersect" }
+ # UR:= { xsize ysize * 0.5 0 ysize "ldiaglinebetween"
+ # xsize 0 xsize ysize "ldiaglineintersect" }
+ # PW2 := pathwidth * 0.5
+ # UMID := {
+ # 0 ysize * 0.5 + PW2 xsize ysize * 0.5 + PW2
+ # {0 ysize} ++ 1f atangle { UR angleto {0 ysize} + 90d }
+ # { 0 ysize } ldiaglineintersect
+ # }
+ # LMID := UMID -- { 0 pathwidth }
+ # 0 0
+ # [LR clockwise]
+ # xsize ysize * 0.5
+ # [UR clockwise]
+ # 0 ysize
+ # UMID
+ # 0 ysize * 0.5 + PW2
+ # 0 ysize * 0.5 - PW2
+ # LMID
+ # 0 0
+ }
+ PDF @Yield {}
+ }
+ }
+ {
+ length @Wide width @High
+ }
+ }
+
+ def @HalfOpenCurvedArrowHead
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ @InsulatedNode
+ outlinestyle { noline }
+ paint { nochange }
+ outlinewidth { pathwidth }
+ outline {
+ @BackEnd @Case {
+ PostScript @Yield {
+ pathwidth "ldiaghalfopencurvedarrowhead"
+ # LR:= { 0 0 xsize ysize * 0.5 "ldiaglinebetween"
+ # xsize 0 xsize ysize "ldiaglineintersect" }
+ # UR:= { xsize ysize * 0.5 0 ysize "ldiaglinebetween"
+ # xsize 0 xsize ysize "ldiaglineintersect" }
+ # BR:= { 0 0 LR 0 ysize UR "ldiaglineintersect" }
+ # BRAD := { 0 0 } distance BR
+ # PW2 := pathwidth * 0.5
+ # XDIST := sqrt { BRAD*BRAD - PW2*PW2 }
+ # UMID := BR ++ { XDIST PW2 }
+ # LMID := BR ++ { XDIST 0 - PW2 }
+ # 0 0
+ # [LR clockwise]
+ # xsize ysize * 0.5
+ # [UR clockwise]
+ # 0 ysize
+ # [BR clockwise ]
+ # UMID
+ # 0 ysize * 0.5 + PW2
+ # 0 ysize * 0.5 - PW2
+ # LMID
+ # [BR clockwise ]
+ # 0 0
+ }
+ PDF @Yield {}
+ }
+ }
+ {
+ length @Wide width @High
+ }
+ }
+
+ def @CircleArrowHead
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ @InsulatedNode
+ outlinestyle { noline }
+ paint { nochange }
+ outlinewidth { pathwidth }
+ outline { circle }
+ { length @Wide length @High }
+ }
+
+ def @BoxArrowHead
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ @InsulatedNode
+ outlinestyle { noline }
+ paint { nochange }
+ outlinewidth { pathwidth }
+ outline { box }
+ { length @Wide width @High }
+ }
+
+ def @ArrowHead
+ named style { arrowstyle }
+ named width { arrowwidth }
+ named length { arrowlength }
+ named pathwidth { pathwidth }
+ {
+ style @Case {
+ solid @Yield @SolidArrowHead
+ width { width } length { length }
+ pathwidth { pathwidth }
+ halfopen @Yield @HalfOpenArrowHead
+ width { width } length { length }
+ pathwidth { pathwidth }
+ open @Yield @OpenArrowHead
+ width { width } length { length }
+ pathwidth { pathwidth }
+ curvedsolid @Yield @SolidCurvedArrowHead
+ width { width } length { length }
+ pathwidth { pathwidth }
+ curvedhalfopen @Yield @HalfOpenCurvedArrowHead
+ width { width } length { length }
+ pathwidth { pathwidth }
+ curvedopen @Yield @OpenCurvedArrowHead
+ width { width } length { length }
+ pathwidth { pathwidth }
+ circle @Yield @CircleArrowHead
+ width { width } length { length }
+ pathwidth { pathwidth }
+ box @Yield @BoxArrowHead
+ width { width } length { length }
+ pathwidth { pathwidth }
+ }
+ }
+
+ def @Link
+ import @Geometry named path
+ named from {}
+ named to {}
+ named bias {}
+ named fbias {}
+ named tbias {}
+ named radius {}
+ named xindent {}
+ named zindent {}
+ named frompt {}
+ named topt {}
+ named arrow {}
+ named arrowlength {}
+ { path
+ from { from }
+ to { to }
+ bias { bias }
+ fbias { fbias }
+ tbias { tbias }
+ radius { radius }
+ xindent { xindent }
+ zindent { zindent }
+ frompt { frompt }
+ topt { topt }
+ arrow { arrow }
+ arrowlength { arrowlength }
+ }
+ import @Geometry named from { from }
+ import @Geometry named to { to }
+ import @Geometry named bias { bias }
+ import @Geometry named fbias { fbias }
+ import @Geometry named tbias { tbias }
+ import @Geometry named radius { radius }
+ import @Geometry named xindent { xindent }
+ import @Geometry named zindent { zindent }
+ import @Geometry named frompt { frompt }
+ import @Geometry named topt { topt }
+ named pathstyle
+ named solid { "/ldiagsolid" }
+ named dashed { "/ldiagdashed" }
+ named cdashed { "/ldiagcdashed" }
+ named dotted { "/ldiagdotted" }
+ named noline { "/ldiagnoline" }
+ { pathstyle }
+ import @Geometry named pathdashlength { pathdashlength }
+ import @Geometry named pathwidth
+ named thin { 0.04 ft }
+ named medium { 0.08 ft }
+ named thick { 0.12 ft }
+ { pathwidth }
+ import @Geometry named pathgap
+ named thin { 0.08 ft }
+ named medium { 0.16 ft }
+ named thick { 0.24 ft }
+ { pathgap }
+
+ named arrow { arrow }
+ named arrowstyle { arrowstyle }
+ named arrowwidth { arrowwidth }
+ named arrowlength { arrowlength }
+
+ named linklabel { linklabel }
+ named linklabelmargin { linklabelmargin }
+ named linklabelfont { linklabelfont }
+ named linklabelbreak { linklabelbreak }
+ named linklabelformat right @Body { linklabelformat @Body }
+ import @Geometry named linklabelpos { linklabelpos }
+ named linklabelprox { linklabelprox }
+ import @Geometry named linklabelangle { linklabelangle }
+ named linklabelctr { linklabelctr }
+ import @Geometry named linklabeladjust { linklabeladjust }
+
+ named xlabel { xlabel }
+ named xlabelmargin { xlabelmargin }
+ named xlabelfont { xlabelfont }
+ named xlabelbreak { xlabelbreak }
+ named xlabelformat right @Body { xlabelformat @Body }
+ import @Geometry named xlabelpos { xlabelpos }
+ named xlabelprox { xlabelprox }
+ import @Geometry named xlabelangle { xlabelangle }
+ named xlabelctr { xlabelctr }
+ import @Geometry named xlabeladjust { xlabeladjust }
+
+ named ylabel { ylabel }
+ named ylabelmargin { ylabelmargin }
+ named ylabelfont { ylabelfont }
+ named ylabelbreak { ylabelbreak }
+ named ylabelformat right @Body { ylabelformat @Body }
+ import @Geometry named ylabelpos { ylabelpos }
+ named ylabelprox { ylabelprox }
+ import @Geometry named ylabelangle { ylabelangle }
+ named ylabelctr { ylabelctr }
+ import @Geometry named ylabeladjust { ylabeladjust }
+
+ named zlabel { zlabel }
+ named zlabelmargin { zlabelmargin }
+ named zlabelfont { zlabelfont }
+ named zlabelbreak { zlabelbreak }
+ named zlabelformat right @Body { zlabelformat @Body }
+ import @Geometry named zlabelpos { zlabelpos }
+ named zlabelprox { zlabelprox }
+ import @Geometry named zlabelangle { zlabelangle }
+ named zlabelctr { zlabelctr }
+ import @Geometry named zlabeladjust { zlabeladjust }
+
+ named fromlabel { fromlabel }
+ named fromlabelmargin { fromlabelmargin }
+ named fromlabelfont { fromlabelfont }
+ named fromlabelbreak { fromlabelbreak }
+ named fromlabelformat right @Body { fromlabelformat @Body }
+ import @Geometry named fromlabelpos { fromlabelpos }
+ named fromlabelprox { fromlabelprox }
+ import @Geometry named fromlabelangle { fromlabelangle }
+ named fromlabelctr { fromlabelctr }
+ import @Geometry named fromlabeladjust { fromlabeladjust }
+
+ named tolabel { tolabel }
+ named tolabelmargin { tolabelmargin }
+ named tolabelfont { tolabelfont }
+ named tolabelbreak { tolabelbreak }
+ named tolabelformat right @Body { tolabelformat @Body }
+ import @Geometry named tolabelpos { tolabelpos }
+ named tolabelprox { tolabelprox }
+ import @Geometry named tolabelangle { tolabelangle }
+ named tolabelctr { tolabelctr }
+ import @Geometry named tolabeladjust{ tolabeladjust }
+
+ {
+ def @XLabel
+ {
+ @DoLabel
+ which { "x" }
+ label { xlabel @Else linklabel }
+ labelmargin { xlabelmargin @Else linklabelmargin }
+ labelfont { xlabelfont @Else linklabelfont }
+ labelbreak { xlabelbreak @Else linklabelbreak }
+ labelformat { xlabelformat @Body @Else linklabelformat @Body}
+ labelpos { xlabelpos @Else linklabelpos }
+ labelprox { xlabelprox @Else linklabelprox }
+ labelangle { xlabelangle @Else linklabelangle }
+ labelctr { xlabelctr @Else linklabelctr }
+ labeladjust { xlabeladjust @Else linklabeladjust }
+ }
+
+ def @YLabel
+ {
+ @DoLabel
+ which { "y" }
+ label { ylabel @Else linklabel }
+ labelmargin { ylabelmargin @Else linklabelmargin }
+ labelfont { ylabelfont @Else linklabelfont }
+ labelbreak { ylabelbreak @Else linklabelbreak }
+ labelformat { ylabelformat @Body @Else linklabelformat @Body}
+ labelpos { ylabelpos @Else linklabelpos }
+ labelprox { ylabelprox @Else linklabelprox }
+ labelangle { ylabelangle @Else linklabelangle }
+ labelctr { ylabelctr @Else linklabelctr }
+ labeladjust { ylabeladjust @Else linklabeladjust }
+ }
+
+ def @ZLabel
+ {
+ @DoLabel
+ which { "z" }
+ label { zlabel @Else linklabel }
+ labelmargin { zlabelmargin @Else linklabelmargin }
+ labelfont { zlabelfont @Else linklabelfont }
+ labelbreak { zlabelbreak @Else linklabelbreak }
+ labelformat { zlabelformat @Body @Else linklabelformat @Body}
+ labelpos { zlabelpos @Else linklabelpos }
+ labelprox { zlabelprox @Else linklabelprox }
+ labelangle { zlabelangle @Else linklabelangle }
+ labelctr { zlabelctr @Else linklabelctr }
+ labeladjust { zlabeladjust @Else linklabeladjust }
+ }
+
+ def @FromArrow
+ {
+ arrow @Case {
+ { back both } @Yield {
+ @ArrowHead
+ style { arrowstyle }
+ width { arrowwidth }
+ length { arrowlength }
+ pathwidth { pathwidth }
+ }
+ else @Yield ""
+ }
+ }
+
+ def @ToArrow
+ {
+ arrow @Case {
+ { yes forward both } @Yield {
+ @ArrowHead
+ style { arrowstyle }
+ width { arrowwidth }
+ length { arrowlength }
+ pathwidth { pathwidth }
+ }
+ else @Yield ""
+ }
+ }
+
+ import @Geometry
+ def @LinePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent "ldiaglinepath"
+ # FROM :< {from??CTR angleto to??CTR}
+ # FROM :: from boundaryatangle FROM@ANGLE
+ # ++ {arrow @FromArrowLength arrowlength}atangle FROM@ANGLE
+ # TO :< FROM@ANGLE
+ # TO :: to boundaryatangle { TO@ANGLE - 180d }
+ # ++ {arrow @ToArrowLength arrowlength} atangle {TO@ANGLE - 180d}
+ #
+ # LMID :: FROM ** 0.5 ++ TO ** 0.5
+ # LMID :< FROM@ANGLE
+ # XINDENT := xindent min { FROM distance LMID }
+ # LFROM :: FROM ++ XINDENT atangle FROM@ANGLE
+ # LFROM :< FROM@ANGLE
+ # ZINDENT := zindent min { TO distance LMID }
+ # LTO :: TO -- ZINDENT atangle FROM@ANGLE
+ # LTO :< FROM@ANGLE
+ #
+ # if cond { direct }
+ # then { FROM TO }
+ # else { FROM LFROM LMID LTO TO }
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @DoubleLinePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent pathgap "ldiagdoublelinepath"
+ # FROM :< {from??CTR angleto to??CTR}
+ # FROM :: from boundaryatangle FROM@ANGLE
+ # ++ {arrow @FromArrowLength arrowlength}atangle FROM@ANGLE
+ # TO :< FROM@ANGLE
+ # TO :: to boundaryatangle { TO@ANGLE - 180d }
+ # ++ {arrow @ToArrowLength arrowlength} atangle {TO@ANGLE - 180d}
+ #
+ # LMID :: FROM ** 0.5 ++ TO ** 0.5
+ # LMID :< FROM@ANGLE
+ # XINDENT := xindent min { FROM distance LMID }
+ # LFROM :: FROM ++ XINDENT atangle FROM@ANGLE
+ # LFROM :< FROM@ANGLE
+ # ZINDENT := zindent min { TO distance LMID }
+ # LTO :: TO -- ZINDENT atangle FROM@ANGLE
+ # LTO :< FROM@ANGLE
+ #
+ # if cond { direct }
+ # then { FROM TO }
+ # else { FROM LFROM LMID LTO TO }
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @ACurvePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias "ldiagacurvepath"
+ # #B1 := bias max 0.02f
+ # #B2 := { from??CTR distance to??CTR } * 0.5
+ # #BIAS := B1 min B2
+ # BIAS := bias max 0.02f
+ # XMID := from??CTR ** 0.5 ++ to??CTR ** 0.5
+ # XTOP := XMID ++ BIAS atangle {from??CTR angleto to??CTR - 90d}
+ # CTR := { from??CTR XTOP ldiaglinebetween
+ # to??CTR XTOP ldiaglinebetween ldiaglineintersect }
+ # FROM :: aabout
+ # circum { from }
+ # extra { arrow @FromArrowLength arrowlength }
+ # centre { CTR }
+ # FROM :< if cond { from??CTR distance FROM > 0 }
+ # then { from??CTR angleto FROM }
+ # else { CTR angleto FROM + 90d }
+ # TO :: cabout
+ # circum { to }
+ # extra { arrow @ToArrowLength arrowlength }
+ # centre { CTR }
+ # TO :< if cond { TO distance to??CTR > 0 }
+ # then { TO angleto to??CTR }
+ # else { CTR angleto TO + 90d }
+ #
+ # RADIUS := CTR distance FROM
+ # LMID :: CTR ++ RADIUS atangle {
+ # CTR angleto FROM +
+ # { {360d + {CTR angleto TO} - {CTR angleto FROM}} mod 360 } / 2
+ # }
+ # LMID :< CTR angleto LMID + 90d
+ #
+ # XINDENT := xindent min { FROM distance LMID }
+ # LFROM :: CTR ++ RADIUS atangle {
+ # CTR angleto { FROM ++ XINDENT atangle FROM@ANGLE } }
+ # LFROM :< CTR angleto LFROM + 90d
+ # ZINDENT := zindent min { TO distance LMID }
+ # LTO :: CTR ++ RADIUS atangle {
+ # CTR angleto { TO ++ ZINDENT atangle {TO@ANGLE+180d}}}
+ # LTO :< CTR angleto LTO + 90d
+ #
+ # if cond { direct }
+ # then { FROM [CTR] TO }
+ # else { FROM [CTR] LFROM [CTR] LMID [CTR] LTO [CTR] TO }
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @CCurvePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias "ldiagccurvepath"
+ # #B1 := bias max 0.02f
+ # #B2 := { from??CTR distance to??CTR } * 0.5
+ # #BIAS := B1 min B2
+ # BIAS := bias max 0.02f
+ # XMID := from??CTR ** 0.5 ++ to??CTR ** 0.5
+ # XTOP := XMID ++ BIAS atangle {from??CTR angleto to??CTR + 90d}
+ # CTR := { from??CTR XTOP ldiaglinebetween
+ # to??CTR XTOP ldiaglinebetween ldiaglineintersect }
+ # FROM :: cabout
+ # circum { from }
+ # extra { arrow @FromArrowLength arrowlength }
+ # centre { CTR }
+ # FROM :< if cond { from??CTR distance FROM > 0 }
+ # then { from??CTR angleto FROM }
+ # else { CTR angleto FROM - 90d }
+ # TO :: aabout
+ # circum { to }
+ # extra { arrow @ToArrowLength arrowlength }
+ # centre { CTR }
+ # TO :< if cond { TO distance to??CTR > 0 }
+ # then { TO angleto to??CTR }
+ # else { CTR angleto TO - 90d }
+ #
+ # RADIUS := CTR distance FROM
+ # LMID :: CTR ++ RADIUS atangle {
+ # CTR angleto TO +
+ # { {360d + {CTR angleto FROM} - {CTR angleto TO} } mod 360 } / 2
+ # }
+ # LMID :< CTR angleto LMID - 90d
+ #
+ # XINDENT := xindent min { FROM distance LMID }
+ # LFROM :: CTR ++ RADIUS atangle {
+ # CTR angleto { FROM ++ XINDENT atangle FROM@ANGLE } }
+ # LFROM :< CTR angleto LFROM - 90d
+ # ZINDENT := zindent min { TO distance LMID }
+ # LTO :: CTR ++ RADIUS atangle {
+ # CTR angleto { TO ++ ZINDENT atangle {TO@ANGLE+180d}}}
+ # LTO :< CTR angleto LTO - 90d
+ #
+ # if cond { direct }
+ # then { FROM [CTR clockwise] TO }
+ # else { FROM [CTR clockwise] LFROM [CTR clockwise]
+ # LMID [CTR clockwise] LTO [CTR clockwise] TO }
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @BezierPath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent [ frompt ] [ topt ] "ldiagbezierpath"
+ # FROM :< from??CTR angleto frompt
+ # FROM :: from boundaryatangle FROM@ANGLE
+ # ++ {arrow @FromArrowLength arrowlength} atangle FROM@ANGLE
+ # TO :< topt angleto to??CTR
+ # TO :: to boundaryatangle { TO@ANGLE + 180d }
+ # ++ {arrow @ToArrowLength arrowlength} atangle { TO@ANGLE + 180d }
+ # LFROM :: FROM ++ { xindent atangle FROM@ANGLE }
+ # LFROM :< FROM@ANGLE
+ # LTO :: TO ++ zindent atangle { TO@ANGLE + 180d }
+ # LTO :< TO@ANGLE
+ # LMID :: { FROM ++ TO ++ frompt ++ topt } ** 0.25
+ # FROM [frompt topt] TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @VHLinePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent "ldiagvhlinepath"
+ # CTR := { {xcoord from??CTR} {ycoord to??CTR} }
+ # FANG := from??CTR angleto CTR
+ # TANG := to??CTR angleto CTR
+ # FROM :: from boundaryatangle FANG
+ # ++ {arrow @FromArrowLength arrowlength} atangle FANG
+ # FROM :< FANG
+ # TO :: to boundaryatangle TANG
+ # ++ {arrow @ToArrowLength arrowlength} atangle TANG
+ # TO :< TANG + 180d
+ # FDIST := FROM distance CTR
+ # TDIST := TO distance CTR
+ # XINDENT := xindent min FDIST
+ # ZINDENT := zindent min TDIST
+ # LFROM :: FROM ++ XINDENT atangle FANG
+ # LFROM :< FROM@ANGLE
+ # LTO :: TO ++ ZINDENT atangle TANG
+ # LTO :< TO@ANGLE
+ # LMID :: CTR
+ # LMID :< {1f atangle {FANG + 180d}} angleto
+ # {1f atangle {TANG + 180d}}
+ # FROM LFROM LMID LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @VHCurvePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent radius "ldiagvhcurvepath"
+ # CTR := { {xcoord from??CTR} {ycoord to??CTR} }
+ # FANG := from??CTR angleto CTR
+ # TANG := to??CTR angleto CTR
+ # FROM :: from boundaryatangle FANG
+ # ++ {arrow @FromArrowLength arrowlength} atangle FANG
+ # FROM :< FANG
+ # TO :: to boundaryatangle TANG
+ # ++ {arrow @ToArrowLength arrowlength} atangle TANG
+ # TO :< TANG + 180d
+ # FDIST := FROM distance CTR
+ # TDIST := TO distance CTR
+ # RADIUS := radius min FDIST min TDIST
+ # XINDENT := xindent min { FDIST - RADIUS }
+ # ZINDENT := zindent min { TDIST - RADIUS }
+ # LFROM :: FROM ++ XINDENT atangle FANG
+ # LFROM :< FROM@ANGLE
+ # LTO :: TO ++ ZINDENT atangle TANG
+ # LTO :< TO@ANGLE
+ # FCTR := CTR ++ RADIUS atangle { FROM@ANGLE + 180d }
+ # TCTR := CTR ++ RADIUS atangle { TO@ANGLE }
+ # XCTR := CTR ++ RADIUS atangle { FROM@ANGLE + 180d }
+ # ++ RADIUS atangle { TO@ANGLE }
+ # LMID :: XCTR ++ RADIUS atangle { XCTR angleto CTR }
+ # LMID :< FCTR angleto TCTR
+ # FROM LFROM FCTR
+ # { FCTR angleto TCTR } quadcase
+ # 0 { }
+ # 0-90 { [XCTR clockwise] }
+ # 90 { }
+ # 90-180 { [XCTR] }
+ # 180 { }
+ # 180-270 { [XCTR clockwise] }
+ # 270 { }
+ # 270-360 { [XCTR] }
+ # TCTR LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @HVLinePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent "ldiaghvlinepath"
+ # CTR := { {xcoord to??CTR} {ycoord from??CTR} }
+ # FANG := from??CTR angleto CTR
+ # TANG := to??CTR angleto CTR
+ # FROM :: from boundaryatangle FANG
+ # ++ {arrow @FromArrowLength arrowlength} atangle FANG
+ # FROM :< FANG
+ # TO :: to boundaryatangle TANG
+ # ++ {arrow @ToArrowLength arrowlength} atangle TANG
+ # TO :< TANG + 180d
+ # FDIST := FROM distance CTR
+ # TDIST := TO distance CTR
+ # XINDENT := xindent min FDIST
+ # ZINDENT := zindent min TDIST
+ # LFROM :: FROM ++ XINDENT atangle FANG
+ # LFROM :< FROM@ANGLE
+ # LTO :: TO ++ ZINDENT atangle TANG
+ # LTO :< TO@ANGLE
+ # LMID :: CTR
+ # LMID :< {1f atangle {FANG + 180d}} angleto
+ # {1f atangle {TANG + 180d}}
+ # FROM LFROM LMID LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @HVCurvePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent radius "ldiaghvcurvepath"
+ # CTR := { {xcoord to??CTR} {ycoord from??CTR} }
+ # FANG := from??CTR angleto CTR
+ # TANG := to??CTR angleto CTR
+ # FROM :: from boundaryatangle FANG
+ # ++ {arrow @FromArrowLength arrowlength} atangle FANG
+ # FROM :< FANG
+ # TO :: to boundaryatangle TANG
+ # ++ {arrow @ToArrowLength arrowlength} atangle TANG
+ # TO :< TANG + 180d
+ # FDIST := FROM distance CTR
+ # TDIST := TO distance CTR
+ # RADIUS := radius min FDIST min TDIST
+ # XINDENT := xindent min { FDIST - RADIUS }
+ # ZINDENT := zindent min { TDIST - RADIUS }
+ # LFROM :: FROM ++ XINDENT atangle FANG
+ # LFROM :< FROM@ANGLE
+ # LTO :: TO ++ ZINDENT atangle TANG
+ # LTO :< TO@ANGLE
+ # FCTR := CTR ++ RADIUS atangle { FROM@ANGLE + 180d }
+ # TCTR := CTR ++ RADIUS atangle { TO@ANGLE }
+ # XCTR := CTR ++ RADIUS atangle { FROM@ANGLE + 180d }
+ # ++ RADIUS atangle { TO@ANGLE }
+ # LMID :: XCTR ++ RADIUS atangle { XCTR angleto CTR }
+ # LMID :< FCTR angleto TCTR
+ # FROM LFROM FCTR
+ # { FCTR angleto TCTR } quadcase
+ # 0 { }
+ # 0-90 { [XCTR] }
+ # 90 { }
+ # 90-180 { [XCTR clockwise] }
+ # 180 { }
+ # 180-270 { [XCTR] }
+ # 270 { }
+ # 270-360 { [XCTR clockwise] }
+ # TCTR LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @LVRLinePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias "ldiaglvrlinepath"
+ # FROM :: from boundaryatangle 180d
+ # ++ {arrow @FromArrowLength arrowlength} atangle 180d
+ # FROM :< 180d
+ # TO :: to boundaryatangle 180d
+ # ++ {arrow @ToArrowLength arrowlength} atangle 180d
+ # TO :< 0d
+ # XLEFT := {{xcoord FROM} min {xcoord TO}} - bias
+ # P1 :: { XLEFT ycoord FROM }
+ # P2 :: { XLEFT ycoord TO }
+ # VERT := P1 angleto P2
+ # P1 :< P1 angleto {P1++{1f atangle 180d}++{1f atangle VERT}}
+ # P2 :< P2 angleto {P2++{1f atangle 0d} ++{1f atangle VERT}}
+ # LMID :: P1 ** 0.5 ++ P2 ** 0.5
+ # LMID :< VERT
+ # XINDENT := xindent min {FROM distance P1}
+ # ZINDENT := zindent min {P2 distance TO}
+ # LFROM :: FROM -- { XINDENT 0 }
+ # LFROM :< 180d
+ # LTO :: TO -- { ZINDENT 0 }
+ # LTO :< 0d
+ # FROM LFROM P1 LMID P2 LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @LVRCurvePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias radius "ldiaglvrcurvepath"
+ # FROM :: from boundaryatangle 180d
+ # ++ {arrow @FromArrowLength arrowlength} atangle 180d
+ # FROM :< 180d
+ # TO :: to boundaryatangle 180d
+ # ++ {arrow @ToArrowLength arrowlength} atangle 180d
+ # TO :< 0d
+ # XLEFT := {{xcoord FROM} min {xcoord TO}} - bias
+ # XP1 := { XLEFT ycoord FROM }
+ # XP2 := { XLEFT ycoord TO }
+ # VERT := XP1 angleto XP2
+ # LMID :: XP1 ** 0.5 ++ XP2 ** 0.5
+ # LMID :< VERT
+ # XINDENT := xindent min {FROM distance XP1}
+ # ZINDENT := zindent min {XP2 distance TO}
+ # LFROM :: FROM -- { XINDENT 0 }
+ # LFROM :< 180d
+ # LTO :: TO -- { ZINDENT 0 }
+ # LTO :< 0d
+ # RADIUS := radius min { { XP1 distance XP2 } / 2 }
+ # XP1PRE := XP1 ++ { RADIUS atangle 0d }
+ # XP1POST := XP1 ++ { RADIUS atangle VERT }
+ # XP1CTR := XP1PRE ++ { RADIUS atangle VERT }
+ # P1 :: XP1CTR ++ { RADIUS atangle { XP1CTR angleto XP1 } }
+ # P1 :< XP1PRE angleto XP1POST
+ # XP2PRE := XP2 -- { RADIUS atangle VERT }
+ # XP2POST := XP2 ++ { RADIUS atangle 0d }
+ # XP2CTR := XP2PRE ++ { RADIUS atangle 0d }
+ # P2 :: XP2CTR ++ { RADIUS atangle { XP2CTR angleto XP2 } }
+ # P2 :< XP2PRE angleto XP2POST
+ # FROM LFROM XP1PRE
+ # {round VERT} quadcase
+ # 90 { [XP1CTR clockwise] P1 [XP1CTR clockwise] }
+ # 270 { [XP1CTR] P1 [XP1CTR] }
+ # XP1POST LMID XP2PRE
+ # {round VERT} quadcase
+ # 90 { [XP2CTR clockwise] P2 [XP2CTR clockwise] }
+ # 270 { [XP2CTR] P2 [XP2CTR] }
+ # XP2POST LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @RVLLinePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias "ldiagrvllinepath"
+ # FROM :: from boundaryatangle 0d
+ # ++ {arrow @FromArrowLength arrowlength} atangle 0d
+ # FROM :< 0d
+ # TO :: to boundaryatangle 0d
+ # ++ {arrow @ToArrowLength arrowlength} atangle 0d
+ # TO :< 180d
+ # XRIGHT := {{xcoord FROM} max {xcoord TO}} + bias
+ # P1 :: { XRIGHT ycoord FROM }
+ # P2 :: { XRIGHT ycoord TO }
+ # VERT := P1 angleto P2
+ # P1 :< P1 angleto {P1++{1f atangle 0d} ++{1f atangle VERT}}
+ # P2 :< P2 angleto {P2++{1f atangle 180d}++{1f atangle VERT}}
+ # LMID :: P1 ** 0.5 ++ P2 ** 0.5
+ # LMID :< VERT
+ # XINDENT := xindent min {FROM distance P1}
+ # ZINDENT := zindent min {P2 distance TO}
+ # LFROM :: FROM ++ { XINDENT 0 }
+ # LFROM :< 0d
+ # LTO :: TO ++ { ZINDENT 0 }
+ # LTO :< 180d
+ # FROM LFROM P1 LMID P2 LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @RVLCurvePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias radius "ldiagrvlcurvepath"
+ # FROM :: from boundaryatangle 0d
+ # ++ {arrow @FromArrowLength arrowlength} atangle 0d
+ # FROM :< 0d
+ # TO :: to boundaryatangle 0d
+ # ++ {arrow @ToArrowLength arrowlength} atangle 0d
+ # TO :< 180d
+ # XRIGHT := {{xcoord FROM} max {xcoord TO}} + bias
+ # XP1 := { XRIGHT ycoord FROM }
+ # XP2 := { XRIGHT ycoord TO }
+ # VERT := XP1 angleto XP2
+ # LMID :: XP1 ** 0.5 ++ XP2 ** 0.5
+ # LMID :< VERT
+ # XINDENT := xindent min {FROM distance XP1}
+ # ZINDENT := zindent min {XP2 distance TO}
+ # LFROM :: FROM ++ { XINDENT 0 }
+ # LFROM :< 0d
+ # LTO :: TO ++ { ZINDENT 0 }
+ # LTO :< 180d
+ # RADIUS := radius min { { XP1 distance XP2 } * 0.5 }
+ # XP1PRE := XP1 ++ { RADIUS atangle 180d }
+ # XP1POST := XP1 ++ { RADIUS atangle VERT }
+ # XP1CTR := XP1PRE ++ { RADIUS atangle VERT }
+ # P1 :: XP1CTR ++ { RADIUS atangle { XP1CTR angleto XP1 } }
+ # P1 :< XP1PRE angleto XP1POST
+ # XP2PRE := XP2 -- { RADIUS atangle VERT }
+ # XP2POST := XP2 ++ { RADIUS atangle 180d }
+ # XP2CTR := XP2PRE ++ { RADIUS atangle 180d }
+ # P2 :: XP2CTR ++ { RADIUS atangle { XP2CTR angleto XP2 } }
+ # P2 :< XP2PRE angleto XP2POST
+ # FROM LFROM XP1PRE
+ # {round VERT} quadcase
+ # 90 { [XP1CTR] P1 [XP1CTR] }
+ # 270 { [XP1CTR clockwise] P1 [XP1CTR clockwise] }
+ # XP1POST LMID XP2PRE
+ # {round VERT} quadcase
+ # 90 { [XP2CTR] P2 [XP2CTR] }
+ # 270 { [XP2CTR clockwise] P2 [XP2CTR clockwise] }
+ # XP2POST LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @DWrapLinePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias fbias tbias "ldiagdwraplinepath"
+ # DIRN := if cond { xcoord from??CTR < xcoord to??CTR }
+ # then { 180d } else { 0d }
+ # FROM :: from boundaryatangle DIRN
+ # ++ {arrow @FromArrowLength arrowlength} atangle DIRN
+ # FROM :< DIRN
+ # TO :: to boundaryatangle { DIRN + 180d }
+ # ++ {arrow @ToArrowLength arrowlength} atangle { DIRN + 180d }
+ # TO :< DIRN
+ # P1 :: FROM ++ {fbias max 0} atangle DIRN
+ # P1 :< if cond { DIRN = 180d } then { 225d } else { -45d }
+ # P4 :: TO ++ {tbias max 0} atangle { DIRN + 180d }
+ # P4 :< if cond { DIRN = 180d } then { 135d } else { 45d }
+ # YC := ycoord { from boundaryatangle 270d } min
+ # ycoord { to boundaryatangle 270d }
+ # - { bias max 0 }
+ # P2 :: { xcoord P1 YC }
+ # P2 :< P4@ANGLE - 180d
+ # P3 :: { xcoord P4 YC }
+ # P3 :< P1@ANGLE - 180d
+ # XINDENT := xindent min { FROM distance P1 }
+ # LFROM :: FROM ++ XINDENT atangle DIRN
+ # LFROM :< FROM@ANGLE
+ # ZINDENT := zindent min { TO distance P4 }
+ # LTO :: TO ++ ZINDENT atangle { DIRN + 180d }
+ # LTO :< TO@ANGLE
+ # LMID :: P2 ** 0.5 ++ P3 ** 0.5
+ # LMID :< DIRN - 180d
+ # FROM P1 P2 P3 P4 TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @DWrapCurvePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias fbias tbias radius "ldiagdwrapcurvepath"
+ # DIRN := if cond { xcoord from??CTR < xcoord to??CTR }
+ # then { 180d } else { 0d }
+ # CLOCK := if cond { xcoord from??CTR < xcoord to??CTR }
+ # then { anticlockwise } else { clockwise }
+ # FROM :: from boundaryatangle DIRN
+ # ++ {arrow @FromArrowLength arrowlength} atangle DIRN
+ # FROM :< DIRN
+ # TO :: to boundaryatangle { DIRN + 180d }
+ # ++ {arrow @ToArrowLength arrowlength} atangle { DIRN + 180d }
+ # TO :< DIRN
+ #
+ # XP1 := FROM ++ {fbias max 0} atangle DIRN
+ # XP4 := TO ++ {tbias max 0} atangle { DIRN + 180d }
+ # YC := ycoord { from boundaryatangle 270d } min
+ # ycoord { to boundaryatangle 270d }
+ # - { bias max 0 }
+ # XP2 := { xcoord XP1 YC }
+ # XP3 := { xcoord XP4 YC }
+ #
+ # RP1 := radius min { XP1 distance FROM } min
+ # { { XP1 distance XP2 } / 2 }
+ # XP1PRE := XP1 ++ RP1 atangle { XP1 angleto FROM }
+ # XP1POST := XP1 ++ RP1 atangle { XP1 angleto XP2 }
+ # XP1CTR := XP1PRE ++ RP1 atangle { XP1 angleto XP2 }
+ # P1 :: XP1CTR ++ RP1 atangle { XP1CTR angleto XP1 }
+ # P1 :< XP1CTR angleto P1 + DIRN - 90d
+ #
+ # RP2 := radius min { { XP1 distance XP2 } / 2 }
+ # min { { XP2 distance XP3 } / 2 }
+ # XP2PRE := XP2 ++ RP2 atangle { XP2 angleto XP1 }
+ # XP2POST := XP2 ++ RP2 atangle { XP2 angleto XP3 }
+ # XP2CTR := XP2PRE ++ RP2 atangle { XP2 angleto XP3 }
+ # P2 :: XP2CTR ++ RP2 atangle { XP2CTR angleto XP2 }
+ # P2 :< XP2CTR angleto P2 + DIRN - 90d
+ #
+ # RP3 := radius min { { XP2 distance XP3 } / 2 }
+ # min { { XP3 distance XP4 } / 2 }
+ # XP3PRE := XP3 ++ RP3 atangle { XP3 angleto XP2 }
+ # XP3POST := XP3 ++ RP3 atangle { XP3 angleto XP4 }
+ # XP3CTR := XP3PRE ++ RP3 atangle { XP3 angleto XP4 }
+ # P3 :: XP3CTR ++ RP3 atangle { XP3CTR angleto XP3 }
+ # P3 :< XP3CTR angleto P3 + DIRN - 90d
+ #
+ # RP4 := radius min { { XP4 distance XP3 } / 2 }
+ # min { XP4 distance TO }
+ # XP4PRE := XP4 ++ RP4 atangle { XP4 angleto XP3 }
+ # XP4POST := XP4 ++ RP4 atangle { XP4 angleto TO }
+ # XP4CTR := XP4PRE ++ RP4 atangle { XP4 angleto TO }
+ # P4 :: XP4CTR ++ RP4 atangle { XP4CTR angleto XP4 }
+ # P4 :< XP4CTR angleto P4 + DIRN - 90d
+ #
+ # XINDENT := xindent min { FROM distance XP1PRE }
+ # LFROM :: FROM ++ XINDENT atangle DIRN
+ # LFROM :< FROM@ANGLE
+ #
+ # LMID :: XP2 ** 0.5 ++ XP3 ** 0.5
+ # LMID :< DIRN - 180d
+ #
+ # ZINDENT := zindent min { TO distance XP4POST }
+ # LTO :: TO ++ ZINDENT atangle { DIRN + 180d }
+ # LTO :< TO@ANGLE
+ #
+ # FROM LFROM
+ # XP1PRE [XP1CTR CLOCK] XP1POST
+ # XP2PRE [XP2CTR CLOCK] XP2POST
+ # LMID
+ # XP3PRE [XP3CTR CLOCK] XP3POST
+ # XP4PRE [XP4CTR CLOCK] XP4POST
+ # LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @UWrapLinePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias fbias tbias "ldiaguwraplinepath"
+ # DIRN := if cond { xcoord from??CTR < xcoord to??CTR }
+ # then { 180d } else { 0d }
+ # FROM :: from boundaryatangle DIRN
+ # ++ {arrow @FromArrowLength arrowlength} atangle DIRN
+ # FROM :< DIRN
+ # TO :: to boundaryatangle { DIRN + 180d }
+ # ++ {arrow @ToArrowLength arrowlength} atangle { DIRN + 180d }
+ # TO :< DIRN
+ # P1 :: FROM ++ {fbias max 0} atangle DIRN
+ # P1 :< if cond { DIRN = 180d } then { 135d } else { 45d }
+ # P4 :: TO ++ {tbias max 0} atangle { DIRN + 180d }
+ # P4 :< if cond { DIRN = 180d } then { 225d } else { -45d }
+ # YC := ycoord { from boundaryatangle 90d } max
+ # ycoord { to boundaryatangle 90d }
+ # + { bias max 0 }
+ # P2 :: { xcoord P1 YC }
+ # P2 :< P4@ANGLE - 180d
+ # P3 :: { xcoord P4 YC }
+ # P3 :< P1@ANGLE - 180d
+ # XINDENT := xindent min { FROM distance P1 }
+ # LFROM :: FROM ++ XINDENT atangle DIRN
+ # LFROM :< FROM@ANGLE
+ # ZINDENT := zindent min { TO distance P4 }
+ # LTO :: TO ++ ZINDENT atangle { DIRN + 180d }
+ # LTO :< TO@ANGLE
+ # LMID :: P2 ** 0.5 ++ P3 ** 0.5
+ # LMID :< DIRN - 180d
+ # FROM P1 P2 P3 P4 TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @UWrapCurvePath
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ {arrow @FromArrowLength arrowlength}
+ {arrow @ToArrowLength arrowlength}
+ "{" from "}" "{" to "}"
+ xindent zindent bias fbias tbias radius "ldiaguwrapcurvepath"
+ # DIRN := if cond { xcoord from??CTR < xcoord to??CTR }
+ # then { 180d } else { 0d }
+ # CLOCK := if cond { xcoord from??CTR < xcoord to??CTR }
+ # then { clockwise } else { anticlockwise }
+ # FROM :: from boundaryatangle DIRN
+ # ++ {arrow @FromArrowLength arrowlength} atangle DIRN
+ # FROM :< DIRN
+ # TO :: to boundaryatangle { DIRN + 180d }
+ # ++ {arrow @ToArrowLength arrowlength} atangle { DIRN + 180d }
+ # TO :< DIRN
+ #
+ # XP1 := FROM ++ {fbias max 0} atangle DIRN
+ # XP4 := TO ++ {tbias max 0} atangle { DIRN + 180d }
+ # YC := ycoord { from boundaryatangle 90d } max
+ # ycoord { to boundaryatangle 90d }
+ # + { bias max 0 }
+ # XP2 := { xcoord XP1 YC }
+ # XP3 := { xcoord XP4 YC }
+ #
+ # RP1 := radius min { XP1 distance FROM } min
+ # { { XP1 distance XP2 } / 2 }
+ # XP1PRE := XP1 ++ RP1 atangle { XP1 angleto FROM }
+ # XP1POST := XP1 ++ RP1 atangle { XP1 angleto XP2 }
+ # XP1CTR := XP1PRE ++ RP1 atangle { XP1 angleto XP2 }
+ # P1 :: XP1CTR ++ RP1 atangle { XP1CTR angleto XP1 }
+ # P1 :< XP1CTR angleto P1 + DIRN + 90d
+ #
+ # RP2 := radius min { { XP1 distance XP2 } / 2 }
+ # min { { XP2 distance XP3 } / 2 }
+ # XP2PRE := XP2 ++ RP2 atangle { XP2 angleto XP1 }
+ # XP2POST := XP2 ++ RP2 atangle { XP2 angleto XP3 }
+ # XP2CTR := XP2PRE ++ RP2 atangle { XP2 angleto XP3 }
+ # P2 :: XP2CTR ++ RP2 atangle { XP2CTR angleto XP2 }
+ # P2 :< XP2CTR angleto P2 + DIRN + 90d
+ #
+ # RP3 := radius min { { XP2 distance XP3 } / 2 }
+ # min { { XP3 distance XP4 } / 2 }
+ # XP3PRE := XP3 ++ RP3 atangle { XP3 angleto XP2 }
+ # XP3POST := XP3 ++ RP3 atangle { XP3 angleto XP4 }
+ # XP3CTR := XP3PRE ++ RP3 atangle { XP3 angleto XP4 }
+ # P3 :: XP3CTR ++ RP3 atangle { XP3CTR angleto XP3 }
+ # P3 :< XP3CTR angleto P3 + DIRN + 90d
+ #
+ # RP4 := radius min { { XP4 distance XP3 } / 2 }
+ # min { XP4 distance TO }
+ # XP4PRE := XP4 ++ RP4 atangle { XP4 angleto XP3 }
+ # XP4POST := XP4 ++ RP4 atangle { XP4 angleto TO }
+ # XP4CTR := XP4PRE ++ RP4 atangle { XP4 angleto TO }
+ # P4 :: XP4CTR ++ RP4 atangle { XP4CTR angleto XP4 }
+ # P4 :< XP4CTR angleto P4 + DIRN + 90d
+ #
+ # XINDENT := xindent min { FROM distance XP1PRE }
+ # LFROM :: FROM ++ XINDENT atangle DIRN
+ # LFROM :< FROM@ANGLE
+ #
+ # LMID :: XP2 ** 0.5 ++ XP3 ** 0.5
+ # LMID :< DIRN - 180d
+ #
+ # ZINDENT := zindent min { TO distance XP4POST }
+ # LTO :: TO ++ ZINDENT atangle { DIRN + 180d }
+ # LTO :< TO@ANGLE
+ #
+ # FROM LFROM
+ # XP1PRE [XP1CTR CLOCK] XP1POST
+ # XP2PRE [XP2CTR CLOCK] XP2POST
+ # LMID
+ # XP3PRE [XP3CTR CLOCK] XP3POST
+ # XP4PRE [XP4CTR CLOCK] XP4POST
+ # LTO TO
+ }
+ PDF @Yield {}
+ }
+ }
+
+ import @Geometry
+ def @Path
+ {
+ path @Case {
+ line @Yield @LinePath
+ doubleline @Yield @DoubleLinePath
+ { acurve curve } @Yield @ACurvePath
+ ccurve @Yield @CCurvePath
+ bezier @Yield @BezierPath
+ vhline @Yield @VHLinePath
+ vhcurve @Yield @VHCurvePath
+ hvline @Yield @HVLinePath
+ hvcurve @Yield @HVCurvePath
+ lvrline @Yield @LVRLinePath
+ lvrcurve @Yield @LVRCurvePath
+ rvlline @Yield @RVLLinePath
+ rvlcurve @Yield @RVLCurvePath
+ dwrapline @Yield @DWrapLinePath
+ dwrapcurve @Yield @DWrapCurvePath
+ uwrapline @Yield @UWrapLinePath
+ uwrapcurve @Yield @UWrapCurvePath
+ else @Yield {
+ path
+ from { from }
+ to { to }
+ bias { bias }
+ fbias { fbias }
+ tbias { tbias }
+ radius { radius }
+ xindent { xindent }
+ zindent { zindent }
+ frompt { frompt }
+ topt { topt }
+ arrow { arrow }
+ arrowlength { arrowlength }
+ }
+ }
+ }
+
+ def @FromLabel
+ {
+ @DoLabel
+ which { "f" }
+ label { fromlabel @Else @FromArrow }
+ labelmargin { fromlabelmargin }
+ labelfont { fromlabelfont }
+ labelbreak { fromlabelbreak }
+ labelformat { fromlabelformat @Body }
+ labelpos { fromlabelpos }
+ labelprox { fromlabelprox }
+ labelangle { fromlabelangle }
+ labelctr { fromlabelctr }
+ labeladjust { fromlabeladjust }
+ }
+
+ def @ToLabel
+ {
+ @DoLabel
+ which { "t" }
+ label { tolabel @Else @ToArrow }
+ labelmargin { tolabelmargin }
+ labelfont { tolabelfont }
+ labelbreak { tolabelbreak }
+ labelformat { tolabelformat @Body }
+ labelpos { tolabelpos }
+ labelprox { tolabelprox }
+ labelangle { tolabelangle }
+ labelctr { tolabelctr }
+ labeladjust { tolabeladjust }
+ }
+
+ def @Direct
+ {
+ pathstyle @Case {
+ { "/ldiagsolid" "/ldiagdashed" "/ldiagcdashed"
+ "/ldiagdotted" "/ldiagnoline" } @Yield 1
+ else @Yield 0
+ }
+ }
+
+ @BackEnd @Case {
+ PostScript @Yield {
+
+ @Null & # so that preceding space gets chewed up
+ {
+ @Direct "ldiaglinkbegin [" @Path "]" pathdashlength
+ "[" pathstyle "]" pathwidth "ldiaglinkend"
+ }
+ @Graphic
+ {
+ / { fromlabel @Else @FromArrow} @IfNonEmpty @FromLabel
+ / { xlabel @Else linklabel } @IfNonEmpty @XLabel
+ / { ylabel @Else linklabel } @IfNonEmpty @YLabel
+ / { zlabel @Else linklabel } @IfNonEmpty @ZLabel
+ / { tolabel @Else @ToArrow } @IfNonEmpty @ToLabel
+ }
+
+ }
+ PDF @Yield {}
+ }
+ }
+
+
+ def @ObjectLink
+ precedence 90
+ associativity left
+ left x
+ named treehsep { treehsep }
+ named treevsep { treevsep }
+ named format
+ named x {}
+ named y {}
+ named insinuatelink {}
+ named treehsep {}
+ named treevsep {}
+ { x | y | insinuatelink }
+ import @Geometry named path
+ named from {}
+ named to {}
+ named bias {}
+ named fbias {}
+ named tbias {}
+ named radius {}
+ named xindent {}
+ named zindent {}
+ named frompt {}
+ named topt {}
+ named arrow {}
+ named arrowlength {}
+ { path
+ from { from }
+ to { to }
+ bias { bias }
+ fbias { fbias }
+ tbias { tbias }
+ radius { radius }
+ xindent { xindent }
+ zindent { zindent }
+ frompt { frompt }
+ topt { topt }
+ arrow { arrow }
+ arrowlength { arrowlength }
+ }
+ import @Geometry named basefrom { }
+ import @Geometry named baseto { }
+ import @Geometry named from { }
+ import @Geometry named to { }
+ import @Geometry named bias { bias }
+ import @Geometry named fbias { fbias }
+ import @Geometry named tbias { tbias }
+ import @Geometry named radius { radius }
+ import @Geometry named xindent { xindent }
+ import @Geometry named zindent { zindent }
+ import @Geometry named frompt { frompt }
+ import @Geometry named topt { topt }
+ named pathstyle
+ named solid { "/ldiagsolid" }
+ named dashed { "/ldiagdashed" }
+ named cdashed { "/ldiagcdashed" }
+ named dotted { "/ldiagdotted" }
+ named noline { "/ldiagnoline" }
+ { pathstyle }
+ import @Geometry named pathdashlength { pathdashlength }
+ import @Geometry named pathwidth
+ named thin { 0.04 ft }
+ named medium { 0.08 ft }
+ named thick { 0.12 ft }
+ { pathwidth }
+ import @Geometry named pathgap
+ named thin { 0.08 ft }
+ named medium { 0.16 ft }
+ named thick { 0.24 ft }
+ { pathgap }
+
+ named arrow { arrow }
+ named arrowstyle { arrowstyle }
+ named arrowwidth { arrowwidth }
+ named arrowlength { arrowlength }
+
+ named linklabel { linklabel }
+ named linklabelmargin { linklabelmargin }
+ named linklabelfont { linklabelfont }
+ named linklabelbreak { linklabelbreak }
+ named linklabelformat right @Body { linklabelformat @Body }
+ import @Geometry named linklabelpos { linklabelpos }
+ named linklabelprox { linklabelprox }
+ import @Geometry named linklabelangle { linklabelangle }
+ named linklabelctr { linklabelctr }
+ import @Geometry named linklabeladjust { linklabeladjust }
+
+ named xlabel { xlabel }
+ named xlabelmargin { xlabelmargin }
+ named xlabelfont { xlabelfont }
+ named xlabelbreak { xlabelbreak }
+ named xlabelformat right @Body { xlabelformat @Body }
+ import @Geometry named xlabelpos { xlabelpos }
+ named xlabelprox { xlabelprox }
+ import @Geometry named xlabelangle { xlabelangle }
+ named xlabelctr { xlabelctr }
+ import @Geometry named xlabeladjust { xlabeladjust }
+
+ named ylabel { ylabel }
+ named ylabelmargin { ylabelmargin }
+ named ylabelfont { ylabelfont }
+ named ylabelbreak { ylabelbreak }
+ named ylabelformat right @Body { ylabelformat @Body }
+ import @Geometry named ylabelpos { ylabelpos }
+ named ylabelprox { ylabelprox }
+ import @Geometry named ylabelangle { ylabelangle }
+ named ylabelctr { ylabelctr }
+ import @Geometry named ylabeladjust { ylabeladjust }
+
+ named zlabel { zlabel }
+ named zlabelmargin { zlabelmargin }
+ named zlabelfont { zlabelfont }
+ named zlabelbreak { zlabelbreak }
+ named zlabelformat right @Body { zlabelformat @Body }
+ import @Geometry named zlabelpos { zlabelpos }
+ named zlabelprox { zlabelprox }
+ import @Geometry named zlabelangle { zlabelangle }
+ named zlabelctr { zlabelctr }
+ import @Geometry named zlabeladjust { zlabeladjust }
+
+ named fromlabel { fromlabel }
+ named fromlabelmargin { fromlabelmargin }
+ named fromlabelfont { fromlabelfont }
+ named fromlabelbreak { fromlabelbreak }
+ named fromlabelformat right @Body { fromlabelformat @Body }
+ import @Geometry named fromlabelpos { fromlabelpos }
+ named fromlabelprox { fromlabelprox }
+ import @Geometry named fromlabelangle { fromlabelangle }
+ named fromlabelctr { fromlabelctr }
+ import @Geometry named fromlabeladjust { fromlabeladjust }
+
+ named tolabel { tolabel }
+ named tolabelmargin { tolabelmargin }
+ named tolabelfont { tolabelfont }
+ named tolabelbreak { tolabelbreak }
+ named tolabelformat right @Body { tolabelformat @Body }
+ import @Geometry named tolabelpos { tolabelpos }
+ named tolabelprox { tolabelprox }
+ import @Geometry named tolabelangle { tolabelangle }
+ named tolabelctr { tolabelctr }
+ import @Geometry named tolabeladjust{ tolabeladjust }
+ right y
+
+ {
+ def @From
+ {
+ from @Case {
+ "" @Yield basefrom
+ else @Yield { basefrom"@"from }
+ }
+ }
+
+ def @To
+ {
+ to @Case {
+ "" @Yield baseto
+ else @Yield { baseto"@"to }
+ }
+ }
+
+ format
+ x { x }
+ y { y }
+ treehsep { treehsep }
+ treevsep { treevsep }
+ insinuatelink {
+ @Link
+ from { @From }
+ to { @To }
+ bias { bias }
+ fbias { fbias }
+ tbias { tbias }
+ radius { radius }
+ xindent { xindent }
+ zindent { zindent }
+ frompt { frompt }
+ topt { topt }
+ path { path
+ from { @From }
+ to { @To }
+ bias { bias }
+ fbias { fbias }
+ tbias { tbias }
+ radius { radius }
+ xindent { xindent }
+ zindent { zindent }
+ frompt { frompt }
+ topt { topt }
+ arrow { arrow }
+ arrowlength { arrowlength }
+ }
+ pathstyle { pathstyle }
+ pathdashlength { pathdashlength }
+ pathwidth { pathwidth }
+ pathgap { pathgap }
+ arrow { arrow }
+ arrowstyle { arrowstyle }
+ arrowwidth { arrowwidth }
+ arrowlength { arrowlength }
+
+ linklabel { linklabel }
+ linklabelmargin { linklabelmargin }
+ linklabelfont { linklabelfont }
+ linklabelbreak { linklabelbreak }
+ linklabelformat { linklabelformat @Body }
+ linklabelpos { linklabelpos }
+ linklabelprox { linklabelprox }
+ linklabelangle { linklabelangle }
+ linklabelctr { linklabelctr }
+ linklabeladjust { linklabeladjust }
+
+ xlabel { xlabel }
+ xlabelmargin { xlabelmargin }
+ xlabelfont { xlabelfont }
+ xlabelbreak { xlabelbreak }
+ xlabelformat { xlabelformat @Body }
+ xlabelpos { xlabelpos }
+ xlabelprox { xlabelprox }
+ xlabelangle { xlabelangle }
+ xlabelctr { xlabelctr }
+ xlabeladjust { xlabeladjust }
+
+ ylabel { ylabel }
+ ylabelmargin { ylabelmargin }
+ ylabelfont { ylabelfont }
+ ylabelbreak { ylabelbreak }
+ ylabelformat { ylabelformat @Body }
+ ylabelpos { ylabelpos }
+ ylabelprox { ylabelprox }
+ ylabelangle { ylabelangle }
+ ylabelctr { ylabelctr }
+ ylabeladjust { ylabeladjust }
+
+ zlabel { zlabel }
+ zlabelmargin { zlabelmargin }
+ zlabelfont { zlabelfont }
+ zlabelbreak { zlabelbreak }
+ zlabelformat { zlabelformat @Body }
+ zlabelpos { zlabelpos }
+ zlabelprox { zlabelprox }
+ zlabelangle { zlabelangle }
+ zlabelctr { zlabelctr }
+ zlabeladjust { zlabeladjust }
+
+ fromlabel { fromlabel }
+ fromlabelmargin { fromlabelmargin }
+ fromlabelfont { fromlabelfont }
+ fromlabelbreak { fromlabelbreak }
+ fromlabelformat { fromlabelformat @Body }
+ fromlabelpos { fromlabelpos }
+ fromlabelprox { fromlabelprox }
+ fromlabelangle { fromlabelangle }
+ fromlabelctr { fromlabelctr }
+ fromlabeladjust { fromlabeladjust }
+
+ tolabel { tolabel }
+ tolabelmargin { tolabelmargin }
+ tolabelfont { tolabelfont }
+ tolabelbreak { tolabelbreak }
+ tolabelformat { tolabelformat @Body }
+ tolabelpos { tolabelpos }
+ tolabelprox { tolabelprox }
+ tolabelangle { tolabelangle }
+ tolabelctr { tolabelctr }
+ tolabeladjust { tolabeladjust }
+ }
+ }
+
+ macro @Line { @Link path { line } }
+ macro @DoubleLine { @Link path { doubleline } }
+ macro @Arrow { @Link path { line } arrow { yes } }
+ macro @DoubleArrow { @Link path {doubleline} arrow { yes } }
+ macro @Curve { @Link path { curve } }
+ macro @CurveArrow { @Link path { curve } arrow { yes } }
+ macro @ACurve { @Link path { acurve } }
+ macro @ACurveArrow { @Link path { acurve } arrow { yes } }
+ macro @CCurve { @Link path { ccurve } }
+ macro @CCurveArrow { @Link path { ccurve } arrow { yes } }
+
+ macro @Bezier { @Link path { bezier } }
+ macro @BezierArrow { @Link path { bezier } arrow { yes } }
+
+ macro @HVLine { @Link path { hvline } }
+ macro @HVArrow { @Link path { hvline } arrow { yes } }
+ macro @VHLine { @Link path { vhline } }
+ macro @VHArrow { @Link path { vhline } arrow { yes } }
+ macro @HVCurve { @Link path { hvcurve } }
+ macro @HVCurveArrow { @Link path { hvcurve } arrow { yes } }
+ macro @VHCurve { @Link path { vhcurve } }
+ macro @VHCurveArrow { @Link path { vhcurve } arrow { yes } }
+
+ macro @LVRLine { @Link path { lvrline } }
+ macro @LVRArrow { @Link path { lvrline } arrow { yes } }
+ macro @RVLLine { @Link path { rvlline } }
+ macro @RVLArrow { @Link path { rvlline } arrow { yes } }
+ macro @LVRCurve { @Link path { lvrcurve } }
+ macro @LVRCurveArrow { @Link path { lvrcurve } arrow { yes } }
+ macro @RVLCurve { @Link path { rvlcurve } }
+ macro @RVLCurveArrow { @Link path { rvlcurve } arrow { yes } }
+
+ macro @DWrapLine { @Link path { dwrapline} }
+ macro @DWrapArrow { @Link path { dwrapline} arrow { yes } }
+ macro @UWrapLine { @Link path { uwrapline} }
+ macro @UWrapArrow { @Link path { uwrapline} arrow { yes } }
+ macro @DWrapCurve { @Link path {dwrapcurve} }
+ macro @DWrapCurveArrow { @Link path {dwrapcurve} arrow { yes } }
+ macro @UWrapCurve { @Link path {uwrapcurve} }
+ macro @UWrapCurveArrow { @Link path {uwrapcurve} arrow { yes } }
+
+ export
+
+ @Node @Box @CurveBox @ShadowBox @Square @Diamond
+ @Polygon @Isosceles @Ellipse @Circle
+ @LeftSub @ZeroWidthLeftSub @RightSub @ZeroWidthRightSub
+ @FirstSub @NextSub @StubSub
+
+ def @Tree
+ named treehindent
+ named left { 0.0rt }
+ named ctr { 0.5rt }
+ named right { 1.0rt }
+ { treehindent }
+ body x
+ {
+
+ macro @TNode { @@Node nodetag { T } }
+ macro @Node { @TNode }
+ macro @Box { @TNode outline { box } }
+ macro @CurveBox { @TNode outline { curvebox } }
+ macro @ShadowBox { @TNode outline { shadowbox } }
+ macro @Square { @TNode outline { square } }
+ macro @Diamond { @TNode outline { diamond } }
+ macro @Polygon { @TNode outline { polygon } }
+ macro @Isosceles { @TNode outline { isosceles } }
+ macro @Ellipse { @TNode outline { ellipse } }
+ macro @Circle { @TNode outline { circle } }
+
+ def fixroot
+ precedence 90
+ left root
+ {
+ |treehindent root
+ }
+
+ macro @LeftSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { L@T }
+ format { { /treevsep {L::y} } |treehsep x | insinuatelink }
+ }
+
+ macro @ZeroWidthLeftSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { L@T }
+ format { { /treevsep @ZeroWidth { {L::y} ^|treehsep } } |
+ x | insinuatelink }
+ }
+
+ macro @FirstSub
+ {
+ fixroot //
+ @ObjectLink
+ basefrom { T }
+ baseto { S@T }
+ format { //treevsep {S::y} | insinuatelink | }
+ }
+
+ macro @NextSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { S@T }
+ format { x |treehsep { / {S::y} | insinuatelink | } }
+ }
+
+ macro @RightSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { R@T }
+ format { x |treehsep { /treevsep {R::y} } | insinuatelink }
+ }
+
+ macro @ZeroWidthRightSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { R@T }
+ format { x | { /treevsep @ZeroWidth { |treehsep {R::y} } }
+ | insinuatelink }
+ }
+
+ macro @StubSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { T }
+ format { @VContract { |0.5rt x | // |0.5rt
+ S:: @BoxLabels @CatchTags y | } | insinuatelink }
+ # path { from S@T@SW S@T@SE to }
+ path {
+ P1:: S@SW
+ P2:: S@SE
+ FROM:: from boundaryatangle { from??CTR angleto P1 }
+ TO:: to boundaryatangle { to??CTR angleto P2 }
+ FROM P1 P2 TO
+ }
+ }
+
+ @HContract @VContract x
+ }
+
+ export
+
+ @Node @Box @CurveBox @ShadowBox @Square @Diamond
+ @Polygon @Isosceles @Ellipse @Circle
+ @LeftSub @ZeroWidthLeftSub @RightSub @ZeroWidthRightSub
+ @FirstSub @NextSub @StubSub
+
+ def @HTree
+ named treevindent
+ named top { 0.0rt }
+ named ctr { 0.5rt }
+ named foot { 1.0rt }
+ { treevindent }
+ body x
+ {
+
+ macro @TNode { @@Node nodetag { T } }
+ macro @Node { @TNode }
+ macro @Box { @TNode outline { box } }
+ macro @CurveBox { @TNode outline { curvebox } }
+ macro @ShadowBox { @TNode outline { shadowbox } }
+ macro @Square { @TNode outline { square } }
+ macro @Diamond { @TNode outline { diamond } }
+ macro @Polygon { @TNode outline { polygon } }
+ macro @Isosceles { @TNode outline { isosceles } }
+ macro @Ellipse { @TNode outline { ellipse } }
+ macro @Circle { @TNode outline { circle } }
+
+ def fixroot
+ precedence 90
+ left root
+ {
+ /treevindent root
+ }
+
+ macro @LeftSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { L@T }
+ format { { |treehsep {L::y} } /treevsep x / insinuatelink }
+ }
+
+ macro @ZeroWidthLeftSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { L@T }
+ format { { |treehsep @ZeroWidth { {L::y} ^/treevsep } } /
+ x / insinuatelink }
+ }
+
+ macro @FirstSub
+ {
+ fixroot ||
+ @ObjectLink
+ basefrom { T }
+ baseto { S@T }
+ format { ||treehsep { {S::y} / insinuatelink / } }
+ }
+
+ macro @NextSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { S@T }
+ format { x /treevsep { | {S::y} { / insinuatelink / } } }
+ }
+
+ macro @RightSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { R@T }
+ format { x /treevsep { |treehsep {R::y} } / insinuatelink }
+ }
+
+ macro @ZeroWidthRightSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { R@T }
+ format { x / { |treehsep @ZeroWidth { /treevsep {R::y} } }
+ / insinuatelink }
+ }
+
+ macro @StubSub
+ {
+ @ObjectLink
+ basefrom { T }
+ baseto { T }
+ format { @VContract { { /0.5rt x / } || { /0.5rt
+ S:: @BoxLabels @CatchTags y / } } / insinuatelink }
+ # path { from S@T@SW S@T@SE to }
+ path {
+ P1:: S@NE
+ P2:: S@SE
+ FROM:: from boundaryatangle { from??CTR angleto P1 }
+ TO:: to boundaryatangle { to??CTR angleto P2 }
+ FROM P1 P2 TO
+ }
+ }
+
+ @HContract @VContract x
+ }
+
+ @BackEnd @Case {
+ PostScript @Yield {
+ {
+ save @Case { { yes Yes } @Yield "grestore save gsave" else @Yield {} }
+ maxlabels "ldiagbegin"
+ //
+ "ldiagend"
+ save @Case { { yes Yes } @Yield "restore" else @Yield {} }
+ } @Graphic @Body
+ }
+ PDF @Yield {}
+ }
+
+ @End @Diag
+}
diff --git a/include/diagf.etc b/include/diagf.etc
new file mode 100644
index 0000000..c92a145
--- /dev/null
+++ b/include/diagf.etc
@@ -0,0 +1,627 @@
+
+###############################################################################
+# #
+# Lout @Geometry package for algebra and geometry in PostScript #
+# Version 1.0 (June 1996) #
+# Jeffrey H. Kingston #
+# #
+###############################################################################
+
+export
+
+ i c p m s v f d "-0" "-1" "-2" "-3" "-4" "-5" "-6" "-7" "-8" "-9" "-."
+ pi e sqrt abs ceiling floor truncate round cos sin atan
+ exp log rand max min "*" "/" idiv mod "+" "-"
+ xcoord ycoord distance angleto ":=" ":==" "::" ":<" prev "??" "?!?"
+ boundaryatangle atangle
+ "**" "++" "--" anglefix anydebug ","
+ "=" "!=" "==" "!==" "<" "<=" ">" ">=" not and xor or
+ if quadcase signcase xloop yloop zloop
+ cabout aabout
+
+def @Geometry
+{
+ def i
+ precedence 100
+ left x
+ {
+ x "in"
+ }
+
+ def c
+ precedence 100
+ left x
+ {
+ x "cm"
+ }
+
+ def p
+ precedence 100
+ left x
+ {
+ x "pt"
+ }
+
+ def m
+ precedence 100
+ left x
+ {
+ x "em"
+ }
+
+ def s
+ precedence 100
+ left x
+ {
+ x "sp"
+ }
+
+ def v
+ precedence 100
+ left x
+ {
+ x "vs"
+ }
+
+ def f
+ precedence 100
+ left x
+ {
+ x "ft"
+ }
+
+ def d
+ precedence 100
+ left x
+ {
+ x "dg"
+ }
+
+ def pi
+ {
+ "ldiagpi"
+ }
+
+ def e
+ {
+ "ldiage"
+ }
+
+ def sqrt
+ precedence 99
+ right y
+ {
+ y "sqrt"
+ }
+
+ def abs
+ precedence 99
+ right y
+ {
+ y "abs"
+ }
+
+ def anglefix
+ precedence 99
+ right y
+ {
+ y "ldiagfixangle"
+ }
+
+ def ceiling
+ precedence 99
+ right y
+ {
+ y "ceiling"
+ }
+
+ def floor
+ precedence 99
+ right y
+ {
+ y "floor"
+ }
+
+ def truncate
+ precedence 99
+ right y
+ {
+ y "truncate"
+ }
+
+ def round
+ precedence 99
+ right y
+ {
+ y "round"
+ }
+
+ def cos
+ precedence 99
+ right y
+ {
+ y "cos"
+ }
+
+ def sin
+ precedence 99
+ right y
+ {
+ y "sin"
+ }
+
+ def xcoord
+ precedence 99
+ right y
+ {
+ y "pop"
+ }
+
+ def ycoord
+ precedence 99
+ right y
+ {
+ y "exch pop"
+ }
+
+ def distance
+ precedence 98
+ left x
+ right y
+ {
+ x y "ldiagdistance"
+ }
+
+ def angleto
+ precedence 98
+ left x
+ right y
+ {
+ x y "ldiagangleto"
+ }
+
+ def atan
+ precedence 98
+ left x
+ right y
+ {
+ x y "atan"
+ }
+
+ def exp
+ precedence 98
+ left x
+ right y
+ {
+ x y "exp"
+ }
+
+ def log
+ precedence 98
+ left x
+ right y
+ {
+ x y "ldiaglog"
+ }
+
+ def rand
+ precedence 98
+ left x
+ right y
+ {
+ x y "dorand"
+ }
+
+ def max
+ precedence 98
+ left x
+ right y
+ {
+ x y "ldiagmax"
+ }
+
+ def min
+ precedence 98
+ left x
+ right y
+ {
+ x y "ldiagmin"
+ }
+
+ def "*"
+ precedence 97
+ left x
+ right y
+ {
+ x y "mul"
+ }
+
+ def "/"
+ precedence 96
+ associativity left
+ left x
+ right y
+ {
+ x y "div"
+ }
+
+ def idiv
+ precedence 96
+ associativity left
+ left x
+ right y
+ {
+ x y "idiv"
+ }
+
+ def mod
+ precedence 96
+ left x
+ right y
+ {
+ x "cvi" y "cvi mod"
+ }
+
+ def "+"
+ precedence 95
+ associativity left
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield y
+ else @Yield { x y "add" }
+ }
+ }
+
+ def "-"
+ precedence 95
+ associativity left
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield { y "neg" }
+ else @Yield { x y "sub" }
+ }
+ }
+
+ def "-0" { "-0" }
+ def "-1" { "-1" }
+ def "-2" { "-2" }
+ def "-3" { "-3" }
+ def "-4" { "-4" }
+ def "-5" { "-5" }
+ def "-6" { "-6" }
+ def "-7" { "-7" }
+ def "-8" { "-8" }
+ def "-9" { "-9" }
+ def "-." { "-." }
+
+ def prev
+ {
+ "ldiagprevious"
+ }
+
+ def "??"
+ precedence 99
+ left x
+ right y
+ {
+ "{" x "} ("y") ldiagdolabel"
+ }
+
+ def "?!?"
+ precedence 99
+ left x
+ right y
+ {
+ "{" x "} "y" ldiagdolabel"
+ }
+
+ def boundaryatangle
+ precedence 89
+ left x
+ right y
+ {
+ x??"CTR" y x??"CIRCUM" "ldiagpadd"
+ }
+
+ def atangle
+ precedence 89
+ left x
+ right y
+ {
+ 0 0 x y "ldiagatangle"
+ }
+
+ def "**"
+ precedence 88
+ left x
+ right y
+ {
+ x y "ldiagpmul"
+ }
+
+ def "++"
+ precedence 87
+ associativity left
+ left x
+ right y
+ {
+ x y "ldiagpadd"
+ }
+
+ def "--"
+ precedence 87
+ associativity left
+ left x
+ right y
+ {
+ y x "ldiagpsub"
+ }
+
+ def "="
+ precedence 79
+ left x
+ right y
+ {
+ x y "eq"
+ }
+
+ def "!="
+ precedence 79
+ left x
+ right y
+ {
+ x y "ne"
+ }
+
+ def "=="
+ precedence 79
+ left x
+ right y
+ {
+ x y "ldiagangleeq"
+ }
+
+ def "!=="
+ precedence 79
+ left x
+ right y
+ {
+ x y "ldiaganglene"
+ }
+
+ def "<"
+ precedence 79
+ left x
+ right y
+ {
+ x y "lt"
+ }
+
+ def "<="
+ precedence 79
+ left x
+ right y
+ {
+ x y "le"
+ }
+
+ def ">"
+ precedence 79
+ left x
+ right y
+ {
+ x y "gt"
+ }
+
+ def ">="
+ precedence 79
+ left x
+ right y
+ {
+ x y "ge"
+ }
+
+ def not
+ precedence 78
+ right y
+ {
+ y "not"
+ }
+
+ def and
+ precedence 77
+ left x
+ right y
+ {
+ x y "and"
+ }
+
+ def xor
+ precedence 76
+ left x
+ right y
+ {
+ x y "xor"
+ }
+
+ def or
+ precedence 76
+ left x
+ right y
+ {
+ x y "or"
+ }
+
+ def ","
+ precedence 70
+ left x
+ right y
+ {
+ OOO ++ { OOX -- OOO }**x ++ { OOY -- OOO }**y
+ }
+
+ def ":="
+ precedence 20
+ left x
+ right y
+ {
+ "/"x "[" y "] cvx def"
+ }
+
+ def ":=="
+ precedence 20
+ left x
+ right y
+ {
+ "/"x "[" y "counttomark 2 add (assigning) exch ldiagdebugprint ] cvx def"
+ }
+
+ def "::"
+ precedence 20
+ left x
+ right y
+ {
+ y "/"x "ldiagpointdef"
+ }
+
+ def ":<"
+ precedence 20
+ left x
+ right y
+ {
+ y "/"x"@ANGLE ldiagangledef"
+ }
+
+ def if
+ named cond {}
+ named then {}
+ named else {}
+ {
+ cond "{" then "} {" else "} ifelse"
+ }
+
+ def quadcase
+ precedence 10
+ left angle
+ named "0" {}
+ named "0-90" {}
+ named "90" {}
+ named "90-180" {}
+ named "180" {}
+ named "180-270" {}
+ named "270" {}
+ named "270-360" {}
+ {
+ "{" 0-90 "} {" 270 "} {" 180 "} {" 90 "}"
+ "{" 0 "} {" 270-360 "} {" 180-270 "} {" 90-180 "}" angle "ldiagquadcase"
+ }
+
+ def signcase
+ precedence 10
+ left number
+ named neg {}
+ named zero {}
+ named pos {}
+ {
+ "{" neg "} {" zero "} {" pos "}" number "ldiagsigncase"
+ }
+
+ def xloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named x { "xval" } {}
+ {
+ from by to "{ /xval exch def" do "} for"
+ }
+
+ def yloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named y { "yval" } {}
+ {
+ from by to "{ /yval exch def" do "} for"
+ }
+
+ def zloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named z { "zval" } {}
+ {
+ from by to "{ /zval exch def" do "} for"
+ }
+
+ def anydebug
+ right tag
+ {
+ "[" tag "counttomark ("tag") exch ldiagdebugprint cleartomark"
+ }
+
+ def aabout
+ named circum {}
+ named extra {}
+ named centre {}
+ {
+ "{" circum "} cvlit" extra "[" centre "] cvx ldiagaabout"
+ # ZXCTR := centre
+ # ZFCTR := circum??CTR
+ # ZAREF := ZFCTR angleto ZXCTR
+ # ZAMIN := 0d
+ # ZPMIN := circum boundaryatangle { ZAREF - ZAMIN }
+ # ++ extra atangle { ZAREF - ZAMIN }
+ # ZAMAX := 90d
+ # ZPMAX := circum boundaryatangle { ZAREF - ZAMAX }
+ # ++ extra atangle { ZAREF - ZAMAX }
+ # xloop from { 1 } to { 12 } by { 1 } do {
+ # ZAMID := { ZAMIN + ZAMAX } * 0.5
+ # ZPMID := circum boundaryatangle { ZAREF - ZAMID }
+ # ++ extra atangle { ZAREF - ZAMID }
+ # if cond { {ZPMID distance ZXCTR} > {ZFCTR distance ZXCTR} } then {
+ # ZAMAX := ZAMID
+ # ZPMAX := ZPMID
+ # }
+ # else {
+ # ZAMIN := ZAMID
+ # ZPMIN := ZPMID
+ # }
+ # }
+ # ZPMID
+ }
+
+ def cabout
+ named circum {}
+ named extra {}
+ named centre {}
+ {
+ "{" circum "} cvlit" extra "[" centre "] cvx ldiagcabout"
+ # ZXCTR := centre
+ # ZFCTR := circum??CTR
+ # ZAREF := ZFCTR angleto ZXCTR
+ # ZAMIN := 0d
+ # ZPMIN := circum boundaryatangle { ZAREF + ZAMIN }
+ # ++ extra atangle { ZAREF + ZAMIN }
+ # ZAMAX := 90d
+ # ZPMAX := circum boundaryatangle { ZAREF + ZAMAX }
+ # ++ extra atangle { ZAREF + ZAMAX }
+ # xloop from { 1 } to { 12 } by { 1 } do {
+ # ZAMID := { ZAMIN + ZAMAX } * 0.5
+ # ZPMID := circum boundaryatangle { ZAREF + ZAMID }
+ # ++ extra atangle { ZAREF + ZAMID }
+ # if cond { {ZPMID distance ZXCTR} > {ZFCTR distance ZXCTR} } then {
+ # ZAMAX := ZAMID
+ # ZPMAX := ZPMID
+ # }
+ # else {
+ # ZAMIN := ZAMID
+ # ZPMIN := ZPMID
+ # }
+ # }
+ # ZPMID
+ }
+}
diff --git a/include/diagf.lpg b/include/diagf.lpg
new file mode 100644
index 0000000..8b76f58
--- /dev/null
+++ b/include/diagf.lpg
@@ -0,0 +1,2706 @@
+%%BeginResource: procset LoutFigPrependGraphic
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% PostScript @SysPrependGraphic file for @Diag Jeffrey H. Kingston %
+% Version 2.0 (includes CIRCUM label) September 1996 %
+% %
+% To assist in avoiding name clashes, the names of all symbols %
+% defined here begin with "ldiag". However, this is not feasible %
+% with user-defined labels and some labels used by users. %
+% %
+% <point> is two numbers, a point. %
+% <length> is one number, a length %
+% <angle> is one number, an angle in degrees %
+% <dashlength> is one number, the preferred length of a dash %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+errordict begin
+ /handleerror
+ {
+ { /Times-Roman findfont 8 pt scalefont setfont
+ 0 setgray 4 pt 4 pt moveto
+ $error /errorname get
+ dup ldiagdict exch known
+ { ldiagdict exch get }
+ { 50 string cvs } ifelse
+ show
+ ( Command: ) show
+ $error /command get 50 string cvs show
+ } stopped {} if
+ showpage stop
+ } def
+end
+
+% begin diagram: <maxlabels> ldiagbegin -
+% must be defined outside ldiagdict since it loads it
+/ldiagbegin
+{ xsize 0 0 ysize ldiagdict begin
+ 5 -1 roll /ldiagmaxlabels exch def
+ (@Diag) ldiagpushtagdict
+ /OOY ldiagpointdef /OOX ldiagpointdef 0 0 /OOO ldiagpointdef
+} def
+
+% end diagram: - ldiagend -
+/ldiagend
+{ ldiagpoptagdict end
+} def
+
+% concat strings: <string> <string> ldiagconcat <string>
+% must be defined outside ldiagdict since used in ldiagpromotelabels
+/ldiagconcat
+{ 2 copy length exch length add string
+ dup 0 4 index putinterval
+ dup 3 index length 3 index putinterval
+ 3 1 roll pop pop
+} def
+
+/ldiagdebugposy 432 def
+/ldiagdebugposx 72 def
+
+% <string> <int> ldiagdebugprint -
+% must be defined outside ldiagdict since used in arbitrary places
+% print count or <int> stack entries, which ever is the smaller
+/ldiagdebugprint
+{
+ exch
+ gsave
+ initgraphics
+ ldiagdebugposy 72 lt
+ { /ldiagdebugposx ldiagdebugposx 144 add store
+ /ldiagdebugposy 432 store
+ }
+ {
+ /ldiagdebugposy ldiagdebugposy 12 sub store
+ } ifelse
+ ldiagdebugposx ldiagdebugposy moveto
+ /Times-Roman findfont 10 scalefont setfont
+ 0 setgray show
+ count 1 sub 2 copy lt { pop } { exch pop } ifelse 1 sub
+ 0 exch 1 exch
+ {
+ /ldiagdebugposy ldiagdebugposy 12 sub store
+ ldiagdebugposx 12 add ldiagdebugposy moveto
+ index 50 string cvs show
+ } for
+ grestore
+} def
+
+/ldiagdict 200 dict def
+ldiagdict begin
+
+% error messages
+/dictfull (dictfull error: too many labels?) def
+/dictstackoverflow (dictstackoverflow error: labels nested too deeply?) def
+/execstackoverflow (execstackoverflow error: figure nested too deeply?) def
+/limitcheck (limitcheck error: figure nested too deeply or too large?) def
+/syntaxerror (syntaxerror error: syntax error in text of figure?) def
+/typecheck (typecheck error: syntax error in text of figure?) def
+/undefined (undefined error: unknown or misspelt label?) def
+/VMError (VMError error: run out of memory?) def
+
+% push pi onto stack: - ldiagpi <num>
+/ldiagpi 3.14159 def
+
+% push e onto stack: - ldiage <num>
+/ldiage 2.71828 def
+
+% arc directions
+/clockwise false def
+/anticlockwise true def
+
+% test equality between two angles: <angle> <angle> ldiagangleeq <bool>
+/ldiagangleeq { ldiagfixangle exch ldiagfixangle eq } def
+
+% test inequality between two angles: <angle> <angle> ldiaganglene <bool>
+/ldiaganglene { ldiagangleeq not } def
+
+% maximum of two numbers: <num> <num> ldiagmax <num>
+/ldiagmax { 2 copy gt { pop } { exch pop } ifelse } def
+
+% minimum of two numbers: <num> <num> ldiagmin <num>
+/ldiagmin { 2 copy lt { pop } { exch pop } ifelse } def
+
+% add two points: <point> <point> ldiagpadd <point>
+/ldiagpadd
+{
+ % (Entering padd) 4 ldiagdebugprint
+ exch 3 1 roll add 3 1 roll add exch
+ % (Leaving padd) 2 ldiagdebugprint
+} def
+
+% subtract first point from second: <point> <point> ldiagpsub <point>
+/ldiagpsub { 3 2 roll sub 3 1 roll exch sub exch } def
+
+% max two points: <point> <point> ldiagpmax <point>
+/ldiagpmax { exch 3 1 roll ldiagmax 3 1 roll ldiagmax exch } def
+
+% min two points: <point> <point> ldiagpmin <point>
+/ldiagpmin { exch 3 1 roll ldiagmin 3 1 roll ldiagmin exch } def
+
+% scalar multiplication: <point> <num> ldiagpmul <point>
+/ldiagpmul { dup 3 1 roll mul 3 1 roll mul exch } def
+
+% point at angle and distance: <point> <length> <angle> ldiagatangle <point>
+/ldiagatangle { 2 copy cos mul 3 1 roll sin mul ldiagpadd } def
+
+% angle from one point to another: <point> <point> ldiagangleto <angle>
+/ldiagangleto { ldiagpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def
+
+% distance between two points: <point> <point> ldiagdistance <length>
+/ldiagdistance { ldiagpsub dup mul exch dup mul add sqrt } def
+
+% stroke a solid line: <length> <dashlength> ldiagsolid -
+/ldiagsolid
+{ pop pop [] 0 setdash 1 setlinecap stroke
+} def
+
+% stroke a dashed line: <length> <dashlength> ldiagdashed -
+/ldiagdashed
+{ 2 copy div 2 le 1 index 0 le or
+ { exch pop 1 pt ldiagmax [ exch dup ] 0 setdash }
+ { dup [ exch 4 2 roll 2 copy div
+ 1 sub 2 div ceiling dup 4 1 roll
+ 1 add mul sub exch div ] 0 setdash
+ } ifelse 0 setlinecap stroke
+} def
+
+% stroke a cdashed line: <length> <dashlength> ldiagcdashed -
+/ldiagcdashed
+{ % (Entering ldiagcdashed) 2 ldiagdebugprint
+ 2 copy le 1 index 0 le or
+ { exch pop 1 pt ldiagmax [ exch dup ] dup 0 get 2 div setdash }
+ { dup [ 4 2 roll exch 2 copy exch div
+ 2 div ceiling div 1 index sub
+ ] exch 2 div setdash
+ } ifelse 0 setlinecap stroke
+ % (Leaving ldiagcdashed) 0 ldiagdebugprint
+} def
+
+% stroke a dotted line: <length> <dashlength> ldiagdotted -
+/ldiagdotted
+{ 2 copy le 1 index 0 le or
+ { exch pop 1 pt ldiagmax [ exch 0 exch ] 0 setdash }
+ { 1 index exch div ceiling div
+ [ 0 3 2 roll ] 0 setdash
+ } ifelse 1 setlinecap stroke
+} def
+
+% stroke a noline line: <length> <dashlength> ldiagnoline -
+/ldiagnoline
+{ pop pop
+} def
+
+% painting (i.e. filling): - ldiagwhite - (etc.)
+/ldiagnopaint { } def
+/ldiagnochange { fill } def
+/ldiagdarkblue { 0.0 0.0 0.5 setrgbcolor fill } def
+/ldiagblue { 0.0 0.0 1.0 setrgbcolor fill } def
+/ldiaglightblue { 0.5 0.5 1.0 setrgbcolor fill } def
+/ldiagdarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def
+/ldiaggreen { 0.0 1.0 0.0 setrgbcolor fill } def
+/ldiaglightgreen { 0.5 1.0 0.5 setrgbcolor fill } def
+/ldiagdarkred { 0.5 0.0 0.0 setrgbcolor fill } def
+/ldiagred { 1.0 0.0 0.0 setrgbcolor fill } def
+/ldiaglightred { 1.0 0.5 0.5 setrgbcolor fill } def
+/ldiagdarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def
+/ldiagcyan { 0.0 1.0 1.0 setrgbcolor fill } def
+/ldiaglightcyan { 0.5 1.0 1.0 setrgbcolor fill } def
+/ldiagdarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def
+/ldiagmagenta { 1.0 0.0 1.0 setrgbcolor fill } def
+/ldiaglightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def
+/ldiagdarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def
+/ldiagyellow { 1.0 1.0 0.0 setrgbcolor fill } def
+/ldiaglightyellow { 1.0 1.0 0.5 setrgbcolor fill } def
+/ldiagdarkgray { 0.2 0.2 0.2 setrgbcolor fill } def
+/ldiaggray { 0.5 0.5 0.5 setrgbcolor fill } def
+/ldiaglightgray { 0.8 0.8 0.8 setrgbcolor fill } def
+/ldiagdarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def
+/ldiaggrey { 0.5 0.5 0.5 setrgbcolor fill } def
+/ldiaglightgrey { 0.8 0.8 0.8 setrgbcolor fill } def
+/ldiagblack { 0.0 0.0 0.0 setrgbcolor fill } def
+/ldiagwhite { 1.0 1.0 1.0 setrgbcolor fill } def
+
+% shape and labels of the @Box symbol
+/ldiagbox
+{
+ 0 0 /SW ldiagpointdef
+ xsize 0 /SE ldiagpointdef
+ xsize ysize /NE ldiagpointdef
+ 0 ysize /NW ldiagpointdef
+ SE 0.5 ldiagpmul /S ldiagpointdef
+ NW 0.5 ldiagpmul /W ldiagpointdef
+ W SE ldiagpadd /E ldiagpointdef
+ S NW ldiagpadd /N ldiagpointdef
+ NE 0.5 ldiagpmul /CTR ldiagpointdef
+
+ 0 dg /S@ANGLE ldiagangledef
+ 45 dg /SE@ANGLE ldiagangledef
+ 90 dg /E@ANGLE ldiagangledef
+ 135 dg /NE@ANGLE ldiagangledef
+ 180 dg /N@ANGLE ldiagangledef
+ 225 dg /NW@ANGLE ldiagangledef
+ 270 dg /W@ANGLE ldiagangledef
+ 315 dg /SW@ANGLE ldiagangledef
+
+ [ CTR NE ldiagpsub /ldiagboxcircum cvx ] ldiagcircumdef
+ SW SE NE NW SW
+} def
+
+% shape and labels of the @CurveBox symbol
+% <margin> ldiagcurvebox <shape>
+/ldiagcurvebox
+{
+
+ % (Entering ldiagcurvebox) 1 ldiagdebugprint
+ ldiagdecodelength /cbmgn exch def
+
+ xsize 0.5 mul ysize 0.5 mul /CTR ldiagpointdef
+ xsize 0.5 mul 0 /S ldiagpointdef
+ xsize ysize 0.5 mul /E ldiagpointdef
+ xsize 0.5 mul ysize /N ldiagpointdef
+ 0 ysize 0.5 mul /W ldiagpointdef
+
+ cbmgn 0.293 mul cbmgn 0.293 mul /SW ldiagpointdef
+ xsize cbmgn 0.293 mul sub cbmgn 0.293 mul /SE ldiagpointdef
+ xsize cbmgn 0.293 mul sub ysize cbmgn 0.293 mul sub /NE ldiagpointdef
+ cbmgn 0.293 mul ysize cbmgn 0.293 mul sub /NW ldiagpointdef
+
+ 0 dg /S@ANGLE ldiagangledef
+ 45 dg /SE@ANGLE ldiagangledef
+ 90 dg /E@ANGLE ldiagangledef
+ 135 dg /NE@ANGLE ldiagangledef
+ 180 dg /N@ANGLE ldiagangledef
+ 225 dg /NW@ANGLE ldiagangledef
+ 270 dg /W@ANGLE ldiagangledef
+ 315 dg /SW@ANGLE ldiagangledef
+
+ [ xsize ysize 0.5 ldiagpmul cbmgn /ldiagcurveboxcircum cvx ] ldiagcircumdef
+
+ cbmgn 0
+ xsize cbmgn sub 0
+ [ xsize cbmgn sub cbmgn ]
+ xsize cbmgn
+ xsize ysize cbmgn sub
+ [ xsize cbmgn sub ysize cbmgn sub ]
+ xsize cbmgn sub ysize
+ cbmgn ysize
+ [ cbmgn ysize cbmgn sub ]
+ 0 ysize cbmgn sub
+ 0 cbmgn
+ [ cbmgn cbmgn ]
+ cbmgn 0
+
+ % (Leaving ldiagcurvebox) 0 ldiagdebugprint
+} def
+
+% shadow of the @ShadowBox symbol
+% its shape and labels are done, somewhat inaccurately, with ldiagbox
+% <shadowmargin> ldiagshadow -
+/ldiagshadow
+{
+ /lfshm exch def
+
+ lfshm 0 moveto
+ 0 lfshm neg rlineto
+ xsize 0 rlineto
+ 0 ysize rlineto
+ lfshm neg 0 rlineto
+ xsize 0 lineto
+ closepath fill
+
+} def
+
+% shape and labels of the @Square symbol
+/ldiagsquare
+{
+ xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef
+ CTR xsize xsize ysize ysize ldiagpmax 0.5 ldiagpmul ldiagpadd /NE ldiagpointdef
+ CTR 0 0 CTR NE ldiagdistance 135 ldiagatangle ldiagpadd /NW ldiagpointdef
+ CTR 0 0 CTR NE ldiagdistance 225 ldiagatangle ldiagpadd /SW ldiagpointdef
+ CTR 0 0 CTR NE ldiagdistance 315 ldiagatangle ldiagpadd /SE ldiagpointdef
+ SW 0.5 ldiagpmul SE 0.5 ldiagpmul ldiagpadd /S ldiagpointdef
+ NW 0.5 ldiagpmul NE 0.5 ldiagpmul ldiagpadd /N ldiagpointdef
+ SW 0.5 ldiagpmul NW 0.5 ldiagpmul ldiagpadd /W ldiagpointdef
+ SE 0.5 ldiagpmul NE 0.5 ldiagpmul ldiagpadd /E ldiagpointdef
+
+ 0 dg /S@ANGLE ldiagangledef
+ 45 dg /SE@ANGLE ldiagangledef
+ 90 dg /E@ANGLE ldiagangledef
+ 135 dg /NE@ANGLE ldiagangledef
+ 180 dg /N@ANGLE ldiagangledef
+ 225 dg /NW@ANGLE ldiagangledef
+ 270 dg /W@ANGLE ldiagangledef
+ 315 dg /SW@ANGLE ldiagangledef
+
+ [ CTR NE ldiagpsub /ldiagboxcircum cvx ] ldiagcircumdef
+ SW SE NE NW SW
+} def
+
+% shape and labels of the @Diamond symbol
+/ldiagdiamond
+{
+ xsize 0 0.5 ldiagpmul /S ldiagpointdef
+ 0 ysize 0.5 ldiagpmul /W ldiagpointdef
+ S W ldiagpadd /CTR ldiagpointdef
+ CTR W ldiagpadd /N ldiagpointdef
+ CTR S ldiagpadd /E ldiagpointdef
+ E N ldiagpadd 0.5 ldiagpmul /NE ldiagpointdef
+ N W ldiagpadd 0.5 ldiagpmul /NW ldiagpointdef
+ S W ldiagpadd 0.5 ldiagpmul /SW ldiagpointdef
+ S E ldiagpadd 0.5 ldiagpmul /SE ldiagpointdef
+
+ 0 dg /S@ANGLE ldiagangledef
+ 90 dg /E@ANGLE ldiagangledef
+ 180 dg /N@ANGLE ldiagangledef
+ 270 dg /W@ANGLE ldiagangledef
+ S E ldiagangleto /SE@ANGLE ldiagangledef
+ E N ldiagangleto /NE@ANGLE ldiagangledef
+ N W ldiagangleto /NW@ANGLE ldiagangledef
+ W S ldiagangleto /SW@ANGLE ldiagangledef
+
+ [ xsize ysize 0.5 ldiagpmul /ldiagdiamondcircum cvx ] ldiagcircumdef
+ S E N W S
+} def
+
+% shape and labels of the @Ellipse symbol
+/ldiagellipse
+{
+ xsize 0 0.5 ldiagpmul /S ldiagpointdef
+ 0 ysize 0.5 ldiagpmul /W ldiagpointdef
+ S W ldiagpadd /CTR ldiagpointdef
+ CTR W ldiagpadd /N ldiagpointdef
+ CTR S ldiagpadd /E ldiagpointdef
+ CTR xsize 0 0.3536 ldiagpmul ldiagpadd 0 ysize 0.3536 ldiagpmul ldiagpadd /NE ldiagpointdef
+ 0 ysize 0.3536 ldiagpmul CTR xsize 0 0.3536 ldiagpmul ldiagpadd ldiagpsub /SE ldiagpointdef
+ xsize 0 0.3536 ldiagpmul CTR ldiagpsub 0 ysize 0.3536 ldiagpmul ldiagpadd /NW ldiagpointdef
+ 0 ysize 0.3536 ldiagpmul xsize 0 0.3536 ldiagpmul CTR ldiagpsub ldiagpsub /SW ldiagpointdef
+ [ xsize ysize 0.5 ldiagpmul /ldiagellipsecircum cvx ] ldiagcircumdef
+
+ 0 dg /S@ANGLE ldiagangledef
+ 90 dg /E@ANGLE ldiagangledef
+ 180 dg /N@ANGLE ldiagangledef
+ 270 dg /W@ANGLE ldiagangledef
+
+ S E ldiagangleto /SE@ANGLE ldiagangledef
+ E N ldiagangleto /NE@ANGLE ldiagangledef
+ N W ldiagangleto /NW@ANGLE ldiagangledef
+ W S ldiagangleto /SW@ANGLE ldiagangledef
+
+ S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
+} def
+
+% shape and labels of the @Circle symbol
+/ldiagcircle
+{
+ xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef
+ CTR xsize 0 ysize 0 ldiagpmax 0.5 ldiagpmul ldiagpadd /E ldiagpointdef
+ CTR 0 0 CTR E ldiagdistance 45 ldiagatangle ldiagpadd /NE ldiagpointdef
+ CTR 0 0 CTR E ldiagdistance 90 ldiagatangle ldiagpadd /N ldiagpointdef
+ CTR 0 0 CTR E ldiagdistance 135 ldiagatangle ldiagpadd /NW ldiagpointdef
+ CTR 0 0 CTR E ldiagdistance 180 ldiagatangle ldiagpadd /W ldiagpointdef
+ CTR 0 0 CTR E ldiagdistance 225 ldiagatangle ldiagpadd /SW ldiagpointdef
+ CTR 0 0 CTR E ldiagdistance 270 ldiagatangle ldiagpadd /S ldiagpointdef
+ CTR 0 0 CTR E ldiagdistance 315 ldiagatangle ldiagpadd /SE ldiagpointdef
+ [ S E ldiagpsub /ldiagellipsecircum cvx ] ldiagcircumdef
+
+ 0 dg /S@ANGLE ldiagangledef
+ 45 dg /SE@ANGLE ldiagangledef
+ 90 dg /E@ANGLE ldiagangledef
+ 135 dg /NE@ANGLE ldiagangledef
+ 180 dg /N@ANGLE ldiagangledef
+ 225 dg /NW@ANGLE ldiagangledef
+ 270 dg /W@ANGLE ldiagangledef
+ 315 dg /SW@ANGLE ldiagangledef
+
+ S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
+} def
+
+% shape and labels of the @VLine and @VArrow symbols
+/ldiagvline
+{
+ xmark ysize ldiagprevious /FROM ldiagpointdef
+ xmark 0 ldiagprevious /TO ldiagpointdef
+} def
+
+% points of a polygon around base with given no of sides, vert init angle:
+% <sides> <angle> ldiagpolygon <point> ... <point>
+/ldiagpolygon
+{ exch round cvi exch
+ xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef
+ 90 sub CTR 2 copy ldiagmax 5 3 roll
+ [ 4 copy pop /ldiagpolycircum cvx ] ldiagcircumdef
+ exch dup 360 exch div exch
+ 1 1 3 2 roll
+ { 4 string cvs (P) exch ldiagconcat
+ 3 copy exch pop (@ANGLE) ldiagconcat cvn exch 90 add exch ldiagangledef
+ cvn 6 copy pop pop ldiagatangle 2 copy 10 2 roll
+ 3 2 roll ldiagpointdef
+ dup 3 1 roll add exch
+ } for
+ pop ldiagatangle
+} def
+
+% shape and labels of the @Isosceles triangle symbol
+/ldiagisosceles
+{
+ xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef
+ 0 0 /SW ldiagpointdef
+ xsize 0 /SE ldiagpointdef
+ xsize 0.5 mul ysize /N ldiagpointdef
+ xsize 0.5 mul 0 /S ldiagpointdef
+ SE 0.5 ldiagpmul N 0.5 ldiagpmul ldiagpadd /NE ldiagpointdef
+ SW 0.5 ldiagpmul N 0.5 ldiagpmul ldiagpadd /NW ldiagpointdef
+
+ [ xsize ysize /ldiagisoscelescircum cvx ] ldiagcircumdef
+
+ 0 dg /SW@ANGLE ldiagangledef
+ 0 dg /SE@ANGLE ldiagangledef
+ 180 dg /N@ANGLE ldiagangledef
+ 0 dg /S@ANGLE ldiagangledef
+ SE N ldiagangleto /NE@ANGLE ldiagangledef
+ N SW ldiagangleto /NW@ANGLE ldiagangledef
+
+ SW SE N SW
+} def
+
+% next array element: <array> <index> ldiaggetnext <array> <index> <any> true
+% or <array> <index> false
+/ldiaggetnext
+{ 2 copy exch length ge
+ { false }
+ { 2 copy get exch 1 add exch true } ifelse
+} def
+
+% check whether thing is number: <any> ldiagisnumbertype <any> <bool>
+/ldiagisnumbertype
+{ dup type dup
+ /integertype eq exch /realtype eq or
+} def
+
+% check whether thing is an array: <any> ldiagisarraytype <any> <bool>
+/ldiagisarraytype { dup type /arraytype eq } def
+
+% check whether thing is an array: <any> ldiagisnametype <any> <bool>
+/ldiagisnametype { dup type /nametype eq } def
+
+% get next item: <array> <index> ldiaggetnextitem <array> <index> 0
+% or <array> <index> <array> 1
+% or <array> <index> <point> 2
+/ldiaggetnextitem
+{ ldiaggetnext
+ { ldiagisarraytype
+ { 1
+ }
+ { ldiagisnumbertype
+ { 3 1 roll
+ ldiaggetnext
+ { ldiagisnumbertype
+ { 4 3 roll exch 2
+ }
+ { pop 3 2 roll pop 0
+ } ifelse
+ }
+ { 3 2 roll pop 0
+ } ifelse
+ }
+ { pop 0
+ } ifelse
+ } ifelse
+ }
+ { 0
+ } ifelse
+} def
+
+% approximate equality: num1 num2 approxeq <boolean>
+/approxeq
+{ dup 0 eq
+ { pop 0 eq
+ }
+ { dup 3 1 roll sub exch div abs 0.001 lt
+ } ifelse
+} def
+
+% set arc path: bool x1 y1 x2 y2 x0 y0 ldiagsetarc <angle> <angle> <dist>
+% the path goes from x1 y1 to x2 y2 about centre x0 y0,
+% anticlockwise if bool is true else clockwise.
+% The orientations of backwards pointing and forwards pointing
+% arrowheads are returned in the two angles, and
+% the length of the arc is returned in <dist>.
+/ldiagsetarc
+{
+ % (Entering ldiagsetarc) 7 ldiagdebugprint
+ 20 dict begin
+ matrix currentmatrix 8 1 roll
+ 2 copy translate 2 copy 8 2 roll
+ 4 2 roll ldiagpsub 6 2 roll ldiagpsub
+ dup /y1 exch def dup mul /y1s exch def
+ dup /x1 exch def dup mul /x1s exch def
+ dup /y2 exch def dup mul /y2s exch def
+ dup /x2 exch def dup mul /x2s exch def
+ /dist1 0 0 x1 y1 ldiagdistance def
+ /dist2 0 0 x2 y2 ldiagdistance def
+
+ y1s y2s approxeq
+ { -1
+ }
+ { y1s x2s mul y2s x1s mul sub y1s y2s sub div
+ } ifelse
+ /da exch def
+
+ x1s x2s approxeq
+ { -1
+ }
+ { x1s y2s mul x2s y1s mul sub x1s x2s sub div
+ } ifelse
+ /db exch def
+
+ da 0 gt db 0 gt and
+ {
+ % ( case 1, ellipse) 0 ldiagdebugprint
+ /LMax da sqrt db sqrt ldiagmax def
+ /scalex da sqrt LMax div def
+ /scaley db sqrt LMax div def
+ scalex scaley scale
+ 0 0 LMax
+ 0 0 x1 scalex mul y1 scaley mul ldiagangleto
+ 0 0 x2 scalex mul y2 scaley mul ldiagangleto
+ 2 copy eq { 360 add } if
+ 2 copy 8 2 roll
+ 5 index { arc } { arcn } ifelse
+ 2 index 1 index
+ { 90 sub } { 90 add } ifelse
+ dup sin scaley mul exch cos scalex mul atan
+ 2 index 2 index
+ { 90 add } { 90 sub } ifelse
+ dup sin scaley mul exch cos scalex mul atan
+ 5 2 roll % res1 res2 ang1 ang2 anticlockwise
+ { exch sub } { sub } ifelse
+ dup 0 le { 360 add } if ldiagpi mul LMax mul 180 div
+ }
+ {
+ dist1 dist2 approxeq
+ % x1 y1 dist1 ( x1 y1, d) 3 ldiagdebugprint pop pop pop
+ % x2 y2 dist2 ( x2 y2, d) 3 ldiagdebugprint pop pop pop
+ {
+ % ( case 2, circle) 0 ldiagdebugprint
+ 0 0
+ dist1
+ 0 0 x1 y1 ldiagangleto
+ 0 0 x2 y2 ldiagangleto
+ 2 copy eq { 360 add } if
+ 2 copy 8 2 roll
+ 5 index { arc } { arcn } ifelse
+ 2 index 1 index
+ { 90 sub } { 90 add } ifelse
+ 2 index 2 index
+ { 90 add } { 90 sub } ifelse
+ 5 2 roll % res1 res2 ang1 ang2 clockwise
+ { exch sub } { sub } ifelse
+ dup 0 le { 360 add } if
+ ldiagpi mul dist1 mul 180 div
+ }
+ {
+ % ( case 3, line) 0 ldiagdebugprint
+ x2 y2 lineto pop
+ x2 y2 x1 y1 ldiagangleto
+ x1 y1 x2 y2 ldiagangleto
+ x1 y1 x2 y2 ldiagdistance
+ } ifelse
+ } ifelse
+ 4 -1 roll setmatrix
+ end
+ % (Leaving ldiagsetarc) 3 ldiagdebugprint
+} def
+
+% ldiagsetcurve: set up a Bezier curve from x0 y0 to x3 y3
+% and return arrowhead angles and length of curve (actually 0)
+% x0 y0 x1 y1 x2 y2 x3 y3 ldiagsetcurve <angle> <angle> <length>
+/ldiagsetcurve
+{ 8 copy curveto pop pop
+ ldiagangleto
+ 5 1 roll
+ 4 2 roll ldiagangleto
+ exch
+ 0
+} def
+
+% ldiagsetpath: convert a Diag path into a PostScript path
+% [ shape ] ldiagsetpath
+/ldiagsetpath
+{
+ 10 dict begin
+ 0 newpath
+ /prevseen false def
+ /curveseen false def
+ { ldiaggetnextitem
+ dup 0 eq { pop exit }
+ { 1 eq
+ { /curveseen true def
+ /curve exch def
+ curve length 0 eq { /curveseen false def } if
+ }
+ { /ycurr exch def
+ /xcurr exch def
+ prevseen
+ { curveseen
+ { curve length 4 eq
+ { xprev yprev
+ curve 0 get curve 1 get
+ curve 2 get curve 3 get
+ xcurr ycurr
+ ldiagsetcurve pop pop pop
+ }
+ { xprev yprev xcurr ycurr
+ curve length 1 ge { curve 0 get } { 0 } ifelse
+ curve length 2 ge { curve 1 get } { 0 } ifelse
+ curve length 3 ge { curve 2 get } { true } ifelse
+ 7 1 roll
+ ldiagsetarc pop pop pop
+ } ifelse
+ }
+ { xcurr ycurr lineto
+ } ifelse
+ }
+ { xcurr ycurr moveto
+ } ifelse
+ /xprev xcurr def
+ /yprev ycurr def
+ /prevseen true def
+ /curveseen false def
+ } ifelse
+ } ifelse
+ } loop pop pop
+ end
+} def
+
+% ldiagpaintpath: paint a path of the given shape
+% /paint [ shape ] ldiagpaintpath -
+/ldiagpaintpath
+{
+ ldiagsetpath cvx exec
+} def
+
+% stroke a path of the given shape in the given linestyle and dash length.
+% Return the origin and angle of the backward and forward arrow heads.
+% dashlength /linestyle [shape] ldiagdopath [<point> <angle>] [<point> <angle>]
+/ldiagdopath
+{
+ 10 dict begin
+ 0
+ /prevseen false def
+ /curveseen false def
+ /backarrow [] def
+ /fwdarrow [] def
+ {
+ ldiaggetnextitem
+ dup 0 eq { pop exit }
+ {
+ 1 eq
+ { /curveseen true def
+ /curve exch def
+ curve length 0 eq { /prevseen false def } if
+ }
+ { /ycurr exch def
+ /xcurr exch def
+ prevseen
+ { newpath xprev yprev moveto
+ curveseen
+ { curve length 4 eq
+ { xprev yprev
+ curve 0 get curve 1 get
+ curve 2 get curve 3 get
+ xcurr ycurr ldiagsetcurve
+ }
+ { xprev yprev xcurr ycurr
+ curve length 1 ge { curve 0 get } { 0 } ifelse
+ curve length 2 ge { curve 1 get } { 0 } ifelse
+ curve length 3 ge { curve 2 get } { true } ifelse
+ 7 1 roll
+ ldiagsetarc
+ } ifelse
+ }
+ { xcurr ycurr lineto
+ xcurr ycurr xprev yprev ldiagangleto dup 180 sub
+ xprev yprev xcurr ycurr ldiagdistance
+ } ifelse
+ 6 index 6 index cvx exec
+ [ xprev yprev 5 -1 roll ]
+ backarrow length 0 eq
+ { /backarrow exch def }
+ { pop } ifelse
+ [ xcurr ycurr 4 -1 roll ] /fwdarrow exch def
+ } if
+ /xprev xcurr def
+ /yprev ycurr def
+ /prevseen true def
+ /curveseen false def
+ } ifelse
+ } ifelse
+ } loop
+ pop pop pop pop
+ backarrow length 0 eq { [ 0 0 0 ] } { backarrow } ifelse
+ fwdarrow length 0 eq { [ 0 0 0 ] } { fwdarrow } ifelse
+ end
+} def
+
+
+% stroke a path of the given shape in the given linestyle and dash length.
+% dashlength [ /linestyle ] [shape] ldiagdosegpath -
+/ldiagdosegpath
+{
+ 12 dict begin
+ 1 index /seg exch def
+ 1 index length /seglength exch def
+ 0 /segcount exch def
+ 0
+ /prevseen false def
+ /curveseen false def
+ /backarrow [] def
+ /fwdarrow [] def
+ {
+ ldiaggetnextitem
+ dup 0 eq { pop exit }
+ {
+ 1 eq
+ { /curveseen true def
+ /curve exch def
+ curve length 0 eq { /prevseen false def } if
+ }
+ { /ycurr exch def
+ /xcurr exch def
+ prevseen
+ { newpath xprev yprev moveto
+ curveseen
+ { curve length 4 eq
+ { xprev yprev
+ curve 0 get curve 1 get
+ curve 2 get curve 3 get
+ xcurr ycurr ldiagsetcurve
+ }
+ { xprev yprev xcurr ycurr
+ curve length 1 ge { curve 0 get } { 0 } ifelse
+ curve length 2 ge { curve 1 get } { 0 } ifelse
+ curve length 3 ge { curve 2 get } { true } ifelse
+ 7 1 roll
+ ldiagsetarc
+ } ifelse
+ }
+ { xcurr ycurr lineto
+ xcurr ycurr xprev yprev ldiagangleto dup 180 sub
+ xprev yprev xcurr ycurr ldiagdistance
+ } ifelse
+ 6 index seg segcount seglength mod get cvx exec
+ /segcount segcount 1 add def
+ [ xprev yprev 5 -1 roll ]
+ backarrow length 0 eq
+ { /backarrow exch def }
+ { pop } ifelse
+ [ xcurr ycurr 4 -1 roll ] /fwdarrow exch def
+ } if
+ /xprev xcurr def
+ /yprev ycurr def
+ /prevseen true def
+ /curveseen false def
+ } ifelse
+ } ifelse
+ } loop
+ pop pop pop pop
+ end
+} def
+
+% ldiagnodebegin: start of node parameters
+% ldiagnodebegin -
+/ldiagnodebegin
+{ % (Entering ldiagnodebegin) 0 ldiagdebugprint
+ ldiagmaxlabels dict begin
+} def
+
+% ldiagnodeend: end of node parameters (so do the node)
+% <outline> <dashlength> <style> <linewidth> <paint> ldiagnodeend -
+/ldiagnodeend
+{
+ % (Entering ldiagnodeend) 0 ldiagdebugprint
+ end % matches begin in ldiagnodebegin
+ 4 index gsave ldiagpaintpath grestore
+ 3 index ldiagsetpath clip newpath
+ 2 mul setlinewidth
+ 3 -1 roll ldiagdosegpath
+ % (Leaving ldiagnodeend) 0 ldiagdebugprint
+} def
+
+% ldiaglinkbegin: start of link parameters
+% <direct> ldiaglinkbegin -
+/ldiaglinkbegin
+{ ldiagmaxlabels dict begin
+ 1 eq /direct exch def
+} def
+
+% ldiaglinkend: end of link parameters (so do the link)
+% <outline> <dashlength> <style> <linewidth> ldiaglinkend -
+/ldiaglinkend
+{
+ end % matches begin in ldiaglinkbegin
+ setlinewidth
+ 3 -1 roll ldiagdosegpath
+} def
+
+% ldiagdoarrow: draw an arrow head of given form
+% dashlength /lstyle /pstyle hfrac height width [ <point> <angle> ] ldiagdoarrow -
+/ldiagdoarrow
+{ matrix currentmatrix 8 1 roll
+ dup 0 get 1 index 1 get translate
+ 2 get rotate
+ [ 2 index neg 2 index 0 0
+ 3 index 3 index neg
+ 1 index 10 index mul 0
+ 7 index 7 index ]
+ 4 1 roll pop pop pop
+ dup 3 1 roll
+ gsave ldiagpaintpath grestore ldiagdopath pop pop
+ setmatrix
+} def
+
+% arrow head styles
+/ldiagopen 0.0 def
+/ldiaghalfopen 0.5 def
+/ldiagclosed 1.0 def
+
+% stroke no arrows, forward, back, and both
+/ldiagnoarrow { pop pop pop pop pop pop pop pop } def
+/ldiagforward { 7 -1 roll ldiagdoarrow pop } def
+/ldiagback { 8 -2 roll pop ldiagdoarrow } def
+/ldiagboth { 8 -1 roll 7 copy ldiagdoarrow pop 7 -1 roll ldiagdoarrow } def
+
+% ldiagprevious: return previous point on path
+/ldiagprevious
+{ ldiagisnumbertype
+ { 2 copy }
+ { ldiagisarraytype
+ { 2 index 2 index }
+ { 0 0 }
+ ifelse
+ } ifelse
+} def
+
+% Tag dictionary operators
+%
+% Diag's tag dictionaries are kept on the same stack as other dictionaries,
+% since there is nowhere else to put them. However, they are managed like
+% a separate stack using the following operators:
+%
+% <tag> ldiagpushtagdict - Push a new, empty tag dictionary
+% ldiagtoptagdict dict Find the top tag dictionary
+% ldiagpoptagdict - Pop and destroy the top tag dictionary
+% ldiagpopuptagdict - Pop top tag dict and promote its entries
+% ldiagdebugtagdict - Debug print of dictionary stack
+%
+% They are distinguished from other dictionaries by containing /ldiagtagdict,
+% whose value is the <tag> which is used by ldiagpopuptagdict,
+% and they are hopefully never the target of any non-tag definition because
+% they are never the top dictionary, since push places the new dict second.
+
+/ldiagpushtagdict
+{ ldiagmaxlabels dict dup
+ currentdict end exch begin begin
+ exch /ldiagtagdict exch put
+} def
+
+/ldiagtoptagdict
+{ /ldiagtagdict where not
+ { (Diag internal error: no tag dictionary) show stop
+ } if
+} def
+
+/ldiagpoptagdict
+{
+ % (Entering poptagdict) 0 ldiagdebugprint
+ % ldiagdebugtagdict
+ mark
+ { currentdict end
+ dup /ldiagtagdict known
+ { exit
+ } if
+ } loop
+ pop
+ counttomark
+ { begin
+ } repeat
+ pop
+ % (Leaving poptagdict) 0 ldiagdebugprint
+ % ldiagdebugtagdict
+} def
+
+% promote labels from top tag dictionary to second top tag dictionary
+% each prefixed by <string>@ if <string> (value of /ldiagtagdict) is not empty
+% - ldiagpopuptagdict -
+/ldiagpopuptagdict
+{
+ ldiagtagdict
+ % (Entering ldiagpopuptagdict) 1 ldiagdebugprint
+ % ldiagdebugtagdict
+ ldiagtoptagdict ldiagpoptagdict ldiagtoptagdict exch
+ { exch 50 string cvs 3 index
+ dup length 0 ne
+ { (@) ldiagconcat
+ } if
+ exch ldiagconcat cvn exch 2 index 3 1 roll put
+ } forall
+ pop pop
+ % (Leaving ldiagpopuptagdict) 0 ldiagdebugprint
+ % ldiagdebugtagdict
+} def
+
+% debug tag dictionary stack
+/ldiagdebugtagdict
+{ (Entering ldiagdebugtagdict) 0 ldiagdebugprint
+ 30 array dictstack
+ { dup /ldiagtagdict known
+ { dup /ldiagtagdict get 0 ldiagdebugprint
+ { pop 50 string cvs ( ) exch ldiagconcat
+ dup 0 ldiagdebugprint
+ pop
+ }
+ forall
+ }
+ { pop (other) 0 ldiagdebugprint
+ } ifelse
+ } forall
+ (Leaving ldiagdebugtagdict) 0 ldiagdebugprint
+} def
+
+% label a point in top tag dictionary: <point> /name ldiagpointdef -
+/ldiagpointdef
+{
+ % (Entering ldiagpointdef) 3 ldiagdebugprint
+ [ 4 2 roll transform /itransform cvx ] cvx
+ ldiagtoptagdict 3 1 roll put
+ % (Leaving ldiagpointdef) 0 ldiagdebugprint
+} def
+
+% label an angle in top tag dictionary: <angle> /name ldiagangledef -
+/ldiagangledef
+{
+ % (Entering ldiagangledef) 2 ldiagdebugprint
+ exch ldiagfixangle ldiagtoptagdict 3 1 roll put
+ % (Leaving ldiagangledef) 0 ldiagdebugprint
+} def
+
+% add CIRCUM operator with this body: <array> ldiagcircumdef -
+/ldiagcircumdef
+{ % (Entering ldiagcircumdef) 1 ldiagdebugprint
+ /CIRCUM exch cvx
+ ldiagtoptagdict 3 1 roll put
+ % currentdict end
+ % 3 1 roll
+ % def
+ % begin
+ % (Leaving ldiagcircumdef) 0 ldiagdebugprint
+} def
+
+% show points (except CIRCUM and ANGLE): - ldiagshowpoints -
+/ldiagshowpoints
+{
+ % (Entering ldiagshowpoints) 0 ldiagdebugprint
+ ldiagtoptagdict
+ { 1 index 50 string cvs
+ (ldiagdebugpos) search
+ { pop pop pop pop pop }
+ {
+ (CIRCUM) search % if CIRCUM in key
+ { pop pop pop pop pop }
+ {
+ (ANGLE) search % if ANGLE in key
+ {
+ pop pop pop pop pop
+ }
+ {
+ (ldiagtagdict) search
+ {
+ pop pop pop pop pop
+ }
+ {
+ pop cvx exec
+ newpath 2.0 pt 0 360 arc 0 setgray fill pop
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ } forall
+ % (Leaving ldiagshowpoints) 0 ldiagdebugprint
+} def
+
+
+/ldiagshowtags
+{
+ % (Entering ldiagshowtags) 0 ldiagdebugprint
+ ldiagtoptagdict
+ { 1 index 50 string cvs
+ % dup 0 ldiagdebugprint
+ (ldiagdebugpos) search
+ { pop pop pop pop pop }
+ {
+ (CIRCUM) search % if CIRCUM in key
+ { pop pop pop pop pop }
+ {
+ (ANGLE) search % if ANGLE in key
+ {
+ pop pop pop pop pop
+ }
+ {
+ (ldiagtagdict) search
+ {
+ pop pop pop pop pop
+ }
+ {
+ pop cvx exec 2 copy
+ gsave
+ newpath 2.0 pt 0 360 arc 0 setgray fill
+ /Times-Roman findfont 8 pt scalefont setfont
+ translate 40 rotate 0.2 cm 0.1 cm moveto 20 string cvs show
+ grestore
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ } forall
+ % (Leaving ldiagshowtags) 0 ldiagdebugprint
+} def
+
+
+% show angles: - ldiagshowangles -
+/ldiagshowangles
+{
+ % (Entering ldiagshowangles) 0 ldiagdebugprint
+ ldiagtoptagdict
+ { 1 index 20 string cvs
+ % dup 0 ldiagdebugprint
+ (ldiagdebugpos) search
+ { pop pop pop pop pop }
+ {
+ (ldiagtagdict) search
+ {
+ pop pop pop pop pop
+ }
+ {
+ (CIRCUM) search % if CIRCUM in key
+ { pop pop pop pop pop }
+ {
+ (@ANGLE) search % if ANGLE in key, draw the angle at the point
+ {
+ % (showing ANGLE) 5 ldiagdebugprint
+ gsave exch pop exch pop cvx
+ % (about to execute) 1 ldiagdebugprint
+ exec translate rotate 0.8 0.8 scale pop
+ newpath 0 0 2.0 pt 0 360 arc 0 setgray fill
+ newpath 4 pt 0 moveto 9 pt 0 lineto
+ 9 pt 1.5 pt lineto 11 pt 0 lineto 9 pt -1.5 pt lineto
+ 9 pt 0 lineto [] 0 setdash 4 pt setlinewidth 0 setlinejoin
+ stroke grestore
+ % (finished ANGLE) 5 ldiagdebugprint
+ }
+ {
+ % else must be a point, we aren't showing those
+ pop pop pop
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ } forall
+ % (Leaving ldiagshowangles) 0 ldiagdebugprint
+} def
+
+% fix an angle to 0 <= res < 360: <angle> ldiagfixangle <angle>
+/ldiagfixangle
+{
+ % (Entering ldiagfixangle) 1 ldiagdebugprint
+ { dup 0 ge { exit } if
+ 360 add
+ } loop
+ { dup 360 lt { exit } if
+ 360 sub
+ } loop
+ % (Leaving ldiagfixangle) 1 ldiagdebugprint
+} def
+
+% find point on circumference of box: alpha a b ldiagboxcircum x y
+/ldiagboxcircum
+{
+ % (Entering ldiagboxcircum) 3 ldiagdebugprint
+ 4 dict begin
+ /b exch def
+ /a exch def
+ ldiagfixangle /alpha exch def
+ 0 0 a b ldiagangleto /theta exch def
+
+ % if alpha <= theta, return (a, a*tan(alpha))
+ alpha theta le
+ { a a alpha sin mul alpha cos div }
+ {
+ % else if alpha <= 180 - theta, return (b*cot(alpha), b)
+ alpha 180 theta sub le
+ { b alpha cos mul alpha sin div b }
+ {
+ % else if alpha <= 180 + theta, return (-a, -a*tan(alpha))
+ alpha 180 theta add le
+ { a neg a neg alpha sin mul alpha cos div }
+ {
+ % else if alpha <= 360 - theta, return (-b*cot(alpha), -b)
+ alpha 360 theta sub le
+ { b neg alpha cos mul alpha sin div b neg }
+ {
+ % else 360 - theta <= alpha, return (a, a*tan(alpha))
+ a a alpha sin mul alpha cos div
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ end
+ % (Leaving ldiagboxcircum) 2 ldiagdebugprint
+} def
+
+% find quadratic roots (assume a != 0): a b c ldiagqroots x1 x2 2
+% or x2 1
+% or 0
+/ldiagqroots
+{
+ 4 dict begin
+ /c exch def
+ /b exch def
+ /a exch def
+ /disc b b mul 4 a c mul mul sub def
+ disc 0 lt
+ { 0
+ }
+ { disc 0 eq
+ { b neg 2 a mul div
+ 1
+ }
+ { b neg disc sqrt add 2 a mul div
+ b neg disc sqrt sub 2 a mul div
+ 2
+ }
+ ifelse
+ }
+ ifelse
+ end
+} def
+
+% work our which quadrant: <angle> ldiagquadrant <0-3>
+/ldiagquadrant
+{ dup 90 lt
+ { pop 0
+ }
+ { dup 180 lt
+ { pop 1
+ }
+ { 270 lt
+ { 2
+ }
+ { 3
+ } ifelse
+ } ifelse
+ } ifelse
+} def
+
+% find curvebox circum, assuming upper right quadrant: alpha a b xmk ldiagcb x y
+/ldiagcb
+{
+ 6 dict begin
+ /xmk exch def
+ /b exch def
+ /a exch def
+ /alpha exch def
+ /theta1 0 0 a b xmk sub ldiagangleto def
+ /theta2 0 0 a xmk sub b ldiagangleto def
+ alpha theta1 le
+ { % if alpha <= theta1, return (a, a*tan(alpha))
+ a a alpha sin mul alpha cos div
+ }
+ { alpha theta2 ge
+ { % else if alpha > theta2, return (b*cot(alpha), b)
+ b alpha cos mul alpha sin div b
+ }
+ {
+ % else, return the intersection of line and circle
+ a xmk sub b xmk sub xmk 0 0 alpha ldiagcircleintersect
+ dup 0 eq
+ { % should never happen, just return any reasonable point
+ pop
+ a b 0.5 ldiagpmul
+ }
+ { 1 eq
+ { % should never happen, just return the point on top of stack
+ }
+ { % the usual case, two points on stack, return the larger
+ ldiagpmax
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ end
+} def
+
+% find point on circumference of curvebox: alpha a b xmk ldiagcurveboxcircum x y
+/ldiagcurveboxcircum
+{
+ % (Entering ldiagcurveboxcircum) 4 ldiagdebugprint
+ 5 dict begin
+ /xmk exch def
+ /b exch def
+ /a exch def
+ ldiagfixangle /alpha exch def
+
+ % work out which quadrant we are in, and reflect accordingly
+ /quad alpha ldiagquadrant def
+ quad 0 eq
+ { alpha a b xmk ldiagcb
+ }
+ { quad 1 eq
+ { 180 alpha sub a b xmk ldiagcb exch neg exch
+ }
+ { quad 2 eq
+ { alpha 180 sub a b xmk ldiagcb neg exch neg exch
+ }
+ { 360 alpha sub a b xmk ldiagcb neg
+ } ifelse
+ } ifelse
+ } ifelse
+ end
+ % (Leaving ldiagcurveboxcircum) 2 ldiagdebugprint
+} def
+
+% find point on circumference of diamond: alpha a b ldiagdiamondcircum x y
+/ldiagdiamondcircum
+{
+ % (Entering ldiagdiamondcircum) 3 ldiagdebugprint
+ 4 dict begin
+ /b exch def
+ /a exch def
+ ldiagfixangle /alpha exch def
+ b alpha cos abs mul a alpha sin abs mul add /denom exch def
+ a b mul alpha cos mul denom div
+ a b mul alpha sin mul denom div
+ end
+ % (Leaving ldiagdiamondcircum) 2 ldiagdebugprint
+} def
+
+% find point on circumference of ellipse: alpha a b ldiagellipsecircum x y
+/ldiagellipsecircum
+{
+ % (Entering ldiagellipsecircum) 3 ldiagdebugprint
+ 4 dict begin
+ /b exch def
+ /a exch def
+ ldiagfixangle /alpha exch def
+ b alpha cos mul dup mul a alpha sin mul dup mul add sqrt /denom exch def
+ a b mul alpha cos mul denom div
+ a b mul alpha sin mul denom div
+ end
+ % (Leaving ldiagellipsecircum) 2 ldiagdebugprint
+} def
+
+% find point on circumference of isosceles: alpha a b ldiagisoscelescircum x y
+/ldiagisoscelescircum
+{
+ % (Entering ldiagisoscelescircum) 3 ldiagdebugprint
+ 7 dict begin
+ /b exch def
+ /a exch def
+ /alpha exch ldiagfixangle def
+ /theta1 90 def
+ /theta2 a b 0.5 ldiagpmul 0 0 ldiagangleto def
+ /theta3 a b 0.5 ldiagpmul a 0 ldiagangleto def
+ alpha theta1 ge alpha theta2 le and
+ { 0 0 a 2 div b
+ }
+ { alpha theta2 ge alpha theta3 le and
+ { 0 0 a 0
+ }
+ { a 0 a 2 div b
+ } ifelse
+ } ifelse
+ a 2 div b 2 div 2 copy 1 ft alpha ldiagatangle ldiaglineintersect
+ a 2 div b 2 div 4 2 roll ldiagpsub
+ end
+ % (Leaving ldiagisoscelescircum) 2 ldiagdebugprint
+} def
+
+% find point of intersection of two lines each defined by two points
+% x1 y1 x2 y2 x3 y3 x4 y4 ldiaglineintersect x y
+/ldiaglineintersect
+{
+ % (Entering ldiaglineintersect) 8 ldiagdebugprint
+ 13 dict begin
+ /y4 exch def
+ /x4 exch def
+ /y3 exch def
+ /x3 exch def
+ /y2 exch def
+ /x2 exch def
+ /y1 exch def
+ /x1 exch def
+ x2 x1 sub /x21 exch def
+ x4 x3 sub /x43 exch def
+ y2 y1 sub /y21 exch def
+ y4 y3 sub /y43 exch def
+ y21 x43 mul y43 x21 mul sub /det exch def
+
+ % calculate x
+ y21 x43 mul x1 mul
+ y43 x21 mul x3 mul sub
+ y3 y1 sub x21 mul x43 mul add
+ det div
+
+ % calculate y
+ x21 y43 mul y1 mul
+ x43 y21 mul y3 mul sub
+ x3 x1 sub y21 mul y43 mul add
+ det neg div
+
+ end
+ % (Leaving ldiaglineintersect) 2 ldiagdebugprint
+} def
+
+% find point on circumference of polygon
+% alpha radius num theta ldiagpolycircum x y
+/ldiagpolycircum
+{
+ % (Entering ldiagpolycircum) 4 ldiagdebugprint
+ 13 dict begin
+ /theta exch def
+ /num exch def
+ /radius exch def
+ /alpha exch def
+
+ % calculate delta, the angle from theta to alpha
+ alpha theta sub ldiagfixangle
+
+ % calculate the angle which is the multiple of 360/num closest to delta
+ 360 num div div truncate 360 num div mul theta add /anglea exch def
+
+ % calculate the next multiple of 360/num after anglea
+ anglea 360 num div add /angleb exch def
+
+ % intersect the line through these two points with the alpha line
+ anglea cos anglea sin angleb cos angleb sin
+ 0 0 alpha cos 2 mul alpha sin 2 mul
+ ldiaglineintersect radius ldiagpmul
+
+ end
+ % (Leaving ldiagpolycircum) 2 ldiagdebugprint
+} def
+
+% find point of intersection of a line and a circle
+% x0 y0 r x1 y1 theta ldiagcircleintersect xa ya xb yb 2
+% or xb yb 1
+% or 0
+/ldiagcircleintersect
+{
+ % (Entering ldiagcircleintersect) 6 ldiagdebugprint
+ 15 dict begin
+ /theta exch def
+ /y1 exch def
+ /x1 exch def
+ /r exch def
+ /y0 exch def
+ /x0 exch def
+
+ % if sin(theta) = 0 then line is horizontal and y must be y1
+ theta sin abs 0.00001 lt
+ {
+ /a 1 def
+ /b -2 x0 mul def
+ /c x0 dup mul y1 y0 sub dup mul add r dup mul sub def
+ a b c ldiagqroots dup
+ 0 eq
+ { pop
+ 0
+ }
+ { 1 eq
+ { y1 1
+ }
+ { y1 exch y1 2
+ } ifelse
+ } ifelse
+ }
+ {
+ /ct theta cos theta sin div def
+ /a ct ct mul 1 add def
+ /b ct x1 x0 sub mul y1 add y0 sub 2 mul def
+ /c x1 x0 sub dup mul y1 y0 sub dup mul add r dup mul sub def
+ a b c ldiagqroots dup
+ 0 eq
+ { pop
+ 0
+ }
+ { 1 eq
+ { y1 add /yb exch def
+ yb y1 sub ct mul x1 add /xb exch def
+ xb yb 1
+ }
+ { y1 add /ya exch def
+ ya y1 sub ct mul x1 add /xa exch def
+ y1 add /yb exch def
+ yb y1 sub ct mul x1 add /xb exch def
+ xa ya xb yb 2
+ } ifelse
+ } ifelse
+ } ifelse
+ end
+ % (Leaving ldiagcircleintersect) 1 ldiagdebugprint
+} def
+
+% find line which is the perpendicular bisector of two points, defined
+% by two points
+% x1 y1 x2 y2 ldiaglinebetween x3 y3 x4 y4
+/ldiaglinebetween
+{ % (Entering ldiaglinebetween) 4 ldiagdebugprint
+ /y2 exch def /x2 exch def
+ /y1 exch def /x1 exch def
+
+ % let x3, y3 be the point halfway between the two points
+ x1 y1 x2 y2 ldiagpadd 0.5 ldiagpmul
+ /y3 exch def /x3 exch def
+
+ % find a point perpendicular to x3, y3
+ x3 y3 50 x1 y1 x2 y2 ldiagangleto 90 dg add ldiagatangle
+
+ % plus x3 y3 gives the two points
+ x3 y3
+
+ % (Leaving ldiaglinebetween) 4 ldiagdebugprint
+} def
+
+% find <proc>@<string>: <proc> <string> ldiagfindlabel <any> true
+% <proc> <string> false
+/ldiagfindlabel
+{
+ % (Entering ldiagfindlabel) 2 ldiagdebugprint
+ exch dup length 1 ne
+ { exch false
+ % (Leaving ldiagfindabel (length not 1)) 3 ldiagdebugprint
+ }
+ { dup 0 get type /nametype ne
+ { exch false
+ % (Leaving ldiagfindabel (not a name)) 3 ldiagdebugprint
+ }
+ { dup 0 get 50 string cvs (@) ldiagconcat 2 index ldiagconcat dup where
+ { exch get exch pop exch pop cvx exec true
+ % (Leaving ldiagfindlabel with success) 100 ldiagdebugprint
+ }
+ {
+ pop exch false
+ % (Leaving ldiagfindabel (concat not sensible)) 3 ldiagdebugprint
+ } ifelse
+ } ifelse
+ } ifelse
+} bind def
+
+% execute <proc>@<string> or else default: <proc> <string> ldiagdolabel <various>
+/ldiagdolabel
+{
+ % (Entering ldiagdolabel) 2 ldiagdebugprint
+ ldiagfindlabel not
+ {
+ dup (CIRCUM) eq
+ { pop pop pop 0 0
+ }
+ {
+ dup (ANGLE) eq
+ { pop pop 0
+ }
+ { pop cvx exec
+ } ifelse
+ } ifelse
+ } if
+ % (Leaving ldiagdolabel) 2 ldiagdebugprint
+} bind def
+
+% execute a proc depending on whether number is negative, zero, or positive
+% procneg proczero procpos number ldiagsigncase <anything>
+/ldiagsigncase
+{
+ % (Entering ldiagsigncase) 4 ldiagdebugprint
+ dup 0 lt
+ { pop pop pop exec
+ }
+ { 0 gt
+ { exch pop exch pop exec
+ }
+ { pop exch pop exec
+ } ifelse
+ } ifelse
+ % (Leaving ldiagsigncase) 0 ldiagdebugprint
+} bind def
+
+% execute proci if angle is in ith quadrant
+% proc45 proc270 proc180 proc90 proc0 proc315 proc225 proc135 angle ldiagquadcase <anything>
+/ldiagquadcase
+{
+ % (Entering ldiagquadcase) 9 ldiagdebugprint
+ round ldiagfixangle cvi dup 90 mod 0 eq
+ { 90 idiv 4 add } { 90 idiv } ifelse
+ 8 exch roll pop pop pop pop pop pop pop exec
+ % (Leaving ldiagquadcase) 0 ldiagdebugprint
+} bind def
+
+% decode Lout length into PostScript length
+% <string> ldiagdecodelength <number>
+/ldiagdecodelength
+{
+ % (Entering ldiagdecodelength) 1 ldiagdebugprint
+ (f) search
+ { exch pop exch pop cvr ft
+ }
+ { (c) search
+ { exch pop exch pop cvr cm
+ }
+ { (p) search
+ { exch pop exch pop cvr pt
+ }
+ { (m) search
+ { exch pop exch pop cvr em
+ }
+ { (s) search
+ { exch pop exch pop cvr sp
+ }
+ { (v) search
+ { exch pop exch pop cvr vs
+ }
+ { (i) search
+ { exch pop exch pop cvr in
+ }
+ { pop 0
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ % (Leaving ldiagdecodelength) 1 ldiagdebugprint
+} def
+
+% implement aabout function
+% logical form: <circum> <extra> <centre> aabout <point>
+% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx aabout <point>
+/ldiagaabout
+{
+ /centre exch def
+ /extra exch def
+ /circum exch def
+
+ /ZXCTR [ centre ] cvx def
+ /ZFCTR [ circum (CTR) ldiagdolabel ] cvx def
+ /ZAREF ZFCTR ZXCTR ldiagangleto def
+ /ZAMIN 0 dg def
+ /ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN sub
+ circum (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 extra ZAREF ZAMIN sub ldiagatangle
+ ldiagpadd ] cvx def
+
+ /ZAMAX 90 dg def
+ /ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX sub
+ circum (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 extra ZAREF ZAMAX sub ldiagatangle
+ ldiagpadd ] cvx def
+
+ 1 1 20
+ { /xval exch def
+ /ZAMID ZAMIN ZAMAX add 0.5 mul def
+ /ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID sub
+ circum (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 extra ZAREF ZAMID sub ldiagatangle
+ ldiagpadd ] cvx def
+ ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt
+ {
+ /ZAMAX [ ZAMID ] cvx def
+ /ZPMAX [ ZPMID ] cvx def
+ }
+ {
+ /ZAMIN [ ZAMID ] cvx def
+ /ZPMIN [ ZPMID ] cvx def
+ } ifelse
+ } for
+ ZPMID
+} def
+
+% implement cabout function
+% logical form: <circum> <extra> <centre> cabout <point>
+% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx cabout <point>
+/ldiagcabout
+{
+ /centre exch def
+ /extra exch def
+ /circum exch def
+
+ /ZXCTR [ centre ] cvx def
+ /ZFCTR [ circum (CTR) ldiagdolabel ] cvx def
+ /ZAREF ZFCTR ZXCTR ldiagangleto def
+ /ZAMIN 0 dg def
+ /ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN add
+ circum (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 extra ZAREF ZAMIN add ldiagatangle
+ ldiagpadd ] cvx def
+
+ /ZAMAX 90 dg def
+ /ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX add
+ circum (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 extra ZAREF ZAMAX add ldiagatangle
+ ldiagpadd ] cvx def
+
+ 1 1 20
+ { /xval exch def
+ /ZAMID ZAMIN ZAMAX add 0.5 mul def
+ /ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID add
+ circum (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 extra ZAREF ZAMID add ldiagatangle
+ ldiagpadd ] cvx def
+ ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt
+ {
+ /ZAMAX [ ZAMID ] cvx def
+ /ZPMAX [ ZPMID ] cvx def
+ }
+ {
+ /ZAMIN [ ZAMID ] cvx def
+ /ZPMIN [ ZPMID ] cvx def
+ } ifelse
+ } for
+ ZPMID
+} def
+
+% fromarrowlength toarrowlength { from } { to } xindent zindent ldiaglinepath -
+/ldiaglinepath
+{
+ % (entering ldiaglinepath) 0 ldiagdebugprint
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto
+ /FROM@ANGLE ldiagangledef
+ from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd
+ /FROM ldiagpointdef
+
+ FROM@ANGLE /TO@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef
+
+ FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ FROM@ANGLE /LMID@ANGLE ldiagangledef
+
+ /XINDENT xindent FROM LMID ldiagdistance ldiagmin def
+ FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+
+ /ZINDENT zindent TO LMID ldiagdistance ldiagmin def
+ 0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef
+ FROM@ANGLE /LTO@ANGLE ldiagangledef
+
+ direct { FROM TO } { FROM LFROM LMID LTO TO } ifelse
+
+ % (leaving ldiaglinepath) 0 ldiagdebugprint
+} def
+
+% fromarrowlength toarrowlength { from } { to } xindent zindent pathgap ldiagdoublelinepath -
+/ldiagdoublelinepath
+{
+ % (entering ldiagdoublelinepath) 0 ldiagdebugprint
+ /pathgap exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto
+ /FROM@ANGLE ldiagangledef
+ from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd
+ /FROM ldiagpointdef
+
+ FROM@ANGLE /TO@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef
+
+ FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ FROM@ANGLE /LMID@ANGLE ldiagangledef
+
+ /XINDENT xindent FROM LMID ldiagdistance ldiagmin def
+ FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+
+ /ZINDENT zindent TO LMID ldiagdistance ldiagmin def
+ 0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef
+ FROM@ANGLE /LTO@ANGLE ldiagangledef
+
+ direct {
+ FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
+ TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
+ []
+ FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
+ TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
+ }
+ {
+ FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
+ LFROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
+ LMID pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
+ LTO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
+ TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
+ []
+ FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
+ LFROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
+ LMID pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
+ LTO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
+ TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
+ } ifelse
+
+ % (leaving ldiagdoublelinepath) 0 ldiagdebugprint
+} def
+
+% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagacurvepath -
+/ldiagacurvepath
+{
+ % (entering ldiagacurvepath) 0 ldiagdebugprint
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ %/B1 bias 0.02 ft ldiagmax def
+ %/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def
+ %/BIAS B1 B2 ldiagmin def
+ /BIAS bias 0.02 ft ldiagmax def
+ /XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul
+ to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def
+ /XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel
+ ldiagangleto 90 dg sub ldiagatangle ldiagpadd ] cvx def
+ /CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween
+ to (CTR) ldiagdolabel XTOP ldiaglinebetween
+ ldiaglineintersect ] cvx def
+
+ from fromarrowlength [ CTR ] cvx ldiagaabout /FROM ldiagpointdef
+ from (CTR) ldiagdolabel FROM ldiagdistance 0 gt
+ { from (CTR) ldiagdolabel FROM ldiagangleto
+ }
+ { CTR FROM ldiagangleto 90 dg add
+ } ifelse /FROM@ANGLE ldiagangledef
+
+ to toarrowlength [ CTR ] cvx ldiagcabout /TO ldiagpointdef
+ TO to (CTR) ldiagdolabel ldiagdistance 0 gt
+ { TO to (CTR) ldiagdolabel ldiagangleto
+ }
+ { CTR TO ldiagangleto 90 dg add
+ } ifelse /TO@ANGLE ldiagangledef
+
+ /RADIUS CTR FROM ldiagdistance def
+ CTR 0 0 RADIUS CTR FROM ldiagangleto 360 dg CTR TO ldiagangleto
+ add CTR FROM ldiagangleto sub cvi 360 mod 0.5 mul add
+ ldiagatangle ldiagpadd /LMID ldiagpointdef
+ CTR LMID ldiagangleto 90 dg add /LMID@ANGLE ldiagangledef
+
+ /XINDENT xindent FROM LMID ldiagdistance ldiagmin def
+ CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle
+ ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ CTR LFROM ldiagangleto 90 dg add /LFROM@ANGLE ldiagangledef
+
+ /ZINDENT zindent TO LMID ldiagdistance ldiagmin def
+ CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add
+ ldiagatangle ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef
+ CTR LTO ldiagangleto 90 dg add /LTO@ANGLE ldiagangledef
+
+ direct
+ { FROM [CTR] TO }
+ { FROM [CTR] LFROM [CTR] LMID [CTR] LTO [CTR] TO }
+ ifelse
+
+ % (leaving ldiagacurvepath) 0 ldiagdebugprint
+} def
+
+% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagccurvepath -
+/ldiagccurvepath
+{
+ % (entering ldiagccurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ %/B1 bias 0.02 ft ldiagmax def
+ %/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def
+ %/BIAS B1 B2 ldiagmin def
+ /BIAS bias 0.02 ft ldiagmax def
+ /XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul
+ to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def
+ /XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel
+ ldiagangleto 90 dg add ldiagatangle ldiagpadd ] cvx def
+ /CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween
+ to (CTR) ldiagdolabel XTOP ldiaglinebetween ldiaglineintersect ] cvx def
+
+ from fromarrowlength [ CTR ] cvx ldiagcabout /FROM ldiagpointdef
+ from (CTR) ldiagdolabel FROM ldiagdistance 0 gt
+ { from (CTR) ldiagdolabel FROM ldiagangleto }
+ { CTR FROM ldiagangleto 90 dg sub }
+ ifelse /FROM@ANGLE ldiagangledef
+
+ to toarrowlength [ CTR ] cvx ldiagaabout /TO ldiagpointdef
+ TO to (CTR) ldiagdolabel ldiagdistance 0 gt
+ { TO to (CTR) ldiagdolabel ldiagangleto }
+ { CTR TO ldiagangleto 90 dg sub }
+ ifelse /TO@ANGLE ldiagangledef
+
+ /RADIUS [ CTR FROM ldiagdistance ] cvx def
+ CTR 0 0 RADIUS CTR TO ldiagangleto 360 dg CTR FROM ldiagangleto add
+ CTR TO ldiagangleto sub cvi 360 cvi mod 2 div add ldiagatangle
+ ldiagpadd /LMID ldiagpointdef
+ CTR LMID ldiagangleto 90 dg sub /LMID@ANGLE ldiagangledef
+
+ /XINDENT [ xindent FROM LMID ldiagdistance ldiagmin ] cvx def
+ CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd
+ ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ CTR LFROM ldiagangleto 90 dg sub /LFROM@ANGLE ldiagangledef
+
+ /ZINDENT [ zindent TO LMID ldiagdistance ldiagmin ] cvx def
+ CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add ldiagatangle
+ ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef
+ CTR LTO ldiagangleto 90 dg sub /LTO@ANGLE ldiagangledef
+
+ direct
+ { FROM [CTR clockwise] TO }
+ { FROM [CTR clockwise] LFROM [CTR clockwise]
+ LMID [CTR clockwise] LTO [CTR clockwise] TO }
+ ifelse
+ % (leaving ldiagccurvepath) 0 ldiagdebugprint
+} def
+
+
+% farr tarr { from } { to } xindent zindent [frompt] [topt] ldiagbezierpath -
+/ldiagbezierpath
+{
+ % (entering ldiagbezierpath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ cvx /topt exch def
+ cvx /frompt exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ from (CTR) ldiagdolabel frompt ldiagangleto /FROM@ANGLE ldiagangledef
+ from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel
+ ldiagpadd 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd
+ /FROM ldiagpointdef
+
+ topt to (CTR) ldiagdolabel ldiagangleto /TO@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel TO@ANGLE 180 dg add to (CIRCUM) ldiagdolabel
+ ldiagpadd 0 0 toarrowlength TO@ANGLE 180 dg add ldiagatangle ldiagpadd
+ /TO ldiagpointdef
+
+ FROM 0 0 xindent FROM@ANGLE ldiagatangle ldiagpadd
+ /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+
+ TO 0 0 zindent TO@ANGLE 180 dg add ldiagatangle ldiagpadd
+ /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+
+ FROM TO ldiagpadd frompt ldiagpadd topt ldiagpadd 0.25 ldiagpmul
+ /LMID ldiagpointdef
+
+ FROM [frompt topt] TO
+
+ % (leaving ldiagbezierpath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+
+% farr tarr { from } { to } xindent zindent ldiagvhlinepath -
+/ldiagvhlinepath
+{
+ % (entering ldiagvhlinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ /CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def
+ /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
+ /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
+
+ from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef
+ FANG /FROM@ANGLE ldiagangledef
+
+ to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef
+ TANG 180 dg add /TO@ANGLE ldiagangledef
+
+ /FDIST [ FROM CTR ldiagdistance ] cvx def
+ /TDIST [ TO CTR ldiagdistance ] cvx def
+ /XINDENT [ xindent FDIST ldiagmin ] cvx def
+ /ZINDENT [ zindent TDIST ldiagmin ] cvx def
+ FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+ TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+
+ CTR /LMID ldiagpointdef
+ 0 0 1 ft FANG 180 dg add ldiagatangle
+ 0 0 1 ft TANG 180 dg add ldiagatangle
+ ldiagangleto /LMID@ANGLE ldiagangledef
+
+ FROM LFROM LMID LTO TO
+
+ % (leaving ldiagvhlinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent radius ldiagvhcurvepath -
+/ldiagvhcurvepath
+{
+ % (entering ldiagvhcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /radius exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ /CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def
+ /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
+ /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
+
+ from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef
+ FANG /FROM@ANGLE ldiagangledef
+
+ to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef
+ TANG 180 dg add /TO@ANGLE ldiagangledef
+
+ /FDIST [ FROM CTR ldiagdistance ] cvx def
+ /TDIST [ TO CTR ldiagdistance ] cvx def
+ /RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def
+ /XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def
+ /ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def
+
+ FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+ TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+
+ /FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def
+ /TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def
+ /XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd
+ 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def
+ XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd
+ /LMID ldiagpointdef
+ FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef
+
+ FROM LFROM FCTR
+ {[XCTR clockwise]} {} {} {} {} {[XCTR]} {[XCTR clockwise]} {[XCTR]}
+ FCTR TCTR ldiagangleto ldiagquadcase
+ TCTR LTO TO
+
+ % (leaving ldiagvhcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent ldiaghvlinepath -
+/ldiaghvlinepath
+{
+ % (entering ldiaghvlinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ /CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def
+ /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
+ /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
+
+ from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef
+ FANG /FROM@ANGLE ldiagangledef
+
+ to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef
+ TANG 180 dg add /TO@ANGLE ldiagangledef
+
+ /FDIST [ FROM CTR ldiagdistance ] cvx def
+ /TDIST [ TO CTR ldiagdistance ] cvx def
+ /XINDENT [ xindent FDIST ldiagmin ] cvx def
+ /ZINDENT [ zindent TDIST ldiagmin ] cvx def
+
+ FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+ TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+
+ CTR /LMID ldiagpointdef
+ 0 0 1 ft FANG 180 dg add ldiagatangle
+ 0 0 1 ft TANG 180 dg add ldiagatangle ldiagangleto
+ /LMID@ANGLE ldiagangledef
+
+ FROM LFROM LMID LTO TO
+
+ % (leaving ldiaghvlinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent radius ldiaghvcurvepath -
+/ldiaghvcurvepath
+{
+ % (entering ldiaghvcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /radius exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ /CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def
+ /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
+ /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
+
+ from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef
+ FANG /FROM@ANGLE ldiagangledef
+
+ to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef
+ TANG 180 dg add /TO@ANGLE ldiagangledef
+
+ /FDIST [ FROM CTR ldiagdistance ] cvx def
+ /TDIST [ TO CTR ldiagdistance ] cvx def
+ /RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def
+ /XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def
+ /ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def
+ FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+ TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+
+ /FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def
+ /TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def
+ /XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd
+ 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def
+ XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd
+ /LMID ldiagpointdef
+ FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef
+
+ FROM LFROM FCTR
+ {[XCTR]} {} {} {} {} {[XCTR clockwise]} {[XCTR]} {[XCTR clockwise]}
+ FCTR TCTR ldiagangleto ldiagquadcase
+ TCTR LTO TO
+
+ % (leaving ldiaghvcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent bias ldiaglvrlinepath -
+/ldiaglvrlinepath
+{
+ % (entering ldiaglvrlinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef
+ 180 dg /FROM@ANGLE ldiagangledef
+
+ to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef
+ 0 dg /TO@ANGLE ldiagangledef
+
+ /XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def
+ XLEFT FROM exch pop /P1 ldiagpointdef
+ XLEFT TO exch pop /P2 ldiagpointdef
+ /VERT [ P1 P2 ldiagangleto ] cvx def
+ P1 P1 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle
+ ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef
+ P2 P2 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle
+ ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef
+
+ P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ VERT /LMID@ANGLE ldiagangledef
+
+ /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def
+ /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def
+ XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef
+ 180 dg /LFROM@ANGLE ldiagangledef
+ ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef
+ 0 dg /LTO@ANGLE ldiagangledef
+
+ FROM LFROM P1 LMID P2 LTO TO
+
+ % (leaving ldiaglvrlinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent bias radius ldiaglvrcurvepath -
+/ldiaglvrcurvepath
+{
+ % (entering ldiaglvrcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /radius exch def
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd 0 0
+ fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef
+ 180 dg /FROM@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd 0 0
+ toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef
+ 0 dg /TO@ANGLE ldiagangledef
+ /XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def
+ /XP1 [ XLEFT FROM exch pop ] cvx def
+ /XP2 [ XLEFT TO exch pop ] cvx def
+ /VERT [ XP1 XP2 ldiagangleto ] cvx def
+ XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ VERT /LMID@ANGLE ldiagangledef
+ /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def
+ /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def
+ XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef
+ 180 dg /LFROM@ANGLE ldiagangledef
+ ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef
+ 0 dg /LTO@ANGLE ldiagangledef
+ /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def
+ /XP1PRE [ XP1 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def
+ /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def
+ /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def
+ XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd
+ /P1 ldiagpointdef
+ XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef
+ /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def
+ /XP2POST [ XP2 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def
+ /XP2CTR [ XP2PRE 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def
+ XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd
+ /P2 ldiagpointdef
+ XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef
+ FROM LFROM XP1PRE
+ { } { [XP1CTR] P1 [XP1CTR] } { } { [XP1CTR clockwise] P1 [XP1CTR clockwise] }
+ { } { } { } { } VERT round ldiagquadcase
+ XP1POST LMID XP2PRE
+ { } { [XP2CTR] P2 [XP2CTR] } { } { [XP2CTR clockwise] P2 [XP2CTR clockwise] }
+ { } { } { } { } VERT round ldiagquadcase
+ XP2POST LTO TO
+
+ % (leaving ldiaglvrcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent bias ldiagrvllinepath -
+/ldiagrvllinepath
+{
+ % (entering ldiagrvllinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef
+ 0 dg /FROM@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef
+ 180 dg /TO@ANGLE ldiagangledef
+ /XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def
+ XRIGHT FROM exch pop /P1 ldiagpointdef
+ XRIGHT TO exch pop /P2 ldiagpointdef
+ /VERT [ P1 P2 ldiagangleto ] cvx def
+ P1 P1 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle
+ ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef
+ P2 P2 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle
+ ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef
+ P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ VERT /LMID@ANGLE ldiagangledef
+ /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def
+ /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def
+ FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef
+ 0 dg /LFROM@ANGLE ldiagangledef
+ TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef
+ 180 dg /LTO@ANGLE ldiagangledef
+ FROM LFROM P1 LMID P2 LTO TO
+
+ % (leaving ldiagrvllinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+
+% farr tarr { from } { to } xindent zindent bias radius ldiagrvlcurvepath -
+/ldiagrvlcurvepath
+{
+ % (entering ldiagrvlcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /radius exch def
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef
+ 0 dg /FROM@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef
+ 180 dg /TO@ANGLE ldiagangledef
+ /XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def
+ /XP1 [ XRIGHT FROM exch pop ] cvx def
+ /XP2 [ XRIGHT TO exch pop ] cvx def
+ /VERT [ XP1 XP2 ldiagangleto ] cvx def
+ XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ VERT /LMID@ANGLE ldiagangledef
+ /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def
+ /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def
+ FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef
+ 0 dg /LFROM@ANGLE ldiagangledef
+ TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef
+ 180 dg /LTO@ANGLE ldiagangledef
+ /RADIUS [ radius XP1 XP2 ldiagdistance 0.5 mul ldiagmin ] cvx def
+ /XP1PRE [ XP1 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def
+ /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def
+ /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def
+ XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd
+ /P1 ldiagpointdef
+ XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef
+ /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def
+ /XP2POST [ XP2 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def
+ /XP2CTR [ XP2PRE 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def
+ XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd
+ /P2 ldiagpointdef
+ XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef
+ FROM LFROM XP1PRE
+ {} {[XP1CTR clockwise] P1 [XP1CTR clockwise]} {} {[XP1CTR] P1 [XP1CTR]}
+ {} {} {} {} VERT round ldiagquadcase
+ XP1POST LMID XP2PRE
+ {} {[XP2CTR clockwise] P2 [XP2CTR clockwise]} {} {[XP2CTR] P2 [XP2CTR]}
+ {} {} {} {} VERT round ldiagquadcase
+ XP2POST LTO TO
+
+ % (leaving ldiagrvlcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent bias fbias tbias ldiagdwraplinepath -
+/ldiagdwraplinepath
+{
+ % (entering ldiagdwraplinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /tbias exch def
+ /fbias exch def
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop
+ lt { 180 dg } { 0 dg } ifelse ] cvx def
+ from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd 0 0
+ fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef
+ DIRN /FROM@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef
+ DIRN /TO@ANGLE ldiagangledef
+ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd /P1 ldiagpointdef
+ DIRN 180 dg eq { 225 dg } { -45 dg } ifelse /P1@ANGLE ldiagangledef
+ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd
+ /P4 ldiagpointdef
+ DIRN 180 dg eq { 135 dg } { 45 dg } ifelse /P4@ANGLE ldiagangledef
+ /YC [ from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd
+ exch pop to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd
+ exch pop ldiagmin bias 0 ldiagmax sub ] cvx def
+ P1 pop YC /P2 ldiagpointdef
+ P4@ANGLE 180 dg sub /P2@ANGLE ldiagangledef
+ P4 pop YC /P3 ldiagpointdef
+ P1@ANGLE 180 dg sub /P3@ANGLE ldiagangledef
+ /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def
+ FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+ /ZINDENT [ zindent TO P4 ldiagdistance ldiagmin ] cvx def
+ TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+ P2 0.5 ldiagpmul P3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ DIRN 180 dg sub /LMID@ANGLE ldiagangledef
+ FROM P1 P2 P3 P4 TO
+
+ % (leaving ldiagdwraplinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent bias fbias tbias radius
+% ldiagdwrapcurvepath -
+/ldiagdwrapcurvepath
+{
+ % (entering ldiagdwrapcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /radius exch def
+ /tbias exch def
+ /fbias exch def
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
+ { 180 dg } { 0 dg } ifelse ] cvx def
+ /CLOCK [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
+ { anticlockwise } { clockwise } ifelse ] cvx def
+ from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef
+ DIRN /FROM@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef
+ DIRN /TO@ANGLE ldiagangledef
+ /XP1 [ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd ] cvx def
+ /XP4 [ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd ] cvx def
+ /YC [ from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd
+ exch pop to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd
+ exch pop ldiagmin bias 0 ldiagmax sub ] cvx def
+ /XP2 [ XP1 pop YC ] cvx def
+ /XP3 [ XP4 pop YC ] cvx def
+ /RP1 [ radius XP1 FROM ldiagdistance XP1 XP2 ldiagdistance 2 div
+ ldiagmin ldiagmin ] cvx def
+ /XP1PRE [ XP1 0 0 RP1 XP1 FROM ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP1POST [ XP1 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP1CTR [ XP1PRE 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ XP1CTR 0 0 RP1 XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef
+ XP1CTR P1 ldiagangleto DIRN add 90 dg sub /P1@ANGLE ldiagangledef
+ /RP2 [ radius XP1 XP2 ldiagdistance 2 div XP2 XP3 ldiagdistance 2 div
+ ldiagmin ldiagmin ] cvx def
+ /XP2PRE [ XP2 0 0 RP2 XP2 XP1 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP2POST [ XP2 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP2CTR [ XP2PRE 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ XP2CTR 0 0 RP2 XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef
+ XP2CTR P2 ldiagangleto DIRN add 90 dg sub /P2@ANGLE ldiagangledef
+ /RP3 [ radius XP2 XP3 ldiagdistance 2 div XP3 XP4 ldiagdistance 2 div
+ ldiagmin ldiagmin ] cvx def
+ /XP3PRE [ XP3 0 0 RP3 XP3 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP3POST [ XP3 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP3CTR [ XP3PRE 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ XP3CTR 0 0 RP3 XP3CTR XP3 ldiagangleto ldiagatangle ldiagpadd /P3 ldiagpointdef
+ XP3CTR P3 ldiagangleto DIRN add 90 dg sub /P3@ANGLE ldiagangledef
+ /RP4 [ radius XP4 XP3 ldiagdistance 2 div XP4 TO ldiagdistance
+ ldiagmin ldiagmin ] cvx def
+ /XP4PRE [ XP4 0 0 RP4 XP4 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP4POST [ XP4 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP4CTR [ XP4PRE 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ XP4CTR 0 0 RP4 XP4CTR XP4 ldiagangleto ldiagatangle ldiagpadd /P4 ldiagpointdef
+ XP4CTR P4 ldiagangleto DIRN add 90 dg sub /P4@ANGLE ldiagangledef
+ /XINDENT [ xindent FROM XP1PRE ldiagdistance ldiagmin ] cvx def
+ FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+ XP2 0.5 ldiagpmul XP3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ DIRN 180 dg sub /LMID@ANGLE ldiagangledef
+ /ZINDENT [ zindent TO XP4POST ldiagdistance ldiagmin ] cvx def
+ TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+ FROM LFROM
+ XP1PRE [XP1CTR CLOCK] XP1POST
+ XP2PRE [XP2CTR CLOCK] XP2POST
+ LMID
+ XP3PRE [XP3CTR CLOCK] XP3POST
+ XP4PRE [XP4CTR CLOCK] XP4POST
+ LTO TO
+
+ % (leaving ldiagdwrapcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent bias fbias tbias ldiaguwraplinepath -
+/ldiaguwraplinepath
+{
+ % (entering ldiaguwraplinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /tbias exch def
+ /fbias exch def
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
+ { 180 dg } { 0 dg } ifelse ] cvx def
+ from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef
+ DIRN /FROM@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef
+ DIRN /TO@ANGLE ldiagangledef
+ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd /P1 ldiagpointdef
+ DIRN 180 dg eq { 135 dg } { 45 dg } ifelse /P1@ANGLE ldiagangledef
+ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd
+ /P4 ldiagpointdef
+ DIRN 180 dg eq { 225 dg } { -45 dg } ifelse /P4@ANGLE ldiagangledef
+ /YC [ from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd
+ exch pop to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd
+ exch pop ldiagmax bias 0 ldiagmax add ] cvx def
+ P1 pop YC /P2 ldiagpointdef
+ P4@ANGLE 180 dg sub /P2@ANGLE ldiagangledef
+ P4 pop YC /P3 ldiagpointdef
+ P1@ANGLE 180 dg sub /P3@ANGLE ldiagangledef
+ /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def
+ FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+ /ZINDENT [ zindent TO P4 ldiagdistance ldiagmin ] cvx def
+ TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+ P2 0.5 ldiagpmul P3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ DIRN 180 dg sub /LMID@ANGLE ldiagangledef
+ FROM P1 P2 P3 P4 TO
+
+ % (leaving ldiaguwraplinepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% farr tarr { from } { to } xindent zindent bias fbias tbias radius
+% ldiaguwrapcurvepath -
+/ldiaguwrapcurvepath
+{
+ % (entering ldiaguwrapcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+ /radius exch def
+ /tbias exch def
+ /fbias exch def
+ /bias exch def
+ /zindent exch def
+ /xindent exch def
+ cvlit /to exch def
+ cvlit /from exch def
+ /toarrowlength exch def
+ /fromarrowlength exch def
+
+ /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
+ { 180 dg } { 0 dg } ifelse ] cvx def
+ /CLOCK [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
+ { clockwise } { anticlockwise } ifelse ] cvx def
+ from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef
+ DIRN /FROM@ANGLE ldiagangledef
+ to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd
+ 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef
+ DIRN /TO@ANGLE ldiagangledef
+ /XP1 [ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd ] cvx def
+ /XP4 [ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd ] cvx def
+ /YC [ from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd
+ exch pop to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd
+ exch pop ldiagmax bias 0 ldiagmax add ] cvx def
+ /XP2 [ XP1 pop YC ] cvx def
+ /XP3 [ XP4 pop YC ] cvx def
+ /RP1 [ radius XP1 FROM ldiagdistance XP1 XP2 ldiagdistance 2 div
+ ldiagmin ldiagmin ] cvx def
+ /XP1PRE [ XP1 0 0 RP1 XP1 FROM ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP1POST [ XP1 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP1CTR [ XP1PRE 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ XP1CTR 0 0 RP1 XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef
+ XP1CTR P1 ldiagangleto DIRN add 90 dg add /P1@ANGLE ldiagangledef
+ /RP2 [ radius XP1 XP2 ldiagdistance 2 div XP2 XP3 ldiagdistance 2 div
+ ldiagmin ldiagmin ] cvx def
+ /XP2PRE [ XP2 0 0 RP2 XP2 XP1 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP2POST [ XP2 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP2CTR [ XP2PRE 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ XP2CTR 0 0 RP2 XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef
+ XP2CTR P2 ldiagangleto DIRN add 90 dg add /P2@ANGLE ldiagangledef
+ /RP3 [ radius XP2 XP3 ldiagdistance 2 div XP3 XP4 ldiagdistance 2 div
+ ldiagmin ldiagmin ] cvx def
+ /XP3PRE [ XP3 0 0 RP3 XP3 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP3POST [ XP3 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP3CTR [ XP3PRE 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ XP3CTR 0 0 RP3 XP3CTR XP3 ldiagangleto ldiagatangle ldiagpadd /P3 ldiagpointdef
+ XP3CTR P3 ldiagangleto DIRN add 90 dg add /P3@ANGLE ldiagangledef
+ /RP4 [ radius XP4 XP3 ldiagdistance 2 div XP4 TO ldiagdistance
+ ldiagmin ldiagmin ] cvx def
+ /XP4PRE [ XP4 0 0 RP4 XP4 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP4POST [ XP4 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ /XP4CTR [ XP4PRE 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def
+ XP4CTR 0 0 RP4 XP4CTR XP4 ldiagangleto ldiagatangle ldiagpadd /P4 ldiagpointdef
+ XP4CTR P4 ldiagangleto DIRN add 90 dg add /P4@ANGLE ldiagangledef
+ /XINDENT [ xindent FROM XP1PRE ldiagdistance ldiagmin ] cvx def
+ FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef
+ FROM@ANGLE /LFROM@ANGLE ldiagangledef
+ XP2 0.5 ldiagpmul XP3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
+ DIRN 180 dg sub /LMID@ANGLE ldiagangledef
+ /ZINDENT [ zindent TO XP4POST ldiagdistance ldiagmin ] cvx def
+ TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef
+ TO@ANGLE /LTO@ANGLE ldiagangledef
+ FROM LFROM
+ XP1PRE [XP1CTR CLOCK] XP1POST
+ XP2PRE [XP2CTR CLOCK] XP2POST
+ LMID
+ XP3PRE [XP3CTR CLOCK] XP3POST
+ XP4PRE [XP4CTR CLOCK] XP4POST
+ LTO TO
+
+ % (leaving ldiaguwrapcurvepath) 0 ldiagdebugprint
+ % count ( stack size is) 1 ldiagdebugprint pop
+} def
+
+% shape and labels of the @SolidArrowHead symbol
+% - ldiagsolidarrowhead -
+/ldiagsolidarrowhead
+{
+ 0 0 xsize ysize 0.5 mul 0 ysize
+} def
+
+% shape and labels of the @OpenArrowHead symbol
+% <pathwidth> ldiagopenarrowhead -
+/ldiagopenarrowhead
+{
+ /pathwidth exch def
+ /PSW [ 0 0 ] cvx def
+ /PNW [ 0 ysize ] cvx def
+ /PE [ xsize ysize 0.5 mul ] cvx def
+ /REL [ 0 0 pathwidth PE PNW ldiagangleto 90 add ldiagatangle ] cvx def
+ /PNA [ 0 ysize 0.5 mul pathwidth 0.5 mul add ] cvx def
+ /PSA [ 0 ysize 0.5 mul pathwidth 0.5 mul sub ] cvx def
+ /PNI [ PNA PNA xsize 0 ldiagpadd PNW REL ldiagpadd
+ PE REL ldiagpadd ldiaglineintersect ] cvx def
+ /PSI [ 0 pathwidth PNI ldiagpsub ] cvx def
+
+ PSW PE PNW PNI PNA PSA PSI PSW
+} def
+
+% shape and labels of the @HalfOpenArrowHead symbol
+% <pathwidth> ldiaghalfopenarrowhead -
+/ldiaghalfopenarrowhead
+{
+ /pathwidth exch def
+ 0 0
+ xsize ysize 0.5 mul
+ 0 ysize
+ xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul add
+ 0 ysize 0.5 mul pathwidth 0.5 mul add
+ 0 ysize 0.5 mul pathwidth 0.5 mul sub
+ xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul sub
+ 0 0
+} def
+
+% shape and labels of the @SolidCurvedArrowHead symbol
+% - ldiagsolidcurvedarrowhead -
+/ldiagsolidcurvedarrowhead
+{
+ 0 0
+ [0 0 xsize ysize 0.5 mul ldiaglinebetween
+ xsize 0 xsize ysize ldiaglineintersect clockwise]
+ xsize ysize 0.5 mul
+ [xsize ysize 0.5 mul 0 ysize ldiaglinebetween
+ xsize 0 xsize ysize ldiaglineintersect clockwise]
+ 0 ysize
+} def
+
+% shape and labels of the @OpenCurvedArrowHead symbol
+% <pathwidth> ldiagopencurvedarrowhead -
+/ldiagopencurvedarrowhead
+{
+ /pathwidth exch def
+ /LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween
+ xsize 0 xsize ysize ldiaglineintersect
+ ] cvx def
+ /UR [ xsize ysize 0.5 mul 0 ysize ldiaglinebetween
+ xsize 0 xsize ysize ldiaglineintersect
+ ] cvx def
+ /PW2 [ pathwidth 0.5 mul ] cvx def
+ /UMID [
+ 0 ysize 0.5 mul PW2 add
+ xsize ysize 0.5 mul PW2 add
+ 0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle
+ ldiagpadd 0 ysize ldiaglineintersect
+ ] cvx def
+ /LMID [ 0 pathwidth UMID ldiagpsub ] cvx def
+ 0 0
+ [LR clockwise]
+ xsize ysize 0.5 mul
+ [UR clockwise]
+ 0 ysize
+ UMID
+ 0 ysize 0.5 mul PW2 add
+ 0 ysize 0.5 mul PW2 sub
+ LMID
+ 0 0
+} def
+
+% shape and labels of the @HalfOpenCurvedArrowHead symbol
+% <pathwidth> ldiaghalfopencurvedarrowhead -
+/ldiaghalfopencurvedarrowhead
+{
+ /pathwidth exch def
+ /LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween
+ xsize 0 xsize ysize ldiaglineintersect
+ ] cvx def
+ /UR [ xsize ysize 0.5 mul 0 ysize ldiaglinebetween
+ xsize 0 xsize ysize ldiaglineintersect
+ ] cvx def
+ /BR [ 0 0 LR 0 ysize UR ldiaglineintersect ] cvx def
+ /BRAD [ 0 0 BR ldiagdistance ] cvx def
+ /PW2 [ pathwidth 0.5 mul ] cvx def
+ /XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def
+ /UMID [ BR XDIST PW2 ldiagpadd ] cvx def
+ /LMID [ BR XDIST 0 PW2 sub ldiagpadd ] cvx def
+ 0 0
+ [LR clockwise]
+ xsize ysize 0.5 mul
+ [UR clockwise]
+ 0 ysize
+ [BR clockwise]
+ UMID
+ 0 ysize 0.5 mul PW2 add
+ 0 ysize 0.5 mul PW2 sub
+ LMID
+ [BR clockwise]
+ 0 0
+} def
+
+end
+%%EndResource
diff --git a/include/doc b/include/doc
new file mode 100644
index 0000000..7dda601
--- /dev/null
+++ b/include/doc
@@ -0,0 +1,353 @@
+###############################################################################
+# #
+# Lout setup file for ordinary documents #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# @SysInclude commands for standard packages. #
+# #
+###############################################################################
+
+ @SysInclude { fontdefs } # font definitions
+ @SysInclude { langdefs } # language definitions
+ @SysInclude { bsf } # BasicSetup package
+ @SysInclude { dsf } # DocumentSetup package
+ @SysInclude { docf } # OrdinarySetup extension
+
+
+###############################################################################
+# #
+# @Include command for reading personal definitions from current directory. #
+# #
+###############################################################################
+
+ @Include { mydefs }
+
+
+###############################################################################
+# #
+# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @BasicSetup
+ # @InitialFont { Times Base 12p } # initial font
+ # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}}
+ # @InitialSpace { lout } # initial space style
+ # @InitialLanguage { English } # initial language
+ # @InitialColour { black } # initial colour
+ # @OptimizePages { No } # optimize page breaks?
+ # @HeadingFont { Bold } # font for @Heading
+ # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs
+ # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP
+ # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays
+ # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent
+ # @DefaultIndent { 0.5rt } # @Display indent
+ # @DisplayNumStyle { (num) } # style of display numbers
+ # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent
+ # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent
+ # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists
+ # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items
+ # @ListIndent { 0s } # indent of list items
+ # @ListRightIndent { 0s } # right indent of list items
+ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags
+ # @NumberSeparator { . } # separates nums like 2.3.7
+}
+
+
+###############################################################################
+# #
+# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @DocumentSetup
+ # @PageType { A4 @OrIfPlain Other} # page type (width, height)
+ # @PageWidth { 80s } # page width if type Other
+ # @PageHeight { 66f } # page height if type Other
+ # @PageOrientation { Portrait } # Portrait, Landscape, etc.
+ # @PageBackground { } # background of each page
+ # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages
+ # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages
+ # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages
+ # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages
+ # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages
+ # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages
+ # @PageBoxType { None } # None Box CurveBox ShadowBox
+ # @PageBoxMargin { 1.00c } # page box margin
+ # @PageBoxLineWidth { } # page box line thickness
+ # @PageBoxPaint { none } # page box paint
+ # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox
+ # @ColumnNumber { 1 } # number of columns (1 to 10)
+ # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap
+
+ # @FigureLocation { PageTop } # default figure location
+ # @TableLocation { PageTop } # default table location
+ # @FigureFormat { @CC @Body } # default figure format
+ # @TableFormat { @CC @Body } # default table format
+ # @FigureWord { figure } # "Figure" word else anything
+ # @TableWord { table } # "Table" word else anything
+ # @FigureNumbers { Arabic } # method of numbering figures
+ # @TableNumbers { Arabic } # method of numbering tables
+ # @FigureCaptionPos { Below } # Above or Below
+ # @TableCaptionPos { Below } # Above or Below
+ # @CaptionFont { } # figure, table caption font
+ # @CaptionBreak { } # figure, table caption break
+ # @CaptionFormat { @B { number @DotSep @OneCol } } # figure, table caption format
+ # @MakeFigureContents { No } # list of figures at start
+ # @MakeTableContents { No } # list of tables at start
+ # @MakeContents { No } # make contents? Yes or No
+ # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry
+ # @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry
+ # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry
+ # @ContentsFont { Bold } # font for major entry
+ # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry
+ # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry
+ # @ContentsFormat { number @DotSep title } # contents entry format
+ # @ContentsLeader { .. } # leader symbol in contents
+ # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders
+ # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width
+ # @MakeReferences { Yes } # make references? Yes or No
+ # @RefCiteStyle { [cite] } # citation style
+ # @RefCiteLabels { @RefNum } # citation items
+ # @RefNumbers { Arabic } # reference numbers
+ # @RefListFormat { Labels } # NoLabels, Labels, etc.
+ # @RefListLabels { [@RefNum] } # ref list label format
+ # @RefListTitle { references } # title of reference list
+ # @ChapRefListTitle { references } # title of chapter ref list
+ # @RefListIndent { 0s } # indent to left of labels
+ # @RefListRightIndent { 0s } # indent to right of items
+ # @RefListGap { @ListGap } # gap between ref list items
+ # @RefListFont { } # font used in reference list
+ # @RefListBreak { } # break style of ref list
+ # @RefListLabelWidth { @ListLabelWidth } # Labels column width
+ # @RefListSortKey { @Tag } # sorting key
+ # @MakeIndex { No } # make index? Yes or No
+ # @IndexFont { } # index entries font
+ # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexColumnNumber { 2 } # index columns (1 to 10)
+ # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap
+ # @MakeIndexA { No } # make index A? Yes or No
+ # @IndexAFont { } # index A entries font
+ # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexAColumnNumber { 2 } # index A columns (1 to 10)
+ # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap
+ # @MakeIndexB { No } # make index B? Yes or No
+ # @IndexBFont { } # index B entries font
+ # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexBColumnNumber { 2 } # index B columns (1 to 10)
+ # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap
+ # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures
+ # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text
+ # @FootNoteNumbers { Arabic } # footnote numbers
+ # @FootNoteThrough { No } # numbered through chapter?
+ # @FootNoteLocation { ColFoot } # where the footnote appears
+ # @FootNoteFont { 0.80f } # font for footnotes
+ # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes
+ # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format
+ # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line
+ # @FootAboveGap { @DisplayGap } # gap above footnote line
+ # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes
+ # @MarginNoteFont { 0.80f } # font of margin notes
+ # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes
+ # @MarginNoteHGap { 0.5c } # horizontal gap to notes
+ # @MarginNoteVGap { @DisplayGap } # min vertical gap between
+ # @MarginNoteWidth { 1.50c } # width of margin notes
+ # @EndNoteNumbers { Arabic } # endnote numbers
+ # @EndNoteFont { 0.80f } # font of endnotes
+ # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes
+ # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format
+ # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes
+ # @TheoremWord { theorem } # "Theorem" word, etc.
+ # @TheoremTitleFormat { (title) } # only if title present
+ # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @DefinitionWord { definition } # "Definition" word, etc.
+ # @DefinitionTitleFormat { (title) } # only if title present
+ # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ClaimWord { claim } # "Claim" word, etc.
+ # @ClaimTitleFormat { (title) } # only if title present
+ # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @PropositionWord { proposition } # "Proposition" word, etc.
+ # @PropositionTitleFormat { (title) } # only if title present
+ # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @LemmaWord { lemma } # "Lemma" word, etc.
+ # @LemmaTitleFormat { (title) } # only if title present
+ # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @CorollaryWord { corollary } # "Corollary" word, etc.
+ # @CorollaryTitleFormat { (title) } # only if title present
+ # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ExampleWord { example } # "Example" word, etc.
+ # @ExampleTitleFormat { (title) } # only if title present
+ # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ProofWord { proof } # "Proof" word, etc.
+ # @PageHeaders { Simple } # None Simple Titles NoTitles
+ # @PageNumbers { Arabic } # page numbers
+ # @FirstPageNumber { 1 } # number of first page
+ # @IntroPageNumbers { Roman } # intro page numbers
+ # @IntroFirstPageNumber{ 1 } # number of first intro page
+ # @StructPageNums { No } # make structured page numbers
+
+ # @OddTop { @Centre{- @PageNum -} } # Simple page headers
+ # @OddFoot { @Null }
+ # @EvenTop { @Centre{- @PageNum -} }
+ # @EvenFoot { @Null }
+ # @StartOddTop { @Null }
+ # @StartOddFoot { @Null }
+ # @StartEvenTop { @Null }
+ # @StartEvenFoot { @Null }
+ # @IntroOddTop { @Null }
+ # @IntroOddFoot { @Centre @PageNum }
+ # @IntroEvenTop { @Null }
+ # @IntroEvenFoot { @Centre @PageNum }
+ # @IntroStartOddTop { @Null }
+ # @IntroStartOddFoot { @Null }
+ # @IntroStartEvenTop { @Null }
+ # @IntroStartEvenFoot { @Null }
+
+ # Titles, NoTitles headers
+ # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum }
+ # @RunningOddFoot { @Null }
+ # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} }
+ # @RunningEvenFoot { @Null }
+ # @RunningStartOddTop { @Null }
+ # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ # @RunningStartEvenTop { @Null }
+ # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ # @RunningIntroOddTop { @Null }
+ # @RunningIntroOddFoot { @Right @PageNum }
+ # @RunningIntroEvenTop { @Null }
+ # @RunningIntroEvenFoot { @PageNum }
+ # @RunningIntroStartOddTop { @Null }
+ # @RunningIntroStartOddFoot { @Null }
+ # @RunningIntroStartEvenTop { @Null }
+ # @RunningIntroStartEvenFoot { @Null }
+}
+
+
+###############################################################################
+# #
+# The @OrdinarySetup @Use clause - options specific to ordinary documents. #
+# #
+###############################################################################
+
+@Use { @OrdinarySetup
+ # @IndexWord { index } # word for "Index" word etc.
+ # @IndexAWord { index } # word for "Index" (A)
+ # @IndexBWord { index } # word for "Index" (B)
+ # @AppendixWord { appendix } # word for "Appendix"
+ # @SectionNumbers { Arabic } # kind of section numbers
+ # @FirstSectionNumber { 1 } # first section num (Arabic)
+ # @SubSectionNumbers { Arabic } # kind of subsection numbers
+ # @FirstSubSectionNumber { 1 } # first subsect num (Arabic)
+ # @SubSubSectionNumbers { Arabic } # kind of sub-subsect numbers
+ # @FirstSubSubSectionNumber { 1 } # first subsub. num (Arabic)
+ # @AppendixNumbers { UCAlpha } # kind of appendix numbers
+ # @FirstAppendixNumber { 1 } # first appendix num (Arabic)
+ # @SubAppendixNumbers { Arabic } # kind of subappendix numbers
+ # @FirstSubAppendixNumber { 1 } # first sub-app. num (Arabic)
+ # @SubSubAppendixNumbers { Arabic } # kind of sub-subapp. numbers
+ # @FirstSubSubAppendixNumber { 1 } # first sub-sub. num (Arabic)
+ # @SectionHeadingFont { Bold } # section head font
+ # @SectionHeadingBreak { ragged 1.2fx nohyphen } # section head break
+ # @SectionHeadingFormat { number @DotSep title } # section head fmt
+ # @SubSectionHeadingFont { Bold } # subsect head font
+ # @SubSectionHeadingBreak { ragged 1.2fx nohyphen } # subsect head break
+ # @SubSectionHeadingFormat { number @DotSep title } # subsect head fmt
+ # @SubSubSectionHeadingFont { Slope } # sub-ss. head font
+ # @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } # sub-ss. head break
+ # @SubSubSectionHeadingFormat { number @DotSep title } # sub-ss. head fmt
+ # @AppendixHeadingFont { Bold } # appendix head font
+ # @AppendixHeadingBreak { ragged 1.2fx nohyphen } # appendix head break
+ # @AppendixHeadingFormat { number @DotSep title } # appendix head fmt
+ # @SubAppendixHeadingFont { Bold } # subapp. head font
+ # @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } # subapp. head break
+ # @SubAppendixHeadingFormat { number @DotSep title } # subapp. head format
+ # @SubSubAppendixHeadingFont { Slope } # sub-sa. head font
+ # @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } # sub-sa. head break
+ # @SubSubAppendixHeadingFormat{ number @DotSep title } # sub-sa. head fmt
+ # @ReferencesHeadingFont { Bold } # refs head font
+ # @ReferencesHeadingBreak { ragged 1.2fx nohyphen } # refs head break
+ # @ReferencesHeadingFormat { title } # refs head format
+ # @IndexHeadingFont { Bold } # index head font
+ # @IndexHeadingBreak { ragged 1.2fx nohyphen } # index head break
+ # @IndexHeadingFormat { title } # index head format
+ # @IndexAHeadingFont { Bold } # index A head font
+ # @IndexAHeadingBreak { ragged 1.2fx nohyphen } # index A head break
+ # @IndexAHeadingFormat { title } # index A head fmt
+ # @IndexBHeadingFont { Bold } # index B head font
+ # @IndexBHeadingBreak { ragged 1.2fx nohyphen } # index B head break
+ # @IndexBHeadingFormat { title } # index B head fmt
+ # @SectionGap { 2.0v @OrIfPlain 3f } # between sections
+ # @SubSectionGap { 1.5v @OrIfPlain 2f } # between subsects
+ # @SubSubSectionGap { 1.5v @OrIfPlain 2f } # between sub-subs.
+ # @AppendixGap { 2.0v @OrIfPlain 3f } # between appendices
+ # @SubAppendixGap { 1.5v @OrIfPlain 2f } # between subappendices
+ # @SubSubAppendixGap { 1.5v @OrIfPlain 2f } # between sub-subapps
+ # @SectionInContents { Yes } # add sections to contents
+ # @SubSectionInContents { Yes } # add subsections to contents
+ # @SubSubSectionInContents { No } # add sub-subsects to contents
+ # @AppendixInContents { Yes } # add appendices to contents
+ # @SubAppendixInContents { Yes } # add subappendices to contents
+ # @SubSubAppendixInContents { No } # add sub-subapps to contents
+ # @ReferencesInContents { Yes } # add ref. section to contents
+ # @IndexInContents { Yes } # add index to contents
+ # @IndexAInContents { Yes } # add index A to contents
+ # @IndexBInContents { Yes } # add index B to contents
+ # @SectionNumInTheorems { No } # theorem num has section num
+ # @SubSectionNumInTheorems { No } # theorem num has subsect num
+ # @SubSubSectionNumInTheorems { No } # theorem num has sub-ss. num
+ # @AppendixNumInTheorems { No } # theorem num has appendix num
+ # @SubAppendixNumInTheorems { No } # theorem num has sub-app num
+ # @SubSubAppendixNumInTheorems{ No } # theorem num has sub-sa. num
+ # @SectionNumInDisplays { Yes } # display num has section num
+ # @SubSectionNumInDisplays { No } # display num has subsect num
+ # @SubSubSectionNumInDisplays { No } # display num has sub-ss. num
+ # @AppendixNumInDisplays { Yes } # display num has appendix num
+ # @SubAppendixNumInDisplays { Yes } # display num has sub-app num
+ # @SubSubAppendixNumInDisplays{ No } # display num has sub-sa. num
+ # @SectionNumInFigures { No } # figure num has section num
+ # @SubSectionNumInFigures { No } # figure num has subsect num
+ # @SubSubSectionNumInFigures { No } # figure num has sub-ss. num
+ # @AppendixNumInFigures { No } # figure num has appendix num
+ # @SubAppendixNumInFigures { No } # figure num has sub-app num
+ # @SubSubAppendixNumInFigures { No } # figure num has sub-sa. num
+ # @SectionNumInTables { No } # table num has section num
+ # @SubSectionNumInTables { No } # table num has subsect num
+ # @SubSubSectionNumInTables { No } # table num has sub-ss. num
+ # @AppendixNumInTables { No } # table num has appendix num
+ # @SubAppendixNumInTables { No } # table num has sub-app num
+ # @SubSubAppendixNumInTables { No } # table num has sub-sa. num
+ # @SectionNumInRunners { Yes } # runners have section num
+ # @SubSectionNumInRunners { No } # runners have subsect num
+ # @SubSubSectionNumInRunners { No } # runners have sub-ss. num
+ # @AppendixNumInRunners { Yes } # runners have appendix num
+ # @SubAppendixNumInRunners { No } # runners have sub-app num
+ # @SubSubAppendixNumInRunners { No } # runners have sub-sa. num
+ # @SectionPrefix { } # for structured page nums
+ # @AppendixPrefix { } # for structured page nums
+ # @ReferencesPrefix { } # for structured page nums
+ # @IndexPrefix { } # for structured page nums
+ # @IndexAPrefix { } # for structured page nums
+ # @IndexBPrefix { } # for structured page nums
+}
+
+
+###############################################################################
+# #
+# @Database (and @SysDatabase) clauses go here. #
+# #
+###############################################################################
+
+@SysDatabase @RefStyle { refstyle } # reference printing styles
diff --git a/include/docf b/include/docf
new file mode 100644
index 0000000..dd9f0e6
--- /dev/null
+++ b/include/docf
@@ -0,0 +1,779 @@
+
+###########################################################################
+# #
+# @OrdinarySetup extension to @DocumentSetup. #
+# #
+# Jeffrey H. Kingston #
+# August 1994 #
+# 5 February 1999 #
+# #
+# This package extends DocumentSetup for ordinary documents. #
+# #
+###########################################################################
+
+extend @BasicSetup @DocumentSetup
+export @Doc @Document @Text
+def @OrdinarySetup
+
+ named @IndexWord { index }
+ named @IndexAWord { index }
+ named @IndexBWord { index }
+ named @AppendixWord { appendix }
+
+ named @SectionNumbers { Arabic }
+ named @FirstSectionNumber { 1 }
+ named @SubSectionNumbers { Arabic }
+ named @FirstSubSectionNumber { 1 }
+ named @SubSubSectionNumbers { Arabic }
+ named @FirstSubSubSectionNumber { 1 }
+ named @AppendixNumbers { UCAlpha }
+ named @FirstAppendixNumber { 1 }
+ named @SubAppendixNumbers { Arabic }
+ named @FirstSubAppendixNumber { 1 }
+ named @SubSubAppendixNumbers { Arabic }
+ named @FirstSubSubAppendixNumber { 1 }
+
+ named @SectionHeadingFont { Bold }
+ named @SectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SectionHeadingFormat
+ left number right title { number @Sep title }
+
+ named @SubSectionHeadingFont { Bold }
+ named @SubSectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSectionHeadingFormat
+ left number right title { number @Sep title }
+
+ named @SubSubSectionHeadingFont { Slope }
+ named @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSubSectionHeadingFormat
+ left number right title { number @Sep title }
+
+ named @AppendixHeadingFont { Bold }
+ named @AppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @AppendixHeadingFormat
+ left number right title { number @Sep title }
+
+ named @SubAppendixHeadingFont { Bold }
+ named @SubAppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubAppendixHeadingFormat
+ left number right title { number @Sep title }
+
+ named @SubSubAppendixHeadingFont { Slope }
+ named @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSubAppendixHeadingFormat
+ left number right title { number @Sep title }
+
+ named @ReferencesHeadingFont { Bold }
+ named @ReferencesHeadingBreak { ragged 1.2fx nohyphen }
+ named @ReferencesHeadingFormat
+ right title { title }
+
+ named @IndexHeadingFont { Bold }
+ named @IndexHeadingBreak { ragged 1.2fx nohyphen }
+ named @IndexHeadingFormat
+ right title { title }
+
+ named @IndexAHeadingFont { Bold }
+ named @IndexAHeadingBreak { ragged 1.2fx nohyphen }
+ named @IndexAHeadingFormat
+ right title { title }
+
+ named @IndexBHeadingFont { Bold }
+ named @IndexBHeadingBreak { ragged 1.2fx nohyphen }
+ named @IndexBHeadingFormat
+ right title { title }
+
+ named @SectionGap { 2.0v @OrIfPlain 3f }
+ named @SubSectionGap { 1.5v @OrIfPlain 2f }
+ named @SubSubSectionGap { 1.5v @OrIfPlain 2f }
+ named @AppendixGap { 2.0v @OrIfPlain 3f }
+ named @SubAppendixGap { 1.5v @OrIfPlain 2f }
+ named @SubSubAppendixGap { 1.5v @OrIfPlain 2f }
+
+ named @SectionInContents { Yes }
+ named @SubSectionInContents { Yes }
+ named @SubSubSectionInContents { No }
+ named @AppendixInContents { Yes }
+ named @SubAppendixInContents { Yes }
+ named @SubSubAppendixInContents { No }
+ named @ReferencesInContents { Yes }
+ named @IndexInContents { Yes }
+ named @IndexAInContents { Yes }
+ named @IndexBInContents { Yes }
+
+ named @SectionNumInTheorems { No }
+ named @SubSectionNumInTheorems { No }
+ named @SubSubSectionNumInTheorems { No }
+ named @AppendixNumInTheorems { No }
+ named @SubAppendixNumInTheorems { No }
+ named @SubSubAppendixNumInTheorems { No }
+
+ named @SectionNumInDisplays { Yes }
+ named @SubSectionNumInDisplays { No }
+ named @SubSubSectionNumInDisplays { No }
+ named @AppendixNumInDisplays { Yes }
+ named @SubAppendixNumInDisplays { No }
+ named @SubSubAppendixNumInDisplays { No }
+
+ named @SectionNumInFigures { No }
+ named @SubSectionNumInFigures { No }
+ named @SubSubSectionNumInFigures { No }
+ named @AppendixNumInFigures { No }
+ named @SubAppendixNumInFigures { No }
+ named @SubSubAppendixNumInFigures { No }
+
+ named @SectionNumInTables { No }
+ named @SubSectionNumInTables { No }
+ named @SubSubSectionNumInTables { No }
+ named @AppendixNumInTables { No }
+ named @SubAppendixNumInTables { No }
+ named @SubSubAppendixNumInTables { No }
+
+ named @SectionNumInRunners { Yes }
+ named @SubSectionNumInRunners { No }
+ named @SubSubSectionNumInRunners { No }
+ named @AppendixNumInRunners { Yes }
+ named @SubAppendixNumInRunners { No }
+ named @SubSubAppendixNumInRunners { No }
+
+ named @SectionPrefix { }
+ named @AppendixPrefix { }
+ named @ReferencesPrefix { }
+ named @IndexPrefix { }
+ named @IndexAPrefix { }
+ named @IndexBPrefix { }
+@Begin
+
+ #######################################################################
+ # #
+ # Lists of sections, sub(-sub)sections, appendices, etc. #
+ # #
+ #######################################################################
+
+ def @TextPlace { @Galley }
+
+ export num
+ def @SectionList named @Tag {} right num
+ {
+ @Galley
+ //@SectionGap @SectionList @Next num
+ }
+
+ export num
+ def @SubSectionList named @Tag {} right num
+ {
+ @Galley
+ //@SubSectionGap @SubSectionList @Next num
+ }
+
+ export num
+ def @SubSubSectionList named @Tag {} right num
+ {
+ @Galley
+ //@SubSubSectionGap @SubSubSectionList @Next num
+ }
+
+ export num
+ def @AppendixList named @Tag {} right num
+ {
+ @Galley
+ //@AppendixGap @AppendixList @Next num
+ }
+
+ export num
+ def @SubAppendixList named @Tag {} right num
+ {
+ @Galley
+ //@SubAppendixGap @SubAppendixList @Next num
+ }
+
+ export num
+ def @SubSubAppendixList named @Tag {} right num
+ {
+ @Galley
+ //@SubSubAppendixGap @SubSubAppendixList @Next num
+ }
+
+
+ #######################################################################
+ # #
+ # @SendFull - send full-width text. #
+ # #
+ #######################################################################
+
+ def @SendFull force into { @FullPlace&&following }
+ right x
+ {
+ x
+ }
+
+
+ #######################################################################
+ # #
+ # Document. #
+ # #
+ #######################################################################
+
+ def @Document
+ named @InitialFont { @InitialFont }
+ named @InitialBreak { @InitialBreak }
+ named @InitialSpace { @InitialSpace }
+ named @InitialLanguage { @InitialLanguage }
+ named @PageOrientation { @PageOrientation }
+ named @PageHeaders { @PageHeaders }
+ named @ColumnNumber { @ColumnNumber }
+ named @FirstPageNumber { @FirstPageNumber }
+ named @OptimizePages { @OptimizePages }
+ named @Unpaginated { No }
+ {
+ def @ReferencesPart
+ named @Tag {}
+ {
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { @RefHeading @RefListTitle }
+ headingfont { @ReferencesHeadingFont }
+ headingbreak { @ReferencesHeadingBreak }
+ headingformat { @ReferencesHeadingFormat @Body }
+ incontents { @ReferencesInContents }
+ pnprefix { @ReferencesPrefix }
+ majornum {}
+ majortitle {}
+ minornum {}
+ minortitle { @RefHeading @RefListTitle }
+ inrunners { Yes }
+ sendheader { @Body }
+ aboveheadinggap { 0f }
+ { //@RefListGap @ReferencesSection }
+
+ }
+
+ def @IndexPart
+ named @Tag {}
+ {
+
+ def @Run
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexWord }
+ @MinorNum {}
+ @MinorTitle {}
+ @Owner { @Tag }
+ @Prefix { @IndexPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexWord }
+ headingfont { @IndexHeadingFont }
+ headingbreak { @IndexHeadingBreak }
+ headingformat { @IndexHeadingFormat @Body }
+ incontents { @IndexInContents }
+ pnprefix { @IndexPrefix }
+ inrunners { Yes }
+ majornum {}
+ majortitle {}
+ minornum {}
+ minortitle { index @WordVal @IndexWord }
+ sendheader { @SendFull @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexSection @Run
+
+ }
+
+ def @IndexAPart
+ named @Tag {}
+ {
+ def @Run
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexAWord }
+ @MinorNum {}
+ @MinorTitle {}
+ @Owner { @Tag }
+ @Prefix { @IndexAPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexAWord }
+ headingfont { @IndexAHeadingFont }
+ headingbreak { @IndexAHeadingBreak }
+ headingformat { @IndexAHeadingFormat @Body }
+ incontents { @IndexAInContents }
+ pnprefix { @IndexAPrefix }
+ inrunners { Yes }
+ majornum {}
+ majortitle {}
+ minornum {}
+ minortitle { index @WordVal @IndexAWord }
+ sendheader { @SendFull @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexASection @Run
+
+ }
+
+ def @IndexBPart
+ named @Tag {}
+ {
+ def @Run
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexBWord }
+ @MinorNum {}
+ @MinorTitle {}
+ @Owner { @Tag }
+ @Prefix { @IndexBPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexBWord }
+ headingfont { @IndexBHeadingFont }
+ headingbreak { @IndexBHeadingBreak }
+ headingformat { @IndexBHeadingFormat @Body }
+ incontents { @IndexBInContents }
+ pnprefix { @IndexBPrefix }
+ inrunners { Yes }
+ majornum {}
+ majortitle {}
+ minornum {}
+ minortitle { index @WordVal @IndexBWord }
+ sendheader { @SendFull @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexBSection @Run
+
+ }
+
+ def @DocumentBody force into { @ColPlace&&preceding }
+ named @Optimize { @OptimizePages }
+ {
+ # this whole comment is now obsolete:
+ # It's important that the first component of @DocumentBody be
+ # indefinite. If it was definite, then @DocumentBody would
+ # attach immediately to the first page. This would prevent
+ # @FullWidth from attaching to that page, with the result that
+ # a document starting with @FullWidth would start on page 2!
+
+ // @FootNoteThrough @Do @BeginFootNoteCounter
+ // @TextPlace
+ //@SectionGap @EndFigureList
+ //@SectionGap @EndNoteList 1
+ //@SectionGap @MakeReferences @Do @ReferencesPart
+ // @MakeIndexA @Do @IndexAPart
+ // @MakeIndexB @Do @IndexBPart
+ // @MakeIndex @Do @IndexPart
+ // NonStart @Runner
+ }
+
+ @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language
+ @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour
+ {
+ Yes @BeginAllCounters {}
+ Yes @BeginDisplayCounter {}
+ Yes @BeginFigureCounter {}
+ Yes @BeginTableCounter {}
+ // @BackEnd @Case {
+
+ PlainText @Yield {
+ @Unpaginated @Case {
+
+ { Yes yes } @Yield {
+ @ContinuousPageList
+ @Orient { @PageOrientation }
+ }
+
+ { No no } @Yield {
+ @PageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @PageOrientation }
+ extra { Yes }
+ @FirstPageNumber
+ }
+ }
+ }
+
+ else @Yield {
+ @PageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @PageOrientation }
+ extra { Yes }
+ @FirstPageNumber
+ }
+ }
+ // @DocumentBody
+ }
+ }
+
+ macro @Doc { @Document // }
+
+
+ #######################################################################
+ # #
+ # @Text containing sections, appendices, etc. #
+ # #
+ #######################################################################
+
+ export @ContentsGoesHere @FullWidth
+ @BeginSections @EndSections @Section
+ @BeginAppendices @EndAppendices @Appendix
+ def @Text force into { @TextPlace&&preceding }
+ body @Body
+ {
+
+ def @ContentsGoesHere { @ContentsSection }
+
+ export @ContentsGoesHere
+ def @FullWidth body @Body
+ {
+ def @ContentsGoesHere {}
+
+ @SendFull { Start @Runner // @Body }
+ & NonStart @Runner & &2.1b &
+ }
+
+ def @EndSectionsPlace { @Galley }
+
+ def @EndSections force into { @EndSectionsPlace&&preceding }
+ {}
+
+ macro @BeginSections
+ { //@SectionGap @SectionList @FirstSectionNumber
+ // @EndSectionsPlace //
+ }
+
+ export @BeginSubSections @EndSubSections @SubSection @Title
+ def @Section force into { @SectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSectionsPlace { @Galley }
+
+ def @EndSubSections force into { @EndSubSectionsPlace&&preceding }
+ {}
+
+ macro @BeginSubSections
+ { //@SubSectionGap @SubSectionList @FirstSubSectionNumber
+ // @EndSubSectionsPlace //
+ }
+
+ def @SectionShortNum
+ {
+ @SectionNumbers @Then {
+ @BypassNumber @Dft {
+ @SectionNumbers @Num @SectionList&&@Tag @Open { num }
+ }
+ }
+ }
+
+ export @BeginSubSubSections @EndSubSubSections @SubSubSection
+ def @SubSection force into { @SubSectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSubSectionsPlace { @Galley }
+
+ def @EndSubSubSections force into
+ { @EndSubSubSectionsPlace&&preceding }
+ {}
+
+ macro @BeginSubSubSections
+ { //@SubSubSectionGap
+ @SubSubSectionList @FirstSubSubSectionNumber
+ // @EndSubSubSectionsPlace //
+ }
+
+ def @SubSectionShortNum
+ {
+ @SubSectionNumbers @Then {
+ @BypassNumber @Dft {
+ @SectionShortNum @Join @SubSectionNumbers @Num
+ { @SubSectionList&&@Tag @Open { num } }
+ }
+ }
+ }
+
+ def @SubSubSection force into { @SubSubSectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSubSectionHeadingFont }
+ headingbreak { @SubSubSectionHeadingBreak }
+ headingformat { @Num @SubSubSectionHeadingFormat @Body }
+ incontents { @SubSubSectionInContents }
+ contentsindent { 6f }
+ numbers { @SubSubSectionNumbers }
+ attachnum { @SubSubSectionList&&preceding @Tagged @Tag }
+ retrievenum { @SubSubSectionList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SubSectionShortNum }
+ majornum {}
+ majortitle {}
+ intheorems { @SubSubSectionNumInTheorems }
+ indisplays { @SubSubSectionNumInDisplays }
+ infigures { @SubSubSectionNumInFigures }
+ intables { @SubSubSectionNumInTables }
+ inrunners { @SubSubSectionNumInRunners }
+ @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSectionHeadingFont }
+ headingbreak { @SubSectionHeadingBreak }
+ headingformat { @Num @SubSectionHeadingFormat @Body }
+ incontents { @SubSectionInContents }
+ contentsindent { 3f }
+ numbers { @SubSectionNumbers }
+ attachnum { @SubSectionList&&preceding @Tagged @Tag }
+ retrievenum { @SubSectionList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SectionShortNum }
+ majornum {}
+ majortitle {}
+ intheorems { @SubSectionNumInTheorems }
+ indisplays { @SubSectionNumInDisplays }
+ infigures { @SubSectionNumInFigures }
+ intables { @SubSectionNumInTables }
+ inrunners { @SubSectionNumInRunners }
+ @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SectionHeadingFont }
+ headingbreak { @SectionHeadingBreak }
+ headingformat { @Num @SectionHeadingFormat @Body }
+ incontents { @SectionInContents }
+ numbers { @SectionNumbers }
+ attachnum { @SectionList&&preceding @Tagged @Tag }
+ retrievenum { @SectionList&&@Tag @Open { num } }
+ pnprefix { @SectionPrefix }
+ majornum {}
+ majortitle {}
+ bypassnumber { @BypassNumber }
+ intheorems { @SectionNumInTheorems }
+ indisplays { @SectionNumInDisplays }
+ infigures { @SectionNumInFigures }
+ intables { @SectionNumInTables }
+ inrunners { @SectionNumInRunners }
+ @Body
+
+ }
+
+ def @EndAppendicesPlace { @Galley }
+
+ def @EndAppendices force into { @EndAppendicesPlace&&preceding }
+ {}
+
+ macro @BeginAppendices
+ { //@AppendixGap @AppendixList @FirstAppendixNumber
+ // @EndAppendicesPlace //
+ }
+
+ export @BeginSubAppendices @EndSubAppendices @SubAppendix
+ def @Appendix force into { @AppendixList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubAppendicesPlace { @Galley }
+
+ def @EndSubAppendices force into
+ { @EndSubAppendicesPlace&&preceding }
+ {}
+
+ macro @BeginSubAppendices
+ { //@SubAppendixGap @SubAppendixList @FirstSubAppendixNumber
+ // @EndSubAppendicesPlace //
+ }
+
+ def @AppendixShortNum
+ {
+ @AppendixNumbers @Then {
+ @BypassNumber @Dft {
+ @AppendixNumbers @Num @AppendixList&&@Tag @Open { num }
+ }
+ }
+ }
+
+ export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix
+ def @SubAppendix force into { @SubAppendixList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSubAppendicesPlace { @Galley }
+
+ def @EndSubSubAppendices force into
+ { @EndSubSubAppendicesPlace&&preceding }
+ {}
+
+ macro @BeginSubSubAppendices
+ { //@SubSubAppendixGap
+ @SubSubAppendixList @FirstSubSubAppendixNumber
+ // @EndSubSubAppendicesPlace //
+ }
+
+ def @SubAppendixShortNum
+ {
+ @SubAppendixNumbers @Then {
+ @BypassNumber @Dft {
+ @AppendixShortNum @Join @SubAppendixNumbers @Num
+ { @SubAppendixList&&@Tag @Open { num } }
+ }
+ }
+ }
+
+ def @SubSubAppendix force into {@SubSubAppendixList&&preceding}
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSubAppendixHeadingFont }
+ headingbreak { @SubSubAppendixHeadingBreak }
+ headingformat { @Num @SubSubAppendixHeadingFormat @Body }
+ incontents { @SubSubAppendixInContents }
+ contentsindent { 6f }
+ numbers { @SubSubAppendixNumbers }
+ attachnum { @SubSubAppendixList&&preceding @Tagged @Tag }
+ retrievenum { @SubSubAppendixList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SubAppendixShortNum }
+ majornum {}
+ majortitle {}
+ intheorems { @SubSubAppendixNumInTheorems }
+ indisplays { @SubSubAppendixNumInDisplays }
+ infigures { @SubSubAppendixNumInFigures }
+ intables { @SubSubAppendixNumInTables }
+ inrunners { @SubSubAppendixNumInRunners }
+ @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubAppendixHeadingFont }
+ headingbreak { @SubAppendixHeadingBreak }
+ headingformat { @Num @SubAppendixHeadingFormat @Body }
+ incontents { @SubAppendixInContents }
+ contentsindent { 3f }
+ numbers { @SubAppendixNumbers }
+ attachnum { @SubAppendixList&&preceding @Tagged @Tag }
+ retrievenum { @SubAppendixList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @AppendixShortNum }
+ majornum {}
+ majortitle {}
+ intheorems { @SubAppendixNumInTheorems }
+ indisplays { @SubAppendixNumInDisplays }
+ infigures { @SubAppendixNumInFigures }
+ intables { @SubAppendixNumInTables }
+ inrunners { @SubAppendixNumInRunners }
+ @Body
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @AppendixHeadingFont }
+ headingbreak { @AppendixHeadingBreak }
+ headingformat { @Num @AppendixHeadingFormat @Body }
+ incontents { @AppendixInContents }
+ contentsindent { 0f }
+ word { appendix @WordVal @AppendixWord }
+ numbers { @AppendixNumbers }
+ attachnum { @AppendixList&&preceding @Tagged @Tag }
+ retrievenum { @AppendixList&&@Tag @Open { num } }
+ pnprefix { @AppendixPrefix }
+ majornum {}
+ majortitle {}
+ bypassnumber { @BypassNumber }
+ intheorems { @AppendixNumInTheorems }
+ indisplays { @AppendixNumInDisplays }
+ infigures { @AppendixNumInFigures }
+ intables { @AppendixNumInTables }
+ inrunners { Yes }
+ @Body
+
+ }
+
+ // Start @Runner
+ // @Body
+ // NonStart @Runner
+
+ }
+
+@End @OrdinarySetup
diff --git a/include/dsf b/include/dsf
new file mode 100644
index 0000000..082c59d
--- /dev/null
+++ b/include/dsf
@@ -0,0 +1,4644 @@
+###############################################################################
+# #
+# Lout @DocumentSetup package (Version 3.16) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, 17 July 1991. #
+# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. #
+# Version 3.0 by Jeffrey H. Kingston, 19 April 1994. #
+# Version 3.03 by Jeffrey H. Kingston, 6 May 1995. #
+# Versions 3.04 and 3.05 by Jeffrey H. Kingston, 11 June 1995. #
+# Version 3.05 by Jeffrey H. Kingston, 25 July 1995. #
+# Version 3.07 by Jeffrey H. Kingston, February 1996. #
+# Version 3.10 by Jeffrey H. Kingston, September 1996. #
+# Version 3.11 by Jeffrey H. Kingston, December 1996. #
+# Version 3.13 by Jeffrey H. Kingston, October 1998. #
+# Version 3.16 by Jeffrey H. Kingston, May 1999. #
+# Version 3.17 by Jeffrey H. Kingston, September 1999. #
+# #
+# This Lout package contains the general definitions used by all types of #
+# documents. It needs to be extended (see docf, reportf, bookf, slidesf, #
+# etc.) with definitions for particular document types. Consult "A User's #
+# Guide to the Lout Document Formatting System" for user information. #
+# #
+###############################################################################
+
+extend @BasicSetup
+
+export
+
+ @Runner
+
+ @Figure @Table
+ @FootNote @AnotherFootNote @EndNote
+ @LeftNote @RightNote @OuterNote @InnerNote @Place
+ @Theorem @Proof @EndProof
+ @Definition @Claim @Proposition @Lemma @Corollary @Example
+ @Reference @RefStyle @RefPrint
+ @Ref @NoRef @ChapRef @NoChapRef
+ @Cite @NoCite @ChapCite @NoChapCite
+
+ @IndexA @SubIndexA @SubSubIndexA @RawIndexA
+ @RawSubIndexA @RawSubSubIndexA @IndexABlanks
+
+ @IndexB @SubIndexB @SubSubIndexB @RawIndexB
+ @RawSubIndexB @RawSubSubIndexB @IndexBBlanks
+
+ @Index @SubIndex @SubSubIndex @RawIndex
+ @RawSubIndex @RawSubSubIndex @IndexBlanks
+
+ @BypassContentsEntry @BypassMajorContentsEntry
+ @BypassFigureContentsEntry @BypassTableContentsEntry
+ @BypassReference @BypassChapReference
+ @BypassBeginIndex @BypassRawIndex @BypassEndIndex
+ @BypassBeginIndexA @BypassRawIndexA @BypassEndIndexA
+ @BypassBeginIndexB @BypassRawIndexB @BypassEndIndexB
+
+
+def @DocumentSetup
+ named @PageType { A4 @OrIfPlain Other} # page type (width, height)
+ named @PageWidth { 80s } # page width if type Other
+ named @PageHeight { 66f } # page height if type Other
+ named @PageOrientation { Portrait } # Portrait, Landscape, etc.
+ named @PageBackground { } # background of each page
+ named @TopMargin { 2.50c @OrIfPlain 6f } # top margin of all pages
+ named @FootMargin { 2.50c @OrIfPlain 6f } # bottom margin of all pages
+ named @OddLeftMargin { 2.50c @OrIfPlain 10s } # left margin of odd pages
+ named @OddRightMargin { 2.50c @OrIfPlain 10s } # right margin of odd pages
+ named @EvenLeftMargin { 2.50c @OrIfPlain 10s } # left margin of even pages
+ named @EvenRightMargin { 2.50c @OrIfPlain 10s } # right margin of even pages
+ named @PageBoxType { None } # None Box CurveBox ShadowBox
+ named @PageBoxMargin { 1.00c } # page box margin
+ import @LengthUnits named @PageBoxLineWidth
+ { } # page box line thickness
+ named @PageBoxPaint { none } # page box paint
+ named @PageBoxShadow { 0.60c } # shadow margin if ShadowBox
+ named @ColumnNumber { 1 } # number of columns (1 to 10)
+ named @ColumnGap { 1.00c @OrIfPlain 6s } # column gap
+ named @FigureLocation { PageTop } # default figure location
+ named @TableLocation { PageTop } # default table location
+ named @FigureFormat
+ named @II right x { |@DisplayIndent x | }
+ named @QQ right x { |@DisplayIndent x |@DisplayIndent }
+ named @CC right x { |0.5rt x | }
+ named @RR right x { |1.0rt x | }
+ right @Body
+ { @CC @Body } # default figure format
+ named @TableFormat
+ named @II right x { |@DisplayIndent x | }
+ named @QQ right x { |@DisplayIndent x |@DisplayIndent }
+ named @CC right x { |0.5rt x | }
+ named @RR right x { |1.0rt x | }
+ right @Body
+ { @CC @Body } # default table format
+ named @FigureWord { figure } # "Figure" word else anything
+ named @TableWord { table } # "Table" word else anything
+ named @FigureNumbers { Arabic } # method of numbering figures
+ named @TableNumbers { Arabic } # method of numbering tables
+ named @FigureCaptionPos { Below } # Above or Below
+ named @TableCaptionPos { Below } # Above or Below
+ named @FigureCaptionFont { } # figure caption font
+ named @FigureCaptionBreak { } # figure caption break
+ named @FigureCaptionFormat named word {} named number {} named caption {}
+ { @B { word @NumSep number. &2s } @Insert caption }
+ named @TableCaptionFont { } # figure caption font
+ named @TableCaptionBreak { } # figure caption break
+ named @TableCaptionFormat named word {} named number {} named caption {}
+ { @B { word @NumSep number. &2s } @Insert caption }
+ named @MakeFigureContents { No } # list of figures at start
+ named @MakeTableContents { No } # list of tables at start
+ named @MakeContents { No } # make contents? Yes or No
+ named @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry
+ named @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry
+ named @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry
+ named @ContentsFont { Bold } # font for major entry
+ named @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above part entry
+ named @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below part entry
+ named @ContentsFormat
+ left number
+ right title
+ { number @Sep title } # contents format
+ named @ContentsLeader { .. } # leader symbol in contents
+ named @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders
+ named @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width
+
+ named @MakeReferences { Yes } # make references? Yes or No
+ named @RefCiteStyle right cite { [cite] } # citation style
+ named @RefCiteLabels
+ named @RefNum {}
+ named @Tag {}
+ named @Type {}
+ named @Abstract {}
+ named @Address {}
+ named @Annote {}
+ named @Author {}
+ named @Day {}
+ named @Edition {}
+ named @HowPublished {}
+ named @InAuthor {}
+ named @InTitle {}
+ named @Institution {}
+ named @Journal {}
+ named @Keywords {}
+ named @Label {}
+ named @Month {}
+ named @Note {}
+ named @Number {}
+ named @Organization {}
+ named @Page {}
+ named @Pages {}
+ named @Pinpoint {}
+ named @Publisher {}
+ named @Title {}
+ named @TitleNote {}
+ named @TRType {}
+ named @Volume {}
+ named @Year {}
+ { @RefNum } # citation items
+ named @RefNumbers { Arabic } # reference numbers
+
+ named @RefListFormat { Labels } # NoLabels, Labels,
+ # DropLabels, IntegrateLabels
+ named @RefListLabels
+ named @RefNum {}
+ named @Tag {}
+ named @Type {}
+ named @Abstract {}
+ named @Address {}
+ named @Annote {}
+ named @Author {}
+ named @Day {}
+ named @Edition {}
+ named @HowPublished {}
+ named @InAuthor {}
+ named @InTitle {}
+ named @Institution {}
+ named @Journal {}
+ named @Keywords {}
+ named @Label {}
+ named @Month {}
+ named @Note {}
+ named @Number {}
+ named @Organization {}
+ named @Page {}
+ named @Pages {}
+ named @Pinpoint {}
+ named @Publisher {}
+ named @Title {}
+ named @TitleNote {}
+ named @TRType {}
+ named @Volume {}
+ named @Year {}
+ { [@RefNum] } # ref list label format
+ named @RefListTitle { references } # title of reference list
+ named @ChapRefListTitle { references } # title of chapter ref list
+ named @RefListIndent { 0s } # indent to left of labels
+ named @RefListRightIndent { 0s } # indent to right of items
+ named @RefListGap { @ListGap } # gap between ref list items
+ named @RefListFont { } # font used in reference list
+ named @RefListBreak { } # break style of ref list
+ named @RefListLabelWidth { @ListLabelWidth } # numeric labels column width
+ named @RefListSortKey
+ named @Tag {}
+ named @Type {}
+ named @Abstract {}
+ named @Address {}
+ named @Annote {}
+ named @Author {}
+ named @Day {}
+ named @Edition {}
+ named @HowPublished {}
+ named @InAuthor {}
+ named @InTitle {}
+ named @Institution {}
+ named @Journal {}
+ named @Keywords {}
+ named @Label {}
+ named @Month {}
+ named @Note {}
+ named @Number {}
+ named @Organization {}
+ named @Page {}
+ named @Pages {}
+ named @Pinpoint {}
+ named @Publisher {}
+ named @Title {}
+ named @TitleNote {}
+ named @TRType {}
+ named @Volume {}
+ named @Year {}
+ named ":" { "\037" }
+ { @Tag } # sorting key
+
+ named @MakeIndex { No } # make index? Yes or No
+ named @IndexFont { } # index entries font
+ named @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index entries break
+ named @IndexColumnNumber { 2 } # index columns (1 to 10)
+ named @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap
+ named @MakeIndexA { No } # make index A? Yes or No
+ named @IndexAFont { } # index A entries font
+ named @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index A entries break
+ named @IndexAColumnNumber { 2 } # index A columns (1 to 10)
+ named @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap
+ named @MakeIndexB { No } # make index B? Yes or No
+ named @IndexBFont { } # index B entries font
+ named @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index B entries break
+ named @IndexBColumnNumber { 2 } # index B columns (1 to 10)
+ named @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap
+ named @TopGap { 0.75c @OrIfPlain 2f } # gap between figures
+ named @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text
+
+ named @FootNoteNumbers { Arabic } # footnote numbers
+ named @FootNoteThrough { No } # numbered through chapter?
+ named @FootNoteLocation { ColFoot } # where the footnote appears
+ named @FootNoteFont { 0.80f } # font for footnotes
+ named @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes
+ named @FootNoteFormat left number right body
+ { { number &0.05f } @Insert body } # break for footnotes
+ named @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line
+ named @FootAboveGap { @DisplayGap } # gap above footnote line
+ named @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes
+
+ named @MarginNoteFont { 0.80f } # font of margin notes
+ named @MarginNoteBreak { ragged 1.10fx } # break style of margin notes
+ named @MarginNoteHGap { 0.5c } # horizontal gap to notes
+ named @MarginNoteVGap { @DisplayGap } # min vertical gap between
+ named @MarginNoteWidth { 1.50c } # width of margin notes
+
+ named @EndNoteNumbers { Arabic } # endnote numbers
+ named @EndNoteFont { 0.80f } # font of endnotes
+ named @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes
+ named @EndNoteFormat left number right body
+ { { number &0.05f } @Insert body } # break for endnotes
+ named @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes
+
+ named @TheoremWord { theorem } # "Theorem" word, etc.
+ named @TheoremTitleFormat right title
+ { (title) } # Theorem title format if present
+ named @TheoremFormat named word {} named number {} named title {} named body {} # theorem format
+ { { @B { word @NumSep number title: } &2s } @Insert body }
+ named @DefinitionWord { definition } # "Definition" word, etc.
+ named @DefinitionTitleFormat{ (title) } # Definition title format if present
+ named @DefinitionFormat named word {} named number {} named title {} named body {} # definition format
+ { { @B { word @NumSep number title: } &2s } @Insert body }
+ named @ClaimWord { claim } # "Claim" word, etc.
+ named @ClaimTitleFormat { (title) } # Claim title format if present
+ named @ClaimFormat named word {} named number {} named title {} named body {} # claim format
+ { { @B { word @NumSep number title: } &2s } @Insert body }
+ named @PropositionWord { proposition } # "Proposition" word, etc.
+ named @PropositionTitleFormat{ (title) } # Proposition title format if present
+ named @PropositionFormat named word {} named number {} named title {} named body {} # proposition format
+ { { @B { word @NumSep number title: } &2s } @Insert body }
+ named @LemmaWord { lemma } # "Lemma" word, etc.
+ named @LemmaTitleFormat { (title) } # Lemma title format if present
+ named @LemmaFormat named word {} named number {} named title {} named body {} # lemma format
+ { { @B { word @NumSep number title: } &2s } @Insert body }
+ named @CorollaryWord { corollary } # "Corollary" word, etc.
+ named @CorollaryTitleFormat { (title) } # Corollary title format if present
+ named @CorollaryFormat named word {} named number {} named title {} named body {} # corollary format
+ { { @B { word @NumSep number title: } &2s } @Insert body }
+ named @ExampleWord { example } # "Example" word, etc.
+ named @ExampleTitleFormat { (title) } # Example title format if present
+ named @ExampleFormat named word {} named number {} named title {} named body {} # example format
+ { { @B { word @NumSep number title: } &2s } @Insert body }
+ named @ProofWord { proof } # "Proof" word, etc.
+
+ named @PageHeaders { Simple } # None Simple Titles NoTitles
+ named @PageNumbers { Arabic } # page numbers
+ named @FirstPageNumber { 1 } # number of first page
+ named @IntroPageNumbers { Roman } # intro page numbers
+ named @IntroFirstPageNumber { 1 } # number of first intro page
+ named @StructPageNums { No } # structured page numbers
+
+ named @OddTop right @PageNum { @Centre { - @PageNum - } }
+ named @OddFoot right @PageNum { @Null }
+ named @EvenTop right @PageNum { @Centre { - @PageNum - } }
+ named @EvenFoot right @PageNum { @Null }
+ named @StartOddTop right @PageNum { @Null }
+ named @StartOddFoot right @PageNum { @Null }
+ named @StartEvenTop right @PageNum { @Null }
+ named @StartEvenFoot right @PageNum { @Null }
+
+ named @IntroOddTop right @PageNum { @Null }
+ named @IntroOddFoot right @PageNum { @Centre @PageNum }
+ named @IntroEvenTop right @PageNum { @Null }
+ named @IntroEvenFoot right @PageNum { @Centre @PageNum }
+ named @IntroStartOddTop right @PageNum { @Null }
+ named @IntroStartOddFoot right @PageNum { @Null }
+ named @IntroStartEvenTop right @PageNum { @Null }
+ named @IntroStartEvenFoot right @PageNum { @Null }
+
+ named @RunningOddTop
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @I { @MinorNum @Sep @MinorTitle } @Right @B @PageNum }
+
+ named @RunningOddFoot
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningEvenTop
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @B @PageNum @Right @I { @MajorNum @Sep @MajorTitle } }
+
+ named @RunningEvenFoot
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningStartOddTop
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningStartOddFoot
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Centre { Bold 0.8f } @Font @PageNum }
+
+ named @RunningStartEvenTop
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningStartEvenFoot
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Centre { Bold 0.8f } @Font @PageNum }
+
+
+ named @RunningIntroOddTop
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningIntroOddFoot
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Right @PageNum }
+
+ named @RunningIntroEvenTop
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningIntroEvenFoot
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @PageNum }
+
+ named @RunningIntroStartOddTop
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningIntroStartOddFoot
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningIntroStartEvenTop
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+ named @RunningIntroStartEvenFoot
+ named @MajorNum {} named @MajorTitle {}
+ named @MinorNum {} named @MinorTitle {} right @PageNum
+ { @Null }
+
+
+@Begin
+
+
+ ###########################################################################
+ # #
+ # @Protect x #
+ # #
+ # Like @CNP, this reserves space on the current page or else makes sure #
+ # x appears on the following page. Lookahead is proportional to font #
+ # size. #
+ # #
+ ###########################################################################
+
+ def @Protect right x { 3.0f @High //0io // x }
+
+
+ ###########################################################################
+ # #
+ # @HLine #
+ # #
+ # Draws a horizontal line to fill available space. #
+ # #
+ ###########################################################################
+
+ def @HLine
+ {
+ @BackEnd @Case {
+ PlainText @Yield { "-" @PlainGraphic 1f @High }
+ PostScript @Yield { {0 0 moveto xsize 0 lineto stroke} @Graphic {} }
+ PDF @Yield { {0 0 m __xsize 0 l S} @Graphic {} }
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # x @WordVal y #
+ # #
+ # Returns @Word&&x if x == y, otherwise y. #
+ # #
+ ###########################################################################
+
+ def @WordVal
+ left x
+ right y
+ {
+ y @Case {
+ x @Yield @Word&&x
+ else @Yield y
+ }
+ }
+
+ ###########################################################################
+ # #
+ # x @Dft y #
+ # #
+ # This returns x unless its value is "dft", in which case it returns y. #
+ # Useful for defaulting the value of one parameter to another. #
+ # #
+ ###########################################################################
+
+ def @Dft
+ left x
+ right y
+ {
+ x @Case {
+ dft @Yield y
+ else @Yield x
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # x @Do y #
+ # #
+ # This returns @Null if x is No or None, otherwise y. #
+ # #
+ ###########################################################################
+
+ def @Do
+ left x
+ right y
+ {
+ x @Case {
+ { No None } @Yield @Null
+ else @Yield y
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # x @NoDo y #
+ # #
+ # Negation of @Do: This returns y if x is No or None, otherwise @Null. #
+ # #
+ ###########################################################################
+
+ def @NoDo
+ left x
+ right y
+ {
+ x @Case {
+ { No None } @Yield y
+ else @Yield @Null
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # x @Then y #
+ # #
+ # This returns the empty object if x is No or None, otherwise y. #
+ # #
+ ###########################################################################
+
+ def @Then
+ left x
+ right y
+ {
+ x @Case {
+ { No None } @Yield {}
+ else @Yield y
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # x @NoThen y #
+ # #
+ # Negation of @Then: returns y if x is No or None, otherwise empty. #
+ # #
+ ###########################################################################
+
+ def @NoThen
+ left x
+ right y
+ {
+ x @Case {
+ { No None } @Yield y
+ else @Yield {}
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Number markers. #
+ # #
+ ###########################################################################
+
+ def @Num
+ left numtype
+ right num
+ {
+ numtype @Case {
+ None @Yield {}
+ Arabic @Yield num
+ Roman @Yield @Roman&&num
+ UCRoman @Yield @UCRoman&&num
+ Alpha @Yield @Alpha&&num
+ UCAlpha @Yield @UCAlpha&&num
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # @MakePageNum #
+ # #
+ # Make a page number. #
+ # #
+ ###########################################################################
+
+ def @MakePageNum
+ named numbers {}
+ named rawnum {}
+ named prefix {}
+ named owner {}
+ {
+ def @OwnerNum { @PageMarker&&owner @Open { rawnum } }
+
+ def @StructNum { @FirstPageNumber @Plus rawnum @Minus @OwnerNum }
+
+ @PageHeaders.@StructPageNums @Case {
+ { Titles.Yes NoTitles.Yes } @Yield {
+ prefix @Join { numbers @Num @StructNum } }
+ else @Yield { numbers @Num rawnum }
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Page size, margins, and boxes. This code culminates in @OddPage x #
+ # and @EvenPage x, which produce one odd or even page containing x. #
+ # #
+ ###########################################################################
+
+ def @Width
+ {
+ @PageType @Case {
+ Letter @Yield 612p
+ Tabloid @Yield 792p
+ Ledger @Yield 1224p
+ Legal @Yield 612p
+ Statement @Yield 396p
+ Executive @Yield 540p
+ A3 @Yield 842p
+ A4 @Yield 595p
+ A5 @Yield 420p
+ B4 @Yield 729p
+ B5 @Yield 516p
+ Folio @Yield 612p
+ Quarto @Yield 610p
+ 10x14 @Yield 720p
+ Other @Yield @PageWidth
+ }
+ }
+
+ def @Height
+ {
+ @PageType @Case {
+ Letter @Yield 792p
+ Tabloid @Yield 1224p
+ Ledger @Yield 792p
+ Legal @Yield 1008p
+ Statement @Yield 612p
+ Executive @Yield 720p
+ A3 @Yield 1190p
+ A4 @Yield 842p
+ A5 @Yield 595p
+ B4 @Yield 1032p
+ B5 @Yield 729p
+ Folio @Yield 936p
+ Quarto @Yield 780p
+ 10x14 @Yield 1008p
+ Other @Yield @PageHeight
+ }
+ }
+
+ def @OrientedWidth right @Orient
+ {
+ @Orient @Case {
+ { Portrait ReversePortrait } @Yield @Width
+ { Landscape ReverseLandscape } @Yield @Height
+ }
+ }
+
+ def @OrientedHeight right @Orient
+ {
+ @Orient @Case {
+ { Portrait ReversePortrait } @Yield @Height
+ { Landscape ReverseLandscape } @Yield @Width
+ }
+ }
+
+ def @OrientationAngle right @Orient
+ {
+ @Orient @Case {
+ Portrait @Yield 0d
+ Landscape @Yield 90d
+ ReversePortrait @Yield 180d
+ ReverseLandscape @Yield 270d
+ }
+ }
+
+ def @PageBox right x
+ {
+ @PageBoxType @Case {
+ None @Yield x
+ Box @Yield @Box
+ margin { @PageBoxMargin }
+ paint { @PageBoxPaint }
+ linewidth { @PageBoxLineWidth } x
+ CurveBox @Yield @CurveBox
+ margin { @PageBoxMargin }
+ paint { @PageBoxPaint }
+ linewidth { @PageBoxLineWidth } x
+ ShadowBox @Yield @ShadowBox
+ margin { @PageBoxMargin }
+ paint { @PageBoxPaint }
+ linewidth { @PageBoxLineWidth }
+ shadow { @PageBoxShadow } x
+ }
+ }
+
+ def @DoBackground right @Orient
+ {
+# "LoutPageSet" @Graphic # VT: case PDF produces nothing
+ { @BackEnd @Case {
+ PostScript @Yield "LoutPageSet"
+ else @Yield "% @DoBackground/LoutPageSet UNIMPLEMENTED"
+ }
+ } @Graphic
+ {
+ { @OrientationAngle @Orient } @Rotate
+ { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High
+ { //@TopMargin ||@OddLeftMargin
+ @HExpand @VExpand @PageBackground
+ ||@OddRightMargin //@FootMargin
+ }
+ }
+ }
+
+ def @PageSet right x
+ {
+# "LoutPageSet" @Graphic # VT: case PDF produces nothing
+ { @BackEnd @Case {
+ PostScript @Yield "LoutPageSet"
+ else @Yield "% @DoBackground/LoutPageSet UNIMPLEMENTED"
+ }
+ } @Graphic x
+ }
+
+ def @MargSet
+ left parity
+ right x
+ {
+# { parity "LoutMargSet" } @Graphic x # VT: case PDF produces nothing
+ { @BackEnd @Case {
+ PostScript @Yield { parity "LoutMargSet" }
+ else @Yield "% @MargSet/LoutMargSet UNIMPLEMENTED"
+ }
+ } @Graphic x
+ }
+
+ def @OddPage
+ left extra
+ named @Orient {}
+ right x
+ {
+ # @DoBackground @Orient ||0io
+ @PageSet
+ { @OrientationAngle @Orient } @Rotate
+ { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High
+ { //@TopMargin ||@OddLeftMargin
+ @PageBackground @Background
+ 1 @MargSet
+ @PageBox @HExpand { extra // @VExpand x }
+ ||@OddRightMargin //@FootMargin
+ }
+ }
+
+ def @EvenPage
+ left extra
+ named @Orient {}
+ right x
+ {
+ @PageSet
+ # @DoBackground @Orient ||0io
+ { @OrientationAngle @Orient } @Rotate
+ { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High
+ { //@TopMargin ||@EvenLeftMargin
+ @PageBackground @Background
+ 0 @MargSet
+ @PageBox @HExpand { extra // @VExpand x }
+ ||@EvenRightMargin //@FootMargin
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Definitions for page headers and footers. There are 16 symbols here, #
+ # in the following pattern: #
+ # #
+ # @(- | Running)(- | Intro)(Odd | Even)(Top | Foot)Header #
+ # #
+ # Running means that running headers are to be used. #
+ # Intro means that the header is destined for an introductory page. #
+ # Odd or Even means whether the page number will be odd or even. #
+ # Top or Foot means whether the header is for the top or foot of page. #
+ # #
+ ###########################################################################
+
+ export @Start @MajorNum @MajorTitle @MinorNum @MinorTitle @Owner @Prefix
+ def @Runner
+ left @Start
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ named @Owner {}
+ named @Prefix {}
+ named @Tag {}
+ { @Null
+ }
+
+ def @DupRunner # duplicate previous runner
+ {
+ @Runner&&preceding @Open {
+ NonStart @Runner
+ @MajorNum { @MajorNum }
+ @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum }
+ @MinorTitle { @MinorTitle }
+ @Owner { @Owner }
+ @Prefix { @Prefix }
+ }
+ }
+
+ def @OddTopHeader
+ left @PageHeadersAndStart
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ None.Start @Yield @Null
+ None.NonStart @Yield @Null
+ None.None @Yield @Null
+ Simple.Start @Yield @StartOddTop @PageNum
+ Simple.NonStart @Yield @OddTop @PageNum
+ Simple.None @Yield @Null
+ }
+ }
+
+ def @OddFootHeader
+ left @PageHeadersAndStart
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ None.Start @Yield @Null
+ None.NonStart @Yield @Null
+ None.None @Yield @Null
+ Simple.Start @Yield @StartOddFoot @PageNum
+ Simple.NonStart @Yield @OddFoot @PageNum
+ Simple.None @Yield @Null
+ }
+ }
+
+ def @EvenTopHeader
+ left @PageHeadersAndStart
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ None.Start @Yield @Null
+ None.NonStart @Yield @Null
+ None.None @Yield @Null
+ Simple.Start @Yield @StartEvenTop @PageNum
+ Simple.NonStart @Yield @EvenTop @PageNum
+ Simple.None @Yield @Null
+ }
+ }
+
+ def @EvenFootHeader
+ left @PageHeadersAndStart
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ None.Start @Yield @Null
+ None.NonStart @Yield @Null
+ None.None @Yield @Null
+ Simple.Start @Yield @StartEvenFoot @PageNum
+ Simple.NonStart @Yield @EvenFoot @PageNum
+ Simple.None @Yield @Null
+ }
+ }
+
+ def @IntroOddTopHeader
+ left @PageHeadersAndStart
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ None.Start @Yield @Null
+ None.NonStart @Yield @Null
+ None.None @Yield @Null
+ Simple.Start @Yield @IntroStartOddTop @PageNum
+ Simple.NonStart @Yield @IntroOddTop @PageNum
+ Simple.None @Yield @Null
+ }
+ }
+
+ def @IntroOddFootHeader
+ left @PageHeadersAndStart
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ None.Start @Yield @Null
+ None.NonStart @Yield @Null
+ None.None @Yield @Null
+ Simple.Start @Yield @IntroStartOddFoot @PageNum
+ Simple.NonStart @Yield @IntroOddFoot @PageNum
+ Simple.None @Yield @Null
+ }
+ }
+
+ def @IntroEvenTopHeader
+ left @PageHeadersAndStart
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ None.Start @Yield @Null
+ None.NonStart @Yield @Null
+ None.None @Yield @Null
+ Simple.Start @Yield @IntroStartEvenTop @PageNum
+ Simple.NonStart @Yield @IntroEvenTop @PageNum
+ Simple.None @Yield @Null
+ }
+ }
+
+ def @IntroEvenFootHeader
+ left @PageHeadersAndStart
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ None.Start @Yield @Null
+ None.NonStart @Yield @Null
+ None.None @Yield @Null
+ Simple.Start @Yield @IntroStartEvenFoot @PageNum
+ Simple.NonStart @Yield @IntroEvenFoot @PageNum
+ Simple.None @Yield @Null
+ }
+ }
+
+
+ def @RunningOddTopHeader
+ left @PageHeadersAndStart
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ NoTitles.?? @Yield ??
+ NoTitles.Start @Yield @RunningStartOddTop @PageNum
+ NoTitles.NonStart @Yield @RunningOddTop @PageNum
+ NoTitles.None @Yield @Null
+ Titles.?? @Yield ??
+ Titles.Start @Yield @RunningStartOddTop
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.NonStart @Yield @RunningOddTop
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.None @Yield @Null
+ }
+ }
+
+ def @RunningOddFootHeader
+ left @PageHeadersAndStart
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ NoTitles.?? @Yield @Null
+ NoTitles.Start @Yield @RunningStartOddFoot @PageNum
+ NoTitles.NonStart @Yield @RunningOddFoot @PageNum
+ NoTitles.None @Yield @Null
+ Titles.?? @Yield @Null
+ Titles.Start @Yield @RunningStartOddFoot
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.NonStart @Yield @RunningOddFoot
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.None @Yield @Null
+ }
+ }
+
+ def @RunningEvenTopHeader
+ left @PageHeadersAndStart
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ NoTitles.?? @Yield ??
+ NoTitles.Start @Yield @RunningStartEvenTop @PageNum
+ NoTitles.NonStart @Yield @RunningEvenTop @PageNum
+ NoTitles.None @Yield @Null
+ Titles.?? @Yield ??
+ Titles.Start @Yield @RunningStartEvenTop
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.NonStart @Yield @RunningEvenTop
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.None @Yield @Null
+ }
+ }
+
+ def @RunningEvenFootHeader
+ left @PageHeadersAndStart
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ NoTitles.?? @Yield @Null
+ NoTitles.Start @Yield @RunningStartEvenFoot @PageNum
+ NoTitles.NonStart @Yield @RunningEvenFoot @PageNum
+ NoTitles.None @Yield @Null
+ Titles.?? @Yield @Null
+ Titles.Start @Yield @RunningStartEvenFoot
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.NonStart @Yield @RunningEvenFoot
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.None @Yield @Null
+ }
+ }
+
+ def @RunningIntroOddTopHeader
+ left @PageHeadersAndStart
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ NoTitles.?? @Yield ??
+ NoTitles.Start @Yield @RunningIntroStartOddTop @PageNum
+ NoTitles.NonStart @Yield @RunningIntroOddTop @PageNum
+ NoTitles.None @Yield @Null
+ Titles.?? @Yield ??
+ Titles.Start @Yield @RunningIntroStartOddTop
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.NonStart @Yield @RunningIntroOddTop
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.None @Yield @Null
+ }
+ }
+
+ def @RunningIntroOddFootHeader
+ left @PageHeadersAndStart
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ NoTitles.?? @Yield @Null
+ NoTitles.Start @Yield @RunningIntroStartOddFoot @PageNum
+ NoTitles.NonStart @Yield @RunningIntroOddFoot @PageNum
+ NoTitles.None @Yield @Null
+ Titles.?? @Yield @Null
+ Titles.Start @Yield @RunningIntroStartOddFoot
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.NonStart @Yield @RunningIntroOddFoot
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.None @Yield @Null
+ }
+ }
+
+ def @RunningIntroEvenTopHeader
+ left @PageHeadersAndStart
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ NoTitles.?? @Yield ??
+ NoTitles.Start @Yield @RunningIntroStartEvenTop @PageNum
+ NoTitles.NonStart @Yield @RunningIntroEvenTop @PageNum
+ NoTitles.None @Yield @Null
+ Titles.?? @Yield ??
+ Titles.Start @Yield @RunningIntroStartEvenTop
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.NonStart @Yield @RunningIntroEvenTop
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.None @Yield @Null
+ }
+ }
+
+ def @RunningIntroEvenFootHeader
+ left @PageHeadersAndStart
+ named @MajorNum {}
+ named @MajorTitle {}
+ named @MinorNum {}
+ named @MinorTitle {}
+ right @PageNum
+ {
+ @PageHeadersAndStart @Case {
+ NoTitles.?? @Yield @Null
+ NoTitles.Start @Yield @RunningIntroStartEvenFoot @PageNum
+ NoTitles.NonStart @Yield @RunningIntroEvenFoot @PageNum
+ NoTitles.None @Yield @Null
+ Titles.?? @Yield @Null
+ Titles.Start @Yield @RunningIntroStartEvenFoot
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.NonStart @Yield @RunningIntroEvenFoot
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ @PageNum
+ Titles.None @Yield @Null
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Helper definitions for laying out pages. #
+ # #
+ ###########################################################################
+
+ def @PageTopPlace { @Galley }
+ def @PageFootAndTopPlace { @Galley }
+ def @PageFootNotePlace { @Galley }
+ def @FullPlace { @Galley }
+ def @OddFullPlace { @Galley }
+ def @EvenFullPlace { @Galley }
+ def @FullPagePlace { @Galley }
+ def @EvenFullPagePlace { @Galley }
+ def @EvenPagePlace { @Galley }
+ def @OddFullPagePlace { @Galley }
+ def @ColTopPlace { @Galley }
+ def @ColFootAndTopPlace { @Galley }
+ def @ColPlace { @Galley }
+ def @ColFootNotePlace { @Galley }
+ def @IntroFullPlace { @Galley }
+ def @IntroOddFullPlace { @Galley }
+ def @IntroEvenFullPlace { @Galley }
+ def @IntroColPlace { @Galley }
+ def @IndexPlace { @Galley }
+ def @IndexAPlace { @Galley }
+ def @IndexBPlace { @Galley }
+ def @AfterLinePlace { @ForceGalley }
+
+ def @TryAfterLinePlace right x
+ {
+ x @Case {
+ noforce @Yield @Galley
+ force @Yield @ForceGalley
+ }
+ }
+
+ def @EvenFullPageSection
+ {
+ @OneRow @EvenFullPagePlace
+ // @FullPagePlace
+ //@MidGap @EvenFullPageSection
+ }
+
+ def @OddFullPageSection
+ {
+ @OneRow @OddFullPagePlace
+ // @FullPagePlace
+ //@MidGap @OddFullPageSection
+ }
+
+ def @EvenPageTopSect
+ {
+ @OneRow @EvenPagePlace
+ // @PageTopPlace
+ //@MidGap @PageFootAndTopPlace
+ //@MidGap @EvenPageTopSect
+ }
+
+ def @OddPageTopSect
+ {
+ @PageTopPlace
+ //@MidGap @PageFootAndTopPlace
+ //@MidGap @OddPageTopSect
+ }
+
+ def @PageOddTopSection right @Orient
+ {
+ @OddPageTopSect ||{@OrientedWidth @Orient} @FullPlace
+ ||{@OrientedWidth @Orient} @OddFullPlace
+ }
+
+ def @PageEvenTopSection right @Orient
+ {
+ @EvenPageTopSect ||{@OrientedWidth @Orient} @FullPlace
+ ||{@OrientedWidth @Orient} @EvenFullPlace
+ }
+
+ def @PageIntroOddTopSection right @Orient
+ {
+ @OddPageTopSect ||{@OrientedWidth @Orient} @IntroFullPlace
+ ||{@OrientedWidth @Orient} @IntroOddFullPlace
+ }
+
+ def @PageIntroEvenTopSection right @Orient
+ {
+ @EvenPageTopSect
+ ||{@OrientedWidth @Orient} @IntroFullPlace
+ ||{@OrientedWidth @Orient} @IntroEvenFullPlace
+ }
+
+ def @PageFootNoteList
+ {
+ @PageFootNotePlace
+ //@FootGap @PageFootNoteList
+ }
+
+ def @PageFootNoteSection
+ {
+ @FootLen @Wide @HLine
+ //@FootGap @PageFootNoteList
+ }
+
+ def @PageFootAndTopSect
+ {
+ @PageFootAndTopPlace
+ //@MidGap @PageFootAndTopSect
+ }
+
+ def @PageFootSection
+ {
+ //@MidGap @PageFootAndTopSect
+ //@FootAboveGap @PageFootNoteSection
+ }
+
+ def @ColTopSection
+ {
+ @ColTopPlace
+ //@MidGap @ColFootAndTopPlace
+ //@MidGap @TryAfterLinePlace noforce
+ //@MidGap @ColTopSection
+ }
+
+ def @RestOfColSection
+ {
+ @AfterLinePlace
+ //@MidGap @TryAfterLinePlace force
+ //@MidGap @ColPlace @NotRevealed
+ //@MidGap @RestOfColSection
+ }
+
+ def @IntroRestOfColSection
+ {
+ @AfterLinePlace
+ //@MidGap @TryAfterLinePlace force
+ //@MidGap @IntroColPlace @NotRevealed
+ //@MidGap @IntroRestOfColSection
+ }
+
+ def @ColFootAndTopList { @ColFootAndTopPlace //@TopGap @ColFootAndTopList }
+
+ def @ColFootNoteList
+ {
+ @ColFootNotePlace
+ //@FootGap @ColFootNoteList
+ }
+
+ def @ColFootNoteSection
+ {
+ @FootLen @Wide @HLine
+ //@FootGap @ColFootNoteList
+ }
+
+ def @ColFootSection
+ {
+ //@TopGap @ColFootAndTopList
+ //@FootAboveGap @ColFootNoteSection
+ }
+
+ def @ColsOf
+ left num
+ named gap { @ColumnGap }
+ right x
+ {
+ def @Two { x ||gap x }
+ def @Four { @Two ||gap @Two }
+ def @Eight { @Four ||gap @Four }
+
+ num @Case {
+ 1 @Yield { x }
+ 2 @Yield { @Two }
+ 3 @Yield { @Two ||gap x }
+ 4 @Yield { @Four }
+ 5 @Yield { @Four ||gap x }
+ 6 @Yield { @Four ||gap @Two }
+ 7 @Yield { @Four ||gap @Two ||gap x }
+ 8 @Yield { @Four ||gap @Four }
+ 9 @Yield { @Four ||gap @Four ||gap x }
+ 10 @Yield { @Four ||gap @Four ||gap @Two }
+ }
+ }
+
+ def @EqualWidth right x { 50c @Wide x } # believe it or not
+
+ def @ColList right num
+ {
+ @HExpand num @ColsOf @EqualWidth @VExpand
+ {
+ @ColTopSection //@TopGap
+ @ColPlace //@MidGap @RestOfColSection // //1rt
+ @OneRow { @ColFootSection }
+
+ }
+ }
+
+ def @IntroColList right num
+ {
+ @HExpand num @ColsOf @EqualWidth @VExpand
+ {
+ @ColTopSection //@TopGap
+ @IntroColPlace //@MidGap @IntroRestOfColSection // //1rt
+ @OneRow { @ColFootSection }
+ }
+ }
+
+ def @ZeroColList right num
+ {
+ @HExpand num @ColsOf @EqualWidth 0c @High @ColPlace
+ }
+
+ def @ZeroIntroColList right num
+ {
+ @HExpand num @ColsOf @EqualWidth 0c @High @IntroColPlace
+ }
+
+ def @IndexColList right num
+ {
+ @HExpand num @ColsOf gap { @IndexColumnGap } @EqualWidth @VExpand @IndexPlace
+ }
+
+ def @IndexAColList right num
+ {
+ @HExpand num @ColsOf gap { @IndexAColumnGap } @EqualWidth @VExpand @IndexAPlace
+ }
+
+ def @IndexBColList right num
+ {
+ @HExpand num @ColsOf gap { @IndexBColumnGap } @EqualWidth @VExpand @IndexBPlace
+ }
+
+
+ ###########################################################################
+ # #
+ # Footnotes. #
+ # #
+ ###########################################################################
+
+ export @Tag count
+ def @FootNoteCounterMarker
+ named @Tag {}
+ named count {}
+ {
+ @Null
+ }
+
+ def @FootNoteNum right tag
+ {
+ @FootNoteCounterMarker&&tag @Open { @Next count }
+ }
+
+ def @FootNoteCounterIncrement
+ right tag
+ {
+ @FootNoteCounterMarker&&preceding @Tagged tag
+ // @FootNoteCounterMarker count { @FootNoteNum tag }
+ // @NumberMarker @Tag { tag }
+ @Value { @FootNoteNumbers @Num @FootNoteNum tag }
+ }
+
+ def @BeginFootNoteCounter
+ {
+ @FootNoteCounterMarker count { 0 }
+ }
+
+ def @FootNote
+ named @Tag {}
+ named @Location { @FootNoteLocation }
+ named @Another { No }
+ named @Label { Numbered }
+ right x
+ {
+
+ def @FootLabelFmt
+ right x
+ {
+ @FootNoteFont @Font @FootNoteBreak @Break
+ +0.3v @VShift { Base 0.8f } @Font x
+ }
+
+ def @FootExtra
+ {
+ @BackEnd @Case {
+ PlainText @Yield ","
+ else @Yield @FootLabelFmt ","
+ }
+ }
+
+ def @FootLabel
+ {
+ @Label @Case {
+ "Numbered" @Yield { @BackEnd @Case {
+ PlainText @Yield { ({@NumberOf @Tag}) }
+ else @Yield @FootLabelFmt @NumberOf @Tag
+ } }
+ else @Yield { @BackEnd @Case {
+ PlainText @Yield @Label
+ else @Yield @FootLabelFmt @Label
+ } }
+ }
+ }
+
+ def @LongFootLabel
+ {
+ @Another @Case {
+ No @Yield { @FootLabel }
+ Yes @Yield { @FootExtra &0iu @FootLabel }
+ }
+ }
+
+ def @FootVal
+ {
+ @FootNoteFont @Font @FootNoteBreak @Break @Label @Case {
+ "Numbered" @Yield {
+ { @FootNoteCounterIncrement @Tag & @FootLabel }
+ @FootNoteFormat x
+ }
+ else @Yield { @FootLabel @FootNoteFormat x }
+ }
+ }
+
+ def @PageFootNote into { @PageFootNotePlace&&following } { @FootVal }
+ def @ColFootNote into { @ColFootNotePlace&&following } { @FootVal }
+
+ @Location @Case {
+ ColFoot @Yield { @Null &0iu @LongFootLabel & @ColFootNote }
+ PageFoot @Yield { @Null &0iu @LongFootLabel & @PageFootNote }
+ }
+ }
+
+ macro @AnotherFootNote { @FootNote @Another { Yes } }
+
+
+ ###########################################################################
+ # #
+ # Definitions for page lists. There are four symbols here, in the #
+ # following pattern: #
+ # #
+ # @(Simple | Running)(- | Intro)PageList #
+ # #
+ # Running means that the page list is to support running headers. #
+ # Intro means that the page list is an introductory page list. #
+ # These are then packaged into @PageList and @IntroPageList. #
+ # #
+ ###########################################################################
+
+ def @SStart right @PageNum
+ {
+ @PageNum @Case {
+ { 1 0 } @Yield Start
+ else @Yield NonStart
+ }
+ }
+
+ def @ChooseColList right colnum
+ {
+ @OneOf
+ {
+ @ColList colnum
+ @IndexAColList @IndexAColumnNumber
+ @IndexBColList @IndexBColumnNumber
+ @IndexColList @IndexColumnNumber
+ }
+ }
+
+ def @ChooseIntroColList right colnum
+ {
+ @OneOf
+ {
+ @IntroColList colnum
+ @IndexAColList @IndexAColumnNumber
+ @IndexBColList @IndexBColumnNumber
+ @IndexColList @IndexColumnNumber
+ }
+ }
+
+ def @SimplePageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named extra { No }
+ named @Orient {}
+ named @AtTop { @Null }
+ right @PageNum
+ {
+
+ def @OrdinaryOddPage
+ {
+ {@PageHeaders.{@SStart @PageNum}} @OddTopHeader
+ { @PageNumbers @Num @PageNum }
+ //@MidGap @AtTop
+ //@MidGap @PageOddTopSection @Orient
+ //@MidGap @ChooseColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap {@PageHeaders.{@SStart @PageNum}} @OddFootHeader
+ { @PageNumbers @Num @PageNum }
+ }
+ }
+
+ def @FullPageOddPage
+ {
+ {@PageHeaders.{@SStart @PageNum}} @OddTopHeader
+ { @PageNumbers @Num @PageNum }
+ //@MidGap @OddFullPageSection
+ // //1rt @OneRow
+ { //@MidGap {@PageHeaders.{@SStart @PageNum}} @OddFootHeader
+ { @PageNumbers @Num @PageNum }
+ }
+ }
+
+ def @SimpleEvenPageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named extra { No }
+ right @PageNum
+ {
+
+ def @OrdinaryEvenPage
+ {
+ @PageHeaders.NonStart @EvenTopHeader
+ { @PageNumbers @Num @PageNum }
+ //@MidGap @PageEvenTopSection @Orient
+ //@MidGap @ChooseColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap @PageHeaders.NonStart @EvenFootHeader
+ { @PageNumbers @Num @PageNum }
+ }
+ }
+
+ def @FullPageEvenPage
+ {
+ @PageHeaders.NonStart @EvenTopHeader
+ { @PageNumbers @Num @PageNum }
+ //@MidGap @EvenFullPageSection
+ // //1rt @OneRow
+ { //@MidGap @PageHeaders.NonStart @EvenFootHeader
+ { @PageNumbers @Num @PageNum }
+ }
+ }
+
+ @PageMarker
+ rawnum { @PageNum }
+ num { @PageNumbers @Num @PageNum }
+ // @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // {} @EvenPage @Orient { @Orient }
+ {
+ @OrdinaryEvenPage ||{@OrientedWidth @Orient} @FullPageEvenPage
+ }
+ // @SimplePageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ @Next @PageNum
+ }
+
+ @PageMarker
+ rawnum { @PageNum }
+ num { @PageNumbers @Num @PageNum }
+ // @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // { extra @Then @ZeroColList @ColumnNumber } @OddPage @Orient { @Orient }
+ {
+ @OrdinaryOddPage ||{@OrientedWidth @Orient} @FullPageOddPage
+ }
+ // @SimpleEvenPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Next @PageNum
+ }
+
+ def @SimpleIntroPageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named @Orient {}
+ named extra { No }
+ named @AtTop { @Null }
+ right @PageNum
+ {
+ @PageMarker
+ num { @IntroPageNumbers @Num @PageNum }
+ rawnum { @PageNum }
+ // @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // { extra @Then @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient }
+ {
+ {@PageHeaders.{@SStart @PageNum}} @IntroOddTopHeader
+ { @IntroPageNumbers @Num @PageNum }
+ //@MidGap @AtTop
+ //@MidGap @PageIntroOddTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap
+ {@PageHeaders.{@SStart @PageNum}} @IntroOddFootHeader
+ { @IntroPageNumbers @Num @PageNum }
+ }
+ }
+ // @PageMarker
+ num { @IntroPageNumbers @Num @Next @PageNum }
+ rawnum { @Next @PageNum }
+ // @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // {} @EvenPage @Orient { @Orient }
+ @Runner&&following @Open
+ {
+ @PageHeaders.NonStart @IntroEvenTopHeader { @IntroPageNumbers @Num @Next @PageNum }
+ //@MidGap @PageIntroEvenTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap @PageHeaders.NonStart @IntroEvenFootHeader
+ { @IntroPageNumbers @Num @Next @PageNum }
+ }
+ }
+ // @SimpleIntroPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ @Next @Next @PageNum
+ }
+
+ def @SimpleOddOrEvenIntroPageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named @Orient {}
+ named extra { No }
+ named @AtTop { @Null }
+ right @PageNum
+ {
+
+ def @SimpleEvenIntroPageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named @Orient {}
+ named extra { No }
+ named @AtTop { @Null }
+ right @PageNum
+ {
+
+ @PageMarker
+ num { @IntroPageNumbers @Num @PageNum }
+ rawnum { @PageNum }
+ // @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // {} @EvenPage @Orient { @Orient }
+ @Runner&&following @Open
+ {
+ @PageHeaders.NonStart @IntroEvenTopHeader { @IntroPageNumbers @Num @PageNum }
+ //@MidGap @PageIntroEvenTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap @PageHeaders.NonStart @IntroEvenFootHeader
+ { @IntroPageNumbers @Num @PageNum }
+ }
+ }
+ // @SimpleOddOrEvenIntroPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ @Next @PageNum
+ }
+ @PageMarker
+ num { @IntroPageNumbers @Num @PageNum }
+ rawnum { @PageNum }
+ // @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // { extra @Then @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient }
+ {
+ {@PageHeaders.{@SStart @PageNum}} @IntroOddTopHeader
+ { @IntroPageNumbers @Num @PageNum }
+ //@MidGap @AtTop
+ //@MidGap @PageIntroOddTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap
+ {@PageHeaders.{@SStart @PageNum}} @IntroOddFootHeader
+ { @IntroPageNumbers @Num @PageNum }
+ }
+ }
+ // @SimpleEvenIntroPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ @Next @PageNum
+ }
+
+ def @RunningPageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named extra { No }
+ named @Orient {}
+ named @AtTop { @Null }
+ right @PageNum
+ {
+
+ def @OrdinaryOddPage
+ {
+ @Runner&&following @Open
+ {
+ @PageMarker
+ num { @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner } }
+ rawnum { @PageNum }
+ // @PageHeaders.@Start @RunningOddTopHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ //@MidGap @AtTop
+ //@MidGap @PageOddTopSection @Orient
+ //@MidGap @ChooseColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap @PageHeaders.@Start @RunningOddFootHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ }
+ }
+ }
+
+ def @FullPageOddPage
+ {
+ @Runner&&following @Open
+ {
+ @PageMarker
+ num { @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner } }
+ rawnum { @PageNum }
+ // @PageHeaders.@Start @RunningOddTopHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ //@MidGap @AtTop
+ //@MidGap @OddFullPageSection
+ // //1rt @OneRow
+ {
+ //@MidGap @PageHeaders.@Start @RunningOddFootHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ }
+ }
+ }
+
+ def @RunningEvenPageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ right @PageNum
+ {
+
+ def @OrdinaryEvenPage
+ {
+ @Runner&&following @Open
+ {
+ @PageMarker
+ num { @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner } }
+ rawnum { @PageNum }
+ // @PageHeaders.@Start @RunningEvenTopHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ //@MidGap @PageEvenTopSection @Orient
+ //@MidGap @ChooseColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap @PageHeaders.@Start @RunningEvenFootHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ }
+ }
+ }
+
+ def @FullPageEvenPage
+ {
+ @Runner&&following @Open
+ {
+ @PageMarker
+ num { @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner } }
+ rawnum { @PageNum }
+ // @PageHeaders.@Start @RunningEvenTopHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ //@MidGap @EvenFullPageSection
+ // //1rt @OneRow
+ {
+ //@MidGap @PageHeaders.@Start @RunningEvenFootHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @PageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ }
+ }
+ }
+
+ @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // {} @EvenPage @Orient { @Orient }
+ {
+ @OrdinaryEvenPage ||{@OrientedWidth @Orient} @FullPageEvenPage
+ }
+ // @RunningPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ @Next @PageNum
+ }
+
+ @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // { extra @Then @ZeroColList @ColumnNumber } @OddPage @Orient { @Orient }
+ {
+ @OrdinaryOddPage ||{@OrientedWidth @Orient} @FullPageOddPage
+ }
+ // @RunningEvenPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Next @PageNum
+ }
+
+ def @RunningIntroPageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named @AtTop { @Null }
+ named @Orient {}
+ named extra { No }
+ right @PageNum
+ {
+ @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // { extra @Then @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient }
+ @Runner&&following @Open
+ {
+ @PageMarker
+ num { @MakePageNum
+ numbers { @IntroPageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner } }
+ rawnum { @PageNum }
+ // @PageHeaders.@Start @RunningIntroOddTopHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @IntroPageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ //@MidGap @AtTop
+ //@MidGap @PageIntroOddTopSection @Orient
+ //@MidGap @IntroColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap @PageHeaders.@Start @RunningIntroOddFootHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @IntroPageNumbers }
+ rawnum { @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ }
+ }
+ // @FootNoteThrough @NoDo @BeginFootNoteCounter
+ // {} @EvenPage @Orient { @Orient }
+ @Runner&&following @Open
+ {
+ @PageMarker
+ num { @MakePageNum
+ numbers { @IntroPageNumbers }
+ rawnum { @Next @PageNum }
+ prefix { @Prefix }
+ owner { @Owner } }
+ rawnum { @Next @PageNum }
+ // @PageHeaders.@Start @RunningIntroEvenTopHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @IntroPageNumbers }
+ rawnum { @Next @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ //@MidGap @PageIntroEvenTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ // //1rt @OneRow
+ { // @PageFootSection
+ //@MidGap @PageHeaders.@Start @RunningIntroEvenFootHeader
+ @MajorNum { @MajorNum } @MajorTitle { @MajorTitle }
+ @MinorNum { @MinorNum } @MinorTitle { @MinorTitle }
+ {
+ @MakePageNum
+ numbers { @IntroPageNumbers }
+ rawnum { @Next @PageNum }
+ prefix { @Prefix }
+ owner { @Owner }
+ }
+ }
+ }
+ // @RunningIntroPageList
+ @PageHeaders { @PageHeaders }
+ @ColumnNumber { @ColumnNumber }
+ @Orient { @Orient }
+ @Next @Next @PageNum
+ }
+
+ def @PageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named extra { No }
+ named @Orient {}
+ named @AtTop { @Null }
+ right @FirstPageNum
+ {
+ @PageHeaders @Case {
+ { None Simple } @Yield @SimplePageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ extra { extra }
+ @AtTop { @AtTop }
+ @FirstPageNum
+ { Running Titles } @Yield @RunningPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ extra { extra }
+ @AtTop { @AtTop }
+ @FirstPageNum
+ }
+ //
+ @PageMark last.page
+ }
+
+ def @IntroPageList
+ named @ColumnNumber {}
+ named @PageHeaders {}
+ named @Orient {}
+ named extra { No }
+ named @AtTop { @Null }
+ right @FirstPageNum
+ {
+ @PageHeaders @Case {
+ { None Simple } @Yield @SimpleIntroPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ extra { extra }
+ @AtTop { @AtTop }
+ @FirstPageNum
+ { Running Titles } @Yield @RunningIntroPageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @Orient }
+ extra { extra }
+ @AtTop { @AtTop }
+ @FirstPageNum
+ }
+ }
+
+ def @ContinuousPageList
+ named @Orient {}
+ {
+ {@OrientedWidth @Orient} @Wide
+ { //@TopMargin ||@EvenLeftMargin
+ {
+ @BeginFootNoteCounter
+ // @ColPlace
+ //@FootAboveGap @ColFootNoteSection
+ //@FootAboveGap @PageFootNoteSection
+ }
+ ||@EvenRightMargin //@FootMargin
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Table of contents (including lists of figures and tables). #
+ # #
+ ###########################################################################
+
+ def @ContentsItem
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGap }
+ named postgap { 0c }
+ named protect { No }
+ {
+ def @Leaders { @ContentsLeader &@ContentsLeaderGap @Leaders }
+
+ def @RightPart
+ {
+ @ContentsRightWidth @Wide {
+ # &@ContentsLeaderGap @Leaders &@ContentsLeaderGap
+ &1rt { pagenum //0.5vx }
+ }
+ }
+
+ def @Item
+ {
+ |indent number @ContentsFormat @HExpand {
+ title & @ContentsLeaderGap @Wide &1rt @OneCol {
+ @Leaders & @RightPart &0io
+ }
+ }
+ |@ContentsRightWidth
+ }
+
+ //pregap
+ //0.5vx
+ @BackEnd @Case {
+ { PostScript PlainText } @Yield {
+ protect @Case {
+ No @Yield @Item
+ Yes @Yield @Protect @Item
+ }
+ }
+ PDF @Yield {
+ protect @Case {
+ No @Yield { "__link_source=<<"title">>" } @Graphic @Item
+ Yes @Yield { "__link_source=<<"title">>" } @Graphic { @Protect @Item }
+ }
+ }
+ }
+ //postgap
+ }
+
+ def @ContentsPlace { @Galley }
+ def @FigureContentsPlace { @Galley }
+ def @TableContentsPlace { @Galley }
+
+ def @SendContents into { @ContentsPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+ def @SendFigureContents into { @FigureContentsPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+ def @SendTableContents into { @TableContentsPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+ def @ContentsEntry
+ left wanted
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGap }
+ named postgap { 0c }
+ {
+ @MakeContents.wanted @Case {
+ Yes.Yes @Yield { @SendContents @ContentsItem
+ indent { indent }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { pregap }
+ postgap { postgap }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @FigureContentsEntry
+ left wanted
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGap }
+ named postgap { 0c }
+ {
+ @MakeFigureContents.wanted @Case {
+ Yes.Yes @Yield { @SendFigureContents @ContentsItem
+ indent { indent }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { pregap }
+ postgap { postgap }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @TableContentsEntry
+ left wanted
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGap }
+ named postgap { 0c }
+ {
+ @MakeTableContents.wanted @Case {
+ Yes.Yes @Yield { @SendTableContents @ContentsItem
+ indent { indent }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { pregap }
+ postgap { postgap }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @MajorContentsEntry
+ left wanted
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGapAbove }
+ named postgap { @ContentsGapBelow }
+ {
+ @MakeContents.wanted @Case {
+ Yes.Yes @Yield { @SendContents @ContentsItem
+ indent { indent }
+ number { @ContentsFont @Font number }
+ title { @ContentsFont @Font title }
+ pagenum { pagenum }
+ pregap { pregap }
+ postgap { postgap }
+ protect { Yes }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @VeryMajorContentsEntry
+ left wanted
+ named indent { 0.5rt }
+ named title {}
+ named pregap { @ContentsPartGapAbove }
+ named postgap { @ContentsPartGapBelow }
+ {
+ def item
+ {
+ //pregap
+ //0.5vx
+ |indent @ContentsFont @Font @OneCol title |
+ //0.5vx
+ //postgap
+ }
+
+ @MakeContents.wanted @Case {
+ Yes.Yes @Yield @SendContents item
+ else @Yield @Null
+ }
+
+ }
+
+ def @ContentsSection
+ {
+ def @ContentsList { @ContentsPlace // @ContentsList }
+
+ @MakeContents @Case {
+ { Yes Bypass } @Yield @ContentsList
+ else @Yield @Null
+ }
+ }
+
+ def @FigureContentsSection
+ {
+ def @FigureContentsList { @FigureContentsPlace // @FigureContentsList }
+
+ @MakeFigureContents @Case {
+ { Yes Bypass } @Yield @FigureContentsList
+ else @Yield @Null
+ }
+ }
+
+ def @TableContentsSection
+ {
+ def @TableContentsList { @TableContentsPlace // @TableContentsList }
+
+ @MakeTableContents @Case {
+ { Yes Bypass } @Yield @TableContentsList
+ else @Yield @Null
+ }
+ }
+
+ ###########################################################################
+ # #
+ # Bypass table of contents. #
+ # #
+ ###########################################################################
+
+ def @BypassContentsEntry into { @ContentsPlace&&preceding }
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ {
+ @MakeContents @Case {
+ Bypass @Yield { @ContentsItem
+ indent { indent }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { @ContentsGap }
+ postgap { 0c }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @BypassFigureContentsEntry into { @FigureContentsPlace&&preceding }
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ {
+ @MakeFigureContents @Case {
+ Bypass @Yield { @ContentsItem
+ indent { indent }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { @ContentsGap }
+ postgap { 0c }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @BypassTableContentsEntry into { @TableContentsPlace&&preceding }
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ {
+ @MakeTableContents @Case {
+ Bypass @Yield { @ContentsItem
+ indent { indent }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { @ContentsGap }
+ postgap { 0c }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @BypassMajorContentsEntry into { @ContentsPlace&&preceding }
+ named indent { 0f }
+ named number {}
+ named title {}
+ named pagenum {}
+ {
+ @MakeContents @Case {
+ Bypass @Yield { @ContentsItem
+ indent { indent }
+ number { @B number }
+ title { @B title }
+ pagenum { pagenum }
+ pregap { @ContentsGapAbove }
+ postgap { @ContentsGapBelow }
+ }
+ else @Yield @Null
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Endnotes. #
+ # #
+ ###########################################################################
+
+ export num
+ def @EndNoteList
+ named @Tag {}
+ right num
+ {
+ @Galley //@EndNoteGap @EndNoteList @Next num
+ }
+
+ def endtag right num
+ {
+ @BackEnd @Case {
+ PlainText @Yield {
+ ({@EndNoteNumbers @Num num})
+ }
+ else @Yield {
+ +0.3v @VShift 0.8f @Font @EndNoteNumbers @Num num
+ }
+ }
+ }
+
+ def @EndNote
+ named @Tag {}
+ right x
+ {
+ def ftag
+ {
+ @EndNoteFont @Font @EndNoteList&&@Tag @Open { endtag num }
+ }
+
+ def @ENote into { @EndNoteList&&following }
+ {
+ @EndNoteFont @Font @EndNoteBreak @Break
+ { { @EndNoteList&&preceding @Tagged @Tag ftag } @EndNoteFormat x }
+ }
+
+ @Null & @EndNoteFont @Font ftag & @ENote
+ }
+
+
+ ###########################################################################
+ # #
+ # Margin Notes. #
+ # #
+ ###########################################################################
+
+ def @ZeroSize right x
+ {
+ @HContract @VContract { ^/0io |0io @OneCol @OneRow x |0io /0io }
+ }
+
+ def @MargPut
+ left parity
+ right x
+ {
+ @MarginNoteFont @Font @MarginNoteBreak @Break @ZeroSize {
+ @BackEnd @Case {
+ PlainText @Yield ""
+ PostScript @Yield {
+ { parity "LoutMargShift gsave" // "grestore" } @Graphic
+ {
+ |@MarginNoteHGap @MarginNoteWidth @Wide @OneRow x
+ |@MarginNoteHGap //@MarginNoteVGap
+ }
+ }
+ PDF @Yield { "% @MargPut/LoutMargShift UNIMPLEMENTED" @Graphic {
+ |@MarginNoteHGap @MarginNoteWidth @Wide @OneRow x
+ |@MarginNoteHGap //@MarginNoteVGap
+ } # VT: PDF currently has no output
+ }
+ }
+ }
+ }
+
+ def @LeftNote right x { @Null & 0 @MargPut x }
+ def @RightNote right x { @Null & 1 @MargPut x }
+ def @OuterNote right x { @Null & 2 @MargPut x }
+ def @InnerNote right x { @Null & 3 @MargPut x }
+
+
+ ###########################################################################
+ # #
+ # @Place: places an object at an arbitrary point on the page. #
+ # #
+ ###########################################################################
+
+#
+# VT: the expressions in the braces will work for PostScript but not for PDF
+# they should be modified in the way the "named c { " cm" }" blocks were modified above
+# but since the point of @Place is to output a matrix (?), I have not implemented this change
+#
+ def @Place
+ named x
+ named "+" precedence 96 associativity left left a right b { a b "add" }
+ named "-" precedence 96 associativity left left a right b { a b "sub" }
+ named "/" precedence 97 associativity left left a right b { a b "div" }
+ named "*" precedence 98 associativity left left a right b { a b "mul" }
+ named c precedence 99 left a { a "cm" }
+ named i precedence 99 left a { a "in" }
+ named e precedence 99 left a { a "em" }
+ named p precedence 99 left a { a "pt" }
+ named f precedence 99 left a { a "ft" }
+ named s precedence 99 left a { a "sp" }
+ named v precedence 99 left a { a "vs" }
+ named cm precedence 99 left a { a "cm" }
+ named in precedence 99 left a { a "in" }
+ named em precedence 99 left a { a "em" }
+ named pt precedence 99 left a { a "pt" }
+ named ft precedence 99 left a { a "ft" }
+ named sp precedence 99 left a { a "sp" }
+ named vs precedence 99 left a { a "vs" }
+ { 0 }
+ named y
+ named "+" precedence 96 associativity left left a right b { a b "add" }
+ named "-" precedence 96 associativity left left a right b { a b "sub" }
+ named "/" precedence 97 associativity left left a right b { a b "div" }
+ named "*" precedence 98 associativity left left a right b { a b "mul" }
+ named c precedence 99 left a { a "cm" }
+ named i precedence 99 left a { a "in" }
+ named e precedence 99 left a { a "em" }
+ named p precedence 99 left a { a "pt" }
+ named f precedence 99 left a { a "ft" }
+ named s precedence 99 left a { a "sp" }
+ named v precedence 99 left a { a "vs" }
+ named cm precedence 99 left a { a "cm" }
+ named in precedence 99 left a { a "in" }
+ named em precedence 99 left a { a "em" }
+ named pt precedence 99 left a { a "pt" }
+ named ft precedence 99 left a { a "ft" }
+ named sp precedence 99 left a { a "sp" }
+ named vs precedence 99 left a { a "vs" }
+ { 0 }
+ right val
+ {
+ @ZeroSize {
+ @BackEnd @Case {
+ PlainText @Yield ""
+ PostScript @Yield {
+ { "LoutPageDict begin matr setmatrix" x y "translate end gsave"
+ // "grestore" } @Graphic val
+ }
+ else @Yield { { "% @Place UNIMPLEMENTED" } @Graphic val # VT: PDF currently has no output
+ }
+ }
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Theorem, @Proof, and @EndProof #
+ # #
+ ###########################################################################
+
+ export @Tag val
+ def @TheoremCounterMarker
+ named @Tag {}
+ named val {}
+ {
+ @Null
+ }
+
+ def @BeginTheoremCounter
+ right prefix
+ {
+ @TheoremCounterMarker val { prefix @Join 0 }
+ }
+
+ def @TheoremNum right tag
+ {
+ @TheoremCounterMarker&&tag @Open { @Next val }
+ }
+
+ def @TheoremCounterIncrement
+ right tag
+ {
+ @TheoremCounterMarker&&preceding @Tagged tag
+ @TheoremCounterMarker val { @TheoremNum tag }
+ @NumberMarker @Tag { tag } @Value { @TheoremNum tag }
+ }
+
+ def @Theorem
+ named @Tag {}
+ named @Title {}
+ right x
+ {
+ def @TheoremTitle
+ {
+ @Title @Case {
+ "" @Yield @Null
+ else @Yield @TheoremTitleFormat @Title
+ }
+ }
+
+ { @PageMark @Tag @TheoremCounterIncrement @Tag } @Insert
+ @TheoremFormat
+ word { theorem @WordVal @TheoremWord }
+ number { @TheoremNum @Tag }
+ title { @TheoremTitle }
+ body { x }
+ }
+
+ macro @Proof { @B { {proof @WordVal @ProofWord}: } &2s }
+
+ macro @EndProof { &1rt @Box {} }
+
+
+ ###########################################################################
+ # #
+ # @Definition #
+ # #
+ ###########################################################################
+
+ export @Tag val
+ def @DefinitionCounterMarker
+ named @Tag {}
+ named val {}
+ {
+ @Null
+ }
+
+ def @BeginDefinitionCounter
+ right prefix
+ {
+ @DefinitionCounterMarker val { prefix @Join 0 }
+ }
+
+ def @DefinitionNum right tag
+ {
+ @DefinitionCounterMarker&&tag @Open { @Next val }
+ }
+
+ def @DefinitionCounterIncrement
+ right tag
+ {
+ @DefinitionCounterMarker&&preceding @Tagged tag
+ @DefinitionCounterMarker val { @DefinitionNum tag }
+ @NumberMarker @Tag { tag } @Value { @DefinitionNum tag }
+ }
+
+ def @Definition
+ named @Tag {}
+ named @Title {}
+ right x
+ {
+ def @DefinitionTitle
+ {
+ @Title @Case {
+ "" @Yield @Null
+ else @Yield (@Title)
+ }
+ }
+
+ { @PageMark @Tag @DefinitionCounterIncrement @Tag } @Insert
+ @DefinitionFormat
+ word { definition @WordVal @DefinitionWord }
+ number { @DefinitionNum @Tag }
+ title { @DefinitionTitle }
+ body { x }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Claim #
+ # #
+ ###########################################################################
+
+ export @Tag val
+ def @ClaimCounterMarker
+ named @Tag {}
+ named val {}
+ {
+ @Null
+ }
+
+ def @BeginClaimCounter
+ right prefix
+ {
+ @ClaimCounterMarker val { prefix @Join 0 }
+ }
+
+ def @ClaimNum right tag
+ {
+ @ClaimCounterMarker&&tag @Open { @Next val }
+ }
+
+ def @ClaimCounterIncrement
+ right tag
+ {
+ @ClaimCounterMarker&&preceding @Tagged tag
+ @ClaimCounterMarker val { @ClaimNum tag }
+ @NumberMarker @Tag { tag } @Value { @ClaimNum tag }
+ }
+
+ def @Claim
+ named @Tag {}
+ named @Title {}
+ right x
+ {
+ def @ClaimTitle
+ {
+ @Title @Case {
+ "" @Yield @Null
+ else @Yield (@Title)
+ }
+ }
+
+ { @PageMark @Tag @ClaimCounterIncrement @Tag } @Insert
+ @ClaimFormat
+ word { claim @WordVal @ClaimWord }
+ number { @ClaimNum @Tag }
+ title { @ClaimTitle }
+ body { x }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Proposition #
+ # #
+ ###########################################################################
+
+ export @Tag val
+ def @PropositionCounterMarker
+ named @Tag {}
+ named val {}
+ {
+ @Null
+ }
+
+ def @BeginPropositionCounter
+ right prefix
+ {
+ @PropositionCounterMarker val { prefix @Join 0 }
+ }
+
+ def @PropositionNum right tag
+ {
+ @PropositionCounterMarker&&tag @Open { @Next val }
+ }
+
+ def @PropositionCounterIncrement
+ right tag
+ {
+ @PropositionCounterMarker&&preceding @Tagged tag
+ @PropositionCounterMarker val { @PropositionNum tag }
+ @NumberMarker @Tag { tag } @Value { @PropositionNum tag }
+ }
+
+ def @Proposition
+ named @Tag {}
+ named @Title {}
+ right x
+ {
+ def @PropositionTitle
+ {
+ @Title @Case {
+ "" @Yield @Null
+ else @Yield (@Title)
+ }
+ }
+
+ { @PageMark @Tag @PropositionCounterIncrement @Tag } @Insert
+ @PropositionFormat
+ word { proposition @WordVal @PropositionWord }
+ number { @PropositionNum @Tag }
+ title { @PropositionTitle }
+ body { x }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Lemma #
+ # #
+ ###########################################################################
+
+ export @Tag val
+ def @LemmaCounterMarker
+ named @Tag {}
+ named val {}
+ {
+ @Null
+ }
+
+ def @BeginLemmaCounter
+ right prefix
+ {
+ @LemmaCounterMarker val { prefix @Join 0 }
+ }
+
+ def @LemmaNum right tag
+ {
+ @LemmaCounterMarker&&tag @Open { @Next val }
+ }
+
+ def @LemmaCounterIncrement
+ right tag
+ {
+ @LemmaCounterMarker&&preceding @Tagged tag
+ @LemmaCounterMarker val { @LemmaNum tag }
+ @NumberMarker @Tag { tag } @Value { @LemmaNum tag }
+ }
+
+ def @Lemma
+ named @Tag {}
+ named @Title {}
+ right x
+ {
+ def @LemmaTitle
+ {
+ @Title @Case {
+ "" @Yield @Null
+ else @Yield (@Title)
+ }
+ }
+
+ { @PageMark @Tag @LemmaCounterIncrement @Tag } @Insert
+ @LemmaFormat
+ word { lemma @WordVal @LemmaWord }
+ number { @LemmaNum @Tag }
+ title { @LemmaTitle }
+ body { x }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Corollary #
+ # #
+ ###########################################################################
+
+ export @Tag val
+ def @CorollaryCounterMarker
+ named @Tag {}
+ named val {}
+ {
+ @Null
+ }
+
+ def @BeginCorollaryCounter
+ right prefix
+ {
+ @CorollaryCounterMarker val { prefix @Join 0 }
+ }
+
+ def @CorollaryNum right tag
+ {
+ @CorollaryCounterMarker&&tag @Open { @Next val }
+ }
+
+ def @CorollaryCounterIncrement
+ right tag
+ {
+ @CorollaryCounterMarker&&preceding @Tagged tag
+ @CorollaryCounterMarker val { @CorollaryNum tag }
+ @NumberMarker @Tag { tag } @Value { @CorollaryNum tag }
+ }
+
+ def @Corollary
+ named @Tag {}
+ named @Title {}
+ right x
+ {
+ def @CorollaryTitle
+ {
+ @Title @Case {
+ "" @Yield @Null
+ else @Yield (@Title)
+ }
+ }
+
+ { @PageMark @Tag @CorollaryCounterIncrement @Tag } @Insert
+ @CorollaryFormat
+ word { corollary @WordVal @CorollaryWord }
+ number { @CorollaryNum @Tag }
+ title { @CorollaryTitle }
+ body { x }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Example #
+ # #
+ ###########################################################################
+
+ export @Tag val
+ def @ExampleCounterMarker
+ named @Tag {}
+ named val {}
+ {
+ @Null
+ }
+
+ def @BeginExampleCounter
+ right prefix
+ {
+ @ExampleCounterMarker val { prefix @Join 0 }
+ }
+
+ def @ExampleNum right tag
+ {
+ @ExampleCounterMarker&&tag @Open { @Next val }
+ }
+
+ def @ExampleCounterIncrement
+ right tag
+ {
+ @ExampleCounterMarker&&preceding @Tagged tag
+ @ExampleCounterMarker val { @ExampleNum tag }
+ @NumberMarker @Tag { tag } @Value { @ExampleNum tag }
+ }
+
+ def @Example
+ named @Tag {}
+ named @Title {}
+ right x
+ {
+ def @ExampleTitle
+ {
+ @Title @Case {
+ "" @Yield @Null
+ else @Yield (@Title)
+ }
+ }
+
+ { @PageMark @Tag @ExampleCounterIncrement @Tag } @Insert
+ @ExampleFormat
+ word { example @WordVal @ExampleWord }
+ number { @ExampleNum @Tag }
+ title { @ExampleTitle }
+ body { x }
+ }
+
+
+ ###########################################################################
+ # #
+ # @BeginAllCounters - begin all counters #
+ # #
+ ###########################################################################
+
+ def @BeginAllCounters
+ left condition
+ right prefix
+ {
+ condition @Do {
+ @BeginTheoremCounter prefix
+ // @BeginDefinitionCounter prefix
+ // @BeginClaimCounter prefix
+ // @BeginPropositionCounter prefix
+ // @BeginLemmaCounter prefix
+ // @BeginCorollaryCounter prefix
+ // @BeginExampleCounter prefix
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Reference - a reference. #
+ # #
+ ###########################################################################
+
+ export @Tag @Type @Abstract @Address @Annote @Author @Day @Edition
+ @HowPublished @InAuthor @InTitle @Institution @Journal @Keywords
+ @Label @Month @Note @Number @Organization @Page @Pages @Pinpoint
+ @Publisher @Title @TitleNote @TRType @URL @Volume @Year
+
+ def @Reference
+ named compulsory @Tag {}
+ named compulsory @Type {}
+ named @Abstract {}
+ named @Address {}
+ named @Annote {}
+ named @Author {}
+ named @Day {}
+ named @Edition {}
+ named @HowPublished {}
+ named @InAuthor {}
+ named @InTitle {}
+ named @Institution {}
+ named @Journal {}
+ named @Keywords {}
+ named @Label {}
+ named @Month {}
+ named @Note {}
+ named @Number {}
+ named @Organization {}
+ named @Page {}
+ named @Pages {}
+ named @Pinpoint {}
+ named @Publisher {}
+ named @Title {}
+ named @TitleNote {}
+ named @TRType {}
+ named @URL
+ named "~" { "~" }
+ named "/" { "/" &0p }
+ named "//" { "//" &0p } {}
+ named @Volume {}
+ named @Year {}
+ { @Null }
+
+
+ ###########################################################################
+ # #
+ # @CiteLabel - the value of the label of a reference within a citation. #
+ # #
+ ###########################################################################
+
+ def @CiteLabel
+ left label
+ right tag
+ {
+ @RefCiteLabels
+ @RefNum { @NumberOf tag }
+ @Tag { tag }
+ @Type { @Reference&&tag @Open { @Type } }
+ @Abstract { @Reference&&tag @Open { @Abstract } }
+ @Address { @Reference&&tag @Open { @Address } }
+ @Annote { @Reference&&tag @Open { @Annote } }
+ @Author { @Reference&&tag @Open { @Author } }
+ @Day { @Reference&&tag @Open { @Day } }
+ @Edition { @Reference&&tag @Open { @Edition } }
+ @HowPublished { @Reference&&tag @Open { @HowPublished } }
+ @InAuthor { @Reference&&tag @Open { @InAuthor } }
+ @InTitle { @Reference&&tag @Open { @InTitle } }
+ @Institution { @Reference&&tag @Open { @Institution } }
+ @Journal { @Reference&&tag @Open { @Journal } }
+ @Keywords { @Reference&&tag @Open { @Keywords } }
+
+ @Label { label @Case {
+ "" @Yield {@Reference&&tag @Open {@Label}}
+ else @Yield label
+ } }
+
+ @Month { @Reference&&tag @Open { @Month } }
+ @Note { @Reference&&tag @Open { @Note } }
+ @Number { @Reference&&tag @Open { @Number } }
+ @Organization { @Reference&&tag @Open { @Organization } }
+ @Page { @Reference&&tag @Open { @Page } }
+ @Pages { @Reference&&tag @Open { @Pages } }
+ @Pinpoint { @Reference&&tag @Open { @Pinpoint } }
+ @Publisher { @Reference&&tag @Open { @Publisher } }
+ @Title { @Reference&&tag @Open { @Title } }
+ @TitleNote { @Reference&&tag @Open { @TitleNote } }
+ @TRType { @Reference&&tag @Open { @TRType } }
+ @Volume { @Reference&&tag @Open { @Volume } }
+ @Year { @Reference&&tag @Open { @Year } }
+ }
+
+
+ ###########################################################################
+ # #
+ # @ListLabel - the value of the label of a reference within a ref list. #
+ # #
+ ###########################################################################
+
+ def @ListLabel
+ left label
+ right tag
+ {
+ @RefListLabels
+ @RefNum { @NumberOf tag }
+ @Tag { tag }
+ @Type { @Reference&&tag @Open { @Type } }
+ @Abstract { @Reference&&tag @Open { @Abstract } }
+ @Address { @Reference&&tag @Open { @Address } }
+ @Annote { @Reference&&tag @Open { @Annote } }
+ @Author { @Reference&&tag @Open { @Author } }
+ @Day { @Reference&&tag @Open { @Day } }
+ @Edition { @Reference&&tag @Open { @Edition } }
+ @HowPublished { @Reference&&tag @Open { @HowPublished } }
+ @InAuthor { @Reference&&tag @Open { @InAuthor } }
+ @InTitle { @Reference&&tag @Open { @InTitle } }
+ @Institution { @Reference&&tag @Open { @Institution } }
+ @Journal { @Reference&&tag @Open { @Journal } }
+ @Keywords { @Reference&&tag @Open { @Keywords } }
+
+ @Label { label @Case {
+ "" @Yield {@Reference&&tag @Open {@Label}}
+ else @Yield label
+ } }
+
+ @Month { @Reference&&tag @Open { @Month } }
+ @Note { @Reference&&tag @Open { @Note } }
+ @Number { @Reference&&tag @Open { @Number } }
+ @Organization { @Reference&&tag @Open { @Organization } }
+ @Page { @Reference&&tag @Open { @Page } }
+ @Pages { @Reference&&tag @Open { @Pages } }
+ @Pinpoint { @Reference&&tag @Open { @Pinpoint } }
+ @Publisher { @Reference&&tag @Open { @Publisher } }
+ @Title { @Reference&&tag @Open { @Title } }
+ @TitleNote { @Reference&&tag @Open { @TitleNote } }
+ @TRType { @Reference&&tag @Open { @TRType } }
+ @Volume { @Reference&&tag @Open { @Volume } }
+ @Year { @Reference&&tag @Open { @Year } }
+ }
+
+
+ ###########################################################################
+ # #
+ # @SortKey - the value of the sort key of a reference. #
+ # #
+ ###########################################################################
+
+ def @SortKey
+ left label
+ right tag
+ {
+ @RefListSortKey
+ @Tag { tag }
+ @Type { @Reference&&tag @Open { @Type } }
+ @Abstract { @Reference&&tag @Open { @Abstract } }
+ @Address { @Reference&&tag @Open { @Address } }
+ @Annote { @Reference&&tag @Open { @Annote } }
+ @Author { @Reference&&tag @Open { @Author } }
+ @Day { @Reference&&tag @Open { @Day } }
+ @Edition { @Reference&&tag @Open { @Edition } }
+ @HowPublished { @Reference&&tag @Open { @HowPublished } }
+ @InAuthor { @Reference&&tag @Open { @InAuthor } }
+ @InTitle { @Reference&&tag @Open { @InTitle } }
+ @Institution { @Reference&&tag @Open { @Institution } }
+ @Journal { @Reference&&tag @Open { @Journal } }
+ @Keywords { @Reference&&tag @Open { @Keywords } }
+
+ @Label { label @Case {
+ "" @Yield {@Reference&&tag @Open {@Label}}
+ else @Yield label
+ } }
+
+ @Month { @Reference&&tag @Open { @Month } }
+ @Note { @Reference&&tag @Open { @Note } }
+ @Number { @Reference&&tag @Open { @Number } }
+ @Organization { @Reference&&tag @Open { @Organization } }
+ @Page { @Reference&&tag @Open { @Page } }
+ @Pages { @Reference&&tag @Open { @Pages } }
+ @Pinpoint { @Reference&&tag @Open { @Pinpoint } }
+ @Publisher { @Reference&&tag @Open { @Publisher } }
+ @Title { @Reference&&tag @Open { @Title } }
+ @TitleNote { @Reference&&tag @Open { @TitleNote } }
+ @TRType { @Reference&&tag @Open { @TRType } }
+ @Volume { @Reference&&tag @Open { @Volume } }
+ @Year { @Reference&&tag @Open { @Year } }
+ }
+
+
+ ###########################################################################
+ # #
+ # @RefStyle - a reference printing style. #
+ # #
+ ###########################################################################
+
+ export @Style
+ def @RefStyle
+ left @Tag
+ named @Style right reftag {}
+ {}
+
+
+ ###########################################################################
+ # #
+ # @RefPrint - prints reference with tag reftag in appropriate style. #
+ # #
+ ###########################################################################
+
+ def @RefPrint right reftag
+ { & @RefStyle&&{ @Reference&&reftag @Open { @Type } }
+ @Open { @Style reftag } &
+ }
+
+
+ ###########################################################################
+ # #
+ # @ReferencesSection and @ChapReferencesSection - a list of references. #
+ # #
+ ###########################################################################
+
+ def @RefPlace { @Galley }
+ def @ChapRefPlace { @Galley }
+
+ def @BypassRefPlace { @Galley }
+ def @BypassChapRefPlace { @Galley }
+
+ def @ReferencesSection
+ {
+ def @RefList right num
+ {
+ @NumberMarker @Value { @RefNumbers @Num num } & | @RefPlace
+ //@RefListGap @RefList @Next num
+ }
+
+ def @BypassRefList
+ {
+ @BypassRefPlace //@RefListGap @BypassRefList
+ }
+
+ @RefList 1
+ //@RefListGap
+ @BypassRefList
+ }
+
+ def @ChapReferencesSection
+ {
+ def @ChapRefList right num
+ {
+ @NumberMarker @Value { @RefNumbers @Num num } & | @ChapRefPlace
+ //@RefListGap @ChapRefList @Next num
+ }
+
+ def @BypassChapRefList
+ {
+ @BypassChapRefPlace //@RefListGap @BypassChapRefList
+ }
+
+ @ChapRefList 1
+ //@RefListGap
+ @BypassChapRefList
+ }
+
+
+ ###########################################################################
+ # #
+ # @RefHeading - heading for reference lists. #
+ # #
+ ###########################################################################
+
+ def @RefHeading right x
+ { x @Case {
+ references @Yield @Word&&references
+ bibliography @Yield @Word&&bibliography
+ else @Yield x
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # @ChapRefSection #
+ # #
+ #######################################################################
+
+ def @ChapRefSection
+ {
+ @Heading @RefHeading @ChapRefListTitle
+ @DP
+ @ChapReferencesSection
+ }
+
+
+ ###########################################################################
+ # #
+ # @SendRef and @ChapSendRef - send one reference to the reference list. #
+ # #
+ ###########################################################################
+
+ def @RefItem
+ left lab
+ right ref
+ {
+ def @ZeroWidth right x { &0io @OneCol x &0io }
+
+ @RefListFormat @Case {
+ NoLabels @Yield { ref }
+ Labels @Yield { @ZeroWidth lab |@RefListLabelWidth ref }
+ DropLabels @Yield { lab //1vx |@RefListLabelWidth ref }
+ InLabels @Yield { lab & 2s @Wide & ref }
+ }
+ }
+
+
+ def @RefListItem
+ left label
+ right tag
+ {
+#
+# VT: I can't get this to work, so I've put back the original code
+#
+# @RefListFont @Font @RefListBreak @Break {
+# @BackEnd @Case {
+# PostScript @Yield {
+# @NumberMarker&&preceding @Tagged tag &
+# @PageMark tag
+# |@RefListIndent {label @ListLabel tag} @RefItem {@RefPrint tag}
+# |@RefListRightIndent
+# }
+# PDF @Yield {
+# { "__link_target=<<"tag">>" }
+# @Graphic
+# {
+# @NumberMarker&&preceding @Tagged tag &
+# @PageMark tag
+# |@RefListIndent {label @ListLabel tag} @RefItem {@RefPrint tag}
+# |@RefListRightIndent
+# }
+# }
+# }
+# }
+# VT: original:
+
+ @RefListFont @Font @RefListBreak @Break {
+ @NumberMarker&&preceding @Tagged tag &
+ @PageMark tag
+ |@RefListIndent {label @ListLabel tag} @RefItem {@RefPrint tag}
+ |@RefListRightIndent
+ }
+ }
+
+
+ def @SendRef into { @RefPlace&&foll_or_prec }
+ left label
+ right tag
+ {
+ def @Key { label @SortKey tag }
+
+ # no @Merge i.e. omit duplicates
+
+ label @RefListItem tag
+ }
+
+
+ def @ChapSendRef into { @ChapRefPlace&&foll_or_prec }
+ left label
+ right tag
+ {
+ def @Key { label @SortKey tag }
+
+ # no @Merge i.e. omit duplicates
+
+ label @RefListItem tag
+ }
+
+
+ ###########################################################################
+ # #
+ # @Ref (bare citation) and its variants. #
+ # #
+ ###########################################################################
+
+ def @Ref
+ named label {}
+ right tag
+ {
+ @MakeReferences @Case {
+ Yes @Yield { label @CiteLabel tag & label @SendRef tag }
+ else @Yield @Null
+ }
+ }
+
+ def @NoRef
+ named label {}
+ right tag
+ {
+ @MakeReferences @Case {
+ Yes @Yield { label @SendRef tag }
+ else @Yield @Null
+ }
+ }
+
+ def @ChapRef
+ named label {}
+ right tag
+ {
+ @MakeReferences @Case {
+ Yes @Yield { label @CiteLabel tag & label @ChapSendRef tag }
+ else @Yield @Null
+ }
+ }
+
+ def @NoChapRef
+ named label {}
+ right tag
+ {
+ @MakeReferences @Case {
+ Yes @Yield { label @ChapSendRef tag }
+ else @Yield @Null
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Bypass references. #
+ # #
+ ###########################################################################
+
+ def @BypassReference into { @BypassRefPlace&&preceding }
+ named label {}
+ named value {}
+ {
+ @MakeReferences @Case {
+ Bypass @Yield { label @RefItem value }
+ else @Yield @Null
+ }
+ }
+
+ def @BypassChapReference into { @BypassChapRefPlace&&preceding }
+ named label {}
+ named value {}
+ {
+ @MakeReferences @Case {
+ Bypass @Yield { label @RefItem value }
+ else @Yield @Null
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # @Cite (citation) and its variants. #
+ # #
+ ###########################################################################
+
+ export "$" "," ";"
+ def @Cite body cite
+ {
+ macro "$" { @Ref }
+ def "," precedence 90 left x { x"," }
+ def ";" precedence 90 left x { x";" }
+
+ @MakeReferences @Case {
+# Yes @Yield { @RefCiteStyle cite }
+ Yes @Yield {
+ @BackEnd @Case {
+ { PlainText PostScript } @Yield { @RefCiteStyle cite }
+ PDF @Yield {
+#
+# VT: can't get this to work: need to ask JHK; I want the text following the "$" to be
+# the name of the link that we are trying to create a link to
+# { "__link_source=<<"label">>" }
+# @Graphic
+ { @RefCiteStyle cite }
+# { blue @Colour @Underline { @RefCiteStyle cite } }
+ }
+ }
+ }
+ else @Yield @Null
+ }
+ }
+
+ export "$" "," ";"
+ def @NoCite body cite
+ {
+ macro "$" { @NoRef }
+ def "," precedence 90 left x { x }
+ def ";" precedence 90 left x { x";" }
+
+ @MakeReferences @Case {
+ Yes @Yield { cite }
+ else @Yield @Null
+ }
+ }
+
+ export "$" "," ";"
+ def @ChapCite body cite
+ {
+ macro "$" { @ChapRef }
+ def "," precedence 90 left x { x"," }
+ def ";" precedence 90 left x { x";" }
+
+ @MakeReferences @Case {
+ Yes @Yield { @RefCiteStyle cite }
+ else @Yield @Null
+ }
+ }
+
+ export "$" "," ";"
+ def @NoChapCite body cite
+ {
+ macro "$" { @NoChapRef }
+ def "," precedence 90 left x { x }
+ def ";" precedence 90 left x { x";" }
+
+ @MakeReferences @Case {
+ Yes @Yield { cite }
+ else @Yield @Null
+ }
+ }
+
+ ###########################################################################
+ # #
+ # Floating figures. #
+ # #
+ ###########################################################################
+
+ export @Tag prefix
+ def @FigurePrefixMarker
+ named @Tag {}
+ named prefix {}
+ {
+ @Null
+ }
+
+ export @Tag count
+ def @FigureCounterMarker
+ named @Tag {}
+ named count {}
+ {
+ @Null
+ }
+
+ def @RawFigureNum right tag
+ {
+ @FigureCounterMarker&&tag @Open { @Next count }
+ }
+
+ def @FigureCounterIncrement
+ right tag
+ {
+ @FigureCounterMarker&&preceding @Tagged tag
+ // @FigurePrefixMarker&&preceding @Tagged tag
+ // @FigureCounterMarker count { @RawFigureNum tag }
+ // @NumberMarker @Tag { tag }
+ @Value { { @FigurePrefixMarker&&tag @Open { prefix } }
+ @Join {@FigureNumbers @Num @RawFigureNum tag}
+ }
+ }
+
+ def @BeginFigureCounter
+ left condition
+ right prefix
+ {
+ condition @Do {
+ @FigurePrefixMarker prefix { prefix }
+ // @FigureCounterMarker count { 0 }
+ }
+ }
+
+ def @EndFigureList { @Galley //@MidGap @EndFigureList }
+
+ def @Figure
+ named @Tag {}
+ named @Caption { dft }
+ named @ShortCaption { dft }
+ named @CaptionPos { @FigureCaptionPos }
+ named @Format
+ named @II right x { |@DisplayIndent x | }
+ named @QQ right x { |@DisplayIndent x |@DisplayIndent }
+ named @CC right x { |0.5rt x | }
+ named @RR right x { |1.0rt x | }
+ right @Body { @FigureFormat @Body }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ named @OnePage { dft }
+ named @Location { @FigureLocation }
+ right @Body
+ {
+ def @FigureNumber
+ {
+ @BypassNumber @Dft @NumberOf @Tag
+ }
+
+ def @ContentsCaption
+ {
+ @ShortCaption @Dft @Caption
+ }
+
+ def @OnePg
+ {
+ @OnePage @Case {
+ { No no } @Yield No
+ { Yes yes } @Yield Yes
+ dft @Yield { @Location @Case {
+ PageTop @Yield No
+ EvenPageTop @Yield No
+ FullPage @Yield No
+ EvenFullPage @Yield No
+ PageFoot @Yield Yes
+ ColTop @Yield No
+ ColFoot @Yield Yes
+ ColEnd @Yield No
+ Display @Yield Yes
+ AfterLine @Yield Yes
+ TryAfterLine @Yield Yes
+ Raw @Yield No
+ }
+ }
+ }
+ }
+
+ def @CaptionState
+ {
+ @Caption @Case {
+ dft @Yield None
+ else @Yield { @CaptionPos @Case {
+ { Below below } @Yield Below
+ { Above above } @Yield Above
+ } }
+ }
+ }
+
+ #def @FigureLabel
+ #{
+ # @FigureNumbers @Case {
+ # No @Yield @Null
+ # else @Yield {
+ # @CaptionFormat { {figure @WordVal @FigureWord} @NumSep @FigureNumber }
+ # }
+ # }
+ #}
+
+ def @CaptionVal
+ {
+ @FigureCaptionFont @Font @FigureCaptionBreak @Break
+ { ||0.5rt @FigureCaptionFormat
+ word { figure @WordVal @FigureWord }
+ number { @FigureNumber }
+ caption { @Caption }
+ }
+ }
+
+ def @FigureVal
+ {
+ @InitialLanguage @Language
+ {
+ @MakeFigureContents @FigureContentsEntry
+ indent { 0f }
+ number { @FigureNumber }
+ title { @InitialLanguage @Language @ContentsCaption }
+ pagenum { @PageOf @Tag }
+ // @FigureCounterIncrement @Tag
+ // @PageMark @Tag
+ // @Body
+ }
+ }
+
+ def @FigureTarget
+ {
+ @Location @Case {
+ PageTop @Yield @PageTopPlace&&following
+ EvenPageTop @Yield @PageTopPlace&&following
+ FullPage @Yield @FullPagePlace&&following
+ EvenFullPage @Yield @FullPagePlace&&following
+ PageFoot @Yield @PageFootAndTopPlace&&following
+ ColTop @Yield @ColTopPlace&&following
+ ColFoot @Yield @ColFootAndTopPlace&&following
+ ColEnd @Yield @EndFigureList&&following
+ Display @Yield @AfterLinePlace&&following
+ AfterLine @Yield @AfterLinePlace&&following
+ TryAfterLine @Yield @TryAfterLinePlace&&following
+ }
+ }
+
+ def @SendEncl into { @FigureTarget }
+ right x
+ {
+ def @Enclose right x
+ {
+ @OnePg @Case {
+ No @Yield @Format x
+ Yes @Yield x
+ }
+ }
+
+ x
+ }
+
+ def @Send into { @FigureTarget }
+ right x
+ {
+ x
+ }
+
+ def @EvenFullPageSend into { @EvenFullPagePlace&&following }
+ right x
+ {
+ @OneRow x
+ }
+
+ def @EvenPageSend into { @EvenPagePlace&&following }
+ right x
+ {
+ @OneRow x
+ }
+
+ def @RawFigureVal
+ {
+ @OnePg.@CaptionState @Case
+ {
+ Yes.Below @Yield @OneRow { @Format @FigureVal @DP @CaptionVal }
+ Yes.Above @Yield @OneRow { @CaptionVal @DP @Format @FigureVal }
+ Yes.None @Yield @OneRow { @Format @FigureVal }
+ No.Below @Yield { @Format @FigureVal @DP @CaptionVal }
+ No.Above @Yield { @CaptionVal @DP @Format @FigureVal }
+ No.None @Yield { @Format @FigureVal }
+ }
+ }
+
+ def @NonRawFigureVal
+ {
+ @OnePg.@CaptionState @Case
+ {
+ Yes.Below @Yield {
+ @Send @OneRow { @Format @FigureVal @DP @CaptionVal // @DupRunner}
+ }
+ Yes.Above @Yield {
+ @Send @OneRow { @CaptionVal @DP @Format @FigureVal // @DupRunner}
+ }
+ Yes.None @Yield {
+ @Send @OneRow { @Format @FigureVal // @DupRunner }
+ }
+ No.Below @Yield {
+ @SendEncl { @FigureVal // @Send { @CaptionVal // @DupRunner } }
+ }
+ No.Above @Yield {
+ @Send { @CaptionVal // @SendEncl { @FigureVal // @DupRunner } }
+ }
+ No.None @Yield {
+ @SendEncl { @FigureVal // @DupRunner }
+ }
+ }
+ }
+
+ @Location @Case {
+ Raw @Yield @RawFigureVal
+ Display @Yield { @NonRawFigureVal &1rt }
+ EvenPageTop @Yield @EvenPageSend @NonRawFigureVal
+ EvenFullPage @Yield @EvenFullPageSend @NonRawFigureVal
+ else @Yield @NonRawFigureVal
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Floating tables (exact clone of figure code immediately above). #
+ # #
+ ###########################################################################
+
+ export @Tag prefix
+ def @TablePrefixMarker
+ named @Tag {}
+ named prefix {}
+ {
+ @Null
+ }
+
+ export @Tag count
+ def @TableCounterMarker
+ named @Tag {}
+ named count {}
+ {
+ @Null
+ }
+
+ def @RawTableNum right tag
+ {
+ @TableCounterMarker&&tag @Open { @Next count }
+ }
+
+ def @TableCounterIncrement
+ right tag
+ {
+ @TableCounterMarker&&preceding @Tagged tag
+ // @TablePrefixMarker&&preceding @Tagged tag
+ // @TableCounterMarker count { @RawTableNum tag }
+ // @NumberMarker @Tag { tag }
+ @Value { { @TablePrefixMarker&&tag @Open { prefix } }
+ @Join {@TableNumbers @Num @RawTableNum tag}
+ }
+ }
+
+ def @BeginTableCounter
+ left condition
+ right prefix
+ {
+ condition @Do {
+ @TablePrefixMarker prefix { prefix }
+ // @TableCounterMarker count { 0 }
+ }
+ }
+
+ def @EndTableList { @Galley //@MidGap @EndTableList }
+
+ def @Table
+ named @Tag {}
+ named @Caption { dft }
+ named @ShortCaption { dft }
+ named @CaptionPos { @TableCaptionPos }
+ named @Format
+ named @II right x { |@DisplayIndent x | }
+ named @QQ right x { |@DisplayIndent x |@DisplayIndent }
+ named @CC right x { |0.5rt x | }
+ named @RR right x { |1.0rt x | }
+ right @Body { @TableFormat @Body }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ named @OnePage { dft }
+ named @Location { @TableLocation }
+ right @Body
+ {
+ def @TableNumber
+ {
+ @BypassNumber @Dft @NumberOf @Tag
+ }
+
+ def @ContentsCaption
+ {
+ @ShortCaption @Dft @Caption
+ }
+
+ def @OnePg
+ {
+ @OnePage @Case {
+ { No no } @Yield No
+ { Yes yes } @Yield Yes
+ dft @Yield { @Location @Case {
+ PageTop @Yield No
+ EvenPageTop @Yield No
+ FullPage @Yield No
+ EvenFullPage @Yield No
+ PageFoot @Yield Yes
+ ColTop @Yield No
+ ColFoot @Yield Yes
+ ColEnd @Yield No
+ Display @Yield Yes
+ AfterLine @Yield Yes
+ TryAfterLine @Yield Yes
+ Raw @Yield No
+ }
+ }
+ }
+ }
+
+ def @CaptionState
+ {
+ @Caption @Case {
+ dft @Yield None
+ else @Yield { @CaptionPos @Case {
+ { Below below } @Yield Below
+ { Above above } @Yield Above
+ } }
+ }
+ }
+
+ #def @TableLabel
+ #{
+ # @TableNumbers @Case {
+ # No @Yield @Null
+ # else @Yield {
+ # @CaptionFormat { {table @WordVal @TableWord} @NumSep @TableNumber }
+ # }
+ # }
+ #}
+
+ def @CaptionVal
+ {
+ @TableCaptionFont @Font @TableCaptionBreak @Break
+ { ||0.5rt @TableCaptionFormat
+ word { table @WordVal @TableWord }
+ number { @TableNumber }
+ caption { @Caption }
+ }
+ }
+
+ def @TableVal
+ {
+ @InitialLanguage @Language
+ {
+ @MakeTableContents @TableContentsEntry
+ indent { 0f }
+ number { @TableNumber }
+ title { @InitialLanguage @Language @ContentsCaption }
+ pagenum { @PageOf @Tag }
+ // @TableCounterIncrement @Tag
+ // @PageMark @Tag
+ // @Body
+ }
+ }
+
+ def @TableTarget
+ {
+ @Location @Case {
+ PageTop @Yield @PageTopPlace&&following
+ EvenPageTop @Yield @PageTopPlace&&following
+ FullPage @Yield @FullPagePlace&&following
+ EvenFullPage @Yield @FullPagePlace&&following
+ PageFoot @Yield @PageFootAndTopPlace&&following
+ ColTop @Yield @ColTopPlace&&following
+ ColFoot @Yield @ColFootAndTopPlace&&following
+ ColEnd @Yield @EndTableList&&following
+ Display @Yield @AfterLinePlace&&following
+ AfterLine @Yield @AfterLinePlace&&following
+ TryAfterLine @Yield @TryAfterLinePlace&&following
+ }
+ }
+
+ def @SendEncl into { @TableTarget }
+ right x
+ {
+ def @Enclose right x
+ {
+ @OnePg @Case {
+ No @Yield @Format x
+ Yes @Yield x
+ }
+ }
+
+ x
+ }
+
+ def @Send into { @TableTarget }
+ right x
+ {
+ x
+ }
+
+ def @EvenFullPageSend into { @EvenFullPagePlace&&following }
+ right x
+ {
+ @OneRow x
+ }
+
+ def @EvenPageSend into { @EvenPagePlace&&following }
+ right x
+ {
+ @OneRow x
+ }
+
+ def @RawTableVal
+ {
+ @OnePg.@CaptionState @Case
+ {
+ Yes.Below @Yield @OneRow { @Format @TableVal @DP @CaptionVal }
+ Yes.Above @Yield @OneRow { @CaptionVal @DP @Format @TableVal }
+ Yes.None @Yield @OneRow { @Format @TableVal }
+ No.Below @Yield { @Format @TableVal @DP @CaptionVal }
+ No.Above @Yield { @CaptionVal @DP @Format @TableVal }
+ No.None @Yield { @Format @TableVal }
+ }
+ }
+
+ def @NonRawTableVal
+ {
+ @OnePg.@CaptionState @Case
+ {
+ Yes.Below @Yield {
+ @Send @OneRow { @Format @TableVal @DP @CaptionVal // @DupRunner}
+ }
+ Yes.Above @Yield {
+ @Send @OneRow { @CaptionVal @DP @Format @TableVal // @DupRunner}
+ }
+ Yes.None @Yield {
+ @Send @OneRow { @Format @TableVal // @DupRunner }
+ }
+ No.Below @Yield {
+ @SendEncl { @TableVal // @Send { @CaptionVal // @DupRunner } }
+ }
+ No.Above @Yield {
+ @Send { @CaptionVal // @SendEncl { @TableVal // @DupRunner } }
+ }
+ No.None @Yield {
+ @SendEncl { @TableVal // @DupRunner }
+ }
+ }
+ }
+
+ @Location @Case {
+ Raw @Yield @RawTableVal
+ Display @Yield { @NonRawTableVal &1rt }
+ EvenPageTop @Yield @EvenPageSend @NonRawTableVal
+ EvenFullPage @Yield @EvenFullPageSend @NonRawTableVal
+ else @Yield @NonRawTableVal
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Index. #
+ # #
+ ###########################################################################
+
+ def @IndexList { @Galley //1vx @IndexList }
+ def @BypassIndexList { @Galley //1vx @BypassIndexList }
+
+ def @IndexSection into { @IndexPlace&&following }
+ right etc
+ {
+ // @IndexBreak @Break @IndexList
+ // @IndexBreak @Break @BypassIndexList // etc
+ }
+
+ def @DoIndex into { @IndexList&&following }
+ left @Key
+ named indent { 0f }
+ right @Body
+ {
+ def @Merge left x right y
+ {
+ {x @Rump y} @Case
+ {
+ "" @Yield x
+ else @Yield { { x &"0.03fu" , } @Meld y }
+ }
+
+################################ obsolete ###################################
+# {x @Rump y} @Case
+# {
+# "" @Yield x
+# else @Yield {
+# { {x @Rump y} @Common "," } @Case
+# {
+# "," @Yield { x &"0.03fu" x @Rump y }
+# else @Yield { x &"0.03fu" , x @Rump y }
+# }
+# }
+# }
+#############################################################################
+ }
+
+ @IndexFont @Font @IndexBreak @Break { indent @Wide & @Body }
+ }
+
+ def @RawIndex
+ left x
+ named @Tag {}
+ named indent { 0f }
+ right y
+ {
+ @MakeIndex @Case {
+ Yes @Yield { {@PageMark @Tag} x @DoIndex indent { indent } y }
+ else @Yield @Null
+ }
+ }
+
+ macro @RawSubIndex { @RawIndex indent { "1f" } }
+ macro @RawSubSubIndex { @RawIndex indent { "2f" } }
+
+ def @Index
+ left x
+ named @Tag {}
+ named indent { 0f }
+ named to {}
+ right y
+ {
+ def numval
+ {
+# to @Case
+# {
+# "" @Yield @PageOf @Tag
+# else @Yield {
+# { @PageOf @Tag } @Case
+# {
+# { @PageOf to } @Yield { @PageOf @Tag }
+# else @Yield { {@PageOf @Tag}--{@PageOf to} }
+# }
+# }
+# }
+ @BackEnd @Case {
+ { PlainText PostScript } @Yield {
+ to @Case
+ {
+ "" @Yield @PageOf @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PageOf @Tag }
+ else @Yield { {@PageOf @Tag}--{@PageOf to} }
+ }
+ }
+ }
+ }
+#
+# PDF: Index entries produce a blue underlined hyperlink for the page number
+#
+ PDF @Yield {
+ { "__link_source=<<"@Tag">>" }
+ @Graphic { blue @Colour @Underline {
+ to @Case
+ {
+ "" @Yield @PageOf @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PageOf @Tag }
+ else @Yield { {@PageOf @Tag}--{@PageOf to} }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @MakeIndex @Case {
+ Yes @Yield {
+ @BackEnd @Case {
+ { PostScript PlainText } @Yield {
+ @PageMark @Tag
+ x @DoIndex indent { indent } { y &"0.03fu" , numval }
+ }
+ PDF @Yield {
+ {"__link_target=<<"@Tag">>"} @Graphic {""}
+ @PageMark @Tag
+ x @DoIndex indent { indent } { y &"0.03fu" , numval }
+ }
+ }
+ }
+# Yes @Yield { @PageMark @Tag
+# x @DoIndex indent { indent } { y &"0.03fu" , numval }
+# }
+ else @Yield @Null
+ }
+ }
+
+ macro @SubIndex { @Index indent { "1f" } }
+ macro @SubSubIndex { @Index indent { "2f" } }
+
+ def @IndexBlanks
+ {
+ b @RawIndex {} c @RawIndex {} d @RawIndex {} e @RawIndex {}
+ f @RawIndex {} g @RawIndex {} h @RawIndex {} i @RawIndex {}
+ j @RawIndex {} k @RawIndex {} l @RawIndex {} m @RawIndex {}
+ n @RawIndex {} o @RawIndex {} p @RawIndex {} q @RawIndex {}
+ r @RawIndex {} s @RawIndex {} t @RawIndex {} u @RawIndex {}
+ v @RawIndex {} w @RawIndex {} x @RawIndex {} y @RawIndex {}
+ z @RawIndex {}
+ }
+
+ def @BypassBeginIndexPlace { @Galley }
+
+ def @BypassBeginIndex force into { @BypassBeginIndexPlace&&preceding } {}
+
+ def @BypassRawIndex force into { @BypassIndexList&&preceding }
+ named indent { 0f }
+ right x
+ {
+ &indent x
+ }
+
+ def @BypassEndIndex { @Null }
+
+
+ ###########################################################################
+ # #
+ # IndexA. #
+ # #
+ ###########################################################################
+
+ def @IndexAList { @Galley //1vx @IndexAList }
+ def @BypassIndexAList { @Galley //1vx @BypassIndexAList }
+
+ def @IndexASection into { @IndexAPlace&&following }
+ right etc
+ {
+ // @IndexAList // etc
+ // @BypassIndexAList // etc
+ }
+
+ def @DoIndexA into { @IndexAList&&following }
+ left @Key
+ named indent { 0f }
+ right @Body
+ {
+ def @Merge left x right y
+ {
+ {x @Rump y} @Case
+ {
+ "" @Yield x
+ else @Yield { { x &"0.03fu" , } @Meld y }
+ }
+ }
+
+ @IndexAFont @Font @IndexABreak @Break { indent @Wide & @Body }
+ }
+
+ def @RawIndexA
+ left x
+ named @Tag {}
+ named indent { 0f }
+ right y
+ {
+ @MakeIndexA @Case {
+ Yes @Yield { {@PageMark @Tag} x @DoIndexA indent { indent } y }
+ else @Yield @Null
+ }
+ }
+
+ macro @RawSubIndexA { @RawIndexA indent { "1f" } }
+ macro @RawSubSubIndexA { @RawIndexA indent { "2f" } }
+
+ def @IndexA
+ left x
+ named @Tag {}
+ named indent { 0f }
+ named to {}
+ right y
+ {
+ def numval
+ {
+# to @Case
+# {
+# "" @Yield @PageOf @Tag
+# else @Yield {
+# { @PageOf @Tag } @Case
+# {
+# { @PageOf to } @Yield { @PageOf @Tag }
+# else @Yield { {@PageOf @Tag}--{@PageOf to} }
+# }
+# }
+# }
+ @BackEnd @Case {
+ { PostScript PlainText } @Yield {
+ to @Case
+ {
+ "" @Yield @PageOf @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PageOf @Tag }
+ else @Yield { {@PageOf @Tag}--{@PageOf to} }
+ }
+ }
+ }
+ }
+#
+# PDF: Index entries produce a blue underlined hyperlink for the page number
+#
+ PDF @Yield {
+ { "__link_source=<<"@Tag">>" }
+ @Graphic { blue @Colour @Underline {
+ to @Case
+ {
+ "" @Yield @PageOf @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PageOf @Tag }
+ else @Yield { {@PageOf @Tag}--{@PageOf to} }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @MakeIndexA @Case {
+ Yes @Yield { @PageMark @Tag
+ x @DoIndexA indent { indent } { y &"0.03fu" , numval }
+ }
+ else @Yield @Null
+ }
+ }
+
+ macro @SubIndexA { @IndexA indent { "1f" } }
+ macro @SubSubIndexA { @IndexA indent { "2f" } }
+
+ def @IndexABlanks
+ {
+ b @RawIndexA {} c @RawIndexA {} d @RawIndexA {} e @RawIndexA {}
+ f @RawIndexA {} g @RawIndexA {} h @RawIndexA {} i @RawIndexA {}
+ j @RawIndexA {} k @RawIndexA {} l @RawIndexA {} m @RawIndexA {}
+ n @RawIndexA {} o @RawIndexA {} p @RawIndexA {} q @RawIndexA {}
+ r @RawIndexA {} s @RawIndexA {} t @RawIndexA {} u @RawIndexA {}
+ v @RawIndexA {} w @RawIndexA {} x @RawIndexA {} y @RawIndexA {}
+ z @RawIndexA {}
+ }
+
+ def @BypassBeginIndexAPlace { @Galley }
+
+ def @BypassBeginIndexA force into { @BypassBeginIndexAPlace&&preceding } {}
+
+ def @BypassRawIndexA force into { @BypassIndexAList&&preceding }
+ named indent { 0f }
+ right x
+ {
+ &indent x
+ }
+
+ def @BypassEndIndexA { @Null }
+
+
+ ###########################################################################
+ # #
+ # IndexB. #
+ # #
+ ###########################################################################
+
+ def @IndexBList { @Galley //1vx @IndexBList }
+ def @BypassIndexBList { @Galley //1vx @BypassIndexBList }
+
+ def @IndexBSection into { @IndexBPlace&&following }
+ right etc
+ {
+ // @IndexBList // etc
+ // @BypassIndexBList // etc
+ }
+
+ def @DoIndexB into { @IndexBList&&following }
+ left @Key
+ named indent { 0f }
+ right @Body
+ {
+ def @Merge left x right y
+ {
+ {x @Rump y} @Case
+ {
+ "" @Yield x
+ else @Yield { { x &"0.03fu" , } @Meld y }
+ }
+ }
+
+ @IndexBFont @Font @IndexBBreak @Break { indent @Wide & @Body }
+ }
+
+ def @RawIndexB
+ left x
+ named @Tag {}
+ named indent { 0f }
+ right y
+ {
+ @MakeIndexB @Case {
+ Yes @Yield { {@PageMark @Tag} x @DoIndexB indent { indent } y }
+ else @Yield @Null
+ }
+ }
+
+ macro @RawSubIndexB { @RawIndexB indent { "1f" } }
+ macro @RawSubSubIndexB { @RawIndexB indent { "2f" } }
+
+ def @IndexB
+ left x
+ named @Tag {}
+ named indent { 0f }
+ named to {}
+ right y
+ {
+ def numval
+ {
+# to @Case
+# {
+# "" @Yield @PageOf @Tag
+# else @Yield {
+# { @PageOf @Tag } @Case
+# {
+# { @PageOf to } @Yield { @PageOf @Tag }
+# else @Yield { {@PageOf @Tag}--{@PageOf to} }
+# }
+# }
+# }
+ @BackEnd @Case {
+ { PostScript PlainText } @Yield {
+ to @Case
+ {
+ "" @Yield @PageOf @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PageOf @Tag }
+ else @Yield { {@PageOf @Tag}--{@PageOf to} }
+ }
+ }
+ }
+ }
+#
+# PDF: Index entries produce a blue underlined hyperlink for the page number
+#
+ PDF @Yield {
+ { "__link_source=<<"@Tag">>" }
+ @Graphic { blue @Colour @Underline {
+ to @Case
+ {
+ "" @Yield @PageOf @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PageOf @Tag }
+ else @Yield { {@PageOf @Tag}--{@PageOf to} }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @MakeIndexB @Case {
+ Yes @Yield { @PageMark @Tag
+ x @DoIndexB indent { indent } { y &"0.03fu" , numval }
+ }
+ else @Yield @Null
+ }
+ }
+
+ macro @SubIndexB { @IndexB indent { "1f" } }
+ macro @SubSubIndexB { @IndexB indent { "2f" } }
+
+ def @IndexBBlanks
+ {
+ b @RawIndexB {} c @RawIndexB {} d @RawIndexB {} e @RawIndexB {}
+ f @RawIndexB {} g @RawIndexB {} h @RawIndexB {} i @RawIndexB {}
+ j @RawIndexB {} k @RawIndexB {} l @RawIndexB {} m @RawIndexB {}
+ n @RawIndexB {} o @RawIndexB {} p @RawIndexB {} q @RawIndexB {}
+ r @RawIndexB {} s @RawIndexB {} t @RawIndexB {} u @RawIndexB {}
+ v @RawIndexB {} w @RawIndexB {} x @RawIndexB {} y @RawIndexB {}
+ z @RawIndexB {}
+ }
+
+ def @BypassBeginIndexBPlace { @Galley }
+
+ def @BypassBeginIndexB force into { @BypassBeginIndexBPlace&&preceding } {}
+
+ def @BypassRawIndexB force into { @BypassIndexBList&&preceding }
+ named indent { 0f }
+ right x
+ {
+ &indent x
+ }
+
+ def @BypassEndIndexB { @Null }
+
+
+ ###########################################################################
+ # #
+ # @LargeScaleStructure #
+ # #
+ # The prototype for the value of each large-scale structure symbol #
+ # (@Chapter, @Section, etc.) #
+ # #
+ ###########################################################################
+
+ def @LargeScaleStructure
+ named tag {} # tag of this large-scale structure sym
+ named type {} # MajorIntro, Major, VeryMajor, or Minor
+ named initiallanguage {} # its language
+ named title {} # its full title
+ named runningtitle {} # its running title
+ named aboveheadinggap { 0f } # gap above heading
+ named headingfont {} # its heading font
+ named headingbreak {} # its heading break
+ named headingformat # its heading format
+ left @Num right @Body {}
+ named incontents { No } # entry in table of contents required
+ named contentsindent { 0f } # only if type is Major
+ named word {}
+ named numbers { None }
+ named attachnum {} # only if numbers is not None
+ named retrievenum {} # only if numbers is not None
+ named bypassnumber {} # only if numbers is not None, or VeryMajor
+ named prefix {} # prefix of number of this symbol
+ named pnprefix {} # prefix for page numbers of this sym
+ named majornum { dft }
+ named majortitle { dft }
+ named minornum { dft }
+ named minortitle { dft }
+ named intheorems { No }
+ named indisplays { No }
+ named infigures { No }
+ named intables { No }
+ named inrunners { No }
+ named sendheader right @Body {}
+ named innergap {}
+ named endifmajor right innergap {
+ @EndFigureList
+ //innergap @EndNoteList 1
+ //innergap @ChapRefSection
+ }
+ named wantindefinite { No }
+ right @Body
+ {
+
+ def @ShortNum
+ {
+ numbers @Then {
+ bypassnumber @Dft {
+ prefix @Join { numbers @Num retrievenum }
+ }
+ }
+ }
+
+ def @LongNum
+ {
+ numbers @Then {
+ initiallanguage @Language { word @NumSep @ShortNum }
+ }
+ }
+
+ def @ShortTitle
+ {
+ initiallanguage @Language { runningtitle @Dft title }
+ }
+
+ def @Run right start
+ {
+ inrunners @Do type @Case {
+
+ { Major MajorIntro } @Yield {
+ start @Runner
+ @MajorNum { majornum @Dft @LongNum }
+ @MajorTitle { majortitle @Dft @ShortTitle }
+ @MinorNum {}
+ @MinorTitle {}
+ @Owner { tag }
+ @Prefix { pnprefix @Join @ShortNum }
+ }
+
+ { ExtraMajor ExtraMajorIntro } @Yield {
+ start @Runner
+ @MajorNum { majornum @Dft @LongNum }
+ @MajorTitle { majortitle @Dft @ShortTitle }
+ @MinorNum { majornum @Dft @LongNum }
+ @MinorTitle { majortitle @Dft @ShortTitle }
+ @Owner { tag }
+ @Prefix { pnprefix @Join @ShortNum }
+ }
+
+ { VeryMajor } @Yield {
+ start @Runner
+ @MajorNum { majornum @Dft @LongNum }
+ @MajorTitle { majortitle @Dft @ShortTitle }
+ @MinorNum {}
+ @MinorTitle {}
+ @Owner { tag }
+ @Prefix {}
+ }
+
+ Minor @Yield {
+ start @Runner
+ @MajorNum { majornum @Dft @LongNum }
+ @MajorTitle { majortitle @Dft @ShortTitle }
+ @MinorNum { minornum @Dft @LongNum }
+ @MinorTitle { minortitle @Dft @ShortTitle }
+ @Owner { tag }
+ @Prefix { pnprefix @Join @ShortNum }
+ }
+ }
+ }
+
+ def @ContentsStuff
+ {
+ incontents.type @Case {
+
+ Yes.Minor @Yield {
+ incontents @ContentsEntry
+ indent { contentsindent }
+ number { @LongNum }
+ title { initiallanguage @Language title }
+ pagenum { @PageOf tag }
+ }
+
+ { Yes.Major Yes.MajorIntro Yes.ExtraMajor Yes.ExtraMajorIntro } @Yield {
+ incontents @MajorContentsEntry
+ number { @LongNum }
+ title { initiallanguage @Language title }
+ pagenum { @PageOf tag }
+ }
+
+ { Yes.VeryMajor } @Yield {
+ incontents @VeryMajorContentsEntry
+ title { initiallanguage @Language { bypassnumber: &2s title } }
+ }
+
+ else @Yield @Null
+ }
+ }
+
+ def @Heading
+ {
+ def @AttachPDFLink
+ left title
+ right x
+ {
+ @BackEnd @Case {
+
+ # VTan: Rats! Cannot use the tag for the name of the link
+ # because the source link has no access to the tag
+ #
+ # using title will work most of the time; it will fail
+ # with a "problem with left parameter of @Graphic" warning
+ # message if the title has objects other than text in it.
+ # Eg, "@Title { My @FancyTitle }" with
+ # "def @FancyTitle { @OneCol { @Bold "fancy" "title" }" }
+ #
+ # Example: the user manual has a definition for @Tex which
+ # causes this warning message to appear
+
+ PDF @Yield {
+ title @Case {
+ "" @Yield x
+ else @Yield {
+ "__link_target_for_export=<<"title">>"
+ @Graphic x
+ }
+ }
+ }
+
+ else @Yield x
+ }
+ }
+
+ type @Case {
+
+ Minor @Yield title @AttachPDFLink {
+ headingfont @Font
+ headingbreak @Break @Protect {@LongNum headingformat title}
+ // @PageMark tag
+ }
+
+ { Major MajorIntro ExtraMajor ExtraMajorIntro } @Yield {
+ sendheader { title @AttachPDFLink {
+ //aboveheadinggap
+ headingfont @Font
+ headingbreak @Break { @LongNum headingformat title }
+ // @PageMark tag
+ } }
+ }
+
+ { VeryMajor } @Yield { sendheader { title @AttachPDFLink {
+ //aboveheadinggap
+ headingfont @Font
+ headingbreak @Break { bypassnumber headingformat title }
+ // @PageMark tag
+ } }
+ }
+ }
+ }
+
+ def @IfMajor right x
+ {
+ type @Case {
+ { MajorIntro Major ExtraMajor ExtraMajorIntro } @Yield x
+ else @Yield @Null
+ }
+ }
+
+ def @StartIfMajor {
+ type @Case {
+ { MajorIntro Major ExtraMajor ExtraMajorIntro VeryMajor } @Yield Start
+ else @Yield NonStart
+ }
+ }
+
+ initiallanguage @Language {
+ @Heading
+ // wantindefinite @Case {
+ Yes @Yield @Null
+ No @Yield ""
+ }
+ // numbers @Do {
+ attachnum & @NumberMarker @Tag { tag } @Value { @ShortNum }
+ }
+ # // @PageMark tag
+ // @IfMajor { @FootNoteThrough @Do @BeginFootNoteCounter }
+ // @Run @StartIfMajor
+ // @ContentsStuff
+ // intheorems @BeginAllCounters @ShortNum
+ // indisplays @BeginDisplayCounter @ShortNum
+ // infigures @BeginFigureCounter @ShortNum
+ // intables @BeginTableCounter @ShortNum
+ // @Body
+ //innergap @IfMajor endifmajor innergap
+ // @Run NonStart
+ }
+ }
+
+@End @DocumentSetup
diff --git a/include/eq b/include/eq
new file mode 100644
index 0000000..b8cd1f0
--- /dev/null
+++ b/include/eq
@@ -0,0 +1,27 @@
+###############################################################################
+# #
+# Lout setup file for equation formatting #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# The @SysInclude { eqf } line #
+# #
+# This line causes Lout to read the definitions for equations, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { eqf }
+
+
+###############################################################################
+# #
+# This package does not offer default options that can be changed. #
+# #
+###############################################################################
diff --git a/include/eqf b/include/eqf
new file mode 100644
index 0000000..4437edf
--- /dev/null
+++ b/include/eqf
@@ -0,0 +1,1643 @@
+
+###############################################################################
+# #
+# Lout @Eq package for equation formatting (Version 3.0) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, December 1990. #
+# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. #
+# Version 3.0 by Jeffrey H. Kingston and Robert Marsa, March 1996. #
+# #
+# This package makes extensive use of the Adobe Systems Symbol font, and #
+# it assumes that the font has not been recoded. It could be rewritten #
+# using the @Char symbol to be made independent of any recoding, but since #
+# there seems no reason to ever recode this font, I haven't bothered. #
+# #
+# See "Eq - a Lout package for typesetting mathematics" for user #
+# information. Acknowledgement: the @Eq language is based closely on #
+# the Eqn language of B. W. Kernighan and L. L. Cherry; the spacing rules #
+# are similar to those of the TeX system by D. E. Knuth. #
+# #
+# Version 3.0 makes use of the new x and y units of measurement to improve #
+# the spacing rules. #
+# #
+###############################################################################
+
+export "`" "``" "```" bin rel punct non vctr big
+
+ space exclam universal numbersign existential percent
+ ampersand suchthat parenleft parenright asteriskmath
+ plus comma minus period slash zero one two three four
+ five six seven eight nine colon semicolon less equal
+ greater question congruent Alpha Beta Chi Delta Epsilon
+ Phi Gamma Eta Iota thetaone Kappa Lambda Mu Nu Omicron
+ Pi Theta Rho Sigma Tau Upsilon sigmaone Omega Xi Psi Zeta
+ bracketleft therefore bracketright perpendicular underscore
+ radicalex alpha beta chi delta epsilon phi gamma eta iota
+ phione kappa lambda mu nu omicron pi theta rho sigma tau
+ upsilon omegaone omega xi psi zeta braceleft bar braceright
+ similar Upsilonone minute lessequal fraction infinity florin
+ club diamond heart spade arrowboth arrowleft arrowup
+ arrowright arrowdown degree plusminus second greaterequal
+ multiply proportional partialdiff bullet divide notequal
+ equivalence approxequal ellipsis arrowvertex arrowhorizex
+ carriagereturn aleph Ifraktur Rfraktur weierstrass
+ circlemultiply circleplus emptyset intersection union
+ propersuperset reflexsuperset notsubset propersubset
+ reflexsubset element notelement angle gradient registerserif
+ copyrightserif trademarkserif product radical dotmath
+ logicalnot logicaland logicalor arrowdblboth arrowdblleft
+ arrowdblup arrowdblright arrowdbldown lozenge angleleft
+ registersans copyrightsans trademarksans summation parenlefttp
+ parenleftex parenleftbt bracketlefttp bracketleftex
+ bracketleftbt bracelefttp braceleftmid braceleftbt braceex
+ angleright integral integraltp integralex integralbt
+ parenrighttp parenrightex parenrightbt bracketrighttp
+ bracketrightex bracketrightbt bracerighttp bracerightmid
+ bracerightbt
+
+ hbar Re Im partial infty prime nabla surd top bot dbar
+ triangle backslash forall exists neg circle square
+
+ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
+
+ sum prod coprod int oint bcap bcup bvee bwedge bodot botimes
+ boplus buplus
+
+ "+" "-" "+-" "-+" setminus cdot times "*" circ div cap cup uplus
+ sqcap sqcup triangleleft triangleright wr bigcirc bigtriangleup
+ bigtriangledown vee wedge oplus ominus otimes oslash odot dagger
+ daggerdbl amalg
+
+ "<" ">" "=" "<=" prec preceq "<<" subset subseteq sqsubseteq
+ in vdash smile frown ">=" succ succeq ">>" supset supseteq
+ sqsupseteq ni dashv mid parallel "==" "~" "-~" asymp "~~"
+ "=~" bowtie propto models doteq perp notsub notin "!=" not
+ "<->" "<--" "-->" up down "<=>" "<==" "==>" dblup dbldown
+ ":" "::" ":="
+
+ lpar blpar rpar brpar lbrack blbrack rbrack brbrack lbrace blbrace
+ rbrace brbrace lfloor blfloor rfloor brfloor lceil blceil
+ rceil brceil langle blangle rangle brangle
+
+ ";" "," col
+
+ "!" "?" "%" "(" ")" "[" "]"
+
+ arccos arcsin arctan arg cos cosh cot coth csc deg det dim exp
+ gcd hom inf ker lg lim liminf limsup ln log max min Pr sec sin
+ sinh supr tan tanh mod ldots cdots vdots ddots del grad
+ "..." ",...," "'" "''" "'''" "''''" empty
+
+ leftarrow longleftarrow dblleftarrow dbllongleftarrow
+ rightarrow longrightarrow dblrightarrow dbllongrightarrow
+ leftrightarrow longleftrightarrow dblleftrightarrow dbllongleftrightarrow
+ mapsto longmapsto hookleftarrow hookrightarrow leadsto
+ leftharpoonup rightharpoonup leftharpoondown rightharpoondown
+ rightleftharpoons
+ uparrow dbluparrow downarrow dbldownarrow updownarrow dblupdownarrow
+ nearrow searrow swarrow nwarrow
+
+ sup sub tsub supp on ton frac half third over from to widefrom wideto
+ dot dotdot hat tilde vec dyad overbar underbar sqrt root
+ nextcol above labove cabove rabove mabove
+ matrix pmatrix bmatrix brmatrix fmatrix cmatrix amatrix
+
+def @Eq
+ body @Body
+@Begin
+
+
+ ###################################################################
+ # #
+ # Context-sensitive format changes. #
+ # #
+ # Equation formatting (according to Knuth) demands changes in #
+ # the appearance of equations depending on context. These are: #
+ # #
+ # @Smaller x Superscripts and subscripts are to be set #
+ # in a smaller font size. The @Smaller #
+ # symbol implements this by changing the #
+ # f unit. #
+ # #
+ # @HSqueeze x The horizontal space surrounding binary #
+ # operators and relations is to be reduced #
+ # within superscripts and subscripts, etc. #
+ # The @HSqueeze symbol implements this by #
+ # changing the y unit, which is not used by #
+ # Lout but which is used by symbols @ThinGap, #
+ # @MedGap and @ThickGap. #
+ # #
+ # @VSqueeze x The vertical space taken by superscripts #
+ # and subscripts is to be reduced within #
+ # built-up fractions and under root signs. #
+ # The @VSqueeze symbol implements this by #
+ # changing the z unit, which is not used by #
+ # Lout but is used by the @SupGap symbol. #
+ # #
+ # Knuth also recommends some changes that depend on whether the #
+ # equation is displayed or inline; these are not implemented. #
+ # #
+ ###################################################################
+
+ def @SpaceGap { 0.05f }
+
+ def @Smaller right x { 0.7f @Font @SpaceGap @Space x }
+
+ def @HSqueeze right x { 0.2f @YUnit x }
+
+ def @VSqueeze right x { 0.7f @ZUnit x }
+
+ def @SkewGap { 0.05f }
+ def @SupGap { 0.43zk }
+ def @ThinGap { 0.15y }
+ def @MedGap { 0.20y }
+ def @ThickGap { 0.25y }
+ def @ColGap { 0.8f }
+ def @RowGap { 0.5f }
+
+ def "`" { &@ThinGap }
+ def "``" { &@MedGap }
+ def "```" { &@ThickGap }
+
+ def bin right x { `` x `` }
+ def rel right x { ``` x ``` }
+ def punct right x { x ` }
+ def non right x { 0c @YUnit x }
+ def big right x { 1.3f @Font @SpaceGap @Space x }
+
+ def @Base right x { Base @Font x }
+ def @Sym right x { {Symbol Base} @Font x }
+
+ def @HLine
+ named line { @BackEnd @Case { PostScript @Yield { "0.05 ft setlinewidth" } PDF @Yield { "__mul(__loutf, 0.05) w" } } }
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "0 0 moveto xsize 0 lineto" line "stroke" } @Graphic {}
+ }
+ PDF @Yield { # note re-arrangement of commands (setlinewidth (='w') not allowed in a path)
+ { line "0 0 m __xsize 0 l s" } @Graphic {}
+ }
+ }
+ }
+
+ def @VLine
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "0 0 moveto 0 ysize lineto 0.05 ft setlinewidth stroke" @Graphic {}
+ }
+ PDF @Yield {
+ "__mul(__loutf, 0.05) w 0 0 m 0 __ysize l s" @Graphic {}
+ }
+ }
+ }
+
+ def vctr
+ right x
+ {
+ 0.5w @VShift x
+ }
+
+ def @Strut right x
+ {
+ @OneCol { x | @OneRow { 0.5f @High ^/ 0.5f @High } }
+ }
+
+ ###################################################################
+ # #
+ # Full names #
+ # #
+ # These symbols and their names are taken directly from the #
+ # Adobe Systems Inc. Symbol font (see PostScript Language #
+ # Reference Manual, pp. 256-257). The only differences are: #
+ # #
+ # Adobe: theta1 Eq: thetaone #
+ # sigma1 sigmaone #
+ # phi1 phione #
+ # omega1 omegaone #
+ # #
+ # These were needed since Lout identifiers do not have digits. #
+ # #
+ ###################################################################
+
+ def space { @Sym "\040" }
+ def exclam { @Sym "\041" }
+ def universal { @Sym "\042" }
+ def numbersign { @Sym "\043" }
+ def existential { @Sym "\044" }
+ def percent { @Sym "\045" }
+ def ampersand { @Sym "\046" }
+ def suchthat { @Sym "\047" }
+ def parenleft { @Sym "\050" }
+ def parenright { @Sym "\051" }
+ def asteriskmath { @Sym "\052" }
+ def plus { @Sym "+" }
+ def comma { @Sym "\054" }
+ def minus { @Sym "-" }
+ def period { @Sym "\056" }
+ def slash { @Sym "\057" }
+ def zero { @Sym "\060" }
+ def one { @Sym "\061" }
+ def two { @Sym "\062" }
+ def three { @Sym "\063" }
+ def four { @Sym "\064" }
+ def five { @Sym "\065" }
+ def six { @Sym "\066" }
+ def seven { @Sym "\067" }
+ def eight { @Sym "\070" }
+ def nine { @Sym "\071" }
+ def colon { @Sym "\072" }
+ def semicolon { @Sym "\073" }
+ def less { @Sym "\074" }
+ def equal { @Sym "\075" }
+ def greater { @Sym "\076" }
+ def question { @Sym "\077" }
+ def congruent { @Sym "\100" }
+ def Alpha { @Sym "\101" }
+ def Beta { @Sym "\102" }
+ def Chi { @Sym "\103" }
+ def Delta { @Sym "\104" }
+ def Epsilon { @Sym "\105" }
+ def Phi { @Sym "\106" }
+ def Gamma { @Sym "\107" }
+ def Eta { @Sym "\110" }
+ def Iota { @Sym "\111" }
+ def thetaone { @Sym "\112" }
+ def Kappa { @Sym "\113" }
+
+ def Lambda { @Sym "\114" }
+ def Mu { @Sym "\115" }
+ def Nu { @Sym "\116" }
+ def Omicron { @Sym "\117" }
+ def Pi { @Sym "\120" }
+ def Theta { @Sym "\121" }
+ def Rho { @Sym "\122" }
+ def Sigma { @Sym "\123" }
+ def Tau { @Sym "\124" }
+ def Upsilon { @Sym "\125" }
+ def sigmaone { @Sym "\126" }
+ def Omega { @Sym "\127" }
+ def Xi { @Sym "\130" }
+ def Psi { @Sym "\131" }
+ def Zeta { @Sym "\132" }
+ def bracketleft { @Sym "\133" }
+ def therefore { @Sym "\134" }
+ def bracketright { @Sym "\135" }
+ def perpendicular { @Sym "\136" }
+ def underscore { @Sym "\137" }
+ def radicalex { @Sym "\140" }
+ def alpha { @Sym "\141" }
+ def beta { @Sym "\142" }
+ def chi { @Sym "\143" }
+ def delta { @Sym "\144" }
+ def epsilon { @Sym "\145" }
+ def phi { @Sym "\146" }
+ def gamma { @Sym "\147" }
+ def eta { @Sym "\150" }
+ def iota { @Sym "\151" }
+ def phione { @Sym "\152" }
+ def kappa { @Sym "\153" }
+ def lambda { @Sym "\154" }
+ def mu { @Sym "\155" }
+ def nu { @Sym "\156" }
+
+ def omicron { @Sym "\157" }
+ def pi { @Sym "\160" }
+ def theta { @Sym "\161" }
+ def rho { @Sym "\162" }
+ def sigma { @Sym "\163" }
+ def tau { @Sym "\164" }
+ def upsilon { @Sym "\165" }
+ def omegaone { @Sym "\166" }
+ def omega { @Sym "\167" }
+ def xi { @Sym "\170" }
+ def psi { @Sym "\171" }
+ def zeta { @Sym "\172" }
+ def braceleft { @Sym "\173" }
+ def bar { @Sym "\174" }
+ def braceright { @Sym "\175" }
+ def similar { @Sym "\176" }
+ def Upsilonone { @Sym "\241" }
+ def minute { @Sym "\242" }
+ def lessequal { @Sym "\243" }
+ def fraction { @Sym "\244" }
+ def infinity { "1.2f" @Font @Sym "\245" }
+ def florin { @Sym "\246" }
+ def club { @Sym "\247" }
+ def diamond { @Sym "\250" }
+ def heart { @Sym "\251" }
+ def spade { @Sym "\252" }
+ def arrowboth { @Sym "\253" }
+ def arrowleft { @Sym "\254" }
+ def arrowup { @Sym "\255" }
+ def arrowright { @Sym "\256" }
+ def arrowdown { @Sym "\257" }
+ def degree { @Sym "\260" }
+ def plusminus { @Sym "\261" }
+ def second { @Sym "\262" }
+ def greaterequal { @Sym "\263" }
+
+ def multiply { @Sym "\264" }
+ def proportional { @Sym "\265" }
+ def partialdiff { @Sym "\266" }
+ def bullet { @Sym "\267" }
+ def divide { @Sym "\270" }
+ def notequal { @Sym "\271" }
+ def equivalence { @Sym "\272" }
+ def approxequal { @Sym "\273" }
+ def ellipsis { @Sym "\274" }
+ def arrowvertex { @Sym "\275" }
+ def arrowhorizex { @Sym "\276" }
+ def carriagereturn { @Sym "\277" }
+ def aleph { @Sym "\300" }
+ def Ifraktur { @Sym "\301" }
+ def Rfraktur { @Sym "\302" }
+ def weierstrass { @Sym "\303" }
+ def circlemultiply { @Sym "\304" }
+ def circleplus { @Sym "\305" }
+ def emptyset { @Sym "\306" }
+ def intersection { @Sym "\307" }
+ def union { @Sym "\310" }
+ def propersuperset { @Sym "\311" }
+ def reflexsuperset { @Sym "\312" }
+ def notsubset { @Sym "\313" }
+ def propersubset { @Sym "\314" }
+ def reflexsubset { @Sym "\315" }
+ def element { @Sym "\316" }
+ def notelement { @Sym "\317" }
+ def angle { @Sym "\320" }
+ def gradient { @Sym "\321" }
+ def registerserif { @Sym "\322" }
+ def copyrightserif { @Sym "\323" }
+ def trademarkserif { @Sym "\324" }
+ def product { @Sym "\325" }
+ def radical { @Sym "\326" }
+ def dotmath { @Sym "\327" }
+
+ def @PureDot # dot with no extra space
+ {
+ @HContract { &0io 0.4w @HShift dotmath }
+ }
+
+ def logicalnot { @Sym "\330" }
+ def logicaland { @Sym "\331" }
+ def logicalor { @Sym "\332" }
+ def arrowdblboth { @Sym "\333" }
+ def arrowdblleft { @Sym "\334" }
+ def arrowdblup { @Sym "\335" }
+ def arrowdblright { @Sym "\336" }
+ def arrowdbldown { @Sym "\337" }
+ def lozenge { @Sym "\340" }
+ def angleleft { @Sym "\341" }
+ def registersans { @Sym "\342" }
+ def copyrightsans { @Sym "\343" }
+ def trademarksans { @Sym "\344" }
+ def summation { @Sym "\345" }
+ def parenlefttp { @Sym "\346" }
+ def parenleftex { @Sym "\347" }
+ def parenleftbt { @Sym "\350" }
+ def bracketlefttp { @Sym "\351" }
+ def bracketleftex { @Sym "\352" }
+ def bracketleftbt { @Sym "\353" }
+ def bracelefttp { @Sym "\354" }
+ def braceleftmid { @Sym "\355" }
+ def braceleftbt { @Sym "\356" }
+ def braceex { @Sym "\357" }
+ def angleright { @Sym "\361" }
+ def integral { @Sym "\362" }
+ def integraltp { @Sym "\363" }
+ def integralex { @Sym "\364" }
+ def integralbt { @Sym "\365" }
+ def parenrighttp { @Sym "\366" }
+ def parenrightex { @Sym "\367" }
+ def parenrightbt { @Sym "\370" }
+ def bracketrighttp { @Sym "\371" }
+ def bracketrightex { @Sym "\372" }
+ def bracketrightbt { @Sym "\373" }
+ def bracerighttp { @Sym "\374" }
+ def bracerightmid { @Sym "\375" }
+ def bracerightbt { @Sym "\376" }
+
+
+ ###################################################################
+ # #
+ # Short names #
+ # #
+ # These symbols, their names, and their spacing, are based on #
+ # the list in Appendix F of Donald E. Knuth's The TeXBook. #
+ # #
+ # Group 1 (lowercase Greek letters): see full names above #
+ # Group 2 (uppercase Greek letters): see full names above #
+ # Group 3 (calligraphic capitals): not provided by Eq #
+ # #
+ ###################################################################
+
+ ###################################################################
+ # #
+ # Group 4 (miscellaneous Ord symbols) #
+ # #
+ # Not all of Knuth's symbols are available. The four suits #
+ # (heartsuit, etc.), have definitions above. #
+ # #
+ ###################################################################
+
+ def hbar { @OneCol { &0.1f @Base "-" ^/0.25fo h } }
+ def Re { Rfraktur }
+ def Im { Ifraktur }
+ def partial { partialdiff }
+ def infty { infinity }
+ def prime { minute }
+ #def emptyset { defined above }
+ def nabla { gradient }
+ def surd { radical }
+ def top { 180d @Rotate perpendicular }
+ def bot { perpendicular }
+ def dbar { @Base "||" }
+ #def angle { defined above }
+ def backslash { "\\" }
+ def forall { universal }
+ def exists { existential }
+ def neg { logicalnot }
+
+ def circle { @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "xsize ysize 2 div moveto"
+ "xsize 2 div ysize 2 div xsize 2 div 0 360 arc"
+ "0.04 ft setlinewidth stroke"
+ }
+ @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High }
+ }
+ PDF @Yield {
+#
+# VT: draws a counterclockwise 360 degree arc from 0 to +360 degree positions
+# (straight right to straight right) with centre = (xsize/2, ysize/2)
+# and radius = xsize/2
+#
+# implemented as two counterclockwise 180 degree arcs:
+#
+ {
+ "__mul(0.04, __loutf) w"
+#
+# start at (xsize, ysize/2)
+# the control points are:
+# pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) and pt2 = (0, ysize/2 + (4/3 * xsize/2))
+# end at (0, ysize/2)
+#
+ "__xsize __div(__ysize, 2) m"
+ "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" # pt1
+ "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" # pt2
+ "0 __div(__ysize, 2) c" # pt3
+#
+# start at (0, ysize/2)
+# the control points are:
+# pt1 = (0, ysize/2 - (4/3 * xsize/2)) and pt2 = (xsize, ysize/2 - (4/3 * xsize/2))
+# end at (xsize, ysize/2)
+#
+ "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" # pt1
+ "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" # pt2
+ "__xsize __div(__ysize, 2) c S" # pt3
+ }
+ @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High }
+ }
+ }
+ }
+
+ def square { @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "0 0 moveto xsize 0 lineto xsize ysize lineto"
+ "0 ysize lineto closepath"
+ "0.04 ft setlinewidth stroke"
+ }
+ @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High }
+ }
+ PDF @Yield {
+ { "__mul(__loutf, 0.04) w"
+ "0 0 m __xsize 0 l __xsize __ysize l"
+ "0 __ysize l s"
+ }
+ @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High }
+ }
+ }
+ }
+
+ def triangle { @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "0 0 moveto xsize 0 lineto"
+ "xsize 2 div ysize lineto closepath"
+ "0.04 ft setlinewidth stroke"
+ }
+ @Graphic
+ { 0.3f @Wide 0.3f @High ^| ^/
+ 0.3f @Wide 0.3f @High
+ }
+ }
+ PDF @Yield {
+ { "__mul(__loutf, 0.04) w"
+ "0 0 m __xsize 0 l"
+ "__div(__xsize, 2) __ysize l s"
+ }
+ @Graphic
+ { 0.3f @Wide 0.3f @High ^| ^/
+ 0.3f @Wide 0.3f @High
+ }
+ }
+ }
+ }
+
+ ###################################################################
+ # #
+ # Group 5 (digits) #
+ # #
+ ###################################################################
+
+ def "0" { zero }
+ def "1" { one }
+ def "2" { two }
+ def "3" { three }
+ def "4" { four }
+ def "5" { five }
+ def "6" { six }
+ def "7" { seven }
+ def "8" { eight }
+ def "9" { nine }
+
+
+ ###################################################################
+ # #
+ # Group 6 ("Large" operators) #
+ # #
+ # Knuth's large operators automatically change size depending #
+ # on whether the equation is display or inline. Eq does not #
+ # do this; instead, the `big' operator must be used. #
+ # #
+ ###################################################################
+
+ def sum { summation }
+ def prod { product }
+ def coprod { 180d @Rotate vctr product }
+ def int { 1.3f @Font vctr integral }
+ def oint { @OneCol { vctr degree |0.015fo int } }
+ def bcap { 1.3f @Font intersection }
+ def bcup { 1.3f @Font union }
+ def bvee { 1.3f @Font logicalor }
+ def bwedge { 1.3f @Font logicaland }
+ def bodot { & 1.3f @Font @HContract { circle /0io &0.5rt @PureDot } }
+ def botimes { 1.3f @Font circlemultiply }
+ def boplus { 1.3f @Font circleplus }
+ def buplus { & 1.3f @Font @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union } }
+
+ ###################################################################
+ # #
+ # Group 7 (binary operations) #
+ # #
+ # All of Knuth's symbols are available except \star, \diamond #
+ # and \bullet; a few have been given more mnemonic names. #
+ # #
+ ###################################################################
+
+ def "+" { bin plus }
+ def "-" { bin minus }
+ def "+-" { bin plusminus }
+ def "-+" { bin 180d @Rotate plusminus }
+ def setminus { bin backslash }
+ def cdot { bin dotmath }
+ def times { bin multiply }
+ def "*" { bin asteriskmath }
+ #def diamond { name used above }
+ def circ { bin circle }
+ #def bullet { name used above }
+ def div { bin divide }
+ def cap { bin intersection }
+ def cup { bin union }
+ def uplus { bin @OneRow @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union}}
+ def sqcap { bin
+ { @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "0 0 moveto 0 ysize lineto xsize ysize lineto"
+ "xsize 0 lineto"
+ "0.04 ft setlinewidth stroke"
+ }
+ @Graphic
+ { 0.3f @Wide 0.3f @High ^| ^/
+ 0.3f @Wide 0.3f @High
+ }
+ }
+ PDF @Yield {
+ { "__mul(__loutf, 0.04) w"
+ "0 0 m 0 __ysize l __xsize __ysize l"
+ "__xsize 0 l s"
+ }
+ @Graphic
+ { 0.3f @Wide 0.3f @High ^| ^/
+ 0.3f @Wide 0.3f @High
+ }
+ }
+ }
+ }
+ }
+ def sqcup { 180d @Rotate sqcap }
+ def triangleleft { bin 90d @Rotate 0.8f @Font triangle }
+ def triangleright { bin "-90d" @Rotate 0.8f @Font triangle}
+ def wr { bin vctr {90d @Rotate similar} }
+ def bigcirc { bin 1.2f @Font circle }
+ def bigtriangleup { bin 1.2f @Font triangle }
+ def bigtriangledown { bin 180d @Rotate 1.2f @Font triangle }
+ def vee { bin logicalor }
+ def wedge { bin logicaland }
+ def oplus { bin circleplus }
+ def ominus { bin @OneRow @HContract { circle /0io &0.5rt minus}}
+ def otimes { bin circlemultiply }
+ def oslash {`vctr 60d @Rotate @HContract {circle /0io &0.5rt minus`}}
+ def odot { bin @OneRow @HContract {circle /0io &0.5rt @PureDot }}
+ def dagger { bin @Base @Char "dagger" }
+ def daggerdbl { bin @Base @Char "daggerdbl" }
+ def amalg { bin 180d @Rotate vctr product }
+
+ ###################################################################
+ # #
+ # Group 8 (relations) #
+ # #
+ # All Knuth's operators are available, but many have been #
+ # given different, more mnemonic names. Also included is #
+ # a not operator for negating the relations. #
+ # #
+ ###################################################################
+
+ def "<" { rel less }
+ def ">" { rel greater }
+ def "=" { rel equal }
+ def "<=" { rel lessequal }
+ def prec { rel { 0.45f @Font "-90d" @Rotate
+ { parenrighttp ^| parenlefttp }
+ }
+ }
+ def preceq { rel { @OneRow non prec /0.1f minus } }
+ def "<<" { rel {less less} }
+ def subset { rel propersubset }
+ def subseteq { rel reflexsubset }
+ def sqsubseteq { rel @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ { { "xsize 0 moveto"
+ "0 0 lineto"
+ "0 ysize lineto"
+ "xsize ysize lineto"
+ "0.04 ft setlinewidth stroke"
+ }
+ @Graphic
+ { 0.5f @Wide 0.25f @High ^/
+ 0.25f @High
+ }
+ /0.1f minus
+ }
+ }
+ PDF @Yield {
+ { { "__mul(__loutf, 0.04) w"
+ "__xsize 0 m"
+ "0 0 l"
+ "0 __ysize l"
+ "__xsize __ysize l s"
+ }
+ @Graphic
+ { 0.5f @Wide 0.25f @High ^/
+ 0.25f @High
+ }
+ /0.1f minus
+ }
+ }
+ }
+ }
+
+ def in { rel element }
+ def vdash { rel vctr{"-90d" @Rotate perpendicular}}
+ def smile { rel vctr 90d @Rotate parenleft }
+ def frown { rel vctr 90d @Rotate parenright }
+
+ def ">=" { rel greaterequal }
+ def succ { rel { 0.45f @Font 90d @Rotate
+ { parenrighttp ^| parenlefttp }
+ }
+ }
+ def succeq { rel { @OneRow non succ /0.1f minus } }
+ def ">>" { rel {greater greater} }
+ def supset { rel propersuperset }
+ def supseteq { rel reflexsuperset }
+ def sqsupseteq { rel @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ { { "0 0 moveto xsize 0 lineto"
+ "xsize ysize lineto"
+ "0 ysize lineto"
+ "0.04 ft setlinewidth stroke"
+ }
+ @Graphic
+ { 0.5f @Wide 0.25f @High ^/
+ 0.25f @High
+ }
+ /0.1f minus
+ }
+ }
+ PDF @Yield {
+ { { "__mul(__loutf, 0.04) w"
+ "0 0 m __xsize 0 l"
+ "__xsize __ysize l"
+ "0 __ysize l s"
+ }
+ @Graphic
+ { 0.5f @Wide 0.25f @High ^/
+ 0.25f @High
+ }
+ /0.1f minus
+ }
+ }
+ }
+ }
+ def ni { rel 180d @Rotate element }
+ def dashv { rel vctr {90d @Rotate perpendicular} }
+ def mid { rel @Base "|" }
+ def parallel { rel @Base "||" }
+
+ def "==" { rel equivalence }
+ def "~" { rel similar }
+ def "-~" { rel @OneRow{similar^/0.07f/0.07f minus}}
+ def asymp { rel 0.7f @Font @OneRow
+ { 90d @Rotate parenleft ^/0.008f
+ /0.008f 90d @Rotate parenright }
+ }
+ def "~~" { rel approxequal }
+ def "=~" { rel congruent }
+ def bowtie { rel{non triangleright non triangleleft}}
+ def propto { rel proportional }
+ def models { rel{@Base vctr "|" &0.05fo vctr equal}}
+ def doteq { rel @OneRow @HContract {&0.5rt dotmath^/0.15f equal}}
+ def perp { rel perpendicular }
+
+ def notsub { rel notsubset }
+ def notin { rel notelement }
+ def "!=" { rel notequal }
+
+ def "<->" { rel arrowboth }
+ def "<--" { rel arrowleft }
+ def "-->" { rel arrowright }
+ def up { rel arrowup }
+ def down { rel arrowdown }
+ def "<=>" { rel arrowdblboth }
+ def "<==" { rel arrowdblleft }
+ def "==>" { rel arrowdblright }
+ def dblup { rel arrowdblup }
+ def dbldown { rel arrowdbldown }
+
+ def ":" { rel colon }
+ def "::" { rel @OneCol {colon ` colon} }
+ def ":=" { rel { colon{ //0.05fo equal} } }
+
+ def not right x { @HContract {@OneCol x /0co &0.5rt slash}}
+
+
+ ###################################################################
+ # #
+ # Groups 11 and 12 - openings and closings. #
+ # #
+ ###################################################################
+
+ def lpar { parenleft }
+ def rpar { parenright }
+ def lbrack { bracketleft }
+ def rbrack { bracketright }
+ def lbrace { braceleft }
+ def rbrace { braceright }
+ def lfloor { ` "-0.15f" @VShift bracketleftbt }
+ def rfloor { "-0.15f" @VShift bracketrightbt ` }
+ def lceil { ` "-0.1f" @VShift bracketlefttp }
+ def rceil { "-0.1f" @VShift bracketrighttp ` }
+ def langle { angleleft }
+ def rangle { angleright }
+
+ def blpar { @OneRow {parenlefttp ^/ parenleftex / parenleftbt } }
+ def brpar { @OneRow {parenrighttp ^/ parenrightex / parenrightbt } }
+ def blbrack { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftbt } }
+ def brbrack { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightbt} }
+ def blbrace { @OneRow {bracelefttp ^/ braceleftmid / braceleftbt } }
+ def brbrace { @OneRow {bracerighttp ^/ bracerightmid / bracerightbt } }
+ def blfloor { @OneRow {bracketleftex ^/ bracketleftex / bracketleftbt } }
+ def brfloor { @OneRow {bracketrightex ^/ bracketrightex / bracketrightbt} }
+ def blceil { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftex } }
+ def brceil { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightex} }
+ def blangle { @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "xsize 0 moveto"
+ "0 ysize 2 div lineto"
+ "xsize ysize lineto"
+ "0.04 ft setlinewidth stroke"
+ }
+ @Graphic { 0.5f @Wide 2f @High ^/ 2f @High }
+ }
+ PDF @Yield {
+ { "__mul(__loutf, 0.04) w"
+ "__xsize 0 m"
+ "0 __div(__ysize, 2) l"
+ "__xsize __ysize l S"
+ }
+ @Graphic { 0.5f @Wide 2f @High ^/ 2f @High }
+ }
+ }
+ }
+ def brangle { @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "0 0 moveto"
+ "xsize ysize 2 div lineto"
+ "0 ysize lineto"
+ "0.04 ft setlinewidth stroke"
+ }
+ @Graphic { 0.5f @Wide 2f @High ^/ 2f @High }
+ }
+ PDF @Yield {
+ { "__mul(__loutf, 0.04) w"
+ "0 0 m"
+ "__xsize __div(__ysize, 2) l"
+ "0 __ysize l S"
+ }
+ @Graphic { 0.5f @Wide 2f @High ^/ 2f @High }
+ }
+ }
+ }
+
+
+ ###################################################################
+ # #
+ # Group 13 - punctuation. #
+ # #
+ ###################################################################
+
+ def ";" { punct semicolon }
+ def "," { punct comma }
+ def col { punct colon }
+
+
+ ###################################################################
+ # #
+ # Additional short symbols (Knuth p. 132) #
+ # #
+ ###################################################################
+
+ def "!" { exclam }
+ def "?" { question }
+ def "%" { percent }
+ def "(" { parenleft }
+ def ")" { parenright }
+ def "[" { bracketleft }
+ def "]" { bracketright }
+
+
+ ###################################################################
+ # #
+ # Common mathematical functions (from Knuth p. 162). #
+ # mod is included, since @Rel mod is easily typed if needed. #
+ # #
+ ###################################################################
+
+ def arccos { @Base "arccos" }
+ def arcsin { @Base "arcsin" }
+ def arctan { @Base "arctan" }
+ def arg { @Base "arg" }
+ def cos { @Base "cos" }
+ def cosh { @Base "cosh" }
+ def cot { @Base "cot" }
+ def coth { @Base "coth" }
+ def csc { @Base "csc" }
+ def deg { @Base "deg" }
+ def det { @Base "det" }
+ def dim { @Base "dim" }
+ def exp { @Base "exp" }
+ def gcd { @Base "gcd" }
+ def hom { @Base "hom" }
+ def inf { @Base "inf" }
+ def ker { @Base "ker" }
+ def lg { @Base "lg" }
+ def lim { @Base "lim" }
+ def liminf { @OneCol { @Base "lim" ` @Base "inf" } }
+ def limsup { @OneCol { @Base "lim" ` @Base "sup" } }
+ def ln { @Base "ln" }
+ def log { @Base "log" }
+ def max { @Base "max" }
+ def min { @Base "min" }
+ def Pr { @Base "Pr" }
+ def sec { @Base "sec" }
+ def sin { @Base "sin" }
+ def sinh { @Base "sinh" }
+ def supr { @Base "sup" }
+ def tan { @Base "tan" }
+ def tanh { @Base "tanh" }
+ def mod { @Base "mod" }
+
+
+ ###################################################################
+ # #
+ # Arrow symbols. #
+ # #
+ ###################################################################
+
+ def leftarrow { arrowleft }
+ def longleftarrow { { 1.6 1 } @Scale arrowleft }
+ def dblleftarrow { arrowdblleft }
+ def dbllongleftarrow { { 1.6 1 } @Scale arrowdblleft }
+ def rightarrow { arrowright }
+ def longrightarrow { { 1.6 1 } @Scale arrowright }
+ def dblrightarrow { arrowdblright }
+ def dbllongrightarrow { { 1.6 1 } @Scale arrowdblright }
+ def leftrightarrow { arrowboth }
+ def longleftrightarrow { { 1.6 1 } @Scale arrowboth }
+ def dblleftrightarrow { arrowdblboth }
+ def dbllongleftrightarrow { { 1.6 1 } @Scale arrowdblboth }
+
+ def mapsto
+ {
+ @HContract @VContract {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "0 ymark 0.16 ft sub moveto 0 ymark 0.16 ft add lineto stroke"
+ @Graphic arrowright
+ }
+ PDF @Yield {
+ "0 __sub(__ymark, __mul(__loutf, 0.16)) m 0 __add(__ymark, __mul(__loutf, 0.16)) l S"
+ @Graphic arrowright
+ }
+ }
+ }
+ }
+
+ def longmapsto
+ {
+ @HContract @VContract {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "0 ymark 0.16 ft sub moveto 0 ymark 0.16 ft add lineto stroke"
+ @Graphic { { 1.6 1 } @Scale arrowright }
+ }
+ PDF @Yield {
+ "0 __sub(__ymark, __mul(__loutf, 0.16)) m 0 __add(__ymark, __mul(__loutf, 0.16)) l S"
+ @Graphic { { 1.6 1 } @Scale arrowright }
+ }
+ }
+ }
+ }
+
+ def hookleftarrow
+ {
+ @HContract @VContract {
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ "xsize ymark moveto xsize ymark 0.1 ft add 0.1 ft -90 90 arc stroke"
+ @Graphic leftarrow
+ }
+
+ PDF @Yield {
+#
+# VT: draws a counterclockwise 180 degree arc from -90 to +90 degree positions
+# (straight down to straight up) with centre = (xsize, ymark + 0.1 ft)
+# and radius = 0.1 ft
+#
+# the control points therefore are:
+# pt1 = (xsize + (4/3 * 0.1 ft), ymark) and pt2 = (xsize + (4/3 * 0.1 ft), ymark + 0.2 ft)
+#
+ {
+ "__xsize __ymark m" # pt0
+ "__add(__xsize, __div(__mul(0.4, __loutf), 3)) __ymark" # pt1
+ "__add(__xsize, __div(__mul(0.4, __loutf), 3)) __add(__ymark, __mul(0.2, __loutf))" # pt2
+ "__xsize __add(__ymark, __mul(0.2, __loutf)) c S" # pt3
+ }
+ @Graphic leftarrow
+ }
+
+ }
+ }
+ }
+
+ def hookrightarrow
+ {
+ @HContract @VContract {
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ "0 ymark moveto 0 0.1 ft ymark add 0.1 ft -90 90 arcn stroke"
+ @Graphic rightarrow
+ }
+
+ PDF @Yield {
+#
+# VT: draws a clockwise 180 degree arc from -90 to +90 degree positions
+# (straight down to straight up) with centre = (0, ymark + 0.1 ft)
+# and radius = 0.1 ft
+#
+# the control points therefore are:
+# pt1 = (-4/3 * 0.1 ft, ymark) and pt2 = (-4/3 * 0.1 ft, ymark + 0.2 ft)
+#
+ {
+ "0 __ymark m" # pt0
+ "__div(__mul(-0.4, __loutf), 3) __ymark" # pt1
+ "__div(__mul(-0.4, __loutf), 3) __add(__ymark, __mul(0.2, __loutf))" # pt2
+ "0 __add(__ymark, __mul(0.2, __loutf)) c S" # pt3
+ }
+ @Graphic rightarrow
+ }
+
+ }
+ }
+ }
+
+ def @ClipToSize right x
+ {
+ @HContract @VContract
+ @BackEnd @Case {
+ PostScript @Yield {
+ {
+ "grestore newpath 0 0 moveto xsize 0 lineto xsize ysize lineto"
+ "0 ysize lineto closepath clip gsave"
+ } @Graphic x
+ }
+ PDF @Yield {
+ "Q n 0 0 __xsize __ysize re W n q" @Graphic x
+ }
+ }
+ }
+
+ def @ClipAboveMark
+ left amount
+ right x
+ {
+ @ClipToSize { ^//{{amount}o} x }
+ }
+
+ def @ClipBelowMark
+ left amount
+ right x
+ {
+ @ClipToSize { x //{{amount}o} }
+ }
+
+ def leftharpoonup
+ {
+ 0.04f @ClipBelowMark leftarrow
+ }
+
+ def rightharpoonup
+ {
+ 0.04f @ClipBelowMark rightarrow
+ }
+
+ def leftharpoondown
+ {
+ 0.02f @ClipAboveMark leftarrow
+ }
+
+ def rightharpoondown
+ {
+ 0.02f @ClipAboveMark rightarrow
+ }
+
+ def rightleftharpoons
+ {
+ @HContract @VContract {
+ rightharpoonup
+ ^//0.1fo
+ //0.1fo
+ leftharpoondown
+ }
+ }
+
+ def leadsto { @HContract { similar &0.4fo arrowright } }
+
+ def uparrow { arrowup }
+ def dbluparrow { arrowdblup }
+ def downarrow { arrowdown }
+ def dbldownarrow { arrowdbldown }
+ def updownarrow { @HContract { arrowup &0io arrowdown } }
+ def dblupdownarrow { @VContract { arrowdblup ^//0.2fo arrowdbldown } }
+ def nearrow { 0.5w @VShift 0.5w @HShift 45d @Rotate arrowright }
+ def searrow { 0.5w @VShift 0.5w @HShift 315d @Rotate arrowright }
+ def swarrow { 0.5w @VShift 0.5w @HShift 225d @Rotate arrowright }
+ def nwarrow { 0.5w @VShift 0.5w @HShift 135d @Rotate arrowright }
+
+
+ ###################################################################
+ # #
+ # Other symbols taken from TeX. #
+ # #
+ ###################################################################
+
+ def ldots { . &0.3f . &0.3f . }
+ def cdots { dotmath &0.3f dotmath &0.3f dotmath }
+ def vdots { @OneRow { dotmath ^/0.3f dotmath /0.3f dotmath } }
+ def ddots { @OneCol @OneRow
+ { dotmath
+ ^/0.3f |0.3f dotmath
+ /0.3f | |0.3f dotmath
+ }
+ }
+
+
+ ###################################################################
+ # #
+ # Symbols taken from eqn (Kernighan and Cherry 1975). #
+ # #
+ ###################################################################
+
+ def del { gradient }
+ def grad { gradient }
+ def "..." { ellipsis }
+ def ",...," { , ellipsis ``` , }
+ def "'" { minute }
+ def "''" { minute minute }
+ def "'''" { minute minute minute }
+ def "''''" { minute minute minute minute }
+ def empty { emptyset }
+
+
+
+ ###################################################################
+ # #
+ # Miscellaneous #
+ # #
+ ###################################################################
+
+ ###################################################################
+ # #
+ # Symbols with parameters. #
+ # #
+ # These symbols are essentially those of eqn, with some #
+ # changes and additions. #
+ # #
+ ###################################################################
+
+ def sup
+ precedence 60
+ associativity left
+ left x
+ named gap { @SupGap }
+ right y
+ {
+ @HContract @VContract
+ { | 0.45w @VShift @Smaller @HSqueeze @VSqueeze y
+ ^/gap x
+ }
+ }
+
+ def sub
+ precedence 60
+ associativity left
+ left x
+ named gap { @SupGap }
+ right y
+ {
+ @HContract @VContract
+ {
+ # x
+ "." @KernShrink x
+ /gap | @Smaller @HSqueeze @VSqueeze y
+ }
+ }
+
+ def tsub
+ precedence 60
+ associativity left
+ left x
+ named gap { @SupGap }
+ right y
+ {
+ @HContract @VContract
+ {
+ x
+ /gap | &0io 0.2f @HShift @Smaller @HSqueeze @VSqueeze y
+ }
+ }
+
+ def supp
+ precedence 60
+ associativity left
+ left x
+ named gap { @SupGap }
+ right y
+ {
+ @HContract @VContract
+ {
+ { ^/gap x /gap } | y
+ }
+ }
+
+ def on
+ precedence 61
+ associativity left
+ left x
+ named gap { @SupGap }
+ right y
+ {
+ @Smaller @HSqueeze @VSqueeze x ^/ /
+ @Smaller @HSqueeze @VSqueeze y
+ }
+
+ def ton
+ precedence 61
+ associativity left
+ left x
+ named gap { @SupGap }
+ right y
+ {
+ @Smaller @HSqueeze @VSqueeze x ^/ /
+ &0io 0.3f @HShift @Smaller @HSqueeze @VSqueeze y
+ }
+
+ def frac
+ precedence 54
+ associativity left
+ left x
+ named gap { 0.2f }
+ right y
+ {
+ @HContract @VContract @Smaller @HSqueeze @VSqueeze
+ { 1w @VShift { x /gap } | fraction &0io | 0w @VShift { |gap y }
+ }
+ }
+
+ def half { 1 frac 2 }
+ def third { 1 frac 3 }
+
+ def over
+ precedence 54
+ associativity left
+ left x
+ named gap { 0.2f }
+ right y
+ {
+ @HContract @VContract
+ { |0.5rt @OneCol @VSqueeze x
+ ^//gap @HLine
+ //gap |0.5rt @OneCol @VSqueeze @Strut y
+ }
+ }
+
+ def from
+ precedence 58
+ associativity left
+ left x
+ named gap { @ThinGap }
+ named skew { 0c }
+ right y
+ {
+ @HContract @VContract
+ { |0.5rt x
+ //gap |0.5rt &skew @Smaller @HSqueeze @VSqueeze y
+ }
+ }
+
+ def to
+ precedence 58
+ associativity left
+ left x
+ named gap { @ThinGap }
+ named skew { 0c }
+ right y
+ {
+ @HContract @VContract
+ { |0.5rt &skew @Smaller @HSqueeze @VSqueeze y
+ ^//gap |0.5rt x
+ }
+ }
+
+ def widefrom
+ precedence 58
+ associativity left
+ left x
+ named gap { @ThinGap }
+ right y
+ {
+ @HContract @VContract
+ {
+ x //gap @HScale y
+ }
+ }
+
+ def wideto
+ precedence 58
+ associativity left
+ left x
+ named gap { @ThinGap }
+ right y
+ {
+ @HContract @VContract
+ {
+ @HScale y ^//gap x
+ }
+ }
+
+ def dot
+ precedence 62
+ left x
+ named gap { @ThinGap }
+ {
+ x to gap { gap } skew { @SkewGap } .
+ }
+
+ def dotdot
+ precedence 62
+ left x
+ named gap { @ThinGap }
+ {
+ x to gap { gap } skew { @SkewGap } ..
+ }
+
+ def hat
+ precedence 62
+ left x
+ named gap { @ThinGap }
+ {
+ x to gap { gap } skew { @SkewGap } @Base "^"
+ }
+
+ def tilde
+ precedence 62
+ left x
+ named gap { @ThinGap }
+ {
+ x to gap { gap } skew { @SkewGap } @Base "~"
+ }
+
+ def vec
+ precedence 62
+ left x
+ named gap { @ThinGap }
+ {
+ x to gap { gap } skew { @SkewGap } arrowright
+ }
+
+ def dyad
+ precedence 62
+ left x
+ named gap { @ThinGap }
+ {
+ x to gap { gap } skew { @SkewGap } arrowboth
+ }
+
+ def overbar
+ precedence 62
+ left x
+ named gap { @ThinGap }
+ {
+ x wideto gap { gap } minus
+ }
+
+ def underbar
+ precedence 62
+ left x
+ named gap { @ThinGap }
+ {
+ x widefrom gap { gap } minus
+ }
+
+ def sqrt
+ precedence 56
+ named gap { @ThinGap }
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ @HContract @VContract
+ {
+ @VScale surd | @OneRow
+ {
+ @HLine line { "0.03 ft setlinewidth 2 setlinecap" }
+ ^//gap |gap @VSqueeze @Strut x # //gap
+ }
+ }
+ }
+ PDF @Yield {
+ @HContract @VContract
+ {
+#
+# VT: this PDF is correct but it renders badly in Acrobat (?problem
+# with scaling by fractional factors)
+# In other words, the @VScale value comes through correctly but it
+# looks ugly; GhostScript's translation actually expands the
+# "draw surd" instruction into raw moveto's and lineto's which
+# it presumably gets from the font's definition of the glyph!
+#
+ @VScale surd | @OneRow
+ {
+ @HLine line { "__mul(__loutf, 0.03) w 2 J" }
+ ^//gap |gap @VSqueeze @Strut x # //gap
+ }
+ }
+ }
+ }
+ }
+
+ def root
+ precedence 56
+ left x
+ right y
+ {
+ "" sup x &0io sqrt y
+ }
+
+ def above
+ precedence 52
+ left x
+ named gap { @RowGap }
+ right y
+ {
+ |0.5rt x //gap |0.5rt y
+ }
+
+ def labove
+ precedence 52
+ left x
+ named gap { @RowGap }
+ right y
+ {
+ x //gap y
+ }
+
+ def cabove
+ precedence 52
+ left x
+ named gap { @RowGap }
+ right y
+ {
+ |0.5rt x //gap |0.5rt y
+ }
+
+ def rabove
+ precedence 52
+ left x
+ named gap { @RowGap }
+ right y
+ {
+ |1rt x //gap |1rt y
+ }
+
+ def mabove
+ precedence 52
+ left x
+ named gap { @RowGap }
+ right y
+ {
+ x /gap y
+ }
+
+ def nextcol
+ precedence 50
+ left x
+ named gap { @ColGap }
+ right y
+ {
+ x |gap y
+ }
+
+ export row axisrow col lcol ccol rcol mcol
+ def matrix
+ precedence 100
+ named gap { @MedGap }
+ named strut
+ named no { }
+ named No { }
+ named yes { 0.5f }
+ named Yes { 0.5f }
+ { No }
+ named atleft {}
+ named atright {}
+ named userow { No }
+ named shiftdelim { Yes }
+ body x
+ {
+ def @Strut
+ {
+ strut @Case {
+ "" @Yield {}
+ else @Yield { @OneRow { strut @High ^/ strut @High } }
+ }
+ }
+
+ def newrow
+ precedence 50
+ associativity left
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield { y | @Strut }
+ else @Yield { x /@RowGap y | @Strut }
+ }
+ }
+
+ macro row { newrow "" }
+
+ def newaxisrow
+ precedence 50
+ associativity left
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield { y | @Strut }
+ else @Yield { x ^/@RowGap y | @Strut }
+ }
+ }
+
+ macro axisrow { newaxisrow "" }
+
+ def col
+ precedence 52
+ associativity left
+ left x
+ named indent { 0.5rt }
+ right y
+ {
+ x @Case {
+ "" @Yield { &indent @OneCol y }
+ else @Yield { x |@ColGap &indent @OneCol y }
+ }
+ }
+
+ def lcol
+ precedence 52
+ associativity left
+ left x
+ right y
+ {
+ x col indent { 0i } y
+ }
+
+ def ccol
+ precedence 52
+ associativity left
+ left x
+ right y
+ {
+ x col indent { 0.5rt } y
+ }
+
+ def rcol
+ precedence 52
+ associativity left
+ left x
+ right y
+ {
+ x col indent { 1rt } y
+ }
+
+ def mcol
+ precedence 52
+ associativity left
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield { @OneCol y }
+ else @Yield { x |@ColGap @OneCol y }
+ }
+ }
+
+ def delim right x
+ {
+ x @Case
+ {
+ "" @Yield @Null
+ else @Yield
+ {
+ shiftdelim @Case {
+ { Yes yes } @Yield { @VScale x }
+ else @Yield { @VCover x }
+ }
+ }
+ }
+ }
+
+ @HContract @VContract {
+ delim atleft &@ThinGap
+ userow @Case {
+ {Yes yes} @Yield @HContract @VContract {^//gap @OneRow x //gap}
+ else @Yield vctr @HContract @VContract { //gap x //gap }
+ }
+ &@ThinGap delim atright
+ }
+ }
+
+ macro pmatrix { matrix atleft { "1.5f" @Font ( } atright { "1.5f" @Font ) }}
+ macro bmatrix { matrix atleft { blbrack } atright { brbrack } }
+ macro brmatrix { matrix atleft { blbrace } atright { brbrace } }
+ macro fmatrix { matrix atleft { blfloor } atright { brfloor } }
+ macro cmatrix { matrix atleft { blceil } atright { brceil } }
+ macro amatrix { matrix atleft { blangle } atright { brangle } }
+
+ Slope @Font { separate @SpaceGap } @Space 1f @ZUnit 1f @YUnit @Body
+
+@End @Eq
+
+macro @E { @OneCol @Eq }
diff --git a/include/fig b/include/fig
new file mode 100644
index 0000000..dac333c
--- /dev/null
+++ b/include/fig
@@ -0,0 +1,27 @@
+###############################################################################
+# #
+# Lout setup file for figure drawing (OBSOLETE: use @Diag instead) #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# The @SysInclude { figf } line #
+# #
+# This line causes Lout to read the definitions for equations, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { figf }
+
+
+###############################################################################
+# #
+# This package does not offer the ability to change default options. #
+# #
+###############################################################################
diff --git a/include/figf b/include/figf
new file mode 100644
index 0000000..c3cd15b
--- /dev/null
+++ b/include/figf
@@ -0,0 +1,909 @@
+
+###############################################################################
+# #
+# Lout @Fig package for drawing figures (Version 2.0) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, October 1991. #
+# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. #
+# Symbol names changed by JHK 5 March 1993 to avoid clashes with EPS files. #
+# @CurveBox and @ShadowBox added by JHK April 1995. #
+# #
+# See "Fig - a Lout package for drawing figures" for user information. #
+# #
+# This package is now obsolete, having been replaced by @Diag. #
+# #
+###############################################################################
+
+@SysPrependGraphic { "figf.lpg" }
+
+export in cm pt em sp vs ft dg
+ "<<" "**" "++" "--" @Max @Min
+ @Distance @XDistance @YDistance @Angle
+ @Prev "::" @Label @BaseOf @MarkOf @ShowLabels @Figure
+ @Frame @Box @CurveBox @ShadowBox @Square @Diamond @Polygon @Ellipse
+ @Circle @HLine @VLine @Line @HArrow @VArrow @Arrow @Arc
+
+def @Fig
+ named maxlabels { 200 }
+ named linestyle { solid }
+ named linewidth { 0.5 pt }
+ named linecap { round }
+ named dashlength { 0.15 cm }
+ named paint { nopaint }
+ named margin { 0.4c }
+ named arrow { noarrow }
+ named headstyle { open }
+ named headwidth { 0.05 cm }
+ named headlength { 0.15 cm }
+ body @Body
+@Begin
+
+ # Like @Graphic, but affects the graphics state of right parameter
+ def @InnerGraphic
+ left ps
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield { { ps gsave // grestore } @Graphic x }
+ PDF @Yield { }
+ }
+ }
+
+ def in precedence 39 left x {
+ @BackEnd @Case {
+ PostScript @Yield { x "in" }
+ PDF @Yield { "__mul(__in, "x")" }
+ }
+ }
+
+ def cm precedence 39 left x {
+ @BackEnd @Case {
+ PostScript @Yield { x "cm" }
+ PDF @Yield { "__mul(__cm, "x")" }
+ }
+ }
+
+ def pt precedence 39 left x {
+ @BackEnd @Case {
+ PostScript @Yield { x "pt" }
+ PDF @Yield { "__mul(__pt, "x")" }
+ }
+ }
+
+ def em precedence 39 left x {
+ @BackEnd @Case {
+ PostScript @Yield { x "em" }
+ PDF @Yield { "__mul(__em, "x")" }
+ }
+ }
+
+ def sp precedence 39 left x {
+ @BackEnd @Case {
+ PostScript @Yield { x "sp" }
+ PDF @Yield { "__mul(__louts, "x")" }
+ }
+ }
+
+ def vs precedence 39 left x {
+ @BackEnd @Case {
+ PostScript @Yield { x "vs" }
+ PDF @Yield { "__mul(__loutv, "x")" }
+ }
+ }
+
+ def ft precedence 39 left x {
+ @BackEnd @Case {
+ PostScript @Yield { x "ft" }
+ PDF @Yield { "__mul(__loutf, "x")" }
+ }
+ }
+
+ def dg precedence 39 left x {
+ @BackEnd @Case {
+ PostScript @Yield { x "dg" }
+ PDF @Yield { }
+ }
+ }
+
+ def "<<"
+ precedence 38
+ left length
+ right angle
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ 0 0 length angle "lfigatangle"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def "**"
+ precedence 37
+ left point
+ right length
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ point length "lfigpmul"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def "++"
+ precedence 36
+ associativity left
+ left x
+ right y
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ x y "lfigpadd"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def "--"
+ precedence 36
+ associativity left
+ left x
+ right y
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ y x "lfigpsub"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @Max
+ precedence 36
+ left x
+ right y
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ x y "lfigpmax"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @Min
+ precedence 36
+ left x
+ right y
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ x y "lfigpmin"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @Distance
+ precedence 35
+ left x
+ right y
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ x y "lfigdistance"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @XDistance
+ precedence 35
+ left x
+ right y
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ x y "lfigxdistance"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @YDistance
+ precedence 35
+ left x
+ right y
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ x y "lfigydistance"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @Angle
+ precedence 35
+ left x
+ right y
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ x y "lfigangle"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @Prev
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "lfigprevious"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def "::"
+ precedence 33
+ left name
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "currentdict end" maxlabels "dict begin begin"
+ // "("name") lfigpromotelabels" } @Graphic x
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @Label
+ right name
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "/"name "lfigpointdef"
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @MarkOf
+ precedence 32
+ left point
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ { point "translate" } @InnerGraphic
+ {
+ /0io |0io @OneCol @OneRow x |0io /0io
+ }
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @BaseOf
+ precedence 32
+ left point
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ { point "translate" } @InnerGraphic
+ {
+ /0io |0io @OneRow @OneCol {
+ | @OneCol @OneRow x ^/
+ } |0io /0io
+ }
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @ShowLabels
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ "lfigshowlabels" @Graphic
+ }
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @Figure
+ named shape { }
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named arrow { arrow }
+ named headstyle { headstyle }
+ named headwidth { headwidth }
+ named headlength { headlength }
+ named paint { paint }
+ named margin { 0c }
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ @HContract @VContract
+ {
+ #fill the shape
+ paint @Case
+ {
+ nopaint @Yield {}
+
+ { nochange darkblue blue lightblue darkgreen green lightgreen
+ darkred red lightred darkcyan cyan lightcyan darkmagenta
+ magenta lightmagenta darkyellow yellow lightyellow darkgray
+ gray lightgray darkgrey grey lightgrey black white }
+ @Yield
+ { "/lfig"paint "[" shape "] gsave lfigpaintpath grestore" }
+ }
+
+ # stroke the path and add any arrowheads
+ linestyle @Case
+ {
+ { solid dashed cdashed dotted noline } @Yield
+ {
+ linewidth "setlinewidth" "lfig"linecap "setlinecap"
+ dashlength "/lfig"linestyle "[" shape "] lfigdopath"
+ arrow @Case
+ {
+ noarrow @Yield { pop pop }
+ { forward back both } @Yield
+ { dashlength "/lfig"linestyle "/"lfigblack
+ headstyle @Case
+ { { open halfopen closed } @Yield "lfig"headstyle }
+ headlength headwidth "lfig"arrow
+ }
+ }
+ }
+ }
+ }
+ @Graphic
+ {
+ ^/margin ^|margin @OneCol @OneRow x |margin
+ /margin
+ }
+ }
+
+ PDF @Yield {
+ }
+ }
+ }
+
+ def @Frame
+ right x
+ {
+ @Figure
+ shape {xsize 0 @Label X 0 ysize @Label Y}
+ { x }
+ }
+
+ def @Box
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { margin }
+ right x
+ {
+ @Figure
+ shape {
+ # 0 0 @Label SW
+ # xsize 0 @Label SE
+ # xsize ysize @Label NE
+ # 0 ysize @Label NW
+ # SE ** 0.5 @Label S
+ # NW ** 0.5 @Label W
+ # W ++ SE @Label E
+ # S ++ NW @Label N
+ # NE ** 0.5 @Label CTR
+ # SW SE NE NW SW
+ lfigbox
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ x
+ }
+
+
+ def @CurveBox
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { margin }
+ right x
+ {
+ @Figure
+ shape {
+ lfigcurvebox
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ { 0c @HShift x }
+ }
+
+ def @ShadowBox
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { margin }
+ named shadow { 0.2f }
+ right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {
+ @VContract @HContract 0c @HShift "lfigshadow" @Graphic
+ {
+ ^/shadow ^|shadow 0c @HShift
+ @Figure
+ shape {
+ lfigbox
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ 0c @HShift x
+ |shadow /shadow
+ }
+ }
+ PDF @Yield {
+ @VContract @HContract 0c @HShift
+
+# "lfigshadow" @Graphic is this:
+ { "__mul(__xmark, 2) 0 m __xsize 0 l" # xmark 2 mul 0 moveto xsize 0 lineto
+ "__xsize __sub(__ysize, __mul(__xmark, 2)) l" # xsize ysize xmark 2 mul sub lineto
+ "__sub(__xsize, __xmark) __sub(ysize, __mul(__xmark, 2)) l" # xsize xmark sub ysize xmark 2 mul sub lineto
+ "__sub(__xsize, __xmark) __xmark l" # xsize xmark sub xmark lineto
+ "__mul(__xmark, 2) __xmark l h f" # xmark 2 mul xmark lineto closepath fill
+ } @Graphic
+
+ {
+ ^/shadow ^|shadow 0c @HShift
+ @Figure
+ shape {
+ lfigbox
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ 0c @HShift x
+ |shadow /shadow
+ }
+ }
+ }
+ }
+
+ def @Square
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { margin }
+ right x
+ {
+ @Figure
+ shape {
+ # {xsize ysize} ** 0.5 @Label CTR
+ # CTR ++ {{xsize xsize} @Max {ysize ysize}}**0.5 @Label NE
+ # CTR ++ { {CTR @Distance NE} << 135 } @Label NW
+ # CTR ++ { {CTR @Distance NE} << 225 } @Label SW
+ # CTR ++ { {CTR @Distance NE} << 315 } @Label SE
+ # SW ** 0.5 ++ SE ** 0.5 @Label S
+ # NW ** 0.5 ++ NE ** 0.5 @Label N
+ # SW ** 0.5 ++ NW ** 0.5 @Label W
+ # SE ** 0.5 ++ NE ** 0.5 @Label E
+ # SW SE NE NW SW
+ lfigsquare
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ x
+ }
+
+ def @Diamond
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { margin }
+ right x
+ {
+ @Figure
+ shape {
+ # {xsize 0} ** 0.5 @Label S
+ # {0 ysize} ** 0.5 @Label W
+ # S ++ W @Label CTR
+ # CTR ++ W @Label N
+ # CTR ++ S @Label E
+ # S E N W S
+ lfigdiamond
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ x
+ }
+
+ def @Polygon
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { margin }
+ named sides { 3 }
+ named angle { "dup 180 exch div" }
+ right x
+ {
+ @Figure
+ shape { sides angle lfigpolygon }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ x
+ }
+
+ def @Ellipse
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { margin }
+ right x
+ {
+ @Figure
+ shape {
+ # {xsize 0} ** 0.5 @Label S
+ # {0 ysize} ** 0.5 @Label W
+ # S ++ W @Label CTR
+ # CTR ++ W @Label N
+ # CTR ++ S @Label E
+ # CTR ++ {xsize 0} ** 0.3536 ++ {0 ysize} ** 0.3536 @Label NE
+ # CTR ++ {xsize 0} ** 0.3536 -- {0 ysize} ** 0.3536 @Label SE
+ # CTR -- {xsize 0} ** 0.3536 ++ {0 ysize} ** 0.3536 @Label NW
+ # CTR -- {xsize 0} ** 0.3536 -- {0 ysize} ** 0.3536 @Label SW
+ # S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
+ lfigellipse
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ x
+ }
+
+ def @Circle
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { margin }
+ right x
+ {
+ @Figure
+ shape {
+ # {xsize ysize} **0.5 @Label CTR
+ # CTR ++ {{xsize 0} @Max {ysize 0}}**0.5 @Label E
+ # CTR ++ { {CTR @Distance E} << 45 } @Label NE
+ # CTR ++ { {CTR @Distance E} << 90 } @Label N
+ # CTR ++ { {CTR @Distance E} << 135 } @Label NW
+ # CTR ++ { {CTR @Distance E} << 180 } @Label W
+ # CTR ++ { {CTR @Distance E} << 225 } @Label SW
+ # CTR ++ { {CTR @Distance E} << 270 } @Label S
+ # CTR ++ { {CTR @Distance E} << 315 } @Label SE
+ # S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
+ lfigcircle
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ x
+ }
+
+ def @HLine
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { 0c }
+ named arrow { arrow }
+ named headstyle { headstyle }
+ named headwidth { headwidth }
+ named headlength { headlength }
+ right x
+ {
+ @Figure
+ shape {
+ # 0 ymark @Prev @Label FROM
+ # xsize ymark @Prev @Label TO
+ lfighline
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ arrow { arrow }
+ headstyle { headstyle }
+ headwidth { headwidth }
+ headlength { headlength }
+ x
+ }
+
+ def @VLine
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { 0c }
+ named arrow { arrow }
+ named headstyle { headstyle }
+ named headwidth { headwidth }
+ named headlength { headlength }
+ right x
+ {
+ @Figure
+ shape {
+ # xmark ysize @Prev @Label FROM
+ # xmark 0 @Prev @Label TO
+ lfigvline
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ arrow { arrow }
+ headstyle { headstyle }
+ headwidth { headwidth }
+ headlength { headlength }
+ x
+ }
+
+ def @HArrow
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { 0c }
+ named arrow { forward }
+ named headstyle { headstyle }
+ named headwidth { headwidth }
+ named headlength { headlength }
+ right x
+ {
+ @Figure
+ shape {
+ # 0 ymark @Prev @Label FROM
+ # xsize ymark @Prev @Label TO
+ lfighline
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ arrow { arrow }
+ headstyle { headstyle }
+ headwidth { headwidth }
+ headlength { headlength }
+ x
+ }
+
+ def @VArrow
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { 0c }
+ named arrow { forward }
+ named headstyle { headstyle }
+ named headwidth { headwidth }
+ named headlength { headlength }
+ right x
+ {
+ @Figure
+ shape {
+ # xmark ysize @Prev @Label FROM
+ # xmark 0 @Prev @Label TO
+ lfigvline
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ arrow { arrow }
+ headstyle { headstyle }
+ headwidth { headwidth }
+ headlength { headlength }
+ x
+ }
+
+ def @Line
+ named from { 0 ysize }
+ named to { xsize 0 }
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { 0c }
+ named arrow { arrow }
+ named headstyle { headstyle }
+ named headwidth { headwidth }
+ named headlength { headlength }
+ right x
+ {
+ @Figure
+ shape {
+ from @Prev @Label FROM
+ to @Prev @Label TO
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ arrow { arrow }
+ headstyle { headstyle }
+ headwidth { headwidth }
+ headlength { headlength }
+ x
+ }
+
+ def @Arrow
+ named from { 0 ysize }
+ named to { xsize 0 }
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { 0c }
+ named arrow { forward }
+ named headstyle { headstyle }
+ named headwidth { headwidth }
+ named headlength { headlength }
+ right x
+ {
+ @Figure
+ shape {
+ from @Prev @Label FROM
+ to @Prev @Label TO
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ arrow { arrow }
+ headstyle { headstyle }
+ headwidth { headwidth }
+ headlength { headlength }
+ x
+ }
+
+ def @Arc
+ named from { 0 ysize }
+ named to { xsize 0 }
+ named ctr { 0 0 }
+ named direction { clockwise }
+ named linestyle { linestyle }
+ named linewidth { linewidth }
+ named linecap { linecap }
+ named dashlength { dashlength }
+ named paint { paint }
+ named margin { 0c }
+ named arrow { noarrow }
+ named headstyle { headstyle }
+ named headwidth { headwidth }
+ named headlength { headlength }
+ right x
+ {
+ @Figure
+ shape {
+ from @Label FROM
+ to @Label TO
+ ctr @Label CTR
+ FROM [ CTR
+ direction @Case { {clockwise anticlockwise} @Yield direction }
+ ] TO
+ }
+ linestyle { linestyle }
+ linewidth { linewidth }
+ linecap { linecap }
+ dashlength { dashlength }
+ paint { paint }
+ margin { margin }
+ arrow { arrow }
+ headstyle { headstyle }
+ headwidth { headwidth }
+ headlength { headlength }
+ x
+ }
+
+ @BackEnd @Case {
+ PostScript @Yield {
+ { "grestore save gsave" maxlabels "dict begin lfigdict begin"
+ // "end end restore"
+ } @Graphic @Body
+ }
+ PDF @Yield {
+ }
+ }
+
+@End @Fig
diff --git a/include/figf.lpg b/include/figf.lpg
new file mode 100644
index 0000000..2b64188
--- /dev/null
+++ b/include/figf.lpg
@@ -0,0 +1,1003 @@
+%%BeginResource: procset LoutFigPrependGraphic
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% PostScript @SysPrependGraphic file for @Fig Jeffrey H. Kingston %
+% Version 2.0 (includes CIRCUM label) January 1992 %
+% %
+% To assist in avoiding name clashes, the names of all symbols %
+% defined here begin with "lfig". However, this is not feasible %
+% with user-defined labels and some labels used by users. %
+% %
+% <point> is two numbers, a point. %
+% <length> is one number, a length %
+% <angle> is one number, an angle in degrees %
+% <dashlength> is one number, the preferred length of a dash %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+errordict begin
+ /handleerror
+ {
+ { /Times-Roman findfont 8 pt scalefont setfont
+ 0 setgray 4 pt 4 pt moveto
+ $error /errorname get
+ dup lfigdict exch known
+ { lfigdict exch get }
+ { 30 string cvs } ifelse
+ show
+ ( Command: ) show
+ $error /command get 30 string cvs show
+ } stopped {} if
+ showpage stop
+ } def
+end
+
+% concat strings: <string> <string> lfigconcat <string>
+% must be defined outside lfigdict since used in lfigpromotelabels
+/lfigconcat
+{ 2 copy length exch length add string
+ dup 0 4 index putinterval
+ dup 3 index length 3 index putinterval
+ 3 1 roll pop pop
+} def
+
+% <string> lfigdebugprint -
+% must be defined outside lfigdict since used in arbitrary places
+% /lfigdebugprint
+% { print
+% (; operand stack:\n) print
+% count copy
+% count 2 idiv
+% { ==
+% (\n) print
+% } repeat
+% (\n) print
+% } def
+
+/lfigdict 120 dict def
+lfigdict begin
+
+% error messages
+/dictfull (dictfull error: too many labels?) def
+/dictstackoverflow (dictstackoverflow error: labels nested too deeply?) def
+/execstackoverflow (execstackoverflow error: figure nested too deeply?) def
+/limitcheck (limitcheck error: figure nested too deeply or too large?) def
+/syntaxerror (syntaxerror error: syntax error in text of figure?) def
+/typecheck (typecheck error: syntax error in text of figure?) def
+/undefined (undefined error: unknown or misspelt label?) def
+/VMError (VMError error: run out of memory?) def
+
+% push pi onto stack: - lfigpi <num>
+/lfigpi 3.14159 def
+
+% arc directions
+/clockwise false def
+/anticlockwise true def
+
+% maximum of two numbers: <num> <num> lfigmax <num>
+/lfigmax { 2 copy gt { pop } { exch pop } ifelse } def
+
+% minimum of two numbers: <num> <num> lfigmin <num>
+/lfigmin { 2 copy lt { pop } { exch pop } ifelse } def
+
+% add two points: <point> <point> lfigpadd <point>
+/lfigpadd { exch 3 1 roll add 3 1 roll add exch } def
+
+% subtract first point from second: <point> <point> lfigpsub <point>
+/lfigpsub { 3 2 roll sub 3 1 roll exch sub exch } def
+
+% max two points: <point> <point> lfigpmax <point>
+/lfigpmax { exch 3 1 roll lfigmax 3 1 roll lfigmax exch } def
+
+% min two points: <point> <point> lfigpmin <point>
+/lfigpmin { exch 3 1 roll lfigmin 3 1 roll lfigmin exch } def
+
+% scalar multiplication: <point> <num> lfigpmul <point>
+/lfigpmul { dup 3 1 roll mul 3 1 roll mul exch } def
+
+% point at angle and distance: <point> <length> <angle> lfigatangle <point>
+/lfigatangle { 2 copy cos mul 3 1 roll sin mul lfigpadd } def
+
+% angle from one point to another: <point> <point> lfigangle <angle>
+/lfigangle { lfigpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def
+
+% distance between two points: <point> <point> lfigdistance <length>
+/lfigdistance { lfigpsub dup mul exch dup mul add sqrt } def
+
+% difference in x coords: <point> <point> lfigxdistance <length>
+/lfigxdistance { pop 3 1 roll pop sub } def
+
+%difference in y coords: <point> <point> lfigydistance <length>
+/lfigydistance { 3 1 roll pop sub exch pop } def
+
+% stroke a solid line: <length> <dashlength> lfigsolid -
+/lfigsolid
+{ pop pop [] 0 setdash stroke
+} def
+
+% stroke a lfigdashed line: <length> <dashlength> lfigdashed -
+/lfigdashed
+{ 2 copy div 2 le 1 index 0 le or
+ { exch pop 1 pt lfigmax [ exch dup ] 0 setdash }
+ { dup [ exch 4 2 roll 2 copy div
+ 1 sub 2 div ceiling dup 4 1 roll
+ 1 add mul sub exch div ] 0 setdash
+ } ifelse stroke
+} def
+
+% stroke a lfigcdashed line: <length> <dashlength> lfigcdashed -
+/lfigcdashed
+{ 2 copy le 1 index 0 le or
+ { exch pop 1 pt lfigmax [ exch dup ] dup 0 get 2 div setdash }
+ { dup [ 4 2 roll exch 2 copy exch div
+ 2 div ceiling div 1 index sub
+ ] exch 2 div setdash
+ } ifelse stroke
+} def
+
+% stroke a dotted line: <length> <dashlength> lfigdotted -
+/lfigdotted
+{ 2 copy le 1 index 0 le or
+ { exch pop 1 pt lfigmax [ exch 0 exch ] 0 setdash }
+ { 1 index exch div ceiling div
+ [ 0 3 2 roll ] 0 setdash
+ } ifelse stroke
+} def
+
+% stroke a noline line: <length> <dashlength> lfignoline -
+/lfignoline
+{ pop pop
+} def
+
+% painting (i.e. filling): - lfigwhite - (etc.)
+/lfignopaint { } def
+/lfignochange { fill } def
+/lfigdarkblue { 0.0 0.0 0.5 setrgbcolor fill } def
+/lfigblue { 0.0 0.0 1.0 setrgbcolor fill } def
+/lfiglightblue { 0.5 0.5 1.0 setrgbcolor fill } def
+/lfigdarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def
+/lfiggreen { 0.0 1.0 0.0 setrgbcolor fill } def
+/lfiglightgreen { 0.5 1.0 0.5 setrgbcolor fill } def
+/lfigdarkred { 0.5 0.0 0.0 setrgbcolor fill } def
+/lfigred { 1.0 0.0 0.0 setrgbcolor fill } def
+/lfiglightred { 1.0 0.5 0.5 setrgbcolor fill } def
+/lfigdarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def
+/lfigcyan { 0.0 1.0 1.0 setrgbcolor fill } def
+/lfiglightcyan { 0.5 1.0 1.0 setrgbcolor fill } def
+/lfigdarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def
+/lfigmagenta { 1.0 0.0 1.0 setrgbcolor fill } def
+/lfiglightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def
+/lfigdarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def
+/lfigyellow { 1.0 1.0 0.0 setrgbcolor fill } def
+/lfiglightyellow { 1.0 1.0 0.5 setrgbcolor fill } def
+/lfigdarkgray { 0.2 0.2 0.2 setrgbcolor fill } def
+/lfiggray { 0.5 0.5 0.5 setrgbcolor fill } def
+/lfiglightgray { 0.8 0.8 0.8 setrgbcolor fill } def
+/lfigdarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def
+/lfiggrey { 0.5 0.5 0.5 setrgbcolor fill } def
+/lfiglightgrey { 0.8 0.8 0.8 setrgbcolor fill } def
+/lfigblack { 0.0 0.0 0.0 setrgbcolor fill } def
+/lfigwhite { 1.0 1.0 1.0 setrgbcolor fill } def
+
+% line caps (and joins, not currently used)
+/lfigbutt 0 def
+/lfiground 1 def
+/lfigprojecting 2 def
+/lfigmiter 0 def
+/lfigbevel 2 def
+
+% shape and labels of the @Box symbol
+/lfigbox
+{
+ 0 0 /SW lfigpointdef
+ xsize 0 /SE lfigpointdef
+ xsize ysize /NE lfigpointdef
+ 0 ysize /NW lfigpointdef
+ SE 0.5 lfigpmul /S lfigpointdef
+ NW 0.5 lfigpmul /W lfigpointdef
+ W SE lfigpadd /E lfigpointdef
+ S NW lfigpadd /N lfigpointdef
+ NE 0.5 lfigpmul /CTR lfigpointdef
+ [ CTR NE lfigpsub /lfigboxcircum cvx ] lfigcircumdef
+ SW SE NE NW SW
+} def
+
+% shape and labels of the @CurveBox symbol
+/lfigcurvebox
+{
+
+ xsize 0.5 mul ysize 0.5 mul /CTR lfigpointdef
+ xsize 0.5 mul 0 /S lfigpointdef
+ xsize ysize 0.5 mul /E lfigpointdef
+ xsize 0.5 mul ysize /N lfigpointdef
+ 0 ysize 0.5 mul /W lfigpointdef
+
+ xmark 0.293 mul xmark 0.293 mul /SW lfigpointdef
+ xsize xmark 0.293 mul sub xmark 0.293 mul /SE lfigpointdef
+ xsize xmark 0.293 mul sub ysize xmark 0.293 mul sub /NE lfigpointdef
+ xmark 0.293 mul ysize xmark 0.293 mul sub /NW lfigpointdef
+
+ [ xsize ysize 0.5 lfigpmul xmark /lfigcurveboxcircum cvx ] lfigcircumdef
+
+ xmark 0
+ xsize xmark sub 0
+ [ xsize xmark sub xmark ]
+ xsize xmark
+ xsize ysize xmark sub
+ [ xsize xmark sub ysize xmark sub ]
+ xsize xmark sub ysize
+ xmark ysize
+ [ xmark ysize xmark sub ]
+ 0 ysize xmark sub
+ 0 xmark
+ [ xmark xmark ]
+ xmark 0
+} def
+
+% shadow of the @ShadowBox symbol
+% its shape and labels are done, somewhat inaccurately, with lfigbox
+/lfigshadow
+{ xmark 2 mul 0 moveto xsize 0 lineto
+ xsize ysize xmark 2 mul sub lineto
+ xsize xmark sub ysize xmark 2 mul sub lineto
+ xsize xmark sub xmark lineto
+ xmark 2 mul xmark lineto closepath fill
+} def
+
+% shape and labels of the @Square symbol
+/lfigsquare
+{
+ xsize ysize 0.5 lfigpmul /CTR lfigpointdef
+ CTR xsize xsize ysize ysize lfigpmax 0.5 lfigpmul lfigpadd /NE lfigpointdef
+ CTR 0 0 CTR NE lfigdistance 135 lfigatangle lfigpadd /NW lfigpointdef
+ CTR 0 0 CTR NE lfigdistance 225 lfigatangle lfigpadd /SW lfigpointdef
+ CTR 0 0 CTR NE lfigdistance 315 lfigatangle lfigpadd /SE lfigpointdef
+ SW 0.5 lfigpmul SE 0.5 lfigpmul lfigpadd /S lfigpointdef
+ NW 0.5 lfigpmul NE 0.5 lfigpmul lfigpadd /N lfigpointdef
+ SW 0.5 lfigpmul NW 0.5 lfigpmul lfigpadd /W lfigpointdef
+ SE 0.5 lfigpmul NE 0.5 lfigpmul lfigpadd /E lfigpointdef
+ [ CTR NE lfigpsub /lfigboxcircum cvx ] lfigcircumdef
+ SW SE NE NW SW
+} def
+
+% shape and labels of the @Diamond symbol
+/lfigdiamond
+{
+ xsize 0 0.5 lfigpmul /S lfigpointdef
+ 0 ysize 0.5 lfigpmul /W lfigpointdef
+ S W lfigpadd /CTR lfigpointdef
+ CTR W lfigpadd /N lfigpointdef
+ CTR S lfigpadd /E lfigpointdef
+ [ xsize ysize 0.5 lfigpmul /lfigdiamondcircum cvx ] lfigcircumdef
+ S E N W S
+} def
+
+% shape and labels of the @Ellipse symbol
+/lfigellipse
+{
+ xsize 0 0.5 lfigpmul /S lfigpointdef
+ 0 ysize 0.5 lfigpmul /W lfigpointdef
+ S W lfigpadd /CTR lfigpointdef
+ CTR W lfigpadd /N lfigpointdef
+ CTR S lfigpadd /E lfigpointdef
+ CTR xsize 0 0.3536 lfigpmul lfigpadd 0 ysize 0.3536 lfigpmul lfigpadd /NE lfigpointdef
+ 0 ysize 0.3536 lfigpmul CTR xsize 0 0.3536 lfigpmul lfigpadd lfigpsub /SE lfigpointdef
+ xsize 0 0.3536 lfigpmul CTR lfigpsub 0 ysize 0.3536 lfigpmul lfigpadd /NW lfigpointdef
+ 0 ysize 0.3536 lfigpmul xsize 0 0.3536 lfigpmul CTR lfigpsub lfigpsub /SW lfigpointdef
+ [ xsize ysize 0.5 lfigpmul /lfigellipsecircum cvx ] lfigcircumdef
+ S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
+} def
+
+% shape and labels of the @Circle symbol
+/lfigcircle
+{
+ xsize ysize 0.5 lfigpmul /CTR lfigpointdef
+ CTR xsize 0 ysize 0 lfigpmax 0.5 lfigpmul lfigpadd /E lfigpointdef
+ CTR 0 0 CTR E lfigdistance 45 lfigatangle lfigpadd /NE lfigpointdef
+ CTR 0 0 CTR E lfigdistance 90 lfigatangle lfigpadd /N lfigpointdef
+ CTR 0 0 CTR E lfigdistance 135 lfigatangle lfigpadd /NW lfigpointdef
+ CTR 0 0 CTR E lfigdistance 180 lfigatangle lfigpadd /W lfigpointdef
+ CTR 0 0 CTR E lfigdistance 225 lfigatangle lfigpadd /SW lfigpointdef
+ CTR 0 0 CTR E lfigdistance 270 lfigatangle lfigpadd /S lfigpointdef
+ CTR 0 0 CTR E lfigdistance 315 lfigatangle lfigpadd /SE lfigpointdef
+ [ S E lfigpsub /lfigellipsecircum cvx ] lfigcircumdef
+ S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
+} def
+
+% shape and labels of the @HLine and @HArrow symbols
+/lfighline
+{
+ 0 ymark lfigprevious /FROM lfigpointdef
+ xsize ymark lfigprevious /TO lfigpointdef
+} def
+
+% shape and labels of the @VLine and @VArrow symbols
+/lfigvline
+{
+ xmark ysize lfigprevious /FROM lfigpointdef
+ xmark 0 lfigprevious /TO lfigpointdef
+} def
+
+% points of a polygon around base with given no of sides, vert init angle:
+% <sides> <angle> figpolygon <point> ... <point>
+/lfigpolygon
+{ xsize ysize 0.5 lfigpmul /CTR lfigpointdef
+ 90 sub CTR 2 copy lfigmax 5 3 roll
+ [ 4 copy pop /lfigpolycircum cvx ] lfigcircumdef
+ exch dup 360 exch div exch
+ 1 1 3 2 roll
+ { 4 string cvs (P) exch lfigconcat cvn
+ 6 copy pop pop lfigatangle 2 copy 10 2 roll
+ 3 2 roll lfigpointdef
+ dup 3 1 roll add exch
+ } for
+ pop lfigatangle
+} def
+
+% next array element: <array> <index> lfiggetnext <array> <index> <any> true
+% or <array> <index> false
+/lfiggetnext
+{ 2 copy exch length ge
+ { false }
+ { 2 copy get exch 1 add exch true } ifelse
+} def
+
+% check whether thing is number: <any> lfigisnumbertype <any> <bool>
+/lfigisnumbertype
+{ dup type dup
+ /integertype eq exch /realtype eq or
+} def
+
+% check whether thing is an array: <any> lfigisarraytype <any> <bool>
+/lfigisarraytype { dup type /arraytype eq } def
+
+% get next item: <array> <index> lfiggetnextitem <array> <index> 0
+% or <array> <index> <array> 1
+% or <array> <index> <point> 2
+/lfiggetnextitem
+{ lfiggetnext
+ { lfigisarraytype
+ { 1
+ }
+ { lfigisnumbertype
+ { 3 1 roll
+ lfiggetnext
+ { lfigisnumbertype
+ { 4 3 roll exch 2
+ }
+ { pop 3 2 roll pop 0
+ } ifelse
+ }
+ { 3 2 roll pop 0
+ } ifelse
+ }
+ { pop 0
+ } ifelse
+ } ifelse
+ }
+ { 0
+ } ifelse
+} def
+
+% set arc path: bool x1 y1 x2 y2 x0 y0 lfigsetarc <angle> <angle> <dist>
+% the path goes from x1 y1 to x2 y2 about centre x0 y0,
+% anticlockwise if bool is true else clockwise.
+% The orientations of backwards pointing and forwards pointing
+% arrowheads are returned in the two angles, and
+% the length of the arc is returned in <dist>.
+/lfigsetarc
+{
+ 20 dict begin
+ matrix currentmatrix 8 1 roll
+ 2 copy translate 2 copy 8 2 roll
+ 4 2 roll lfigpsub 6 2 roll lfigpsub
+ dup /y1 exch def dup mul /y1s exch def
+ dup /x1 exch def dup mul /x1s exch def
+ dup /y2 exch def dup mul /y2s exch def
+ dup /x2 exch def dup mul /x2s exch def
+
+ y1s y2s eq
+ { -1
+ }
+ { y1s x2s mul y2s x1s mul sub y1s y2s sub div
+ } ifelse
+ /da exch def
+
+ x1s x2s eq
+ { -1
+ }
+ { x1s y2s mul x2s y1s mul sub x1s x2s sub div
+ } ifelse
+ /db exch def
+
+ da 0 gt db 0 gt and
+ { /LMax da sqrt db sqrt lfigmax def
+ /scalex da sqrt LMax div def
+ /scaley db sqrt LMax div def
+ scalex scaley scale
+ 0 0 LMax
+ 0 0 x1 scalex mul y1 scaley mul lfigangle
+ 0 0 x2 scalex mul y2 scaley mul lfigangle
+ 2 copy eq { 360 add } if
+ 2 copy 8 2 roll
+ 5 index { arc } { arcn } ifelse
+ 2 index 1 index
+ { 90 sub } { 90 add } ifelse
+ dup sin scaley mul exch cos scalex mul atan
+ 2 index 2 index
+ { 90 add } { 90 sub } ifelse
+ dup sin scaley mul exch cos scalex mul atan
+ 5 2 roll % res1 res2 ang1 ang2 anticlockwise
+ { exch sub } { sub } ifelse
+ dup 0 le { 360 add } if lfigpi mul LMax mul 180 div
+ }
+ { 0 0 x1 y1 lfigdistance 0 0 x2 y2 lfigdistance eq
+ 0 0 x1 y1 lfigdistance 0 gt and
+ { 0 0
+ 0 0 x1 y1 lfigdistance
+ 0 0 x1 y1 lfigangle
+ 0 0 x2 y2 lfigangle
+ 2 copy eq { 360 add } if
+ 2 copy 8 2 roll
+ 5 index { arc } { arcn } ifelse
+ 2 index 1 index
+ { 90 sub } { 90 add } ifelse
+ 2 index 2 index
+ { 90 add } { 90 sub } ifelse
+ 5 2 roll % res1 res2 ang1 ang2 clockwise
+ { exch sub } { sub } ifelse
+ dup 0 le { 360 add } if lfigpi mul 0 0 x1 y1 lfigdistance mul 180 div
+ }
+ { x2 y2 lineto pop
+ x2 y2 x1 y1 lfigangle
+ x1 y1 x2 y2 lfigangle
+ x1 y1 x2 y2 lfigdistance
+ } ifelse
+ } ifelse
+ 4 -1 roll setmatrix
+ end
+} def
+
+% lfigsetcurve: set up a Bezier curve from x0 y0 to x3 y3
+% and return arrowhead angles and length of curve (actually 0)
+% x0 y0 x1 y1 x2 y2 x3 y3 lfigsetcurve <angle> <angle> <length>
+/lfigsetcurve
+{ 8 copy curveto pop pop
+ lfigangle
+ 5 1 roll
+ 4 2 roll lfigangle
+ exch
+ 0
+} def
+
+% lfigpaintpath: paint a path of the given shape
+% /paint [ shape ] lfigpaintpath -
+/lfigpaintpath
+{
+ 10 dict begin
+ 0 newpath
+ /prevseen false def
+ /curveseen false def
+ { lfiggetnextitem
+ dup 0 eq { pop exit }
+ { 1 eq
+ { /curveseen true def
+ /curve exch def
+ curve length 0 eq { /curveseen false def } if
+ }
+ { /ycurr exch def
+ /xcurr exch def
+ prevseen
+ { curveseen
+ { curve length 4 eq
+ { xprev yprev
+ curve 0 get curve 1 get
+ curve 2 get curve 3 get
+ xcurr ycurr
+ lfigsetcurve pop pop pop
+ }
+ { xprev yprev xcurr ycurr
+ curve length 1 ge { curve 0 get } { 0 } ifelse
+ curve length 2 ge { curve 1 get } { 0 } ifelse
+ curve length 3 ge { curve 2 get } { true } ifelse
+ 7 1 roll
+ lfigsetarc pop pop pop
+ } ifelse
+ }
+ { xcurr ycurr lineto
+ } ifelse
+ }
+ { xcurr ycurr moveto
+ } ifelse
+ /xprev xcurr def
+ /yprev ycurr def
+ /prevseen true def
+ /curveseen false def
+ } ifelse
+ } ifelse
+ } loop pop pop cvx exec
+ end
+} def
+
+% stroke a path of the given shape in the given linestyle and dash length.
+% Return the origin and angle of the backward and forward arrow heads.
+% dashlength /linestyle [shape] lfigdopath [<point> <angle>] [<point> <angle>]
+/lfigdopath
+{
+ 10 dict begin
+ 0
+ /prevseen false def
+ /curveseen false def
+ /backarrow [] def
+ /fwdarrow [] def
+ {
+ lfiggetnextitem
+ dup 0 eq { pop exit }
+ {
+ 1 eq
+ { /curveseen true def
+ /curve exch def
+ curve length 0 eq { /prevseen false def } if
+ }
+ { /ycurr exch def
+ /xcurr exch def
+ prevseen
+ { newpath xprev yprev moveto
+ curveseen
+ { curve length 4 eq
+ { xprev yprev
+ curve 0 get curve 1 get
+ curve 2 get curve 3 get
+ xcurr ycurr lfigsetcurve
+ }
+ { xprev yprev xcurr ycurr
+ curve length 1 ge { curve 0 get } { 0 } ifelse
+ curve length 2 ge { curve 1 get } { 0 } ifelse
+ curve length 3 ge { curve 2 get } { true } ifelse
+ 7 1 roll
+ lfigsetarc
+ } ifelse
+ }
+ { xcurr ycurr lineto
+ xcurr ycurr xprev yprev lfigangle dup 180 sub
+ xprev yprev xcurr ycurr lfigdistance
+ } ifelse
+ 6 index 6 index cvx exec
+ [ xprev yprev 5 -1 roll ]
+ backarrow length 0 eq
+ { /backarrow exch def }
+ { pop } ifelse
+ [ xcurr ycurr 4 -1 roll ] /fwdarrow exch def
+ } if
+ /xprev xcurr def
+ /yprev ycurr def
+ /prevseen true def
+ /curveseen false def
+ } ifelse
+ } ifelse
+ } loop
+ pop pop pop pop
+ backarrow length 0 eq { [ 0 0 0 ] } { backarrow } ifelse
+ fwdarrow length 0 eq { [ 0 0 0 ] } { fwdarrow } ifelse
+ end
+} def
+
+% lfigdoarrow: draw an arrow head of given form
+% dashlength /lstyle /pstyle hfrac height width [ <point> <angle> ] lfigdoarrow -
+/lfigdoarrow
+{ matrix currentmatrix 8 1 roll
+ dup 0 get 1 index 1 get translate
+ 2 get rotate
+ [ 2 index neg 2 index 0 0
+ 3 index 3 index neg
+ 1 index 10 index mul 0
+ 7 index 7 index ]
+ 4 1 roll pop pop pop
+ dup 3 1 roll
+ gsave lfigpaintpath grestore lfigdopath pop pop
+ setmatrix
+} def
+
+% arrow head styles
+/lfigopen 0.0 def
+/lfighalfopen 0.5 def
+/lfigclosed 1.0 def
+
+% stroke no arrows, forward, back, and both
+/lfignoarrow { pop pop pop pop pop pop pop pop } def
+/lfigforward { 7 -1 roll lfigdoarrow pop } def
+/lfigback { 8 -2 roll pop lfigdoarrow } def
+/lfigboth { 8 -1 roll 7 copy lfigdoarrow pop 7 -1 roll lfigdoarrow } def
+
+% lfigprevious: return previous point on path
+/lfigprevious
+{ lfigisnumbertype
+ { 2 copy }
+ { lfigisarraytype
+ { 2 index 2 index }
+ { 0 0 }
+ ifelse
+ } ifelse
+} def
+
+% label a point in 2nd top dictionary: <point> /name lfigpointdef -
+/lfigpointdef
+{
+ % (Entering lfigpointdef) lfigdebugprint
+ [ 4 2 roll transform
+ /itransform cvx ] cvx
+ currentdict end
+ 3 1 roll
+ % currentdict length currentdict maxlength lt
+ % { def }
+ % { exec moveto (too many labels) show stop }
+ % ifelse
+ def
+ begin
+ % (Leaving lfigpointdef) lfigdebugprint
+} def
+
+% promote labels from second top to third top dictionary
+% <string> lfigpromotelabels -
+/lfigpromotelabels
+{
+ % (Entering lfigpromotelabels) lfigdebugprint
+ currentdict end exch currentdict end
+ { exch 20 string cvs 2 index
+ (@) lfigconcat exch lfigconcat cvn exch def
+ } forall pop begin
+ % (Leaving lfigpromotelabels) lfigdebugprint
+} def
+
+% show labels (except CIRCUM): - lfigshowlabels -
+/lfigshowlabels
+{
+ % (Entering lfigshowlabels) lfigdebugprint
+ currentdict end
+ currentdict
+ { 1 index 20 string cvs (CIRCUM) search % if CIRCUM in key
+ { pop pop pop pop pop }
+ { pop cvx exec 2 copy
+ newpath 1.5 pt 0 360 arc
+ 0 setgray fill
+ /Times-Roman findfont 8 pt scalefont setfont
+ moveto 0.2 cm 0.1 cm rmoveto 20 string cvs show
+ }
+ ifelse
+ } forall
+ begin
+ % (Leaving lfigshowlabels) lfigdebugprint
+} def
+
+% fix an angle to 0 <= res < 360: <angle> lfigfixangle <angle>
+/lfigfixangle
+{
+ % (Entering lfigfixangle) lfigdebugprint
+ { dup 0 ge { exit } if
+ 360 add
+ } loop
+ { dup 360 lt { exit } if
+ 360 sub
+ } loop
+ % (Leaving lfigfixangle) lfigdebugprint
+} def
+
+% find point on circumference of box: alpha a b lfigboxcircum x y
+/lfigboxcircum
+{
+ % (Entering lfigboxcircum) lfigdebugprint
+ 4 dict begin
+ /b exch def
+ /a exch def
+ lfigfixangle /alpha exch def
+ 0 0 a b lfigangle /theta exch def
+
+ % if alpha <= theta, return (a, a*tan(alpha))
+ alpha theta le
+ { a a alpha sin mul alpha cos div }
+ {
+ % else if alpha <= 180 - theta, return (b*cot(alpha), b)
+ alpha 180 theta sub le
+ { b alpha cos mul alpha sin div b }
+ {
+ % else if alpha <= 180 + theta, return (-a, -a*tan(alpha))
+ alpha 180 theta add le
+ { a neg a neg alpha sin mul alpha cos div }
+ {
+ % else if alpha <= 360 - theta, return (-b*cot(alpha), -b)
+ alpha 360 theta sub le
+ { b neg alpha cos mul alpha sin div b neg }
+ {
+ % else 360 - theta <= alpha, return (a, a*tan(alpha))
+ a a alpha sin mul alpha cos div
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ end
+ % (Leaving lfigboxcircum) lfigdebugprint
+} def
+
+% find quadratic roots (assume a != 0): a b c lfigqroots x1 x2 2
+% or x2 1
+% or 0
+/lfigqroots
+{
+ 4 dict begin
+ /c exch def
+ /b exch def
+ /a exch def
+ /disc b b mul 4 a c mul mul sub def
+ disc 0 lt
+ { 0
+ }
+ { disc 0 eq
+ { b neg 2 a mul div
+ 1
+ }
+ { b neg disc sqrt add 2 a mul div
+ b neg disc sqrt sub 2 a mul div
+ 2
+ }
+ ifelse
+ }
+ ifelse
+ end
+} def
+
+% work our which quadrant: <angle> lfigquadrant <0-3>
+/lfigquadrant
+{ dup 90 lt
+ { pop 0
+ }
+ { dup 180 lt
+ { pop 1
+ }
+ { 270 lt
+ { 2
+ }
+ { 3
+ } ifelse
+ } ifelse
+ } ifelse
+} def
+
+% find curvebox circum, assuming upper right quadrant: alpha a b xmk lfigcb x y
+/lfigcb
+{
+ 6 dict begin
+ /xmk exch def
+ /b exch def
+ /a exch def
+ /alpha exch def
+ /theta1 0 0 a b xmk sub lfigangle def
+ /theta2 0 0 a xmk sub b lfigangle def
+ alpha theta1 le
+ { % if alpha <= theta1, return (a, a*tan(alpha))
+ a a alpha sin mul alpha cos div
+ }
+ { alpha theta2 ge
+ { % else if alpha > theta2, return (b*cot(alpha), b)
+ b alpha cos mul alpha sin div b
+ }
+ {
+ % else, return the intersection of line and circle
+ a xmk sub b xmk sub xmk 0 0 alpha lfigcircleintersect
+ dup 0 eq
+ { % should never happen, just return any reasonable point
+ pop
+ a b 0.5 lfigpmul
+ }
+ { 1 eq
+ { % should never happen, just return the point on top of stack
+ }
+ { % the usual case, two points on stack, return the larger
+ lfigpmax
+ } ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+ end
+} def
+
+% find point on circumference of curvebox: alpha a b xmk lfigcurveboxcircum x y
+/lfigcurveboxcircum
+{
+ % (Entering lfigcurveboxcircum) lfigdebugprint
+ 5 dict begin
+ /xmk exch def
+ /b exch def
+ /a exch def
+ lfigfixangle /alpha exch def
+
+ % work out which quadrant we are in, and reflect accordingly
+ /quad alpha lfigquadrant def
+ quad 0 eq
+ { alpha a b xmk lfigcb
+ }
+ { quad 1 eq
+ { 180 alpha sub a b xmk lfigcb exch neg exch
+ }
+ { quad 2 eq
+ { alpha 180 sub a b xmk lfigcb neg exch neg exch
+ }
+ { 360 alpha sub a b xmk lfigcb neg
+ } ifelse
+ } ifelse
+ } ifelse
+ end
+ % (Leaving lfigcurveboxcircum) lfigdebugprint
+} def
+
+% find point on circumference of diamond: alpha a b lfigdiamondcircum x y
+/lfigdiamondcircum
+{
+ % (Entering lfigdiamondcircum) lfigdebugprint
+ 4 dict begin
+ /b exch def
+ /a exch def
+ lfigfixangle /alpha exch def
+ b alpha cos abs mul a alpha sin abs mul add /denom exch def
+ a b mul alpha cos mul denom div
+ a b mul alpha sin mul denom div
+ end
+ % (Leaving lfigdiamondcircum) lfigdebugprint
+} def
+
+% find point on circumference of ellipse: alpha a b lfigellipsecircum x y
+/lfigellipsecircum
+{
+ % (Entering lfigellipsecircum) lfigdebugprint
+ 4 dict begin
+ /b exch def
+ /a exch def
+ lfigfixangle /alpha exch def
+ b alpha cos mul dup mul a alpha sin mul dup mul add sqrt /denom exch def
+ a b mul alpha cos mul denom div
+ a b mul alpha sin mul denom div
+ end
+ % (Leaving lfigellipsecircum) lfigdebugprint
+} def
+
+% find point of intersection of two lines each defined by two points
+% x1 y1 x2 y2 x3 y3 x4 y4 lfiglineintersect x y
+/lfiglineintersect
+{
+ % (Entering lfiglineintersect) lfigdebugprint
+ 13 dict begin
+ /y4 exch def
+ /x4 exch def
+ /y3 exch def
+ /x3 exch def
+ /y2 exch def
+ /x2 exch def
+ /y1 exch def
+ /x1 exch def
+ x2 x1 sub /x21 exch def
+ x4 x3 sub /x43 exch def
+ y2 y1 sub /y21 exch def
+ y4 y3 sub /y43 exch def
+ y21 x43 mul y43 x21 mul sub /det exch def
+
+ % calculate x
+ y21 x43 mul x1 mul
+ y43 x21 mul x3 mul sub
+ y3 y1 sub x21 mul x43 mul add
+ det div
+
+ % calculate y
+ x21 y43 mul y1 mul
+ x43 y21 mul y3 mul sub
+ x3 x1 sub y21 mul y43 mul add
+ det neg div
+
+ end
+ % (Leaving lfiglineintersect) lfigdebugprint
+} def
+
+% find point on circumference of polygon
+% alpha radius num theta lfigpolycircum x y
+/lfigpolycircum
+{
+ % (Entering lfigpolycircum) lfigdebugprint
+ 13 dict begin
+ /theta exch def
+ /num exch def
+ /radius exch def
+ /alpha exch def
+
+ % calculate delta, the angle from theta to alpha
+ alpha theta sub lfigfixangle
+
+ % calculate the angle which is the multiple of 360/num closest to delta
+ 360 num div div truncate 360 num div mul theta add /anglea exch def
+
+ % calculate the next multiple of 360/num after anglea
+ anglea 360 num div add /angleb exch def
+
+ % intersect the line through these two points with the alpha line
+ anglea cos anglea sin angleb cos angleb sin
+ 0 0 alpha cos 2 mul alpha sin 2 mul
+ lfiglineintersect radius lfigpmul
+
+ end
+ % (Leaving lfigpolycircum) lfigdebugprint
+} def
+
+% find point of intersection of a point and a circle
+% x0 y0 r x1 y1 theta lfigcircleintersect xa ya xb yb 2
+% or xb yb 1
+% or 0
+/lfigcircleintersect
+{
+ % (Entering lfigcircleintersect) lfigdebugprint
+ 15 dict begin
+ /theta exch def
+ /y1 exch def
+ /x1 exch def
+ /r exch def
+ /y0 exch def
+ /x0 exch def
+
+ % if sin(theta) = 0 then line is horizontal and y must be y1
+ theta sin abs 0.00001 lt
+ {
+ /a 1 def
+ /b -2 x0 mul def
+ /c x0 dup mul y1 y0 sub dup mul add r dup mul sub def
+ a b c lfigqroots dup
+ 0 eq
+ { pop
+ 0
+ }
+ { 1 eq
+ { y1 1
+ }
+ { y1 exch y1 2
+ } ifelse
+ } ifelse
+ }
+ {
+ /ct theta cos theta sin div def
+ /a ct ct mul 1 add def
+ /b ct x1 x0 sub mul y1 add y0 sub 2 mul def
+ /c x1 x0 sub dup mul y1 y0 sub dup mul add r dup mul sub def
+ a b c lfigqroots dup
+ 0 eq
+ { pop
+ 0
+ }
+ { 1 eq
+ { y1 add /yb exch def
+ yb y1 sub ct mul x1 add /xb exch def
+ xb yb 1
+ }
+ { y1 add /ya exch def
+ ya y1 sub ct mul x1 add /xa exch def
+ y1 add /yb exch def
+ yb y1 sub ct mul x1 add /xb exch def
+ xa ya xb yb 2
+ } ifelse
+ } ifelse
+ } ifelse
+ end
+ % (Leaving lfigcircleintersect) lfigdebugprint
+} def
+
+% add CIRCUM operator with this body: <array> lfigcircumdef -
+/lfigcircumdef
+{ % (Entering lfigcircumdef) lfigdebugprint
+ /CIRCUM exch cvx
+ currentdict end
+ 3 1 roll
+ % currentdict length currentdict maxlength lt
+ % { def }
+ % { exec moveto (too many labels) show stop }
+ % ifelse
+ def
+ begin
+ % (Leaving lfigcircumdef) lfigdebugprint
+} def
+
+end
+%%EndResource
diff --git a/include/fontdefs b/include/fontdefs
new file mode 100644
index 0000000..0001b97
--- /dev/null
+++ b/include/fontdefs
@@ -0,0 +1,156 @@
+##################################################################################################################
+# #
+# Font definitions. Use a very wide window to see them clearly. #
+# #
+# Lout font Lout font PostScript PostScript font metrics Lout character Recode/ #
+# family name face name font name (formerly .AFM) file name mapping file NoRecode #
+# #
+##################################################################################################################
+
+
+fontdef AvantGarde Base { AvantGarde-Medium AG-Md LtLatin1.LCM Recode }
+fontdef AvantGarde Slope { AvantGarde-MediumObl AG-MdO LtLatin1.LCM Recode }
+fontdef AvantGarde Bold { AvantGarde-Bold AG-Bd LtLatin1.LCM Recode }
+fontdef AvantGarde BoldSlope { AvantGarde-BoldObl AG-BdO LtLatin1.LCM Recode }
+
+fontdef AvantGarde Bold { AvantGarde-Bold AG-Bd LtLatin1.LCM Recode }
+fontdef AvantGarde BoldObl { AvantGarde-BoldObl AG-BdO LtLatin1.LCM Recode }
+fontdef AvantGarde Book { AvantGarde-Book AG-Bk LtLatin1.LCM Recode }
+fontdef AvantGarde BookOblique { AvantGarde-BookOblique AG-BkO LtLatin1.LCM Recode }
+fontdef AvantGarde CondBold { AvantGarde-CondBold AG-CnBd LtLatin1.LCM Recode }
+fontdef AvantGarde CondBook { AvantGarde-CondBook AG-CnBk LtLatin1.LCM Recode }
+fontdef AvantGarde CondDemi { AvantGarde-CondDemi AG-CnDm LtLatin1.LCM Recode }
+fontdef AvantGarde CondMedium { AvantGarde-CondMedium AG-CnMd LtLatin1.LCM Recode }
+fontdef AvantGarde Demi { AvantGarde-Demi AG-Dm LtLatin1.LCM Recode }
+fontdef AvantGarde DemiOblique { AvantGarde-DemiOblique AG-DmO LtLatin1.LCM Recode }
+fontdef AvantGarde ExtraLight { AvantGarde-ExtraLight AG-ExLt LtLatin1.LCM Recode }
+fontdef AvantGarde ExtraLightObl { AvantGarde-ExtraLightObl AG-ExLtO LtLatin1.LCM Recode }
+fontdef AvantGarde Medium { AvantGarde-Medium AG-Md LtLatin1.LCM Recode }
+fontdef AvantGarde MediumObl { AvantGarde-MediumObl AG-MdO LtLatin1.LCM Recode }
+
+
+fontdef Bookman Base { Bookman-Medium Bk-Md LtLatin1.LCM Recode }
+fontdef Bookman Slope { Bookman-MediumItalic Bk-MdIt LtLatin1.LCM Recode }
+fontdef Bookman Bold { Bookman-Bold Bk-Bd LtLatin1.LCM Recode }
+fontdef Bookman BoldSlope { Bookman-BoldItalic Bk-BdIt LtLatin1.LCM Recode }
+
+fontdef Bookman Bold { Bookman-Bold Bk-Bd LtLatin1.LCM Recode }
+fontdef Bookman BoldItalic { Bookman-BoldItalic Bk-BdIt LtLatin1.LCM Recode }
+fontdef Bookman Demi { Bookman-Demi Bk-Dm LtLatin1.LCM Recode }
+fontdef Bookman DemiItalic { Bookman-DemiItalic Bk-DmIt LtLatin1.LCM Recode }
+fontdef Bookman Light { Bookman-Light Bk-Lt LtLatin1.LCM Recode }
+fontdef Bookman LightItalic { Bookman-LightItalic Bk-LtIt LtLatin1.LCM Recode }
+fontdef Bookman Medium { Bookman-Medium Bk-Md LtLatin1.LCM Recode }
+fontdef Bookman MediumItalic { Bookman-MediumItalic Bk-MdIt LtLatin1.LCM Recode }
+
+
+fontdef Courier Base { Courier Cr LtLatin1.LCM Recode }
+fontdef Courier Slope { Courier-Oblique Cr-O LtLatin1.LCM Recode }
+fontdef Courier Bold { Courier-Bold Cr-Bd LtLatin1.LCM Recode }
+fontdef Courier BoldSlope { Courier-BoldOblique Cr-BdO LtLatin1.LCM Recode }
+
+fontdef Courier Base { Courier Cr LtLatin1.LCM Recode }
+fontdef Courier Bold { Courier-Bold Cr-Bd LtLatin1.LCM Recode }
+fontdef Courier BoldOblique { Courier-BoldOblique Cr-BdO LtLatin1.LCM Recode }
+fontdef Courier Oblique { Courier-Oblique Cr-O LtLatin1.LCM Recode }
+
+
+fontdef Helvetica Base { Helvetica He LtLatin1.LCM Recode }
+fontdef Helvetica Slope { Helvetica-Oblique He-O LtLatin1.LCM Recode }
+fontdef Helvetica Bold { Helvetica-Bold He-Bd LtLatin1.LCM Recode }
+fontdef Helvetica BoldSlope { Helvetica-BoldOblique He-BdO LtLatin1.LCM Recode }
+
+fontdef Helvetica Base { Helvetica He LtLatin1.LCM Recode }
+fontdef Helvetica Black { Helvetica-Black He-Bl LtLatin1.LCM Recode }
+fontdef Helvetica BlackOblique { Helvetica-BlackOblique He-BlO LtLatin1.LCM Recode }
+fontdef Helvetica Bold { Helvetica-Bold He-Bd LtLatin1.LCM Recode }
+fontdef Helvetica BoldOblique { Helvetica-BoldOblique He-BdO LtLatin1.LCM Recode }
+fontdef Helvetica Compressed { Helvetica-Compressed He-Cm LtLatin1.LCM Recode }
+fontdef Helvetica Cond { Helvetica-Condensed He-Cn LtLatin1.LCM Recode }
+fontdef Helvetica CondBlack { Helvetica-Condensed-Black He-CnBl LtLatin1.LCM Recode }
+fontdef Helvetica CondBlackObl { Helvetica-Condensed-BlackObl He-CnBlO LtLatin1.LCM Recode }
+fontdef Helvetica CondBold { Helvetica-Condensed-Bold He-CnBd LtLatin1.LCM Recode }
+fontdef Helvetica CondBoldObl { Helvetica-Condensed-BoldObl He-CnBdO LtLatin1.LCM Recode }
+fontdef Helvetica CondLight { Helvetica-Condensed-Light He-CnLi LtLatin1.LCM Recode }
+fontdef Helvetica CondLightObl { Helvetica-Condensed-LightObl He-CnLiO LtLatin1.LCM Recode }
+fontdef Helvetica CondOblique { Helvetica-Condensed-Oblique He-CnO LtLatin1.LCM Recode }
+fontdef Helvetica ExtraCompressed { Helvetica-ExtraCompressed He-ExtC LtLatin1.LCM Recode }
+fontdef Helvetica Light { Helvetica-Light He-Lt LtLatin1.LCM Recode }
+fontdef Helvetica LightOblique { Helvetica-LightOblique He-LtO LtLatin1.LCM Recode }
+fontdef Helvetica Narrow { Helvetica-Narrow He-Nr LtLatin1.LCM Recode }
+fontdef Helvetica NarrowBold { Helvetica-Narrow-Bold He-NrBd LtLatin1.LCM Recode }
+fontdef Helvetica NarrowBoldObl { Helvetica-Narrow-BoldOblique He-NrBdO LtLatin1.LCM Recode }
+fontdef Helvetica NarrowObl { Helvetica-Narrow-Oblique He-NrO LtLatin1.LCM Recode }
+fontdef Helvetica Oblique { Helvetica-Oblique He-O LtLatin1.LCM Recode }
+fontdef Helvetica UltraCompressed { Helvetica-UltraCompressed He-UlCm LtLatin1.LCM Recode }
+
+
+fontdef Schoolbook Base { NewCenturySchlbk-Roman NCS-Rm LtLatin1.LCM Recode }
+fontdef Schoolbook Slope { NewCenturySchlbk-Italic NCS-It LtLatin1.LCM Recode }
+fontdef Schoolbook Bold { NewCenturySchlbk-Bold NCS-Bd LtLatin1.LCM Recode }
+fontdef Schoolbook BoldSlope { NewCenturySchlbk-BoldItalic NCS-BdIt LtLatin1.LCM Recode }
+
+fontdef Schoolbook Bold { NewCenturySchlbk-Bold NCS-Bd LtLatin1.LCM Recode }
+fontdef Schoolbook BoldItalic { NewCenturySchlbk-BoldItalic NCS-BdIt LtLatin1.LCM Recode }
+fontdef Schoolbook Italic { NewCenturySchlbk-Italic NCS-It LtLatin1.LCM Recode }
+fontdef Schoolbook Roman { NewCenturySchlbk-Roman NCS-Rm LtLatin1.LCM Recode }
+
+
+fontdef Palatino Base { Palatino-Roman Pa-Rm LtLatin1.LCM Recode }
+fontdef Palatino Slope { Palatino-Italic Pa-It LtLatin1.LCM Recode }
+fontdef Palatino Bold { Palatino-Bold Pa-Bd LtLatin1.LCM Recode }
+fontdef Palatino BoldSlope { Palatino-BoldItalic Pa-BdIt LtLatin1.LCM Recode }
+
+fontdef Palatino Bold { Palatino-Bold Pa-Bd LtLatin1.LCM Recode }
+fontdef Palatino BoldItalic { Palatino-BoldItalic Pa-BdIt LtLatin1.LCM Recode }
+fontdef Palatino BoldItalicOsF { Palatino-BoldItalicOsF Pa-BdItF LtLatin1.LCM Recode }
+fontdef Palatino BoldOsF { Palatino-BoldOsF Pa-BdF LtLatin1.LCM Recode }
+fontdef Palatino Italic { Palatino-Italic Pa-It LtLatin1.LCM Recode }
+fontdef Palatino ItalicOsF { Palatino-ItalicOsF Pa-ItF LtLatin1.LCM Recode }
+fontdef Palatino Roman { Palatino-Roman Pa-Rm LtLatin1.LCM Recode }
+fontdef Palatino SC { Palatino-SC Pa-SC LtLatin1.LCM Recode }
+
+
+fontdef Symbol Base { Symbol Symbol Symb.LCM NoRecode }
+fontdef Symbol Slope { Symbol Symbol Symb.LCM NoRecode }
+fontdef Symbol Bold { Symbol Symbol Symb.LCM NoRecode }
+fontdef Symbol BoldSlope { Symbol Symbol Symb.LCM NoRecode }
+
+
+fontdef Times Base { Times-Roman Ti-Rm LtLatin1.LCM Recode }
+fontdef Times Slope { Times-Italic Ti-It LtLatin1.LCM Recode }
+fontdef Times Bold { Times-Bold Ti-Bd LtLatin1.LCM Recode }
+fontdef Times BoldSlope { Times-BoldItalic Ti-BdIt LtLatin1.LCM Recode }
+
+fontdef Times Bold { Times-Bold Ti-Bd LtLatin1.LCM Recode }
+fontdef Times BoldItalic { Times-BoldItalic Ti-BdIt LtLatin1.LCM Recode }
+fontdef Times BoldItalicOsF { Times-BoldItalicOsF Ti-BdItF LtLatin1.LCM Recode }
+fontdef Times BoldSC { Times-BoldSC Ti-BdSC LtLatin1.LCM Recode }
+fontdef Times ExtraBold { Times-ExtraBold Ti-ExBd LtLatin1.LCM Recode }
+fontdef Times Italic { Times-Italic Ti-It LtLatin1.LCM Recode }
+fontdef Times ItalicOsF { Times-ItalicOsF Ti-ItF LtLatin1.LCM Recode }
+fontdef Times Roman { Times-Roman Ti-Rm LtLatin1.LCM Recode }
+fontdef Times RomanSC { Times-RomanSC Ti-RmSC LtLatin1.LCM Recode }
+fontdef Times Semibold { Times-Semibold Ti-Sm LtLatin1.LCM Recode }
+fontdef Times SemiboldItalic { Times-SemiboldItalic Ti-SmIt LtLatin1.LCM Recode }
+
+
+fontdef Chancery Base { ZapfChancery-Roman ZC-Rm LtLatin1.LCM Recode }
+fontdef Chancery Slope { ZapfChancery-Italic ZC-It LtLatin1.LCM Recode }
+fontdef Chancery Bold { ZapfChancery-Bold ZC-Bd LtLatin1.LCM Recode }
+fontdef Chancery BoldSlope { ZapfChancery-MediumItalic ZC-MdIt LtLatin1.LCM Recode }
+
+fontdef Chancery Roman { ZapfChancery-Roman ZC-Rm LtLatin1.LCM Recode }
+fontdef Chancery Bold { ZapfChancery-Bold ZC-Bd LtLatin1.LCM Recode }
+fontdef Chancery Italic { ZapfChancery-Italic ZC-It LtLatin1.LCM Recode }
+fontdef Chancery Light { ZapfChancery-Light ZC-Lt LtLatin1.LCM Recode }
+fontdef Chancery Demi { ZapfChancery-Demi ZC-Dm LtLatin1.LCM Recode }
+fontdef Chancery LightItalic { ZapfChancery-LightItalic ZC-LtIt LtLatin1.LCM Recode }
+fontdef Chancery MediumItalic { ZapfChancery-MediumItalic ZC-MdIt LtLatin1.LCM Recode }
+
+
+fontdef Dingbats Base { ZapfDingbats ZD Ding.LCM NoRecode }
+fontdef Dingbats Slope { ZapfDingbats ZD Ding.LCM NoRecode }
+fontdef Dingbats Bold { ZapfDingbats ZD Ding.LCM NoRecode }
+fontdef Dingbats BoldSlope { ZapfDingbats ZD Ding.LCM NoRecode }
+
diff --git a/include/graph b/include/graph
new file mode 100644
index 0000000..f346317
--- /dev/null
+++ b/include/graph
@@ -0,0 +1,27 @@
+###############################################################################
+# #
+# Lout setup file for graph drawing #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# The @SysInclude { graphf } line #
+# #
+# This line causes Lout to read the definitions for graphs, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { graphf }
+
+
+###############################################################################
+# #
+# This package does not offer default options that can be changed. #
+# #
+###############################################################################
diff --git a/include/graphf b/include/graphf
new file mode 100644
index 0000000..dfd69df
--- /dev/null
+++ b/include/graphf
@@ -0,0 +1,1084 @@
+
+###############################################################################
+# #
+# Lout @Graph package for drawing graphs (Version 1.0) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, December 1993. #
+# #
+# This package draws graphs, the statistical kind not the graph-theoretical #
+# kind. See the User's Guide (Advanced Graphics) for user info. #
+# #
+###############################################################################
+
+@SysPrependGraphic { graphf.lpg }
+@SysInclude { graphf.etc }
+
+def @GraphObj
+ left p
+ named margin { 0c }
+ named adj { 0 0 }
+ right x
+{
+ @BackEnd @Case {
+ PostScript @Yield {
+ @Null & # kills previous white space
+ @HContract @VContract {
+ //0io ||0io @HContract @VContract
+ { p "trpoint translate" adj "translate gsave" // "grestore" }
+ @Graphic { //margin ||margin x ||margin //margin }
+ ||0io //0io
+ }
+ }
+# VT: PDF does nothing
+ PDF @Yield {
+ @Null & # kills previous white space
+ @HContract @VContract {
+ //0io ||0io @HContract @VContract
+ { "% @GraphObj UNIMPLEMENTED" }
+ @Graphic { //margin ||margin x ||margin //margin }
+ ||0io //0io
+ }
+ }
+ }
+}
+
+def @GraphCross
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath 0 0 moveto xsize ysize lineto 0 ysize moveto"
+ "xsize 0 lineto [] 0 setdash stroke"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+ {"n [] 0 d 0 0 m __xsize __ysize l 0 __ysize m __xsize 0 l S"} # uses S because PostScript version does NOT use closepath
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphPlus
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath xmark 0 moveto xmark ysize lineto 0 ymark moveto"
+ "xsize ymark lineto [] 0 setdash stroke"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+ {"n [] 0 d __xmark 0 m __xmark __ysize l 0 __ymark m __xsize __ymark l S"} # uses S because PostScript version does NOT use closepath
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphSquare
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto"
+ "0 ysize lineto closepath [] 0 setdash stroke"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+ {"n [] 0 d 0 0 __xsize __ysize re s"}
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphFilledSquare
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto"
+ "0 ysize lineto closepath gsave [] 0 setdash stroke grestore fill"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+ {"n [] 0 d 0 0 __xsize __ysize re b"}
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphDiamond
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto"
+ "xmark ysize lineto closepath [] 0 setdash stroke"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+ {"n [] 0 d 0 __ymark m __xmark 0 l __xsize __ymark l __xmark __ysize l s"}
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphFilledDiamond
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto"
+ "xmark ysize lineto closepath gsave [] 0 setdash stroke grestore fill"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+ {"n [] 0 d 0 __ymark m __xmark 0 l __xsize __ymark l __xmark __ysize l b"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphCircle
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath xmark ymark xmark 0 360 arc"
+ "[] 0 setdash stroke"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+#
+# draw a circle whose centre is at (xmark, ymark) and whose radius is xmark units;
+#
+# for curveto to work, we need to calculate the control points of the Bezier curve
+# as well as move the pen to the correct initial point. The circle is drawn as two
+# arcs of 180 degrees
+#
+# pt0 = (xmark + xmark, ymark)
+# pt1 = (xmark + xmark, ymark + 4/3 * xmark)
+# pt2 = (0, ymark + 4/3 * xmark)
+# pt3 = (0, ymark)
+#
+# pt0 = (0, ymark)
+# pt1 = (0, ymark - 4/3 * xmark)
+# pt2 = (xmark + xmark, ymark - 4/3 * xmark)
+# pt3 = (xmark + xmark, ymark)
+#
+ {"n [] 0 d"
+ "__mul(2, __xmark) __ymark m"
+ "__mul(2, __xmark) __add(__ymark, __div(__mul(4, __xmark), 3))" # pt1
+ "0 __add(__ymark, __div(__mul(4, __xmark), 3))" # pt2
+ "0 __ymark c" # pt3
+
+ "0 __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt1
+ "__mul(2, __xmark) __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt2
+ "__mul(2, __xmark) __ymark c S" # pt3
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphFilledCircle
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath xmark ymark xmark 0 360 arc"
+ "gsave [] 0 setdash stroke grestore fill"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+#
+# draw a filled circle whose centre is at (xmark, ymark) and whose radius is xmark units;
+#
+# for curveto to work, we need to calculate the control points of the Bezier curve
+# as well as move the pen to the correct initial point. The circle is drawn as two
+# arcs of 180 degrees
+#
+# pt0 = (xmark + xmark, ymark)
+# pt1 = (xmark + xmark, ymark + 4/3 * xmark)
+# pt2 = (0, ymark + 4/3 * xmark)
+# pt3 = (0, ymark)
+#
+# pt0 = (0, ymark)
+# pt1 = (0, ymark - 4/3 * xmark)
+# pt2 = (xmark + xmark, ymark - 4/3 * xmark)
+# pt3 = (xmark + xmark, ymark)
+#
+# Note: this is not a strict translation because there is a setdash bracketed by
+# gsave/grestore in the above PostScript but there is no closepath before it;
+# but in PDF, it is not possible to execute a setdash within a path definition.
+#
+ {"n [] 0 d"
+ "__mul(2, __xmark) __ymark m"
+ "__mul(2, __xmark) __add(__ymark, __div(__mul(4, __xmark), 3))" # pt1
+ "0 __add(__ymark, __div(__mul(4, __xmark), 3))" # pt2
+ "0 __ymark c" # pt3
+
+ "0 __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt1
+ "__mul(2, __xmark) __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt2
+ "__mul(2, __xmark) __ymark c b" # pt3
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphTriangle
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto"
+ "closepath [] 0 setdash stroke"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+ {"n [] 0 d 0 0 m __xsize 0 l __xmark __mul(__ysize, 1.25) l s"}
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphFilledTriangle
+ named symbolsize
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.15 ft }
+{
+ @BackEnd @Case {
+
+ PostScript @Yield {
+ @HContract @VContract
+ { "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto"
+ "closepath gsave [] 0 setdash stroke grestore fill"
+ }
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ PDF @Yield {
+ @HContract @VContract
+ {"n [] 0 d 0 0 m __xsize 0 l __xmark __mul(__ysize, 1.25) l h b"}
+ @Graphic
+ {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High}
+ }
+
+ }
+}
+
+def @GraphNoLine
+ named dashlength { 0.2 ft }
+ named linewidth { "currentlinewidth" }
+ named length
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 1.0 ft }
+{
+ length @Wide {}
+}
+
+def @GraphSolid
+ named dashlength { 0.2 ft }
+ named linewidth { "currentlinewidth" }
+ named length
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 1.0 ft }
+{
+ @BackEnd @Case {
+ PostScript @Yield {
+ @HContract @VContract
+ { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto"
+ "/linewidth" linewidth "def xsize" dashlength "solid end"
+ } @Graphic { length @Wide }
+ }
+# VT: PDF does nothing
+ PDF @Yield {
+ @HContract @VContract
+ { "% @GraphSolid UNIMPLEMENTED" } @Graphic { length @Wide }
+ }
+ }
+}
+
+def @GraphDashed
+ named dashlength { 0.2 ft }
+ named linewidth { "currentlinewidth" }
+ named length
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 1.0 ft }
+{
+ @BackEnd @Case {
+ PostScript @Yield {
+ @HContract @VContract
+ { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto"
+ "/linewidth" linewidth "def xsize" dashlength "dashed end"
+ } @Graphic { length @Wide }
+ }
+# VT: PDF does nothing
+ PDF @Yield {
+ @HContract @VContract
+ { "% @GraphDashed UNIMPLEMENTED" } @Graphic { length @Wide }
+ }
+ }
+}
+
+def @GraphDotted
+ named dashlength { 0.2 ft }
+ named linewidth { "currentlinewidth" }
+ named length
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 1.0 ft }
+{
+ @BackEnd @Case {
+ PostScript @Yield {
+ @HContract @VContract
+ { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto"
+ "/linewidth" linewidth "def xsize" dashlength "dotted end"
+ } @Graphic { length @Wide }
+ }
+# VT: PDF does nothing
+ PDF @Yield {
+ @HContract @VContract
+ { "% @GraphDotted UNIMPLEMENTED" } @Graphic { length @Wide }
+ }
+ }
+}
+
+
+export @Data
+def @Graph
+ named save { no }
+ named style { frame }
+ named width
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 6.0 cm }
+ named height
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 4.0 cm }
+ named xextra { "none" }
+ named yextra { "none" }
+ named xdecreasing { no }
+ named ydecreasing { no }
+ named leftcaption { }
+ named rightcaption { }
+ named abovecaption { }
+ named belowcaption { }
+ named leftgap
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 1.5 cm }
+ named rightgap
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.5 cm }
+ named abovegap
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.5 cm }
+ named belowgap
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.5 cm }
+ named hidecaptions { yes }
+ named objects
+ named @NW
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "xsize neg ysize" } margin { margin } x }
+ named @SW
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "xsize neg 0" } margin { margin } x }
+ named @SE
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "0 0" } margin { margin } x }
+ named @NE
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "0 ysize" } margin { margin } x }
+ named @W
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "xsize neg ysize 2 div" } margin { margin } x }
+ named @S
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "xsize neg 2 div 0" } margin { margin } x }
+ named @E
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "0 ysize 2 div" } margin { margin } x }
+ named @N
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "xsize neg 2 div ysize" } margin { margin } x }
+ named @CTR
+ import @GraphMath named at { 0 0 }
+ named margin
+ named cm left x { x"c" }
+ named in left x { x"i" }
+ named em left x { x"m" }
+ named pt left x { x"p" }
+ named ft left x { x"f" }
+ named sp left x { x"s" }
+ named vs left x { x"v" }
+ { 0.3 ft }
+ right x
+ { at @GraphObj adj { "xsize neg 2 div ysize 2 div" } margin {margin} x }
+ {}
+ named xorigin named none { "false" } { none }
+ named yorigin named none { "false" } { none }
+ named xlog named none { "0" } { none }
+ named ylog named none { "0" } { none }
+ named points named none { "none" } { none }
+ named pairs named none { "none" } { none }
+ named colour named none { "none" } { none }
+ named color named none { "none" } { none }
+ named paint named none { "none" } { none }
+ named xmin named none { "false" } { none }
+ named xmax named none { "false" } { none }
+ named ymin named none { "false" } { none }
+ named ymax named none { "false" } { none }
+ named xticksep named none { "0" } { none }
+ named yticksep named none { "0" } { none }
+ named rticksep named none { "0" } { none }
+ import @GraphMath named xticks
+ named none { "false" }
+ named auto { "false" }
+ named "@" { " lgen" }
+ named "^" { "^" }
+ { false }
+ import @GraphMath named yticks
+ named none { "false" }
+ named auto { "false" }
+ named "@" { " lgen" }
+ named "^" { "^" }
+ { false }
+ import @GraphMath named rticks
+ named none { "false" }
+ named auto { "false" }
+ named "@" { " lgen" }
+ named "^" { "^" }
+ { }
+ named xticklength { 0.5 ft }
+ named yticklength { 0.5 ft }
+ named rticklength { 0.5 ft }
+ named dataformat { xandy }
+ named dashlength { 0.2 ft }
+ named linewidth { "currentlinewidth" }
+ named symbolsize { 0.15 ft }
+ body @Body
+@Begin
+
+ def @Above
+ {
+ abovecaption @Case {
+ "" @Yield {}
+ else @Yield @OneCol { ||0.5rt clines @Break abovecaption || //abovegap }
+ }
+ }
+
+ def @Below
+ {
+ belowcaption @Case {
+ "" @Yield {}
+ else @Yield @OneCol { //belowgap ||0.5rt clines @Break belowcaption || }
+ }
+ }
+
+ def @Left
+ {
+ leftcaption @Case {
+ "" @Yield {}
+ else @Yield @OneCol @OneRow {
+ { //0.5rt @OneRow clines @Break leftcaption // } ^||leftgap }
+ }
+ }
+
+ def @Right
+ {
+ rightcaption @Case {
+ "" @Yield {}
+ else @Yield @OneCol @OneRow {
+ ||rightgap { //0.5rt @OneRow lines @Break rightcaption // } }
+ }
+ }
+
+ def @ZeroWidth
+ right x
+ {
+ hidecaptions @Case {
+ { No no } @Yield x
+ { Yes yes } @Yield @OneCol { ||0io x ||0io }
+ }
+ }
+
+ def @AddCaptions right x
+ {
+ def belowextra
+ {
+ xticks @Case {
+ "" @Yield { 0i }
+ else @Yield { 1.7f }
+ }
+ }
+
+ @HContract @VContract
+ {
+ | @Above |
+ / @ZeroWidth @Left | &0.5rt x | @ZeroWidth @Right
+ /belowextra | @Below |
+ }
+ }
+
+ export pi e sqrt abs ceiling floor truncate round cos sin atan exp log rand
+ "*" "/" idiv mod "-" "-0" "-1" "-2" "-3" "-4" "-5" "-6" "-7" "-8"
+ "-9" "-." "+" "=" "!=" "<" "<=" ">" ">=" not and xor or
+ if xloop yloop zloop
+
+ def @Data
+ named points named none { "none" } { points }
+ named pairs named none { "none" } { pairs }
+ named colour named none { "none" } { colour }
+ named color named none { "none" } { color }
+ named paint named none { "none" } { paint }
+ named dashlength { dashlength }
+ named linewidth { linewidth }
+ named symbolsize { symbolsize }
+ named dataformat { dataformat }
+ body data
+ {
+ def pi { "3.14159" }
+ def e { "2.71828" }
+ def sqrt precedence 40 right y { y "sqrt" }
+ def abs precedence 40 right y { y "abs" }
+ def ceiling precedence 40 right y { y "ceiling" }
+ def floor precedence 40 right y { y "floor" }
+ def truncate precedence 40 right y { y "truncate" }
+ def round precedence 40 right y { y "round" }
+ def cos precedence 40 right y { y "cos" }
+ def sin precedence 40 right y { y "sin" }
+ def atan precedence 39 left x right y { x y "atan" }
+ def exp precedence 38 left x right y { x y "exp" }
+ def log precedence 37 left x right y { x y "dolog" }
+ def rand precedence 36 left x right y { x y "dorand" }
+ def "*" precedence 35 left x right y { x y "mul" }
+ def "/" precedence 34 left x right y { x y "div" }
+ def idiv precedence 34 left x right y { x y "idiv" }
+ def mod precedence 34 left x right y { x y "mod" }
+ def "-" precedence 33 left x right y
+ { x @Case { "" @Yield {y "neg"} else @Yield { x y "sub" } } }
+ def "-0" { "-0" }
+ def "-1" { "-1" }
+ def "-2" { "-2" }
+ def "-3" { "-3" }
+ def "-4" { "-4" }
+ def "-5" { "-5" }
+ def "-6" { "-6" }
+ def "-7" { "-7" }
+ def "-8" { "-8" }
+ def "-9" { "-9" }
+ def "-." { "-." }
+ def "+" precedence 32 left x right y
+ { x @Case { "" @Yield { y } else @Yield { x y "add" } } }
+ def "=" precedence 30 left x right y { x y "eq" }
+ def "!=" precedence 30 left x right y { x y "ne" }
+ def "<" precedence 30 left x right y { x y "lt" }
+ def "<=" precedence 30 left x right y { x y "le" }
+ def ">" precedence 30 left x right y { x y "gt" }
+ def ">=" precedence 30 left x right y { x y "ge" }
+ def not precedence 25 right y { y "not" }
+ def and precedence 24 left x right y { x y "and" }
+ def xor precedence 23 left x right y { x y "xor" }
+ def or precedence 22 left x right y { x y "or" }
+ def if
+ named cond { true }
+ named then {}
+ named else {}
+ { cond "{" then "} {" else "} ifelse" }
+ def xloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named x { "xval" } {}
+ { from by to "{ /xval exch def" do "} for" }
+ def yloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named y { "yval" } {}
+ { from by to "{ /yval exch def" do "} for" }
+ def zloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named z { "zval" } {}
+ { from by to "{ /zval exch def" do "} for" }
+
+ def @IfPt
+ left no
+ right yes
+ {
+ points @Case {
+ none @Yield no
+ else @Yield yes
+ }
+ }
+
+ def @Points
+ {
+ points @Case {
+ none @Yield ""
+ plus @Yield "plus"
+ cross @Yield "cross"
+ square @Yield "square"
+ filledsquare @Yield "filledsquare"
+ diamond @Yield "diamond"
+ filleddiamond @Yield "filleddiamond"
+ circle @Yield "circle"
+ filledcircle @Yield "filledcircle"
+ triangle @Yield "triangle"
+ filledtriangle @Yield "filledtriangle"
+ }
+ }
+
+ def @Pairs
+ {
+ pairs @Case {
+ none @Yield {}
+ solid @Yield { "linesetup solid" @IfPt "ilinesetup solid" }
+ dashed @Yield { "linesetup cdashed" @IfPt "ilinesetup dashed" }
+ dotted @Yield { "linesetup dotted" @IfPt "ilinesetup dotted" }
+ surfacexhisto @Yield { "surfacexhisto" }
+ surfaceyhisto @Yield { "surfaceyhisto" }
+ xhisto @Yield { "xhisto" }
+ yhisto @Yield { "yhisto" }
+ filledxhisto @Yield { "filledxhisto" }
+ filledyhisto @Yield { "filledyhisto" }
+ }
+ }
+
+ def @DataFormat
+ {
+ dataformat @Case {
+ xandy @Yield xandy
+ yonly @Yield yonly
+ xonly @Yield xonly
+ }
+ }
+
+ def @Col
+ {
+ { colour @Case { "none" @Yield color else @Yield colour } } @Case {
+ none @Yield { }
+ nochange @Yield { }
+ darkblue @Yield { 0.0 0.0 0.5 setrgbcolor }
+ blue @Yield { 0.0 0.0 1.0 setrgbcolor }
+ lightblue @Yield { 0.5 0.5 1.0 setrgbcolor }
+ darkgreen @Yield { 0.0 0.5 0.0 setrgbcolor }
+ green @Yield { 0.0 1.0 0.0 setrgbcolor }
+ lightgreen @Yield { 0.5 1.0 0.5 setrgbcolor }
+ darkred @Yield { 0.5 0.0 0.0 setrgbcolor }
+ red @Yield { 1.0 0.0 0.0 setrgbcolor }
+ lightred @Yield { 1.0 0.5 0.5 setrgbcolor }
+ darkcyan @Yield { 0.0 0.5 0.5 setrgbcolor }
+ cyan @Yield { 0.0 1.0 1.0 setrgbcolor }
+ lightcyan @Yield { 0.5 1.0 1.0 setrgbcolor }
+ darkmagenta @Yield { 0.5 0.0 0.5 setrgbcolor }
+ magenta @Yield { 1.0 0.0 1.0 setrgbcolor }
+ lightmagenta @Yield { 1.0 0.5 1.0 setrgbcolor }
+ darkyellow @Yield { 0.5 0.5 0.0 setrgbcolor }
+ yellow @Yield { 1.0 1.0 0.0 setrgbcolor }
+ lightyellow @Yield { 1.0 1.0 0.5 setrgbcolor }
+ darkgray @Yield { 0.2 0.2 0.2 setrgbcolor }
+ gray @Yield { 0.5 0.5 0.5 setrgbcolor }
+ lightgray @Yield { 0.7 0.7 0.7 setrgbcolor }
+ darkgrey @Yield { 0.2 0.2 0.2 setrgbcolor }
+ grey @Yield { 0.5 0.5 0.5 setrgbcolor }
+ lightgrey @Yield { 0.7 0.7 0.7 setrgbcolor }
+ black @Yield { 0.0 0.0 0.0 setrgbcolor }
+ white @Yield { 1.0 1.0 1.0 setrgbcolor }
+ }
+ }
+
+ def @Paint
+ {
+ paint @Case {
+ { none no No } @Yield "false"
+ { yes Yes } @Yield "true"
+ }
+ }
+
+ "[ [" data "]" dataformat
+ "{" @Points "}"
+ "{" @Pairs "}"
+ "{ /dashlength" dashlength "def"
+ " /linewidth" linewidth "def" @Col
+ " /symbolsize" symbolsize "def }"
+ "{" @Paint "}"
+ "]"
+ }
+
+ def @Style
+ {
+ style @Case {
+ frame @Yield { "framestyle" }
+ none @Yield { "nonestyle" }
+ axes @Yield { "axesstyle" }
+ }
+ }
+
+ def @XExtra
+ {
+ xextra @Case {
+ "none" @Yield {
+ style @Case {
+ frame @Yield { "0.5 cm" }
+ none @Yield { "0" }
+ axes @Yield { "0" }
+ }
+ }
+ else @Yield xextra
+ }
+ }
+
+ def @YExtra
+ {
+ yextra @Case {
+ "none" @Yield {
+ style @Case {
+ frame @Yield { "0.5 cm" }
+ none @Yield { "0" }
+ axes @Yield { "0" }
+ }
+ }
+ else @Yield yextra
+ }
+ }
+
+ def @XDecreasing
+ {
+ xdecreasing @Case {
+ { No no } @Yield "false"
+ { Yes yes } @Yield "true"
+ }
+ }
+
+ def @YDecreasing
+ {
+ ydecreasing @Case {
+ { No no } @Yield "false"
+ { Yes yes } @Yield "true"
+ }
+ }
+
+ @AddCaptions width @Wide height @High
+ @BackEnd @Case {
+ PostScript @Yield {
+ {
+ "grestore"
+ save @Case { { Yes yes } @Yield "save" else @Yield {} }
+ "gsave xsize ysize lgraphdict begin /ysize exch def /xsize exch def"
+ "/alldata [" @Body "] def"
+ xticksep "[" xticks "] 0 alldata" xmin xmax xlog
+ @XExtra @XDecreasing xorigin xticklength "xset"
+ yticksep "[" yticks "] 1 alldata" ymin ymax ylog
+ @YExtra @YDecreasing yorigin yticklength "yset"
+
+ rticks @Case {
+
+ "" @Yield "norset"
+
+ else @Yield {
+ rticksep "[" rticks "] 1 alldata" ymin ymax ylog
+ @YExtra @YDecreasing yorigin rticklength "rset"
+ }
+ }
+
+ "rundata" @Style // "end"
+ save @Case { { Yes yes } @Yield "restore" else @Yield {} }
+ } @Graphic { //1rt objects }
+ }
+ PDF @Yield { {"% @Graph UNIMPLEMENTED"} @Graphic { //1rt objects } }
+ }
+
+@End @Graph
diff --git a/include/graphf.etc b/include/graphf.etc
new file mode 100644
index 0000000..3e3a6cb
--- /dev/null
+++ b/include/graphf.etc
@@ -0,0 +1,295 @@
+
+###############################################################################
+# #
+# Lout @GraphMath package for @Graph (Version 1.1) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, December 1993. #
+# Version 1.1 by Jeffrey H. Kingston, October 1996. #
+# #
+# This package provides mathematics for the @Graph graph drawing package. #
+# #
+###############################################################################
+
+export
+
+ "-0" "-1" "-2" "-3" "-4" "-5" "-6" "-7" "-8" "-9" "-."
+ pi e sqrt abs ceiling floor truncate round cos sin atan
+ exp log rand "*" "/" idiv mod "+" "-"
+ "=" "!=" "<" "<=" ">" ">=" not and xor or
+ if xloop yloop zloop
+
+def @GraphMath
+{
+ def "-0" { "-0" }
+ def "-1" { "-1" }
+ def "-2" { "-2" }
+ def "-3" { "-3" }
+ def "-4" { "-4" }
+ def "-5" { "-5" }
+ def "-6" { "-6" }
+ def "-7" { "-7" }
+ def "-8" { "-8" }
+ def "-9" { "-9" }
+ def "-." { "-." }
+
+ def pi { "3.14159" }
+
+ def e { "2.71828" }
+
+ def sqrt
+ precedence 40
+ right y
+ {
+ y "sqrt"
+ }
+
+ def abs
+ precedence 40
+ right y
+ {
+ y "abs"
+ }
+
+ def ceiling
+ precedence 40
+ right y
+ {
+ y "ceiling"
+ }
+
+ def floor
+ precedence 40
+ right y
+ {
+ y "floor"
+ }
+
+ def truncate
+ precedence 40
+ right y
+ {
+ y "truncate"
+ }
+
+ def round
+ precedence 40
+ right y
+ {
+ y "round"
+ }
+
+ def cos
+ precedence 40
+ right y
+ {
+ y "cos"
+ }
+
+ def sin
+ precedence 40
+ right y
+ {
+ y "sin"
+ }
+
+ def atan
+ precedence 39
+ left x
+ right y
+ {
+ x y "atan"
+ }
+
+ def exp
+ precedence 38
+ left x
+ right y
+ {
+ x y "exp"
+ }
+
+ def log
+ precedence 37
+ left x
+ right y
+ {
+ x y "dolog"
+ }
+
+ def rand
+ precedence 36
+ left x
+ right y
+ {
+ x y "dorand"
+ }
+
+ def "*"
+ precedence 35
+ left x
+ right y
+ {
+ x y "mul"
+ }
+
+ def "/"
+ precedence 35
+ left x
+ right y
+ {
+ x y "div"
+ }
+
+ def "idiv"
+ precedence 34
+ left x
+ right y
+ {
+ x y "idiv"
+ }
+
+ def "mod"
+ precedence 34
+ left x
+ right y
+ {
+ x y "mod"
+ }
+
+ def "-"
+ precedence 33
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield { y "neg" }
+ else @Yield { x y "sub" }
+ }
+ }
+
+ def "+"
+ precedence 32
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield { y }
+ else @Yield { x y "add" }
+ }
+ }
+
+ def "="
+ precedence 30
+ left x
+ right y
+ {
+ x y "eq"
+ }
+
+ def "!="
+ precedence 30
+ left x
+ right y
+ {
+ x y "ne"
+ }
+
+ def "<"
+ precedence 30
+ left x
+ right y
+ {
+ x y "lt"
+ }
+
+ def "<="
+ precedence 30
+ left x
+ right y
+ {
+ x y "le"
+ }
+
+ def ">"
+ precedence 30
+ left x
+ right y
+ {
+ x y "gt"
+ }
+
+ def ">="
+ precedence 30
+ left x
+ right y
+ {
+ x y "ge"
+ }
+
+ def "not"
+ precedence 25
+ right y
+ {
+ y "not"
+ }
+
+ def "and"
+ precedence 24
+ left x
+ right y
+ {
+ x y "and"
+ }
+
+ def "xor"
+ precedence 23
+ left x
+ right y
+ {
+ x y "xor"
+ }
+
+ def "or"
+ precedence 22
+ left x
+ right y
+ {
+ x y "or"
+ }
+
+ def if
+ named cond { true }
+ named then {}
+ named else {}
+ {
+ cond "{" then "} {" else "} ifelse"
+ }
+
+ def xloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named x { "xval" } {}
+ {
+ from by to "{ /xval exch def" do "} for"
+ }
+
+ def yloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named y { "yval" } {}
+ {
+ from by to "{ /yval exch def" do "} for"
+ }
+
+ def zloop
+ named from { 0 }
+ named to { 0 }
+ named by { 1 }
+ named do named z { "zval" } {}
+ {
+ from by to "{ /zval exch def" do "} for"
+ }
+
+}
diff --git a/include/graphf.lpg b/include/graphf.lpg
new file mode 100644
index 0000000..60447f0
--- /dev/null
+++ b/include/graphf.lpg
@@ -0,0 +1,768 @@
+%%BeginResource: procset LoutGraphPrependGraphic
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% PostScript @SysPrependGraphic file for @Graph (Version 1.0) %
+% %
+% Version 1.0 by Jeffrey H. Kingston, December 1993. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+errordict begin
+ /handleerror
+ {
+ { /Times-Roman findfont 8 pt scalefont setfont
+ 0 setgray 4 pt 4 pt moveto
+ $error /errorname get
+ dup lgraphdict exch known
+ { lgraphdict exch get }
+ { 30 string cvs } ifelse
+ show
+ ( Command: ) show
+ $error /command get 30 string cvs show
+ } stopped {} if
+ showpage stop
+ } def
+end
+
+/lgraphdict 200 dict def
+lgraphdict begin
+
+% error messages
+/dictfull (dictfull error) def
+/dictstackoverflow (dictstackoverflow error) def
+/execstackoverflow (execstackoverflow error: expression too complex?) def
+/limitcheck (limitcheck error: graph too complex or too large?) def
+/syntaxerror (syntaxerror error: syntax error in text of graph?) def
+/typecheck (typecheck error: syntax error in text of graph?) def
+/undefined (undefined error: unknown or misspelt symbol?) def
+/rangecheck (rangecheck error: undefined expression (e.g. divide by zero)?) def
+/VMError (VMError error: run out of memory?) def
+
+% random number between x and y inclusive: x y dorand num
+/dorand { 1 index sub 1 add rand exch mod add } def
+
+% log to given base: base num dolog num
+/dolog { ln exch ln div } def
+
+% maximum of two numbers: <num> <num> max <num>
+/max { 2 copy gt { pop } { exch pop } ifelse } def
+
+% add two points: <point> <point> padd <point>
+/padd { exch 3 1 roll add 3 1 roll add exch } def
+
+% subtract first point from second: <point> <point> psub <point>
+/psub { 3 2 roll sub 3 1 roll exch sub exch } def
+
+% distance between two points: <point> <point> distance <length>
+/distance { psub dup mul exch dup mul add sqrt } def
+
+% point at angle and distance: <point> <length> <angle> atangle <point>
+/atangle { 2 copy cos mul 3 1 roll sin mul padd } def
+
+% angle from one point to another: <point> <point> angle <angle>
+/angle { psub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def
+
+
+% set up for line
+% - linesetup <length> <dashlength>
+/linesetup
+{ newpath
+ xcurr ycurr trpoint xprev yprev trpoint
+ 4 copy moveto lineto distance dashlength
+} def
+
+% set up for icon-avoiding line
+% - ilinesetup <length> <dashlength>
+/ilinesetup
+{ newpath
+ xprev yprev trpoint xcurr ycurr trpoint 4 copy
+ 4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle
+ 6 2 roll 4 2 roll
+ 4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle
+ 4 copy moveto lineto distance dashlength
+} def
+
+
+% stroke a solid line: <length> <dashlength> solid -
+/solid
+{ pop pop [] 0 setdash linewidth setlinewidth stroke
+} def
+
+% stroke a dashed line: <length> <dashlength> dashed -
+/dashed
+{ 2 copy 2 mul le 1 index 0 le or
+ { exch pop 1 pt max [ exch dup ] 0 setdash }
+ { dup [ exch 4 2 roll 2 copy div
+ 1 sub 2 div ceiling dup 4 1 roll
+ 1 add mul sub exch div ] 0 setdash
+ } ifelse linewidth setlinewidth stroke
+} def
+
+% stroke a cdashed line: <length> <dashlength> cdashed -
+/cdashed
+{ 2 copy le 1 index 0 le or
+ { exch pop 1 pt max [ exch dup ] dup 0 get 2 div setdash }
+ { dup [ 4 2 roll exch 2 copy exch div
+ 2 div ceiling div 1 index sub
+ ] exch 2 div setdash
+ } ifelse linewidth setlinewidth stroke
+} def
+
+% stroke a dotted line: <length> <dashlength> dotted -
+/dotted
+{ 2 copy le 1 index 0 le or
+ { exch pop 1 pt max [ exch 0 exch ] 0 setdash }
+ { 1 index exch div ceiling div 0.99999 mul
+ [ 0 3 2 roll ] 0 setdash
+ } ifelse gsave 1 setlinecap linewidth setlinewidth stroke grestore newpath
+} def
+
+% stroke a noline line: <length> <dashlength> noline -
+/noline
+{ pop pop
+} def
+
+% stroke a y histogram: - yhisto -
+/yhisto
+{ xprev yleft trpoint yextra sub moveto
+ xprev yprev trpoint lineto
+ xcurr yprev trpoint lineto
+ xcurr yleft trpoint yextra sub lineto
+ linewidth setlinewidth stroke
+} def
+
+% stroke an x histogram: - xhisto -
+/xhisto
+{ xleft yprev trpoint exch xextra sub exch moveto
+ xcurr yprev trpoint lineto
+ xcurr ycurr trpoint lineto
+ xleft ycurr trpoint exch xextra sub exch lineto
+ linewidth setlinewidth stroke
+} def
+
+% stroke a surface y histogram: - surfaceyhisto -
+/surfaceyhisto
+{ firstpair
+ { xprev yleft trpoint yextra sub moveto
+ xprev yprev trpoint lineto
+ }
+ { xprev yprev trpoint moveto
+ } ifelse
+ xcurr yprev trpoint lineto
+ lastpair
+ { xcurr yleft trpoint yextra sub lineto
+ }
+ { xcurr ycurr trpoint lineto
+ } ifelse
+ linewidth setlinewidth stroke
+} def
+
+% stroke a surface x histogram: - surfacexhisto -
+/surfacexhisto
+{ firstpair
+ { xleft yprev trpoint exch xextra sub exch moveto
+ }
+ { xprev yprev trpoint moveto
+ } ifelse
+ xcurr yprev trpoint lineto
+ xcurr ycurr trpoint lineto
+ lastpair
+ { xleft ycurr trpoint exch xextra sub exch lineto
+ } if
+ linewidth setlinewidth stroke
+} def
+
+% stroke a filled y histogram: - filledyhisto -
+/filledyhisto
+{
+ linewidth setlinewidth
+ xprev yleft trpoint exch currentlinewidth 2 div add exch yextra sub moveto
+ xprev yprev trpoint exch currentlinewidth 2 div add exch lineto
+ xcurr yprev trpoint exch currentlinewidth 2 div sub exch lineto
+ xcurr yleft trpoint exch currentlinewidth 2 div sub exch yextra sub lineto
+ closepath fill
+} def
+
+% stroke a filled x histogram: - filledxhisto -
+/filledxhisto
+{
+ linewidth setlinewidth
+ xleft yprev trpoint currentlinewidth 2 div add exch xextra sub exch moveto
+ xcurr yprev trpoint currentlinewidth 2 div add lineto
+ xcurr ycurr trpoint currentlinewidth 2 div sub lineto
+ xleft ycurr trpoint currentlinewidth 2 div sub exch xextra sub exch lineto
+ closepath fill
+} def
+
+
+% cross: show a small cross
+/cross
+{ newpath
+ xcurr ycurr trpoint moveto
+ symbolsize neg symbolsize neg rmoveto
+ symbolsize 2 mul symbolsize 2 mul rlineto
+ 0 symbolsize -2 mul rmoveto
+ symbolsize -2 mul symbolsize 2 mul rlineto
+ [] 0 setdash stroke
+} def
+
+% plus: show a small plus
+/plus
+{ newpath
+ xcurr ycurr trpoint moveto
+ symbolsize neg 0 rmoveto
+ symbolsize 2 mul 0 rlineto
+ symbolsize neg symbolsize neg rmoveto
+ 0 symbolsize 2 mul rlineto
+ [] 0 setdash stroke
+} def
+
+% square: show a small square
+/square
+{ newpath
+ xcurr ycurr trpoint moveto
+ symbolsize neg symbolsize neg rmoveto
+ symbolsize 2 mul 0 rlineto
+ 0 symbolsize 2 mul rlineto
+ symbolsize -2 mul 0 rlineto
+ closepath [] 0 setdash stroke
+} def
+
+% filledsquare: show a small filled square
+/filledsquare
+{ newpath
+ xcurr ycurr trpoint moveto
+ symbolsize neg symbolsize neg rmoveto
+ symbolsize 2 mul 0 rlineto
+ 0 symbolsize 2 mul rlineto
+ symbolsize -2 mul 0 rlineto
+ closepath gsave [] 0 setdash stroke grestore fill
+} def
+
+% diamond: show a small diamond
+/diamond
+{ newpath
+ xcurr ycurr trpoint moveto
+ symbolsize neg 0 rmoveto
+ symbolsize symbolsize neg rlineto
+ symbolsize symbolsize rlineto
+ symbolsize neg symbolsize rlineto
+ closepath [] 0 setdash stroke
+} def
+
+% filleddiamond: show a small filled diamond
+/filleddiamond
+{ newpath
+ xcurr ycurr trpoint moveto
+ symbolsize neg 0 rmoveto
+ symbolsize symbolsize neg rlineto
+ symbolsize symbolsize rlineto
+ symbolsize neg symbolsize rlineto
+ closepath gsave [] 0 setdash stroke grestore fill
+} def
+
+% circle: show a small circle
+/circle
+{ newpath
+ xcurr ycurr trpoint symbolsize 0 360 arc [] 0 setdash stroke
+} def
+
+% filledcircle: show a small filled circle
+/filledcircle
+{ newpath
+ xcurr ycurr trpoint symbolsize 0 360 arc gsave [] 0 setdash stroke grestore fill
+} def
+
+% triangle: show a small triangle
+/triangle
+{ newpath
+ xcurr ycurr trpoint moveto
+ 0 symbolsize 1.5 mul rmoveto
+ symbolsize neg symbolsize -2.5 mul rlineto
+ symbolsize 2 mul 0 rlineto
+ closepath [] 0 setdash stroke
+} def
+
+% filledtriangle: show a small filled triangle
+/filledtriangle
+{ newpath
+ xcurr ycurr trpoint moveto
+ 0 symbolsize 1.5 mul rmoveto
+ symbolsize neg symbolsize -2.5 mul rlineto
+ symbolsize 2 mul 0 rlineto
+ closepath gsave [] 0 setdash stroke grestore fill
+} def
+
+
+%plog: like log only with a base, and protected from failing if <= 0
+% base x plog res
+/plog { dup 0 le { pop pop 0 } { ln exch ln div } ifelse } def
+
+% xtr: transform one x value logarithmically if xlog > 1
+% <num> xtr <num>
+/xtr
+{ xlog 1 gt
+ { xlog exch plog
+ } if
+} def
+
+% ytr: transform one y value logarithmically if ylog > 1
+% <num> ytr <num>
+/ytr
+{ ylog 1 gt
+ { ylog exch plog
+ } if
+} def
+
+% % trpoint: transform (x, y) in graph space into (x', y') in print space
+% % x y trpoint x' y'
+% /trpoint
+% { exch xtr trxmin sub trxmax trxmin sub div xwidth mul xextra add
+% exch ytr trymin sub trymax trymin sub div ywidth mul yextra add
+% } def
+
+
+% trpoint: transform (x, y) in graph space into (x', y') in print space
+% x y trpoint x' y'
+/trpoint
+{ exch xtr xdecr { trxmax exch sub } { trxmin sub } ifelse
+ trxmax trxmin sub div xwidth mul xextra add
+
+ exch ytr ydecr { trymax exch sub } { trymin sub } ifelse
+ trymax trymin sub div ywidth mul yextra add
+} def
+
+
+% yonly: interpolate x values 1, 2, ... into data
+% [ data ] yonly [ newdata ]
+/yonly
+{ dup /tmp exch def
+ length [ exch 1 exch 1 exch
+ { dup tmp exch 1 sub get
+ } for
+ ]
+} def
+
+% xonly: interpolate y values 1, 2, ... into data
+% [ data ] yonly [ newdata ]
+/xonly
+{ dup /tmp exch def
+ length [ exch 1 exch 1 exch
+ { dup tmp exch 1 sub get exch
+ } for
+ ]
+} def
+
+% xandy: no interpolation of x or y values
+% [ data ] xandy [ data ]
+/xandy {} def
+
+
+% expstringwidth: calculate width of string containing optional exponent
+% <string> expstringwidth <width>
+/expstringwidth
+{ (^) search
+ { exch pop stringwidth pop exch stringwidth pop 0.7 mul add }
+ { stringwidth pop }
+ ifelse
+} def
+
+% expstringshow: show string containing optional exponent
+% <string> expstringshow -
+/expstringshow
+{ (^) search
+ { exch pop show 0 0.5 ft rmoveto
+ gsave currentfont 0.7 scalefont setfont show grestore
+ }
+ { show
+ }
+ ifelse
+} def
+
+% concatenate two strings: <string> <string> strconcat <string>
+/strconcat
+{ 2 copy length exch length add string
+ dup 0 4 index putinterval
+ dup 3 index length 3 index putinterval
+ 3 1 roll pop pop
+} def
+
+% lgen: generate one label automatically
+% num lgen num string
+/lgen { dup 20 string cvs } def
+
+% loglgen: generate one logarithmic label (with exponent)
+% <base> <exponent> loglgen <string>
+/loglgen
+{ 20 string cvs exch 20 string cvs
+ (^) strconcat exch strconcat
+} def
+
+
+% printxtick: print one x tick
+% xpos printxtick -
+/printxtick
+{ newpath
+ yleft trpoint moveto 0 yextra neg rmoveto
+ 0 xticklength neg rlineto [] 0 setdash stroke
+} def
+
+% printxlabel: print one x label
+% (xlabel) xpos printxlabel -
+/printxlabel
+{ yleft trpoint moveto 0 yextra neg rmoveto
+ 0 xticklength neg rmoveto 0 0.9 ft neg rmoveto
+ xlog 1 gt { 0 0.3 ft neg rmoveto } if
+ dup expstringwidth -2 div 0 rmoveto expstringshow
+} def
+
+% printytick: print one y tick
+% ypos printytick -
+/printytick
+{ newpath
+ xleft exch trpoint moveto xextra neg 0 rmoveto
+ yticklength neg 0 rlineto [] 0 setdash stroke
+} def
+
+% printylabel: print one y label
+% (ylabel) ypos printylabel -
+/printylabel
+{ xleft exch trpoint moveto xextra neg 0 rmoveto
+ yticklength neg 0 rmoveto -0.3 ft -0.3 ft rmoveto
+ dup expstringwidth neg 0 rmoveto expstringshow
+} def
+
+% printrtick: print one r tick
+% ypos printrtick -
+/printrtick
+{ newpath
+ xright exch trpoint moveto xextra 0 rmoveto
+ rticklength 0 rlineto [] 0 setdash stroke
+} def
+
+% printrlabel: print one r label
+% (rlabel) ypos printrlabel -
+/printrlabel
+{ xright exch trpoint moveto xextra 0 rmoveto
+ rticklength 0 rmoveto 0.3 ft -0.3 ft rmoveto
+ expstringshow
+} def
+
+% printticks: print ticks and labels
+% /tickproc /labelproc [ tickandlabeldata ] min printticks -
+/printticks
+{ /prev exch def
+ { dup type dup dup /integertype eq exch /realtype eq or
+ { pop dup /prev exch def 2 index cvx exec
+ }
+ { /stringtype eq
+ { prev 2 index cvx exec
+ }
+ { pop
+ } ifelse
+ } ifelse
+ } forall
+ pop pop
+} def
+
+
+% printxaxistick: print one x axis tick
+% xpos printxaxistick -
+/printxaxistick
+{ newpath
+ yaxis trpoint moveto 0 xticklength -2 div rmoveto
+ 0 xticklength rlineto [] 0 setdash stroke
+} def
+
+% printxaxislabel: print one x axis label
+% (xlabel) xpos printxaxislabel -
+/printxaxislabel
+{ yaxis trpoint moveto
+ 0 xticklength -2 div rmoveto 0 0.9 ft neg rmoveto
+ xlog 1 gt { 0 0.3 ft neg rmoveto } if
+ dup expstringwidth -2 div 0 rmoveto expstringshow
+} def
+
+% printyaxistick: print one y axis tick
+% ypos printyaxistick -
+/printyaxistick
+{ newpath
+ xaxis exch trpoint moveto
+ yticklength -2 div 0 rmoveto
+ yticklength 0 rlineto [] 0 setdash stroke
+} def
+
+% printyaxislabel: print one y axis label
+% (ylabel) ypos printyaxislabel -
+/printyaxislabel
+{ xaxis exch trpoint moveto
+ yticklength -2 div 0 rmoveto -0.3 ft -0.3 ft rmoveto
+ dup expstringwidth neg 0 rmoveto expstringshow
+} def
+
+
+% <val> minmax -
+% perform minv := min(minv, val); maxv := max(maxv, val)
+% allowing for the possibility of minv, maxv, val being false (undefined)
+/minmax
+{ dup false eq
+ { pop }
+ { minv false eq
+ { dup /minv exch def /maxv exch def }
+ { dup minv lt
+ { /minv exch def }
+ { dup maxv gt
+ { /maxv exch def }
+ { pop }
+ ifelse
+ } ifelse
+ } ifelse
+ } ifelse
+} def
+
+% <ticks> ticksundef <ticks> <bool>
+% returns true iff the ticks array is undefined (one false entry)
+/ticksundef
+{ dup length 1 eq
+ { dup 0 get false eq
+ }
+ { false }
+ ifelse
+} def
+
+% <number> integral <boolean>
+% true if the number has an integral value
+/integral { dup round eq } def
+
+% ticksep ticks xory alldata minval maxval axis base ticksandlimits ticks min max base
+% ticksandlimits: sort out value of x or y ticks and limits and log base
+/ticksandlimits
+{ /base exch def
+ /minv false def
+ /maxv false def
+
+ % min and max of user-supplied minval, maxval, and axis
+ minmax minmax minmax
+
+ % min and max of data points
+ { 0 get dup dup length 1 sub 3 index exch 2 exch
+ { get minmax dup
+ } for pop pop
+ } forall
+ pop dup
+
+ % min and max of tick values
+ { dup type /stringtype eq
+ { pop } { minmax } ifelse
+ } forall
+
+ % fix minv and maxv if undefined (false) or equal
+ minv false eq
+ { /minv -1 def /maxv 1 def }
+ { minv maxv eq
+ { minv 0 lt
+ { /minv 2 minv mul def /maxv 0 def
+ }
+ { minv 0 eq
+ { /minv -1 def /maxv 1 def
+ }
+ { /minv 0 def /maxv 2 maxv mul def
+ } ifelse
+ } ifelse
+ } if
+ } ifelse
+
+ % invent ticks if undefined
+ ticksundef
+ { pop /ticksep exch def
+
+ % if base is reasonable and minv is positive, logarithmic ticks
+ base 1 gt minv 0 gt and
+ {
+ % get integral log of minv and maxv
+ /logminv base minv plog floor cvi def
+ /logmaxv base maxv plog ceiling cvi def
+
+ % if minv close to base, make it 1; reset minv and maxv
+ logminv 1 eq logmaxv 4 ge and { /logminv 0 def } if
+ /minv base logminv exp def
+ /maxv base logmaxv exp def
+
+ % ticks := [ base**logminv, ... , base**logmaxv ]
+ [ logminv 1 logmaxv
+ { dup base exch exp
+ exch base exch loglgen
+ } for
+ ]
+ }
+ { % non-logarithmic ticks
+ {
+ % fix tick separation if undefined (0) or too small
+ /base 0 def
+ /delta maxv minv sub def
+ ticksep delta 30 div le
+ { /ticksep 10 delta log 1 sub ceiling exp def
+ ticksep delta 2 div ge
+ { /ticksep ticksep 2 div def }
+ { ticksep delta 5 div lt
+ { /ticksep 2 ticksep mul def
+ } if
+ } ifelse
+ } if
+
+ % adjust minv and maxv to be multiples of ticksep
+ /minv minv ticksep div floor ticksep mul def
+ /maxv maxv ticksep div ceiling ticksep mul def
+ /delta maxv minv sub def
+
+ % if minv or maxv near zero, move to zero and redo
+ minv ticksep eq
+ { /minv 0 def }
+ { maxv ticksep neg eq { /maxv 0 def } { exit } ifelse
+ } ifelse
+ } loop
+
+ % if minv, maxv, and ticksep are all integral, set "makeint" to true
+ /makeint minv integral maxv integral ticksep integral and and def
+
+ % ticks := [ minv, minv+ticksep, ... , maxv ]
+ [ 0 1 delta ticksep div round
+ { ticksep mul minv add makeint { cvi } if lgen }
+ for
+ ]
+ } ifelse
+ }
+ { exch pop
+ } ifelse
+ minv maxv base
+} def
+
+% xset: set up all data for x axis, including limits and ticks
+% xticksep xticks 0 alldata xmin xmax xlog xextra xdecr xaxis xticklength xset -
+/xset
+{ /xticklength exch def
+ /xaxis exch def
+ /xdecr exch def
+ /xextra exch def
+ xaxis exch ticksandlimits
+ /xlog exch def /xmax exch def /xmin exch def /xticks exch def
+ /xleft xdecr { xmax } { xmin } ifelse def
+ /xright xdecr { xmin } { xmax } ifelse def
+ /xwidth xsize xextra 2 mul sub def
+ /trxmin xmin xtr def /trxmax xmax xtr def
+} def
+
+% yset: set up all data for y axis, including limits and yticks
+% yticksep yticks 0 alldata ymin ymax ylog yextra ydecr yaxis yticklength yset -
+/yset
+{ /yticklength exch def
+ /yaxis exch def
+ /ydecr exch def
+ /yextra exch def
+ yaxis exch ticksandlimits
+ /ylog exch def /ymax exch def /ymin exch def /yticks exch def
+ /yleft ydecr { ymax } { ymin } ifelse def
+ /yright ydecr { ymin } { ymax } ifelse def
+ /ywidth ysize yextra 2 mul sub def
+ /trymin ymin ytr def /trymax ymax ytr def
+} def
+
+% rset: set up all data for y axis (again), but including limits and rticks
+% rticksep rticks 0 alldata ymin ymax ylog yextra ydecr yaxis rticklength rset -
+/rset
+{ /rticklength exch def
+ /yaxis exch def
+ /ydecr exch def
+ /yextra exch def
+ yaxis exch ticksandlimits
+ /ylog exch def /ymax exch def /ymin exch def /rticks exch def
+ /yleft ydecr { ymax } { ymin } ifelse def
+ /yright ydecr { ymin } { ymax } ifelse def
+ /ywidth ysize yextra 2 mul sub def
+ /trymin ymin ytr def /trymax ymax ytr def
+} def
+
+% norset: set up data for no rticks
+% - norset -
+/norset
+{ /rticklength 0 def
+ /rticks [] def
+} def
+
+% framestyle: print a frame around the graph
+/framestyle
+{ 0 0 moveto xsize 0 lineto xsize ysize lineto
+ 0 ysize lineto closepath stroke
+ /printxtick /printxlabel xticks xleft printticks
+ /printytick /printylabel yticks ymin printticks
+ /printrtick /printrlabel rticks ymin printticks
+} def
+
+% nonestyle: print nothing around the graph
+/nonestyle
+{
+} def
+
+% axesstyle: print axes for the graph (unless axis values missing)
+/axesstyle
+{
+ xaxis false eq yaxis false eq or
+ { framestyle }
+ { xaxis yaxis trpoint dup 0 exch moveto xsize exch lineto
+ dup 0 moveto ysize lineto stroke
+ /printxaxistick /printxaxislabel xticks xleft printticks
+ /printyaxistick /printyaxislabel yticks ymin printticks
+ } ifelse
+} def
+
+% rundata: run all data sets
+/rundata
+{ alldata
+ { gsave
+ dup dup dup dup
+ 4 get /dopaint exch def
+ 3 get /initrun exch def
+ 2 get /pairs exch def
+ 1 get /points exch def
+ 0 get /data exch def
+ dopaint
+ { data length 4 ge
+ { initrun
+ newpath
+ data 0 get ymin trpoint yextra sub moveto
+ 0 2 data length 2 sub
+ { dup 1 add
+ data exch get /ycurr exch def
+ data exch get /xcurr exch def
+ xcurr ycurr trpoint lineto
+ } for
+ data dup length 2 sub get ymin trpoint yextra sub lineto
+ closepath fill
+ } if
+ } if
+ initrun
+ data length 2 ge
+ {
+ /xcurr data 0 get def
+ /ycurr data 1 get def
+ points
+ data length 4 ge
+ { 2 2 data length 2 sub
+ { /xprev xcurr def
+ /yprev ycurr def
+ dup dup 2 eq /firstpair exch def
+ data length 2 sub eq /lastpair exch def
+ dup 1 add
+ data exch get /ycurr exch def
+ data exch get /xcurr exch def
+ pairs
+ points
+ } for
+ } if
+ } if
+ grestore
+ } forall
+} def
+
+end
+%%EndResource
diff --git a/include/init b/include/init
new file mode 100644
index 0000000..2718c22
--- /dev/null
+++ b/include/init
@@ -0,0 +1,34 @@
+
+###############################################################################
+# #
+# init #
+# #
+# Lout file for initializing run. #
+# #
+# Jeffrey H. Kingston #
+# 21 September 1994 #
+# #
+###############################################################################
+
+
+@SysInclude { fontdefs } # font definitions
+@SysInclude { langdefs } # language definitions
+@SysInclude { bsf } # BasicSetup package
+@SysInclude { dsf } # DocumentSetup package
+ # including standard.ld
+def @TeX
+{
+ @OneCol { T &0.4fo {-0.2f @VShift E} &0.45fo X }
+}
+
+def @LaTeX
+{
+ @OneCol { L &0.3fo { +0.1f @VShift 0.8f @Font A } &0.4fo @TeX }
+}
+
+@Use { @BasicSetup }
+@Use { @DocumentSetup }
+
+@SysDatabase @Reference { loutrefs } # references about Lout
+@SysDatabase @Reference { oldrefs } # old references about Lout
+@SysDatabase @RefStyle { refstyle } # reference printing styles
diff --git a/include/langdefs b/include/langdefs
new file mode 100644
index 0000000..ec3ac3a
--- /dev/null
+++ b/include/langdefs
@@ -0,0 +1,16 @@
+langdef Czech Cesky Cestina { czech . : ! ? .) ?) !) .' !' ?' }
+langdef Danish Dansk { danish . : ! ? .) ?) !) .' !' ?' }
+langdef Dutch Nederlands { dutch . : ! ? .) ?) !) .' !' ?' }
+langdef English { english . : ! ? .) ?) !) .' !' ?' }
+langdef EnglishUK { engluk . : ! ? .) ?) !) .' !' ?' }
+langdef Finnish Suomi { finnish . : ! ? .) ?) !) .' !' ?' }
+langdef French Francais "Fran\347ais" { french }
+langdef German Deutsch { german . : ! ? .) ?) !) .' !' ?' }
+langdef Hungarian Magyar { - . : ! ? .) ?) !) .' !' ?' }
+langdef Italian Italiano { italian . : ! ? .) ?) !) .' !' ?' }
+langdef Norwegian Norsk { norweg . : ! ? .) ?) !) .' !' ?' }
+langdef Polish Polski { polish . : ! ? .) ?) !) .' !' ?' }
+langdef Russian "\362\325\323\323\313\311\312" { russian . : ! ? .) ?) !) .' !' ?' }
+langdef Slovenian Slovenia Slovenija { slovenia . : ! ? .) ?) !) .' !' ?' }
+langdef Spanish "Espa\361ol" { spanish . : ! ? .) ?) !) .' !' ?' }
+langdef Swedish Svenska { swedish . : ! ? .) ?) !) .' !' ?' }
diff --git a/include/latin2 b/include/latin2
new file mode 100644
index 0000000..35ddf2c
--- /dev/null
+++ b/include/latin2
@@ -0,0 +1,9 @@
+#################################################################
+# #
+# latin2 #
+# #
+# This file includes everything you need for Latin2. #
+# #
+#################################################################
+
+@SysInclude { latin2.fd }
diff --git a/include/latin2.fd b/include/latin2.fd
new file mode 100644
index 0000000..5bc648b
--- /dev/null
+++ b/include/latin2.fd
@@ -0,0 +1,143 @@
+##################################################################################################################
+# #
+# Latin2 Font definitions. Use a very wide window to see them clearly. #
+# #
+# Lout font Lout font PostScript PostScript font metrics Lout character Recode/ #
+# family name face name font name (formerly .AFM) file name mapping file NoRecode #
+# #
+##################################################################################################################
+
+
+fontdef AvantGardeCE Base { AvantGarde-Medium AG-Md LtLatin2.LCM Recode }
+fontdef AvantGardeCE Slope { AvantGarde-MediumObl AG-MdO LtLatin2.LCM Recode }
+fontdef AvantGardeCE Bold { AvantGarde-Bold AG-Bd LtLatin2.LCM Recode }
+fontdef AvantGardeCE BoldSlope { AvantGarde-BoldObl AG-BdO LtLatin2.LCM Recode }
+
+fontdef AvantGardeCE Bold { AvantGarde-Bold AG-Bd LtLatin2.LCM Recode }
+fontdef AvantGardeCE BoldObl { AvantGarde-BoldObl AG-BdO LtLatin2.LCM Recode }
+fontdef AvantGardeCE Book { AvantGarde-Book AG-Bk LtLatin2.LCM Recode }
+fontdef AvantGardeCE BookOblique { AvantGarde-BookOblique AG-BkO LtLatin2.LCM Recode }
+fontdef AvantGardeCE CondBold { AvantGarde-CondBold AG-CnBd LtLatin2.LCM Recode }
+fontdef AvantGardeCE CondBook { AvantGarde-CondBook AG-CnBk LtLatin2.LCM Recode }
+fontdef AvantGardeCE CondDemi { AvantGarde-CondDemi AG-CnDm LtLatin2.LCM Recode }
+fontdef AvantGardeCE CondMedium { AvantGarde-CondMedium AG-CnMd LtLatin2.LCM Recode }
+fontdef AvantGardeCE Demi { AvantGarde-Demi AG-Dm LtLatin2.LCM Recode }
+fontdef AvantGardeCE DemiOblique { AvantGarde-DemiOblique AG-DmO LtLatin2.LCM Recode }
+fontdef AvantGardeCE ExtraLight { AvantGarde-ExtraLight AG-ExLt LtLatin2.LCM Recode }
+fontdef AvantGardeCE ExtraLightObl { AvantGarde-ExtraLightObl AG-ExLtO LtLatin2.LCM Recode }
+fontdef AvantGardeCE Medium { AvantGarde-Medium AG-Md LtLatin2.LCM Recode }
+fontdef AvantGardeCE MediumObl { AvantGarde-MediumObl AG-MdO LtLatin2.LCM Recode }
+
+
+fontdef BookmanCE Base { Bookman-Medium Bk-Md LtLatin2.LCM Recode }
+fontdef BookmanCE Slope { Bookman-MediumItalic Bk-MdIt LtLatin2.LCM Recode }
+fontdef BookmanCE Bold { Bookman-Bold Bk-Bd LtLatin2.LCM Recode }
+fontdef BookmanCE BoldSlope { Bookman-BoldItalic Bk-BdIt LtLatin2.LCM Recode }
+
+fontdef BookmanCE Bold { Bookman-Bold Bk-Bd LtLatin2.LCM Recode }
+fontdef BookmanCE BoldItalic { Bookman-BoldItalic Bk-BdIt LtLatin2.LCM Recode }
+fontdef BookmanCE Demi { Bookman-Demi Bk-Dm LtLatin2.LCM Recode }
+fontdef BookmanCE DemiItalic { Bookman-DemiItalic Bk-DmIt LtLatin2.LCM Recode }
+fontdef BookmanCE Light { Bookman-Light Bk-Lt LtLatin2.LCM Recode }
+fontdef BookmanCE LightItalic { Bookman-LightItalic Bk-LtIt LtLatin2.LCM Recode }
+fontdef BookmanCE Medium { Bookman-Medium Bk-Md LtLatin2.LCM Recode }
+fontdef BookmanCE MediumItalic { Bookman-MediumItalic Bk-MdIt LtLatin2.LCM Recode }
+
+
+fontdef CourierCE Base { Courier Cr LtLatin2.LCM Recode }
+fontdef CourierCE Slope { Courier-Oblique Cr-O LtLatin2.LCM Recode }
+fontdef CourierCE Bold { Courier-Bold Cr-Bd LtLatin2.LCM Recode }
+fontdef CourierCE BoldSlope { Courier-BoldOblique Cr-BdO LtLatin2.LCM Recode }
+
+fontdef CourierCE Base { Courier Cr LtLatin2.LCM Recode }
+fontdef CourierCE Bold { Courier-Bold Cr-Bd LtLatin2.LCM Recode }
+fontdef CourierCE BoldOblique { Courier-BoldOblique Cr-BdO LtLatin2.LCM Recode }
+fontdef CourierCE Oblique { Courier-Oblique Cr-O LtLatin2.LCM Recode }
+
+
+fontdef HelveticaCE Base { Helvetica He LtLatin2.LCM Recode }
+fontdef HelveticaCE Slope { Helvetica-Oblique He-O LtLatin2.LCM Recode }
+fontdef HelveticaCE Bold { Helvetica-Bold He-Bd LtLatin2.LCM Recode }
+fontdef HelveticaCE BoldSlope { Helvetica-BoldOblique He-BdO LtLatin2.LCM Recode }
+
+fontdef HelveticaCE Base { Helvetica He LtLatin2.LCM Recode }
+fontdef HelveticaCE Black { Helvetica-Black He-Bl LtLatin2.LCM Recode }
+fontdef HelveticaCE BlackOblique { Helvetica-BlackOblique He-BlO LtLatin2.LCM Recode }
+fontdef HelveticaCE Bold { Helvetica-Bold He-Bd LtLatin2.LCM Recode }
+fontdef HelveticaCE BoldOblique { Helvetica-BoldOblique He-BdO LtLatin2.LCM Recode }
+fontdef HelveticaCE Compressed { Helvetica-Compressed He-Cm LtLatin2.LCM Recode }
+fontdef HelveticaCE Cond { Helvetica-Condensed He-Cn LtLatin2.LCM Recode }
+fontdef HelveticaCE CondBlack { Helvetica-Condensed-Black He-CnBl LtLatin2.LCM Recode }
+fontdef HelveticaCE CondBlackObl { Helvetica-Condensed-BlackObl He-CnBlO LtLatin2.LCM Recode }
+fontdef HelveticaCE CondBold { Helvetica-Condensed-Bold He-CnBd LtLatin2.LCM Recode }
+fontdef HelveticaCE CondBoldObl { Helvetica-Condensed-BoldObl He-CnBdO LtLatin2.LCM Recode }
+fontdef HelveticaCE CondLight { Helvetica-Condensed-Light He-CnLi LtLatin2.LCM Recode }
+fontdef HelveticaCE CondLightObl { Helvetica-Condensed-LightObl He-CnLiO LtLatin2.LCM Recode }
+fontdef HelveticaCE CondOblique { Helvetica-Condensed-Oblique He-CnO LtLatin2.LCM Recode }
+fontdef HelveticaCE ExtraCompressed { Helvetica-ExtraCompressed He-ExtC LtLatin2.LCM Recode }
+fontdef HelveticaCE Light { Helvetica-Light He-Lt LtLatin2.LCM Recode }
+fontdef HelveticaCE LightOblique { Helvetica-LightOblique He-LtO LtLatin2.LCM Recode }
+fontdef HelveticaCE Narrow { Helvetica-Narrow He-Nr LtLatin2.LCM Recode }
+fontdef HelveticaCE NarrowBold { Helvetica-Narrow-Bold He-NrBd LtLatin2.LCM Recode }
+fontdef HelveticaCE NarrowBoldObl { Helvetica-Narrow-BoldOblique He-NrBdO LtLatin2.LCM Recode }
+fontdef HelveticaCE NarrowObl { Helvetica-Narrow-Oblique He-NrO LtLatin2.LCM Recode }
+fontdef HelveticaCE Oblique { Helvetica-Oblique He-O LtLatin2.LCM Recode }
+fontdef HelveticaCE UltraCompressed { Helvetica-UltraCompressed He-UlCm LtLatin2.LCM Recode }
+
+
+fontdef SchoolbookCE Base { NewCenturySchlbk-Roman NCS-Rm LtLatin2.LCM Recode }
+fontdef SchoolbookCE Slope { NewCenturySchlbk-Italic NCS-It LtLatin2.LCM Recode }
+fontdef SchoolbookCE Bold { NewCenturySchlbk-Bold NCS-Bd LtLatin2.LCM Recode }
+fontdef SchoolbookCE BoldSlope { NewCenturySchlbk-BoldItalic NCS-BdIt LtLatin2.LCM Recode }
+
+fontdef SchoolbookCE Bold { NewCenturySchlbk-Bold NCS-Bd LtLatin2.LCM Recode }
+fontdef SchoolbookCE BoldItalic { NewCenturySchlbk-BoldItalic NCS-BdIt LtLatin2.LCM Recode }
+fontdef SchoolbookCE Italic { NewCenturySchlbk-Italic NCS-It LtLatin2.LCM Recode }
+fontdef SchoolbookCE Roman { NewCenturySchlbk-Roman NCS-Rm LtLatin2.LCM Recode }
+
+
+fontdef PalatinoCE Base { Palatino-Roman Pa-Rm LtLatin2.LCM Recode }
+fontdef PalatinoCE Slope { Palatino-Italic Pa-It LtLatin2.LCM Recode }
+fontdef PalatinoCE Bold { Palatino-Bold Pa-Bd LtLatin2.LCM Recode }
+fontdef PalatinoCE BoldSlope { Palatino-BoldItalic Pa-BdIt LtLatin2.LCM Recode }
+
+fontdef PalatinoCE Bold { Palatino-Bold Pa-Bd LtLatin2.LCM Recode }
+fontdef PalatinoCE BoldItalic { Palatino-BoldItalic Pa-BdIt LtLatin2.LCM Recode }
+fontdef PalatinoCE BoldItalicOsF { Palatino-BoldItalicOsF Pa-BdItF LtLatin2.LCM Recode }
+fontdef PalatinoCE BoldOsF { Palatino-BoldOsF Pa-BdF LtLatin2.LCM Recode }
+fontdef PalatinoCE Italic { Palatino-Italic Pa-It LtLatin2.LCM Recode }
+fontdef PalatinoCE ItalicOsF { Palatino-ItalicOsF Pa-ItF LtLatin2.LCM Recode }
+fontdef PalatinoCE Roman { Palatino-Roman Pa-Rm LtLatin2.LCM Recode }
+fontdef PalatinoCE SC { Palatino-SC Pa-SC LtLatin2.LCM Recode }
+
+
+fontdef TimesCE Base { Times-Roman Ti-Rm LtLatin2.LCM Recode }
+fontdef TimesCE Slope { Times-Italic Ti-It LtLatin2.LCM Recode }
+fontdef TimesCE Bold { Times-Bold Ti-Bd LtLatin2.LCM Recode }
+fontdef TimesCE BoldSlope { Times-BoldItalic Ti-BdIt LtLatin2.LCM Recode }
+
+fontdef TimesCE Bold { Times-Bold Ti-Bd LtLatin2.LCM Recode }
+fontdef TimesCE BoldItalic { Times-BoldItalic Ti-BdIt LtLatin2.LCM Recode }
+fontdef TimesCE BoldItalicOsF { Times-BoldItalicOsF Ti-BdItF LtLatin2.LCM Recode }
+fontdef TimesCE BoldSC { Times-BoldSC Ti-BdSC LtLatin2.LCM Recode }
+fontdef TimesCE ExtraBold { Times-ExtraBold Ti-ExBd LtLatin2.LCM Recode }
+fontdef TimesCE Italic { Times-Italic Ti-It LtLatin2.LCM Recode }
+fontdef TimesCE ItalicOsF { Times-ItalicOsF Ti-ItF LtLatin2.LCM Recode }
+fontdef TimesCE Roman { Times-Roman Ti-Rm LtLatin2.LCM Recode }
+fontdef TimesCE RomanSC { Times-RomanSC Ti-RmSC LtLatin2.LCM Recode }
+fontdef TimesCE Semibold { Times-Semibold Ti-Sm LtLatin2.LCM Recode }
+fontdef TimesCE SemiboldItalic { Times-SemiboldItalic Ti-SmIt LtLatin2.LCM Recode }
+
+
+fontdef ChanceryCE Base { ZapfChancery-Roman ZC-Rm LtLatin2.LCM Recode }
+fontdef ChanceryCE Slope { ZapfChancery-Italic ZC-It LtLatin2.LCM Recode }
+fontdef ChanceryCE Bold { ZapfChancery-Bold ZC-Bd LtLatin2.LCM Recode }
+fontdef ChanceryCE BoldSlope { ZapfChancery-MediumItalic ZC-MdIt LtLatin2.LCM Recode }
+
+fontdef ChanceryCE Roman { ZapfChancery-Roman ZC-Rm LtLatin2.LCM Recode }
+fontdef ChanceryCE Bold { ZapfChancery-Bold ZC-Bd LtLatin2.LCM Recode }
+fontdef ChanceryCE Italic { ZapfChancery-Italic ZC-It LtLatin2.LCM Recode }
+fontdef ChanceryCE Light { ZapfChancery-Light ZC-Lt LtLatin2.LCM Recode }
+fontdef ChanceryCE Demi { ZapfChancery-Demi ZC-Dm LtLatin2.LCM Recode }
+fontdef ChanceryCE LightItalic { ZapfChancery-LightItalic ZC-LtIt LtLatin2.LCM Recode }
+fontdef ChanceryCE MediumItalic { ZapfChancery-MediumItalic ZC-MdIt LtLatin2.LCM Recode }
diff --git a/include/modula b/include/modula
new file mode 100644
index 0000000..0f84ad6
--- /dev/null
+++ b/include/modula
@@ -0,0 +1,27 @@
+###############################################################################
+# #
+# Lout setup file for Modula-2 program printing #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# The @SysInclude { modulaf } line #
+# #
+# This line causes Lout to read the definitions for Modula-2, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { modulaf }
+
+
+###############################################################################
+# #
+# This package does not offer the ability to change default options. #
+# #
+###############################################################################
diff --git a/include/modulaf b/include/modulaf
new file mode 100644
index 0000000..2f1221d
--- /dev/null
+++ b/include/modulaf
@@ -0,0 +1,137 @@
+
+###############################################################################
+# #
+# Lout @Modula package for formatting Modula-2 programs (Version 1.0) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, September 1993. #
+# #
+# This package implements the complete Modula-2 language (in a style which #
+# claims only to reflect its author's taste) with the following caveats: #
+# #
+# * The symbol { must be given as lbrace #
+# #
+# * The symbol } must be given as rbrace #
+# #
+# * The symbol # must be given as numbersign #
+# #
+# * Double quotes are used by Lout to delimit literal strings, so they #
+# need to be quoted (Modula-2 allows single quoted strings wherever #
+# double quoted strings can go; we recommend these be used) #
+# #
+# * Literal strings should be enclosed in double quotes #
+# #
+# * The symbols B, H, C, and E as used in numeric literals will appear #
+# in italic font #
+# #
+###############################################################################
+
+export "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
+
+ "*" "/" "~" "+" "-" "=" "<>" ">" ">=" "<" "<=" "("
+ ")" "[" "]" "," ";" "." ":" "..." ".." "|" "^" ":=" "'" "`"
+ "&"
+
+ lbrace rbrace numbersign
+
+ AND ARRAY BEGIN BY CASE CONST DEFINITION DIV DO ELSE ELSIF
+ END EXPORT EXIT FOR FROM IF IMPLEMENTATION IMPORT IN LOOP
+ MOD MODULE NOT OF OR POINTER PROCEDURE QUALIFIED RECORD
+ REPEAT RETURN SET TO THEN TYPE UNTIL VAR WHILE WITH @Com
+
+def @Modula
+ body @Body
+@Begin
+
+ def @R right x { Base @Font x }
+ def @B right x { Bold @Font x }
+ def @S right x { { Symbol Base } @Font x }
+
+ def "0" { @R "0" }
+ def "1" { @R "1" }
+ def "2" { @R "2" }
+ def "3" { @R "3" }
+ def "4" { @R "4" }
+ def "5" { @R "5" }
+ def "6" { @R "6" }
+ def "7" { @R "7" }
+ def "8" { @R "8" }
+ def "9" { @R "9" }
+
+ def "*" { @S @Char "asteriskmath" }
+ def "/" { @R @Char "fraction" }
+ def "~" { @R "~" }
+ def "+" { @S "+" }
+ def "-" { @S "-" }
+ def "=" { @S @Char "equal" }
+ def "<>" { @S @Char "notequal" }
+ def ">" { @S @Char "greater" }
+ def ">=" { @S @Char "greaterequal" }
+ def "<" { @S @Char "less" }
+ def "<=" { @S @Char "lessequal" }
+ def "(" { @R "(" }
+ def ")" { @R ")" }
+ def "[" { @R "[" }
+ def "]" { @R "]" }
+ def "," { @R "," }
+ def ";" { @R ";" }
+ def "." { @R "." }
+ def ":" { @R ":" }
+ def ".." { @R ".." &0.1f }
+ def "..." { @R "..." }
+ def "|" { @R "|" }
+ def "^" { @S 0.8f @Font @Char "arrowup" }
+ def ":=" { :{//0.03fo =} }
+ def "'" { @R "'" }
+ def "`" { @R "`" }
+ def "&" { @R "&" }
+
+ def lbrace { @R "{" }
+ def rbrace { @R "}" }
+ def numbersign { @R "#" }
+
+ def AND { @B "and" }
+ def ARRAY { @B "array" }
+ def BEGIN { @B "begin" }
+ def BY { @B "by" }
+ def CASE { @B "case" }
+ def CONST { @B "const" }
+ def DEFINITION { @B "definition" }
+ def DIV { @B "div" }
+ def DO { @B "do" }
+ def ELSE { @B "else" }
+ def ELSIF { @B "elsif" }
+ def END { @B "end" }
+ def EXPORT { @B "export" }
+ def EXIT { @B "exit" }
+ def FOR { @B "for" }
+ def FROM { @B "from" }
+ def IF { @B "if" }
+ def IMPLEMENTATION { @B "implementation" }
+ def IMPORT { @B "import" }
+ def IN { @B "in" }
+ def LOOP { @B "loop" }
+ def MOD { @B "mod" }
+ def MODULE { @B "module" }
+ def NOT { @B "not" }
+ def OF { @B "of" }
+ def OR { @B "or" }
+ def POINTER { @B "pointer" }
+ def PROCEDURE { @B "procedure" }
+ def QUALIFIED { @B "qualified" }
+ def RECORD { @B "record" }
+ def REPEAT { @B "repeat" }
+ def RETURN { @B "return" }
+ def SET { @B "set" }
+ def TO { @B "to" }
+ def THEN { @B "then" }
+ def TYPE { @B "type" }
+ def UNTIL { @B "until" }
+ def VAR { @B "var" }
+ def WHILE { @B "while" }
+ def WITH { @B "with" }
+
+ def @Com right x { @R "{" x @R "}" }
+
+ Slope @Font lines @Break @Body
+
+@End @Modula
diff --git a/include/mydefs b/include/mydefs
new file mode 100644
index 0000000..e7b7ebb
--- /dev/null
+++ b/include/mydefs
@@ -0,0 +1,9 @@
+
+###############################################################################
+# #
+# mydefs #
+# #
+# This empty Lout file is a placeholder which is read by the standard setup #
+# files when there is no mydefs file in the user's current directory. #
+# #
+###############################################################################
diff --git a/include/pas b/include/pas
new file mode 100644
index 0000000..b62b24a
--- /dev/null
+++ b/include/pas
@@ -0,0 +1,27 @@
+###############################################################################
+# #
+# Lout setup file for Pascal program printing #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# The @SysInclude { pasf } line #
+# #
+# This line causes Lout to read the definitions for Pascal, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { pasf }
+
+
+###############################################################################
+# #
+# This package does not offer default options that can be changed. #
+# #
+###############################################################################
diff --git a/include/pasf b/include/pasf
new file mode 100644
index 0000000..84dba18
--- /dev/null
+++ b/include/pasf
@@ -0,0 +1,110 @@
+
+###############################################################################
+# #
+# Lout @Pas package for formatting Pascal programs (Version 2.0) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, June 1991. #
+# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. #
+# #
+# See "Eq - a Lout package for typesetting mathematics" for user #
+# information. #
+# #
+# Reference: Jensen, K. and Wirth, N. Pascal User Manual and Report. #
+# Second Edition, Springer-Verlag, 1975. #
+# #
+###############################################################################
+
+export "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
+ "." "," ":" ";" "'" "`" "+" "-" "*" "/" "(" ")"
+ "[" "]" "^" ".." "=" "<" ">" "<>" "<=" ">=" ":="
+
+ and array begin case const div do downto else end
+ file for forward function goto if in label mod nil not
+ of or otherwise packed procedure program record repeat
+ set then to type until var while with @Com
+
+def @Pas
+ body @Body
+@Begin
+
+ def @R right x { Base @Font x }
+ def @B right x { Bold @Font x }
+ def @S right x { { Symbol Base } @Font x }
+
+ def "0" { @R "0" }
+ def "1" { @R "1" }
+ def "2" { @R "2" }
+ def "3" { @R "3" }
+ def "4" { @R "4" }
+ def "5" { @R "5" }
+ def "6" { @R "6" }
+ def "7" { @R "7" }
+ def "8" { @R "8" }
+ def "9" { @R "9" }
+ def "." { @R "." }
+ def "," { @R "," }
+ def ":" { @R ":" }
+ def ";" { @R ";" }
+ def "'" { @R "'" }
+ def "`" { @R "`" }
+ def "+" { @S "+" }
+ def "-" { @S "-" }
+ def "*" { @S @Char "asteriskmath" }
+ def "/" { @R @Char "fraction" }
+ def "(" { @R "(" }
+ def ")" { @R ")" }
+ def "[" { @R "[" }
+ def "]" { @R "]" }
+ def "^" { @S 0.8f @Font @Char "arrowup" }
+ def ".." { @R ".." &0.1f }
+ def "=" { @S @Char "equal" }
+ def "<" { @S @Char "less" }
+ def ">" { @S @Char "greater" }
+ def "<>" { @S @Char "notequal" }
+ def "<=" { @S @Char "lessequal" }
+ def ">=" { @S @Char "greaterequal" }
+ def ":=" { :{//0.03fo &0.1f =} }
+
+ def and { @B "and" }
+ def array { @B "array" }
+ def begin { @B "begin" }
+ def case { @B "case" }
+ def const { @B "const" }
+ def div { @B "div" }
+ def do { @B "do" }
+ def downto { @B "downto" }
+ def else { @B "else" }
+ def end { @B "end" }
+ def file { @B "file" }
+ def for { @B "for" }
+ def forward { @B "forward" }
+ def function { @B "function" }
+ def goto { @B "goto" }
+ def if { @B "if" }
+ def in { @B "in" }
+ def label { @B "label" }
+ def mod { @B "mod" }
+ def nil { @B "nil" }
+ def not { @B "not" }
+ def of { @B "of" }
+ def or { @B "or" }
+ def otherwise { @B "otherwise" }
+ def packed { @B "packed" }
+ def procedure { @B "procedure" }
+ def program { @B "program" }
+ def record { @B "record" }
+ def repeat { @B "repeat" }
+ def set { @B "set" }
+ def then { @B "then" }
+ def to { @B "to" }
+ def type { @B "type" }
+ def until { @B "until" }
+ def var { @B "var" }
+ def while { @B "while" }
+ def with { @B "with" }
+
+ def @Com right x { @R "{" x @R "}" }
+
+ Slope @Font lines @Break @Body
+
+@End @Pas
diff --git a/include/picture b/include/picture
new file mode 100644
index 0000000..55d2f3e
--- /dev/null
+++ b/include/picture
@@ -0,0 +1,254 @@
+###############################################################################
+# #
+# Lout setup file for stand-alone illustrations #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# @SysInclude commands for standard packages. #
+# #
+###############################################################################
+
+ @SysInclude { fontdefs } # font definitions
+ @SysInclude { langdefs } # language definitions
+ @SysInclude { bsf } # BasicSetup package
+ @SysInclude { dsf } # DocumentSetup package
+ @SysInclude { picturef } # IllustrationSetup extension
+
+
+###############################################################################
+# #
+# @Include command for reading personal definitions from current directory. #
+# #
+###############################################################################
+
+ @Include { mydefs }
+
+
+###############################################################################
+# #
+# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @BasicSetup
+ # @InitialFont { Times Base 12p } # initial font
+ # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}}
+ # @InitialSpace { lout } # initial space style
+ # @InitialLanguage { English } # initial language
+ # @InitialColour { black } # initial colour
+ # @OptimizePages { No } # optimize page breaks?
+ # @HeadingFont { Bold } # font for @Heading
+ # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs
+ # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP
+ # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays
+ # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent
+ # @DefaultIndent { 0.5rt } # @Display indent
+ # @DisplayNumStyle { (num) } # style of display numbers
+ # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent
+ # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent
+ # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists
+ # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items
+ # @ListIndent { 0s } # indent of list items
+ # @ListRightIndent { 0s } # right indent of list items
+ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags
+ # @NumberSeparator { . } # separates nums like 2.3.7
+}
+
+
+###############################################################################
+# #
+# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @DocumentSetup
+ # @PageType { A4 @OrIfPlain Other} # page type (width, height)
+ # @PageWidth { 80s } # page width if type Other
+ # @PageHeight { 66f } # page height if type Other
+ # @PageOrientation { Portrait } # Portrait, Landscape, etc.
+ # @PageBackground { } # background of each page
+ # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages
+ # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages
+ # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages
+ # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages
+ # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages
+ # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages
+ # @PageBoxType { None } # None Box CurveBox ShadowBox
+ # @PageBoxMargin { 1.00c } # page box margin
+ # @PageBoxLineWidth { } # page box line thickness
+ # @PageBoxPaint { none } # page box paint
+ # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox
+ # @ColumnNumber { 1 } # number of columns (1 to 10)
+ # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap
+ # @FigureLocation { PageTop } # default figure location
+ # @TableLocation { PageTop } # default table location
+ # @FigureFormat { @CC @Body } # default figure format
+ # @TableFormat { @CC @Body } # default table format
+ # @FigureWord { figure } # "Figure" word else anything
+ # @TableWord { table } # "Table" word else anything
+ # @FigureNumbers { Arabic } # method of numbering figures
+ # @TableNumbers { Arabic } # method of numbering tables
+ # @FigureCaptionPos { Below } # Above or Below
+ # @TableCaptionPos { Below } # Above or Below
+ # @CaptionFont { } # figure, table caption font
+ # @CaptionBreak { } # figure, table caption break
+ # @CaptionFormat { @B { number @DotSep @OneCol } } # figure, table caption format
+ # @MakeFigureContents { No } # list of figures at start
+ # @MakeTableContents { No } # list of tables at start
+ # @MakeContents { No } # make contents? Yes or No
+ # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry
+ # @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry
+ # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry
+ # @ContentsFont { Bold } # font for major entry
+ # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry
+ # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry
+ # @ContentsFormat { number @DotSep title } # contents entry format
+ # @ContentsLeader { .. } # leader symbol in contents
+ # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders
+ # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width
+ # @MakeReferences { Yes } # make references? Yes or No
+ # @RefCiteStyle { [cite] } # citation style
+ # @RefCiteLabels { @RefNum } # citation items
+ # @RefNumbers { Arabic } # reference numbers
+ # @RefListFormat { Labels } # NoLabels, Labels, etc.
+ # @RefListLabels { [@RefNum] } # ref list label format
+ # @RefListTitle { references } # title of reference list
+ # @ChapRefListTitle { references } # title of chapter ref list
+ # @RefListIndent { 0s } # indent to left of labels
+ # @RefListRightIndent { 0s } # indent to right of items
+ # @RefListGap { @ListGap } # gap between ref list items
+ # @RefListFont { } # font used in reference list
+ # @RefListBreak { } # break style of ref list
+ # @RefListLabelWidth { @ListLabelWidth } # Labels column width
+ # @RefListSortKey { @Tag } # sorting key
+ # @MakeIndex { No } # make index? Yes or No
+ # @IndexFont { } # index entries font
+ # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexColumnNumber { 2 } # index columns (1 to 10)
+ # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap
+ # @MakeIndexA { No } # make index A? Yes or No
+ # @IndexAFont { } # index A entries font
+ # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexAColumnNumber { 2 } # index A columns (1 to 10)
+ # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap
+ # @MakeIndexB { No } # make index B? Yes or No
+ # @IndexBFont { } # index B entries font
+ # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexBColumnNumber { 2 } # index B columns (1 to 10)
+ # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap
+ # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures
+ # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text
+ # @FootNoteNumbers { Arabic } # footnote numbers
+ # @FootNoteThrough { No } # numbered through chapter?
+ # @FootNoteLocation { ColFoot } # where the footnote appears
+ # @FootNoteFont { 0.80f } # font for footnotes
+ # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes
+ # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format
+ # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line
+ # @FootAboveGap { @DisplayGap } # gap above footnote line
+ # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes
+ # @MarginNoteFont { 0.80f } # font of margin notes
+ # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes
+ # @MarginNoteHGap { 0.5c } # horizontal gap to notes
+ # @MarginNoteVGap { @DisplayGap } # min vertical gap between
+ # @MarginNoteWidth { 1.50c } # width of margin notes
+ # @EndNoteNumbers { Arabic } # endnote numbers
+ # @EndNoteFont { 0.80f } # font of endnotes
+ # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes
+ # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format
+ # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes
+ # @TheoremWord { theorem } # "Theorem" word, etc.
+ # @TheoremTitleFormat { (title) } # only if title present
+ # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @DefinitionWord { definition } # "Definition" word, etc.
+ # @DefinitionTitleFormat { (title) } # only if title present
+ # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ClaimWord { claim } # "Claim" word, etc.
+ # @ClaimTitleFormat { (title) } # only if title present
+ # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @PropositionWord { proposition } # "Proposition" word, etc.
+ # @PropositionTitleFormat { (title) } # only if title present
+ # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @LemmaWord { lemma } # "Lemma" word, etc.
+ # @LemmaTitleFormat { (title) } # only if title present
+ # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @CorollaryWord { corollary } # "Corollary" word, etc.
+ # @CorollaryTitleFormat { (title) } # only if title present
+ # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ExampleWord { example } # "Example" word, etc.
+ # @ExampleTitleFormat { (title) } # only if title present
+ # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ProofWord { proof } # "Proof" word, etc.
+ # @PageHeaders { Simple } # None Simple Titles NoTitles
+ # @PageNumbers { Arabic } # page numbers
+ # @FirstPageNumber { 1 } # number of first page
+ # @IntroPageNumbers { Roman } # intro page numbers
+ # @IntroFirstPageNumber{ 1 } # number of first intro page
+ # @StructPageNums { No } # make structured page numbers
+
+ # @OddTop { @Centre{- @PageNum -} } # Simple page headers
+ # @OddFoot { @Null }
+ # @EvenTop { @Centre{- @PageNum -} }
+ # @EvenFoot { @Null }
+ # @StartOddTop { @Null }
+ # @StartOddFoot { @Null }
+ # @StartEvenTop { @Null }
+ # @StartEvenFoot { @Null }
+ # @IntroOddTop { @Null }
+ # @IntroOddFoot { @Centre @PageNum }
+ # @IntroEvenTop { @Null }
+ # @IntroEvenFoot { @Centre @PageNum }
+ # @IntroStartOddTop { @Null }
+ # @IntroStartOddFoot { @Null }
+ # @IntroStartEvenTop { @Null }
+ # @IntroStartEvenFoot { @Null }
+
+ # Titles, NoTitles headers
+ # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum }
+ # @RunningOddFoot { @Null }
+ # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} }
+ # @RunningEvenFoot { @Null }
+ # @RunningStartOddTop { @Null }
+ # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ # @RunningStartEvenTop { @Null }
+ # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ # @RunningIntroOddTop { @Null }
+ # @RunningIntroOddFoot { @Right @PageNum }
+ # @RunningIntroEvenTop { @Null }
+ # @RunningIntroEvenFoot { @PageNum }
+ # @RunningIntroStartOddTop { @Null }
+ # @RunningIntroStartOddFoot { @Null }
+ # @RunningIntroStartEvenTop { @Null }
+ # @RunningIntroStartEvenFoot { @Null }
+}
+
+
+###############################################################################
+# #
+# The @IllustrationSetup @Use clause - there are no options for this. #
+# #
+###############################################################################
+
+@Use { @IllustrationSetup
+}
+
+
+###############################################################################
+# #
+# @Database (and @SysDatabase) clauses go here. #
+# #
+###############################################################################
+
+@SysDatabase @RefStyle { refstyle } # reference printing styles
diff --git a/include/picturef b/include/picturef
new file mode 100644
index 0000000..fd9177d
--- /dev/null
+++ b/include/picturef
@@ -0,0 +1,37 @@
+
+###########################################################################
+# #
+# @IllustrationSetup extension to @DocumentSetup. #
+# #
+# Jeffrey H. Kingston #
+# August 1994 #
+# #
+# This package extends DocumentSetup for illustrations. #
+# #
+###########################################################################
+
+extend @BasicSetup @DocumentSetup
+export @Illustration
+def @IllustrationSetup
+@Begin
+
+ #######################################################################
+ # #
+ # @Illustration #
+ # #
+ #######################################################################
+
+ def @Illustration
+ named @InitialFont { @InitialFont }
+ named @InitialBreak { @InitialBreak }
+ named @InitialSpace { @InitialSpace }
+ named @InitialLanguage { @InitialLanguage }
+ named @InitialColour { @InitialColour }
+ right x
+ {
+ @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language
+ @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour
+ @OneCol @OneRow x
+ }
+
+@End @IllustrationSetup
diff --git a/include/report b/include/report
new file mode 100644
index 0000000..01fdcc6
--- /dev/null
+++ b/include/report
@@ -0,0 +1,372 @@
+###############################################################################
+# #
+# Lout setup file for technical reports #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# 17 September 1999 #
+# #
+# Note: this version, released with Lout Version 3.13, is not upwardly #
+# compatible with previous versions: the @Abstract symbol must now #
+# be placed before the //, not after. #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# @SysInclude commands for standard packages. #
+# #
+###############################################################################
+
+ @SysInclude { fontdefs } # font definitions
+ @SysInclude { langdefs } # language definitions
+ @SysInclude { bsf } # BasicSetup package
+ @SysInclude { dsf } # DocumentSetup package
+ @SysInclude { reportf } # ReportSetup extension
+
+
+###############################################################################
+# #
+# @Include command for reading personal definitions from current directory. #
+# #
+###############################################################################
+
+ @Include { mydefs }
+
+
+###############################################################################
+# #
+# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @BasicSetup
+ # @InitialFont { Times Base 12p } # initial font
+ # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}}
+ # @InitialSpace { lout } # initial space style
+ # @InitialLanguage { English } # initial language
+ # @InitialColour { black } # initial colour
+ # @OptimizePages { No } # optimize page breaks?
+ # @HeadingFont { Bold } # font for @Heading
+ # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs
+ # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP
+ # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays
+ # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent
+ # @DefaultIndent { 0.5rt } # @Display indent
+ # @DisplayNumStyle { (num) } # style of display numbers
+ # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent
+ # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent
+ # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists
+ # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items
+ # @ListIndent { 0s } # indent of list items
+ # @ListRightIndent { 0s } # right indent of list items
+ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags
+ # @NumberSeparator { . } # separates nums like 2.3.7
+}
+
+
+###############################################################################
+# #
+# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @DocumentSetup
+ # @PageType { A4 @OrIfPlain Other} # page type (width, height)
+ # @PageWidth { 80s } # page width if type Other
+ # @PageHeight { 66f } # page height if type Other
+ # @PageOrientation { Portrait } # Portrait, Landscape, etc.
+ # @PageBackground { } # background of each page
+ # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages
+ # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages
+ # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages
+ # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages
+ # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages
+ # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages
+ # @PageBoxType { None } # None Box CurveBox ShadowBox
+ # @PageBoxMargin { 1.00c } # page box margin
+ # @PageBoxLineWidth { } # page box line thickness
+ # @PageBoxPaint { none } # page box paint
+ # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox
+ # @ColumnNumber { 1 } # number of columns (1 to 10)
+ # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap
+ # @FigureLocation { PageTop } # default figure location
+ # @TableLocation { PageTop } # default table location
+ # @FigureFormat { @CC @Body } # default figure format
+ # @TableFormat { @CC @Body } # default table format
+ # @FigureWord { figure } # "Figure" word else anything
+ # @TableWord { table } # "Table" word else anything
+ # @FigureNumbers { Arabic } # method of numbering figures
+ # @TableNumbers { Arabic } # method of numbering tables
+ # @FigureCaptionPos { Below } # Above or Below
+ # @TableCaptionPos { Below } # Above or Below
+ # @CaptionFont { } # figure, table caption font
+ # @CaptionBreak { } # figure, table caption break
+ # @CaptionFormat { @B { number @DotSep @OneCol } } # figure, table caption format
+ # @MakeFigureContents { No } # list of figures at start
+ # @MakeTableContents { No } # list of tables at start
+ # @MakeContents { No } # make contents? Yes or No
+ # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry
+ # @ContentsGapAbove { 0.80v @OrIfPlain 1f } # extra gap above major entry
+ # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry
+ # @ContentsFont { Bold } # font for major entry
+ # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry
+ # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry
+ # @ContentsFormat { number @DotSep title } # contents entry format
+ # @ContentsLeader { .. } # leader symbol in contents
+ # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders
+ # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width
+ # @MakeReferences { Yes } # make references? Yes or No
+ # @RefCiteStyle { [cite] } # citation style
+ # @RefCiteLabels { @RefNum } # citation items
+ # @RefNumbers { Arabic } # reference numbers
+ # @RefListFormat { Labels } # NoLabels, Labels, etc.
+ # @RefListLabels { [@RefNum] } # ref list label format
+ # @RefListTitle { references } # title of reference list
+ # @ChapRefListTitle { references } # title of chapter ref list
+ # @RefListIndent { 0s } # indent to left of labels
+ # @RefListRightIndent { 0s } # indent to right of items
+ # @RefListGap { @ListGap } # gap between ref list items
+ # @RefListFont { } # font used in reference list
+ # @RefListBreak { } # break style of ref list
+ # @RefListLabelWidth { @ListLabelWidth } # Labels column width
+ # @RefListSortKey { @Tag } # sorting key
+ # @MakeIndex { No } # make index? Yes or No
+ # @IndexFont { } # index entries font
+ # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexColumnNumber { 2 } # index columns (1 to 10)
+ # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap
+ # @MakeIndexA { No } # make index A? Yes or No
+ # @IndexAFont { } # index A entries font
+ # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexAColumnNumber { 2 } # index A columns (1 to 10)
+ # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap
+ # @MakeIndexB { No } # make index B? Yes or No
+ # @IndexBFont { } # index B entries font
+ # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexBColumnNumber { 2 } # index B columns (1 to 10)
+ # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap
+ # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures
+ # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text
+ # @FootNoteNumbers { Arabic } # footnote numbers
+ # @FootNoteThrough { No } # numbered through chapter?
+ # @FootNoteLocation { ColFoot } # where the footnote appears
+ # @FootNoteFont { 0.80f } # font for footnotes
+ # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes
+ # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format
+ # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line
+ # @FootAboveGap { @DisplayGap } # gap above footnote line
+ # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes
+ # @MarginNoteFont { 0.80f } # font of margin notes
+ # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes
+ # @MarginNoteHGap { 0.5c } # horizontal gap to notes
+ # @MarginNoteVGap { @DisplayGap } # min vertical gap between
+ # @MarginNoteWidth { 1.50c } # width of margin notes
+ # @EndNoteNumbers { Arabic } # endnote numbers
+ # @EndNoteFont { 0.80f } # font of endnotes
+ # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes
+ # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format
+ # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes
+ # @TheoremWord { theorem } # "Theorem" word, etc.
+ # @TheoremTitleFormat { (title) } # only if title present
+ # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @DefinitionWord { definition } # "Definition" word, etc.
+ # @DefinitionTitleFormat { (title) } # only if title present
+ # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ClaimWord { claim } # "Claim" word, etc.
+ # @ClaimTitleFormat { (title) } # only if title present
+ # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @PropositionWord { proposition } # "Proposition" word, etc.
+ # @PropositionTitleFormat { (title) } # only if title present
+ # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @LemmaWord { lemma } # "Lemma" word, etc.
+ # @LemmaTitleFormat { (title) } # only if title present
+ # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @CorollaryWord { corollary } # "Corollary" word, etc.
+ # @CorollaryTitleFormat { (title) } # only if title present
+ # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ExampleWord { example } # "Example" word, etc.
+ # @ExampleTitleFormat { (title) } # only if title present
+ # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ProofWord { proof } # "Proof" word, etc.
+ # @PageHeaders { Simple } # None Simple Titles NoTitles
+ # @PageNumbers { Arabic } # page numbers
+ # @FirstPageNumber { 1 } # number of first page
+ # @IntroPageNumbers { Roman } # intro page numbers
+ # @IntroFirstPageNumber{ 1 } # number of first intro page
+ # @StructPageNums { No } # make structured page numbers
+
+ # @OddTop { @Centre{- @PageNum -} } # Simple page headers
+ # @OddFoot { @Null }
+ # @EvenTop { @Centre{- @PageNum -} }
+ # @EvenFoot { @Null }
+ # @StartOddTop { @Null }
+ # @StartOddFoot { @Null }
+ # @StartEvenTop { @Null }
+ # @StartEvenFoot { @Null }
+ # @IntroOddTop { @Null }
+ # @IntroOddFoot { @Centre @PageNum }
+ # @IntroEvenTop { @Null }
+ # @IntroEvenFoot { @Centre @PageNum }
+ # @IntroStartOddTop { @Null }
+ # @IntroStartOddFoot { @Null }
+ # @IntroStartEvenTop { @Null }
+ # @IntroStartEvenFoot { @Null }
+
+ # Titles, NoTitles headers
+ # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum }
+ # @RunningOddFoot { @Null }
+ # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} }
+ # @RunningEvenFoot { @Null }
+ # @RunningStartOddTop { @Null }
+ # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ # @RunningStartEvenTop { @Null }
+ # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ # @RunningIntroOddTop { @Null }
+ # @RunningIntroOddFoot { @Right @PageNum }
+ # @RunningIntroEvenTop { @Null }
+ # @RunningIntroEvenFoot { @PageNum }
+ # @RunningIntroStartOddTop { @Null }
+ # @RunningIntroStartOddFoot { @Null }
+ # @RunningIntroStartEvenTop { @Null }
+ # @RunningIntroStartEvenFoot { @Null }
+}
+
+
+###############################################################################
+# #
+# The @ReportSetup @Use clause - options specific to technical reports. #
+# #
+###############################################################################
+
+@Use { @ReportSetup
+ # @CoverSheet { Yes } # make cover sheet
+ # @DisplayAbstract { No } # abstract full width display
+ # @ContentsSeparate { No } # contents on separate pages
+ # @DateLine { No } # Yes, No, or a date
+ # @ReferencesBeforeAppendices { No } # references before appendices
+ # @AbstractWord { abstract } # word for "Abstract"
+ # @ContentsWord { contents } # word for "Contents"
+ # @AppendixWord { appendix } # word for "Appendix"
+ # @IndexWord { index } # word for "Index"
+ # @IndexAWord { index } # word for "Index" (A)
+ # @IndexBWord { index } # word for "Index" (B)
+ # @SectionNumbers { Arabic } # kind of section numbers
+ # @FirstSectionNumber { 1 } # first section num (Arabic)
+ # @SubSectionNumbers { Arabic } # kind of subsection numbers
+ # @FirstSubSectionNumber { 1 } # first subsect num (Arabic)
+ # @SubSubSectionNumbers { Arabic } # kind of sub-subsect numbers
+ # @FirstSubSubSectionNumber { 1 } # first subsub. num (Arabic)
+ # @AppendixNumbers { UCAlpha } # kind of appendix numbers
+ # @FirstAppendixNumber { 1 } # first appendix num (Arabic)
+ # @SubAppendixNumbers { Arabic } # kind of subappendix numbers
+ # @FirstSubAppendixNumber { 1 } # first sub-app. num (Arabic)
+ # @SubSubAppendixNumbers { Arabic } # kind of sub-subapp. numbers
+ # @FirstSubSubAppendixNumber { 1 } # first sub-sub. num (Arabic)
+ # @AbstractHeadingFont { Bold } # abstract head font
+ # @AbstractHeadingBreak { ragged 1.2fx nohyphen } # abstract head break
+ # @AbstractHeadingFormat { title } # abstract head fmt
+ # @ContentsHeadingFont { Bold } # contents head font
+ # @ContentsHeadingBreak { ragged 1.2fx nohyphen } # contents head break
+ # @ContentsHeadingFormat { title } # contents head fmt
+ # @SectionHeadingFont { Bold } # section head font
+ # @SectionHeadingBreak { ragged 1.2fx nohyphen } # section head break
+ # @SectionHeadingFormat { number @DotSep title } # section head fmt
+ # @SubSectionHeadingFont { Bold } # subsection head font
+ # @SubSectionHeadingBreak { ragged 1.2fx nohyphen } # subsection head break
+ # @SubSectionHeadingFormat { number @DotSep title } # subsection head fmt
+ # @SubSubSectionHeadingFont { Slope } # sub-subs. head font
+ # @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } # sub-subs. head break
+ # @SubSubSectionHeadingFormat { number @DotSep title } # sub-subs. head fmt
+ # @AppendixHeadingFont { Bold } # appendix head font
+ # @AppendixHeadingBreak { ragged 1.2fx nohyphen } # appendix head break
+ # @AppendixHeadingFormat { number @DotSep title } # appendix head fmt
+ # @SubAppendixHeadingFont { Bold } # subapp. head font
+ # @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } # subapp. head break
+ # @SubAppendixHeadingFormat { number @DotSep title } # subapp. head fmt
+ # @SubSubAppendixHeadingFont { Slope } # sub-subapp. head font
+ # @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } # sub-subapp head break
+ # @SubSubAppendixHeadingFormat{ number @DotSep title } # sub-subapp. head fmt
+ # @ReferencesHeadingFont { Bold } # references head font
+ # @ReferencesHeadingBreak { ragged 1.2fx nohyphen } # references head break
+ # @ReferencesHeadingFormat { title } # references head fmt
+ # @IndexHeadingFont { Bold } # index head font
+ # @IndexHeadingBreak { ragged 1.2fx nohyphen } # index head break
+ # @IndexHeadingFormat { title } # index head fmt
+ # @IndexAHeadingFont { Bold } # index A head font
+ # @IndexAHeadingBreak { ragged 1.2fx nohyphen } # index A head break
+ # @IndexAHeadingFormat { title } # index A head fmt
+ # @IndexBHeadingFont { Bold } # index B head font
+ # @IndexBHeadingBreak { ragged 1.2fx nohyphen } # index B head break
+ # @IndexBHeadingFormat { title } # index B head fmt
+ # @SectionGap { 2.0v @OrIfPlain 3f } # between sections
+ # @SubSectionGap { 1.5v @OrIfPlain 2f } # between subsects
+ # @SubSubSectionGap { 1.5v @OrIfPlain 2f } # between sub-subs.
+ # @AppendixGap { 2.0v @OrIfPlain 3f } # between appendices
+ # @SubAppendixGap { 1.5v @OrIfPlain 2f } # between subappendices
+ # @SubSubAppendixGap { 1.5v @OrIfPlain 2f } # between sub-subapps
+ # @SectionInContents { Yes } # add sections to contents
+ # @SubSectionInContents { Yes } # add subsections to contents
+ # @SubSubSectionInContents { No } # add sub-subsects to contents
+ # @AppendixInContents { Yes } # add appendices to contents
+ # @SubAppendixInContents { Yes } # add subappendices to contents
+ # @SubSubAppendixInContents { No } # add sub-subapps to contents
+ # @ReferencesInContents { Yes } # add references to contents
+ # @IndexInContents { Yes } # add index to contents
+ # @IndexAInContents { Yes } # add index A to contents
+ # @IndexBInContents { Yes } # add index B to contents
+ # @SectionNumInTheorems { No } # theorem num has section num
+ # @SubSectionNumInTheorems { No } # theorem num has subsect num
+ # @SubSubSectionNumInTheorems { No } # theorem num has sub-ss. num
+ # @AppendixNumInTheorems { No } # theorem num has appendix num
+ # @SubAppendixNumInTheorems { No } # theorem num has sub-app num
+ # @SubSubAppendixNumInTheorems{ No } # theorem num has sub-sa. num
+ # @SectionNumInDisplays { Yes } # display num has section num
+ # @SubSectionNumInDisplays { No } # display num has subsect num
+ # @SubSubSectionNumInDisplays { No } # display num has sub-ss. num
+ # @AppendixNumInDisplays { Yes } # display num has appendix num
+ # @SubAppendixNumInDisplays { No } # display num has sub-app num
+ # @SubSubAppendixNumInDisplays{ No } # display num has sub-sa. num
+ # @SectionNumInFigures { No } # figure num has section num
+ # @SubSectionNumInFigures { No } # figure num has subsect num
+ # @SubSubSectionNumInFigures { No } # figure num has sub-ss. num
+ # @AppendixNumInFigures { No } # figure num has appendix num
+ # @SubAppendixNumInFigures { No } # figure num has sub-app num
+ # @SubSubAppendixNumInFigures { No } # figure num has sub-sa. num
+ # @SectionNumInTables { No } # table num has section num
+ # @SubSectionNumInTables { No } # table num has subsect num
+ # @SubSubSectionNumInTables { No } # table num has sub-ss. num
+ # @AppendixNumInTables { No } # table num has appendix num
+ # @SubAppendixNumInTables { No } # table num has sub-app num
+ # @SubSubAppendixNumInTables { No } # table num has sub-sa. num
+ # @SectionNumInRunners { Yes } # runners have section num
+ # @SubSectionNumInRunners { No } # runners have subsect num
+ # @SubSubSectionNumInRunners { No } # runners have sub-ss. num
+ # @AppendixNumInRunners { Yes } # runners have appendix num
+ # @SubAppendixNumInRunners { No } # runners have sub-app num
+ # @SubSubAppendixNumInRunners { No } # runners have sub-sa. num
+ # @FigureContentsPrefix { } # for structured page nums
+ # @TableContentsPrefix { } # for structured page nums
+ # @SectionPrefix { } # for structured page nums
+ # @AppendixPrefix { } # for structured page nums
+ # @ReferencesPrefix { } # for structured page nums
+ # @IndexPrefix { } # for structured page nums
+ # @IndexAPrefix { } # for structured page nums
+ # @IndexBPrefix { } # for structured page nums
+}
+
+
+###############################################################################
+# #
+# @Database (and @SysDatabase) clauses go here. #
+# #
+###############################################################################
+
+@SysDatabase @RefStyle { refstyle } # reference printing styles
diff --git a/include/reportf b/include/reportf
new file mode 100644
index 0000000..f1a62a9
--- /dev/null
+++ b/include/reportf
@@ -0,0 +1,895 @@
+
+###########################################################################
+# #
+# @ReportSetup extension to @DocumentSetup. #
+# #
+# Jeffrey H. Kingston #
+# August 1994 #
+# #
+# This package extends DocumentSetup with definitions for reports. #
+# #
+###########################################################################
+
+extend @BasicSetup @DocumentSetup
+export @Report @Section @Appendix
+def @ReportSetup
+ named @CoverSheet { Yes }
+ named @ContentsSeparate { No }
+ named @DateLine { No }
+ named @AbstractDisplay { Yes }
+ named @AbstractTitle { dft }
+ named @ReferencesBeforeAppendices { No }
+
+ named @AbstractWord { abstract }
+ named @ContentsWord { contents }
+ named @AppendixWord { appendix }
+ named @IndexWord { index }
+ named @IndexAWord { index }
+ named @IndexBWord { index }
+
+ named @SectionNumbers { Arabic }
+ named @FirstSectionNumber { 1 }
+ named @SubSectionNumbers { Arabic }
+ named @FirstSubSectionNumber { 1 }
+ named @SubSubSectionNumbers { Arabic }
+ named @FirstSubSubSectionNumber { 1 }
+ named @AppendixNumbers { UCAlpha }
+ named @FirstAppendixNumber { 1 }
+ named @SubAppendixNumbers { Arabic }
+ named @FirstSubAppendixNumber { 1 }
+ named @SubSubAppendixNumbers { Arabic }
+ named @FirstSubSubAppendixNumber { 1 }
+
+ named @AbstractHeadingFont { Bold }
+ named @AbstractHeadingBreak { ragged 1.2fx nohyphen }
+ named @AbstractHeadingFormat
+ right title { title }
+
+ named @ContentsHeadingFont { Bold }
+ named @ContentsHeadingBreak { ragged 1.2fx nohyphen }
+ named @ContentsHeadingFormat
+ right title { title }
+
+ named @SectionHeadingFont { Bold }
+ named @SectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SectionHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SubSectionHeadingFont { Bold }
+ named @SubSectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSectionHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SubSubSectionHeadingFont { Slope }
+ named @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSubSectionHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @AppendixHeadingFont { Bold }
+ named @AppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @AppendixHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SubAppendixHeadingFont { Bold }
+ named @SubAppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubAppendixHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @SubSubAppendixHeadingFont { Slope }
+ named @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen }
+ named @SubSubAppendixHeadingFormat
+ left number right title { number @DotSep title }
+
+ named @ReferencesHeadingFont { Bold }
+ named @ReferencesHeadingBreak { ragged 1.2fx nohyphen }
+ named @ReferencesHeadingFormat
+ right title { title }
+
+ named @IndexHeadingFont { Bold }
+ named @IndexHeadingBreak { ragged 1.2fx nohyphen }
+ named @IndexHeadingFormat
+ right title { title }
+
+ named @IndexAHeadingFont { Bold }
+ named @IndexAHeadingBreak { ragged 1.2fx nohyphen }
+ named @IndexAHeadingFormat
+ right title { title }
+
+ named @IndexBHeadingFont { Bold }
+ named @IndexBHeadingBreak { ragged 1.2fx nohyphen }
+ named @IndexBHeadingFormat
+ right title { title }
+
+ named @SectionGap { 2.0v @OrIfPlain 3f }
+ named @SubSectionGap { 1.5v @OrIfPlain 2f }
+ named @SubSubSectionGap { 1.5v @OrIfPlain 2f }
+ named @AppendixGap { 2.0v @OrIfPlain 3f }
+ named @SubAppendixGap { 1.5v @OrIfPlain 2f }
+ named @SubSubAppendixGap { 1.5v @OrIfPlain 2f }
+
+ named @SectionInContents { Yes }
+ named @SubSectionInContents { Yes }
+ named @SubSubSectionInContents { No }
+ named @AppendixInContents { Yes }
+ named @SubAppendixInContents { Yes }
+ named @SubSubAppendixInContents { No }
+ named @ReferencesInContents { Yes }
+ named @IndexInContents { Yes }
+ named @IndexAInContents { Yes }
+ named @IndexBInContents { Yes }
+
+ named @SectionNumInTheorems { No }
+ named @SubSectionNumInTheorems { No }
+ named @SubSubSectionNumInTheorems { No }
+ named @AppendixNumInTheorems { No }
+ named @SubAppendixNumInTheorems { No }
+ named @SubSubAppendixNumInTheorems { No }
+
+ named @SectionNumInDisplays { Yes }
+ named @SubSectionNumInDisplays { No }
+ named @SubSubSectionNumInDisplays { No }
+ named @AppendixNumInDisplays { Yes }
+ named @SubAppendixNumInDisplays { No }
+ named @SubSubAppendixNumInDisplays { No }
+
+ named @SectionNumInFigures { No }
+ named @SubSectionNumInFigures { No }
+ named @SubSubSectionNumInFigures { No }
+ named @AppendixNumInFigures { No }
+ named @SubAppendixNumInFigures { No }
+ named @SubSubAppendixNumInFigures { No }
+
+ named @SectionNumInTables { No }
+ named @SubSectionNumInTables { No }
+ named @SubSubSectionNumInTables { No }
+ named @AppendixNumInTables { No }
+ named @SubAppendixNumInTables { No }
+ named @SubSubAppendixNumInTables { No }
+
+ named @SectionNumInRunners { Yes }
+ named @SubSectionNumInRunners { No }
+ named @SubSubSectionNumInRunners { No }
+ named @AppendixNumInRunners { Yes }
+ named @SubAppendixNumInRunners { No }
+ named @SubSubAppendixNumInRunners { No }
+
+ named @FigureContentsPrefix { }
+ named @TableContentsPrefix { }
+ named @SectionPrefix { }
+ named @AppendixPrefix { }
+ named @ReferencesPrefix { }
+ named @IndexPrefix { }
+ named @IndexAPrefix { }
+ named @IndexBPrefix { }
+@Begin
+
+ #######################################################################
+ # #
+ # Lists of sections, subsections, etc. #
+ # #
+ #######################################################################
+
+ export num
+ def @SectionList named @Tag {} right num
+ {
+ @Galley
+ //@SectionGap @SectionList @Next num
+ }
+
+ export num
+ def @SubSectionList named @Tag {} right num
+ {
+ @Galley
+ //@SubSectionGap @SubSectionList @Next num
+ }
+
+ export num
+ def @SubSubSectionList named @Tag {} right num
+ {
+ @Galley
+ //@SubSubSectionGap @SubSubSectionList @Next num
+ }
+
+ export num
+ def @AppendixList named @Tag {} right num
+ {
+ @Galley
+ //@AppendixGap @AppendixList @Next num
+ }
+
+ export num
+ def @SubAppendixList named @Tag {} right num
+ {
+ @Galley
+ //@SubAppendixGap @SubAppendixList @Next num
+ }
+
+ export num
+ def @SubSubAppendixList named @Tag {} right num
+ {
+ @Galley
+ //@SubSubAppendixGap @SubSubAppendixList @Next num
+ }
+
+
+ #######################################################################
+ # #
+ # @Full - this sends text to a full-width place. #
+ # #
+ #######################################################################
+
+ def @Full force into { @FullPlace&&following } right x
+ {
+ x
+ }
+
+ def @NoForceFull into { @FullPlace&&following } right x
+ {
+ x
+ }
+
+
+ #######################################################################
+ # #
+ # @Report #
+ # #
+ #######################################################################
+
+ def @Report
+ named @Title {}
+ named @Author {}
+ named @Institution {}
+ named @DateLine { @DateLine }
+ named @CoverSheet { @CoverSheet }
+ named @ContentsSeparate { @ContentsSeparate }
+ named @AtEnd { dft }
+ named @InitialFont { @InitialFont }
+ named @InitialBreak { @InitialBreak }
+ named @InitialSpace { @InitialSpace }
+ named @InitialLanguage { @InitialLanguage }
+ named @PageOrientation { @PageOrientation }
+ named @PageHeaders { @PageHeaders }
+ named @ColumnNumber { @ColumnNumber }
+ named @FirstPageNumber { @FirstPageNumber }
+ named @OptimizePages { @OptimizePages }
+ named @AbstractDisplay { @AbstractDisplay }
+ named @AbstractTitle { @AbstractTitle }
+ named @Abstract {}
+ {
+
+ def @Cntr right x
+ {
+ x @Case {
+ "" @Yield @Null
+ else @Yield { |0.5rt x | }
+ }
+ }
+
+ def @DateValue right indent
+ {
+ @DateLine @Case {
+ No @Yield {}
+ Yes @Yield @Date
+ else @Yield @DateLine
+ }
+ }
+
+ def @TitleMaterial
+ {
+ //1i @B {clines 1.4vx} @Break @Cntr @Title
+ //1.00v @I clines @Break { |0.5rt @Author | }
+ //1.00v clines @Break @Cntr @Institution
+ //1.00v clines @Break @Cntr @DateValue
+ }
+
+ def @AbstractPart
+ {
+ def @Title
+ {
+ @AbstractHeadingFont @Font @AbstractHeadingBreak @Break
+ @AbstractHeadingFormat {
+ @AbstractTitle @Dft { abstract @WordVal @AbstractWord }
+ }
+ }
+
+ @Abstract @Case {
+
+ "" @Yield @Null
+
+ else @Yield @AbstractDisplay @Case {
+
+ No @Yield { @Title @DP @Abstract }
+
+ Yes @Yield { |0.5rt @Title |
+ @DP
+ |@DisplayIndent @Abstract |@DisplayIndent
+ }
+ }
+ }
+ }
+
+ def @ContentsPart
+ {
+ // |0.5rt @ContentsHeadingFont @Font @ContentsHeadingBreak @Break
+ @ContentsHeadingFormat { contents @WordVal @ContentsWord } |
+ //@DisplayGap @ContentsSection
+ // NonStart @Runner @MajorTitle {contents @WordVal @ContentsWord}
+ }
+
+ def @ReferencesPart
+ named @Tag {}
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { @RefHeading @RefListTitle }
+ sendheader { @Body }
+ headingfont { @ReferencesHeadingFont }
+ headingbreak { @ReferencesHeadingBreak }
+ headingformat { @ReferencesHeadingFormat @Body }
+ incontents { @ReferencesInContents }
+ majornum {}
+ majortitle {}
+ minornum {}
+ minortitle { @RefHeading @RefListTitle }
+ prefix { @ReferencesPrefix }
+ inrunners { Yes }
+ { //@RefListGap @ReferencesSection }
+ }
+
+ def @IndexPart
+ named @Tag {}
+ {
+
+ def @Run
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexWord }
+ @MinorNum {}
+ @MinorTitle {}
+ @Owner { @Tag }
+ @Prefix { @IndexPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexWord }
+ headingfont { @IndexHeadingFont }
+ headingbreak { @IndexHeadingBreak }
+ headingformat { @IndexHeadingFormat @Body }
+ incontents { @IndexInContents }
+ prefix { @IndexPrefix }
+ inrunners { Yes }
+ majornum {}
+ majortitle {}
+ minornum {}
+ minortitle { index @WordVal @IndexWord }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexSection @Run
+
+ }
+
+ def @IndexAPart
+ named @Tag {}
+ {
+ def @Run
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexAWord }
+ @MinorNum {}
+ @MinorTitle {}
+ @Owner { @Tag }
+ @Prefix { @IndexAPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexAWord }
+ headingfont { @IndexAHeadingFont }
+ headingbreak { @IndexAHeadingBreak }
+ headingformat { @IndexAHeadingFormat @Body }
+ incontents { @IndexAInContents }
+ prefix { @IndexAPrefix }
+ inrunners { Yes }
+ majornum {}
+ majortitle {}
+ minornum {}
+ minortitle { index @WordVal @IndexAWord }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexASection @Run
+
+ }
+
+ def @IndexBPart
+ named @Tag {}
+ {
+ def @Run
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @IndexBWord }
+ @MinorNum {}
+ @MinorTitle {}
+ @Owner { @Tag }
+ @Prefix { @IndexBPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { index @WordVal @IndexBWord }
+ headingfont { @IndexBHeadingFont }
+ headingbreak { @IndexBHeadingBreak }
+ headingformat { @IndexBHeadingFormat @Body }
+ incontents { @IndexBInContents }
+ prefix { @IndexBPrefix }
+ inrunners { Yes }
+ majornum {}
+ majortitle {}
+ minornum {}
+ minortitle { index @WordVal @IndexBWord }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexBSection @Run
+
+ }
+
+ def @ContentsGap
+ {
+ @ContentsSeparate @Case {
+ No @Yield @SectionGap
+ Yes @Yield 2b
+ }
+ }
+
+ def @ReportBodyWithoutCoverSheet force into { @ColPlace&&following }
+ named @Optimize { @OptimizePages }
+ {
+
+ Start @Runner
+ // @AbstractDisplay @NoDo @AbstractPart
+ //@ContentsGap @ContentsPart
+ //@ContentsGap @SectionList @FirstSectionNumber
+ //@SectionGap @ReferencesBeforeAppendices @Do {
+ @MakeReferences @Do @ReferencesPart
+ }
+ //@AppendixGap @AppendixList @FirstAppendixNumber
+ //@SectionGap @EndFigureList
+ //@SectionGap @EndNoteList 1
+ //@SectionGap @ReferencesBeforeAppendices @NoDo {
+ @MakeReferences @Do @ReferencesPart
+ }
+ // @MakeIndexA @Do @IndexAPart
+ // @MakeIndexB @Do @IndexBPart
+ // @MakeIndex @Do @IndexPart
+ }
+
+ def @ReportCoverSheet into { @IntroColPlace&&preceding }
+ named @Optimize { @OptimizePages }
+ {
+ // Start @Runner
+ // @TitleMaterial
+ //@DisplayGap @DP @AbstractPart
+ }
+
+ def @ReportBodyWithCoverSheet force into { @ColPlace&&preceding }
+ named @Optimize { @OptimizePages }
+ {
+
+ Start @Runner
+ //@SectionGap @ContentsPart
+ //@SectionGap @SectionList @FirstSectionNumber
+ //@SectionGap @ReferencesBeforeAppendices @Do {
+ @MakeReferences @Do @ReferencesPart
+ }
+ //@AppendixGap @AppendixList @FirstAppendixNumber
+ //@SectionGap @ReferencesBeforeAppendices @NoDo {
+ @MakeReferences @Do @ReferencesPart
+ }
+ //@SectionGap @EndFigureList
+ //@SectionGap @EndNoteList 1
+ // @MakeIndexA @Do @IndexAPart
+ // @MakeIndexB @Do @IndexBPart
+ // @MakeIndex @Do @IndexPart
+ }
+
+ @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language
+ @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour
+ {
+ @CoverSheet @Case {
+
+ No @Yield {
+ @FootNoteThrough @Do @BeginFootNoteCounter
+ // Yes @BeginAllCounters {}
+ // Yes @BeginDisplayCounter {}
+ // Yes @BeginFigureCounter {}
+ // Yes @BeginTableCounter {}
+ // @AbstractDisplay @Do { @NoForceFull @AbstractPart }
+ // @ReportBodyWithoutCoverSheet
+ // @PageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @PageOrientation }
+ # extra { Yes }
+ @AtTop { @TitleMaterial }
+ @FirstPageNumber
+ // NonStart @Runner
+ // @AtEnd @Case {
+ dft @Yield @Null
+ else @Yield
+ @EvenPage @Orient { @PageOrientation } @AtEnd
+ }
+ }
+
+ Yes @Yield {
+ @FootNoteThrough @Do @BeginFootNoteCounter
+ // Yes @BeginAllCounters {}
+ // Yes @BeginDisplayCounter {}
+ // Yes @BeginFigureCounter {}
+ // Yes @BeginTableCounter {}
+ // @SimpleOddOrEvenIntroPageList
+ @ColumnNumber { 1 }
+ @PageHeaders { Simple }
+ @Orient { @PageOrientation }
+ 1
+ // @ReportCoverSheet
+ // @PageList
+ @ColumnNumber { @ColumnNumber }
+ @PageHeaders { @PageHeaders }
+ @Orient { @PageOrientation }
+ # extra { Yes }
+ @AtTop { @TitleMaterial }
+ @FirstPageNumber
+ // @ReportBodyWithCoverSheet
+ // NonStart @Runner
+ // @AtEnd @Case {
+ dft @Yield @Null
+ else @Yield
+ @EvenPage @Orient { @PageOrientation } @AtEnd
+ }
+ }
+ }
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # Sections. #
+ # #
+ #######################################################################
+
+ export @BeginSubSections @EndSubSections @SubSection
+ def @Section force into { @SectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSectionsPlace { @Galley }
+
+ def @EndSubSections force into { @EndSubSectionsPlace&&preceding }
+ {}
+
+ macro @BeginSubSections
+ {
+ //@SubSectionGap @SubSectionList @FirstSubSectionNumber
+ // @EndSubSectionsPlace //
+ }
+
+ def @SectionShortNum
+ {
+ @SectionNumbers @Then {
+ @BypassNumber @Dft {
+ @SectionNumbers @Num @SectionList&&@Tag @Open { num }
+ }
+ }
+ }
+
+ export @BeginSubSubSections @EndSubSubSections @SubSubSection
+ def @SubSection force into { @SubSectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSubSectionsPlace { @Galley }
+
+ def @EndSubSubSections force into
+ { @EndSubSubSectionsPlace&&preceding }
+ {}
+
+ macro @BeginSubSubSections
+ {
+ //@SubSubSectionGap @SubSubSectionList @FirstSubSubSectionNumber
+ // @EndSubSubSectionsPlace //
+ }
+
+ def @SubSectionShortNum
+ {
+ @SubSectionNumbers @Then {
+ @BypassNumber @Dft {
+ @SectionShortNum @Join @SubSectionNumbers @Num
+ { @SubSectionList&&@Tag @Open { num } }
+ }
+ }
+ }
+
+ def @SubSubSection force into { @SubSubSectionList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSubSectionHeadingFont }
+ headingbreak { @SubSubSectionHeadingBreak }
+ headingformat { @Num @SubSubSectionHeadingFormat @Body }
+ incontents { @SubSubSectionInContents }
+ contentsindent { 6f }
+ numbers { @SubSubSectionNumbers }
+ attachnum { @SubSubSectionList&&preceding @Tagged @Tag }
+ retrievenum { @SubSubSectionList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SubSectionShortNum }
+ majornum {}
+ majortitle {}
+ intheorems { @SubSubSectionNumInTheorems }
+ indisplays { @SubSubSectionNumInDisplays }
+ infigures { @SubSubSectionNumInFigures }
+ intables { @SubSubSectionNumInTables }
+ inrunners { @SubSubSectionNumInRunners }
+ @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSectionHeadingFont }
+ headingbreak { @SubSectionHeadingBreak }
+ headingformat { @Num @SubSectionHeadingFormat @Body }
+ incontents { @SubSectionInContents }
+ contentsindent { 3f }
+ numbers { @SubSectionNumbers }
+ attachnum { @SubSectionList&&preceding @Tagged @Tag }
+ retrievenum { @SubSectionList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SectionShortNum }
+ majornum {}
+ majortitle {}
+ intheorems { @SubSectionNumInTheorems }
+ indisplays { @SubSectionNumInDisplays }
+ infigures { @SubSectionNumInFigures }
+ intables { @SubSectionNumInTables }
+ inrunners { @SubSectionNumInRunners }
+ @Body
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SectionHeadingFont }
+ headingbreak { @SectionHeadingBreak }
+ headingformat { @Num @SectionHeadingFormat @Body }
+ incontents { @SectionInContents }
+ contentsindent { 0f }
+ numbers { @SectionNumbers }
+ attachnum { @SectionList&&preceding @Tagged @Tag }
+ retrievenum { @SectionList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SectionPrefix }
+ majornum {}
+ majortitle {}
+ intheorems { @SectionNumInTheorems }
+ indisplays { @SectionNumInDisplays }
+ infigures { @SectionNumInFigures }
+ intables { @SectionNumInTables }
+ inrunners { @SectionNumInRunners }
+ @Body
+
+ }
+
+
+ #######################################################################
+ # #
+ # Appendices. #
+ # #
+ #######################################################################
+
+ export @BeginSubAppendices @EndSubAppendices @SubAppendix
+ def @Appendix force into { @AppendixList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+ def @EndSubAppendicesPlace { @Galley }
+
+ def @EndSubAppendices force into { @EndSubAppendicesPlace&&preceding }
+ {}
+
+ macro @BeginSubAppendices
+ {
+ //@SubAppendixGap @SubAppendixList @FirstSubAppendixNumber
+ // @EndSubAppendicesPlace //
+ }
+
+ def @AppendixShortNum
+ {
+ @AppendixNumbers @Then {
+ @BypassNumber @Dft {
+ @AppendixNumbers @Num @AppendixList&&@Tag @Open { num }
+ }
+ }
+ }
+
+ def @AppendixLongNum
+ {
+ @AppendixNumbers @Then {
+ @InitialLanguage @Language {
+ appendix @WordVal @AppendixWord @AppendixShortNum
+ }
+ }
+ }
+
+ export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix
+ def @SubAppendix force into { @SubAppendixList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ def @EndSubSubAppendicesPlace { @Galley }
+
+ def @EndSubSubAppendices force into
+ { @EndSubSubAppendicesPlace&&preceding }
+ {}
+
+ macro @BeginSubSubAppendices
+ {
+ //@SubSubAppendixGap
+ @SubSubAppendixList @FirstSubSubAppendixNumber
+ // @EndSubSubAppendicesPlace //
+ }
+
+ def @SubAppendixShortNum
+ {
+ @SubAppendixNumbers @Then {
+ @BypassNumber @Dft {
+ @AppendixShortNum @Join @SubAppendixNumbers @Num
+ { @SubAppendixList&&@Tag @Open { num } }
+ }
+ }
+ }
+
+ def @SubSubAppendix force into { @SubSubAppendixList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubSubAppendixHeadingFont }
+ headingbreak { @SubSubAppendixHeadingBreak }
+ headingformat { @Num @SubSubAppendixHeadingFormat @Body }
+ incontents { @SubSubAppendixInContents }
+ contentsindent { 6f }
+ numbers { @SubSubAppendixNumbers }
+ attachnum { @SubSubAppendixList&&preceding @Tagged @Tag }
+ retrievenum { @SubSubAppendixList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @SubAppendixShortNum }
+ majornum {}
+ majortitle {}
+ intheorems { @SubSubAppendixNumInTheorems }
+ indisplays { @SubSubAppendixNumInDisplays }
+ infigures { @SubSubAppendixNumInFigures }
+ intables { @SubSubAppendixNumInTables }
+ inrunners { @SubSubAppendixNumInRunners }
+ @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @SubAppendixHeadingFont }
+ headingbreak { @SubAppendixHeadingBreak }
+ headingformat { @Num @SubAppendixHeadingFormat @Body }
+ incontents { @SubAppendixInContents }
+ contentsindent { 3f }
+ numbers { @SubAppendixNumbers }
+ attachnum { @SubAppendixList&&preceding @Tagged @Tag }
+ retrievenum { @SubAppendixList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @AppendixShortNum }
+ majornum {}
+ majortitle {}
+ intheorems { @SubAppendixNumInTheorems }
+ indisplays { @SubAppendixNumInDisplays }
+ infigures { @SubAppendixNumInFigures }
+ intables { @SubAppendixNumInTables }
+ inrunners { @SubAppendixNumInRunners }
+ @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @AppendixHeadingFont }
+ headingbreak { @AppendixHeadingBreak }
+ headingformat { @Num @AppendixHeadingFormat @Body }
+ incontents { @AppendixInContents }
+ contentsindent { 0f }
+ word { appendix @WordVal @AppendixWord }
+ numbers { @AppendixNumbers }
+ attachnum { @AppendixList&&preceding @Tagged @Tag }
+ retrievenum { @AppendixList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @AppendixPrefix }
+ majornum {}
+ majortitle {}
+ intheorems { @AppendixNumInTheorems }
+ indisplays { @AppendixNumInDisplays }
+ infigures { @AppendixNumInFigures }
+ intables { @AppendixNumInTables }
+ inrunners { Yes }
+ @Body
+ }
+
+@End @ReportSetup
diff --git a/include/russian b/include/russian
new file mode 100644
index 0000000..d0f5a53
--- /dev/null
+++ b/include/russian
@@ -0,0 +1,10 @@
+#################################################################
+# #
+# russian #
+# #
+# This file includes everything you need for Russian. #
+# #
+#################################################################
+
+# Commented out because these fonts are not distributed with Lout.
+# @SysInclude { russian.fd }
diff --git a/include/russian.fd b/include/russian.fd
new file mode 100644
index 0000000..f145530
--- /dev/null
+++ b/include/russian.fd
@@ -0,0 +1,38 @@
+##################################################################################################################
+# #
+# Russian font definitions. Use a very wide window to see them clearly. #
+# #
+# Lout font Lout font PostScript PostScript font metrics Lout character Recode/ #
+# family name face name font name (formerly .AFM) file name mapping file NoRecode #
+# #
+##################################################################################################################
+
+fontdef Academy Base { Academy Aca koi8r.LCM Recode }
+fontdef Academy Slope { Academy-Italic Aca-It koi8r.LCM Recode }
+fontdef Academy Bold { Academy-Bold Aca-Bd koi8r.LCM Recode }
+fontdef Academy BoldSlope { Academy-Italic Aca-It koi8r.LCM Recode }
+fontdef Academy Italic { Academy-Italic Aca-It koi8r.LCM Recode }
+
+fontdef Antiqua Base { Antiqua Ant koi8r.LCM Recode }
+fontdef Antiqua Slope { Antiqua-Italic Ant-It koi8r.LCM Recode }
+fontdef Antiqua Bold { Antiqua-Bold Ant-Bd koi8r.LCM Recode }
+fontdef Antiqua BoldSlope { Antiqua-Italic Ant-It koi8r.LCM Recode }
+fontdef Antiqua Italic { Antiqua-Italic Ant-It koi8r.LCM Recode }
+
+fontdef College Base { College Col koi8r.LCM Recode }
+fontdef College Slope { College-Italic Col-It koi8r.LCM Recode }
+fontdef College Bold { College-Bold Col-Bd koi8r.LCM Recode }
+fontdef College BoldSlope { College-Italic Col-It koi8r.LCM Recode }
+fontdef College Italic { College-Italic Col-It koi8r.LCM Recode }
+
+fontdef Magazine Base { Magazine Mag koi8r.LCM Recode }
+fontdef Magazine Slope { Magazine-Italic Mag-It koi8r.LCM Recode }
+fontdef Magazine Bold { Magazine-Bold Mag-Bd koi8r.LCM Recode }
+fontdef Magazine BoldSlope { Magazine-Italic Mag-It koi8r.LCM Recode }
+fontdef Magazine Italic { Magazine-Italic Mag-It koi8r.LCM Recode }
+
+fontdef Textbook Base { Textbook Txt koi8r.LCM Recode }
+fontdef Textbook Slope { Textbook-Italic Txt-It koi8r.LCM Recode }
+fontdef Textbook Bold { Textbook-Bold Txt-Bd koi8r.LCM Recode }
+fontdef Textbook BoldSlope { Textbook-Italic Txt-It koi8r.LCM Recode }
+fontdef Textbook Italic { Textbook-Italic Txt-It koi8r.LCM Recode }
diff --git a/include/slides b/include/slides
new file mode 100644
index 0000000..7833f60
--- /dev/null
+++ b/include/slides
@@ -0,0 +1,299 @@
+###############################################################################
+# #
+# Lout setup file for overhead transparencies #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# @SysInclude commands for standard packages. #
+# #
+###############################################################################
+
+ @SysInclude { fontdefs } # font definitions
+ @SysInclude { langdefs } # language definitions
+ @SysInclude { bsf } # BasicSetup package
+ @SysInclude { dsf } # DocumentSetup package
+ @SysInclude { slidesf } # OverheadSetup extension
+
+
+###############################################################################
+# #
+# @Include command for reading personal definitions from current directory. #
+# #
+###############################################################################
+
+ @Include { mydefs }
+
+
+###############################################################################
+# #
+# The @BasicSetup @Use clause - basics, lists, paragraphs, displays. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @BasicSetup
+ # @InitialFont { Times Base 12p } # initial font
+ @InitialFont { Times Base 20p } # initial font
+ # @InitialBreak {{adjust 1.2fx hyphen} @OrIfPlain {ragged 1fx nohyphen}}
+ @InitialBreak { ragged 1.20fx nohyphen} # initial break
+ # @InitialSpace { lout } # initial space style
+ # @InitialLanguage { English } # initial language
+ # @InitialColour { black } # initial colour
+ # @OptimizePages { No } # optimize page breaks?
+ # @HeadingFont { Bold } # font for @Heading
+ # @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs
+ # @ParaIndent { 2.00f @OrIfPlain 5s } # first-line indent for @PP
+ # @DisplayGap { 1.00v @OrIfPlain 1f } # gap above, below displays
+ # @DisplayIndent { 2.00f @OrIfPlain 5s } # @IndentedDisplay indent
+ # @DefaultIndent { 0.5rt } # @Display indent
+ # @DisplayNumStyle { (num) } # style of display numbers
+ # @WideIndent { 4.00f @OrIfPlain 10s } # @WideTaggedList indent
+ # @VeryWideIndent { 8.00f @OrIfPlain 20s } # @VeryWideTaggedList indent
+ # @ListOuterGap { 1.00v @OrIfPlain 1f } # gap before, after lists
+ # @ListGap { 1.00v @OrIfPlain 1f } # gap between list items
+ # @ListIndent { 0s } # indent of list items
+ # @ListRightIndent { 0s } # right indent of list items
+ # @ListLabelWidth { 2.00f @OrIfPlain 5s } # width allowed for list tags
+ # @NumberSeparator { . } # separates nums like 2.3.7
+}
+
+
+###############################################################################
+# #
+# The @DocumentSetup @Use clause - page layout plus figures, tables, etc. #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @DocumentSetup
+ # @PageType { A4 @OrIfPlain Other} # page type (width, height)
+ # @PageWidth { 80s } # page width if type Other
+ # @PageHeight { 66f } # page height if type Other
+ # @PageOrientation { Portrait } # Portrait, Landscape, etc.
+ # @PageBackground { } # background of each page
+ # @TopMargin { 2.5c @OrIfPlain 6f } # top margin of all pages
+ # @FootMargin { 2.5c @OrIfPlain 6f } # bottom margin of all pages
+ @FootMargin { 5.00c } # bottom margin of all pages
+ # @OddLeftMargin { 2.5c @OrIfPlain 10s } # left margin of odd pages
+ # @OddRightMargin { 2.5c @OrIfPlain 10s } # right margin of odd pages
+ # @EvenLeftMargin { 2.5c @OrIfPlain 10s } # left margin of even pages
+ # @EvenRightMargin { 2.5c @OrIfPlain 10s } # right margin of even pages
+ # @PageBoxType { None } # None Box CurveBox ShadowBox
+ # @PageBoxMargin { 1.00c } # page box margin
+ # @PageBoxLineWidth { } # page box line thickness
+ # @PageBoxPaint { none } # page box paint
+ # @PageBoxShadow { 0.60c } # shadow margin if ShadowBox
+ # @ColumnNumber { 1 } # number of columns (1 to 10)
+ # @ColumnGap { 1.00c @OrIfPlain 6s } # column gap
+ # @FigureLocation { PageTop } # default figure location
+ # @TableLocation { PageTop } # default table location
+ # @FigureFormat { @CC @Body } # default figure format
+ # @TableFormat { @CC @Body } # default table format
+ # @FigureWord { figure } # "Figure" word else anything
+ # @TableWord { table } # "Table" word else anything
+ # @FigureNumbers { Arabic } # method of numbering figures
+ # @TableNumbers { Arabic } # method of numbering tables
+ # @FigureCaptionPos { Below } # Above or Below
+ # @TableCaptionPos { Below } # Above or Below
+ # @CaptionFont { } # figure, table caption font
+ # @CaptionBreak { } # figure, table caption break
+ # @CaptionFormat { @B { number @DotSep @OneCol } } # figure, table caption format
+ # @MakeFigureContents { No } # list of figures at start
+ # @MakeTableContents { No } # list of tables at start
+ # @MakeContents { No } # make contents? Yes or No
+ # @ContentsGap { 0.20v @OrIfPlain 0f } # extra gap above minor entry
+ @ContentsGapAbove { 0.00v @OrIfPlain 1f } # extra gap above major entry
+ # @ContentsGapBelow { 0.00v @OrIfPlain 0f } # extra gap below major entry
+ @ContentsFont { Base } # font for major entry
+ # @ContentsPartGapAbove { 1.00v @OrIfPlain 1f } # extra gap above `part' entry
+ # @ContentsPartGapBelow { 0.00v @OrIfPlain 0f } # extra gap below `part' entry
+ # @ContentsFormat { number @DotSep title } # contents entry format
+ # @ContentsLeader { .. } # leader symbol in contents
+ # @ContentsLeaderGap { 4s @OrIfPlain 2s } # gap between leaders
+ # @ContentsRightWidth { 3f @OrIfPlain 6s } # page numbers column width
+ # @MakeReferences { Yes } # make references? Yes or No
+ # @RefCiteStyle { [cite] } # citation style
+ # @RefCiteLabels { @RefNum } # citation items
+ # @RefNumbers { Arabic } # reference numbers
+ # @RefListFormat { Labels } # NoLabels, Labels, etc.
+ # @RefListLabels { [@RefNum] } # ref list label format
+ # @RefListTitle { references } # title of reference list
+ # @ChapRefListTitle { references } # title of chapter ref list
+ # @RefListIndent { 0s } # indent to left of labels
+ # @RefListRightIndent { 0s } # indent to right of items
+ # @RefListGap { @ListGap } # gap between ref list items
+ # @RefListFont { } # font used in reference list
+ # @RefListBreak { } # break style of ref list
+ # @RefListLabelWidth { @ListLabelWidth } # Labels column width
+ # @RefListSortKey { @Tag } # sorting key
+ # @MakeIndex { No } # make index? Yes or No
+ # @IndexFont { } # index entries font
+ # @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexColumnNumber { 2 } # index columns (1 to 10)
+ # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap
+ # @MakeIndexA { No } # make index A? Yes or No
+ # @IndexAFont { } # index A entries font
+ # @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexAColumnNumber { 2 } # index A columns (1 to 10)
+ # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap
+ # @MakeIndexB { No } # make index B? Yes or No
+ # @IndexBFont { } # index B entries font
+ # @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # and break
+ # @IndexBColumnNumber { 2 } # index B columns (1 to 10)
+ # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap
+ # @TopGap { 0.75c @OrIfPlain 2f } # gap between figures
+ # @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text
+ # @FootNoteNumbers { Arabic } # footnote numbers
+ # @FootNoteThrough { No } # numbered through chapter?
+ # @FootNoteLocation { ColFoot } # where the footnote appears
+ # @FootNoteFont { 0.80f } # font for footnotes
+ # @FootNoteBreak { 1.2fx @OrIfPlain 1fx } # break for footnotes
+ # @FootNoteFormat { { number &0.05f } @Insert body } # footnote format
+ # @FootLen { 2.00c @OrIfPlain 10s } # length of footnote line
+ # @FootAboveGap { @DisplayGap } # gap above footnote line
+ # @FootGap { 0.20c @OrIfPlain 1fx } # gap between footnotes
+ # @MarginNoteFont { 0.80f } # font of margin notes
+ # @MarginNoteBreak { ragged 1.10fx } # break style of margin notes
+ # @MarginNoteHGap { 0.5c } # horizontal gap to notes
+ # @MarginNoteVGap { @DisplayGap } # min vertical gap between
+ # @MarginNoteWidth { 1.50c } # width of margin notes
+ # @EndNoteNumbers { Arabic } # endnote numbers
+ # @EndNoteFont { 0.80f } # font of endnotes
+ # @EndNoteBreak { 1.2fx @OrIfPlain 1fx } # break for endnotes
+ # @EndNoteFormat { { number &0.05f } @Insert body } # endnote format
+ # @EndNoteGap { 0.20c @OrIfPlain 1f } # gap between endnotes
+ # @TheoremWord { theorem } # "Theorem" word, etc.
+ # @TheoremTitleFormat { (title) } # only if title present
+ # @TheoremFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @DefinitionWord { definition } # "Definition" word, etc.
+ # @DefinitionTitleFormat { (title) } # only if title present
+ # @DefinitionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ClaimWord { claim } # "Claim" word, etc.
+ # @ClaimTitleFormat { (title) } # only if title present
+ # @ClaimFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @PropositionWord { proposition } # "Proposition" word, etc.
+ # @PropositionTitleFormat { (title) } # only if title present
+ # @PropositionFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @LemmaWord { lemma } # "Lemma" word, etc.
+ # @LemmaTitleFormat { (title) } # only if title present
+ # @LemmaFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @CorollaryWord { corollary } # "Corollary" word, etc.
+ # @CorollaryTitleFormat { (title) } # only if title present
+ # @CorollaryFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ExampleWord { example } # "Example" word, etc.
+ # @ExampleTitleFormat { (title) } # only if title present
+ # @ExampleFormat { {@B { word @NumSep number title: } &2s} @Insert body }
+ # @ProofWord { proof } # "Proof" word, etc.
+ # @PageHeaders { Simple } # None Simple Titles NoTitles
+ @PageHeaders { Titles } # None Simple Titles NoTitles
+ # @PageNumbers { Arabic } # page numbers
+ # @FirstPageNumber { 1 } # number of first page
+ # @IntroPageNumbers { Roman } # intro page numbers
+ # @IntroFirstPageNumber{ 1 } # number of first intro page
+ # @StructPageNums { No } # make structured page numbers
+
+ # @OddTop { @Centre{- @PageNum -} } # Simple page headers
+ # @OddFoot { @Null }
+ # @EvenTop { @Centre{- @PageNum -} }
+ # @EvenFoot { @Null }
+ # @StartOddTop { @Null }
+ # @StartOddFoot { @Null }
+ # @StartEvenTop { @Null }
+ # @StartEvenFoot { @Null }
+ # @IntroOddTop { @Null }
+ # @IntroOddFoot { @Centre @PageNum }
+ # @IntroEvenTop { @Null }
+ # @IntroEvenFoot { @Centre @PageNum }
+ # @IntroStartOddTop { @Null }
+ # @IntroStartOddFoot { @Null }
+ # @IntroStartEvenTop { @Null }
+ # @IntroStartEvenFoot { @Null }
+
+ # Titles, NoTitles headers
+ # @RunningOddTop { @I {@MinorNum @DotSep @MinorTitle} @Right @B @PageNum }
+ @RunningOddTop { 8p @Font {@MajorTitle @MinorNum @Right @PageNum} }
+ # @RunningOddFoot { @Null }
+ @RunningOddFoot { @Null }
+ # @RunningEvenTop { @B @PageNum @Right @I {@MajorNum @DotSep @MajorTitle} }
+ @RunningEvenTop { 8p @Font {@MajorTitle @MinorNum @Right @PageNum} }
+ # @RunningEvenFoot { @Null }
+ @RunningEvenFoot { @Null }
+ # @RunningStartOddTop { @Null }
+ @RunningStartOddTop { 8p @Font { @MajorTitle @MinorNum @Right @PageNum } }
+ # @RunningStartOddFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ @RunningStartOddFoot { @Null }
+ # @RunningStartEvenTop { @Null }
+ @RunningStartEvenTop { 8p @Font { @MajorTitle @MinorNum @Right @PageNum } }
+ # @RunningStartEvenFoot { @Centre { Bold 0.8f } @Font @PageNum }
+ @RunningStartEvenFoot { @Null }
+ # @RunningIntroOddTop { @Null }
+ # @RunningIntroOddFoot { @Right @PageNum }
+ # @RunningIntroEvenTop { @Null }
+ # @RunningIntroEvenFoot { @PageNum }
+ # @RunningIntroStartOddTop { @Null }
+ # @RunningIntroStartOddFoot { @Null }
+ # @RunningIntroStartEvenTop { @Null }
+ # @RunningIntroStartEvenFoot { @Null }
+}
+
+
+###############################################################################
+# #
+# The @OverheadSetup @Use clause - options specific to overheads. #
+# #
+###############################################################################
+
+@Use { @OverheadSetup
+ # @DateLine { No } # No, Yes, or a date
+ # @ContentsWord { contents } # word for "Contents"
+ # @LectureWord { lecture } # word for "Lecture"
+ # @OverheadWord { } # word for "Overhead"
+ # @LectureNumbers { Arabic } # kind of lecture numbers
+ # @FirstLectureNumber { 1 } # first lecture num
+ # @OverheadNumbers { Arabic } # kind of overhead numbers
+ # @FirstOverheadNumber { 1 } # first overhead num
+ # @TitlePageFont { Helvetica Base 1.5f } # title page font
+ # @LectureHeadingFont { Bold 1.20f } # lecture head font
+ # @LectureHeadingBreak { clines 1.2fx nohyphen } # lecture head break
+ # @LectureHeadingFormat { @Centre number @DP @Centre title @DP }
+ # @AboveLectureGap { 3.0f } # gap above lec head
+ # @OverheadHeadingFont { Bold } # overhead head font
+ # @OverheadHeadingBreak { 1.2fx nohyphen } # overhead head break
+ # @OverheadHeadingFormat { @Centre title @DP } # overhead head format
+ # @OverheadFormat { @Body } # overhead body format
+ # @AboveOverheadGap { 1.0f } # gap above over head
+ # @LectureInContents { Yes } # add lectures to contents
+ # @OverheadInContents { No } # add overheads to contents
+ # @ReferencesInContents { Yes } # add references to contents
+ # @LectureNumInTheorems { Yes } # theorem num has lecture num
+ # @OverheadNumInTheorems { No } # theorem num has overhead num
+ # @LectureNumInDisplays { Yes } # display num has lecture num
+ # @OverheadNumInDisplays { No } # display num has overhead num
+ # @LectureNumInFigures { Yes } # figure num has lecture num
+ # @OverheadNumInFigures { No } # figure num has overhead num
+ # @LectureNumInTables { Yes } # table num has lecture num
+ # @OverheadNumInTables { No } # table num has overhead num
+ # @LectureNumInRunners { Yes } # running head has lecture num
+ # @OverheadNumInRunners { Yes } # running head has overhd num
+ # @LecturePrefix { } # for structured page nums
+ # @OverheadPrefix { } # for structured page nums
+}
+
+
+###############################################################################
+# #
+# @Database (and @SysDatabase) clauses go here. #
+# #
+###############################################################################
+
+@SysDatabase @RefStyle { refstyle } # reference printing styles
diff --git a/include/slidesf b/include/slidesf
new file mode 100644
index 0000000..e39f804
--- /dev/null
+++ b/include/slidesf
@@ -0,0 +1,371 @@
+
+###########################################################################
+# #
+# @OverheadSetup extension to @DocumentSetup. #
+# #
+# Jeffrey H. Kingston #
+# August 1994 #
+# #
+# This package extends DocumentSetup with definitions for overheads. #
+# #
+###########################################################################
+
+extend @BasicSetup @DocumentSetup
+export @OverheadTransparencies @Lecture @Overhead
+def @OverheadSetup
+ named @DateLine { No }
+ named @ContentsWord { contents }
+ named @LectureWord { lecture }
+ named @OverheadWord { }
+ named @LectureNumbers { Arabic }
+ named @FirstLectureNumber { 1 }
+ named @OverheadNumbers { Arabic }
+ named @FirstOverheadNumber { 1 }
+ named @TitlePageFont { Helvetica Base }
+ named @LectureHeadingFont { Bold 1.20f }
+ named @LectureHeadingBreak { 1.2fx nohyphen }
+ named @LectureHeadingFormat
+ left number right title { @Centre number @DP @Centre title @DP }
+ named @AboveLectureGap { 3.0f }
+ named @OverheadHeadingFont { Bold }
+ named @OverheadHeadingBreak { 1.2fx nohyphen }
+ named @OverheadHeadingFormat
+ left number right title { @Centre title @DP }
+ named @OverheadFormat
+ named @II right x { |@DisplayIndent x | }
+ named @QQ right x { |@DisplayIndent x |@DisplayIndent }
+ named @CC right x { |0.5rt x | }
+ named @RR right x { |1.0rt x | }
+ right @Body
+ { @Body }
+ named @AboveOverheadGap { 1.0f }
+ named @LectureInContents { Yes }
+ named @OverheadInContents { No }
+ named @ReferencesInContents { Yes }
+ named @LectureNumInTheorems { Yes }
+ named @OverheadNumInTheorems { No }
+ named @LectureNumInDisplays { Yes }
+ named @OverheadNumInDisplays { No }
+ named @LectureNumInFigures { Yes }
+ named @OverheadNumInFigures { No }
+ named @LectureNumInTables { Yes }
+ named @OverheadNumInTables { No }
+ named @LectureNumInRunners { Yes }
+ named @OverheadNumInRunners { Yes }
+ named @LecturePrefix { }
+ named @OverheadPrefix { }
+@Begin
+
+ #######################################################################
+ # #
+ # Symbols for passing full title to running headers. #
+ # #
+ #######################################################################
+
+ export @Val
+ def @StoreTitle left @Tag named @Val {} { @Null }
+
+ def @SaveTitle right x { save @StoreTitle @Val { x } }
+
+ def @GetTitle { @StoreTitle&&save @Open { @Val } }
+
+
+ #######################################################################
+ # #
+ # Lists of lectures and overheads. #
+ # #
+ #######################################################################
+
+ export num
+ def @LectureList named @Tag {} right num
+ {
+ @Galley
+ //1.1b @LectureList @Next num
+ }
+
+ export num
+ def @OverheadsList named @Tag {} right num
+ {
+ @Galley
+ //1.1b @OverheadsList @Next num
+ }
+
+ export num
+ def @LecOverheadsList named @Tag {} right num
+ {
+ @Galley
+ //1.1b @LecOverheadsList @Next num
+ }
+
+
+ #######################################################################
+ # #
+ # @Full - this sends text to a full-width place. #
+ # #
+ #######################################################################
+
+ def @Full force into { @FullPlace&&following } right x { x }
+
+
+ #######################################################################
+ # #
+ # @OverheadTransparencies. #
+ # #
+ #######################################################################
+
+ def @OverheadTransparencies
+ named @Title {}
+ named @RunningTitle { dft }
+ named @Author {}
+ named @Institution {}
+ named @DateLine { @DateLine }
+ named @InitialFont { @InitialFont }
+ named @InitialBreak { @InitialBreak }
+ named @InitialSpace { @InitialSpace }
+ named @InitialLanguage { @InitialLanguage }
+ named @PageOrientation { @PageOrientation }
+ named @PageHeaders { @PageHeaders }
+ named @FirstPageNumber { @FirstPageNumber }
+ named @FirstOverheadNumber { @FirstOverheadNumber }
+ named @FirstLectureNumber { @FirstLectureNumber }
+ named @OptimizePages { @OptimizePages }
+ {
+
+ def @DatePart
+ {
+ @DateLine @Case {
+ No @Yield { @Null }
+ Yes @Yield { |0.5rt @Date | }
+ else @Yield { |0.5rt @DateLine | }
+ }
+ }
+
+ def @TitlePart
+ {
+ @TitlePageFont @Font @InitialBreak @Break
+ @InitialSpace @Space clines @Break {
+ //0.5i |0.5rt 1.5f @Font @InitialBreak @Break
+ @InitialSpace @Space clines @Break @Title |
+ //1i |0.5rt clines @Break @Author |
+ //0.5i |0.5rt clines @Break @I @Institution |
+ //0.5i @DatePart
+ }
+ }
+
+ def @ContentsPart
+ {
+ @DP |0.5rt @LectureHeadingFont @Font @LectureHeadingBreak @Break
+ @LectureHeadingFormat { contents @WordVal @ContentsWord } |
+ @DP @ContentsSection
+ }
+
+ def @ReferencesPart
+ named @Tag {}
+ {
+ @DP |0.5rt @LectureHeadingFont @Font @LectureHeadingBreak @Break
+ @LectureHeadingFormat { @RefHeading @RefListTitle } |
+ // @PageMark @Tag
+ // @ReferencesInContents @ContentsEntry
+ title { @RefHeading @RefListTitle }
+ pagenum { @PageOf @Tag }
+ // Start @Runner @MajorTitle { @GetTitle }
+ @DP @ReferencesSection
+ // NonStart @Runner @MajorTitle { @GetTitle }
+ }
+
+ def @OverheadsBody force into { @ColPlace&&preceding }
+ named @Optimize { @OptimizePages }
+ {
+ @Title @Case {
+ "" @Yield @Null
+ else @Yield @TitlePart
+ }
+ //1.1b @MakeContents @Case {
+ { Yes Bypass } @Yield @ContentsPart
+ else @Yield @Null
+ }
+ // Start @Runner @MajorTitle { @GetTitle }
+ //1.1b @OverheadsList @FirstOverheadNumber
+ //1.1b @LectureList @FirstLectureNumber
+ //1.1b @ReferencesPart
+ }
+
+ @InitialFont @Font @InitialBreak @Break @InitialLanguage @Language
+ @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour
+ {
+ @SaveTitle {
+ @InitialLanguage @Language { @RunningTitle @Dft @Title }
+ }
+
+ // Yes @BeginAllCounters {}
+ // Yes @BeginDisplayCounter {}
+ // Yes @BeginFigureCounter {}
+ // Yes @BeginFigureCounter {}
+ // @PageList
+ @ColumnNumber { 1 }
+ @PageHeaders { @PageHeaders }
+ @Orient { @PageOrientation }
+ extra { Yes }
+ @FirstPageNumber
+ // @OverheadsBody
+ // Start @Runner
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # Overheads. #
+ # #
+ #######################################################################
+
+ def @Overhead force into { @OverheadsList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @Format
+ named @II right x { |@DisplayIndent x | }
+ named @QQ right x { |@DisplayIndent x |@DisplayIndent }
+ named @CC right x { |0.5rt x | }
+ named @RR right x { |1.0rt x | }
+ right @Body { @OverheadFormat @Body }
+ named @InitialLanguage {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ majortitle { @GetTitle }
+ runningtitle { @RunningTitle }
+ aboveheadinggap { @AboveOverheadGap }
+ headingfont { @OverheadHeadingFont }
+ headingbreak { @OverheadHeadingBreak }
+ headingformat { @Num @OverheadHeadingFormat @Body }
+ incontents { @OverheadInContents }
+ contentsindent { 0f }
+ numbers { @OverheadNumbers }
+ attachnum { @OverheadsList&&preceding @Tagged @Tag }
+ retrievenum { @OverheadsList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ pnprefix { @OverheadPrefix }
+ intheorems { @OverheadNumInTheorems }
+ indisplays { @OverheadNumInDisplays }
+ infigures { @OverheadNumInFigures }
+ intables { @OverheadNumInTables }
+ sendheader { @Full @Body }
+ innergap { @DisplayGap }
+ inrunners { @OverheadNumInRunners }
+ @Format @Body
+ }
+
+
+ #######################################################################
+ # #
+ # Lectures containing overheads. #
+ # #
+ #######################################################################
+
+ export @BeginOverheads @EndOverheads @Overhead
+ def @Lecture force into { @LectureList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @InitialLanguage {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+ def @EndOverheadsPlace { @Galley }
+
+ def @EndOverheads force into { @EndOverheadsPlace&&preceding }
+ {}
+
+ macro @BeginOverheads
+ { //1.1b @LecOverheadsList 1
+ // @EndOverheadsPlace //
+ }
+
+ def @LectureNum
+ {
+ @LectureNumbers @Then {
+ @BypassNumber @Dft {
+ @LectureNumbers @Num @LectureList&&@Tag @Open { num }
+ }
+ }
+ }
+
+ def @Overhead force into { @LecOverheadsList&&preceding }
+ named @Tag {}
+ named @Title {}
+ named @RunningTitle { dft }
+ named @Format
+ named @II right x { |@DisplayIndent x | }
+ named @QQ right x { |@DisplayIndent x |@DisplayIndent }
+ named @CC right x { |0.5rt x | }
+ named @RR right x { |1.0rt x | }
+ right @Body { @OverheadFormat @Body }
+ named @InitialLanguage { @InitialLanguage }
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Minor }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ headingfont { @OverheadHeadingFont }
+ headingbreak { @OverheadHeadingBreak }
+ headingformat { @Num @OverheadHeadingFormat @Body }
+ incontents { @OverheadInContents }
+ contentsindent { 2f }
+ numbers { @OverheadNumbers }
+ attachnum { @LecOverheadsList&&preceding @Tagged @Tag }
+ retrievenum { @LecOverheadsList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ prefix { @LectureNum }
+ majornum { @LectureNum }
+ majortitle { @GetTitle }
+ intheorems { @OverheadNumInTheorems }
+ indisplays { OverheadNumInDisplays }
+ infigures { @OverheadNumInFigures }
+ inrunners { @OverheadNumInRunners }
+ @Format @Body
+
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { @Title }
+ runningtitle { @RunningTitle }
+ aboveheadinggap { @AboveLectureGap }
+ headingfont { @LectureHeadingFont }
+ headingbreak { @LectureHeadingBreak }
+ headingformat { @Num @LectureHeadingFormat @Body }
+ incontents { @LectureInContents }
+ contentsindent { 0f }
+ word { lecture @WordVal @LectureWord }
+ numbers { @LectureNumbers }
+ attachnum { @LectureList&&preceding @Tagged @Tag }
+ retrievenum { @LectureList&&@Tag @Open { num } }
+ bypassnumber { @BypassNumber }
+ pnprefix { @LecturePrefix }
+ majortitle { @GetTitle }
+ intheorems { @LectureNumInTheorems }
+ indisplays { @LectureNumInDisplays }
+ infigures { @LectureNumInFigures }
+ intables { @LectureNumInTables }
+ sendheader { @Full @Body }
+ innergap { @DisplayGap }
+ inrunners { @LectureNumInRunners }
+ @Body
+
+ }
+
+@End @OverheadSetup
diff --git a/include/tab b/include/tab
new file mode 100644
index 0000000..02311d4
--- /dev/null
+++ b/include/tab
@@ -0,0 +1,29 @@
+###############################################################################
+# #
+# Lout setup file for table printing #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+# This package is OBSOLETE; use tbl instead. #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# The @SysInclude { tabf } line #
+# #
+# This line causes Lout to read the definitions for tables, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { tabf }
+
+
+###############################################################################
+# #
+# This package does not offer default options that can be changed. #
+# #
+###############################################################################
diff --git a/include/tabf b/include/tabf
new file mode 100644
index 0000000..bc1e0c8
--- /dev/null
+++ b/include/tabf
@@ -0,0 +1,936 @@
+
+###############################################################################
+# #
+# Lout @Tab package for formatting tables (Version 2.0) #
+# #
+# Version 1.0 by Jeffrey H. Kingston, September 1991. #
+# Version 2.0 by Jeffrey H. Kingston, 22 December 1992. #
+# Version 3.0 by Jeffrey H. Kingston, 13 September 1993. #
+# #
+# The only change between Versions 2 and 3 is to make the linewidth #
+# option accept a Lout length rather than a Fig length. See the User's #
+# Guide for user information. #
+# #
+###############################################################################
+
+@SysPrependGraphic { "tabf.lpg" }
+
+export @CC @RR @Rule @DoubleRule @Line @DoubleLine @NP
+ @Rowa @Rowb @Rowc @Rowd @Rowe @Rowf @Rowg @Rowh @Rowi @Rowj
+ @MarkRowa @MarkRowb @MarkRowc @MarkRowd @MarkRowe @MarkRowf
+ @MarkRowg @MarkRowh @MarkRowi @MarkRowj
+ @FirstRowa @FirstRowb @FirstRowc @FirstRowd @FirstRowe @FirstRowf
+ @FirstRowg @FirstRowh @FirstRowi @FirstRowj
+
+def @Tab
+
+ named above { no }
+ named below { no }
+ named between { no }
+ named side { no }
+ named hmargin { 0.3c }
+ named vmargin {
+ @BackEnd @Case {
+ PostScript @Yield 0.2v
+ PDF @Yield 0.2v # VT: PDF case added
+ PlainText @Yield 0.5v
+ }
+ }
+
+ named linewidth
+ named c left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" cm" }
+ PDF @Yield { "__mul(__cm, "x")" }
+ }
+ }
+ named i left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" in" }
+ PDF @Yield { "__mul(__in, "x")" }
+ }
+ }
+ named e left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" em" }
+ PDF @Yield { "__mul(__em, "x")" }
+ }
+ }
+ named p left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" pt" }
+ PDF @Yield { "__mul(__pt, "x")" }
+ }
+ }
+ named f left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" ft" }
+ PDF @Yield { "__mul(__loutf, "x")" }
+ }
+ }
+ named s left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" sp" }
+ PDF @Yield { "__mul(__louts, "x")" }
+ }
+ }
+ named v left x {
+ @BackEnd @Case {
+ PostScript @Yield { x" vs" }
+ PDF @Yield { "__mul(__loutv, "x")" }
+ }
+ }
+ { 0.5p }
+
+ named @Fmta
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmtb
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmtc
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmtd
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmte
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmtf
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmtg
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmth
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmti
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ named @Fmtj
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named "!" precedence 10 left x named between { dft } right y {}
+ named "!!" precedence 10 left x right y {}
+ named "!!!" precedence 10 left x right y {}
+ named "@Over" precedence 11 left x right y { x // y }
+ named "," precedence 12 left x right y {}
+ named @Col precedence 12 right x {}
+ named @CC right x { clines @Break { & x & } }
+ named @RR right x { rlines @Break { & x & } }
+ {}
+
+ body @Body
+
+@Begin
+
+ macro @NP { /1.1b }
+
+ def @CC right x { clines @Break { & x & } }
+ def @RR right x { rlines @Break { & x & } }
+#
+# VT: these definitions have been modified for PDF support
+#
+ def @HSingle {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabhs }
+ PDF @Yield { "0 0 m __xsize 0 l" linewidth "w 0 J S" }
+ }
+ }
+
+ def @HSingleProject {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabhsp }
+ PDF @Yield { "0 0 m __xsize 0 l" linewidth "w 2 J S" }
+ }
+ }
+
+ def @HDouble {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabhd }
+ PDF @Yield { # dup dup
+ "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto
+ "0 __mul(3, " linewidth ") m __xsize __mul(3, " linewidth ") l" # 0 exch 3 mul moveto xsize exch 3 mul lineto
+ linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke
+ }
+ }
+ }
+
+ def @HDoubleBelow {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabhdb }
+ PDF @Yield { # dup dup
+ "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto
+ "0 __mul(-3, "linewidth") m __xsize __mul(-3, "linewidth") l" # 0 exch -3 mul moveto xsize exch -3 mul lineto
+ linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke
+ }
+ }
+ }
+
+ def @HDoubleNW {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabhdnw }
+ PDF @Yield { # dup dup dup dup
+ "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto
+ "__xsize __mul(3, "linewidth") m" # xsize exch 3 mul moveto
+ "__mul(-3, "linewidth") __mul(3, "linewidth") l" # -3 mul exch 3 mul lineto
+ "__mul(-3, "linewidth") 0 l" # -3 mul 0 lineto
+ linewidth "w 0 j 2 J S" # setlinewidth 0 setlinejoin 2 setlinecap stroke
+ }
+ }
+ }
+
+ def @HDoubleNE {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabhdne }
+ PDF @Yield { # dup dup dup dup
+ "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto
+ "0 __mul(3, "linewidth") m" # 0 exch 3 mul moveto
+ "__add(__xsize, __mul(3, "linewidth")) __mul(3, "linewidth") l" # 3 mul xsize add exch 3 mul lineto
+ "__add(__xsize, __mul(3, "linewidth")) 0 l" # 3 mul xsize add 0 lineto
+ linewidth "w 0 j 2 J S" # setlinewidth 0 setlinejoin 2 setlinecap stroke
+ }
+ }
+ }
+
+ def @HDoubleSW {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabhdsw }
+ PDF @Yield { # dup dup dup dup
+ "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto
+ "__xsize __mul(-3, "linewidth") m" # xsize exch -3 mul moveto
+ "__mul(-3, "linewidth") __mul(-3, "linewidth") l" # -3 mul exch -3 mul lineto
+ "__mul(-3, "linewidth") 0 l" # -3 mul 0 lineto
+ linewidth "w 0 j 2 J S" # setlinewidth 0 setlinejoin 2 setlinecap stroke
+ }
+ }
+ }
+
+ def @HDoubleSE {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabhdse }
+ PDF @Yield { # dup dup dup dup
+ "0 0 m __xsize 0 l" # 0 0 moveto xsize 0 lineto
+ "0 __mul(-3, "linewidth") m" # 0 exch -3 mul moveto
+ "__add(__xsize, __mul(-3, "linewidth")) __mul(-3, "linewidth") l" # 3 mul xsize add exch -3 mul lineto
+ "__add(__xsize, __mul( 3, "linewidth")) 0 l" # 3 mul xsize add 0 lineto
+ linewidth "w 0 j 2 J S" # setlinewidth 0 setlinejoin 2 setlinecap stroke
+ }
+ }
+ }
+
+ def @VSingle {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabvs }
+ PDF @Yield {
+ "0 0 m 0 __ysize l" # 0 0 moveto 0 ysize lineto
+ linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke
+ }
+ }
+ }
+
+ def @VDouble {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabvd }
+ PDF @Yield { # dup dup
+ "0 0 m 0 __ysize l" # 0 0 moveto 0 ysize lineto
+ "__mul(-3, "linewidth") 0 m __mul(-3, "linewidth") __ysize l" # -3 mul 0 moveto -3 mul ysize lineto
+ linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke
+ }
+ }
+ }
+
+ def @VDoubleRight {
+ @BackEnd @Case {
+ PostScript @Yield { linewidth ltabvdr }
+ PDF @Yield { # dup dup
+ "0 0 m 0 __ysize l" # 0 0 moveto 0 ysize lineto
+ "__mul(3, "linewidth") 0 m __mul(3, "linewidth") __ysize l" # 3 mul 0 moveto 3 mul ysize lineto
+ linewidth "w 0 J S" # setlinewidth 0 setlinecap stroke
+ }
+ }
+ }
+
+ def @MidHRule
+ left rule
+ right x
+ {
+ rule @Case
+ {
+ no @Yield { @OneCol x }
+ { yes single } @Yield { @HSingle @Graphic x }
+ { double doubleboxabove } @Yield { @HDouble @Graphic x }
+ doubleboxbelow @Yield { @HDoubleBelow @Graphic x }
+ }
+ }
+
+ def @LeftHRule
+ left rule
+ right x
+ {
+ rule @Case
+ {
+ no @Yield { @OneCol x }
+ { yes single } @Yield { @HSingleProject @Graphic x }
+ double @Yield { @HDouble @Graphic x }
+ doubleboxabove @Yield { @HDoubleNW @Graphic x }
+ doubleboxbelow @Yield { @HDoubleSW @Graphic x }
+ }
+ }
+
+ def @RightHRule
+ left rule
+ right x
+ {
+ rule @Case
+ {
+ no @Yield { @OneCol x }
+ { yes single } @Yield { @HSingleProject @Graphic x }
+ double @Yield { @HDouble @Graphic x }
+ doubleboxabove @Yield { @HDoubleNE @Graphic x }
+ doubleboxbelow @Yield { @HDoubleSE @Graphic x }
+ }
+ }
+
+ def @HSRule
+ left rule
+ {
+ rule @Case
+ {
+ no @Yield {}
+ { yes single } @Yield { @HSingle @Graphic {} }
+ double @Yield { @HDouble @Graphic {} }
+ doubleboxabove @Yield { @HDouble @Graphic {} }
+ doubleboxbelow @Yield { @HDoubleBelow @Graphic {} }
+ }
+ }
+
+ def @ZeroWidth
+ right x
+ { @OneCol { |0io x |0io }
+ }
+
+ def @Line
+ { single @HSRule
+ }
+
+ def @DoubleLine
+ { double @HSRule
+ }
+
+ def @Rule
+ {
+ @OneRow
+ {
+ @ZeroWidth @HSingle @Graphic { ^|hmargin }
+ / @Line /
+ &1rt @ZeroWidth @HSingle @Graphic { |hmargin }
+ }
+ }
+
+ def @DoubleRule
+ {
+ @OneRow
+ {
+ @ZeroWidth @HDouble @Graphic { ^|hmargin }
+ / @DoubleLine /
+ &1rt @ZeroWidth @HDouble @Graphic { |hmargin }
+ }
+ }
+
+ def @VRule
+ left rule
+ right x
+ {
+ rule @Case
+ {
+ no @Yield {}
+ { yes single } @Yield @OneRow { /0io @VSingle @Graphic x /0io }
+ double @Yield @OneRow { /0io @VDouble @Graphic x /0io }
+ }
+ }
+
+ def @VRuleRight
+ left rule
+ right x
+ {
+ rule @Case
+ {
+ no @Yield {}
+ {yes single} @Yield @OneRow { /0io @VSingle @Graphic x /0io }
+ double @Yield @OneRow { /0io @VDoubleRight @Graphic x /0io }
+ }
+ }
+
+ def @VSRule
+ left rule
+ {
+ rule @Case
+ {
+ no @Yield {}
+ { yes single } @Yield { @VSingle @Graphic {} }
+ double @Yield { @VDouble @Graphic {} }
+ }
+ }
+
+ def @VSRuleRight
+ left rule
+ {
+ rule @Case
+ {
+ no @Yield {}
+ {yes single} @Yield { @VSingle @Graphic {} }
+ double @Yield { @VDoubleRight @Graphic {} }
+ }
+ }
+
+ def @Wrap
+ named ur { no } # Rule up above entry
+ named dr { no } # Rule down below entry
+ named vm { vmargin } # Vertical margin
+ right x # The object to be wrapped
+ {
+ ur @HSRule
+ ^/vm @OneCol @OneRow x
+ /vm dr @HSRule
+ }
+
+ def @Sep
+ left x
+ named ur { no } # Rule up above entry
+ named dr { no } # Rule down below entry
+ named sr { no } # Rule separating x from y
+ named hm { hmargin } # Horizontal margin
+ named vm { vmargin } # Vertical margin
+ right y
+ {
+ def vr
+ {
+ sr @Case
+ { dft @Yield between
+ else @Yield sr
+ }
+ }
+
+ x | @OneCol
+ { ur @MidHRule {|hm}
+ /vm
+ /vm dr @MidHRule {|hm}
+ }
+ | @OneCol
+ { vr @VRule { /vm } | ur @MidHRule {|hm}
+ /vm vr @VSRule |
+ /vm vr @VRule {^/vm } | dr @MidHRule {|hm}
+ }
+ | y
+ }
+
+ def @NSep
+ left x
+ named hm { hmargin }
+ right y
+ {
+ x | @OneCol { |hm } | @OneCol { |hm } | y
+ }
+
+ def @LeftEdge
+ named ur { no } # Rule up above entry
+ named dr { no } # Rule down below entry
+ named sr { no } # Rule separating x from y
+ named hm { hmargin } # Horizontal margin
+ named vm { vmargin } # Vertical margin
+ right x
+ {
+ sr @Case
+ {
+ no @Yield { x }
+ else @Yield
+ { @OneCol
+ {
+ sr @VRule { /vm } | ur @LeftHRule { |hm }
+ ^/vm sr @VSRule |
+ /vm sr @VRule { ^/vm } | dr @LeftHRule { |hm }
+ }
+ | x
+ }
+ }
+ }
+
+ def @RightEdge
+ left x
+ named ur { no } # Rule up above entry
+ named dr { no } # Rule down below entry
+ named sr { no } # Rule separating x from y
+ named hm { hmargin } # Horizontal margin
+ named vm { vmargin } # Vertical margin
+ {
+ sr @Case
+ {
+ no @Yield { x }
+ else @Yield
+ {
+ x | @OneCol
+ {
+ ur @RightHRule { |hm }
+ /vm
+ /vm dr @RightHRule { |hm }
+ }
+ | @OneCol
+ {
+ sr @VRuleRight { /vm }
+ /vm sr @VSRuleRight
+ /vm sr @VRuleRight { ^/vm }
+ }
+ }
+ }
+ }
+
+ def @DoRowa
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmta
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowb
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmtb
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowc
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmtc
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowd
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmtd
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowe
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmte
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowf
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmtf
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowg
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmtg
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowh
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmth
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowi
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmti
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ def @DoRowj
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named above { above }
+ named below { below }
+ named side { side }
+ named vmargin { vmargin }
+ {
+ @LeftEdge ur { above } dr { below } sr { side } vm { vmargin }
+ @Fmtj
+ A { A } B { B } C { C } D { D } E { E }
+ F { F } G { G } H { H } I { I } J { J }
+ K { K } L { L } M { M } N { N } O { O }
+ P { P } Q { Q } R { R } S { S } T { T }
+ U { U } V { V } W { W } X { X } Y { Y }
+ Z { Z }
+ @Col { @Wrap ur {above} dr {below} vm {vmargin} x}
+ ! { x @Sep ur {above} dr {below} sr { between } vm {vmargin} y}
+ !! { x @Sep ur {above} dr {below} sr { single } vm {vmargin} y}
+ !!! { x @Sep ur {above} dr {below} sr { double } vm {vmargin} y}
+ , { x @NSep y }
+ @RightEdge ur { above } dr { below } sr { side } vm { vmargin }
+ }
+
+ macro @Rowa { / @DoRowa }
+ macro @Rowb { / @DoRowb }
+ macro @Rowc { / @DoRowc }
+ macro @Rowd { / @DoRowd }
+ macro @Rowe { / @DoRowe }
+ macro @Rowf { / @DoRowf }
+ macro @Rowg { / @DoRowg }
+ macro @Rowh { / @DoRowh }
+ macro @Rowi { / @DoRowi }
+ macro @Rowj { / @DoRowj }
+
+ macro @FirstRowa { @DoRowa }
+ macro @FirstRowb { @DoRowb }
+ macro @FirstRowc { @DoRowc }
+ macro @FirstRowd { @DoRowd }
+ macro @FirstRowe { @DoRowe }
+ macro @FirstRowf { @DoRowf }
+ macro @FirstRowg { @DoRowg }
+ macro @FirstRowh { @DoRowh }
+ macro @FirstRowi { @DoRowi }
+ macro @FirstRowj { @DoRowj }
+
+ macro @MarkRowa { ^/ @DoRowa }
+ macro @MarkRowb { ^/ @DoRowb }
+ macro @MarkRowc { ^/ @DoRowc }
+ macro @MarkRowd { ^/ @DoRowd }
+ macro @MarkRowe { ^/ @DoRowe }
+ macro @MarkRowf { ^/ @DoRowf }
+ macro @MarkRowg { ^/ @DoRowg }
+ macro @MarkRowh { ^/ @DoRowh }
+ macro @MarkRowi { ^/ @DoRowi }
+ macro @MarkRowj { ^/ @DoRowj }
+
+
+ @Body
+
+@End @Tab
diff --git a/include/tabf.lpg b/include/tabf.lpg
new file mode 100644
index 0000000..c0dd9a0
--- /dev/null
+++ b/include/tabf.lpg
@@ -0,0 +1,115 @@
+%%BeginResource: procset LoutTabPrependGraphic
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% PostScript @SysPrependGraphic file for @Tab %
+% %
+% To assist in avoiding name clashes, the names %
+% of all these symbols begin with "ltab". %
+% %
+% Jeffrey H. Kingston %
+% 24 September 1991 %
+% 22 December 1992 %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% linewidth ltabhs -
+% horizontal single line
+/ltabhs
+{ 0 0 moveto xsize 0 lineto
+ setlinewidth 0 setlinecap stroke
+} def
+
+% linewidth ltabhsp -
+% horizontal single line with projecting ends
+/ltabhsp
+{ 0 0 moveto xsize 0 lineto
+ setlinewidth 2 setlinecap stroke
+} def
+
+% linewidth ltabhd -
+% horizontal double line
+/ltabhd
+{ dup dup
+ 0 0 moveto xsize 0 lineto
+ 0 exch 3 mul moveto xsize exch 3 mul lineto
+ setlinewidth 0 setlinecap stroke
+} def
+
+% linewidth ltabhdb -
+% horizontal double line below mark
+/ltabhdb
+{ dup dup
+ 0 0 moveto xsize 0 lineto
+ 0 exch -3 mul moveto xsize exch -3 mul lineto
+ setlinewidth 0 setlinecap stroke
+} def
+
+% linewidth ltabhdnw -
+% horizontal double line with northwest corner
+/ltabhdnw
+{ dup dup dup dup
+ 0 0 moveto xsize 0 lineto
+ xsize exch 3 mul moveto
+ -3 mul exch 3 mul lineto
+ -3 mul 0 lineto
+ setlinewidth 0 setlinejoin 2 setlinecap stroke
+} def
+
+% linewidth ltabhdne -
+% horizontal double line with northeast corner
+/ltabhdne
+{ dup dup dup dup
+ 0 0 moveto xsize 0 lineto
+ 0 exch 3 mul moveto
+ 3 mul xsize add exch 3 mul lineto
+ 3 mul xsize add 0 lineto
+ setlinewidth 0 setlinejoin 2 setlinecap stroke
+} def
+
+% linewidth ltabhdsw -
+% horizontal double line with southwest corner
+/ltabhdsw
+{ dup dup dup dup
+ 0 0 moveto xsize 0 lineto
+ xsize exch -3 mul moveto
+ -3 mul exch -3 mul lineto
+ -3 mul 0 lineto
+ setlinewidth 0 setlinejoin 2 setlinecap stroke
+} def
+
+% linewidth ltabhdse -
+% horizontal double line with southeast corner
+/ltabhdse
+{ dup dup dup dup
+ 0 0 moveto xsize 0 lineto
+ 0 exch -3 mul moveto
+ 3 mul xsize add exch -3 mul lineto
+ 3 mul xsize add 0 lineto
+ setlinewidth 0 setlinejoin 2 setlinecap stroke
+} def
+
+% linewidth ltabvs -
+% vertical single line
+/ltabvs
+{ 0 0 moveto 0 ysize lineto
+ setlinewidth 0 setlinecap stroke
+} def
+
+% linewidth ltabvd -
+% vertical double line
+/ltabvd
+{ dup dup
+ 0 0 moveto 0 ysize lineto
+ -3 mul 0 moveto -3 mul ysize lineto
+ setlinewidth 0 setlinecap stroke
+} def
+
+% linewidth ltabvdr -
+% vertical double line to right of mark
+/ltabvdr
+{ dup dup
+ 0 0 moveto 0 ysize lineto
+ 3 mul 0 moveto 3 mul ysize lineto
+ setlinewidth 0 setlinecap stroke
+} def
+%%EndResource
diff --git a/include/tbl b/include/tbl
new file mode 100644
index 0000000..0574bf0
--- /dev/null
+++ b/include/tbl
@@ -0,0 +1,79 @@
+
+###############################################################################
+# #
+# Lout setup file for table printing #
+# #
+# Jeffrey H. Kingston #
+# 5 February 1999 #
+# #
+###############################################################################
+
+###############################################################################
+# #
+# The @SysInclude { tblf } line #
+# #
+# This line causes Lout to read the definitions for diagrams, and should #
+# not be touched. #
+# #
+###############################################################################
+
+@SysInclude { tblf }
+
+
+###############################################################################
+# #
+# The @TbleSetup @Use clause #
+# #
+# To change the default value of any option, delete the # at the start of #
+# its line and change the value between braces. #
+# #
+###############################################################################
+
+@Use { @TblSetup
+ # paint { nopaint } # colour of background
+ # background { } # object in background
+ # font { } # font
+ # break { } # paragraph breaking style
+ # width { } # fixed width or "expand"
+ # height { } # fixed height
+ # indent { } # horizontal indent
+ # indentvertical { } # vertical indent
+ # strut { yes } # vertical strut
+ # struthorizontal { no } # horizontal strut
+ # margin { } # margin all round
+ # marginhorizontal { 0.6f @OrIfPlain 2s } # margin left, right of entry
+ # marginleft { } # margin left of entry
+ # marginright { } # margin right of entry
+ # marginvertical { 0.3f @OrIfPlain 2f } # margin above, below entry
+ # marginabove { } # margin above entry
+ # marginbelow { } # margin below entry
+ # rule { no } # rule all round cell
+ # rulehorizontal { } # rule above and below cell
+ # ruleabove { } # rule above cell
+ # rulebelow { } # rule below cell
+ # rulevertical { } # rule left and right of cell
+ # ruleleft { } # rule left of cell
+ # ruleright { } # rule right of cell
+ # rulewidth { 0.05f } # width (thickness) of rule
+ # rulehorizontalwidth { {} @OrIfPlain 1f } # width of above, below rules
+ # ruleabovewidth { } # width of above rule
+ # rulebelowwidth { } # width of below rule
+ # ruleverticalwidth { {} @OrIfPlain 1s } # width of left, right rules
+ # ruleleftwidth { } # width of left rule
+ # rulerightwidth { } # width of right rule
+ # rulegap { 0.15f } # gap between double rules
+ # rulehorizontalgap { {} @OrIfPlain 0f } # gap between dbl a&b rules
+ # ruleabovegap { } # gap between dbl above rules
+ # rulebelowgap { } # gap between dbl below rules
+ # ruleverticalgap { {} @OrIfPlain 0s } # gap between dbl l&r rules
+ # ruleleftgap { } # gap between dbl left rules
+ # rulerightgap { } # gap between dbl right rules
+ # rulecolour { black } # color of rules
+ # rulehorizontalcolour { } # color of above, below rules
+ # ruleabovecolour { } # color of above rules
+ # rulebelowcolour { } # color of below rules
+ # ruleverticalcolour { } # color of left, right rules
+ # ruleleftcolour { } # color of left rules
+ # rulerightcolour { } # color of right rules
+ # ruleplainchar { . } # plain text rule characters
+}
diff --git a/include/tblf b/include/tblf
new file mode 100644
index 0000000..c8f0019
--- /dev/null
+++ b/include/tblf
@@ -0,0 +1,3127 @@
+
+###############################################################################
+# #
+# Lout @Tbl package for tables #
+# #
+# Version 1.0 (22 November 1998) #
+# Jeffrey H. Kingston #
+# #
+# Based on the @Tab package (Jeffrey H. Kingston, September 1991). #
+# #
+###############################################################################
+
+@SysPrependGraphic { tblf.lpg }
+
+export @OrIfPlain
+def @TOIP {
+
+ def @OrIfPlain
+ left ps
+ right plain
+ {
+ @BackEnd @Case {
+ PlainText @Yield plain
+ else @Yield ps
+ }
+ }
+}
+
+export @Tbl
+def @TblSetup
+ import @TOIP named paint p { nopaint }
+ import @TOIP named background bg {}
+ import @TOIP named font f {}
+ import @TOIP named break b {}
+ import @TOIP named width w {}
+ import @TOIP named height h {}
+ import @TOIP named indent i {}
+ import @TOIP named indentvertical iv {}
+ import @TOIP named strut s { yes }
+ import @TOIP named struthorizontal sh { no }
+ import @TOIP named margin m {}
+ import @TOIP named marginhorizontal mh { 0.6f @OrIfPlain 2s }
+ import @TOIP named marginleft ml {}
+ import @TOIP named marginright mr {}
+ import @TOIP named marginvertical mv { 0.3f @OrIfPlain 2f }
+ import @TOIP named marginabove ma {}
+ import @TOIP named marginbelow mb {}
+ import @TOIP named rule r { no }
+ import @TOIP named rulehorizontal rh {}
+ import @TOIP named ruleabove ra {}
+ import @TOIP named rulebelow rb {}
+ import @TOIP named rulevertical rv {}
+ import @TOIP named ruleleft rl {}
+ import @TOIP named ruleright rr {}
+ import @TOIP named rulewidth rw { 0.05f }
+ import @TOIP named rulehorizontalwidth rhw { {} @OrIfPlain 1f }
+ import @TOIP named ruleabovewidth raw {}
+ import @TOIP named rulebelowwidth rbw {}
+ import @TOIP named ruleverticalwidth rvw { {} @OrIfPlain 1s }
+ import @TOIP named ruleleftwidth rlw {}
+ import @TOIP named rulerightwidth rrw {}
+ import @TOIP named rulegap rg { 0.15f }
+ import @TOIP named rulehorizontalgap rhg { {} @OrIfPlain 0f }
+ import @TOIP named ruleabovegap rag {}
+ import @TOIP named rulebelowgap rbg {}
+ import @TOIP named ruleverticalgap rvg { {} @OrIfPlain 0s }
+ import @TOIP named ruleleftgap rlg {}
+ import @TOIP named rulerightgap rrg {}
+ import @TOIP named rulecolour rulecolor rc { black }
+ import @TOIP named rulehorizontalcolour rulehorizontalcolor rhc {}
+ import @TOIP named ruleabovecolour ruleabovecolor rac {}
+ import @TOIP named rulebelowcolour rulebelowcolor rbc {}
+ import @TOIP named ruleverticalcolour ruleverticalcolor rvc {}
+ import @TOIP named ruleleftcolour ruleleftcolor rlc {}
+ import @TOIP named rulerightcolour rulerightcolor rrc {}
+ import @TOIP named ruleplainchar rpc { . }
+
+@Begin
+
+ def @Else
+ precedence 20
+ associativity right
+ left x
+ right y
+ {
+ x @Case {
+ "" @Yield y
+ else @Yield x
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Specific option values as the setup file knows them (i.e. Level 1) #
+ # #
+ ###########################################################################
+
+ def setupp { p }
+ def setupbg { bg }
+ def setupf { f }
+ def setupb { b }
+ def setupw { w }
+ def setuph { h }
+ def setupi { i }
+ def setupiv { iv }
+ def setups { s }
+ def setupsh { sh }
+ def setupml { ml @Else mh @Else m }
+ def setupmr { mr @Else mh @Else m }
+ def setupma { ma @Else mv @Else m }
+ def setupmb { mb @Else mv @Else m }
+ def setupra { ra @Else rh @Else r }
+ def setuprb { rb @Else rh @Else r }
+ def setuprl { rl @Else rv @Else r }
+ def setuprr { rr @Else rv @Else r }
+ def setupraw { raw @Else rhw @Else rw }
+ def setuprbw { rbw @Else rhw @Else rw }
+ def setuprlw { rlw @Else rvw @Else rw }
+ def setuprrw { rrw @Else rvw @Else rw }
+ def setuprag { rag @Else rhg @Else rg }
+ def setuprbg { rbg @Else rhg @Else rg }
+ def setuprlg { rlg @Else rvg @Else rg }
+ def setuprrg { rrg @Else rvg @Else rg }
+ def setuprac { rac @Else rhc @Else rc }
+ def setuprbc { rbc @Else rhc @Else rc }
+ def setuprlc { rlc @Else rvc @Else rc }
+ def setuprrc { rrc @Else rvc @Else rc }
+ def setuprpc { rpc }
+
+
+ ###########################################################################
+ # #
+ # @Tbl symbol #
+ # #
+ ###########################################################################
+
+ export
+
+ @Row
+ @Rowa
+ @Rowb
+ @Rowc
+ @Rowd
+ @Rowe
+ @Rowf
+ @Rowg
+ @Rowh
+
+ @FirstRow
+ @FirstRowa
+ @FirstRowb
+ @FirstRowc
+ @FirstRowd
+ @FirstRowe
+ @FirstRowf
+ @FirstRowg
+ @FirstRowh
+
+ @MarkRow
+ @MarkRowa
+ @MarkRowb
+ @MarkRowc
+ @MarkRowd
+ @MarkRowe
+ @MarkRowf
+ @MarkRowg
+ @MarkRowh
+
+ @NoBreakRow
+ @NoBreakRowa
+ @NoBreakRowb
+ @NoBreakRowc
+ @NoBreakRowd
+ @NoBreakRowe
+ @NoBreakRowf
+ @NoBreakRowg
+ @NoBreakRowh
+
+ @NP
+
+ def @Tbl
+
+ # parameters for formatting the entire table
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+
+ # parameters for formatting @Rowa rows
+ named apaint ap {}
+ named abackground abg {}
+ named afont af {}
+ named abreak ab {}
+ named awidth aw {}
+ named aheight ah {}
+ named aindent ai {}
+ named aindentvertical aiv {}
+ named astrut as {}
+ named astruthorizontal ash {}
+ named amargin am {}
+ named amarginhorizontal amh {}
+ named amarginleft aml {}
+ named amarginright amr {}
+ named amarginvertical amv {}
+ named amarginabove ama {}
+ named amarginbelow amb {}
+ named arule ar {}
+ named arulehorizontal arh {}
+ named aruleabove ara {}
+ named arulebelow arb {}
+ named arulevertical arv {}
+ named aruleleft arl {}
+ named aruleright arr {}
+ named arulewidth arw {}
+ named arulehorizontalwidth arhw {}
+ named aruleabovewidth araw {}
+ named arulebelowwidth arbw {}
+ named aruleverticalwidth arvw {}
+ named aruleleftwidth arlw {}
+ named arulerightwidth arrw {}
+ named arulegap arg {}
+ named arulehorizontalgap arhg {}
+ named aruleabovegap arag {}
+ named arulebelowgap arbg {}
+ named aruleverticalgap arvg {}
+ named aruleleftgap arlg {}
+ named arulerightgap arrg {}
+ named arulecolour arulecolor arc {}
+ named arulehorizontalcolour arulehorizontalcolor arhc {}
+ named aruleabovecolour aruleabovecolor arac {}
+ named arulebelowcolour arulebelowcolor arbc {}
+ named aruleverticalcolour aruleverticalcolor arvc {}
+ named aruleleftcolour aruleleftcolor arlc {}
+ named arulerightcolour arulerightcolor arrc {}
+ named aruleplainchar arpc {}
+ named aformat
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+
+ # parameters for formatting @Rowb rows
+ named bpaint bp {}
+ named bbackground bbg {}
+ named bfont bf {}
+ named bbreak bb {}
+ named bwidth bw {}
+ named bheight bh {}
+ named bindent bi {}
+ named bindentvertical biv {}
+ named bstrut bs {}
+ named bstruthorizontal bsh {}
+ named bmargin bm {}
+ named bmarginhorizontal bmh {}
+ named bmarginleft bml {}
+ named bmarginright bmr {}
+ named bmarginvertical bmv {}
+ named bmarginabove bma {}
+ named bmarginbelow bmb {}
+ named brule br {}
+ named brulehorizontal brh {}
+ named bruleabove bra {}
+ named brulebelow brb {}
+ named brulevertical brv {}
+ named bruleleft brl {}
+ named bruleright brr {}
+ named brulewidth brw {}
+ named brulehorizontalwidth brhw {}
+ named bruleabovewidth braw {}
+ named brulebelowwidth brbw {}
+ named bruleverticalwidth brvw {}
+ named bruleleftwidth brlw {}
+ named brulerightwidth brrw {}
+ named brulegap brg {}
+ named brulehorizontalgap brhg {}
+ named bruleabovegap brag {}
+ named brulebelowgap brbg {}
+ named bruleverticalgap brvg {}
+ named bruleleftgap brlg {}
+ named brulerightgap brrg {}
+ named brulecolour brulecolor brc {}
+ named brulehorizontalcolour brulehorizontalcolor brhc {}
+ named bruleabovecolour bruleabovecolor brac {}
+ named brulebelowcolour brulebelowcolor brbc {}
+ named bruleverticalcolour bruleverticalcolor brvc {}
+ named bruleleftcolour bruleleftcolor brlc {}
+ named brulerightcolour brulerightcolor brrc {}
+ named bruleplainchar brpc {}
+ named bformat
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+
+ # parameters for formatting @Rowc rows
+ named cpaint cp {}
+ named cbackground cbg {}
+ named cfont cf {}
+ named cbreak cb {}
+ named cwidth cw {}
+ named cheight ch {}
+ named cindent ci {}
+ named cindentvertical civ {}
+ named cstrut cs {}
+ named cstruthorizontal csh {}
+ named cmargin cm {}
+ named cmarginhorizontal cmh {}
+ named cmarginleft cml {}
+ named cmarginright cmr {}
+ named cmarginvertical cmv {}
+ named cmarginabove cma {}
+ named cmarginbelow cmb {}
+ named crule cr {}
+ named crulehorizontal crh {}
+ named cruleabove cra {}
+ named crulebelow crb {}
+ named crulevertical crv {}
+ named cruleleft crl {}
+ named cruleright crr {}
+ named crulewidth crw {}
+ named crulehorizontalwidth crhw {}
+ named cruleabovewidth craw {}
+ named crulebelowwidth crbw {}
+ named cruleverticalwidth crvw {}
+ named cruleleftwidth crlw {}
+ named crulerightwidth crrw {}
+ named crulegap crg {}
+ named crulehorizontalgap crhg {}
+ named cruleabovegap crag {}
+ named crulebelowgap crbg {}
+ named cruleverticalgap crvg {}
+ named cruleleftgap crlg {}
+ named crulerightgap crrg {}
+ named crulecolour crulecolor crc {}
+ named crulehorizontalcolour crulehorizontalcolor crhc {}
+ named cruleabovecolour cruleabovecolor crac {}
+ named crulebelowcolour crulebelowcolor crbc {}
+ named cruleverticalcolour cruleverticalcolor crvc {}
+ named cruleleftcolour cruleleftcolor crlc {}
+ named crulerightcolour crulerightcolor crrc {}
+ named cruleplainchar crpc {}
+ named cformat
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+
+ # parameters for formatting @Rowd rows
+ named dpaint dp {}
+ named dbackground dbg {}
+ named dfont df {}
+ named dbreak db {}
+ named dwidth dw {}
+ named dheight dh {}
+ named dindent di {}
+ named dindentvertical div {}
+ named dstrut ds {}
+ named dstruthorizontal dsh {}
+ named dmargin dm {}
+ named dmarginhorizontal dmh {}
+ named dmarginleft dml {}
+ named dmarginright dmr {}
+ named dmarginvertical dmv {}
+ named dmarginabove dma {}
+ named dmarginbelow dmb {}
+ named drule dr {}
+ named drulehorizontal drh {}
+ named druleabove dra {}
+ named drulebelow drb {}
+ named drulevertical drv {}
+ named druleleft drl {}
+ named druleright drr {}
+ named drulewidth drw {}
+ named drulehorizontalwidth drhw {}
+ named druleabovewidth draw {}
+ named drulebelowwidth drbw {}
+ named druleverticalwidth drvw {}
+ named druleleftwidth drlw {}
+ named drulerightwidth drrw {}
+ named drulegap drg {}
+ named drulehorizontalgap drhg {}
+ named druleabovegap drag {}
+ named drulebelowgap drbg {}
+ named druleverticalgap drvg {}
+ named druleleftgap drlg {}
+ named drulerightgap drrg {}
+ named drulecolour drulecolor drc {}
+ named drulehorizontalcolour drulehorizontalcolor drhc {}
+ named druleabovecolour druleabovecolor drac {}
+ named drulebelowcolour drulebelowcolor drbc {}
+ named druleverticalcolour druleverticalcolor drvc {}
+ named druleleftcolour druleleftcolor drlc {}
+ named drulerightcolour drulerightcolor drrc {}
+ named druleplainchar drpc {}
+ named dformat
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+
+ # parameters for formatting @Rowe rows
+ named epaint ep {}
+ named ebackground ebg {}
+ named efont ef {}
+ named ebreak eb {}
+ named ewidth ew {}
+ named eheight eh {}
+ named eindent ei {}
+ named eindentvertical eiv {}
+ named estrut es {}
+ named estruthorizontal esh {}
+ named emargin em {}
+ named emarginhorizontal emh {}
+ named emarginleft eml {}
+ named emarginright emr {}
+ named emarginvertical emv {}
+ named emarginabove ema {}
+ named emarginbelow emb {}
+ named erule er {}
+ named erulehorizontal erh {}
+ named eruleabove era {}
+ named erulebelow erb {}
+ named erulevertical erv {}
+ named eruleleft erl {}
+ named eruleright err {}
+ named erulewidth erw {}
+ named erulehorizontalwidth erhw {}
+ named eruleabovewidth eraw {}
+ named erulebelowwidth erbw {}
+ named eruleverticalwidth ervw {}
+ named eruleleftwidth erlw {}
+ named erulerightwidth errw {}
+ named erulegap erg {}
+ named erulehorizontalgap erhg {}
+ named eruleabovegap erag {}
+ named erulebelowgap erbg {}
+ named eruleverticalgap ervg {}
+ named eruleleftgap erlg {}
+ named erulerightgap errg {}
+ named erulecolour erulecolor erc {}
+ named erulehorizontalcolour erulehorizontalcolor erhc {}
+ named eruleabovecolour eruleabovecolor erac {}
+ named erulebelowcolour erulebelowcolor erbc {}
+ named eruleverticalcolour eruleverticalcolor ervc {}
+ named eruleleftcolour eruleleftcolor erlc {}
+ named erulerightcolour erulerightcolor errc {}
+ named eruleplainchar erpc {}
+ named eformat
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+
+ # parameters for formatting @Rowf rows
+ named fpaint fp {}
+ named fbackground fbg {}
+ named ffont ff {}
+ named fbreak fb {}
+ named fwidth fw {}
+ named fheight fh {}
+ named findent fi {}
+ named findentvertical fiv {}
+ named fstrut fs {}
+ named fstruthorizontal fsh {}
+ named fmargin fm {}
+ named fmarginhorizontal fmh {}
+ named fmarginleft fml {}
+ named fmarginright fmr {}
+ named fmarginvertical fmv {}
+ named fmarginabove fma {}
+ named fmarginbelow fmb {}
+ named frule fr {}
+ named frulehorizontal frh {}
+ named fruleabove fra {}
+ named frulebelow frb {}
+ named frulevertical frv {}
+ named fruleleft frl {}
+ named fruleright frr {}
+ named frulewidth frw {}
+ named frulehorizontalwidth frhw {}
+ named fruleabovewidth fraw {}
+ named frulebelowwidth frbw {}
+ named fruleverticalwidth frvw {}
+ named fruleleftwidth frlw {}
+ named frulerightwidth frrw {}
+ named frulegap frg {}
+ named frulehorizontalgap frhg {}
+ named fruleabovegap frag {}
+ named frulebelowgap frbg {}
+ named fruleverticalgap frvg {}
+ named fruleleftgap frlg {}
+ named frulerightgap frrg {}
+ named frulecolour frulecolor frc {}
+ named frulehorizontalcolour frulehorizontalcolor frhc {}
+ named fruleabovecolour fruleabovecolor frac {}
+ named frulebelowcolour frulebelowcolor frbc {}
+ named fruleverticalcolour fruleverticalcolor frvc {}
+ named fruleleftcolour fruleleftcolor frlc {}
+ named frulerightcolour frulerightcolor frrc {}
+ named fruleplainchar frpc {}
+ named fformat
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+
+ # parameters for formatting @Rowg rows
+ named gpaint gp {}
+ named gbackground gbg {}
+ named gfont gf {}
+ named gbreak gb {}
+ named gwidth gw {}
+ named gheight gh {}
+ named gindent gi {}
+ named gindentvertical giv {}
+ named gstrut gs {}
+ named gstruthorizontal gsh {}
+ named gmargin gm {}
+ named gmarginhorizontal gmh {}
+ named gmarginleft gml {}
+ named gmarginright gmr {}
+ named gmarginvertical gmv {}
+ named gmarginabove gma {}
+ named gmarginbelow gmb {}
+ named grule gr {}
+ named grulehorizontal grh {}
+ named gruleabove gra {}
+ named grulebelow grb {}
+ named grulevertical grv {}
+ named gruleleft grl {}
+ named gruleright grr {}
+ named grulewidth grw {}
+ named grulehorizontalwidth grhw {}
+ named gruleabovewidth graw {}
+ named grulebelowwidth grbw {}
+ named gruleverticalwidth grvw {}
+ named gruleleftwidth grlw {}
+ named grulerightwidth grrw {}
+ named grulegap grg {}
+ named grulehorizontalgap grhg {}
+ named gruleabovegap grag {}
+ named grulebelowgap grbg {}
+ named gruleverticalgap grvg {}
+ named gruleleftgap grlg {}
+ named grulerightgap grrg {}
+ named grulecolour grulecolor grc {}
+ named grulehorizontalcolour grulehorizontalcolor grhc {}
+ named gruleabovecolour gruleabovecolor grac {}
+ named grulebelowcolour grulebelowcolor grbc {}
+ named gruleverticalcolour gruleverticalcolor grvc {}
+ named gruleleftcolour gruleleftcolor grlc {}
+ named grulerightcolour grulerightcolor grrc {}
+ named gruleplainchar grpc {}
+ named gformat
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+
+ # parameters for formatting @Rowh rows
+ named hpaint hp {}
+ named hbackground hbg {}
+ named hfont hf {}
+ named hbreak hb {}
+ named hwidth hw {}
+ named hheight hh {}
+ named hindent hi {}
+ named hindentvertical hiv {}
+ named hstrut hs {}
+ named hstruthorizontal hsh {}
+ named hmargin hm {}
+ named hmarginhorizontal hmh {}
+ named hmarginleft hml {}
+ named hmarginright hmr {}
+ named hmarginvertical hmv {}
+ named hmarginabove hma {}
+ named hmarginbelow hmb {}
+ named hrule hr {}
+ named hrulehorizontal hrh {}
+ named hruleabove hra {}
+ named hrulebelow hrb {}
+ named hrulevertical hrv {}
+ named hruleleft hrl {}
+ named hruleright hrr {}
+ named hrulewidth hrw {}
+ named hrulehorizontalwidth hrhw {}
+ named hruleabovewidth hraw {}
+ named hrulebelowwidth hrbw {}
+ named hruleverticalwidth hrvw {}
+ named hruleleftwidth hrlw {}
+ named hrulerightwidth hrrw {}
+ named hrulegap hrg {}
+ named hrulehorizontalgap hrhg {}
+ named hruleabovegap hrag {}
+ named hrulebelowgap hrbg {}
+ named hruleverticalgap hrvg {}
+ named hruleleftgap hrlg {}
+ named hrulerightgap hrrg {}
+ named hrulecolour hrulecolor hrc {}
+ named hrulehorizontalcolour hrulehorizontalcolor hrhc {}
+ named hruleabovecolour hruleabovecolor hrac {}
+ named hrulebelowcolour hrulebelowcolor hrbc {}
+ named hruleverticalcolour hruleverticalcolor hrvc {}
+ named hruleleftcolour hruleleftcolor hrlc {}
+ named hrulerightcolour hrulerightcolor hrrc {}
+ named hruleplainchar hrpc {}
+ named hformat
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+
+ body @Body # this is the right parameter of @Tbl
+
+ {
+
+ #######################################################################
+ # #
+ # Specific option values as @Tbl knows them (i.e. Level 2) #
+ # #
+ #######################################################################
+
+ def tblp { p @Else setupp }
+ def tblbg { bg @Else setupbg }
+ def tblf { f @Else setupf }
+ def tblb { b @Else setupb }
+ def tblw { w @Else setupw }
+ def tblh { h @Else setuph }
+ def tbli { i @Else setupi }
+ def tbliv { iv @Else setupiv }
+ def tbls { s @Else setups }
+ def tblsh { sh @Else setupsh }
+ def tblml { ml @Else mh @Else m @Else setupml }
+ def tblmr { mr @Else mh @Else m @Else setupmr }
+ def tblma { ma @Else mv @Else m @Else setupma }
+ def tblmb { mb @Else mv @Else m @Else setupmb }
+ def tblra { ra @Else rh @Else r @Else setupra }
+ def tblrb { rb @Else rh @Else r @Else setuprb }
+ def tblrl { rl @Else rv @Else r @Else setuprl }
+ def tblrr { rr @Else rv @Else r @Else setuprr }
+ def tblraw { raw @Else rhw @Else rw @Else setupraw }
+ def tblrbw { rbw @Else rhw @Else rw @Else setuprbw }
+ def tblrlw { rlw @Else rvw @Else rw @Else setuprlw }
+ def tblrrw { rrw @Else rvw @Else rw @Else setuprrw }
+ def tblrag { rag @Else rhg @Else rg @Else setuprag }
+ def tblrbg { rbg @Else rhg @Else rg @Else setuprbg }
+ def tblrlg { rlg @Else rvg @Else rg @Else setuprlg }
+ def tblrrg { rrg @Else rvg @Else rg @Else setuprrg }
+ def tblrac { rac @Else rhc @Else rc @Else setuprac }
+ def tblrbc { rbc @Else rhc @Else rc @Else setuprbc }
+ def tblrlc { rlc @Else rvc @Else rc @Else setuprlc }
+ def tblrrc { rrc @Else rvc @Else rc @Else setuprrc }
+ def tblrpc { rpc @Else setuprpc }
+
+
+ def @DoCell
+ named compulsory p {}
+ named compulsory bg {}
+ named compulsory f {}
+ named compulsory b {}
+ named compulsory w {}
+ named compulsory h {}
+ named compulsory i {}
+ named compulsory iv {}
+ named compulsory s {}
+ named compulsory sh {}
+ named compulsory ml {}
+ named compulsory mr {}
+ named compulsory ma {}
+ named compulsory mb {}
+ named compulsory ra {}
+ named compulsory rb {}
+ named compulsory rl {}
+ named compulsory rr {}
+ named compulsory raw {}
+ named compulsory rbw {}
+ named compulsory rlw {}
+ named compulsory rrw {}
+ named compulsory rag {}
+ named compulsory rbg {}
+ named compulsory rlg {}
+ named compulsory rrg {}
+ named compulsory rac {}
+ named compulsory rbc {}
+ named compulsory rlc {}
+ named compulsory rrc {}
+ named compulsory rpc {}
+ right @Body
+ {
+
+ def @ZeroWidth right x
+ {
+ @OneCol { |0io x |0io }
+ }
+
+ def @ZeroHeight right x
+ {
+ @OneRow { /0io x /0io }
+ }
+
+ def @PDFColourCommand right col
+ {
+ def @ColourCoords
+ {
+ col @Case {
+ nochange @Yield { nochange }
+ darkblue @Yield { 0.0 0.0 0.5 }
+ blue @Yield { 0.0 0.0 1.0 }
+ lightblue @Yield { 0.5 0.5 1.0 }
+ darkgreen @Yield { 0.0 0.5 0.0 }
+ green @Yield { 0.0 1.0 0.0 }
+ lightgreen @Yield { 0.5 1.0 0.5 }
+ darkred @Yield { 0.5 0.0 0.0 }
+ red @Yield { 1.0 0.0 0.0 }
+ lightred @Yield { 1.0 0.5 0.5 }
+ darkcyan @Yield { 0.0 0.5 0.5 }
+ cyan @Yield { 0.0 1.0 1.0 }
+ lightcyan @Yield { 0.5 1.0 1.0 }
+ darkmagenta @Yield { 0.5 0.0 0.5 }
+ magenta @Yield { 1.0 0.0 1.0 }
+ lightmagenta @Yield { 1.0 0.5 1.0 }
+ darkyellow @Yield { 0.5 0.5 0.0 }
+ yellow @Yield { 1.0 1.0 0.0 }
+ lightyellow @Yield { 1.0 1.0 0.5 }
+ darkgray @Yield { 0.2 0.2 0.2 }
+ gray @Yield { 0.5 0.5 0.5 }
+ lightgray @Yield { 0.8 0.8 0.8 }
+ darkgrey @Yield { 0.2 0.2 0.2 }
+ grey @Yield { 0.5 0.5 0.5 }
+ lightgrey @Yield { 0.8 0.8 0.8 }
+ black @Yield { 0.0 0.0 0.0 }
+ white @Yield { 1.0 1.0 1.0 }
+ }
+ }
+
+ @ColourCoords "rg" @ColourCoords "RG"
+ }
+
+ def @PDFAddPaint right col
+ {
+ col @Case {
+ none @Yield ""
+ nochange @Yield "q f Q"
+ else @Yield { "q" @PDFColourCommand col "f Q" }
+ }
+ }
+
+ def @FillBox left col right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {{"LoutBox ltbl"col} @Graphic x}
+ PDF @Yield {{
+ "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h"
+ @PDFAddPaint col "S"
+ } @Graphic x}
+ PlainText @Yield { rpc @PlainGraphic x }
+ }
+ }
+
+ def @PaintBox left col right x
+ {
+ @BackEnd @Case {
+ PostScript @Yield {{"LoutBox ltbl"col} @Graphic x}
+ PDF @Yield {{
+ "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h"
+ @PDFAddPaint col "S"
+ } @Graphic x}
+ PlainText @Yield { x }
+ }
+ }
+
+ def @HRule left col right thick
+ {
+ @ZeroHeight thick @High col @FillBox {}
+ # thick @High col @FillBox {}
+ }
+
+ def @VRule left col right thick
+ {
+ @ZeroWidth thick @Wide col @FillBox {}
+ # thick @Wide col @FillBox {}
+ }
+
+ def @DoubleHRule
+ left col
+ named gap {}
+ right thick
+ {
+ @OneCol { col @HRule thick /gap col @HRule thick }
+ }
+
+ def @DoubleVRule
+ left col
+ named gap {}
+ right thick
+ {
+ @OneRow { col @VRule thick /gap col @VRule thick }
+ }
+
+ def @MakeHRule
+ left col
+ named thick {}
+ named gap {}
+ right type
+ {
+ type @Case {
+ { none "" no } @Yield {}
+ { yes single } @Yield col @HRule thick
+ { double } @Yield col @DoubleHRule gap { gap } thick
+ }
+ }
+
+ def @MakeVRule
+ left col
+ named thick {}
+ named gap {}
+ right type
+ {
+ type @Case {
+ { none "" no } @Yield {}
+ { yes single } @Yield col @VRule thick
+ { double } @Yield col @DoubleVRule gap { gap } thick
+ }
+ }
+
+ def @RuleBox
+ left col
+ named hthick {}
+ named vthick {}
+ named htype {}
+ named vtype {}
+ {
+ htype @Case {
+ { none "" no } @Yield {}
+ else @Yield vtype @Case {
+ { none "" no } @Yield {}
+ else @Yield {
+ @ZeroWidth @ZeroHeight hthick @Wide vthick @High
+ col @FillBox {}
+ }
+ }
+ }
+ }
+
+ def @AddRules
+ right x
+ {
+ {
+ rlc @MakeVRule thick { rlw } gap { rlg } rl
+ |0rt |1rt
+ rrc @MakeVRule thick { rrw } gap { rrg } rr
+ } @Background
+ { rac @MakeHRule thick { raw } gap { rag } ra
+ /0rt
+ /1rt
+ rbc @MakeHRule thick { rbw } gap { rbg } rb
+ } @Background
+ {
+ |1rt rac @RuleBox hthick { rrw } vthick { raw } htype { rr } vtype { ra }
+ /0rt
+ /1rt |1rt
+ rbc @RuleBox hthick { rrw } vthick { rbw } htype { rr } vtype { rb }
+ } @Background x
+
+ }
+
+ def @AddMargins
+ right x
+ {
+ @OneCol @OneRow {
+ ^|ml |mr
+ ^/ma | x |
+ /mb | |
+ }
+ }
+
+ def @AddPaint
+ right x
+ {
+ p @Case {
+ { none nopaint no } @Yield x
+ else @Yield { p @PaintBox x }
+ }
+ }
+
+ def @Strut right x
+ {
+ def strutval right x
+ {
+ x @Case {
+ { no No "" } @Yield "0.0f"
+ { yes Yes } @Yield "1.0f"
+ else @Yield x
+ }
+ }
+
+ def vs { "0.5w" @VShift { { strutval s } @High } }
+ def hs { { strutval sh } @Wide }
+
+ @OneCol @OneRow { ^| hs ^/ vs | x }
+ }
+
+ def @VSize right x
+ {
+ h @Case {
+ "" @Yield x
+ else @Yield { h @High x }
+ }
+ }
+
+ def @HSize right x
+ {
+ w @Case {
+ "" @Yield x
+ "expand" @Yield { "40c" @Wide x }
+ else @Yield { w @Wide x }
+ }
+ }
+
+ def @HIndent right x
+ {
+ i @Case {
+ left @Yield @OneCol { | x }
+ ctr @Yield @OneCol { |"0.5rt" x }
+ right @Yield @OneCol { |"1.0rt" x }
+ mctr @Yield @OneCol { |"0.5bx" x }
+ "" @Yield @OneCol x
+ else @Yield @OneCol { |i x }
+ }
+ }
+
+ def @VIndent right x
+ {
+ iv @Case {
+ top @Yield @OneRow { / x }
+ ctr @Yield @OneRow { /"0.5rt" x }
+ foot @Yield @OneRow { /"1.0rt" x }
+ mctr @Yield @OneRow { /"0.5bx" x }
+ "" @Yield @OneRow x
+ else @Yield @OneRow { /iv x }
+ }
+ }
+
+ @HSize @VSize @AddPaint bg @Background @AddRules
+ @HIndent @VIndent @AddMargins f @Font b @Break @Strut @Body
+ }
+
+ # symbol for producing @Row rows
+ def @DoRow
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named compulsory format
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ named @Cell
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ right x
+ {}
+ {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values as @Row knows them (i.e. Level 6) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tblp }
+ def rowbg { bg @Else tblbg }
+ def rowf { f @Else tblf }
+ def rowb { b @Else tblb }
+ def roww { w @Else tblw }
+ def rowh { h @Else tblh }
+ def rowi { i @Else tbli }
+ def rowiv { iv @Else tbliv }
+ def rows { s @Else tbls }
+ def rowsh { sh @Else tblsh }
+ def rowml { ml @Else mh @Else m @Else tblml }
+ def rowmr { mr @Else mh @Else m @Else tblmr }
+ def rowma { ma @Else mv @Else m @Else tblma }
+ def rowmb { mb @Else mv @Else m @Else tblmb }
+ def rowra { ra @Else rh @Else r @Else tblra }
+ def rowrb { rb @Else rh @Else r @Else tblrb }
+ def rowrl { rl @Else rv @Else r @Else tblrl }
+ def rowrr { rr @Else rv @Else r @Else tblrr }
+ def rowraw { raw @Else rhw @Else rw @Else tblraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tblrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tblrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tblrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tblrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tblrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tblrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tblrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tblrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tblrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tblrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tblrrc }
+ def rowrpc { rpc @Else tblrpc }
+
+ format
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 7) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ # symbol for producing @Rowa rows
+ def @DoRowa
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values at "aoption" level (i.e. Level 3) #
+ # #
+ ###################################################################
+
+ def tbxp { ap @Else tblp }
+ def tbxbg { abg @Else tblbg }
+ def tbxf { af @Else tblf }
+ def tbxb { ab @Else tblb }
+ def tbxw { aw @Else tblw }
+ def tbxh { ah @Else tblh }
+ def tbxi { ai @Else tbli }
+ def tbxiv { aiv @Else tbliv }
+ def tbxs { as @Else tbls }
+ def tbxsh { ash @Else tblsh }
+ def tbxml { aml @Else amh @Else am @Else tblml }
+ def tbxmr { amr @Else amh @Else am @Else tblmr }
+ def tbxma { ama @Else amv @Else am @Else tblma }
+ def tbxmb { amb @Else amv @Else am @Else tblmb }
+ def tbxra { ara @Else arh @Else ar @Else tblra }
+ def tbxrb { arb @Else arh @Else ar @Else tblrb }
+ def tbxrl { arl @Else arv @Else ar @Else tblrl }
+ def tbxrr { arr @Else arv @Else ar @Else tblrr }
+ def tbxraw { araw @Else arhw @Else arw @Else tblraw }
+ def tbxrbw { arbw @Else arhw @Else arw @Else tblrbw }
+ def tbxrlw { arlw @Else arvw @Else arw @Else tblrlw }
+ def tbxrrw { arrw @Else arvw @Else arw @Else tblrrw }
+ def tbxrag { arag @Else arhg @Else arg @Else tblrag }
+ def tbxrbg { arbg @Else arhg @Else arg @Else tblrbg }
+ def tbxrlg { arlg @Else arvg @Else arg @Else tblrlg }
+ def tbxrrg { arrg @Else arvg @Else arg @Else tblrrg }
+ def tbxrac { arac @Else arhc @Else arc @Else tblrac }
+ def tbxrbc { arbc @Else arhc @Else arc @Else tblrbc }
+ def tbxrlc { arlc @Else arvc @Else arc @Else tblrlc }
+ def tbxrrc { arrc @Else arvc @Else arc @Else tblrrc }
+ def tbxrpc { arpc @Else tblrpc }
+
+ ###################################################################
+ # #
+ # Specific option values at @Rowa level (i.e. Level 4) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tbxp }
+ def rowbg { bg @Else tbxbg }
+ def rowf { f @Else tbxf }
+ def rowb { b @Else tbxb }
+ def roww { w @Else tbxw }
+ def rowh { h @Else tbxh }
+ def rowi { i @Else tbxi }
+ def rowiv { iv @Else tbxiv }
+ def rows { s @Else tbxs }
+ def rowsh { sh @Else tbxsh }
+ def rowml { ml @Else mh @Else m @Else tbxml }
+ def rowmr { mr @Else mh @Else m @Else tbxmr }
+ def rowma { ma @Else mv @Else m @Else tbxma }
+ def rowmb { mb @Else mv @Else m @Else tbxmb }
+ def rowra { ra @Else rh @Else r @Else tbxra }
+ def rowrb { rb @Else rh @Else r @Else tbxrb }
+ def rowrl { rl @Else rv @Else r @Else tbxrl }
+ def rowrr { rr @Else rv @Else r @Else tbxrr }
+ def rowraw { raw @Else rhw @Else rw @Else tbxraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tbxrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tbxrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc }
+ def rowrpc { rpc @Else tbxrpc }
+
+ aformat
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 5) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ # symbol for producing @Rowb rows
+ def @DoRowb
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values at "boption" level (i.e. Level 3) #
+ # #
+ ###################################################################
+
+ def tbxp { bp @Else tblp }
+ def tbxbg { bbg @Else tblbg }
+ def tbxf { bf @Else tblf }
+ def tbxb { bb @Else tblb }
+ def tbxw { bw @Else tblw }
+ def tbxh { bh @Else tblh }
+ def tbxi { bi @Else tbli }
+ def tbxiv { biv @Else tbliv }
+ def tbxs { bs @Else tbls }
+ def tbxsh { bsh @Else tblsh }
+ def tbxml { bml @Else bmh @Else bm @Else tblml }
+ def tbxmr { bmr @Else bmh @Else bm @Else tblmr }
+ def tbxma { bma @Else bmv @Else bm @Else tblma }
+ def tbxmb { bmb @Else bmv @Else bm @Else tblmb }
+ def tbxra { bra @Else brh @Else br @Else tblra }
+ def tbxrb { brb @Else brh @Else br @Else tblrb }
+ def tbxrl { brl @Else brv @Else br @Else tblrl }
+ def tbxrr { brr @Else brv @Else br @Else tblrr }
+ def tbxraw { braw @Else brhw @Else brw @Else tblraw }
+ def tbxrbw { brbw @Else brhw @Else brw @Else tblrbw }
+ def tbxrlw { brlw @Else brvw @Else brw @Else tblrlw }
+ def tbxrrw { brrw @Else brvw @Else brw @Else tblrrw }
+ def tbxrag { brag @Else brhg @Else brg @Else tblrag }
+ def tbxrbg { brbg @Else brhg @Else brg @Else tblrbg }
+ def tbxrlg { brlg @Else brvg @Else brg @Else tblrlg }
+ def tbxrrg { brrg @Else brvg @Else brg @Else tblrrg }
+ def tbxrac { brac @Else brhc @Else brc @Else tblrac }
+ def tbxrbc { brbc @Else brhc @Else brc @Else tblrbc }
+ def tbxrlc { brlc @Else brvc @Else brc @Else tblrlc }
+ def tbxrrc { brrc @Else brvc @Else brc @Else tblrrc }
+ def tbxrpc { brpc @Else tblrpc }
+
+ ###################################################################
+ # #
+ # Specific option values at @Rowb level (i.e. Level 4) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tbxp }
+ def rowbg { bg @Else tbxbg }
+ def rowf { f @Else tbxf }
+ def rowb { b @Else tbxb }
+ def roww { w @Else tbxw }
+ def rowh { h @Else tbxh }
+ def rowi { i @Else tbxi }
+ def rowiv { iv @Else tbxiv }
+ def rows { s @Else tbxs }
+ def rowsh { sh @Else tbxsh }
+ def rowml { ml @Else mh @Else m @Else tbxml }
+ def rowmr { mr @Else mh @Else m @Else tbxmr }
+ def rowma { ma @Else mv @Else m @Else tbxma }
+ def rowmb { mb @Else mv @Else m @Else tbxmb }
+ def rowra { ra @Else rh @Else r @Else tbxra }
+ def rowrb { rb @Else rh @Else r @Else tbxrb }
+ def rowrl { rl @Else rv @Else r @Else tbxrl }
+ def rowrr { rr @Else rv @Else r @Else tbxrr }
+ def rowraw { raw @Else rhw @Else rw @Else tbxraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tbxrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tbxrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc }
+ def rowrpc { rpc @Else tbxrpc }
+
+ bformat
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 5) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ # symbol for producing @Rowc rows
+ def @DoRowc
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values at "coption" level (i.e. Level 3) #
+ # #
+ ###################################################################
+
+ def tbxp { cp @Else tblp }
+ def tbxbg { cbg @Else tblbg }
+ def tbxf { cf @Else tblf }
+ def tbxb { cb @Else tblb }
+ def tbxw { cw @Else tblw }
+ def tbxh { ch @Else tblh }
+ def tbxi { ci @Else tbli }
+ def tbxiv { civ @Else tbliv }
+ def tbxs { cs @Else tbls }
+ def tbxsh { csh @Else tblsh }
+ def tbxml { cml @Else cmh @Else cm @Else tblml }
+ def tbxmr { cmr @Else cmh @Else cm @Else tblmr }
+ def tbxma { cma @Else cmv @Else cm @Else tblma }
+ def tbxmb { cmb @Else cmv @Else cm @Else tblmb }
+ def tbxra { cra @Else crh @Else cr @Else tblra }
+ def tbxrb { crb @Else crh @Else cr @Else tblrb }
+ def tbxrl { crl @Else crv @Else cr @Else tblrl }
+ def tbxrr { crr @Else crv @Else cr @Else tblrr }
+ def tbxraw { craw @Else crhw @Else crw @Else tblraw }
+ def tbxrbw { crbw @Else crhw @Else crw @Else tblrbw }
+ def tbxrlw { crlw @Else crvw @Else crw @Else tblrlw }
+ def tbxrrw { crrw @Else crvw @Else crw @Else tblrrw }
+ def tbxrag { crag @Else crhg @Else crg @Else tblrag }
+ def tbxrbg { crbg @Else crhg @Else crg @Else tblrbg }
+ def tbxrlg { crlg @Else crvg @Else crg @Else tblrlg }
+ def tbxrrg { crrg @Else crvg @Else crg @Else tblrrg }
+ def tbxrac { crac @Else crhc @Else crc @Else tblrac }
+ def tbxrbc { crbc @Else crhc @Else crc @Else tblrbc }
+ def tbxrlc { crlc @Else crvc @Else crc @Else tblrlc }
+ def tbxrrc { crrc @Else crvc @Else crc @Else tblrrc }
+ def tbxrpc { crpc @Else tblrpc }
+
+ ###################################################################
+ # #
+ # Specific option values at @Rowc level (i.e. Level 4) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tbxp }
+ def rowbg { bg @Else tbxbg }
+ def rowf { f @Else tbxf }
+ def rowb { b @Else tbxb }
+ def roww { w @Else tbxw }
+ def rowh { h @Else tbxh }
+ def rowi { i @Else tbxi }
+ def rowiv { iv @Else tbxiv }
+ def rows { s @Else tbxs }
+ def rowsh { sh @Else tbxsh }
+ def rowml { ml @Else mh @Else m @Else tbxml }
+ def rowmr { mr @Else mh @Else m @Else tbxmr }
+ def rowma { ma @Else mv @Else m @Else tbxma }
+ def rowmb { mb @Else mv @Else m @Else tbxmb }
+ def rowra { ra @Else rh @Else r @Else tbxra }
+ def rowrb { rb @Else rh @Else r @Else tbxrb }
+ def rowrl { rl @Else rv @Else r @Else tbxrl }
+ def rowrr { rr @Else rv @Else r @Else tbxrr }
+ def rowraw { raw @Else rhw @Else rw @Else tbxraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tbxrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tbxrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc }
+ def rowrpc { rpc @Else tbxrpc }
+
+ cformat
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 5) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ # symbol for producing @Rowd rows
+ def @DoRowd
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values at "doption" level (i.e. Level 3) #
+ # #
+ ###################################################################
+
+ def tbxp { dp @Else tblp }
+ def tbxbg { dbg @Else tblbg }
+ def tbxf { df @Else tblf }
+ def tbxb { db @Else tblb }
+ def tbxw { dw @Else tblw }
+ def tbxh { dh @Else tblh }
+ def tbxi { di @Else tbli }
+ def tbxiv { div @Else tbliv }
+ def tbxs { ds @Else tbls }
+ def tbxsh { dsh @Else tblsh }
+ def tbxml { dml @Else dmh @Else dm @Else tblml }
+ def tbxmr { dmr @Else dmh @Else dm @Else tblmr }
+ def tbxma { dma @Else dmv @Else dm @Else tblma }
+ def tbxmb { dmb @Else dmv @Else dm @Else tblmb }
+ def tbxra { dra @Else drh @Else dr @Else tblra }
+ def tbxrb { drb @Else drh @Else dr @Else tblrb }
+ def tbxrl { drl @Else drv @Else dr @Else tblrl }
+ def tbxrr { drr @Else drv @Else dr @Else tblrr }
+ def tbxraw { draw @Else drhw @Else drw @Else tblraw }
+ def tbxrbw { drbw @Else drhw @Else drw @Else tblrbw }
+ def tbxrlw { drlw @Else drvw @Else drw @Else tblrlw }
+ def tbxrrw { drrw @Else drvw @Else drw @Else tblrrw }
+ def tbxrag { drag @Else drhg @Else drg @Else tblrag }
+ def tbxrbg { drbg @Else drhg @Else drg @Else tblrbg }
+ def tbxrlg { drlg @Else drvg @Else drg @Else tblrlg }
+ def tbxrrg { drrg @Else drvg @Else drg @Else tblrrg }
+ def tbxrac { drac @Else drhc @Else drc @Else tblrac }
+ def tbxrbc { drbc @Else drhc @Else drc @Else tblrbc }
+ def tbxrlc { drlc @Else drvc @Else drc @Else tblrlc }
+ def tbxrrc { drrc @Else drvc @Else drc @Else tblrrc }
+ def tbxrpc { drpc @Else tblrpc }
+
+ ###################################################################
+ # #
+ # Specific option values at @Rowd level (i.e. Level 4) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tbxp }
+ def rowbg { bg @Else tbxbg }
+ def rowf { f @Else tbxf }
+ def rowb { b @Else tbxb }
+ def roww { w @Else tbxw }
+ def rowh { h @Else tbxh }
+ def rowi { i @Else tbxi }
+ def rowiv { iv @Else tbxiv }
+ def rows { s @Else tbxs }
+ def rowsh { sh @Else tbxsh }
+ def rowml { ml @Else mh @Else m @Else tbxml }
+ def rowmr { mr @Else mh @Else m @Else tbxmr }
+ def rowma { ma @Else mv @Else m @Else tbxma }
+ def rowmb { mb @Else mv @Else m @Else tbxmb }
+ def rowra { ra @Else rh @Else r @Else tbxra }
+ def rowrb { rb @Else rh @Else r @Else tbxrb }
+ def rowrl { rl @Else rv @Else r @Else tbxrl }
+ def rowrr { rr @Else rv @Else r @Else tbxrr }
+ def rowraw { raw @Else rhw @Else rw @Else tbxraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tbxrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tbxrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc }
+ def rowrpc { rpc @Else tbxrpc }
+
+ dformat
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 5) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ # symbol for producing @Rowe rows
+ def @DoRowe
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values at "eoption" level (i.e. Level 3) #
+ # #
+ ###################################################################
+
+ def tbxp { ep @Else tblp }
+ def tbxbg { ebg @Else tblbg }
+ def tbxf { ef @Else tblf }
+ def tbxb { eb @Else tblb }
+ def tbxw { ew @Else tblw }
+ def tbxh { eh @Else tblh }
+ def tbxi { ei @Else tbli }
+ def tbxiv { eiv @Else tbliv }
+ def tbxs { es @Else tbls }
+ def tbxsh { esh @Else tblsh }
+ def tbxml { eml @Else emh @Else em @Else tblml }
+ def tbxmr { emr @Else emh @Else em @Else tblmr }
+ def tbxma { ema @Else emv @Else em @Else tblma }
+ def tbxmb { emb @Else emv @Else em @Else tblmb }
+ def tbxra { era @Else erh @Else er @Else tblra }
+ def tbxrb { erb @Else erh @Else er @Else tblrb }
+ def tbxrl { erl @Else erv @Else er @Else tblrl }
+ def tbxrr { err @Else erv @Else er @Else tblrr }
+ def tbxraw { eraw @Else erhw @Else erw @Else tblraw }
+ def tbxrbw { erbw @Else erhw @Else erw @Else tblrbw }
+ def tbxrlw { erlw @Else ervw @Else erw @Else tblrlw }
+ def tbxrrw { errw @Else ervw @Else erw @Else tblrrw }
+ def tbxrag { erag @Else erhg @Else erg @Else tblrag }
+ def tbxrbg { erbg @Else erhg @Else erg @Else tblrbg }
+ def tbxrlg { erlg @Else ervg @Else erg @Else tblrlg }
+ def tbxrrg { errg @Else ervg @Else erg @Else tblrrg }
+ def tbxrac { erac @Else erhc @Else erc @Else tblrac }
+ def tbxrbc { erbc @Else erhc @Else erc @Else tblrbc }
+ def tbxrlc { erlc @Else ervc @Else erc @Else tblrlc }
+ def tbxrrc { errc @Else ervc @Else erc @Else tblrrc }
+ def tbxrpc { erpc @Else tblrpc }
+
+ ###################################################################
+ # #
+ # Specific option values at @Rowe level (i.e. Level 4) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tbxp }
+ def rowbg { bg @Else tbxbg }
+ def rowf { f @Else tbxf }
+ def rowb { b @Else tbxb }
+ def roww { w @Else tbxw }
+ def rowh { h @Else tbxh }
+ def rowi { i @Else tbxi }
+ def rowiv { iv @Else tbxiv }
+ def rows { s @Else tbxs }
+ def rowsh { sh @Else tbxsh }
+ def rowml { ml @Else mh @Else m @Else tbxml }
+ def rowmr { mr @Else mh @Else m @Else tbxmr }
+ def rowma { ma @Else mv @Else m @Else tbxma }
+ def rowmb { mb @Else mv @Else m @Else tbxmb }
+ def rowra { ra @Else rh @Else r @Else tbxra }
+ def rowrb { rb @Else rh @Else r @Else tbxrb }
+ def rowrl { rl @Else rv @Else r @Else tbxrl }
+ def rowrr { rr @Else rv @Else r @Else tbxrr }
+ def rowraw { raw @Else rhw @Else rw @Else tbxraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tbxrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tbxrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc }
+ def rowrpc { rpc @Else tbxrpc }
+
+ eformat
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 5) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ # symbol for producing @Rowf rows
+ def @DoRowf
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values at "foption" level (i.e. Level 3) #
+ # #
+ ###################################################################
+
+ def tbxp { fp @Else tblp }
+ def tbxbg { fbg @Else tblbg }
+ def tbxf { ff @Else tblf }
+ def tbxb { fb @Else tblb }
+ def tbxw { fw @Else tblw }
+ def tbxh { fh @Else tblh }
+ def tbxi { fi @Else tbli }
+ def tbxiv { fiv @Else tbliv }
+ def tbxs { fs @Else tbls }
+ def tbxsh { fsh @Else tblsh }
+ def tbxml { fml @Else fmh @Else fm @Else tblml }
+ def tbxmr { fmr @Else fmh @Else fm @Else tblmr }
+ def tbxma { fma @Else fmv @Else fm @Else tblma }
+ def tbxmb { fmb @Else fmv @Else fm @Else tblmb }
+ def tbxra { fra @Else frh @Else fr @Else tblra }
+ def tbxrb { frb @Else frh @Else fr @Else tblrb }
+ def tbxrl { frl @Else frv @Else fr @Else tblrl }
+ def tbxrr { frr @Else frv @Else fr @Else tblrr }
+ def tbxraw { fraw @Else frhw @Else frw @Else tblraw }
+ def tbxrbw { frbw @Else frhw @Else frw @Else tblrbw }
+ def tbxrlw { frlw @Else frvw @Else frw @Else tblrlw }
+ def tbxrrw { frrw @Else frvw @Else frw @Else tblrrw }
+ def tbxrag { frag @Else frhg @Else frg @Else tblrag }
+ def tbxrbg { frbg @Else frhg @Else frg @Else tblrbg }
+ def tbxrlg { frlg @Else frvg @Else frg @Else tblrlg }
+ def tbxrrg { frrg @Else frvg @Else frg @Else tblrrg }
+ def tbxrac { frac @Else frhc @Else frc @Else tblrac }
+ def tbxrbc { frbc @Else frhc @Else frc @Else tblrbc }
+ def tbxrlc { frlc @Else frvc @Else frc @Else tblrlc }
+ def tbxrrc { frrc @Else frvc @Else frc @Else tblrrc }
+ def tbxrpc { frpc @Else tblrpc }
+
+ ###################################################################
+ # #
+ # Specific option values at @Rowf level (i.e. Level 4) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tbxp }
+ def rowbg { bg @Else tbxbg }
+ def rowf { f @Else tbxf }
+ def rowb { b @Else tbxb }
+ def roww { w @Else tbxw }
+ def rowh { h @Else tbxh }
+ def rowi { i @Else tbxi }
+ def rowiv { iv @Else tbxiv }
+ def rows { s @Else tbxs }
+ def rowsh { sh @Else tbxsh }
+ def rowml { ml @Else mh @Else m @Else tbxml }
+ def rowmr { mr @Else mh @Else m @Else tbxmr }
+ def rowma { ma @Else mv @Else m @Else tbxma }
+ def rowmb { mb @Else mv @Else m @Else tbxmb }
+ def rowra { ra @Else rh @Else r @Else tbxra }
+ def rowrb { rb @Else rh @Else r @Else tbxrb }
+ def rowrl { rl @Else rv @Else r @Else tbxrl }
+ def rowrr { rr @Else rv @Else r @Else tbxrr }
+ def rowraw { raw @Else rhw @Else rw @Else tbxraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tbxrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tbxrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc }
+ def rowrpc { rpc @Else tbxrpc }
+
+ fformat
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 5) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ # symbol for producing @Rowg rows
+ def @DoRowg
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values at "doption" level (i.e. Level 3) #
+ # #
+ ###################################################################
+
+ def tbxp { gp @Else tblp }
+ def tbxbg { gbg @Else tblbg }
+ def tbxf { gf @Else tblf }
+ def tbxb { gb @Else tblb }
+ def tbxw { gw @Else tblw }
+ def tbxh { gh @Else tblh }
+ def tbxi { gi @Else tbli }
+ def tbxiv { giv @Else tbliv }
+ def tbxs { gs @Else tbls }
+ def tbxsh { gsh @Else tblsh }
+ def tbxml { gml @Else gmh @Else gm @Else tblml }
+ def tbxmr { gmr @Else gmh @Else gm @Else tblmr }
+ def tbxma { gma @Else gmv @Else gm @Else tblma }
+ def tbxmb { gmb @Else gmv @Else gm @Else tblmb }
+ def tbxra { gra @Else grh @Else gr @Else tblra }
+ def tbxrb { grb @Else grh @Else gr @Else tblrb }
+ def tbxrl { grl @Else grv @Else gr @Else tblrl }
+ def tbxrr { grr @Else grv @Else gr @Else tblrr }
+ def tbxraw { graw @Else grhw @Else grw @Else tblraw }
+ def tbxrbw { grbw @Else grhw @Else grw @Else tblrbw }
+ def tbxrlw { grlw @Else grvw @Else grw @Else tblrlw }
+ def tbxrrw { grrw @Else grvw @Else grw @Else tblrrw }
+ def tbxrag { grag @Else grhg @Else grg @Else tblrag }
+ def tbxrbg { grbg @Else grhg @Else grg @Else tblrbg }
+ def tbxrlg { grlg @Else grvg @Else grg @Else tblrlg }
+ def tbxrrg { grrg @Else grvg @Else grg @Else tblrrg }
+ def tbxrac { grac @Else grhc @Else grc @Else tblrac }
+ def tbxrbc { grbc @Else grhc @Else grc @Else tblrbc }
+ def tbxrlc { grlc @Else grvc @Else grc @Else tblrlc }
+ def tbxrrc { grrc @Else grvc @Else grc @Else tblrrc }
+ def tbxrpc { grpc @Else tblrpc }
+
+ ###################################################################
+ # #
+ # Specific option values at @Rowg level (i.e. Level 4) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tbxp }
+ def rowbg { bg @Else tbxbg }
+ def rowf { f @Else tbxf }
+ def rowb { b @Else tbxb }
+ def roww { w @Else tbxw }
+ def rowh { h @Else tbxh }
+ def rowi { i @Else tbxi }
+ def rowiv { iv @Else tbxiv }
+ def rows { s @Else tbxs }
+ def rowsh { sh @Else tbxsh }
+ def rowml { ml @Else mh @Else m @Else tbxml }
+ def rowmr { mr @Else mh @Else m @Else tbxmr }
+ def rowma { ma @Else mv @Else m @Else tbxma }
+ def rowmb { mb @Else mv @Else m @Else tbxmb }
+ def rowra { ra @Else rh @Else r @Else tbxra }
+ def rowrb { rb @Else rh @Else r @Else tbxrb }
+ def rowrl { rl @Else rv @Else r @Else tbxrl }
+ def rowrr { rr @Else rv @Else r @Else tbxrr }
+ def rowraw { raw @Else rhw @Else rw @Else tbxraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tbxrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tbxrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc }
+ def rowrpc { rpc @Else tbxrpc }
+
+ gformat
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 5) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ # symbol for producing @Rowh rows
+ def @DoRowh
+ named paint p {}
+ named background bg {}
+ named font f {}
+ named break b {}
+ named width w {}
+ named height h {}
+ named indent i {}
+ named indentvertical iv {}
+ named strut s {}
+ named struthorizontal sh {}
+ named margin m {}
+ named marginhorizontal mh {}
+ named marginleft ml {}
+ named marginright mr {}
+ named marginvertical mv {}
+ named marginabove ma {}
+ named marginbelow mb {}
+ named rule r {}
+ named rulehorizontal rh {}
+ named ruleabove ra {}
+ named rulebelow rb {}
+ named rulevertical rv {}
+ named ruleleft rl {}
+ named ruleright rr {}
+ named rulewidth rw {}
+ named rulehorizontalwidth rhw {}
+ named ruleabovewidth raw {}
+ named rulebelowwidth rbw {}
+ named ruleverticalwidth rvw {}
+ named ruleleftwidth rlw {}
+ named rulerightwidth rrw {}
+ named rulegap rg {}
+ named rulehorizontalgap rhg {}
+ named ruleabovegap rag {}
+ named rulebelowgap rbg {}
+ named ruleverticalgap rvg {}
+ named ruleleftgap rlg {}
+ named rulerightgap rrg {}
+ named rulecolour rulecolor rc {}
+ named rulehorizontalcolour rulehorizontalcolor rhc {}
+ named ruleabovecolour ruleabovecolor rac {}
+ named rulebelowcolour rulebelowcolor rbc {}
+ named ruleverticalcolour ruleverticalcolor rvc {}
+ named ruleleftcolour ruleleftcolor rlc {}
+ named rulerightcolour rulerightcolor rrc {}
+ named ruleplainchar rpc {}
+ named A {} named B {} named C {} named D {} named E {}
+ named F {} named G {} named H {} named I {} named J {}
+ named K {} named L {} named M {} named N {} named O {}
+ named P {} named Q {} named R {} named S {} named T {}
+ named U {} named V {} named W {} named X {} named Y {}
+ named Z {}
+ {
+
+ ###################################################################
+ # #
+ # Specific option values at "hoption" level (i.e. Level 3) #
+ # #
+ ###################################################################
+
+ def tbxp { hp @Else tblp }
+ def tbxbg { hbg @Else tblbg }
+ def tbxf { hf @Else tblf }
+ def tbxb { hb @Else tblb }
+ def tbxw { hw @Else tblw }
+ def tbxh { hh @Else tblh }
+ def tbxi { hi @Else tbli }
+ def tbxiv { hiv @Else tbliv }
+ def tbxs { hs @Else tbls }
+ def tbxsh { hsh @Else tblsh }
+ def tbxml { hml @Else hmh @Else hm @Else tblml }
+ def tbxmr { hmr @Else hmh @Else hm @Else tblmr }
+ def tbxma { hma @Else hmv @Else hm @Else tblma }
+ def tbxmb { hmb @Else hmv @Else hm @Else tblmb }
+ def tbxra { hra @Else hrh @Else hr @Else tblra }
+ def tbxrb { hrb @Else hrh @Else hr @Else tblrb }
+ def tbxrl { hrl @Else hrv @Else hr @Else tblrl }
+ def tbxrr { hrr @Else hrv @Else hr @Else tblrr }
+ def tbxraw { hraw @Else hrhw @Else hrw @Else tblraw }
+ def tbxrbw { hrbw @Else hrhw @Else hrw @Else tblrbw }
+ def tbxrlw { hrlw @Else hrvw @Else hrw @Else tblrlw }
+ def tbxrrw { hrrw @Else hrvw @Else hrw @Else tblrrw }
+ def tbxrag { hrag @Else hrhg @Else hrg @Else tblrag }
+ def tbxrbg { hrbg @Else hrhg @Else hrg @Else tblrbg }
+ def tbxrlg { hrlg @Else hrvg @Else hrg @Else tblrlg }
+ def tbxrrg { hrrg @Else hrvg @Else hrg @Else tblrrg }
+ def tbxrac { hrac @Else hrhc @Else hrc @Else tblrac }
+ def tbxrbc { hrbc @Else hrhc @Else hrc @Else tblrbc }
+ def tbxrlc { hrlc @Else hrvc @Else hrc @Else tblrlc }
+ def tbxrrc { hrrc @Else hrvc @Else hrc @Else tblrrc }
+ def tbxrpc { hrpc @Else tblrpc }
+
+ ###################################################################
+ # #
+ # Specific option values at @Rowh level (i.e. Level 4) #
+ # #
+ ###################################################################
+
+ def rowp { p @Else tbxp }
+ def rowbg { bg @Else tbxbg }
+ def rowf { f @Else tbxf }
+ def rowb { b @Else tbxb }
+ def roww { w @Else tbxw }
+ def rowh { h @Else tbxh }
+ def rowi { i @Else tbxi }
+ def rowiv { iv @Else tbxiv }
+ def rows { s @Else tbxs }
+ def rowsh { sh @Else tbxsh }
+ def rowml { ml @Else mh @Else m @Else tbxml }
+ def rowmr { mr @Else mh @Else m @Else tbxmr }
+ def rowma { ma @Else mv @Else m @Else tbxma }
+ def rowmb { mb @Else mv @Else m @Else tbxmb }
+ def rowra { ra @Else rh @Else r @Else tbxra }
+ def rowrb { rb @Else rh @Else r @Else tbxrb }
+ def rowrl { rl @Else rv @Else r @Else tbxrl }
+ def rowrr { rr @Else rv @Else r @Else tbxrr }
+ def rowraw { raw @Else rhw @Else rw @Else tbxraw }
+ def rowrbw { rbw @Else rhw @Else rw @Else tbxrbw }
+ def rowrlw { rlw @Else rvw @Else rw @Else tbxrlw }
+ def rowrrw { rrw @Else rvw @Else rw @Else tbxrrw }
+ def rowrag { rag @Else rhg @Else rg @Else tbxrag }
+ def rowrbg { rbg @Else rhg @Else rg @Else tbxrbg }
+ def rowrlg { rlg @Else rvg @Else rg @Else tbxrlg }
+ def rowrrg { rrg @Else rvg @Else rg @Else tbxrrg }
+ def rowrac { rac @Else rhc @Else rc @Else tbxrac }
+ def rowrbc { rbc @Else rhc @Else rc @Else tbxrbc }
+ def rowrlc { rlc @Else rvc @Else rc @Else tbxrlc }
+ def rowrrc { rrc @Else rvc @Else rc @Else tbxrrc }
+ def rowrpc { rpc @Else tbxrpc }
+
+ hformat
+ A { A } B { B } C { C } D { D } E { E } F { F }
+ G { G } H { H } I { I } J { J } K { K } L { L }
+ M { M } N { N } O { O } P { P } Q { Q } R { R }
+ S { S } T { T } U { U } V { V } W { W } X { X }
+ Y { Y } Z { Z }
+ @Cell {
+
+ @DoCell
+
+ #######################################################
+ # #
+ # Specific option values to @Cell (i.e. Level 5) #
+ # #
+ #######################################################
+
+ p { p @Else rowp }
+ bg { bg @Else rowbg }
+ f { f @Else rowf }
+ b { b @Else rowb }
+ w { w @Else roww }
+ h { h @Else rowh }
+ i { i @Else rowi }
+ iv { iv @Else rowiv }
+ s { s @Else rows }
+ sh { sh @Else rowsh }
+ ml { ml @Else mh @Else m @Else rowml }
+ mr { mr @Else mh @Else m @Else rowmr }
+ ma { ma @Else mv @Else m @Else rowma }
+ mb { mb @Else mv @Else m @Else rowmb }
+ ra { ra @Else rh @Else r @Else rowra }
+ rb { rb @Else rh @Else r @Else rowrb }
+ rl { rl @Else rv @Else r @Else rowrl }
+ rr { rr @Else rv @Else r @Else rowrr }
+ raw { raw @Else rhw @Else rw @Else rowraw }
+ rbw { rbw @Else rhw @Else rw @Else rowrbw }
+ rlw { rlw @Else rvw @Else rw @Else rowrlw }
+ rrw { rrw @Else rvw @Else rw @Else rowrrw }
+ rag { rag @Else rhg @Else rg @Else rowrag }
+ rbg { rbg @Else rhg @Else rg @Else rowrbg }
+ rlg { rlg @Else rvg @Else rg @Else rowrlg }
+ rrg { rrg @Else rvg @Else rg @Else rowrrg }
+ rac { rac @Else rhc @Else rc @Else rowrac }
+ rbc { rbc @Else rhc @Else rc @Else rowrbc }
+ rlc { rlc @Else rvc @Else rc @Else rowrlc }
+ rrc { rrc @Else rvc @Else rc @Else rowrrc }
+ rpc { rpc @Else rowrpc }
+
+ x
+ }
+ }
+
+ macro @Row { / @DoRow }
+ macro @Rowa { / @DoRowa }
+ macro @Rowb { / @DoRowb }
+ macro @Rowc { / @DoRowc }
+ macro @Rowd { / @DoRowd }
+ macro @Rowe { / @DoRowe }
+ macro @Rowf { / @DoRowf }
+ macro @Rowg { / @DoRowg }
+ macro @Rowh { / @DoRowh }
+
+ macro @FirstRow { @DoRow }
+ macro @FirstRowa { @DoRowa }
+ macro @FirstRowb { @DoRowb }
+ macro @FirstRowc { @DoRowc }
+ macro @FirstRowd { @DoRowd }
+ macro @FirstRowe { @DoRowe }
+ macro @FirstRowf { @DoRowf }
+ macro @FirstRowg { @DoRowg }
+ macro @FirstRowh { @DoRowh }
+
+ macro @MarkRow { ^/ @DoRow }
+ macro @MarkRowa { ^/ @DoRowa }
+ macro @MarkRowb { ^/ @DoRowb }
+ macro @MarkRowc { ^/ @DoRowc }
+ macro @MarkRowd { ^/ @DoRowd }
+ macro @MarkRowe { ^/ @DoRowe }
+ macro @MarkRowf { ^/ @DoRowf }
+ macro @MarkRowg { ^/ @DoRowg }
+ macro @MarkRowh { ^/ @DoRowh }
+
+ macro @NoBreakRow { /0iu @DoRow }
+ macro @NoBreakRowa { /0iu @DoRowa }
+ macro @NoBreakRowb { /0iu @DoRowb }
+ macro @NoBreakRowc { /0iu @DoRowc }
+ macro @NoBreakRowd { /0iu @DoRowd }
+ macro @NoBreakRowe { /0iu @DoRowe }
+ macro @NoBreakRowf { /0iu @DoRowf }
+ macro @NoBreakRowg { /0iu @DoRowg }
+ macro @NoBreakRowh { /0iu @DoRowh }
+
+ macro @NP { /"1.1b" }
+
+ @Body
+ }
+
+@End @TblSetup
diff --git a/include/tblf.lpg b/include/tblf.lpg
new file mode 100644
index 0000000..a31c30f
--- /dev/null
+++ b/include/tblf.lpg
@@ -0,0 +1,41 @@
+%%BeginResource: procset LoutTblPrependGraphic
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% PostScript @SysPrependGraphic file for @Tbl Jeffrey H. Kingston %
+% Version 1.0 June 1998 %
+% %
+% To assist in avoiding name clashes, the names of all symbols %
+% defined here begin with "ltbl". %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% painting (i.e. filling): - ltblwhite - (etc.)
+/ltblnopaint { } def
+/ltblnochange { fill } def
+/ltbldarkblue { 0.0 0.0 0.5 setrgbcolor fill } def
+/ltblblue { 0.0 0.0 1.0 setrgbcolor fill } def
+/ltbllightblue { 0.5 0.5 1.0 setrgbcolor fill } def
+/ltbldarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def
+/ltblgreen { 0.0 1.0 0.0 setrgbcolor fill } def
+/ltbllightgreen { 0.5 1.0 0.5 setrgbcolor fill } def
+/ltbldarkred { 0.5 0.0 0.0 setrgbcolor fill } def
+/ltblred { 1.0 0.0 0.0 setrgbcolor fill } def
+/ltbllightred { 1.0 0.5 0.5 setrgbcolor fill } def
+/ltbldarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def
+/ltblcyan { 0.0 1.0 1.0 setrgbcolor fill } def
+/ltbllightcyan { 0.5 1.0 1.0 setrgbcolor fill } def
+/ltbldarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def
+/ltblmagenta { 1.0 0.0 1.0 setrgbcolor fill } def
+/ltbllightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def
+/ltbldarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def
+/ltblyellow { 1.0 1.0 0.0 setrgbcolor fill } def
+/ltbllightyellow { 1.0 1.0 0.5 setrgbcolor fill } def
+/ltbldarkgray { 0.2 0.2 0.2 setrgbcolor fill } def
+/ltblgray { 0.5 0.5 0.5 setrgbcolor fill } def
+/ltbllightgray { 0.8 0.8 0.8 setrgbcolor fill } def
+/ltbldarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def
+/ltblgrey { 0.5 0.5 0.5 setrgbcolor fill } def
+/ltbllightgrey { 0.8 0.8 0.8 setrgbcolor fill } def
+/ltblblack { 0.0 0.0 0.0 setrgbcolor fill } def
+/ltblwhite { 1.0 1.0 1.0 setrgbcolor fill } def
+%%EndResource
diff --git a/include/ts b/include/ts
new file mode 100644
index 0000000..d78ed14
--- /dev/null
+++ b/include/ts
@@ -0,0 +1,105 @@
+
+###############################################################################
+# #
+# Lout @ToySetup package (Jeff Kingston, July 1993, updated October 1994) #
+# #
+# In response to a user request I have put together this tiny package for #
+# people to play with who want to start learning how to do page layout and #
+# galleys with Lout. It produces a very simple sequence of pages. To #
+# invoke the package, run "lout myfile > op" where myfile looks like this: #
+# #
+# @SysInclude { ts } #
+# @Use { @ToySetup } #
+# @Document #
+# // #
+# @Text { #
+# Any text you like here, using @I, @B, @Heading, @PP, @LP, @DP, #
+# @LeftDisplay, @IndentedDisplay, and @CenteredDisplay just as in #
+# DocumentSetup. #
+# } #
+# #
+###############################################################################
+
+@SysInclude { fontdefs }
+@SysInclude { langdefs }
+
+export @I @B @Heading @PP @LP @DP @NP
+ @LeftDisplay @IndentedDisplay @CenteredDisplay
+ @Text @Document
+
+def @ToySetup
+ named @PageWidth { 21.0c }
+ named @PageHeight { 29.7c }
+@Begin
+
+ ###########################################################################
+ # #
+ # Font changes, headings, and paragraphs. #
+ # #
+ ###########################################################################
+
+ def @I right x { Slope @Font x }
+ def @B right x { Bold @Font x }
+ def @Heading right x { ragged @Break @B x }
+
+ macro @PP { //1.3vx 1.0f @Wide &0i }
+ macro @LP { //1.3vx }
+ macro @DP { //0.5v }
+ macro @NP { //1.1b }
+
+
+ ###########################################################################
+ # #
+ # Displays. #
+ # #
+ ###########################################################################
+
+ def @DispPlace { @Galley }
+
+ def @Disp into { @DispPlace&&preceding }
+ right x
+ {
+ @OneRow x
+ }
+
+ macro @LeftDisplay { @DP | @DispPlace | @DP // @Disp }
+ macro @IndentedDisplay { @DP |2f @DispPlace | @DP // @Disp }
+ macro @CenteredDisplay { @DP |0.5rt @DispPlace | @DP // @Disp }
+
+
+ ###########################################################################
+ # #
+ # Page layout. #
+ # #
+ ###########################################################################
+
+ def @TextPlace { @Galley }
+
+ def @Text force into { @TextPlace&&preceding }
+ right x
+ {
+ x
+ }
+
+ def @Page right x
+ {
+ @PageWidth @Wide @PageHeight @High
+ { Times Base 12p } @Font
+ { adjust nohyphen 14px } @Break
+ English @Language { 0 0 0 } @SetColour
+ { //1i ||1i
+ @HExpand @VExpand x
+ ||1i //1i
+ }
+ }
+
+ def @PageList right num
+ {
+ @Page { |0.5rt - num - //0.4i @TextPlace }
+ //
+ @PageList @Next num
+ }
+
+ def @Document { @PageList 1 }
+
+@End @ToySetup