aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeffrey H. Kingston <jeff@it.usyd.edu.au>2010-09-14 20:38:39 +0000
committerJeffrey H. Kingston <jeff@it.usyd.edu.au>2010-09-14 20:38:39 +0000
commit68c155de3c3e83f53404288a318c5e29f0c4610f (patch)
tree3038e465a5cda497e52e93b4c5532b0dfa7d2c79 /include
parent78c2bcf9e96ab00615ee6f96905bca78fcd52a00 (diff)
downloadlout-68c155de3c3e83f53404288a318c5e29f0c4610f.tar.gz
Lout 3.28.
git-svn-id: http://svn.savannah.nongnu.org/svn/lout/trunk@25 9365b830-b601-4143-9ba8-b4a8e2c3339c
Diffstat (limited to 'include')
-rw-r--r--include/README4
-rw-r--r--include/book8
-rw-r--r--include/bookf56
-rw-r--r--include/bsf19
-rw-r--r--include/dsf30
-rw-r--r--include/np108
-rw-r--r--include/npf389
-rw-r--r--include/report2
-rw-r--r--include/ruby109
-rw-r--r--include/rubyf393
-rw-r--r--include/save_bookf1358
-rw-r--r--include/save_dsf4930
12 files changed, 7395 insertions, 11 deletions
diff --git a/include/README b/include/README
index 135cb4b..ebea782 100644
--- a/include/README
+++ b/include/README
@@ -33,10 +33,12 @@ Setup files (containing mainly lists of options settable by the user)
eiffel Eiffel
java Java
modula Modula-2 (quick hack, does not use prg2lout)
+ np Nonpareil
pas Pascal (quick hack, does not use prg2lout)
perl Perl + Pod
pod Pod
python Python
+ ruby Ruby
Source files containing Lout and PostScript source code for the packages
------------------------------------------------------------------------
@@ -67,10 +69,12 @@ Source files containing Lout and PostScript source code for the packages
eiffelf Eiffel
javaf Java
modulaf Modula-2
+ npf Nonpareil
pasf Pascal
perlf Perl
podf Pod
pythonf Python
+ rubyf Ruby
Obsolete source files retained for backward compatibility
---------------------------------------------------------
diff --git a/include/book b/include/book
index d823ab7..e2afc0f 100644
--- a/include/book
+++ b/include/book
@@ -206,6 +206,11 @@
# @IndexBSpacerBelow { 1v } # space below index B spacer
# @IndexBSpacerFont { +3p } # font of index B spacer
# @IndexBSpacerFormat { @Body } # format of index B spacer
+ # @MakeColophon { No } # make colophon? Yes or No
+ # @ColophonFont { } # font for colophon
+ # @ColophonBreak { } # break style for colophon
+ # @ColophonColumnNumber { 1 } # colophon columns (1 to 10)
+ # @ColophonColumnGap { 1.00c @OrIfPlain 6s } # colophon column gap
# @TopGap { 0.75c @OrIfPlain 2f } # gap between figures
# @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text
# @FootNoteNumbers { Arabic } # footnote numbers
@@ -318,6 +323,7 @@
# @IndexWord { index } # word for "Index"
# @IndexAWord { index } # word for "Index" (A)
# @IndexBWord { index } # word for "Index" (B)
+ # @ColophonWord { colophon } # word for "Colophon"
# @ChapterNumbers { Arabic } # kind of chapter numbers
# @FirstChapterNumber { 1 } # first chapter number (Arabic)
# @SectionNumbers { Arabic } # kind of section numbers
@@ -379,6 +385,7 @@
# @IndexInContents { Yes } # add index to contents
# @IndexAInContents { Yes } # add index A to contents
# @IndexBInContents { Yes } # add index B to contents
+ # @ColophonInContents { Yes } # add colophon to contents
# @PartContentsIndent { 0.5rt } # indent of part contents entry
# @ChapterNumInTheorems { Yes } # theorem num has chapter num
# @SectionNumInTheorems { No } # theorem num has section num
@@ -426,6 +433,7 @@
# @IndexPrefix { } # for structured page nums
# @IndexAPrefix { } # for structured page nums
# @IndexBPrefix { } # for structured page nums
+ # @ColophonPrefix { } # for structured page nums
}
diff --git a/include/bookf b/include/bookf
index c50d2cd..45a5bed 100644
--- a/include/bookf
+++ b/include/bookf
@@ -11,7 +11,7 @@
###########################################################################
extend @BasicSetup @DocumentSetup
-export @Book @Preface @Abbreviations @Introduction @Chapter @Appendix
+export @Book @Preface @Abbreviations @Introduction @Chapter @Appendix @Colophon
def @BookSetup
named @TitlePageFont { Helvetica Base }
named @SeparateIntroNumbering { Yes }
@@ -31,6 +31,7 @@ def @BookSetup
named @IndexWord { index }
named @IndexAWord { index }
named @IndexBWord { index }
+ named @ColophonWord { colophon }
named @ChapterNumbers { Arabic }
named @FirstChapterNumber { 1 }
@@ -111,6 +112,7 @@ def @BookSetup
named @IndexInContents { Yes }
named @IndexAInContents { Yes }
named @IndexBInContents { Yes }
+ named @ColophonInContents { Yes }
named @PartContentsIndent { 0.5rt }
named @ChapterNumInTheorems { Yes }
@@ -164,6 +166,7 @@ def @BookSetup
named @IndexPrefix { }
named @IndexAPrefix { }
named @IndexBPrefix { }
+ named @ColophonPrefix { }
@Begin
@@ -585,6 +588,38 @@ def @BookSetup
@IndexBSection @RunB
}
+ def @ColophonPart
+ named @Tag {}
+ {
+ def @RunC
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { index @WordVal @ColophonWord }
+ @MinorNum {}
+ @MinorTitle { index @WordVal @ColophonWord }
+ @Owner { @Tag }
+ @Prefix { @ColophonPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { colophon @WordVal @ColophonWord }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ incontents { @ColophonInContents }
+ pnprefix { @ColophonPrefix }
+ inrunners { Yes }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @ColophonSection @RunC
+ }
+
def @BookIntro force into { @IntroColPlace&&preceding }
named @Optimize { @OptimizePages }
{
@@ -644,6 +679,7 @@ def @BookSetup
Bypass @Yield @BypassBeginIndexPlace
else @Yield @Null
}
+ // @MakeColophon @Do @ColophonPart
}
def @BookCombined force into { @ColPlace&&preceding }
@@ -694,6 +730,7 @@ def @BookSetup
Bypass @Yield @BypassBeginIndexPlace
else @Yield @Null
}
+ // @MakeColophon @Do @ColophonPart
}
@InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break
@@ -1321,4 +1358,21 @@ def @BookSetup
}
+ #######################################################################
+ # #
+ # Colophon. #
+ # #
+ #######################################################################
+
+ def @Colophon into { @ColophonList&&preceding }
+ named @Tag {}
+ named @InitialLanguage {}
+ body @Body
+ {
+
+ @InitialLanguage @Language @Body
+
+ }
+
+
@End @BookSetup
diff --git a/include/bsf b/include/bsf
index afc3dba..dbf7eeb 100644
--- a/include/bsf
+++ b/include/bsf
@@ -110,7 +110,7 @@ export
@Word @Roman @UCRoman @Alpha @UCAlpha @Months @ShortMonths @WeekDays
@ShortWeekDays @TwelveHours @ShortHours @MeriDiems @ShortMeriDiems
- @Sym @R @I @B @BI @S @F @II
+ @Sym @Ding @R @I @B @BI @S @F @II
"~" "~~" "``" "''" ",," "--" "---" "..."
@Bullet @ParSym @SectSym @Dagger @DaggerDbl @CDot @Sterling @Yen @Florin
@@ -279,18 +279,19 @@ def @BasicSetup
###########################################################################
# #
- # @Sym, font symbols, and miscellaneous special characters. #
+ # @Sym, @Ding font symbols, and miscellaneous special characters. #
# #
###########################################################################
- def @Sym right x { { Symbol Base } @Font @Char x }
+ def @Sym right x { { Symbol Base } @Font @Char x }
+ def @Ding right x { { Dingbats 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 { @FixedWidthFont @Font 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 { @FixedWidthFont @Font x }
def @II
right x
diff --git a/include/dsf b/include/dsf
index 5e1ee73..18a3825 100644
--- a/include/dsf
+++ b/include/dsf
@@ -326,6 +326,11 @@ def @DocumentSetup
named @IndexBSpacerFont { +3p } # font of index B spacer
named @IndexBSpacerFormat
right @Body { @Body } # format of index B spacer
+ named @MakeColophon { No } # make colophon? Yes or No
+ named @ColophonFont { } # font for colophon
+ named @ColophonBreak { } # break style for colophon
+ named @ColophonColumnNumber { 1 } # colophon columns (1 to 10)
+ named @ColophonColumnGap { 1.00c @OrIfPlain 6s } # colophon column gap
named @TopGap { 0.75c @OrIfPlain 2f } # gap between figures
named @MidGap { 0.75c @OrIfPlain 2f } # gap above/below body text
@@ -1227,6 +1232,7 @@ def @DocumentSetup
def @IndexPlace { @Galley }
def @IndexAPlace { @Galley }
def @IndexBPlace { @Galley }
+ def @ColophonPlace { @Galley }
def @AfterLinePlace { @ForceGalley }
def @TryAfterLinePlace right x
@@ -1434,6 +1440,11 @@ def @DocumentSetup
{
@HExpand num @ColsOf gap { @IndexBColumnGap } @EqualWidth @VExpand @IndexBPlace
}
+
+ def @ColophonColList right num
+ {
+ @HExpand num @ColsOf gap { @ColophonColumnGap } @EqualWidth @VExpand @ColophonPlace
+ }
###########################################################################
@@ -1567,6 +1578,7 @@ def @DocumentSetup
@IndexAColList @IndexAColumnNumber
@IndexBColList @IndexBColumnNumber
@IndexColList @IndexColumnNumber
+ @ColophonColList @ColophonColumnNumber
}
}
@@ -1579,6 +1591,7 @@ def @DocumentSetup
@IndexAColList @IndexAColumnNumber
@IndexBColList @IndexBColumnNumber
@IndexColList @IndexColumnNumber
+ @ColophonColList @ColophonColumnNumber
}
}
@@ -4707,6 +4720,23 @@ def @DocumentSetup
###########################################################################
# #
+ # Colophon. #
+ # #
+ ###########################################################################
+
+ def @ColophonList { @Galley //1vx @ColophonList }
+
+ def @ColophonSection into { @ColophonPlace&&following }
+ right etc
+ {
+ // @ColophonBreak @Break @ColophonFont @Font @ColophonList
+ // etc
+ //1rt
+ }
+
+
+ ###########################################################################
+ # #
# @LargeScaleStructure #
# #
# The prototype for the value of each large-scale structure symbol #
diff --git a/include/np b/include/np
new file mode 100644
index 0000000..247da10
--- /dev/null
+++ b/include/np
@@ -0,0 +1,108 @@
+###############################################################################
+# #
+# Lout setup file for Nonpareil program printing #
+# #
+# Jeffrey H. Kingston #
+# 3 December 2002 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# @SysInclude line #
+# #
+# This line causes Lout to read the definitions for this programming #
+# language, and should not be touched. #
+# #
+###############################################################################
+
+@SysInclude { npf }
+
+
+###############################################################################
+# #
+# @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 { @NonpareilSetup
+ # pipe { } # pipe source through this
+ # numbered { No } # No, Yes, or a line number
+ # style { symbol @OrIfPlain fixed } # fixed, varying, or symbol
+
+ # the following options apply when style is "fixed"
+
+ # fixedfont { Courier } # font family
+ # fixedsize { -1.0p } # font size
+ # fixedline { 1.0vx } # line-space
+ # fixedtabin { 8 } # tab interval
+ # fixedtabout { 8s } # tab width
+
+ # fixedidentifiers { Base } # identifier face
+ # fixedkeywords { Base } # keyword face
+ # fixedoperators { Base } # operator face
+ # fixednumbers { Base } # number face
+ # fixedstrings { Base } # string face
+ # fixedcomments { Base } # comment face
+ # fixedlinenumbers { Base } # line numbers face
+
+ # fixedidentifiersformat { @Body } # identifiers format
+ # fixedkeywordsformat { @Body } # keywords format
+ # fixedoperatorsformat { @Body } # operators format
+ # fixednumbersformat { @Body } # numbers format
+ # fixedstringsformat { @Body } # strings format
+ # fixedcommentsformat { @Body } # comments format
+ # fixedlinenumbersformat { @Body } # line numbers format
+
+ # the following options apply when style is "varying"
+
+ # varyingfont { } # font family
+ # varyingsize { 1.0f } # font size
+ # varyingline { 1.0vx } # line-space
+ # varyingtabin { 8 } # tab interval
+ # varyingtabout { 3f } # tab width
+
+ # varyingidentifiers { Slope } # identifier face
+ # varyingkeywords { Bold } # keyword face
+ # varyingoperators { Base } # operator face
+ # varyingnumbers { Base } # number face
+ # varyingstrings { Slope } # string face
+ # varyingcomments { Base } # comment face
+ # varyinglinenumbers { Base } # line numbers face
+
+ # varyingidentifiersformat { @Body } # identifiers format
+ # varyingkeywordsformat { @Body } # keywords format
+ # varyingoperatorsformat { @Body } # operators format
+ # varyingnumbersformat { @Body } # numbers format
+ # varyingstringsformat { @Body } # strings format
+ # varyingcommentsformat { @Body } # comments format
+ # varyinglinenumbersformat { @Body } # line numbers format
+
+ # the following options apply when style is "symbol"
+
+ # symbolfont { } # font family
+ # symbolsize { 1.0f } # font size
+ # symbolline { 1.0vx } # line-space
+ # symboltabin { 8 } # tab interval
+ # symboltabout { 3f } # tab width
+
+ # symbolidentifiers { Slope } # identifier face
+ # symbolkeywords { Bold } # keyword face
+ # symboloperators { Base } # operator face
+ # symbolnumbers { Base } # number face
+ # symbolstrings { Slope } # string face
+ # symbolcomments { Base } # comment face
+ # symbollinenumbers { Base } # line numbers face
+
+ # symbolidentifiersformat { @Body } # identifiers format
+ # symbolkeywordsformat { @Body } # keywords format
+ # symboloperatorsformat { @Body } # operators format
+ # symbolnumbersformat { @Body } # numbers format
+ # symbolstringsformat { @Body } # strings format
+ # symbolcommentsformat { @Body } # comments format
+ # symbollinenumbersformat { @Body } # line numbers format
+}
diff --git a/include/npf b/include/npf
new file mode 100644
index 0000000..a45a94c
--- /dev/null
+++ b/include/npf
@@ -0,0 +1,389 @@
+
+###############################################################################
+# #
+# Lout @NonpareilSetup package for formatting Nonpareil programs #
+# #
+# Jeffrey H. Kingston #
+# 3 December 2002 #
+# #
+# This package uses a filtered body parameter to convert program source #
+# code into Lout source. The filter program is prg2lout, which is #
+# distributed with Lout and should be compiled and installed wherever #
+# Lout itself is. #
+# #
+###############################################################################
+
+export @Nonpareil
+def @NonpareilSetup
+ named pipe { } # pipe through this
+ named numbered { No } # numbered lines?
+ named style
+ named @OrIfPlain left x right y
+ { @BackEnd @Case { PlainText @Yield y else @Yield x } }
+ { symbol @OrIfPlain fixed } # print style
+
+ # the following options apply when style is "fixed"
+ named fixedfont { Courier }# font family
+ named fixedsize { -1.0p } # font size
+ named fixedline { 1.0vx } # line-space
+ named fixedtabin { 8 } # tab interval
+ named fixedtabout { 8s } # tab width
+
+ named fixedidentifiers { Base } # identifier face
+ named fixedkeywords { Base } # keyword face
+ named fixedoperators { Base } # operator face
+ named fixednumbers { Base } # number face
+ named fixedstrings { Base } # string face
+ named fixedcomments { Base } # comment face
+ named fixedlinenumbers { Base } # line numbers face
+
+ named fixedidentifiersformat right @Body { @Body } # identifier format
+ named fixedkeywordsformat right @Body { @Body } # keyword format
+ named fixedoperatorsformat right @Body { @Body } # operators format
+ named fixednumbersformat right @Body { @Body } # number format
+ named fixedstringsformat right @Body { @Body } # string format
+ named fixedcommentsformat right @Body { @Body } # comment format
+ named fixedlinenumbersformat right @Body { @Body } # line nums format
+
+ # the following options apply when style is "varying"
+ named varyingfont { } # font family
+ named varyingsize { 1.0f } # font size
+ named varyingline { 1.0vx } # line-space
+ named varyingtabin { 8 } # tab interval
+ named varyingtabout { 3f } # tab width
+
+ named varyingidentifiers { Slope } # identifier face
+ named varyingkeywords { Bold } # keyword face
+ named varyingoperators { Base } # operator face
+ named varyingnumbers { Base } # number face
+ named varyingstrings { Slope } # string face
+ named varyingcomments { Base } # comment face
+ named varyinglinenumbers { Base } # line numbers face
+
+ named varyingidentifiersformat right @Body { @Body } # identifier format
+ named varyingkeywordsformat right @Body { @Body } # keyword format
+ named varyingoperatorsformat right @Body { @Body } # operators format
+ named varyingnumbersformat right @Body { @Body } # number format
+ named varyingstringsformat right @Body { @Body } # string format
+ named varyingcommentsformat right @Body { @Body } # comment format
+ named varyinglinenumbersformat right @Body { @Body } # line nums format
+
+ # the following options apply when style is "symbol"
+ named symbolfont { } # font family
+ named symbolsize { 1.0f } # font size
+ named symbolline { 1.0vx } # line-space
+ named symboltabin { 8 } # tab interval
+ named symboltabout { 3f } # tab width
+
+ named symbolidentifiers { Slope } # identifier face
+ named symbolkeywords { Bold } # keyword face
+ named symboloperators { Base } # operator face
+ named symbolnumbers { Base } # number face
+ named symbolstrings { Slope } # string face
+ named symbolcomments { Base } # comment face
+ named symbollinenumbers { Base } # line numbers face
+
+ named symbolidentifiersformat right @Body { @Body } # identifier format
+ named symbolkeywordsformat right @Body { @Body } # keyword format
+ named symboloperatorsformat right @Body { @Body } # operators format
+ named symbolnumbersformat right @Body { @Body } # number format
+ named symbolstringsformat right @Body { @Body } # string format
+ named symbolcommentsformat right @Body { @Body } # comment format
+ named symbollinenumbersformat right @Body { @Body } # line nums format
+
+@Begin
+
+ export
+
+ @PI @PK @PO @PN @PS @PC @PL @PA @PM @PD
+ @A "$>"
+
+ def @Nonpareil
+ named style { style } # style
+ named numbered { numbered } # want numbered lines?
+ named pipe { pipe } # pipe through this first
+ named font { dft } # font family
+ named size { dft } # font size
+ named line { dft } # line-space
+ named tabin { dft } # tab interval
+ named tabout { dft } # tab width
+ named identifiers { dft } # ident. font
+ named keywords { dft } # keyword font
+ named operators { dft } # operator font
+ named numbers { dft } # number font
+ named strings { dft } # string font
+ named comments { dft } # comment font
+ named linenumbers { dft } # line numbers font
+ 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 @Else # returns x, or y if x is dft
+ left x
+ right y
+ {
+ x @Case {
+ dft @Yield y
+ 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
+ {
+ def wantnumbered
+ {
+ numbered @Case {
+ { No no } @Yield ""
+ { Yes yes } @Yield "-L"
+ else @Yield { "-L"numbered }
+ }
+ }
+
+ pipe @Case {
+ "" @Yield {
+ "prg2lout -r -lNonpareil" wantnumbered -i{@FilterIn}
+ -o{@FilterOut} -e{@FilterErr}
+ -t{@InitTab} -T{@InitTabWidth}
+ }
+ else @Yield {
+ "cat" @FilterIn "|" pipe "|"
+ "prg2lout -r -lNonpareil" wantnumbered -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 @PI # for formatting identifiers
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedidentifiersformat {
+ { identifiers @Else fixedidentifiers } @Font x
+ }
+ varying @Yield varyingidentifiersformat {
+ { identifiers @Else varyingidentifiers } @Font x
+ }
+ symbol @Yield symbolidentifiersformat {
+ { identifiers @Else symbolidentifiers } @Font x
+ }
+ }
+ }
+
+
+ def @PK # for formatting keywords
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedkeywordsformat {
+ { keywords @Else fixedkeywords } @Font x
+ }
+ varying @Yield varyingkeywordsformat {
+ { keywords @Else varyingkeywords } @Font x
+ }
+ symbol @Yield symbolkeywordsformat {
+ { keywords @Else symbolkeywords } @Font x
+ }
+ }
+ }
+
+
+ def @PO # for formatting operators
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedoperatorsformat {
+ { operators @Else fixedoperators } @Font x
+ }
+ varying @Yield varyingoperatorsformat {
+ { operators @Else varyingoperators } @Font x
+ }
+ symbol @Yield symboloperatorsformat {
+ { operators @Else symboloperators } @Font x
+ }
+ }
+ }
+
+
+ def @PN # for formatting numbers
+ right x
+ {
+ style @Case {
+ fixed @Yield fixednumbersformat {
+ { numbers @Else fixednumbers } @Font x
+ }
+ varying @Yield varyingnumbersformat {
+ { numbers @Else varyingnumbers } @Font x
+ }
+ symbol @Yield symbolnumbersformat {
+ { numbers @Else symbolnumbers } @Font x
+ }
+ }
+ }
+
+
+ def @PS # for formatting strings
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedstringsformat {
+ { strings @Else fixedstrings } @Font x
+ }
+ varying @Yield varyingstringsformat {
+ { strings @Else varyingstrings } @Font x
+ }
+ symbol @Yield symbolstringsformat {
+ { strings @Else symbolstrings } @Font x
+ }
+ }
+ }
+
+
+ def @PC # for formatting comments
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedcommentsformat {
+ { comments @Else fixedcomments } @Font x
+ }
+ varying @Yield varyingcommentsformat {
+ { comments @Else varyingcomments } @Font x
+ }
+ symbol @Yield symbolcommentsformat {
+ { comments @Else symbolcomments } @Font x
+ }
+ }
+ }
+
+
+ def @PL # for formatting line numbers
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedlinenumbersformat {
+ { linenumbers @Else fixedlinenumbers } @Font x
+ }
+ varying @Yield varyinglinenumbersformat {
+ { linenumbers @Else varyinglinenumbers } @Font x
+ }
+ symbol @Yield symbollinenumbersformat {
+ { linenumbers @Else symbollinenumbers } @Font x
+ }
+ }
+ }
+
+
+ def @PA # for formatting asterisks
+ {
+ @PO @BackEnd @Case {
+ PlainText @Yield "*"
+ else @Yield { "0.5w" @VShift "*" }
+ }
+ }
+
+
+ def @PM # for formatting minus signs
+ {
+ @PO @BackEnd @Case {
+ PlainText @Yield "-"
+ else @Yield style @Case {
+ fixed @Yield "-"
+ else @Yield { { Symbol Base } @Font @Char "minus" }
+ }
+ }
+ }
+
+
+ def @PD # for formatting dots, if wanted larger
+ {
+ @PO @BackEnd @Case {
+ PlainText @Yield "."
+ else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" }
+ }
+ }
+
+
+ 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 "$>" { {} & }
+
+
+ { @InitFontFamily Base @InitSize } @Font
+ { @InitLine lines nohyphen } @Break @Body
+
+ @End @Nonpareil
+
+@End @NonpareilSetup
diff --git a/include/report b/include/report
index aa79533..7666e93 100644
--- a/include/report
+++ b/include/report
@@ -325,7 +325,7 @@
# @AbstractWord { abstract } # word for "Abstract"
# @ContentsWord { contents } # word for "Contents"
# @AppendixWord { appendix } # word for "Appendix"
- # @GlossaryWor { glossary } # word for "Glossary"
+ # @GlossaryWord { glossary } # word for "Glossary"
# @IndexWord { index } # word for "Index"
# @IndexAWord { index } # word for "Index" (A)
# @IndexBWord { index } # word for "Index" (B)
diff --git a/include/ruby b/include/ruby
new file mode 100644
index 0000000..8ee57d5
--- /dev/null
+++ b/include/ruby
@@ -0,0 +1,109 @@
+###############################################################################
+# #
+# Lout setup file for Ruby program printing #
+# #
+# Version 3.0 #
+# Jeffrey H. Kingston #
+# 5 April 2000 #
+# #
+###############################################################################
+
+
+###############################################################################
+# #
+# @SysInclude line #
+# #
+# This line causes Lout to read the definitions for this programming #
+# language, and should not be touched. #
+# #
+###############################################################################
+
+@SysInclude { rubyf }
+
+
+###############################################################################
+# #
+# @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 { @RubySetup
+ # pipe { } # pipe source through this
+ # numbered { No } # No, Yes, or a line number
+ style { fixed @OrIfPlain fixed } # fixed, varying, or symbol
+
+ # the following options apply when style is "fixed"
+
+ # fixedfont { LetterGothic } # font family
+ # fixedsize { -1.0p } # font size
+ # fixedline { 1.0vx } # line-space
+ # fixedtabin { 8 } # tab interval
+ # fixedtabout { 8s } # tab width
+
+ # fixedidentifiers { Base } # identifier face
+ # fixedkeywords { Bold } # keyword face
+ # fixedoperators { Base } # operator face
+ # fixednumbers { Base } # number face
+ # fixedstrings { Base } # string face
+ # fixedcomments { Slope } # comment face
+ # fixedlinenumbers { Base } # line numbers face
+
+ # fixedidentifiersformat { @Body } # identifiers format
+ # fixedkeywordsformat { @Body } # keywords format
+ # fixedoperatorsformat { @Body } # operators format
+ # fixednumbersformat { @Body } # numbers format
+ # fixedstringsformat { @Body } # strings format
+ # fixedcommentsformat { @Body } # comments format
+ # fixedlinenumbersformat { @Body } # line numbers format
+
+ # the following options apply when style is "varying"
+
+ # varyingfont { } # font family
+ # varyingsize { 1.0f } # font size
+ # varyingline { 1.0vx } # line-space
+ # varyingtabin { 8 } # tab interval
+ # varyingtabout { 3f } # tab width
+
+ # varyingidentifiers { Slope } # identifier face
+ # varyingkeywords { Bold } # keyword face
+ # varyingoperators { Base } # operator face
+ # varyingnumbers { Base } # number face
+ # varyingstrings { Slope } # string face
+ # varyingcomments { Base } # comment face
+ # varyinglinenumbers { Base } # line numbers face
+
+ # varyingidentifiersformat { @Body } # identifiers format
+ # varyingkeywordsformat { @Body } # keywords format
+ # varyingoperatorsformat { @Body } # operators format
+ # varyingnumbersformat { @Body } # numbers format
+ # varyingstringsformat { @Body } # strings format
+ # varyingcommentsformat { @Body } # comments format
+ # varyinglinenumbersformat { @Body } # line numbers format
+
+ # the following options apply when style is "symbol"
+
+ # symbolfont { } # font family
+ # symbolsize { 1.0f } # font size
+ # symbolline { 1.0vx } # line-space
+ # symboltabin { 8 } # tab interval
+ # symboltabout { 3f } # tab width
+
+ # symbolidentifiers { Slope } # identifier face
+ # symbolkeywords { Bold } # keyword face
+ # symboloperators { Base } # operator face
+ # symbolnumbers { Base } # number face
+ # symbolstrings { Slope } # string face
+ # symbolcomments { Base } # comment face
+ # symbollinenumbers { Base } # line numbers face
+
+ # symbolidentifiersformat { @Body } # identifiers format
+ # symbolkeywordsformat { @Body } # keywords format
+ # symboloperatorsformat { @Body } # operators format
+ # symbolnumbersformat { @Body } # numbers format
+ # symbolstringsformat { @Body } # strings format
+ # symbolcommentsformat { @Body } # comments format
+ # symbollinenumbersformat { @Body } # line numbers format
+}
diff --git a/include/rubyf b/include/rubyf
new file mode 100644
index 0000000..89f38e0
--- /dev/null
+++ b/include/rubyf
@@ -0,0 +1,393 @@
+
+###############################################################################
+# #
+# Lout @RubySetup package for formatting Ruby programs #
+# #
+# Version 3.0 #
+# Jeffrey H. Kingston #
+# 5 April 2000 #
+# #
+# This package uses a filtered body parameter to convert program source #
+# code into Lout source. The filter program is prg2lout, which is #
+# distributed with Lout and should be compiled and installed wherever #
+# Lout itself is. #
+# #
+###############################################################################
+
+export @Ruby
+def @RubySetup
+ named pipe { } # pipe through this first
+ named numbered { No } # want lines numbered?
+ named style
+ named @OrIfPlain left x right y
+ { @BackEnd @Case { PlainText @Yield y else @Yield x } }
+ { varying @OrIfPlain fixed } # print style
+
+ # the following options apply when style is "fixed"
+ named fixedfont { Courier }# font family
+ named fixedsize { -1.0p } # font size
+ named fixedline { 1.0vx } # line-space
+ named fixedtabin { 8 } # tab interval
+ named fixedtabout { 8s } # tab width
+
+ named fixedidentifiers { Base } # identifier face
+ named fixedkeywords { Bold } # keyword face
+ named fixedoperators { Base } # operator face
+ named fixednumbers { Base } # number face
+ named fixedstrings { Base } # string face
+ named fixedcomments { Slope } # comment face
+ named fixedlinenumbers { Base } # line numbers face
+
+ named fixedidentifiersformat right @Body { @Body } # identifier format
+ named fixedkeywordsformat right @Body { @Body } # keyword format
+ named fixedoperatorsformat right @Body { @Body } # operators format
+ named fixednumbersformat right @Body { @Body } # number format
+ named fixedstringsformat right @Body { @Body } # string format
+ named fixedcommentsformat right @Body { @Body } # comment format
+ named fixedlinenumbersformat right @Body { @Body } # line nums format
+
+ # the following options apply when style is "varying"
+ named varyingfont { } # font family
+ named varyingsize { 1.0f } # font size
+ named varyingline { 1.0vx } # line-space
+ named varyingtabin { 8 } # tab interval
+ named varyingtabout { 3f } # tab width
+
+ named varyingidentifiers { Slope } # identifier face
+ named varyingkeywords { Bold } # keyword face
+ named varyingoperators { Base } # operator face
+ named varyingnumbers { Base } # number face
+ named varyingstrings { Slope } # string face
+ named varyingcomments { Base } # comment face
+ named varyinglinenumbers { Base } # line numbers face
+
+ named varyingidentifiersformat right @Body { @Body } # identifier format
+ named varyingkeywordsformat right @Body { @Body } # keyword format
+ named varyingoperatorsformat right @Body { @Body } # operators format
+ named varyingnumbersformat right @Body { @Body } # number format
+ named varyingstringsformat right @Body { @Body } # string format
+ named varyingcommentsformat right @Body { @Body } # comment format
+ named varyinglinenumbersformat right @Body { @Body } # line nums format
+
+ # the following options apply when style is "symbol"
+ named symbolfont { } # font family
+ named symbolsize { 1.0f } # font size
+ named symbolline { 1.0vx } # line-space
+ named symboltabin { 8 } # tab interval
+ named symboltabout { 3f } # tab width
+
+ named symbolidentifiers { Slope } # identifier face
+ named symbolkeywords { Bold } # keyword face
+ named symboloperators { Base } # operator face
+ named symbolnumbers { Base } # number face
+ named symbolstrings { Slope } # string face
+ named symbolcomments { Base } # comment face
+ named symbollinenumbers { Base } # line numbers face
+
+ named symbolidentifiersformat right @Body { @Body } # identifier format
+ named symbolkeywordsformat right @Body { @Body } # keyword format
+ named symboloperatorsformat right @Body { @Body } # operators format
+ named symbolnumbersformat right @Body { @Body } # number format
+ named symbolstringsformat right @Body { @Body } # string format
+ named symbolcommentsformat right @Body { @Body } # comment format
+ named symbollinenumbersformat right @Body { @Body } # line nums format
+
+@Begin
+
+ export
+
+ @PI @PK @PO @PN @PS @PC @PL @PA @PM @PD
+ @A "$>"
+
+ def @Ruby
+ named style { style } # style
+ named numbered { numbered } # want numbered lines?
+ named pipe { pipe } # pipe through this first
+ named font { dft } # font family
+ named size { dft } # font size
+ named line { dft } # line-space
+ named tabin { dft } # tab interval
+ named tabout { dft } # tab width
+ named identifiers { dft } # ident. font
+ named keywords { dft } # keyword font
+ named operators { dft } # operator font
+ named numbers { dft } # number font
+ named strings { dft } # string font
+ named comments { dft } # comment font
+ named linenumbers { dft } # line numbers font
+ 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 @Else # returns x, or y if x is dft
+ left x
+ right y
+ {
+ x @Case {
+ dft @Yield y
+ 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
+ {
+ def wantnumbered
+ {
+ numbered @Case {
+ { No no } @Yield ""
+ { Yes yes } @Yield "-L"
+ else @Yield { "-L"numbered }
+ }
+ }
+
+ pipe @Case {
+ "" @Yield {
+ "prg2lout -r -lRuby" wantnumbered -i{@FilterIn}
+ -o{@FilterOut} -e{@FilterErr}
+ -t{@InitTab} -T{@InitTabWidth}
+ }
+ else @Yield {
+ "cat" @FilterIn "|" pipe "|"
+ "prg2lout -r -lRuby" wantnumbered -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 @PI # for formatting identifiers
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedidentifiersformat {
+ { identifiers @Else fixedidentifiers } @Font x
+ }
+ varying @Yield varyingidentifiersformat {
+ { identifiers @Else varyingidentifiers } @Font x
+ }
+ symbol @Yield symbolidentifiersformat {
+ { identifiers @Else symbolidentifiers } @Font x
+ }
+ }
+ }
+
+
+ def @PK # for formatting keywords
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedkeywordsformat {
+ { keywords @Else fixedkeywords } @Font x
+ }
+ varying @Yield varyingkeywordsformat {
+ { keywords @Else varyingkeywords } @Font x
+ }
+ symbol @Yield symbolkeywordsformat {
+ { keywords @Else symbolkeywords } @Font x
+ }
+ }
+ }
+
+
+ def @PO # for formatting operators
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedoperatorsformat {
+ { operators @Else fixedoperators } @Font x
+ }
+ varying @Yield varyingoperatorsformat {
+ { operators @Else varyingoperators } @Font x
+ }
+ symbol @Yield symboloperatorsformat {
+ { operators @Else symboloperators } @Font x
+ }
+ }
+ }
+
+
+ def @PN # for formatting numbers
+ right x
+ {
+ style @Case {
+ fixed @Yield fixednumbersformat {
+ { numbers @Else fixednumbers } @Font x
+ }
+ varying @Yield varyingnumbersformat {
+ { numbers @Else varyingnumbers } @Font x
+ }
+ symbol @Yield symbolnumbersformat {
+ { numbers @Else symbolnumbers } @Font x
+ }
+ }
+ }
+
+
+ export "'''"
+ def @PS # for formatting strings
+ body x
+ {
+ def "'''" { "'''" }
+
+ style @Case {
+ fixed @Yield fixedstringsformat {
+ { strings @Else fixedstrings } @Font x
+ }
+ varying @Yield varyingstringsformat {
+ { strings @Else varyingstrings } @Font x
+ }
+ symbol @Yield symbolstringsformat {
+ { strings @Else symbolstrings } @Font x
+ }
+ }
+ }
+
+
+ def @PC # for formatting comments
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedcommentsformat {
+ { comments @Else fixedcomments } @Font x
+ }
+ varying @Yield varyingcommentsformat {
+ { comments @Else varyingcomments } @Font x
+ }
+ symbol @Yield symbolcommentsformat {
+ { comments @Else symbolcomments } @Font x
+ }
+ }
+ }
+
+
+ def @PL # for formatting line numbers
+ right x
+ {
+ style @Case {
+ fixed @Yield fixedlinenumbersformat {
+ { linenumbers @Else fixedlinenumbers } @Font x
+ }
+ varying @Yield varyinglinenumbersformat {
+ { linenumbers @Else varyinglinenumbers } @Font x
+ }
+ symbol @Yield symbollinenumbersformat {
+ { linenumbers @Else symbollinenumbers } @Font x
+ }
+ }
+ }
+
+
+ def @PA # for formatting asterisks
+ {
+ @PO @BackEnd @Case {
+ PlainText @Yield "*"
+ else @Yield { "0.5w" @VShift "*" }
+ }
+ }
+
+
+ def @PM # for formatting minus signs
+ {
+ @PO @BackEnd @Case {
+ PlainText @Yield "-"
+ else @Yield style @Case {
+ fixed @Yield "-"
+ else @Yield { { Symbol Base } @Font @Char "minus" }
+ }
+ }
+ }
+
+
+ def @PD # for formatting dots, if wanted larger
+ {
+ @PO @BackEnd @Case {
+ PlainText @Yield "."
+ else @Yield { "1.4f" @Font "+0.04f" @VShift "." &"0.05f" }
+ }
+ }
+
+
+ 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 "$>" { {} & }
+
+
+ { @InitFontFamily Base @InitSize } @Font
+ { @InitLine lines nohyphen } @Break @Body
+
+ @End @Ruby
+
+@End @RubySetup
diff --git a/include/save_bookf b/include/save_bookf
new file mode 100644
index 0000000..001f946
--- /dev/null
+++ b/include/save_bookf
@@ -0,0 +1,1358 @@
+
+###########################################################################
+# #
+# @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 @GlossaryWord { glossary }
+ named @IndexWord { index }
+ named @IndexAWord { index }
+ named @IndexBWord { index }
+ named @ColophonWord { colophon }
+
+ 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 { Yes }
+ 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 @GlossaryInContents { Yes }
+ named @IndexInContents { Yes }
+ named @IndexAInContents { Yes }
+ named @IndexBInContents { Yes }
+ named @ColophonInContents { 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 @GlossaryPrefix { }
+ named @IndexPrefix { }
+ named @IndexAPrefix { }
+ named @IndexBPrefix { }
+ named @ColophonPrefix { }
+
+@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 on a new page, even #
+ # if @ChapterStartPages is SamePage. #
+ # #
+ #######################################################################
+
+ 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 SamePage } @Yield @Any x
+ Odd @Yield @Odd x
+ Even @Yield @Even x
+ }
+ }
+
+
+ #######################################################################
+ # #
+ # @ChapterFull - this sends text to a full-width place on a new #
+ # page, unless @ChapterStartPages is SamePage, in which case it #
+ # doesn't send the text anywhere. #
+ # #
+ #######################################################################
+
+ def @ChapterFull 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
+ SamePage @Yield 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 SamePage } @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 @InitialFont { @InitialFont }
+ named @InitialBreak { @InitialBreak }
+ named @InitialOutdent { @InitialOutdent }
+ named @InitialSpace { @InitialSpace }
+ named @InitialLanguage { @InitialLanguage }
+ named @PageOrientation { @PageOrientation }
+ named @PageHeaders { @PageHeaders }
+ named @ColumnNumber { @ColumnNumber }
+ named @FirstPageNumber { @FirstPageNumber }
+ named @IntroFirstPageNumber { @IntroFirstPageNumber }
+ named @OptimizePages { @OptimizePages }
+ named @GlossaryText { @GlossaryText }
+ named @IndexText { @IndexText }
+ named @IndexAText { @IndexAText }
+ named @IndexBText { @IndexBText }
+ {
+ 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 { @ChapterFull @Body }
+ innergap { @SectionGap }
+ @ReferencesSection
+
+ }
+
+ def @GlossaryPart
+ named @Tag {}
+ {
+ def @Run
+ {
+ NonStart @Runner
+ @MajorNum {}
+ @MajorTitle { glossary @WordVal @GlossaryWord }
+ @MinorNum {}
+ @MinorTitle { glossary @WordVal @GlossaryWord }
+ @Owner { @Tag }
+ @Prefix { @GlossaryPrefix }
+ }
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ title { glossary @WordVal @GlossaryWord }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @ChapterHeadingFont }
+ headingbreak { @ChapterHeadingBreak }
+ headingformat { @Num @ChapterHeadingFormat @Body }
+ headingtext { @GlossaryText }
+ incontents { @GlossaryInContents }
+ pnprefix { @GlossaryPrefix }
+ inrunners { Yes }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @GlossarySection @Run
+ }
+
+ 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 }
+ headingtext { @IndexText }
+ 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 }
+ headingtext { @IndexAText }
+ 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 }
+ headingtext { @IndexAText }
+ incontents { @IndexBInContents }
+ pnprefix { @IndexBPrefix }
+ inrunners { Yes }
+ sendheader { @Full @Body }
+ innergap { @SectionGap }
+ wantindefinite { Yes }
+ @IndexBSection @RunB
+ }
+
+ def @BookIntro force into { @IntroColPlace&&preceding }
+ named @Optimize { @OptimizePages }
+ {
+ @NoLinkPageMark @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
+ }
+ // @MakeGlossary @Do @GlossaryPart
+ // @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 }
+ {
+ @NoLinkPageMark @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
+ }
+ // @MakeGlossary @Do @GlossaryPart
+ // @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 setoutdent @InitialOutdent } @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 }
+ // None @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 {
+ @PartTitle @Case {
+ "" @Yield @Null
+ else @Yield @Part
+ }
+ }
+ 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 { @ChapterFull @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 {
+ @PartTitle @Case {
+ "" @Yield @Null
+ else @Yield @Part
+ }
+ }
+ 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 { @ChapterFull @Body }
+ innergap { @SubAppendixGap }
+ inrunners { Yes }
+ @Body
+
+ }
+
+
+ def @Colophon force into { @ColophonPlace&&preceding }
+ named @Tag {}
+ named @InitialLanguage {}
+ named @PartNumber {}
+ named @PartTitle {}
+ named @PartText {}
+ named @BypassNumber { dft }
+ body @Body
+ {
+
+ @LargeScaleStructure
+ tag { @Tag }
+ type { Major }
+ initiallanguage { @InitialLanguage }
+ aboveheadinggap { @AboveChapterGap }
+ headingfont { @AppendixHeadingFont }
+ headingbreak { @AppendixHeadingBreak }
+ headingformat { @Num @AppendixHeadingFormat @Body }
+ incontents { @ColophonInContents }
+ contentsindent { 0f }
+ word { colophon @WordVal @ColophonWord }
+ numbers { None }
+ pnprefix { @ColophonPrefix }
+ sendheader { @ChapterFull @Body }
+ innergap { @SubAppendixGap }
+ inrunners { Yes }
+ @Body
+
+ }
+
+
+@End @BookSetup
diff --git a/include/save_dsf b/include/save_dsf
new file mode 100644
index 0000000..5e1ee73
--- /dev/null
+++ b/include/save_dsf
@@ -0,0 +1,4930 @@
+###############################################################################
+# #
+# Lout @DocumentSetup package #
+# #
+# 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. #
+# Version 3.21 by Jeffrey H. Kingston, May 2000. #
+# #
+# 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
+
+ @Glossary @InGlossary
+
+ @IndexA @SubIndexA @SubSubIndexA
+ @RawIndexA @RawSubIndexA @RawSubSubIndexA
+ @IndexABlanks @IndexASpacer @InitialIndexASpacer @IndexALetters
+
+ @IndexB @SubIndexB @SubSubIndexB
+ @RawIndexB @RawSubIndexB @RawSubSubIndexB
+ @IndexBBlanks @IndexBSpacer @InitialIndexBSpacer @IndexBLetters
+
+ @Index @SubIndex @SubSubIndex
+ @RawIndex @RawSubIndex @RawSubSubIndex
+ @IndexBlanks @IndexSpacer @InitialIndexSpacer @IndexLetters
+
+ @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 @OddLeftBodyMargin { 0c } # extra margin for page body
+ named @OddRightBodyMargin { 0c } # extra margin for page body
+ named @EvenLeftBodyMargin { 0c } # extra margin for page body
+ named @EvenRightBodyMargin { 0c } # extra margin for page body
+ named @PageBoxType { None } # None Box CurveBox ShadowBox
+ named @PageBoxMargin { 1.00c } # page box margin
+ import @PSLengths named @PageBoxLineWidth
+ { } # page box line thickness
+ named @PageBoxPaint { none } # page box paint
+ named @PageBoxShadow { 0.60c } # shadow margin if ShadowBox
+ named @PageEnclose right @Body { @Body } # page enclose
+ 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 { -2p } # figure caption font
+ named @FigureCaptionBreak { adjust hyphen 1.2fx } # figure caption break
+ named @FigureCaptionFormat named word {} named number {} named caption {}
+ { {@B { word @NumSep number. &2s }} @Insert caption }
+ named @TableCaptionFont { -2p } # figure caption font
+ named @TableCaptionBreak { adjust hyphen 1.2fx } # 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 @CiteOrder {}
+ 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 @MakeGlossary { No } # make glossary? Yes or No
+ named @GlossaryText { @Null } # initial glossary text
+ named @GlossaryFont { } # font for glossary
+ named @GlossaryBreak { } # break style for glossary
+ named @GlossaryFormat # format for glossary
+ named @Name {}
+ named @PageNum {}
+ named @Body {}
+ { +3p @Font @S @Name
+ @Right @I { @Word&&page @PageNum }
+ @DP @RawIndentedDisplay @Body }
+ named @GlossaryGap { @DisplayGap } # gap between glossary items
+ named @GlossaryColumnNumber { 2 } # glossary columns (1 to 10)
+ named @GlossaryColumnGap { 1.00c @OrIfPlain 6s } # glossary column gap
+ named @InGlossaryFont { smallcaps } # font for @InGlossary
+ named @InGlossaryFormat right @Body { @Body } # format for @InGlossary
+ named @MakeIndex { No } # make index? Yes or No
+ named @IndexText { @Null } # initial index text
+ named @IndexFont { } # index entries font
+ named @IndexBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index entries break
+ named @IndexFormat
+ right @Body { @Body } # @Index format
+ named @SubIndexFormat
+ right @Body { {1f @Wide}@Body } # @SubIndex format
+ named @SubSubIndexFormat
+ right @Body { {2f @Wide}@Body } # @SubSubIndex format
+ named @IndexColumnNumber { 2 } # index columns (1 to 10)
+ named @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap
+ named @IndexCtd { Yes } # include (ctd.) lines
+ named @IndexCtdWord { continued } # "ctd." in current lang
+ named @IndexCtdFormat
+ left @Body
+ right @CtdWord
+ { @Body @I (@CtdWord) } # (ctd.) format
+ named @IndexSpacerAbove { 2v } # space above index spacer
+ named @IndexSpacerBelow { 1v } # space below index spacer
+ named @IndexSpacerFont { +3p } # font of index spacer
+ named @IndexSpacerFormat
+ right @Body { @Body } # format of index spacer
+ named @MakeIndexA { No } # make index A? Yes or No
+ named @IndexAText { @Null } # initial index text
+ named @IndexAFont { } # index A entries font
+ named @IndexABreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index A entries break
+ named @IndexAFormat
+ right @Body { @Body } # @IndexA format
+ named @SubIndexAFormat
+ right @Body { {1f @Wide}@Body } # @SubIndexA format
+ named @SubSubIndexAFormat
+ right @Body { {2f @Wide}@Body } # @SubSubIndexA format
+ named @IndexAColumnNumber { 2 } # index A columns (1 to 10)
+ named @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap
+ named @IndexACtd { Yes } # include (ctd.) lines
+ named @IndexACtdWord { continued } # "ctd." in current lang
+ named @IndexACtdFormat
+ left @Body
+ right @CtdWord
+ { @Body @I (@CtdWord) } # (ctd.) format
+ named @IndexASpacerAbove { 2v } # space above index A spacer
+ named @IndexASpacerBelow { 1v } # space below index A spacer
+ named @IndexASpacerFont { +3p } # font of index A spacer
+ named @IndexASpacerFormat
+ right @Body { @Body } # format of index A spacer
+ named @MakeIndexB { No } # make index B? Yes or No
+ named @IndexBText { @Null } # initial index text
+ named @IndexBFont { } # index B entries font
+ named @IndexBBreak { {oragged 1.2fx} @OrIfPlain {oragged 1fx} } # index B entries break
+ named @IndexBFormat
+ right @Body { @Body } # @IndexB format
+ named @SubIndexBFormat
+ right @Body { {1f @Wide}@Body } # @SubIndexB format
+ named @SubSubIndexBFormat
+ right @Body { {2f @Wide}@Body } # @SubSubIndexB format
+ named @IndexBColumnNumber { 2 } # index B columns (1 to 10)
+ named @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap
+ named @IndexBCtd { Yes } # include (ctd.) lines
+ named @IndexBCtdWord { continued } # "ctd." in current lang
+ named @IndexBCtdFormat
+ left @Body
+ right @CtdWord
+ { @Body @I (@CtdWord) } # (ctd.) format
+ named @IndexBSpacerAbove { 2v } # space above index B spacer
+ named @IndexBSpacerBelow { 1v } # space below index B spacer
+ named @IndexBSpacerFont { +3p } # font of index B spacer
+ named @IndexBSpacerFormat
+ right @Body { @Body } # format of index B spacer
+ 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 @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
+ {
+ @PageSet
+ { @OrientationAngle @Orient } @Rotate
+ { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High
+ { //@TopMargin ||@OddLeftMargin
+ { // || @PageBackground } @Background
+ # 1 @MargSet
+ @PageEnclose @PageBox @HExpand { extra // @VExpand x }
+ ||@OddRightMargin //@FootMargin
+ }
+ }
+
+ def @EvenPage
+ left extra
+ named @Orient {}
+ right x
+ {
+ @PageSet
+ { @OrientationAngle @Orient } @Rotate
+ { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High
+ { //@TopMargin ||@EvenLeftMargin
+ { // || @PageBackground } @Background
+ # 0 @MargSet
+ @PageEnclose @PageBox @HExpand { extra // @VExpand x }
+ ||@EvenRightMargin //@FootMargin
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Definitions for page headers and footers. There are 16 symbols here, #
+ # in the following arrangement: #
+ # #
+ # @(- | 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
+ # "(@Runner:"@Start":"@MajorTitle")"
+ }
+
+ 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 @GlossaryPlace { @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 @GlossaryColList right num
+ {
+ @HExpand num @ColsOf gap { @GlossaryColumnGap } @EqualWidth @VExpand @GlossaryPlace
+ }
+
+ 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 arrangement: #
+ # #
+ # @(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
+ @GlossaryColList @GlossaryColumnNumber
+ @IndexAColList @IndexAColumnNumber
+ @IndexBColList @IndexBColumnNumber
+ @IndexColList @IndexColumnNumber
+ }
+ }
+
+ def @ChooseIntroColList right colnum
+ {
+ @OneOf
+ {
+ @IntroColList colnum
+ @GlossaryColList @GlossaryColumnNumber
+ @IndexAColList @IndexAColumnNumber
+ @IndexBColList @IndexBColumnNumber
+ @IndexColList @IndexColumnNumber
+ }
+ }
+
+ def @OddBodyMargins right x
+ {
+ @OddLeftBodyMargin @Wide {} || 1 @MargSet x || @OddRightBodyMargin @Wide {}
+ }
+
+ def @EvenBodyMargins right x
+ {
+ @EvenLeftBodyMargin @Wide {} || 0 @MargSet x || @EvenRightBodyMargin @Wide {}
+ }
+
+ 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
+ @OddBodyMargins {
+ @AtTop
+ //@MidGap @PageOddTopSection @Orient
+ //@MidGap @ChooseColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @OddBodyMargins @PageFootSection
+ //@MidGap {@PageHeaders.{@SStart @PageNum}} @OddFootHeader
+ { @PageNumbers @Num @PageNum }
+ }
+ }
+
+ def @FullPageOddPage
+ {
+ {@PageHeaders.{@SStart @PageNum}} @OddTopHeader
+ { @PageNumbers @Num @PageNum }
+ //@MidGap @OddBodyMargins @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
+ @EvenBodyMargins {
+ @PageEvenTopSection @Orient
+ //@MidGap @ChooseColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @EvenBodyMargins @PageFootSection
+ //@MidGap @PageHeaders.NonStart @EvenFootHeader
+ { @PageNumbers @Num @PageNum }
+ }
+ }
+
+ def @FullPageEvenPage
+ {
+ @PageHeaders.NonStart @EvenTopHeader
+ { @PageNumbers @Num @PageNum }
+ //@MidGap @EvenBodyMargins @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 @OddBodyMargins @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 @OddBodyMargins @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient }
+ {
+ {@PageHeaders.{@SStart @PageNum}} @IntroOddTopHeader
+ { @IntroPageNumbers @Num @PageNum }
+ //@MidGap
+ @OddBodyMargins {
+ @AtTop
+ //@MidGap @PageIntroOddTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @OddBodyMargins @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
+ @EvenBodyMargins {
+ @PageIntroEvenTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @EvenBodyMargins @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
+ @EvenBodyMargins {
+ @PageIntroEvenTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @EvenBodyMargins @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 @OddBodyMargins @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient }
+ {
+ {@PageHeaders.{@SStart @PageNum}} @IntroOddTopHeader
+ { @IntroPageNumbers @Num @PageNum }
+ //@MidGap
+ @OddBodyMargins {
+ @AtTop
+ //@MidGap @PageIntroOddTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @OddBodyMargins @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
+ @OddBodyMargins {
+ @AtTop
+ //@MidGap @PageOddTopSection @Orient
+ //@MidGap @ChooseColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @OddBodyMargins @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
+ @OddBodyMargins {
+ @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
+ @EvenBodyMargins {
+ @PageEvenTopSection @Orient
+ //@MidGap @ChooseColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @EvenBodyMargins @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
+ @EvenBodyMargins @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 @OddBodyMargins @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 @OddBodyMargins @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
+ @OddBodyMargins {
+ @AtTop
+ //@MidGap @PageIntroOddTopSection @Orient
+ //@MidGap @IntroColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @OddBodyMargins @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
+ @EvenBodyMargins {
+ @PageIntroEvenTopSection @Orient
+ //@MidGap @ChooseIntroColList @ColumnNumber
+ }
+ //1rt @OneRow
+ { // @EvenBodyMargins @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 NoTitles } @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 NoTitles } @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 crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGap }
+ named postgap { 0c }
+ named protect { No }
+ {
+# def @Leaders { @ContentsLeader &@ContentsLeaderGap @Leaders }
+
+ def @Leaders { @ContentsLeaderGap @Wide {} & @ContentsLeader & @Leaders }
+
+ def @OptionalCrossLink right x
+ {
+ crosstag @Case {
+ "" @Yield x
+ else @Yield { crosstag @CrossLink x }
+ }
+ }
+
+ def @RightPart
+ {
+ @ContentsRightWidth @Wide {
+ &1rt { @OptionalCrossLink pagenum //0.5vx }
+ }
+ }
+
+# def @Item
+# {
+# |indent @OptionalCrossLink number @ContentsFormat @HExpand {
+# title & @ContentsLeaderGap @Wide &1rt @OneCol {
+# @Leaders & @RightPart &0io
+# }
+# }
+# |@ContentsRightWidth
+# }
+
+ def @Item
+ {
+ |indent @OptionalCrossLink number @ContentsFormat @HExpand {
+ title &1rt @OneCol {
+ @Leaders & @RightPart &0io
+ }
+ }
+ |@ContentsRightWidth
+ }
+
+ //pregap
+ //0.5vx
+ protect @Case {
+ No @Yield @Item
+ Yes @Yield @Protect @Item
+ }
+ //postgap
+ }
+
+ def @ContentsPlace { @Galley }
+ def @FigureContentsPlace { @Galley }
+ def @TableContentsPlace { @Galley }
+
+ def @SendContents into { @ContentsPlace&&foll_or_prec }
+ right x
+ {
+ x
+ }
+
+ def @SendFigureContents into { @FigureContentsPlace&&foll_or_prec }
+ right x
+ {
+ x
+ }
+
+ def @SendTableContents into { @TableContentsPlace&&foll_or_prec }
+ right x
+ {
+ x
+ }
+
+ def @ContentsEntry
+ left wanted
+ named indent { 0f }
+ named crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGap }
+ named postgap { 0c }
+ {
+ @MakeContents.wanted @Case {
+ Yes.Yes @Yield { @SendContents @ContentsItem
+ indent { indent }
+ crosstag { crosstag }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { pregap }
+ postgap { postgap }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @FigureContentsEntry
+ left wanted
+ named indent { 0f }
+ named crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGap }
+ named postgap { 0c }
+ {
+ @MakeFigureContents.wanted @Case {
+ Yes.Yes @Yield { @SendFigureContents @ContentsItem
+ indent { indent }
+ crosstag { crosstag }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { pregap }
+ postgap { postgap }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @TableContentsEntry
+ left wanted
+ named indent { 0f }
+ named crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGap }
+ named postgap { 0c }
+ {
+ @MakeTableContents.wanted @Case {
+ Yes.Yes @Yield { @SendTableContents @ContentsItem
+ indent { indent }
+ crosstag { crosstag }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { pregap }
+ postgap { postgap }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @MajorContentsEntry
+ left wanted
+ named indent { 0f }
+ named crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ named pregap { @ContentsGapAbove }
+ named postgap { @ContentsGapBelow }
+ {
+ @MakeContents.wanted @Case {
+ Yes.Yes @Yield { @SendContents @ContentsItem
+ indent { indent }
+ crosstag { crosstag }
+ 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 crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ {
+ @MakeContents @Case {
+ Bypass @Yield { @ContentsItem
+ indent { indent }
+ crosstag { crosstag }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { @ContentsGap }
+ postgap { 0c }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @BypassFigureContentsEntry into { @FigureContentsPlace&&preceding }
+ named indent { 0f }
+ named crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ {
+ @MakeFigureContents @Case {
+ Bypass @Yield { @ContentsItem
+ indent { indent }
+ crosstag { crosstag }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { @ContentsGap }
+ postgap { 0c }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @BypassTableContentsEntry into { @TableContentsPlace&&preceding }
+ named indent { 0f }
+ named crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ {
+ @MakeTableContents @Case {
+ Bypass @Yield { @ContentsItem
+ indent { indent }
+ crosstag { crosstag }
+ number { number }
+ title { title }
+ pagenum { pagenum }
+ pregap { @ContentsGap }
+ postgap { 0c }
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @BypassMajorContentsEntry into { @ContentsPlace&&preceding }
+ named indent { 0f }
+ named crosstag {}
+ named number {}
+ named title {}
+ named pagenum {}
+ {
+ @MakeContents @Case {
+ Bypass @Yield { @ContentsItem
+ indent { indent }
+ crosstag { crosstag }
+ 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
+ import @PSLengths 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 }
+ import @PSLengths 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
+ {
+ tag @CrossLink @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 } }
+
+ @CiteOrder { {@NumberOf tag} @Case {
+ "??" @Yield "??"
+ else @Yield { "1000" @Plus @NumberOf tag }
+ }
+ }
+
+ @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
+ {
+ @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
+ }
+ 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 }
+ crosstag { @Tag }
+ number { @FigureNumber }
+ title { @InitialLanguage @Language @ContentsCaption }
+ pagenum { @PageOf @Tag }
+ // @FigureCounterIncrement @Tag
+ // @Body
+ // @PageMark @Tag
+ }
+ }
+
+ 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 }
+ crosstag { @Tag }
+ number { @TableNumber }
+ title { @InitialLanguage @Language @ContentsCaption }
+ pagenum { @PageOf @Tag }
+ // @TableCounterIncrement @Tag
+ // @Body
+ // @PageMark @Tag
+ }
+ }
+
+ 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
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Glossary. #
+ # #
+ ###########################################################################
+
+ def @GlossaryList { @Galley //@GlossaryGap @GlossaryList }
+
+ def @GlossarySection into { @GlossaryPlace&&following }
+ right etc
+ {
+ // @GlossaryList
+ // etc
+ //1rt
+ }
+
+ def @DoGlossary into { @GlossaryList&&following }
+ left @Key
+ named name {}
+ named pnum {}
+ right body
+ {
+ @GlossaryFont @Font @GlossaryBreak @Break @GlossaryFormat
+ @Name { name }
+ @PageNum { pnum }
+ @Body { body }
+ }
+
+ def @Glossary
+ left name
+ named sortkey { dft }
+ right body
+ {
+ def key { sortkey @Dft name }
+
+ @MakeGlossary @Case {
+ { Yes yes } @Yield { @PageMark key &
+ key @DoGlossary name { name } pnum { @PageOf key } body
+ }
+ else @Yield @Null
+ }
+ }
+
+ def @InGlossary
+ right x
+ {
+ @MakeGlossary @Case {
+ { Yes yes } @Yield { @InGlossaryFormat @InGlossaryFont @Font x }
+ else @Yield x
+ }
+ }
+
+
+ ###########################################################################
+ # #
+ # Index. #
+ # #
+ ###########################################################################
+
+ def @IndexList { @Galley //1vx @IndexList }
+ def @BypassIndexList { @Galley //1vx @BypassIndexList }
+
+ def @IndexSection into { @IndexPlace&&following }
+ right etc
+ {
+ // @IndexBreak @Break @IndexList
+ // @IndexBreak @Break @BypassIndexList
+ // @ClearHeaderComponent
+ // etc
+ //1rt
+ }
+
+ def @DoIndex into { @IndexList&&following }
+ left @Key # sort key
+ named pgrange {} # page numbers, or empty if none
+ named depth {} # 0, 1, or 2 (@Index, @Sub, or @SubSub)
+ right body # body, not including any prefix
+ {
+ def @Body
+ {
+ depth @Case {
+ 0 @Yield @IndexFormat body
+ 1 @Yield @SubIndexFormat body
+ 2 @Yield @SubSubIndexFormat body
+ }
+ }
+
+ def @Enclose right x
+ {
+ @IndexCtd.depth @Case {
+
+ Yes.0 @Yield {
+ @ClearHeaderComponent
+ //1vx
+ x
+ //1vx
+ 1vx @SetHeaderComponent {
+ @Body @IndexCtdFormat {continued @WordVal @IndexCtdWord}
+ }
+ //1vx
+ 1vx @BeginHeaderComponent (unused)
+ }
+
+ Yes.1 @Yield {
+ @EndHeaderComponent
+ //1vx
+ x
+ //1vx
+ 1vx @BeginHeaderComponent {
+ @Body @IndexCtdFormat {continued @WordVal @IndexCtdWord}
+ }
+ }
+
+ else @Yield x
+
+ }
+ }
+
+ def @Merge left lpart right rpart
+ {
+ { lpart @Rump { lpart @Meld rpart } } @Case
+ {
+ "" @Yield lpart
+ else @Yield { { lpart{@OneCol ,} } @Meld rpart }
+ }
+
+ }
+
+ @IndexFont @Font @IndexBreak @Break pgrange @Case {
+ "" @Yield { @Body &"0.03fu" {} }
+ else @Yield { @Body &"0.03fu" {}{@OneCol ,} pgrange }
+
+ }
+ }
+
+ def @RawIndex
+ left lpart
+ named depth { 0 }
+ right rpart
+ {
+ @MakeIndex @Case {
+ Yes @Yield { lpart @DoIndex depth { depth } rpart }
+ else @Yield @Null
+ }
+ }
+
+ macro @RawSubIndex { @RawIndex depth { 1 } }
+ macro @RawSubSubIndex { @RawIndex depth { 2 } }
+
+ def @Index
+ left lpart
+ named @Tag {}
+ named depth { 0 }
+ named to {}
+ right rpart
+ {
+ def @PgMk right tag
+ {
+ tag @CrossLink @PageOf tag
+ }
+
+ def @PgRange
+ {
+ to @Case
+ {
+ "" @Yield @PgMk @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PgMk @Tag }
+ else @Yield { {@PgMk @Tag}--{@PgMk to} }
+ }
+ }
+ }
+ }
+
+ @MakeIndex @Case {
+ Yes @Yield {
+ @PageMark @Tag &
+ lpart @DoIndex depth { depth } pgrange { @PgRange } rpart }
+ else @Yield @Null
+ }
+ }
+
+ macro @SubIndex { @Index depth { 1 } }
+ macro @SubSubIndex { @Index depth { 2 } }
+
+ 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 @IndexSpacer
+ left lpart
+ named above { @IndexSpacerAbove }
+ named below { @IndexSpacerBelow }
+ named font { @IndexSpacerFont }
+ named format right @Body { @IndexSpacerFormat @Body }
+ right rpart
+ {
+ def @Send into { @IndexList&&following }
+ right @Key
+ {
+ @ClearHeaderComponent
+ //
+ //above
+ @CNP
+ @OneRow { font @Font format rpart //below }
+ }
+
+ @MakeIndex @Case {
+ Yes @Yield @Send lpart
+ else @Yield @Null
+ }
+ }
+
+ macro @InitialIndexSpacer { @IndexSpacer above { 0i } }
+
+ def @IndexLetters
+ {
+ a @InitialIndexSpacer A
+ b @IndexSpacer B c @IndexSpacer C d @IndexSpacer D e @IndexSpacer E
+ f @IndexSpacer F g @IndexSpacer G h @IndexSpacer H i @IndexSpacer I
+ j @IndexSpacer J k @IndexSpacer K l @IndexSpacer L m @IndexSpacer M
+ n @IndexSpacer N o @IndexSpacer O p @IndexSpacer P q @IndexSpacer Q
+ r @IndexSpacer R s @IndexSpacer S t @IndexSpacer T u @IndexSpacer U
+ v @IndexSpacer V w @IndexSpacer W x @IndexSpacer X y @IndexSpacer Y
+ z @IndexSpacer Z
+ }
+
+ 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
+ {
+ // @IndexABreak @Break @IndexAList
+ // @IndexABreak @Break @BypassIndexAList
+ // @ClearHeaderComponent
+ // etc
+ //1rt
+ }
+
+ def @DoIndexA into { @IndexAList&&following }
+ left @Key # sort key
+ named pgrange {} # page numbers, or empty if none
+ named depth {} # 0, 1, or 2 (@IndexA, @Sub, or @SubSub)
+ right body # body, not including any prefix
+ {
+ def @Body
+ {
+ depth @Case {
+ 0 @Yield @IndexAFormat body
+ 1 @Yield @SubIndexAFormat body
+ 2 @Yield @SubSubIndexAFormat body
+ }
+ }
+
+ def @Enclose right x
+ {
+ @IndexACtd.depth @Case {
+
+ Yes.0 @Yield {
+ @ClearHeaderComponent
+ //1vx
+ x
+ //1vx
+ 1vx @SetHeaderComponent {
+ @Body @IndexACtdFormat {continued @WordVal @IndexACtdWord}
+ }
+ //1vx
+ 1vx @BeginHeaderComponent (unused)
+ }
+
+ Yes.1 @Yield {
+ @EndHeaderComponent
+ //1vx
+ x
+ //1vx
+ 1vx @BeginHeaderComponent {
+ @Body @IndexACtdFormat {continued @WordVal @IndexACtdWord}
+ }
+ }
+
+ else @Yield x
+
+ }
+ }
+
+ def @Merge left lpart right rpart
+ {
+ { lpart @Rump { lpart @Meld rpart } } @Case
+ {
+ "" @Yield lpart
+ else @Yield { { lpart{@OneCol ,} } @Meld rpart }
+ }
+
+ }
+
+ @IndexAFont @Font @IndexABreak @Break pgrange @Case {
+ "" @Yield { @Body &"0.03fu" {} }
+ else @Yield { @Body &"0.03fu" {}{@OneCol ,} pgrange }
+
+ }
+ }
+
+ def @RawIndexA
+ left lpart
+ named depth { 0 }
+ right rpart
+ {
+ @MakeIndexA @Case {
+ Yes @Yield { lpart @DoIndexA depth { depth } rpart }
+ else @Yield @Null
+ }
+ }
+
+ macro @RawSubIndexA { @RawIndexA depth { 1 } }
+ macro @RawSubSubIndexA { @RawIndexA depth { 2 } }
+
+ def @IndexA
+ left lpart
+ named @Tag {}
+ named depth { 0 }
+ named to {}
+ right rpart
+ {
+ def @PgMk right tag
+ {
+ tag @CrossLink @PageOf tag
+ }
+
+ def @PgRange
+ {
+ to @Case
+ {
+ "" @Yield @PgMk @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PgMk @Tag }
+ else @Yield { {@PgMk @Tag}--{@PgMk to} }
+ }
+ }
+ }
+ }
+
+ @MakeIndexA @Case {
+ Yes @Yield {
+ @PageMark @Tag &
+ lpart @DoIndexA depth { depth } pgrange { @PgRange } rpart }
+ else @Yield @Null
+ }
+ }
+
+ macro @SubIndexA { @IndexA depth { 1 } }
+ macro @SubSubIndexA { @IndexA depth { 2 } }
+
+ 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 @IndexASpacer
+ left lpart
+ named above { @IndexASpacerAbove }
+ named below { @IndexASpacerBelow }
+ named font { @IndexASpacerFont }
+ named format right @Body { @IndexASpacerFormat @Body }
+ right rpart
+ {
+ def @Send into { @IndexAList&&following }
+ right @Key
+ {
+ @ClearHeaderComponent
+ //
+ //above
+ @CNP
+ @OneRow { font @Font format rpart //below }
+ }
+
+ @MakeIndexA @Case {
+ Yes @Yield @Send lpart
+ else @Yield @Null
+ }
+ }
+
+ macro @InitialIndexASpacer { @IndexASpacer above { 0i } }
+
+ def @IndexALetters
+ {
+ a @InitialIndexASpacer A
+ b @IndexASpacer B c @IndexASpacer C d @IndexASpacer D e @IndexASpacer E
+ f @IndexASpacer F g @IndexASpacer G h @IndexASpacer H i @IndexASpacer I
+ j @IndexASpacer J k @IndexASpacer K l @IndexASpacer L m @IndexASpacer M
+ n @IndexASpacer N o @IndexASpacer O p @IndexASpacer P q @IndexASpacer Q
+ r @IndexASpacer R s @IndexASpacer S t @IndexASpacer T u @IndexASpacer U
+ v @IndexASpacer V w @IndexASpacer W x @IndexASpacer X y @IndexASpacer Y
+ z @IndexASpacer Z
+ }
+
+ 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
+ {
+ // @IndexBBreak @Break @IndexBList
+ // @IndexBBreak @Break @BypassIndexBList
+ // @ClearHeaderComponent
+ // etc
+ //1rt
+ }
+
+ def @DoIndexB into { @IndexBList&&following }
+ left @Key # sort key
+ named pgrange {} # page numbers, or empty if none
+ named depth {} # 0, 1, or 2 (@IndexB, @Sub, or @SubSub)
+ right body # body, not including any prefix
+ {
+ def @Body
+ {
+ depth @Case {
+ 0 @Yield @IndexBFormat body
+ 1 @Yield @SubIndexBFormat body
+ 2 @Yield @SubSubIndexBFormat body
+ }
+ }
+
+ def @Enclose right x
+ {
+ @IndexBCtd.depth @Case {
+
+ Yes.0 @Yield {
+ @ClearHeaderComponent
+ //1vx
+ x
+ //1vx
+ 1vx @SetHeaderComponent {
+ @Body @IndexBCtdFormat {continued @WordVal @IndexBCtdWord}
+ }
+ //1vx
+ 1vx @BeginHeaderComponent (unused)
+ }
+
+ Yes.1 @Yield {
+ @EndHeaderComponent
+ //1vx
+ x
+ //1vx
+ 1vx @BeginHeaderComponent {
+ @Body @IndexBCtdFormat {continued @WordVal @IndexBCtdWord}
+ }
+ }
+
+ else @Yield x
+
+ }
+ }
+
+ def @Merge left lpart right rpart
+ {
+ { lpart @Rump { lpart @Meld rpart } } @Case
+ {
+ "" @Yield lpart
+ else @Yield { { lpart{@OneCol ,} } @Meld rpart }
+ }
+
+ }
+
+ @IndexBFont @Font @IndexBBreak @Break pgrange @Case {
+ "" @Yield { @Body &"0.03fu" {} }
+ else @Yield { @Body &"0.03fu" {}{@OneCol ,} pgrange }
+
+ }
+ }
+
+ def @RawIndexB
+ left lpart
+ named depth { 0 }
+ right rpart
+ {
+ @MakeIndexB @Case {
+ Yes @Yield { lpart @DoIndexB depth { depth } rpart }
+ else @Yield @Null
+ }
+ }
+
+ macro @RawSubIndexB { @RawIndexB depth { 1 } }
+ macro @RawSubSubIndexB { @RawIndexB depth { 2 } }
+
+ def @IndexB
+ left lpart
+ named @Tag {}
+ named depth { 0 }
+ named to {}
+ right rpart
+ {
+ def @PgMk right tag
+ {
+ tag @CrossLink @PageOf tag
+ }
+
+ def @PgRange
+ {
+ to @Case
+ {
+ "" @Yield @PgMk @Tag
+ else @Yield {
+ { @PageOf @Tag } @Case
+ {
+ { @PageOf to } @Yield { @PgMk @Tag }
+ else @Yield { {@PgMk @Tag}--{@PgMk to} }
+ }
+ }
+ }
+ }
+
+ @MakeIndexB @Case {
+ Yes @Yield {
+ @PageMark @Tag &
+ lpart @DoIndexB depth { depth } pgrange { @PgRange } rpart }
+ else @Yield @Null
+ }
+ }
+
+ macro @SubIndexB { @IndexB depth { 1 } }
+ macro @SubSubIndexB { @IndexB depth { 2 } }
+
+ 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 @IndexBSpacer
+ left lpart
+ named above { @IndexBSpacerAbove }
+ named below { @IndexBSpacerBelow }
+ named font { @IndexBSpacerFont }
+ named format right @Body { @IndexBSpacerFormat @Body }
+ right rpart
+ {
+ def @Send into { @IndexBList&&following }
+ right @Key
+ {
+ @ClearHeaderComponent
+ //
+ //above
+ @CNP
+ @OneRow { font @Font format rpart //below }
+ }
+
+ @MakeIndexB @Case {
+ Yes @Yield @Send lpart
+ else @Yield @Null
+ }
+ }
+
+ macro @InitialIndexBSpacer { @IndexBSpacer above { 0i } }
+
+ def @IndexBLetters
+ {
+ a @InitialIndexBSpacer A
+ b @IndexBSpacer B c @IndexBSpacer C d @IndexBSpacer D e @IndexBSpacer E
+ f @IndexBSpacer F g @IndexBSpacer G h @IndexBSpacer H i @IndexBSpacer I
+ j @IndexBSpacer J k @IndexBSpacer K l @IndexBSpacer L m @IndexBSpacer M
+ n @IndexBSpacer N o @IndexBSpacer O p @IndexBSpacer P q @IndexBSpacer Q
+ r @IndexBSpacer R s @IndexBSpacer S t @IndexBSpacer T u @IndexBSpacer U
+ v @IndexBSpacer V w @IndexBSpacer W x @IndexBSpacer X y @IndexBSpacer Y
+ z @IndexBSpacer Z
+ }
+
+ 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 { dft } # its running title Jeffk 12/11/02 from {}
+ 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 headingtext { @Null } # heading text
+ 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 @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
+ }
+ }
+
+ 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 }
+ crosstag { tag }
+ number { @LongNum }
+ title { initiallanguage @Language title }
+ pagenum { @PageOf tag }
+ }
+
+ { Yes.Major Yes.MajorIntro Yes.ExtraMajor Yes.ExtraMajorIntro } @Yield {
+ incontents @MajorContentsEntry
+ crosstag { tag }
+ number { @LongNum }
+ title { initiallanguage @Language title }
+ pagenum { @PageOf tag }
+ }
+
+ { Yes.VeryMajor } @Yield {
+ incontents @VeryMajorContentsEntry
+ title { initiallanguage @Language {
+ bypassnumber @ColonSep title } }
+ }
+
+ else @Yield @Null
+ }
+ }
+
+ def @Heading
+ {
+
+ type @Case {
+
+ Minor @Yield {
+ headingfont @Font
+ headingbreak @Break @Protect {@LongNum headingformat title}
+ // @Run @StartIfMajor
+ // @PageMark tag
+ @DP headingtext
+ }
+
+ { Major MajorIntro ExtraMajor ExtraMajorIntro } @Yield {
+ sendheader {
+ //aboveheadinggap
+ headingfont @Font
+ headingbreak @Break { @LongNum headingformat title }
+ // @Run @StartIfMajor
+ // @PageMark tag
+ @DP headingtext
+ }
+ }
+
+ { VeryMajor } @Yield { sendheader {
+ //aboveheadinggap
+ headingfont @Font
+ headingbreak @Break { bypassnumber headingformat title }
+ // @Run @StartIfMajor
+ // @PageMark tag
+ @DP headingtext
+ }
+ }
+ }
+ }
+
+ initiallanguage @Language {
+ @Heading
+ // wantindefinite @Case {
+ Yes @Yield @Null
+ No @Yield ""
+ }
+ // numbers @Do {
+ attachnum & @NumberMarker @Tag { tag } @Value { @ShortNum }
+ }
+ // @IfMajor { @FootNoteThrough @Do @BeginFootNoteCounter }
+ # // @Run @StartIfMajor
+ // @ContentsStuff
+ // @TitleMarker @Tag { tag } @Value { title }
+ // intheorems @BeginAllCounters @ShortNum
+ // indisplays @BeginDisplayCounter @ShortNum
+ // infigures @BeginFigureCounter @ShortNum
+ // intables @BeginTableCounter @ShortNum
+ // @Body
+ //innergap @IfMajor endifmajor innergap
+ // @Run NonStart
+ }
+ }
+
+@End @DocumentSetup