diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/README | 22 | ||||
-rw-r--r-- | include/bluef | 3 | ||||
-rw-r--r-- | include/book | 2 | ||||
-rw-r--r-- | include/bookf | 23 | ||||
-rw-r--r-- | include/bsf | 51 | ||||
-rw-r--r-- | include/cprintf | 3 | ||||
-rw-r--r-- | include/diagf | 107 | ||||
-rw-r--r-- | include/diagf.lpg | 145 | ||||
-rw-r--r-- | include/doc | 2 | ||||
-rw-r--r-- | include/docf | 8 | ||||
-rw-r--r-- | include/dsf | 91 | ||||
-rw-r--r-- | include/eiffelf | 3 | ||||
-rw-r--r-- | include/graphf | 85 | ||||
-rw-r--r-- | include/graphf.lpg | 326 | ||||
-rw-r--r-- | include/haskellf | 3 | ||||
-rw-r--r-- | include/javaf | 3 | ||||
-rw-r--r-- | include/langdefs | 1 | ||||
-rw-r--r-- | include/mathf | 3099 | ||||
-rw-r--r-- | include/npf | 3 | ||||
-rw-r--r-- | include/perlf | 3 | ||||
-rw-r--r-- | include/picture | 2 | ||||
-rw-r--r-- | include/pythonf | 3 | ||||
-rw-r--r-- | include/report | 2 | ||||
-rw-r--r-- | include/rslf | 3 | ||||
-rw-r--r-- | include/rubyf | 3 | ||||
-rw-r--r-- | include/save_bsf | 1826 | ||||
-rw-r--r-- | include/slides | 6 | ||||
-rw-r--r-- | include/slidesf | 24 |
28 files changed, 2580 insertions, 3272 deletions
diff --git a/include/README b/include/README index 45266eb..c1ae322 100644 --- a/include/README +++ b/include/README @@ -18,8 +18,7 @@ Setup files (containing mainly lists of options settable by the user) Setup files for special-purpose packages (choose any combination): diag Diag diagram drawing package - eq Eq equation formatting package - math Math, an alternative equation formatting package + math Math, a mathematics formatting package graph Graph graph drawing package latin2 Latin2 (Eastern European characters) package pie Pie pie graph drawing package @@ -58,8 +57,7 @@ Source files containing Lout and PostScript source code for the packages diagf Diag diagram drawing package diagf.etc A file included by diagf diagf.lpg A PostScript prepend file needed by diagf - eqf Eq equation formatting package - mathf Math, an alternative equation formatting package + mathf Math, a mathematics formatting package graphf Graph graph drawing package graphf.etc A file included by graphf graphf.lpg A PostScript prepend file needed by graphf @@ -85,12 +83,14 @@ Source files containing Lout and PostScript source code for the packages Obsolete source files retained for backward compatibility --------------------------------------------------------- - tab Tab table formatting package (OBSOLETE, use tbl) - tabf Tab table formatting package (OBSOLETE) - tabf.lpg A PostScript prepend file needed by tabf (OBSOLETE) - fig Fig advanced graphics package (OBSOLETE, use diag) - figf Fig advanced graphics package (OBSOLETE) - figf.lpg A PostScript prepend file needed by figf (OBSOLETE) + eq Eq equation formatting package (obsolete, use math) + eqf Eq equation formatting package + tab Tab table formatting package (obsolete, use tbl) + tabf Tab table formatting package + tabf.lpg A PostScript prepend file needed by tabf + fig Fig advanced graphics package (obsolete, use diag) + figf Fig advanced graphics package + figf.lpg A PostScript prepend file needed by figf Miscellaneous source files -------------------------- @@ -104,4 +104,4 @@ Miscellaneous source files Jeffrey H. Kingston -12 April 2007 +19 September 2008 diff --git a/include/bluef b/include/bluef index c4d4946..9ec6ae1 100644 --- a/include/bluef +++ b/include/bluef @@ -420,8 +420,9 @@ def @BlueSetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @Blue diff --git a/include/book b/include/book index 401fc51..7f8093f 100644 --- a/include/book +++ b/include/book @@ -43,6 +43,7 @@ # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour + # @InitialBackgroundColour { white } # initial background colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading # @FixedWidthFont { Courier Base -1p } # font for @F @@ -299,6 +300,7 @@ # @IntroPageNumbers { Roman } # intro page numbers # @IntroFirstPageNumber{ 1 } # number of first intro page # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers # @OddTop { @Centre{- @PageNum -} } # Simple page headers # @OddFoot { @Null } diff --git a/include/bookf b/include/bookf index fde3b80..a512758 100644 --- a/include/bookf +++ b/include/bookf @@ -849,10 +849,10 @@ def @BookSetup No @Yield { Yes @BeginAllCounters {} - Yes @BeginDisplayCounter {} - Yes @BeginFigureCounter {} - Yes @BeginTableCounter {} - Yes @BeginFloaterCounter {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginTableCounter {} + // Yes @BeginFloaterCounter {} // @PageList @ColumnNumber { @ColumnNumber } @PageHeaders { @PageHeaders } @@ -869,10 +869,10 @@ def @BookSetup Yes @Yield { Yes @BeginAllCounters {} - Yes @BeginDisplayCounter {} - Yes @BeginFigureCounter {} - Yes @BeginTableCounter {} - Yes @BeginFloaterCounter {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginTableCounter {} + // Yes @BeginFloaterCounter {} // @IntroPageList @ColumnNumber { 1 } @PageHeaders { @PageHeaders } @@ -1137,6 +1137,7 @@ def @BookSetup named @PartTitle {} named @PartText {} named @BypassNumber { dft } + named @BypassWord { dft } body @Body { @@ -1162,7 +1163,8 @@ def @BookSetup def @MajorNum { @ChapterNumbers @Then @InitialLanguage @Language { - chapter @WordVal @ChapterWord @ChapterShortNum + # chapter @WordVal @ChapterWord @ChapterShortNum + @BypassWord @Dft {chapter @WordVal @ChapterWord} @ChapterShortNum } } @@ -1374,7 +1376,8 @@ def @BookSetup headingformat { @Num @ChapterHeadingFormat @Body } incontents { @ChapterInContents } contentsindent { @ChapterContentsIndent } - word { chapter @WordVal @ChapterWord } + # word { chapter @WordVal @ChapterWord } + word { @BypassWord @Dft { chapter @WordVal @ChapterWord } } numbers { @ChapterNumbers } attachnum { @ChapterList&&preceding @Tagged @Tag } retrievenum { @ChapterList&&@Tag @Open { num } } diff --git a/include/bsf b/include/bsf index b2ca24a..cf80ac1 100644 --- a/include/bsf +++ b/include/bsf @@ -108,7 +108,7 @@ def @Texture export @InitialFont @InitialBreak @InitialOutdent @InitialSpace @InitialLanguage - @InitialColour @OptimizePages @HeadingFont + @InitialColour @InitialBackgroundColour @OptimizePages @HeadingFont @ParaGap @ParaIndent @DisplayGap @DisplayIndent @DefaultIndent @DisplayNumStyle @WideIndent @VeryWideIndent @ListGap @ListIndent @ListRightIndent @@ -132,8 +132,9 @@ export @NoDotSep @NoDotJoin @Join @Sep @DotSep @ColonSep @DotJoin @DashJoin @NumSep @VStrut @ZeroWidth @ZeroHeight @OverStrike @Sup @Sub @HClip @VClip @FullWidthRule @LocalWidthRule @Box @CurveBox @ShadowBox @BoundaryMarks - @NumberMarker @NumberOf @TitleMarker @TitleOf - @PageMarker @PageMark @NoLinkPageMark @PageOf @CrossLink @ExternalLink + @DocInfo @NumberMarker @NumberOf @TitleMarker @TitleOf + @PageMarker @PageMark @NoLinkPageMark @PageOf @PageParityOf + @CrossLink @ExternalLink @BeginDisplayCounter @@ -263,6 +264,7 @@ def @BasicSetup named @InitialSpace { lout } # initial space style named @InitialLanguage{ English } # initial language named @InitialColour { black } # initial colour + named @InitialBackgroundColour { white } # initial background colour named @OptimizePages { No } # optimize page breaks? named @HeadingFont { Bold } # font for @Heading named @FixedWidthFont { Courier Base -1p } # font for @F @@ -343,7 +345,7 @@ def @BasicSetup right x { def @Filter { - "(echo @RawVerbatim @Begin ; (cat" @FilterIn "|" command "); echo @End @Verbatim ) >" @FilterOut } + "(echo @RawVerbatim @Begin ; (cat" @FilterIn "|" command "); echo @End @RawVerbatim ) >" @FilterOut } x } @@ -1136,8 +1138,38 @@ def @BasicSetup ########################################################################## # # + # @DocInfo # + # # + ########################################################################## + + def @DocInfo + named author {} + named title {} + named keywords {} + { + { @BackEnd @Case { + PostScript @Yield + { + "[" author @Case { + "" @Yield "" + else @Yield { "/Author ("author")" } } + title @Case { + "" @Yield "" + else @Yield { "/Title ("title")" } } + keywords @Case { + "" @Yield "" + else @Yield { "/Keywords ("keywords")" } } + "/DOCINFO pdfmark" + } + else @Yield @Null + } } @Graphic { } + } + + + ########################################################################## + # # # @NumberMarker, @NumberOf, @TitleMarker, @TitleOf, # - # @PageMark, @PageOf, @CrossLink, @ExternalLink # + # @PageMark, @PageOf, @PageparityOf, @CrossLink, @ExternalLink # # # # NB the default value ?? is desperately important for unsorted # # reference lists numbered by first appearance (@NumberOf @Tag), # @@ -1177,11 +1209,12 @@ def @BasicSetup } - export num rawnum @Tag + export @Tag num rawnum parity def @PageMarker named @Tag {} named num {} named rawnum {} + named parity {} { @PageLabel num } @@ -1204,6 +1237,12 @@ def @BasicSetup @PageMarker&&tag @Open { num } } + def @PageParityOf + right tag + { + @PageMarker&&tag @Open { parity } + } + def @CrossLink left tag named @Format right @Body { @CrossLinkFormat @Body } diff --git a/include/cprintf b/include/cprintf index b31a7b3..8bb1d94 100644 --- a/include/cprintf +++ b/include/cprintf @@ -420,8 +420,9 @@ def @CPSetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @CP diff --git a/include/diagf b/include/diagf index f9ef401..4479386 100644 --- a/include/diagf +++ b/include/diagf @@ -4825,7 +4825,6 @@ def @DiagSetup @BackEnd @Case { PostScript @Yield { "ldiagsolidarrowhead" - # 0 0 xsize ysize * 0.5 0 ysize } PDF @Yield {} } @@ -4849,7 +4848,6 @@ def @DiagSetup @BackEnd @Case { PostScript @Yield { pathwidth "ldiagsolidwithbararrowhead" - # 0 0 xsize ysize * 0.5 0 ysize } PDF @Yield {} } @@ -4863,6 +4861,7 @@ def @DiagSetup named width { arrowwidth } named length { arrowlength } named pathwidth { pathwidth } + named pathgap { pathgap } { @InsulatedNode outlinewidth { pathwidth } @@ -4872,21 +4871,7 @@ def @DiagSetup outline { @BackEnd @Case { PostScript @Yield { - pathwidth "ldiagopenarrowhead" - - # PSW := { 0 0 } - # PNW := { 0 ysize } - # PE := { xsize ysize*0.5 } - # REL := pathwidth atangle { PE angleto PNW + 90d } - # PNA := { 0 ysize*0.5 + pathwidth*0.5 } - # PSA := { 0 ysize*0.5 - pathwidth*0.5 } - # PNI := { - # PNA PNA ++ { xsize 0 } - # PNW ++ REL PE ++ REL ldiaglineintersect - # } - # PSI := PNI -- { 0 pathwidth } - # - # PSW PE PNW PNI PNA PSA PSI PSW + pathwidth pathgap "ldiagopenarrowhead" } PDF @Yield {} } @@ -4900,6 +4885,7 @@ def @DiagSetup named width { arrowwidth } named length { arrowlength } named pathwidth { pathwidth } + named pathgap { pathgap } { @InsulatedNode paint { nochange } @@ -4909,16 +4895,7 @@ def @DiagSetup outline { @BackEnd @Case { PostScript @Yield { - pathwidth "ldiaghalfopenarrowhead" - - # 0 0 - # xsize ysize * 0.5 - # 0 ysize - # xsize*0.3 ysize*0.5 + pathwidth*0.5 - # 0 ysize*0.5 + pathwidth*0.5 - # 0 ysize*0.5 - pathwidth*0.5 - # xsize*0.3 ysize*0.5 - pathwidth*0.5 - # 0 0 + pathwidth pathgap "ldiaghalfopenarrowhead" } PDF @Yield {} } @@ -4942,13 +4919,6 @@ def @DiagSetup @BackEnd @Case { PostScript @Yield { "ldiagsolidcurvedarrowhead" - # 0 0 - # [0 0 xsize ysize * 0.5 "ldiaglinebetween" - # xsize 0 xsize ysize "ldiaglineintersect" clockwise] - # xsize ysize * 0.5 - # [xsize ysize * 0.5 0 ysize "ldiaglinebetween" - # xsize 0 xsize ysize "ldiaglineintersect" clockwise] - # 0 ysize } PDF @Yield {} } @@ -4962,6 +4932,7 @@ def @DiagSetup named width { arrowwidth } named length { arrowlength } named pathwidth { pathwidth } + named pathgap { pathgap } { @InsulatedNode outlinestyle { noline } @@ -4971,28 +4942,7 @@ def @DiagSetup outline { @BackEnd @Case { PostScript @Yield { - pathwidth "ldiagopencurvedarrowhead" - # LR:= { 0 0 xsize ysize * 0.5 "ldiaglinebetween" - # xsize 0 xsize ysize "ldiaglineintersect" } - # UR:= { xsize ysize * 0.5 0 ysize "ldiaglinebetween" - # xsize 0 xsize ysize "ldiaglineintersect" } - # PW2 := pathwidth * 0.5 - # UMID := { - # 0 ysize * 0.5 + PW2 xsize ysize * 0.5 + PW2 - # {0 ysize} ++ 1f atangle { UR angleto {0 ysize} + 90d } - # { 0 ysize } ldiaglineintersect - # } - # LMID := UMID -- { 0 pathwidth } - # 0 0 - # [LR clockwise] - # xsize ysize * 0.5 - # [UR clockwise] - # 0 ysize - # UMID - # 0 ysize * 0.5 + PW2 - # 0 ysize * 0.5 - PW2 - # LMID - # 0 0 + pathwidth pathgap "ldiagopencurvedarrowhead" } PDF @Yield {} } @@ -5006,6 +4956,7 @@ def @DiagSetup named width { arrowwidth } named length { arrowlength } named pathwidth { pathwidth } + named pathgap { pathgap } { @InsulatedNode outlinestyle { noline } @@ -5015,29 +4966,7 @@ def @DiagSetup outline { @BackEnd @Case { PostScript @Yield { - pathwidth "ldiaghalfopencurvedarrowhead" - # LR:= { 0 0 xsize ysize * 0.5 "ldiaglinebetween" - # xsize 0 xsize ysize "ldiaglineintersect" } - # UR:= { xsize ysize * 0.5 0 ysize "ldiaglinebetween" - # xsize 0 xsize ysize "ldiaglineintersect" } - # BR:= { 0 0 LR 0 ysize UR "ldiaglineintersect" } - # BRAD := { 0 0 } distance BR - # PW2 := pathwidth * 0.5 - # XDIST := sqrt { BRAD*BRAD - PW2*PW2 } - # UMID := BR ++ { XDIST PW2 } - # LMID := BR ++ { XDIST 0 - PW2 } - # 0 0 - # [LR clockwise] - # xsize ysize * 0.5 - # [UR clockwise] - # 0 ysize - # [BR clockwise ] - # UMID - # 0 ysize * 0.5 + PW2 - # 0 ysize * 0.5 - PW2 - # LMID - # [BR clockwise ] - # 0 0 + pathwidth pathgap "ldiaghalfopencurvedarrowhead" } PDF @Yield {} } @@ -5099,6 +5028,7 @@ def @DiagSetup named width { arrowwidth } named length { arrowlength } named pathwidth { pathwidth } + named pathgap { pathgap } { style @Case { solid @Yield @SolidArrowHead @@ -5109,19 +5039,19 @@ def @DiagSetup pathwidth { pathwidth } halfopen @Yield @HalfOpenArrowHead width { width } length { length } - pathwidth { pathwidth } + pathwidth { pathwidth } pathgap { pathgap } open @Yield @OpenArrowHead width { width } length { length } - pathwidth { pathwidth } + pathwidth { pathwidth } pathgap { pathgap } curvedsolid @Yield @SolidCurvedArrowHead width { width } length { length } pathwidth { pathwidth } curvedhalfopen @Yield @HalfOpenCurvedArrowHead width { width } length { length } - pathwidth { pathwidth } + pathwidth { pathwidth } pathgap { pathgap } curvedopen @Yield @OpenCurvedArrowHead width { width } length { length } - pathwidth { pathwidth } + pathwidth { pathwidth } pathgap { pathgap } circle @Yield @CircleArrowHead width { width } length { length } pathwidth { pathwidth } @@ -5172,6 +5102,7 @@ def @DiagSetup frompt { frompt } topt { topt } arrow { arrow } + arrowlength { arrowlength } backarrowlength { backarrowlength } } import @Geometry named from { from } @@ -5334,6 +5265,14 @@ def @DiagSetup labeladjust { zlabeladjust @Else linklabeladjust } } + def @PathGap + { + path @Case { + doubleline @Yield { pathgap } + else @Yield { "0" } + } + } + def @FromArrow { arrow @Case { @@ -5343,6 +5282,7 @@ def @DiagSetup width { backarrowwidth } length { backarrowlength } pathwidth { pathwidth } + pathgap { @PathGap } } else @Yield "" } @@ -5357,6 +5297,7 @@ def @DiagSetup width { arrowwidth } length { arrowlength } pathwidth { pathwidth } + pathgap { @PathGap } } else @Yield "" } diff --git a/include/diagf.lpg b/include/diagf.lpg index f266960..47b37fb 100644 --- a/include/diagf.lpg +++ b/include/diagf.lpg @@ -1012,10 +1012,10 @@ ldiagdict begin setmatrix } def -% arrow head styles -/ldiagopen 0.0 def -/ldiaghalfopen 0.5 def -/ldiagclosed 1.0 def +% arrow head styles (unused) +% /ldiagopen 0.0 def +% /ldiaghalfopen 0.5 def +% /ldiagclosed 1.0 def % stroke no arrows, forward, back, and both /ldiagnoarrow { pop pop pop pop pop pop pop pop } def @@ -3199,35 +3199,66 @@ ldiagdict begin } def % shape and labels of the @OpenArrowHead symbol -% <pathwidth> ldiagopenarrowhead - +% <pathwidth> <pathgap> ldiagopenarrowhead - /ldiagopenarrowhead { + /pathgap exch def /pathwidth exch def /PSW [ 0 0 ] cvx def /PNW [ 0 ysize ] cvx def /PE [ xsize ysize 0.5 mul ] cvx def /REL [ 0 0 pathwidth PE PNW ldiagangleto 90 add ldiagatangle ] cvx def - /PNA [ 0 ysize 0.5 mul pathwidth 0.5 mul add ] cvx def - /PSA [ 0 ysize 0.5 mul pathwidth 0.5 mul sub ] cvx def - /PNI [ PNA PNA xsize 0 ldiagpadd PNW REL ldiagpadd - PE REL ldiagpadd ldiaglineintersect ] cvx def - /PSI [ 0 pathwidth PNI ldiagpsub ] cvx def + pathgap 0 eq + { + /PNA [ 0 ysize 0.5 mul pathwidth 0.5 mul add ] cvx def + /PSA [ 0 ysize 0.5 mul pathwidth 0.5 mul sub ] cvx def + /PNI [ PNA PNA xsize 0 ldiagpadd PNW REL ldiagpadd + PE REL ldiagpadd ldiaglineintersect ] cvx def + /PSI [ 0 pathwidth PNI ldiagpsub ] cvx def - PSW PE PNW PNI PNA PSA PSI PSW + PSW PE PNW PNI PNA PSA PSI PSW + } + { + /PNA [ 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add ] cvx def + /PSA [ 0 ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul sub ] cvx def + /PNI [ PNA PNA xsize 0 ldiagpadd PNW REL ldiagpadd + PE REL ldiagpadd ldiaglineintersect ] cvx def + /PSI [ 0 pathwidth pathgap add PNI ldiagpsub ] cvx def + /PXA [ 0 pathwidth PNA ldiagpsub ] cvx def + /PXI [ 0 pathwidth PNI ldiagpsub ] cvx def + /PYA [ 0 pathwidth PSA ldiagpadd ] cvx def + /PYI [ 0 pathwidth PSI ldiagpadd ] cvx def + + PSW PE PNW PNI PNA PXA PXI PYI PYA PSA PSI PSW + } ifelse } def % shape and labels of the @HalfOpenArrowHead symbol -% <pathwidth> ldiaghalfopenarrowhead - +% <pathwidth> <pathgap> ldiaghalfopenarrowhead - /ldiaghalfopenarrowhead { + /pathgap exch def /pathwidth exch def 0 0 xsize ysize 0.5 mul 0 ysize - xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul add - 0 ysize 0.5 mul pathwidth 0.5 mul add - 0 ysize 0.5 mul pathwidth 0.5 mul sub - xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul sub + pathgap 0 eq + { + xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul add + 0 ysize 0.5 mul pathwidth 0.5 mul add + 0 ysize 0.5 mul pathwidth 0.5 mul sub + xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul sub + } + { + xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add + 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add + 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul sub + xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul sub + xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul add + 0 ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul add + 0 ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul sub + xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul sub + } ifelse 0 0 } def @@ -3245,9 +3276,10 @@ ldiagdict begin } def % shape and labels of the @OpenCurvedArrowHead symbol -% <pathwidth> ldiagopencurvedarrowhead - +% <pathwidth> <pathgap> ldiagopencurvedarrowhead - /ldiagopencurvedarrowhead { + /pathgap exch def /pathwidth exch def /LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween xsize 0 xsize ysize ldiaglineintersect @@ -3256,29 +3288,52 @@ ldiagdict begin xsize 0 xsize ysize ldiaglineintersect ] cvx def /PW2 [ pathwidth 0.5 mul ] cvx def - /UMID [ - 0 ysize 0.5 mul PW2 add - xsize ysize 0.5 mul PW2 add - 0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle - ldiagpadd 0 ysize ldiaglineintersect - ] cvx def - /LMID [ 0 pathwidth UMID ldiagpsub ] cvx def 0 0 [LR clockwise] xsize ysize 0.5 mul [UR clockwise] 0 ysize - UMID - 0 ysize 0.5 mul PW2 add - 0 ysize 0.5 mul PW2 sub - LMID + pathgap 0 eq + { + /UMID [ + 0 ysize 0.5 mul PW2 add + xsize ysize 0.5 mul PW2 add + 0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle + ldiagpadd 0 ysize ldiaglineintersect + ] cvx def + /LMID [ 0 pathwidth UMID ldiagpsub ] cvx def + UMID + 0 ysize 0.5 mul PW2 add + 0 ysize 0.5 mul PW2 sub + LMID + } + { + /UMIDU [ + 0 ysize 0.5 mul PW2 add pathgap 0.5 mul add + xsize ysize 0.5 mul PW2 add pathgap 0.5 mul add + 0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle + ldiagpadd 0 ysize ldiaglineintersect + ] cvx def + /UMIDL [ 0 pathwidth UMIDU ldiagpsub ] cvx def + /LMIDL [ 0 pathgap 0 pathwidth UMIDU ldiagpsub ldiagpsub ] cvx def + /LMIDU [ 0 pathwidth LMIDL ldiagpadd ] cvx def + UMIDU + 0 UMIDU exch pop + 0 UMIDL exch pop + UMIDL + LMIDU + 0 LMIDU exch pop + 0 LMIDL exch pop + LMIDL + } ifelse 0 0 } def % shape and labels of the @HalfOpenCurvedArrowHead symbol -% <pathwidth> ldiaghalfopencurvedarrowhead - +% <pathwidth> <pathgap> ldiaghalfopencurvedarrowhead - /ldiaghalfopencurvedarrowhead { + /pathgap exch def /pathwidth exch def /LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween xsize 0 xsize ysize ldiaglineintersect @@ -3289,19 +3344,37 @@ ldiagdict begin /BR [ 0 0 LR 0 ysize UR ldiaglineintersect ] cvx def /BRAD [ 0 0 BR ldiagdistance ] cvx def /PW2 [ pathwidth 0.5 mul ] cvx def - /XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def - /UMID [ BR XDIST PW2 ldiagpadd ] cvx def - /LMID [ BR XDIST 0 PW2 sub ldiagpadd ] cvx def 0 0 [LR clockwise] xsize ysize 0.5 mul [UR clockwise] 0 ysize [BR clockwise] - UMID - 0 ysize 0.5 mul PW2 add - 0 ysize 0.5 mul PW2 sub - LMID + pathgap 0 eq + { + /XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def + /UMID [ BR XDIST PW2 ldiagpadd ] cvx def + /LMID [ BR XDIST 0 PW2 sub ldiagpadd ] cvx def + UMID + 0 ysize 0.5 mul PW2 add + 0 ysize 0.5 mul PW2 sub + LMID + } + { + /XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def + /UMIDU [ BR XDIST PW2 pathgap 0.5 mul add ldiagpadd ] cvx def + /UMIDL [ 0 pathwidth UMIDU ldiagpsub ] cvx def + /LMIDL [ BR XDIST 0 PW2 sub pathgap 0.5 mul sub ldiagpadd ] cvx def + /LMIDU [ 0 pathwidth LMIDL ldiagpadd ] cvx def + UMIDU + 0 UMIDU exch pop + 0 UMIDL exch pop + UMIDL + LMIDU + 0 LMIDU exch pop + 0 LMIDL exch pop + LMIDL + } ifelse [BR clockwise] 0 0 } def diff --git a/include/doc b/include/doc index c5e9d65..146c469 100644 --- a/include/doc +++ b/include/doc @@ -44,6 +44,7 @@ # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour + # @InitialBackgroundColour { white } # initial background colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading # @FixedWidthFont { Courier Base -1p } # font for @F @@ -290,6 +291,7 @@ # @IntroPageNumbers { Roman } # intro page numbers # @IntroFirstPageNumber{ 1 } # number of first intro page # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers # @OddTop { @Centre{- @PageNum -} } # Simple page headers # @OddFoot { @Null } diff --git a/include/docf b/include/docf index 8085a9a..db8fea4 100644 --- a/include/docf +++ b/include/docf @@ -412,10 +412,10 @@ def @OrdinarySetup { @ColourCommand @InitialColour } @SetColour { Yes @BeginAllCounters {} - Yes @BeginDisplayCounter {} - Yes @BeginFigureCounter {} - Yes @BeginTableCounter {} - Yes @BeginFloaterCounter {} + // Yes @BeginDisplayCounter {} + // Yes @BeginFigureCounter {} + // Yes @BeginTableCounter {} + // Yes @BeginFloaterCounter {} // @BackEnd @Case { PlainText @Yield { diff --git a/include/dsf b/include/dsf index ae05e7d..92dfc80 100644 --- a/include/dsf +++ b/include/dsf @@ -448,6 +448,7 @@ def @DocumentSetup named @IntroPageNumbers { Roman } # intro page numbers named @IntroFirstPageNumber { 1 } # number of first intro page named @StructPageNums { No } # structured page numbers + named @PageNumberFormat right number { number } # format of page numbers named @OddTop right @PageNum { @Centre { - @PageNum - } } named @OddFoot right @PageNum { @Null } @@ -745,8 +746,8 @@ def @DocumentSetup @PageHeaders.@StructPageNums @Case { { Titles.Yes NoTitles.Yes } @Yield { - prefix @Join { numbers @Num @StructNum } } - else @Yield { numbers @Num rawnum } + prefix @Join @PageNumberFormat { numbers @Num @StructNum } } + else @Yield @PageNumberFormat { numbers @Num rawnum } } } @@ -862,6 +863,13 @@ def @DocumentSetup } @Graphic x } + def @ColouriseBackground left color right x + { + color @Colour + @Box margin { 0c } paint { color } linewidth { 0c } + @InitialColour @Colour x + } + def @MargSet left parity right x @@ -880,6 +888,7 @@ def @DocumentSetup right x { @PageSet + @InitialBackgroundColour @ColouriseBackground { @OrientationAngle @Orient } @Rotate { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High { //@TopMargin ||@OddLeftMargin @@ -896,6 +905,7 @@ def @DocumentSetup right x { @PageSet + @InitialBackgroundColour @ColouriseBackground { @OrientationAngle @Orient } @Rotate { @OrientedWidth @Orient } @Wide { @OrientedHeight @Orient } @High { //@TopMargin ||@EvenLeftMargin @@ -1684,7 +1694,7 @@ def @DocumentSetup def @OrdinaryOddPage { {@PageHeaders.{@SStart @PageNum}} @OddTopHeader - { @PageNumbers @Num @PageNum } + @PageNumberFormat { @PageNumbers @Num @PageNum } //@MidGap @OddBodyMargins { @AtTop @@ -1694,18 +1704,18 @@ def @DocumentSetup //1rt @OneRow { // @OddBodyMargins @PageFootSection //@MidGap {@PageHeaders.{@SStart @PageNum}} @OddFootHeader - { @PageNumbers @Num @PageNum } + @PageNumberFormat { @PageNumbers @Num @PageNum } } } def @FullPageOddPage { {@PageHeaders.{@SStart @PageNum}} @OddTopHeader - { @PageNumbers @Num @PageNum } + @PageNumberFormat { @PageNumbers @Num @PageNum } //@MidGap @OddBodyMargins @OddFullPageSection //1rt @OneRow { //@MidGap {@PageHeaders.{@SStart @PageNum}} @OddFootHeader - { @PageNumbers @Num @PageNum } + @PageNumberFormat { @PageNumbers @Num @PageNum } } } @@ -1719,7 +1729,7 @@ def @DocumentSetup def @OrdinaryEvenPage { @PageHeaders.NonStart @EvenTopHeader - { @PageNumbers @Num @PageNum } + @PageNumberFormat { @PageNumbers @Num @PageNum } //@MidGap @EvenBodyMargins { @PageEvenTopSection @Orient @@ -1728,24 +1738,25 @@ def @DocumentSetup //1rt @OneRow { // @EvenBodyMargins @PageFootSection //@MidGap @PageHeaders.NonStart @EvenFootHeader - { @PageNumbers @Num @PageNum } + @PageNumberFormat { @PageNumbers @Num @PageNum } } } def @FullPageEvenPage { @PageHeaders.NonStart @EvenTopHeader - { @PageNumbers @Num @PageNum } + @PageNumberFormat { @PageNumbers @Num @PageNum } //@MidGap @EvenBodyMargins @EvenFullPageSection //1rt @OneRow { //@MidGap @PageHeaders.NonStart @EvenFootHeader - { @PageNumbers @Num @PageNum } + @PageNumberFormat { @PageNumbers @Num @PageNum } } } @PageMarker rawnum { @PageNum } num { @PageNumbers @Num @PageNum } + parity { "Even" } // @FootNoteThrough @NoDo @BeginFootNoteCounter // {} @EvenPage @Orient { @Orient } { @@ -1761,6 +1772,7 @@ def @DocumentSetup @PageMarker rawnum { @PageNum } num { @PageNumbers @Num @PageNum } + parity { "Odd" } // @FootNoteThrough @NoDo @BeginFootNoteCounter // { extra @Then @OddBodyMargins @ZeroColList @ColumnNumber } @OddPage @Orient { @Orient } { @@ -1783,11 +1795,12 @@ def @DocumentSetup @PageMarker num { @IntroPageNumbers @Num @PageNum } rawnum { @PageNum } + parity { "Odd" } // @FootNoteThrough @NoDo @BeginFootNoteCounter // { extra @Then @OddBodyMargins @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient } { {@PageHeaders.{@SStart @PageNum}} @IntroOddTopHeader - { @IntroPageNumbers @Num @PageNum } + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } //@MidGap @OddBodyMargins { @AtTop @@ -1798,17 +1811,18 @@ def @DocumentSetup { // @OddBodyMargins @PageFootSection //@MidGap {@PageHeaders.{@SStart @PageNum}} @IntroOddFootHeader - { @IntroPageNumbers @Num @PageNum } + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } } } // @PageMarker num { @IntroPageNumbers @Num @Next @PageNum } rawnum { @Next @PageNum } + parity { "Even" } // @FootNoteThrough @NoDo @BeginFootNoteCounter // {} @EvenPage @Orient { @Orient } @Runner&&following @Open { - @PageHeaders.NonStart @IntroEvenTopHeader { @IntroPageNumbers @Num @Next @PageNum } + @PageHeaders.NonStart @IntroEvenTopHeader @PageNumberFormat { @IntroPageNumbers @Num @Next @PageNum } //@MidGap @EvenBodyMargins { @PageIntroEvenTopSection @Orient @@ -1817,7 +1831,7 @@ def @DocumentSetup //1rt @OneRow { // @EvenBodyMargins @PageFootSection //@MidGap @PageHeaders.NonStart @IntroEvenFootHeader - { @IntroPageNumbers @Num @Next @PageNum } + @PageNumberFormat { @IntroPageNumbers @Num @Next @PageNum } } } // @SimpleIntroPageList @@ -1848,11 +1862,12 @@ def @DocumentSetup @PageMarker num { @IntroPageNumbers @Num @PageNum } rawnum { @PageNum } + parity { "Even" } // @FootNoteThrough @NoDo @BeginFootNoteCounter // {} @EvenPage @Orient { @Orient } @Runner&&following @Open { - @PageHeaders.NonStart @IntroEvenTopHeader { @IntroPageNumbers @Num @PageNum } + @PageHeaders.NonStart @IntroEvenTopHeader @PageNumberFormat { @IntroPageNumbers @Num @PageNum } //@MidGap @EvenBodyMargins { @PageIntroEvenTopSection @Orient @@ -1861,7 +1876,7 @@ def @DocumentSetup //1rt @OneRow { // @EvenBodyMargins @PageFootSection //@MidGap @PageHeaders.NonStart @IntroEvenFootHeader - { @IntroPageNumbers @Num @PageNum } + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } } } // @SimpleOddOrEvenIntroPageList @@ -1873,11 +1888,12 @@ def @DocumentSetup @PageMarker num { @IntroPageNumbers @Num @PageNum } rawnum { @PageNum } + parity { "Odd" } // @FootNoteThrough @NoDo @BeginFootNoteCounter // { extra @Then @OddBodyMargins @ZeroIntroColList @ColumnNumber } @OddPage @Orient { @Orient } { {@PageHeaders.{@SStart @PageNum}} @IntroOddTopHeader - { @IntroPageNumbers @Num @PageNum } + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } //@MidGap @OddBodyMargins { @AtTop @@ -1888,7 +1904,7 @@ def @DocumentSetup { // @OddBodyMargins @PageFootSection //@MidGap {@PageHeaders.{@SStart @PageNum}} @IntroOddFootHeader - { @IntroPageNumbers @Num @PageNum } + @PageNumberFormat { @IntroPageNumbers @Num @PageNum } } } // @SimpleEvenIntroPageList @@ -1918,6 +1934,7 @@ def @DocumentSetup prefix { @Prefix } owner { @Owner } } rawnum { @PageNum } + parity { "Odd" } // @PageHeaders.@Start @RunningOddTopHeader @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } @@ -1961,6 +1978,7 @@ def @DocumentSetup prefix { @Prefix } owner { @Owner } } rawnum { @PageNum } + parity { "Odd" } // @PageHeaders.@Start @RunningOddTopHeader @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } @@ -2009,6 +2027,7 @@ def @DocumentSetup prefix { @Prefix } owner { @Owner } } rawnum { @PageNum } + parity { "Even" } // @PageHeaders.@Start @RunningEvenTopHeader @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } @@ -2051,6 +2070,7 @@ def @DocumentSetup prefix { @Prefix } owner { @Owner } } rawnum { @PageNum } + parity { "Even" } // @PageHeaders.@Start @RunningEvenTopHeader @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } @@ -2121,6 +2141,7 @@ def @DocumentSetup prefix { @Prefix } owner { @Owner } } rawnum { @PageNum } + parity { "Odd" } // @PageHeaders.@Start @RunningIntroOddTopHeader @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } @@ -2162,6 +2183,7 @@ def @DocumentSetup prefix { @Prefix } owner { @Owner } } rawnum { @Next @PageNum } + parity { "Even" } // @PageHeaders.@Start @RunningIntroEvenTopHeader @MajorNum { @MajorNum } @MajorTitle { @MajorTitle } @MinorNum { @MinorNum } @MinorTitle { @MinorTitle } @@ -3856,6 +3878,7 @@ def @DocumentSetup title { @InitialLanguage @Language @ContentsCaption } pagenum { @PageOf @Tag } // @FigureCounterIncrement @Tag + // @TitleMarker @Tag { @Tag } @Value { @Caption } // @Body // @PageMark @Tag } @@ -3901,13 +3924,13 @@ def @DocumentSetup def @EvenFullPageSend into { @EvenFullPagePlace&&following } right x { - @OneRow x + @OneRow @HExpand x } def @EvenPageSend into { @EvenPagePlace&&following } right x { - @OneRow x + @OneRow @HExpand x } def @RawFigureVal @@ -3928,13 +3951,13 @@ def @DocumentSetup @OnePg.@CaptionState @Case { Yes.Below @Yield { - @Send @OneRow { @Format @FigureVal @DP @CaptionVal // @DupRunner} + @Send @OneRow @HExpand { @Format @FigureVal @DP @CaptionVal // @DupRunner} } Yes.Above @Yield { - @Send @OneRow { @CaptionVal @DP @Format @FigureVal // @DupRunner} + @Send @OneRow @HExpand { @CaptionVal @DP @Format @FigureVal // @DupRunner} } Yes.None @Yield { - @Send @OneRow { @Format @FigureVal // @DupRunner } + @Send @OneRow @HExpand { @Format @FigureVal // @DupRunner } } No.Below @Yield { @SendEncl { @FigureVal // @Send { @CaptionVal // @DupRunner } } @@ -4091,6 +4114,7 @@ def @DocumentSetup title { @InitialLanguage @Language @ContentsCaption } pagenum { @PageOf @Tag } // @TableCounterIncrement @Tag + // @TitleMarker @Tag { @Tag } @Value { @Caption } // @Body // @PageMark @Tag } @@ -4136,13 +4160,13 @@ def @DocumentSetup def @EvenFullPageSend into { @EvenFullPagePlace&&following } right x { - @OneRow x + @OneRow @HExpand x } def @EvenPageSend into { @EvenPagePlace&&following } right x { - @OneRow x + @OneRow @HExpand x } def @RawTableVal @@ -4163,13 +4187,13 @@ def @DocumentSetup @OnePg.@CaptionState @Case { Yes.Below @Yield { - @Send @OneRow { @Format @TableVal @DP @CaptionVal // @DupRunner} + @Send @OneRow @HExpand { @Format @TableVal @DP @CaptionVal // @DupRunner} } Yes.Above @Yield { - @Send @OneRow { @CaptionVal @DP @Format @TableVal // @DupRunner} + @Send @OneRow @HExpand { @CaptionVal @DP @Format @TableVal // @DupRunner} } Yes.None @Yield { - @Send @OneRow { @Format @TableVal // @DupRunner } + @Send @OneRow @HExpand { @Format @TableVal // @DupRunner } } No.Below @Yield { @SendEncl { @TableVal // @Send { @CaptionVal // @DupRunner } } @@ -4326,6 +4350,7 @@ def @DocumentSetup title { @InitialLanguage @Language @ContentsCaption } pagenum { @PageOf @Tag } // @FloaterCounterIncrement @Tag + // @TitleMarker @Tag { @Tag } @Value { @Caption } // @Body // @PageMark @Tag } @@ -4371,13 +4396,13 @@ def @DocumentSetup def @EvenFullPageSend into { @EvenFullPagePlace&&following } right x { - @OneRow x + @OneRow @HExpand x } def @EvenPageSend into { @EvenPagePlace&&following } right x { - @OneRow x + @OneRow @HExpand x } def @RawFloaterVal @@ -4398,13 +4423,13 @@ def @DocumentSetup @OnePg.@CaptionState @Case { Yes.Below @Yield { - @Send @OneRow { @Format @FloaterVal @DP @CaptionVal // @DupRunner} + @Send @OneRow @HExpand { @Format @FloaterVal @DP @CaptionVal // @DupRunner} } Yes.Above @Yield { - @Send @OneRow { @CaptionVal @DP @Format @FloaterVal // @DupRunner} + @Send @OneRow @HExpand { @CaptionVal @DP @Format @FloaterVal // @DupRunner} } Yes.None @Yield { - @Send @OneRow { @Format @FloaterVal // @DupRunner } + @Send @OneRow @HExpand { @Format @FloaterVal // @DupRunner } } No.Below @Yield { @SendEncl { @FloaterVal // @Send { @CaptionVal // @DupRunner } } diff --git a/include/eiffelf b/include/eiffelf index f5cfc67..14315c7 100644 --- a/include/eiffelf +++ b/include/eiffelf @@ -420,8 +420,9 @@ def @EiffelSetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @Eiffel diff --git a/include/graphf b/include/graphf index d2d3175..931a8ec 100644 --- a/include/graphf +++ b/include/graphf @@ -47,13 +47,17 @@ def @GraphObj def @GraphCross import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath 0 0 moveto xsize ysize lineto 0 ysize moveto" - "xsize 0 lineto [] 0 setdash stroke" + { + # "newpath 0 0 moveto xsize ysize lineto 0 ysize moveto" + # "xsize 0 lineto [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "docross" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -72,13 +76,17 @@ def @GraphCross def @GraphPlus import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath xmark 0 moveto xmark ysize lineto 0 ymark moveto" - "xsize ymark lineto [] 0 setdash stroke" + { + # "newpath xmark 0 moveto xmark ysize lineto 0 ymark moveto" + # "xsize ymark lineto [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "doplus" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -97,13 +105,17 @@ def @GraphPlus def @GraphSquare import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" - "0 ysize lineto closepath [] 0 setdash stroke" + { + # "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + # "0 ysize lineto closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dosquare" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -121,13 +133,17 @@ def @GraphSquare def @GraphFilledSquare import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" - "0 ysize lineto closepath gsave [] 0 setdash stroke grestore fill" + { + # "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + # "0 ysize lineto closepath gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dofilledsquare" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -145,13 +161,17 @@ def @GraphFilledSquare def @GraphDiamond import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" - "xmark ysize lineto closepath [] 0 setdash stroke" + { + # "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" + # "xmark ysize lineto closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dodiamond" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -169,13 +189,17 @@ def @GraphDiamond def @GraphFilledDiamond import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" - "xmark ysize lineto closepath gsave [] 0 setdash stroke grestore fill" + { + # "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" + # "xmark ysize lineto closepath gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dofilleddiamond" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -194,13 +218,17 @@ def @GraphFilledDiamond def @GraphCircle import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath xmark ymark xmark 0 360 arc" - "[] 0 setdash stroke" + { + # "newpath xmark ymark xmark 0 360 arc" + # "[] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "docircle" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -244,12 +272,16 @@ def @GraphCircle def @GraphFilledCircle import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath xmark ymark xmark 0 360 arc" - "gsave [] 0 setdash stroke grestore fill" + { + # "newpath xmark ymark xmark 0 360 arc" + # "gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dofilledcircle" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -297,13 +329,17 @@ def @GraphFilledCircle def @GraphTriangle import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" - "closepath [] 0 setdash stroke" + { + # "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" + # "closepath [] 0 setdash stroke" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dotriangle" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -321,13 +357,17 @@ def @GraphTriangle def @GraphFilledTriangle import @LoutLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { 0.5p } { @BackEnd @Case { PostScript @Yield { @HContract @VContract - { "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" - "closepath gsave [] 0 setdash stroke grestore fill" + { + # "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" + # "closepath gsave [] 0 setdash stroke grestore fill" + "lgraphdict begin xmark ymark xmark" symbollinewidth "dofilledtriangle" + // "end" } @Graphic {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} @@ -579,6 +619,7 @@ def @Graph import @PSLengths named dashlength { 0.2f } import @PSLengths named linewidth { "currentlinewidth" } import @PSLengths named symbolsize { 0.15f } + import @PSLengths named symbollinewidth { "currentlinewidth" } body @Body @Begin @@ -657,6 +698,7 @@ def @Graph import @PSLengths named dashlength { dashlength } import @PSLengths named linewidth { linewidth } import @PSLengths named symbolsize { symbolsize } + import @PSLengths named symbollinewidth { symbollinewidth } named dataformat { dataformat } body data { @@ -799,7 +841,8 @@ def @Graph "{" @Pairs "}" "{ /dashlength" dashlength "def" " /linewidth" linewidth "def" @ColourCommand colour - " /symbolsize" symbolsize "def }" + " /symbolsize" symbolsize "def" + " /symbollinewidth" symbollinewidth "def }" "{" @Paint "}" "{" texture "}" "]" diff --git a/include/graphf.lpg b/include/graphf.lpg index f85dc77..209ae75 100644 --- a/include/graphf.lpg +++ b/include/graphf.lpg @@ -25,6 +25,86 @@ errordict begin } def end +/lgraphdebugposy 432 def +/lgraphdebugposx 72 def + +% - lgraphdebugnextline - +/lgraphdebugnextline +{ + lgraphdebugposy 72 lt + { /lgraphdebugposx lgraphdebugposx 144 add store + /lgraphdebugposy 432 store + } + { + /lgraphdebugposy lgraphdebugposy 12 sub store + } ifelse + lgraphdebugposx lgraphdebugposy moveto +} def + +% - lgraphdebugbeginindent - +/lgraphdebugbeginindent +{ + /lgraphdebugposx lgraphdebugposx 12 add store +} def + +% - lgraphdebugendindent - +/lgraphdebugendindent +{ + /lgraphdebugposx lgraphdebugposx 12 sub store +} def + +% <string> <int> lgraphdebugprint - +% must be defined outside lgraphdict since used in arbitrary places +% print <string> plus count or <int> stack entries, whichever is the smaller +/lgraphdebugprint +{ + exch + gsave + initgraphics + lgraphdebugnextline + /Times-Roman findfont 10 scalefont setfont + 0 setgray show + lgraphdebugbeginindent + count 1 sub 2 copy lt { pop } { exch pop } ifelse 1 sub + 0 exch 1 exch + { + lgraphdebugnextline + index + dup type (dicttype) eq + { + (begin dict) show + lgraphdebugbeginindent + { + lgraphdebugnextline + pop 100 string cvs show + } forall + lgraphdebugendindent + lgraphdebugnextline + (end dict) show + } + { + dup type (arraytype) eq + { + (begin array) show + lgraphdebugbeginindent + { + lgraphdebugnextline + 100 string cvs show + } forall + lgraphdebugendindent + lgraphdebugnextline + (end array) show + } + { + 100 string cvs show + } ifelse + } ifelse + } for + lgraphdebugendindent + grestore +} def + + /lgraphdict 200 dict def lgraphdict begin @@ -319,103 +399,187 @@ lgraphdict begin } def -% cross: show a small cross -/cross -{ newpath - xcurr ycurr trpoint moveto - symbolsize neg symbolsize neg rmoveto - symbolsize 2 mul symbolsize 2 mul rlineto - 0 symbolsize -2 mul rmoveto - symbolsize -2 mul symbolsize 2 mul rlineto - [] 0 setdash stroke +% docross: show a cross with a given symbolsize and symbollinewidth +% <x> <y> <symbolsize> <symbollinewidth> docross - +/docross +{ + setlinewidth + /ss exch def + newpath + moveto + ss neg ss neg rmoveto + ss 2 mul ss 2 mul rlineto + 0 ss -2 mul rmoveto + ss -2 mul ss 2 mul rlineto + [] 0 setdash 0 setlinecap stroke +} def + +% cross: show a cross +% - cross - +/cross { xcurr ycurr trpoint symbolsize symbollinewidth docross } def + +% doplus: show a plus with a given symbolsize and symbollinewidth +% <x> <y> <symbolsize> <symbollinewidth> doplus - +/doplus +{ + setlinewidth + /ss exch def + newpath + moveto + ss neg 0 rmoveto + ss 2 mul 0 rlineto + ss neg ss neg rmoveto + 0 ss 2 mul rlineto + [] 0 setdash 0 setlinecap stroke +} def + +% plus: show a plus +% - plus - +/plus { xcurr ycurr trpoint symbolsize symbollinewidth doplus } def + +% dosquare: show an open square with a given symbolsize and symbollinewidth +% NB symbolsize is reduced by half the line width to get size exactly right +% <x> <y> <symbolsize> <symbollinewidth> dosquare - +/dosquare +{ + dup setlinewidth + 0.5 mul sub 0 max /ss exch def + newpath + moveto + ss neg ss neg rmoveto + ss 2 mul 0 rlineto + 0 ss 2 mul rlineto + ss -2 mul 0 rlineto + closepath [] 0 setdash stroke } def -% plus: show a small plus -/plus -{ newpath - xcurr ycurr trpoint moveto - symbolsize neg 0 rmoveto - symbolsize 2 mul 0 rlineto - symbolsize neg symbolsize neg rmoveto - 0 symbolsize 2 mul rlineto - [] 0 setdash stroke -} def +% square: show an open square +% - square - +/square { xcurr ycurr trpoint symbolsize symbollinewidth dosquare } def -% square: show a small square -/square -{ newpath - xcurr ycurr trpoint moveto - symbolsize neg symbolsize neg rmoveto - symbolsize 2 mul 0 rlineto - 0 symbolsize 2 mul rlineto - symbolsize -2 mul 0 rlineto +% dofilledsquare: show filled square with given symbolsize and symbollinewidth +% NB symbollinewidth is not used +% <x> <y> <symbolsize> <symbollinewidth> dofilledsquare - +/dofilledsquare +{ + pop /ss exch def + newpath + moveto + ss neg ss neg rmoveto + ss 2 mul 0 rlineto + 0 ss 2 mul rlineto + ss -2 mul 0 rlineto + closepath fill +} def + +% filledsquare: show a filled square +% - filledsquare - +/filledsquare { xcurr ycurr trpoint symbolsize symbollinewidth dofilledsquare } def + +% dodiamond: show an open diamond with a given symbolsize and symbollinewidth +% NB symbolsize is reduced by half the line width to get size exactly right +% <x> <y> <symbolsize> <symbollinewidth> dodiamond - +/dodiamond +{ + dup setlinewidth + 0.5 mul sub 0 max /ss exch def + newpath + moveto + ss neg 0 rmoveto + ss ss neg rlineto + ss ss rlineto + ss neg ss rlineto closepath [] 0 setdash stroke } def -% filledsquare: show a small filled square -/filledsquare -{ newpath - xcurr ycurr trpoint moveto - symbolsize neg symbolsize neg rmoveto - symbolsize 2 mul 0 rlineto - 0 symbolsize 2 mul rlineto - symbolsize -2 mul 0 rlineto - closepath gsave [] 0 setdash stroke grestore fill -} def +% diamond: show an open diamond +% - diamond - +/diamond { xcurr ycurr trpoint symbolsize symbollinewidth dodiamond } def -% diamond: show a small diamond -/diamond -{ newpath - xcurr ycurr trpoint moveto - symbolsize neg 0 rmoveto - symbolsize symbolsize neg rlineto - symbolsize symbolsize rlineto - symbolsize neg symbolsize rlineto - closepath [] 0 setdash stroke +% dofilleddiamond: show filled diamond with given symbolsize and symbollinewidth +% NB symbollinewidth is not used +% <x> <y> <symbolsize> <symbollinewidth> dofilleddiamond - +/dofilleddiamond +{ + pop /ss exch def + newpath + moveto + ss neg 0 rmoveto + ss ss neg rlineto + ss ss rlineto + ss neg ss rlineto + closepath fill +} def + +% filleddiamond: show a filled diamond +% - filleddiamond - +/filleddiamond { xcurr ycurr trpoint symbolsize symbollinewidth dofilleddiamond } def + +% docircle: show an open circle with a given symbolsize and symbollinewidth +% NB symbolsize is reduced by half the line width to get size exactly right +% <x> <y> <symbolsize> <symbollinewidth> docircle - +/docircle +{ + dup setlinewidth + 0.5 mul sub 0 max /ss exch def + newpath + ss 0 360 arc [] 0 setdash stroke } def -% filleddiamond: show a small filled diamond -/filleddiamond -{ newpath - xcurr ycurr trpoint moveto - symbolsize neg 0 rmoveto - symbolsize symbolsize neg rlineto - symbolsize symbolsize rlineto - symbolsize neg symbolsize rlineto - closepath gsave [] 0 setdash stroke grestore fill -} def +% circle: show an open circle +% - circle - +/circle { xcurr ycurr trpoint symbolsize symbollinewidth docircle } def -% circle: show a small circle -/circle -{ newpath - xcurr ycurr trpoint symbolsize 0 360 arc [] 0 setdash stroke +% dofilledcircle: show filled circle with given symbolsize and symbollinewidth +% NB symbollinewidth is not used +% <x> <y> <symbolsize> <symbollinewidth> dofilledcircle - +/dofilledcircle +{ + pop /ss exch def + newpath + ss 0 360 arc fill } def -% filledcircle: show a small filled circle -/filledcircle -{ newpath - xcurr ycurr trpoint symbolsize 0 360 arc gsave [] 0 setdash stroke grestore fill -} def +% filledcircle: show a filled circle +% - filledcircle - +/filledcircle { xcurr ycurr trpoint symbolsize symbollinewidth dofilledcircle } def -% triangle: show a small triangle -/triangle -{ newpath - xcurr ycurr trpoint moveto - 0 symbolsize 1.5 mul rmoveto - symbolsize neg symbolsize -2.5 mul rlineto - symbolsize 2 mul 0 rlineto +% dotriangle: show an open triangle with a given symbolsize and symbollinewidth +% NB symbolsize is reduced by half the line width to get size exactly right +% <x> <y> <symbolsize> <symbollinewidth> dotriangle - +/dotriangle +{ + dup setlinewidth + 0.5 mul sub 0 max /ss exch def + newpath + moveto + 0 ss 1.5 mul rmoveto + ss neg ss -2.5 mul rlineto + ss 2 mul 0 rlineto closepath [] 0 setdash stroke } def -% filledtriangle: show a small filled triangle -/filledtriangle -{ newpath - xcurr ycurr trpoint moveto - 0 symbolsize 1.5 mul rmoveto - symbolsize neg symbolsize -2.5 mul rlineto - symbolsize 2 mul 0 rlineto - closepath gsave [] 0 setdash stroke grestore fill -} def +% triangle: show an open triangle +% - triangle - +/triangle { xcurr ycurr trpoint symbolsize symbollinewidth dotriangle } def + +% dofilledtriangle: show filled triangle with symbolsize and symbollinewidth +% NB symbollinewidth is not used +% <x> <y> <symbolsize> <symbollinewidth> dofilledtriangle - +/dofilledtriangle +{ + pop /ss exch def + newpath + moveto + 0 ss 1.5 mul rmoveto + ss neg ss -2.5 mul rlineto + ss 2 mul 0 rlineto + closepath fill +} def + +% filledtriangle: show a filled triangle +% - filledtriangle - +/filledtriangle { symbolsize symbollinewidth dofilledtriangle } def %plog: like log only with a base, and protected from failing if <= 0 diff --git a/include/haskellf b/include/haskellf index 26f4cac..df2192e 100644 --- a/include/haskellf +++ b/include/haskellf @@ -501,8 +501,9 @@ def @HaskellSetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @Haskell diff --git a/include/javaf b/include/javaf index e0cf8ea..2d47049 100644 --- a/include/javaf +++ b/include/javaf @@ -420,8 +420,9 @@ def @JavaSetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @Java diff --git a/include/langdefs b/include/langdefs index 3df4bae..9a980da 100644 --- a/include/langdefs +++ b/include/langdefs @@ -13,6 +13,7 @@ langdef Italian Italiano it { italian } langdef Norwegian Norsk no { norweg . : ! ? .) ?) !) .' !' ?' } langdef Polish Polski pl { polish . : ! ? .) ?) !) .' !' ?' } langdef Portuguese "Português" pt { portugal . : ! ? .) ?) !) .' !' ?' } +langdef Programming pr { programming } langdef Russian "\362\325\323\323\313\311\312" ru { russian . : ! ? .) ?) !) .' !' ?' } langdef Slovak Slovensky Slovencina sk { slovak . : ! ? .) ?) !) .' !' ?' } langdef Slovenian Slovenia Slovenija sl { slovenia . : ! ? .) ?) !) .' !' ?' } diff --git a/include/mathf b/include/mathf index 8c395fd..41d335e 100644 --- a/include/mathf +++ b/include/mathf @@ -1,9 +1,9 @@ ############################################################################### # # -# Lout @Math package for equation formatting, based on @Eq. # +# Lout @Math package for formatting mathematics # # # -# @Eq revision history: # +# @Math is based on the earlier @Eq package. @Eq revision history: # # # # Version 1.0 by Jeffrey H. Kingston, December 1990. # # Version 2.0 by Jeffrey H. Kingston, 22 December 1992. # @@ -11,21 +11,27 @@ # # # @Math revision history: # # # -# Version 1.0 by Ludovic Courtès, June 2007. # +# Version 4.0 by Ludovic Courtès, June 2007. # +# Version 5.0 by Jeffrey H. Kingston, September 2008. # # # -# See "Eq - a Lout package for typesetting mathematics" for user # -# information. Acknowledgement: the @Eq language is based closely on # -# the Eqn language of B. W. Kernighan and L. L. Cherry; the spacing rules # -# are similar to those of the TeX system by D. E. Knuth. # +# Acknowledgement: @Eq and @Math are based closely on the Eqn language # +# of B. W. Kernighan and L. L. Cherry; the spacing rules are similar to # +# those of the TeX system by D. E. Knuth. # # # # Version 4.0 makes use of `@SetContext' and `@GetContext' (introduced in # -# Basser Lout 3.34) to better honor the typesetting conventions outlined by # -# Knuth. # +# Lout 3.34) to better honor the typesetting conventions outlined by Knuth. # # # ############################################################################### -export "`" "``" "```" bin rel punct non vctr big small +export + # Helper symbols + above below wideabove widebelow + "`" "``" "```" non big small vctr + @SuperScriptStyle @SubScriptStyle @NumeratorStyle + @DenominatorStyle @SquareRootStyle + + # Ordinary symbols (Symbol font) space exclam universal numbersign existential percent ampersand suchthat parenleft parenright asteriskmath plus comma minus period slash zero one two three four @@ -57,59 +63,63 @@ export "`" "``" "```" bin rel punct non vctr big small bracketrightex bracketrightbt bracerighttp bracerightmid bracerightbt - hbar Re Im partial infty prime nabla surd top bot dbar - triangle backslash forall exists neg - circle filledcircle square + # Ordinary symbols (arrows) + leftarrow longleftarrow dblleftarrow dbllongleftarrow + rightarrow longrightarrow dblrightarrow dbllongrightarrow + leftrightarrow longleftrightarrow dblleftrightarrow + dbllongleftrightarrow mapsto longmapsto hookleftarrow + hookrightarrow leadsto leftharpoonup rightharpoonup + leftharpoondown rightharpoondown rightleftharpoons + uparrow dbluparrow downarrow dbldownarrow updownarrow + dblupdownarrow nearrow searrow swarrow nwarrow + + # Ordinary symbols (to get Roman font) + arccos arcsin arctan arg cos cosh cot coth csc deg det dim exp + gcd hom inf ker lg lim liminf limsup ln log max min Pr sec sin + sinh supr tan tanh mod "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" + "!" "?" "%" "(" ")" "[" "]" - "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" + # Ordinary symbols (for atleft and atright) + lpar blpar rpar brpar lbrack blbrack rbrack brbrack lbrace blbrace + rbrace brbrace lfloor blfloor rfloor brfloor lceil blceil + rceil brceil langle blangle rangle brangle + + # Ordinary symbols (miscellaneous) + hbar Re Im partial infty prime nabla surd top bot dbar triangle + backslash forall exists neg circle filledcircle square ldots cdots + vdots ddots del grad "..." ",...," "'" "''" "'''" "''''" empty + triangleup triangledown half third - sum prod coprod int oint bcap bcup bvee bwedge bodot botimes - boplus buplus + # Variable-building symbols + dot dotdot hat tilde vec dyad overbar underbar + sup sub tsub supp on ton + + # Large operator symbols + largeop sum prod coprod bcap bcup bvee bwedge bodot botimes + boplus buplus int oint + + # Unary operator symbols + sqrt root zroot + matrix pmatrix bmatrix brmatrix fmatrix cmatrix amatrix - "+" "-" "+-" "-+" setminus cdot times "*" circ div cap cup uplus - sqcap sqcup triangleleft triangleright + # Binary operator symbols + over frac + bin "+" "-" "+-" "-+" setminus cdot times "*" circ div + cap cup uplus sqcap sqcup triangleleft triangleright wr bigcirc bigtriangleup bigtriangledown vee wedge oplus ominus otimes oslash odot dagger daggerdbl amalg - "<" ">" "=" "<=" prec preceq "<<" subset subseteq sqsubseteq + # Relation symbols + rel "<" ">" "=" "<=" prec preceq "<<" subset subseteq sqsubseteq in vdash smile frown ">=" succ succeq ">>" supset supseteq sqsupseteq ni dashv mid parallel "==" "~" "-~" asymp "~~" - "=~" bowtie propto models doteq trieq perp notsub notin "!=" not + "=~" bowtie propto models doteq trieq perp notsub notin "!=" "<->" "<--" "-->" up down "<=>" "<==" "==>" dblup dbldown ":" "::" ":=" + # not - lpar blpar rpar brpar lbrack blbrack rbrack brbrack lbrace blbrace - rbrace brbrace lfloor blfloor rfloor brfloor lceil blceil - rceil brceil langle blangle rangle brangle - - ";" "," col - - "!" "?" "%" "(" ")" "[" "]" - - arccos arcsin arctan arg cos cosh cot coth csc deg det dim exp - gcd hom inf ker lg lim liminf limsup ln log max min Pr sec sin - sinh supr tan tanh mod ldots cdots vdots ddots del grad - "..." ",...," "'" "''" "'''" "''''" empty - - triangleup triangledown - - leftarrow longleftarrow dblleftarrow dbllongleftarrow - rightarrow longrightarrow dblrightarrow dbllongrightarrow - leftrightarrow longleftrightarrow dblleftrightarrow dbllongleftrightarrow - mapsto longmapsto hookleftarrow hookrightarrow leadsto - leftharpoonup rightharpoonup leftharpoondown rightharpoondown - rightleftharpoons - uparrow dbluparrow downarrow dbldownarrow updownarrow dblupdownarrow - nearrow searrow swarrow nwarrow - - sup sub tsub supp on ton frac half third over - atop below wideatop widebelow - dot dotdot hat tilde vec dyad overbar underbar sqrt root zroot - matrix pmatrix bmatrix brmatrix fmatrix cmatrix amatrix - - @SuperScriptStyle @SubScriptStyle - @NumeratorStyle @DenominatorStyle - @SquareRootStyle + # Punctuation symbols + punct ";" "," col def @Math named symbolfont { Symbol Base } @@ -120,24 +130,57 @@ def @Math body @Body @Begin + ################################################################### + # # + # Operator Precedences (private) # + # # + # All @Math symbols with parameters have explicit precedences # + # defined by invoking one of the following macros. Symbols # + # that are typically used to build variables have high # + # precedence (84-80), then come unary operators (70), then # + # binary operators (66-60), then relations and the rest. # + # See also http://en.wikipedia.org/wiki/Order_of_operations . # + # # + ################################################################### + + macro @MaxPrec { 100 } + macro @HatPrec { 84 } + macro @SubPrec { 82 } + macro @SupPrec { 80 } + macro @UnaryOpPrec { 70 } + macro @BinaryOpTimesPrec { 64 } + macro @BinaryOpDividePrec { 62 } + macro @BinaryOpPrec { 60 } + macro @RelationPrec { 50 } + macro @PunctuationPrec { 40 } + macro @HelperNonPrec { 26 } + macro @HelperAbovePrec { 24 } + macro @HelperColPrec { 22 } + macro @HelperRowPrec { 20 } + ################################################################### # # - # Context-sensitive format changes. # + # Context-sensitive format changes (private) # # # # Equation formatting (according to Knuth) demands changes in # # the appearance of equations depending on context. Knuth # # distinguishes four major styles (the TeXbook, Ch. 17): # # # - # display style (formulas displayed on lines by themselves) # - # text style (formulas embedded in the text) # - # script style (formulas used as superscripts or subscripts) # - # scriptscript (second-order superscripts or subscripts) # + # display formulas displayed on lines by themselves # + # text formulas embedded in the text # + # script formulas used as superscripts or subscripts # + # scriptscript second-order superscripts or subscripts # # # # Each style has its own font size and spacing rules. # - # # # Additionally, each of these styles can be ``cramped'', # - # meaning that exponents are not raised as much. # + # meaning that exponents are not raised as much. To these # + # four styles @Math adds a fifth: # + # # + # nohspace formulas enclosed in "non" # + # # + # which implements the "non" operator by causing all # + # style-dependent horizontal space to be 0. # # # ################################################################### @@ -176,6 +219,7 @@ def @Math # display and text styles yield the same font size { "display" "text" } @Yield 1.0f else @Yield 0.7f } } + "nohspace" @Yield 1.0f } } @@ -186,7 +230,7 @@ def @Math { @CrampedVar @Yield cramped } @SetContext { # FIXME: Space is not properly inherited, hence this # `@Space' invocation. - { @EqDebug initialspace @Space x } + { initialspace @Space x } } } } @@ -201,18 +245,12 @@ def @Math def @SubScriptGap { 0.35fk } - - ################################################################### - # # - # Spacing rules. # - # # - ################################################################### - # Space around relational operators. def @CurrRelSpaceGap { @CurrStyle @Case { { "display" "text" } @Yield 0.300fe + "nohspace" @Yield 0i else @Yield 0.030ce } } @@ -222,6 +260,7 @@ def @Math { @CurrStyle @Case { { "display" "text" } @Yield 0.240fe + "nohspace" @Yield 0i else @Yield 0.024ce } } @@ -231,20 +270,11 @@ def @Math { @CurrStyle @Case { { "display" "text" } @Yield 0.180fe + "nohspace" @Yield 0i else @Yield 0.018ce } } - def "`" { &@CurrPunctSpaceGap } - def "``" { &@CurrBinarySpaceGap } - def "```" { &@CurrRelSpaceGap } - def bin left l named op { "binop" } right r - { l &@CurrBinarySpaceGap op &@CurrBinarySpaceGap r } - def rel left l named op { "relop" } right r - { l &@CurrRelSpaceGap op &@CurrRelSpaceGap r } - def punct left l named symbol { "punct" } right r - { l &0.0ce symbol &@CurrPunctSpaceGap r } - # Gap above/below math expressions (see, e.g., `to' and `from'). def @AboveGap { 0.15f } def @BelowGap { 0.15f } @@ -256,21 +286,162 @@ def @Math ################################################################### # # - # Major styles: scripts, fractions, and square roots. # + # Miscellaneous helper definitions (private) # + # # + ################################################################### + + def @Base precedence @MaxPrec right x { basefont @Font x } + def @Sym precedence @MaxPrec right x { symbolfont @Font x } + + def @HLine + named line { @BackEnd @Case { PostScript @Yield { "0.05 ft setlinewidth" } PDF @Yield { "__mul(__loutf, 0.05) w" } } } + { + @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto xsize 0 lineto" line "stroke" } @Graphic {} + } + PDF @Yield { # note re-arrangement of commands (setlinewidth (='w') not allowed in a path) + { line "0 0 m __xsize 0 l s" } @Graphic {} + } + } + } + + def @VLine + { + @BackEnd @Case { + PostScript @Yield { + "0 0 moveto 0 ysize lineto 0.05 ft setlinewidth stroke" @Graphic {} + } + PDF @Yield { + "__mul(__loutf, 0.05) w 0 0 m 0 __ysize l s" @Graphic {} + } + } + } + + def @Strut + precedence @MaxPrec + right x + { + @OneCol { x | @OneRow { 0.5f @High ^/ 0.5f @High } } + } + + def @OrDefault + left l + right r + { + l @Case { + "dft" @Yield r + else @Yield l + } + } + + + ################################################################### + # # + # Helper symbols (public, exc @ScriptStyle and @FractionStyle) # # # ################################################################### + def above + precedence @HelperAbovePrec + associativity left + left x + named gap { @BelowGap } + named skew { 0c } + right y + { + @HContract @VContract + { |0.5rt x + //gap |0.5rt &skew y + } + } + + def below + precedence @HelperAbovePrec + associativity left + left x + named gap { @AboveGap } + named skew { 0c } + right y + { + @HContract @VContract + { |0.5rt &skew y + ^//gap |0.5rt x + } + } + + def wideabove + precedence @HelperAbovePrec + associativity left + left x + named gap { @BelowGap } + right y + { + @HContract @VContract + { + x //gap @HScale y + } + } + + def widebelow + precedence @HelperAbovePrec + associativity left + left x + named gap { @AboveGap } + right y + { + @HContract @VContract + { + @HScale y ^//gap x + } + } + + def "`" { &@CurrPunctSpaceGap } + def "``" { &@CurrBinarySpaceGap } + def "```" { &@CurrRelSpaceGap } + + def non + precedence @HelperNonPrec + right x + { + { @CurrStyleVar @Yield "nohspace" } @SetContext x + } + + def big + precedence @MaxPrec + right x + { + 1.3f @Font x + } + + def small + precedence @MaxPrec + right x + { + 0.6f @Font x + } + + def vctr + precedence @MaxPrec + right x + { + 0.5w @VShift x + } + def @ScriptStyle named level { "sup" } right script { @WithStyle - style { @CurrStyle @Case { - { "display" "text" } @Yield "script" - { "script" "scriptscript" } @Yield "scriptscript" } } - cramped { level @Case { - "sub" @Yield "Yes" - "sup" @Yield @Cramped } } + style { @CurrStyle @Case { + { "display" "text" } @Yield "script" + { "script" "scriptscript" } @Yield "scriptscript" + "nohspace" @Yield "nohspace" + } } + cramped { level @Case { + "sub" @Yield "Yes" + "sup" @Yield @Cramped + } } { script } } @@ -284,19 +455,21 @@ def @Math @ScriptStyle level { "sub" } subscript } - def @FractionStyle named level { "numerator" } right x { @WithStyle - style { @CurrStyle @Case { - "display" @Yield "text" - "text" @Yield "script" - { "script" "scriptscript" } @Yield "scriptscript" } } - cramped { level @Case { - "numerator" @Yield @Cramped - "denominator" @Yield "Yes"} } + style { @CurrStyle @Case { + "display" @Yield "text" + "text" @Yield "script" + { "script" "scriptscript" } @Yield "scriptscript" + "nohspace" @Yield "nohspace" + } } + cramped { level @Case { + "numerator" @Yield @Cramped + "denominator" @Yield "Yes" + } } { x } } @@ -314,70 +487,20 @@ def @Math { @WithStyle style { @CurrStyle } cramped { "Yes" } x } - - - ################################################################### - # # - # Utilities: `big', `small', `@HLine', etc. # - # # - ################################################################### - - # XXX: Certainly not the best way to implement `non'. - def non right x { { @CurrStyleVar @Yield "script" } @SetContext x } - def big right x { 1.3f @Font x } - def small right x { 0.6f @Font x } - - def @Base right x { basefont @Font x } - def @Sym right x { symbolfont @Font x } - - def @HLine - named line { @BackEnd @Case { PostScript @Yield { "0.05 ft setlinewidth" } PDF @Yield { "__mul(__loutf, 0.05) w" } } } - { - @BackEnd @Case { - PostScript @Yield { - { "0 0 moveto xsize 0 lineto" line "stroke" } @Graphic {} - } - PDF @Yield { # note re-arrangement of commands (setlinewidth (='w') not allowed in a path) - { line "0 0 m __xsize 0 l s" } @Graphic {} - } - } - } - - def @VLine - { - @BackEnd @Case { - PostScript @Yield { - "0 0 moveto 0 ysize lineto 0.05 ft setlinewidth stroke" @Graphic {} - } - PDF @Yield { - "__mul(__loutf, 0.05) w 0 0 m 0 __ysize l s" @Graphic {} - } - } - } - - def vctr - right x - { - 0.5w @VShift x - } - - def @Strut right x - { - @OneCol { x | @OneRow { 0.5f @High ^/ 0.5f @High } } - } ################################################################### # # - # Full names # + # Ordinary symbols (Symbol font) # # # # These symbols and their names are taken directly from the # # Adobe Systems Inc. Symbol font (see PostScript Language # # Reference Manual, pp. 256-257). The only differences are: # # # - # Adobe: theta1 Eq: thetaone # + # Adobe: theta1 @Math: thetaone # # sigma1 sigmaone # # phi1 phione # # omega1 omegaone # + # Upsilon1 Upsilonone # # # # These were needed since Lout identifiers do not have digits. # # # @@ -425,7 +548,7 @@ def @Math def Gamma { @Sym @Char "Gamma" } def Eta { @Sym @Char "Eta" } def Iota { @Sym @Char "Iota" } - def thetaone { @Sym @Char "thetaone" } + def thetaone { @Sym @Char "theta1" } def Kappa { @Sym @Char "Kappa" } def Lambda { @Sym @Char "Lambda" } @@ -438,7 +561,7 @@ def @Math def Sigma { @Sym @Char "Sigma" } def Tau { @Sym @Char "Tau" } def Upsilon { @Sym @Char "Upsilon" } - def sigmaone { @Sym @Char "sigmaone" } + def sigmaone { @Sym @Char "sigma1" } def Omega { @Sym @Char "Omega" } def Xi { @Sym @Char "Xi" } def Psi { @Sym @Char "Psi" } @@ -458,7 +581,7 @@ def @Math def gamma { @Sym @Char "gamma" } def eta { @Sym @Char "eta" } def iota { @Sym @Char "iota" } - def phione { @Sym @Char "phione" } + def phione { @Sym @Char "phi1" } def kappa { @Sym @Char "kappa" } def lambda { @Sym @Char "lambda" } def mu { @Sym @Char "mu" } @@ -471,7 +594,7 @@ def @Math def sigma { @Sym @Char "sigma" } def tau { @Sym @Char "tau" } def upsilon { @Sym @Char "upsilon" } - def omegaone { @Sym @Char "omegaone" } + def omegaone { @Sym @Char "omega1" } def omega { @Sym @Char "omega" } def xi { @Sym @Char "xi" } def psi { @Sym @Char "psi" } @@ -480,7 +603,7 @@ def @Math def bar { @Sym @Char "bar" } def braceright { @Sym @Char "braceright" } def similar { @Sym @Char "similar" } - def Upsilonone { @Sym @Char "Upsilonone" } + def Upsilonone { @Sym @Char "Upsilon1" } def minute { @Sym @Char "minute" } def lessequal { @Sym @Char "lessequal" } def fraction { @Sym @Char "fraction" } @@ -537,12 +660,6 @@ def @Math def product { @Sym @Char "product" } def radical { @Sym @Char "radical" } def dotmath { @Sym @Char "dotmath" } - - def @PureDot # dot with no extra space - { - @HContract { &0io 0.4w @HShift dotmath } - } - def logicalnot { @Sym @Char "logicalnot" } def logicaland { @Sym @Char "logicaland" } def logicalor { @Sym @Char "logicalor" } @@ -585,861 +702,7 @@ def @Math ################################################################### # # - # Short names # - # # - # These symbols, their names, and their spacing, are based on # - # the list in Appendix F of Donald E. Knuth's The TeXBook. # - # # - # Group 1 (lowercase Greek letters): see full names above # - # Group 2 (uppercase Greek letters): see full names above # - # Group 3 (calligraphic capitals): not provided by Eq # - # # - ################################################################### - - ################################################################### - # # - # Group 4 (miscellaneous Ord symbols) # - # # - # Not all of Knuth's symbols are available. The four suits # - # (heartsuit, etc.), have definitions above. # - # # - ################################################################### - - def hbar { @OneCol { &0.1f @Base "-" ^/0.25fo h } } - def Re { Rfraktur } - def Im { Ifraktur } - def partial { partialdiff } - def infty { infinity } - def prime { minute } - #def emptyset { defined above } - def nabla { gradient } - def surd { radical } - def top { 180d @Rotate perpendicular } - def bot { perpendicular } - def dbar { @Base "||" } - #def angle { defined above } - def backslash { "\\" } - def forall { universal } - def exists { existential } - def neg { logicalnot } - - def circle - { @HContract @VContract @BackEnd @Case { - PostScript @Yield { - { - "xsize ysize 2 div moveto" - "xsize 2 div ysize 2 div xsize 2 div 0 360 arc" - "0.04 ft setlinewidth stroke" - } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } - } - PDF @Yield { - # - # VT: draws a counterclockwise 360 degree arc from 0 to +360 - # degree positions (straight right to straight right) with - # centre = (xsize/2, ysize/2) and radius = xsize/2, - # implemented as two counterclockwise 180 degree arcs. - # start at (xsize, ysize/2); the control points are: - # - # pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) - # pt2 = (0, ysize/2 + (4/3 * xsize/2)) - # - # end at (0, ysize/2). Then start at (0, ysize/2); control points - # - # pt1 = (0, ysize/2 - (4/3 * xsize/2)) - # pt2 = (xsize, ysize/2 - (4/3 * xsize/2)) - # - # and end at (xsize, ysize/2). - - { - "__mul(0.04, __loutf) w" - "__xsize __div(__ysize, 2) m" - "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" - "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" - "0 __div(__ysize, 2) c" - "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" - "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" - "__xsize __div(__ysize, 2) c S" - } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } - } - } - } - - def filledcircle - { @HContract @VContract @BackEnd @Case { - PostScript @Yield { - { - "xsize ysize 2 div moveto" - "xsize 2 div ysize 2 div xsize 2 div 0 360 arc" - "0.04 ft setlinewidth fill" - } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } - } - PDF @Yield { - # - # JK: I don't know how to fill in PDF, so this doesn't! - # - # VT: draws a counterclockwise 360 degree arc from 0 to +360 - # degree positions (straight right to straight right) with - # centre = (xsize/2, ysize/2) and radius = xsize/2, - # implemented as two counterclockwise 180 degree arcs. - # start at (xsize, ysize/2); the control points are: - # - # pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) - # pt2 = (0, ysize/2 + (4/3 * xsize/2)) - # - # end at (0, ysize/2). Then start at (0, ysize/2); control points - # - # pt1 = (0, ysize/2 - (4/3 * xsize/2)) - # pt2 = (xsize, ysize/2 - (4/3 * xsize/2)) - # - # and end at (xsize, ysize/2). - - { - "__mul(0.04, __loutf) w" - "__xsize __div(__ysize, 2) m" - "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" - "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" - "0 __div(__ysize, 2) c" - "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" - "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" - "__xsize __div(__ysize, 2) c S" - } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } - } - } - } - - def square - { @HContract @VContract @BackEnd @Case { - PostScript @Yield { - { - "0 0 moveto xsize 0 lineto xsize ysize lineto" - "0 ysize lineto closepath" - "0.04 ft setlinewidth stroke" - } @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High } - } - PDF @Yield { - { - "__mul(__loutf, 0.04) w" - "0 0 m __xsize 0 l __xsize __ysize l" - "0 __ysize l s" - } @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High } - } - } - } - - def triangle - { @HContract @VContract @BackEnd @Case { - PostScript @Yield { - { - "0 0 moveto xsize 0 lineto" - "xsize 2 div ysize lineto closepath" - "0.04 ft setlinewidth stroke" - } @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } - } - PDF @Yield { - { - "__mul(__loutf, 0.04) w" - "0 0 m __xsize 0 l" - "__div(__xsize, 2) __ysize l s" - } @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } - } - } - } - - - ################################################################### - # # - # Layout primitives. # - # # - ################################################################### - - def atop - precedence 73 - associativity left - left x - named gap { @BelowGap } - named skew { 0c } - right y - { - @HContract @VContract - { |0.5rt x - //gap |0.5rt &skew y - } - } - - def below - precedence 73 - associativity left - left x - named gap { @AboveGap } - named skew { 0c } - right y - { - @HContract @VContract - { |0.5rt &skew y - ^//gap |0.5rt x - } - } - - def wideatop - precedence 73 - associativity left - left x - named gap { @BelowGap } - right y - { - @HContract @VContract - { - x //gap @HScale y - } - } - - def widebelow - precedence 73 - associativity left - left x - named gap { @AboveGap } - right y - { - @HContract @VContract - { - @HScale y ^//gap x - } - } - - ################################################################### - # # - # Operator Precedence # - # # - # We use the precedence illustrated by the following macros # - # for the various operator groups. I.e., exponentiation and # - # square root precede multiplication and division, which in # - # turn precede addition and substraction, etc. # - # See http://en.wikipedia.org/wiki/Order_of_operations . # - # # - ################################################################### - - macro @PunctuationPrec { 13 } - - macro @EqualityPrec { 23 } - macro @OrderingPrec { 33 } - macro @AdditionPrec { 43 } - macro @MultiplicationPrec { 53 } - macro @DivisionPrec { 54 } - macro @ExponentPrec { 63 } - macro @FactorialPrec { 73 } - - - ################################################################### - # # - # Group 6 ("Large" operators) # - # # - # Layout of large operators differs in several ways, depending # - # on whether they are in display mode or not. # - # # - # 1. The operator itself is larger in display mode. We # - # achieve this by automatically prepending `big' to the # - # operator's symbol when in display mode. # - # # - # 2. The "bounds" of these operators (i.e., `from' and `to') # - # are set as limits (i.e., above and below the operator # - # symbol) when in display mode, and displayed to the # - # right of the symbol otherwise. Integrations are an # - # exception (the only exception?). # - # # - # See ``The TeXbook'', Chapter 17. # - # # - ################################################################### - - def largeoperator - precedence 58 - named symbol { "largeop" } - named from { "" } - named to { "" } - named limits { "Yes" } # whether to set `from' and `to' as limits - { - def @NoLimitsBody { - 0.5w @VShift { - 1.0w @VShift @OneRow { - { | 0.3w @VShift @SuperScriptStyle to } - ^/0.0fo { 0w @VShift symbol | } - } - - /0.0fo - - { | 0.7w @VShift @SubScriptStyle from } - } - |{ @CurrPunctSpaceGap } - } - - def @LimitsBody { - symbol atop { @SuperScriptStyle from } - below { @SubScriptStyle to } - } - - limits @Case { - { "Yes" "yes" } @Yield @LimitsBody - { "No" "no" } @Yield @NoLimitsBody - } - } - - def simplelargeoperator - named symbol { "simplelargeop" } - named limits { "Auto" } - named from { } - named to { } - { - largeoperator symbol { @CurrStyle @Case { - "display" @Yield { big symbol } - else @Yield symbol } } - limits { limits @Case { - "Auto" @Yield { - @CurrStyle @Case { - "display" @Yield "Yes" - else @Yield "No" } } - else @Yield limits } } - from { from } - to { to } - } - - def sum named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { summation } limits { limits } - from { from } to { to } } - def prod named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { product } limits { limits } - from { from } to { to } } - def coprod named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { 180d @Rotate vctr product } - limits { limits } - from { from } to { to } } - def bcap named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { intersection } limits { limits } - from { from } to { to } } - def bcup named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { union } limits { limits } - from { from } to { to } } - def bvee named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { logicalor } limits { limits } - from { from } to { to } } - def bwedge named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { logicaland } limits { limits } - from { from } to { to } } - def bodot named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { & @HContract { - circle /0io &0.5rt @PureDot } } - limits { limits } - from { from } to { to } } - def botimes named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { circlemultiply } limits { limits } - from { from } to { to } } - def boplus named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { circleplus } limits { limits } - from { from } to { to } } - def buplus named from { } named to { } named limits { "Auto" } - { simplelargeoperator symbol { & @HContract { - &0.5rt 0.7f @Font plus - ^/0.2fo union } } - limits { limits } - from { from } to { to } } - - ################################################################### - # # - # Integrations are slightly different in that, according to # - # Knuth (Chapter 17, p. 144), ``superscripts and subscripts # - # are not set as limits, even in display style''. Still, as # - # in TeX, we let users the possibility to override this. # - # # - ################################################################### - - def integration - named symbol { "integration" } - named limits { "No" } - named from { } - named to { } - { - largeoperator symbol { @CurrStyle @Case { - "display" @Yield { big symbol } - else @Yield symbol } } - limits { limits } - from { from } - to { to } - } - - def int - named limits { "No" } - named from { } - named to { } - { - integration symbol { vctr integral } - limits { limits } - from { from } - to { to } - } - - def oint - named limits { "No" } - named from { } - named to { } - { - integration symbol { @OneCol { vctr degree |0.015fo int } } - limits { limits } - from { from } - to { to } - } - - - - ################################################################### - # # - # Group 7 (binary operations) # - # # - # All of Knuth's symbols are available except \star, \diamond # - # and \bullet; a few have been given more mnemonic names. # - # # - ################################################################### - - def "+" precedence @AdditionPrec left l right r - { l bin op { plus } r } - def "-" precedence @AdditionPrec left l right r - { l bin op { minus } r } - def "+-" precedence @AdditionPrec left l right r - { l bin op { plusminus } r } - def "-+" precedence @AdditionPrec left l right r - { l bin op { 180d @Rotate plusminus } r } - def setminus precedence @AdditionPrec left l right r - { l bin op { backslash } r } - def cdot precedence @AdditionPrec left l right r - { l bin op { dotmath } r } - def times precedence @MultiplicationPrec left l right r - { l bin op { multiply } r } - def "*" precedence @MultiplicationPrec left l right r - { l bin op { asteriskmath } r } - #def diamond { name used above } - def circ precedence @MultiplicationPrec left l right r - { l bin op { circle } r } - #def bullet { name used above } - def div precedence @DivisionPrec left l right r - { l bin op { divide } r } - def cap precedence @MultiplicationPrec left l right r - { l bin op { intersection } r } - def cup precedence @MultiplicationPrec left l right r - { l bin op { union } r } - def uplus precedence @MultiplicationPrec left l right r - { l - bin op { @OneRow @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union} } - r } - - def sqcap precedence @MultiplicationPrec left l right r - { l - bin op { @HContract @VContract - @BackEnd @Case { - PostScript @Yield { - { "0 0 moveto 0 ysize lineto xsize ysize lineto" - "xsize 0 lineto" - "0.04 ft setlinewidth stroke" - } - @Graphic - { 0.3f @Wide 0.3f @High ^| ^/ - 0.3f @Wide 0.3f @High - } - } - PDF @Yield { - { "__mul(__loutf, 0.04) w" - "0 0 m 0 __ysize l __xsize __ysize l" - "__xsize 0 l s" - } - @Graphic - { 0.3f @Wide 0.3f @High ^| ^/ - 0.3f @Wide 0.3f @High - } - } - } - } - r } - - def sqcup { 180d @Rotate sqcap } - def triangleleft left l right r - { l bin op { "90d" @Rotate 0.8f @Font triangle } r } - def triangleright left l right r - { l bin op { "-90d" @Rotate 0.8f @Font triangle } r } - def wr left l right r - { l bin op { vctr {90d @Rotate similar } } r } - def bigcirc left l right r - { l bin op { 1.2f @Font circle} r } - def bigtriangleup left l right r - { l bin op { 1.2f @Font triangle } r } - def bigtriangledown left l right r - { l bin op { 180d @Rotate 1.2f @Font triangle } r } - def vee left l right r - { l bin op { logicalor } r } - def wedge left l right r - { l bin op { logicaland } r } - def oplus left l right r - { l bin op { circleplus } r } - def ominus left l right r - { l bin op { @OneRow @HContract { circle /0io &0.5rt minus } } r } - def otimes left l right r - { l bin op { circlemultiply } r } - def oslash left l right r - { l - bin op { `vctr 60d @Rotate @HContract {circle /0io &0.5rt minus`} } - r } - def odot left l right r - { l bin op { @OneRow @HContract {circle /0io &0.5rt @PureDot } } r } - def dagger left l right r - { l bin op { @Base @Char "dagger" } r } - def daggerdbl left l right r - { l bin op { @Base @Char "daggerdbl" } r } - def amalg left l right r - { l bin op { 180d @Rotate vctr product } r } - - ################################################################### - # # - # Group 8 (relations) # - # # - # All Knuth's operators are available, but many have been # - # given different, more mnemonic names. Also included is # - # a not operator for negating the relations. # - # # - ################################################################### - - def "<" precedence @OrderingPrec left l right r - { l rel op { less } r } - def ">" precedence @OrderingPrec left l right r - { l rel op { greater } r } - def "=" precedence @EqualityPrec left l right r - { l rel op { equal } r } - def "<=" precedence @OrderingPrec left l right r - { l rel op { lessequal } r } - def prec left l right r - { l - rel op { 0.45f @Font "-90d" - @Rotate { parenrighttp ^| parenlefttp } } - r } - def preceq { rel { @OneRow non prec /0.1f minus } } - def "<<" precedence @OrderingPrec left l right r - { l rel op { less less } r } - def subset precedence @OrderingPrec left l right r - { l rel op { propersubset } r } - def subseteq precedence @OrderingPrec left l right r - { l rel op { reflexsubset } r } - def sqsubseteq precedence @OrderingPrec left l right r - { l - rel op { @HContract @VContract - @BackEnd @Case { - PostScript @Yield { - { { "xsize 0 moveto" - "0 0 lineto" - "0 ysize lineto" - "xsize ysize lineto" - "0.04 ft setlinewidth stroke" - } - @Graphic - { 0.5f @Wide 0.25f @High ^/ - 0.25f @High - } - /0.1f minus - } - } - PDF @Yield { - { { "__mul(__loutf, 0.04) w" - "__xsize 0 m" - "0 0 l" - "0 __ysize l" - "__xsize __ysize l s" - } - @Graphic - { 0.5f @Wide 0.25f @High ^/ - 0.25f @High - } - /0.1f minus - } - } - } - } - r } - - def in precedence @OrderingPrec left l right r - { l rel op { element } r } - def vdash precedence @OrderingPrec left l right r - { l rel op { vctr {"-90d" @Rotate perpendicular} } r } - def smile precedence @OrderingPrec left l right r - { l rel op { vctr 90d @Rotate parenleft } r } - def frown precedence @OrderingPrec left l right r - { l rel op { vctr 90d @Rotate parenright } r } - - def ">=" precedence @OrderingPrec left l right r - { l rel op { greaterequal } r } - def succ precedence @OrderingPrec left l right r - { l - rel op { 0.45f @Font 90d @Rotate - { parenrighttp ^| parenlefttp } } - r } - def succeq precedence @OrderingPrec left l right r - { l rel op { @OneRow non succ /0.1f minus } r } - def ">>" precedence @OrderingPrec left l right r - { l rel op { greater greater } r } - def supset precedence @OrderingPrec left l right r - { l rel op { propersuperset } r } - def supseteq precedence @OrderingPrec left l right r - { l rel op { reflexsuperset } r } - def sqsupseteq precedence @OrderingPrec left l right r - { l - rel op { @HContract @VContract - @BackEnd @Case { - PostScript @Yield { - { { "0 0 moveto xsize 0 lineto" - "xsize ysize lineto" - "0 ysize lineto" - "0.04 ft setlinewidth stroke" - } - @Graphic - { 0.5f @Wide 0.25f @High ^/ - 0.25f @High - } - /0.1f minus - } - } - PDF @Yield { - { { "__mul(__loutf, 0.04) w" - "0 0 m __xsize 0 l" - "__xsize __ysize l" - "0 __ysize l s" - } - @Graphic - { 0.5f @Wide 0.25f @High ^/ - 0.25f @High - } - /0.1f minus - } - } - } - } - r } - def ni precedence @OrderingPrec left l right r - { l rel op { 180d @Rotate element } r } - def dashv precedence @OrderingPrec left l right r - { l rel op { vctr {90d @Rotate perpendicular} } r } - def mid precedence @OrderingPrec left l right r - { l rel op { @Base "|" } r } - def parallel precedence @OrderingPrec left l right r - { l rel op { @Base "||" } r } - - def "==" precedence @EqualityPrec left l right r - { l rel op { equivalence } r } - def "~" precedence @EqualityPrec left l right r - { l rel op { similar } r } - def "-~" precedence @EqualityPrec left l right r - { l rel op { @OneRow{similar^/0.07f/0.07f minus} } r } - def asymp precedence @EqualityPrec left l right r - { l - rel op { 0.7f @Font @OneRow - { 90d @Rotate parenleft ^/0.008f - /0.008f 90d @Rotate parenright } } - r } - def "~~" precedence @EqualityPrec left l right r - { l rel op { approxequal } r } - def "=~" precedence @EqualityPrec left l right r - { l rel op { congruent } r } - def bowtie precedence @EqualityPrec left l right r - { l rel op { non triangleright non triangleleft } r } - def propto precedence @EqualityPrec left l right r - { l rel op { proportional } r } - def models precedence @EqualityPrec left l right r - { l rel op { @Base vctr "|" &0.05fo vctr equal } r } - def trieq precedence @EqualityPrec left l right r - { l - rel op { @OneRow @HContract {&0.5rt small triangle^/0.15f equal} } - r } - def doteq precedence @EqualityPrec left l right r - { l - rel op { @OneRow @HContract { &0.5rt dotmath^/0.15f equal } } - r } - def perp precedence @EqualityPrec left l right r - { l rel op { perpendicular } r } - - def notsub precedence @OrderingPrec left l right r - { l rel op { notsubset } r } - def notin precedence @OrderingPrec left l right r - { l rel op { notelement } r } - def "!=" precedence @EqualityPrec left l right r - { l rel op { notequal } r } - - def "<->" left l right r - { l rel op { arrowboth } r } - def "<--" left l right r - { l rel op { arrowleft } r } - def "-->" left l right r - { l rel op { arrowright } r } - def up left l right r - { l rel op { arrowup } r } - def down left l right r - { l rel op { arrowdown } r } - def "<=>" left l right r - { l rel op { arrowdblboth } r } - def "<==" left l right r - { l rel op { arrowdblleft } r } - def "==>" left l right r - { l rel op { arrowdblright } r } - def dblup left l right r - { l rel op { arrowdblup } r } - def dbldown left l right r - { l rel op { arrowdbldown } r } - - def ":" left l right r - { l rel op { colon } r } - def "::" left l right r - { l rel op { @OneCol {colon ` colon} } r } - def ":=" left l right r - { l rel op { colon{ //0.05fo equal } } r } - - def not right x { @HContract {@OneCol x /0co &0.5rt slash}} - - - ################################################################### - # # - # Groups 11 and 12 - openings and closings. # - # # - ################################################################### - - def lpar { parenleft } - def rpar { parenright } - def lbrack { bracketleft } - def rbrack { bracketright } - def lbrace { braceleft } - def rbrace { braceright } - def lfloor { ` "-0.15f" @VShift bracketleftbt } - def rfloor { "-0.15f" @VShift bracketrightbt ` } - def lceil { ` "-0.1f" @VShift bracketlefttp } - def rceil { "-0.1f" @VShift bracketrighttp ` } - def langle { angleleft } - def rangle { angleright } - - def blpar { @OneRow {parenlefttp ^/ parenleftex / parenleftbt } } - def brpar { @OneRow {parenrighttp ^/ parenrightex / parenrightbt } } - def blbrack { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftbt } } - def brbrack { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightbt} } - def blbrace { @OneRow {bracelefttp ^/ braceleftmid / braceleftbt } } - def brbrace { @OneRow {bracerighttp ^/ bracerightmid / bracerightbt } } - def blfloor { @OneRow {bracketleftex ^/ bracketleftex / bracketleftbt } } - def brfloor { @OneRow {bracketrightex ^/ bracketrightex / bracketrightbt} } - def blceil { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftex } } - def brceil { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightex} } - def blangle { @HContract @VContract - @BackEnd @Case { - PostScript @Yield { - { "xsize 0 moveto" - "0 ysize 2 div lineto" - "xsize ysize lineto" - "0.04 ft setlinewidth stroke" - } - @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } - } - PDF @Yield { - { "__mul(__loutf, 0.04) w" - "__xsize 0 m" - "0 __div(__ysize, 2) l" - "__xsize __ysize l S" - } - @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } - } - } - } - def brangle { @HContract @VContract - @BackEnd @Case { - PostScript @Yield { - { "0 0 moveto" - "xsize ysize 2 div lineto" - "0 ysize lineto" - "0.04 ft setlinewidth stroke" - } - @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } - } - PDF @Yield { - { "__mul(__loutf, 0.04) w" - "0 0 m" - "__xsize __div(__ysize, 2) l" - "0 __ysize l S" - } - @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } - } - } - } - - - ################################################################### - # # - # Group 13 - punctuation. # - # # - ################################################################### - - def ";" precedence @PunctuationPrec left l right r - { l punct symbol { semicolon } r } - def "," precedence @PunctuationPrec left l right r - { l punct symbol { comma } r } - def col precedence @PunctuationPrec left l right r - { l punct symbol { colon } r } - - - ################################################################### - # # - # Additional short symbols (Knuth p. 132) # - # # - ################################################################### - - def "!" { exclam } - def "?" { question } - def "%" { percent } - def "(" { parenleft } - def ")" { parenright } - def "[" { bracketleft } - def "]" { bracketright } - - - ################################################################### - # # - # Common mathematical functions (from Knuth p. 162). # - # mod is included, since @Rel mod is easily typed if needed. # - # # - ################################################################### - - def arccos { @Base "arccos" } - def arcsin { @Base "arcsin" } - def arctan { @Base "arctan" } - def arg { @Base "arg" } - def cos { @Base "cos" } - def cosh { @Base "cosh" } - def cot { @Base "cot" } - def coth { @Base "coth" } - def csc { @Base "csc" } - def deg { @Base "deg" } - def det { @Base "det" } - def dim { @Base "dim" } - def exp { @Base "exp" } - def gcd { @Base "gcd" } - def hom { @Base "hom" } - def inf { @Base "inf" } - def ker { @Base "ker" } - def lg { @Base "lg" } - def lim { @Base "lim" } - def liminf { @OneCol { @Base "lim" ` @Base "inf" } } - def limsup { @OneCol { @Base "lim" ` @Base "sup" } } - def ln { @Base "ln" } - def log { @Base "log" } - def max { @Base "max" } - def min { @Base "min" } - def Pr { @Base "Pr" } - def sec { @Base "sec" } - def sin { @Base "sin" } - def sinh { @Base "sinh" } - def supr { @Base "sup" } - def tan { @Base "tan" } - def tanh { @Base "tanh" } - def mod { @Base "mod" } - - - ################################################################### - # # - # Arrow symbols. # + # Ordinary symbols (arrows) # # # ################################################################### @@ -1624,14 +887,277 @@ def @Math def searrow { 0.5w @VShift 0.5w @HShift 315d @Rotate arrowright } def swarrow { 0.5w @VShift 0.5w @HShift 225d @Rotate arrowright } def nwarrow { 0.5w @VShift 0.5w @HShift 135d @Rotate arrowright } + + + ################################################################### + # # + # Ordinary symbols (to get Roman font) # + # # + # These symbols are defined to yield themselves, but in Roman # + # font rather than the Italic that would otherwise be used. # + # See Knuth p. 162 and 132. The definitions of "0" ... "9" # + # should logically appear here, but they have been moved to # + # the end since it is awkward to enter numeric lengths after # + # they are defined. # + # # + ################################################################### + def arccos { @Base "arccos" } + def arcsin { @Base "arcsin" } + def arctan { @Base "arctan" } + def arg { @Base "arg" } + def cos { @Base "cos" } + def cosh { @Base "cosh" } + def cot { @Base "cot" } + def coth { @Base "coth" } + def csc { @Base "csc" } + def deg { @Base "deg" } + def det { @Base "det" } + def dim { @Base "dim" } + def exp { @Base "exp" } + def gcd { @Base "gcd" } + def hom { @Base "hom" } + def inf { @Base "inf" } + def ker { @Base "ker" } + def lg { @Base "lg" } + def lim { @Base "lim" } + def liminf { @OneCol { @Base "lim" ` @Base "inf" } } + def limsup { @OneCol { @Base "lim" ` @Base "sup" } } + def ln { @Base "ln" } + def log { @Base "log" } + def max { @Base "max" } + def min { @Base "min" } + def Pr { @Base "Pr" } + def sec { @Base "sec" } + def sin { @Base "sin" } + def sinh { @Base "sinh" } + def supr { @Base "sup" } + def tan { @Base "tan" } + def tanh { @Base "tanh" } + def mod { @Base "mod" } + def "!" { exclam } + def "?" { question } + def "%" { percent } + def "(" { parenleft } + def ")" { parenright } + def "[" { bracketleft } + def "]" { bracketright } + ################################################################### # # - # Other symbols taken from TeX. # + # Ordinary symbols (for atleft and atright) # + # These are Knuth's Groups 11 and 12 - openings and closings. # # # ################################################################### + def lpar { parenleft } + def rpar { parenright } + def lbrack { bracketleft } + def rbrack { bracketright } + def lbrace { braceleft } + def rbrace { braceright } + def lfloor { ` "-0.15f" @VShift bracketleftbt } + def rfloor { "-0.15f" @VShift bracketrightbt ` } + def lceil { ` "-0.1f" @VShift bracketlefttp } + def rceil { "-0.1f" @VShift bracketrighttp ` } + def langle { angleleft } + def rangle { angleright } + + def blpar { @OneRow {parenlefttp ^/ parenleftex / parenleftbt } } + def brpar { @OneRow {parenrighttp ^/ parenrightex / parenrightbt } } + def blbrack { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftbt } } + def brbrack { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightbt} } + def blbrace { @OneRow {bracelefttp ^/ braceleftmid / braceleftbt } } + def brbrace { @OneRow {bracerighttp ^/ bracerightmid / bracerightbt } } + def blfloor { @OneRow {bracketleftex ^/ bracketleftex / bracketleftbt } } + def brfloor { @OneRow {bracketrightex ^/ bracketrightex / bracketrightbt} } + def blceil { @OneRow {bracketlefttp ^/ bracketleftex / bracketleftex } } + def brceil { @OneRow {bracketrighttp ^/ bracketrightex / bracketrightex} } + + def blangle + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "xsize 0 moveto 0 ysize 2 div lineto" + "xsize ysize lineto 0.04 ft setlinewidth stroke" + } @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w __xsize 0 m" + "0 __div(__ysize, 2) l __xsize __ysize l S" + } @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + } + } + + def brangle + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto xsize ysize 2 div lineto" + "0 ysize lineto 0.04 ft setlinewidth stroke" + } @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w 0 0 m" + "__xsize __div(__ysize, 2) l 0 __ysize l S" + } @Graphic { 0.5f @Wide 2f @High ^/ 2f @High } + } + } + } + + + ################################################################### + # # + # Ordinary symbols (miscellaneous) # + # # + # Not all of Knuth's symbols are available. The four suits # + # (heartsuit, etc.), have definitions above. # + # # + ################################################################### + + def hbar { @HContract @VContract {&0.1f @Base "-" ^/0.30fo h }} + def Re { Rfraktur } + def Im { Ifraktur } + def partial { partialdiff } + def infty { infinity } + def prime { minute } + #def emptyset { defined above } + def nabla { gradient } + def surd { radical } + def top { 180d @Rotate perpendicular } + def bot { perpendicular } + def dbar { @Base "||" } + #def angle { defined above } + def backslash { "\\" } + def forall { universal } + def exists { existential } + def neg { logicalnot } + + def circle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "xsize ysize 2 div moveto" + "xsize 2 div ysize 2 div xsize 2 div 0 360 arc" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + # + # VT: draws a counterclockwise 360 degree arc from 0 to +360 + # degree positions (straight right to straight right) with + # centre = (xsize/2, ysize/2) and radius = xsize/2, + # implemented as two counterclockwise 180 degree arcs. + # start at (xsize, ysize/2); the control points are: + # + # pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) + # pt2 = (0, ysize/2 + (4/3 * xsize/2)) + # + # end at (0, ysize/2). Then start at (0, ysize/2); control points + # + # pt1 = (0, ysize/2 - (4/3 * xsize/2)) + # pt2 = (xsize, ysize/2 - (4/3 * xsize/2)) + # + # and end at (xsize, ysize/2). + + { + "__mul(0.04, __loutf) w" + "__xsize __div(__ysize, 2) m" + "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __div(__ysize, 2) c" + "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __div(__ysize, 2) c S" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def filledcircle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "xsize ysize 2 div moveto" + "xsize 2 div ysize 2 div xsize 2 div 0 360 arc" + "0.04 ft setlinewidth fill" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + # + # JK: I don't know how to fill in PDF, so this doesn't! + # + # VT: draws a counterclockwise 360 degree arc from 0 to +360 + # degree positions (straight right to straight right) with + # centre = (xsize/2, ysize/2) and radius = xsize/2, + # implemented as two counterclockwise 180 degree arcs. + # start at (xsize, ysize/2); the control points are: + # + # pt1 = (xsize, ysize/2 + (4/3 * xsize/2)) + # pt2 = (0, ysize/2 + (4/3 * xsize/2)) + # + # end at (0, ysize/2). Then start at (0, ysize/2); control points + # + # pt1 = (0, ysize/2 - (4/3 * xsize/2)) + # pt2 = (xsize, ysize/2 - (4/3 * xsize/2)) + # + # and end at (xsize, ysize/2). + + { + "__mul(0.04, __loutf) w" + "__xsize __div(__ysize, 2) m" + "__xsize __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __add(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "0 __div(__ysize, 2) c" + "0 __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __sub(__div(__ysize, 2), __div(__mul(2, __xsize), 3))" + "__xsize __div(__ysize, 2) c S" + } @Graphic { 0.7f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def square + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto closepath" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High } + } + PDF @Yield { + { + "__mul(__loutf, 0.04) w" + "0 0 m __xsize 0 l __xsize __ysize l" + "0 __ysize l s" + } @Graphic { 0.6f @Wide 0.3f @High ^/ 0.3f @High } + } + } + } + + def triangle + { @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { + "0 0 moveto xsize 0 lineto" + "xsize 2 div ysize lineto closepath" + "0.04 ft setlinewidth stroke" + } @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + PDF @Yield { + { + "__mul(__loutf, 0.04) w" + "0 0 m __xsize 0 l" + "__div(__xsize, 2) __ysize l s" + } @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + } + } + + # other symbols taken from TeX def ldots { . &0.3f . &0.3f . } def cdots { dotmath &0.3f dotmath &0.3f dotmath } def vdots { @OneRow { dotmath ^/0.3f dotmath /0.3f dotmath } } @@ -1642,13 +1168,7 @@ def @Math } } - - ################################################################### - # # - # Symbols taken from eqn (Kernighan and Cherry 1975). # - # # - ################################################################### - + # symbols taken from eqn (Kernighan and Cherry 1975). # def del { gradient } def grad { gradient } def "..." { ellipsis } @@ -1659,38 +1179,89 @@ def @Math def "''''" { minute minute minute minute } def empty { emptyset } - - - ################################################################### - # # - # Miscellaneous # - # # - ################################################################### - + # forget where these are from def triangleup { 0.8f @Font triangle } def triangledown { 180d @Rotate 0.8f @Font triangle } + # half and third defined later, since they use frac + + ################################################################### # # - # Symbols with parameters. # + # Variable-building symbols # # # # These symbols are essentially those of eqn, with some # # changes and additions. # # # ################################################################### - def @OrDefault - left l - right r + def dot + precedence @HatPrec + left x + named gap { @AboveGap } { - l @Case { - "dft" @Yield r - else @Yield l - } + x below gap { gap } skew { @SkewGap } @SuperScriptStyle . + } + + def dotdot + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle .. + } + + def hat + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle @Base "^" + } + + def tilde + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle @Base "~" + } + + def vec + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle arrowright + } + + def dyad + precedence @HatPrec + left x + named gap { @AboveGap } + { + x below gap { gap } skew { @SkewGap } @SuperScriptStyle arrowboth + } + + def overbar + precedence @HatPrec + left x + named gap { @AboveGap } + { + { @WithStyle style { @CurrStyle } cramped { "Yes" } x } + widebelow gap { gap } @SuperScriptStyle minus + } + + def underbar + precedence @HatPrec + left x + named gap { @BelowGap } + { + x wideabove gap { gap } @SuperScriptStyle minus } def sup - precedence @FactorialPrec + precedence @SupPrec associativity left left x named gap { "dft" } @@ -1703,7 +1274,7 @@ def @Math } def sub - precedence 72 + precedence @SubPrec associativity left left x named gap { @SubScriptGap } @@ -1717,7 +1288,7 @@ def @Math } def tsub - precedence 72 + precedence @SubPrec associativity left left x named gap { @SubScriptGap } @@ -1731,7 +1302,7 @@ def @Math } def supp - precedence @FactorialPrec + precedence @SupPrec associativity left left x named gap { "dft" } @@ -1746,7 +1317,7 @@ def @Math } def on - precedence 74 + precedence @SubPrec associativity left left x right y @@ -1756,7 +1327,7 @@ def @Math } def ton - precedence 74 + precedence @SubPrec associativity left left x right y @@ -1764,133 +1335,299 @@ def @Math @SuperScriptStyle x ^/ / &0io 0.3f @HShift @SubScriptStyle y } + - def frac - precedence @DivisionPrec - associativity left - left x - named gap { 0.2f } - right y + ################################################################### + # # + # Large operator symbols (Knuth's Group 6 "Large" operators) # + # # + # Layout of large operators differs in several ways, depending # + # on whether they are in display mode or not. # + # # + # 1. The operator itself is larger in display mode. We # + # achieve this by automatically prepending `big' to the # + # operator's symbol when in display mode. # + # # + # 2. The "bounds" of these operators (i.e., `from' and `to') # + # are set as limits (i.e., above and below the operator # + # symbol) when in display mode, and displayed to the # + # right of the symbol otherwise. Integrations are an # + # exception (the only exception?). # + # # + # See ``The TeXbook'', Chapter 17. # + # # + ################################################################### + + def largeop + named symbol { "largeop" } + named limits { "dft" } # whether to set `from' and `to' as limits + named from { "" } + named to { "" } { - @HContract @VContract - { 1w @VShift { @SuperScriptStyle { x } /gap } - | fraction &0io - | 0w @VShift { |gap @SubScriptStyle { y } } + def @Symbol + { + @CurrStyle @Case { + "display" @Yield { big symbol } + else @Yield symbol + } + } + + def @Limits + { + limits @OrDefault { + @CurrStyle @Case { + "display" @Yield "Yes" + else @Yield "No" } + } } + + def @LimitsBody + { + @Symbol above { @SuperScriptStyle from } + below { @SubScriptStyle to } + } + + def @NoLimitsBody + { + 0.5w @VShift { + 1.0w @VShift @OneRow { + { | 0.3w @VShift @SuperScriptStyle to } + ^/0.0fo { 0w @VShift @Symbol | } + } + + /0.0fo + + { | 0.7w @VShift @SubScriptStyle from } + } + |{ @CurrPunctSpaceGap } + } + + @Limits @Case { + { "Yes" "yes" } @Yield @LimitsBody + { "No" "no" } @Yield @NoLimitsBody + } } - def half { 1 frac 2 } - def third { 1 frac 3 } + # Ludovic's symbol, no longer used + def largeoperator + named symbol { "largeop" } + named from { "" } + named to { "" } + named limits { "Yes" } # whether to set `from' and `to' as limits + { + def @NoLimitsBody { + 0.5w @VShift { + 1.0w @VShift @OneRow { + { | 0.3w @VShift @SuperScriptStyle to } + ^/0.0fo { 0w @VShift symbol | } + } - def over - precedence @DivisionPrec - associativity left - left x - named gap { "dft" } - named belowgap { "dft" } - right y - { - def @AboveLineGap - { - gap @Case { - "dft" @Yield { - @CurrStyle @Case { - "display" @Yield 0.20f - else @Yield 0.10f - } - } - else @Yield gap - } + /0.0fo + + { | 0.7w @VShift @SubScriptStyle from } + } + |{ @CurrPunctSpaceGap } } - def @BelowLineGap - { - belowgap @Case { - "dft" @Yield { - @CurrStyle @Case { - "display" @Yield 0.15f - else @Yield 0.09f - } - } - else @Yield belowgap - } + def @LimitsBody { + symbol above { @SuperScriptStyle from } + below { @SubScriptStyle to } } - @HContract @VContract - { |0.5rt @OneCol @NumeratorStyle x - ^//@AboveLineGap @HLine - //@BelowLineGap |0.5rt @OneCol @DenominatorStyle @Strut y - } + limits @Case { + { "Yes" "yes" } @Yield @LimitsBody + { "No" "no" } @Yield @NoLimitsBody + } } + # Ludovic's symbol, no longer used + def simplelargeoperator + named symbol { "simplelargeop" } + named limits { "dft" } + named from { } + named to { } + { + largeoperator + symbol { @CurrStyle @Case { + "display" @Yield { big symbol } + else @Yield symbol } + } + limits { limits @OrDefault { + @CurrStyle @Case { + "display" @Yield "Yes" + else @Yield "No" } + } + } + from { from } + to { to } + } - def dot - precedence @FactorialPrec - left x - named gap { @AboveGap } + def sum + named limits { "dft" } + named from {} + named to {} { - x below gap { gap } skew { @SkewGap } . + largeop + symbol { summation } limits { limits } from { from } to { to } } - def dotdot - precedence @FactorialPrec - left x - named gap { @AboveGap } + def prod + named limits { "dft" } + named from {} + named to {} { - x below gap { gap } skew { @SkewGap } .. + largeop + symbol { product } limits { limits } from { from } to { to } } - def hat - precedence @FactorialPrec - left x - named gap { @AboveGap } + def coprod + named limits { "dft" } + named from {} + named to {} { - x below gap { gap } skew { @SkewGap } @Base "^" + largeop + symbol { 180d @Rotate vctr product } + limits { limits } from { from } to { to } } - def tilde - precedence @FactorialPrec - left x - named gap { @AboveGap } + def bcap + named limits { "dft" } + named from {} + named to {} { - x below gap { gap } skew { @SkewGap } @Base "~" + largeop + symbol { big intersection } limits { limits } from { from } to { to } } - def vec - precedence @FactorialPrec - left x - named gap { @AboveGap } + def bcup + named limits { "dft" } + named from {} + named to {} { - x below gap { gap } skew { @SkewGap } arrowright + largeop + symbol { big union } limits { limits } from { from } to { to } } - def dyad - precedence @FactorialPrec - left x - named gap { @AboveGap } + def bvee + named limits { "dft" } + named from {} + named to {} { - x below gap { gap } skew { @SkewGap } arrowboth + largeop + symbol { big logicalor } limits { limits } from { from } to { to } } - def overbar - precedence @FactorialPrec - left x - named gap { @AboveGap } + def bwedge + named limits { "dft" } + named from {} + named to {} { - { @WithStyle style { @CurrStyle } cramped { "Yes" } x } - widebelow gap { gap } minus + largeop + symbol { big logicaland } limits { limits } from { from } to { to } } - def underbar - precedence @FactorialPrec - left x - named gap { @BelowGap } + def circledot + { + def @PureDot # dot with no extra space + { + @HContract { &0io 0.4w @HShift dotmath } + } + + @OneRow @HContract { circle /0io &0.5rt @PureDot /0io circle } + } + + + def bodot + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { circledot } + limits { limits } from { from } to { to } + } + + def botimes + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { circlemultiply } limits { limits } from { from } to { to } + } + + def boplus + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { circleplus } limits { limits } from { from } to { to } + } + + def buplus + named limits { "dft" } + named from {} + named to {} + { + largeop + symbol { & big @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union } } + limits { limits } from { from } to { to } + } + + + ################################################################### + # # + # Integrations are slightly different in that, according to # + # Knuth (Chapter 17, p. 144), ``superscripts and subscripts # + # are not set as limits, even in display style''. Still, as # + # in TeX, we give users the possibility to override this. # + # # + ################################################################### + + # Ludovic's symbol, no longer used + def integration + named symbol { "integration" } + named limits { "No" } + named from { } + named to { } + { + largeoperator + symbol { @CurrStyle @Case { + "display" @Yield { big symbol } + else @Yield symbol } + } + limits { limits } from { from } to { to } + } + + def int + named limits { "No" } + named from { } + named to { } { - x wideatop gap { gap } minus + largeop + symbol { vctr big integral } limits { limits } from { from } to { to } } + def oint + named limits { "No" } + named from { } + named to { } + { + largeop + symbol { @OneCol { vctr degree |0.015fo big integral } } + limits { limits } from { from } to { to } + } + + + ################################################################### + # # + # Unary operator symbols # + # # + ################################################################### + def sqrt - precedence @ExponentPrec + precedence @UnaryOpPrec named gap { @AboveGap } right x { @@ -1927,7 +1664,8 @@ def @Math } def root - precedence @ExponentPrec + precedence @UnaryOpPrec + associativity left left x right y { @@ -1935,7 +1673,8 @@ def @Math } def zroot - precedence @ExponentPrec + precedence @UnaryOpPrec + associativity left left x right y { @@ -1946,7 +1685,7 @@ def @Math export row axisrow col lcol ccol rcol mcol def matrix - precedence 100 + precedence @UnaryOpPrec named gap { @CurrBinarySpaceGap } named strut named no { } @@ -1969,7 +1708,7 @@ def @Math } def newrow - precedence 50 + precedence @HelperRowPrec associativity left left x right y @@ -1983,7 +1722,7 @@ def @Math macro row { newrow "" } def newaxisrow - precedence 50 + precedence @HelperRowPrec associativity left left x right y @@ -1997,7 +1736,7 @@ def @Math macro axisrow { newaxisrow "" } def col - precedence 52 + precedence @HelperColPrec associativity left left x named indent { 0.5rt } @@ -2010,7 +1749,7 @@ def @Math } def lcol - precedence 52 + precedence @HelperColPrec associativity left left x right y @@ -2019,7 +1758,7 @@ def @Math } def ccol - precedence 52 + precedence @HelperColPrec associativity left left x right y @@ -2028,7 +1767,7 @@ def @Math } def rcol - precedence 52 + precedence @HelperColPrec associativity left left x right y @@ -2037,7 +1776,7 @@ def @Math } def mcol - precedence 52 + precedence @HelperColPrec associativity left left x right y @@ -2073,17 +1812,1080 @@ def @Math } } - macro pmatrix { matrix atleft { "1.5f" @Font ( } atright { "1.5f" @Font ) }} + macro pmatrix { matrix atleft {1.5f @Font (} atright {1.5f @Font )} } macro bmatrix { matrix atleft { blbrack } atright { brbrack } } macro brmatrix { matrix atleft { blbrace } atright { brbrace } } macro fmatrix { matrix atleft { blfloor } atright { brfloor } } macro cmatrix { matrix atleft { blceil } atright { brceil } } macro amatrix { matrix atleft { blangle } atright { brangle } } + + + ################################################################### + # # + # Binary operator symbols # + # # + ################################################################### + + ################################################################### + # # + # over and frac (also half and third) # + # # + ################################################################### + + def over + precedence @BinaryOpDividePrec + associativity left + left x + named gap { "dft" } + named belowgap { "dft" } + right y + { + def @AboveLineGap + { + gap @Case { + "dft" @Yield { + @CurrStyle @Case { + "display" @Yield 0.20f + else @Yield 0.10f + } + } + else @Yield gap + } + } + + def @BelowLineGap + { + belowgap @Case { + "dft" @Yield { + @CurrStyle @Case { + "display" @Yield 0.15f + else @Yield 0.09f + } + } + else @Yield belowgap + } + } + + @HContract @VContract + { |0.5rt @OneCol @NumeratorStyle x + ^//@AboveLineGap @HLine + //@BelowLineGap |0.5rt @OneCol @DenominatorStyle @Strut y + } + } + + def frac + precedence @BinaryOpDividePrec + associativity left + left x + named gap { 0.2f } + right y + { + @HContract @VContract + { 1w @VShift { @SuperScriptStyle { x } /gap } + | fraction &0io + | 0w @VShift { |gap @SubScriptStyle { y } } + } + } + + def half { one frac two } + def third { one frac three } + + + ################################################################### + # # + # Knuth's Group 7 (binary operations) # + # # + # All of Knuth's symbols are available except \star, \diamond # + # and \bullet; a few have been given more mnemonic names. # + # # + ################################################################### + + def bin + precedence @BinaryOpPrec + associativity left + left l + named op { "binop" } + right r + { + l &@CurrBinarySpaceGap op &@CurrBinarySpaceGap r + } + + def "+" + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { plus } r + } + + def "-" + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { minus } r + } + + def "+-" + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { plusminus } r + } + + def "-+" + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 180d @Rotate plusminus } r + } + + def setminus + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { backslash } r + } + + def cdot + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { dotmath } r + } + + def times + precedence @BinaryOpTimesPrec + associativity left + left l + right r + { + l bin op { multiply } r + } + + def "*" + precedence @BinaryOpTimesPrec + associativity left + left l + right r + { + l bin op { asteriskmath } r + } + + #def diamond { name used above } + + def circ + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { circle } r + } + + #def bullet { name used above } + + def div + precedence @BinaryOpDividePrec + associativity left + left l + right r + { + l bin op { divide } r + } + + def cap + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { intersection } r + } + + def cup + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { union } r + } + + def uplus + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op {@OneRow @HContract { &0.5rt 0.7f @Font plus ^/0.2fo union}} r + } + + def sqcapshape + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto 0 ysize lineto xsize ysize lineto" + "xsize 0 lineto 0.04 ft setlinewidth stroke" + } + @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + PDF @Yield { + { "__mul(__loutf, 0.04) w" + "0 0 m 0 __ysize l __xsize __ysize l __xsize 0 l s" + } + @Graphic { 0.3f @Wide 0.3f @High ^| ^/ 0.3f @Wide 0.3f @High } + } + } + } + + def sqcap + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { sqcapshape } r + } + + def sqcup + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { "180d" @Rotate sqcapshape } r + } + + def triangleleft + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { "90d" @Rotate 0.8f @Font triangle } r + } + + def triangleright + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { "-90d" @Rotate 0.8f @Font triangle } r + } + + def wr + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { vctr {90d @Rotate similar } } r + } + + def bigcirc + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 1.2f @Font circle} r + } + + def bigtriangleup + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 1.2f @Font triangle } r + } + + def bigtriangledown + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 180d @Rotate 1.2f @Font triangle } r + } + + def vee + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { logicalor } r + } + + def wedge + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { logicaland } r + } + + def oplus + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { circleplus } r + } + + def ominus + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { @OneRow @HContract { circle /0io &0.5rt minus } } r + } + + def otimes + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { circlemultiply } r + } + + def oslash + precedence @BinaryOpPrec + associativity left + left l + right r + { + #l bin op { `vctr 60d @Rotate @HContract {circle /0io &0.5rt minus`} } r + l bin op {@OneRow @HContract {circle /0io &0.5rt "-0.1f" @VShift slash}} r + } + + def odot + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { circledot } r + } + + def dagger + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { @Base @Char "dagger" } r + } + + def daggerdbl + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { @Base @Char "daggerdbl" } r + } + + def amalg + precedence @BinaryOpPrec + associativity left + left l + right r + { + l bin op { 180d @Rotate vctr product } r + } + + + ################################################################### + # # + # Group 8 (relations) # + # # + # All Knuth's operators are available, but many have been # + # given different, more mnemonic names. Also included is # + # a not operator for negating the relations. # + # # + ################################################################### + + # "not" done by an option now + # def not right x { @HContract {@OneCol x /0co &0.5rt slash}} + + def rel + precedence @RelationPrec + associativity left + left l + named op { "relop" } + named neg { "no" } + right r + { + + def @Op + { + neg @Case { + { "No" "no" } @Yield op + { "Yes" "yes" } @Yield + { @HContract {@OneCol { & op } /0co &0.5rt slash} } + } + } + + l &@CurrRelSpaceGap @Op &@CurrRelSpaceGap r + } + + def "<" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { less } r + } + + def ">" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { greater } r + } + + def "=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { equal } r + } + + def "<=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { lessequal } r + } + + def precsym + { + 0i @HShift 0.45f @Font "-90d" @Rotate {parenrighttp ^| parenlefttp} + } + + def prec + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { precsym } r + } + + def preceq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @VContract { precsym /0.1f minus } } r + } + + def "<<" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { less less } r + } + + def subset + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { propersubset } r + } + + def subseteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { reflexsubset } r + } + + def sqsubsetshape + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "xsize 0 moveto 0 0 lineto 0 ysize lineto" + "xsize ysize lineto 0.04 ft setlinewidth stroke" + } + @Graphic { 0.5f @Wide 0.25f @High ^/ 0.25f @High } + /0.1f minus + } + PDF @Yield { + { "__mul(__loutf, 0.04) w __xsize 0 m 0 0 l" + "0 __ysize l __xsize __ysize l s" + } + @Graphic { 0.5f @Wide 0.25f @High ^/ 0.25f @High } + /0.1f minus + } + } + } + + def sqsubseteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { sqsubsetshape } r + } + + def in + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { element } r + } + + def vdash + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { vctr {"-90d" @Rotate perpendicular} } r + } + + def smile + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { vctr 90d @Rotate parenleft } r + } + + def frown + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { vctr 90d @Rotate parenright } r + } + + def ">=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { greaterequal } r + } + + def succsym + { + 0.45f @Font 90d @Rotate { parenrighttp ^| parenlefttp } + } + + def succ + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { succsym } r + } + + def succeq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @OneRow non succ /0.1f minus } r + } + + def ">>" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { greater greater } r + } + + def supset + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { propersuperset } r + } + + def supseteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { reflexsuperset } r + } + + def sqsupseteqshape + { + @HContract @VContract @BackEnd @Case { + PostScript @Yield { + { "0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto 0.04 ft setlinewidth stroke" + } @Graphic { 0.5f @Wide 0.25f @High ^/ 0.25f @High } + /0.1f minus + } + PDF @Yield { + { "__mul(__loutf, 0.04) w 0 0 m __xsize 0 l" + "__xsize __ysize l 0 __ysize l s" + } @Graphic { 0.5f @Wide 0.25f @High ^/ 0.25f @High } + /0.1f minus + } + } + } + + def sqsupseteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { sqsupseteqshape } r + } + + def ni + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { 180d @Rotate element } r + } + + def dashv + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { vctr {90d @Rotate perpendicular} } r + } + + def mid + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @Base "|" } r + } + + def parallel + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @Base "||" } r + } + + def "==" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { equivalence } r + } + + def "~" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { similar } r + } + + def "-~" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @OneRow { similar ^/0.07f /0.07f minus } } r + } + + def asymp + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { l + rel neg { neg } op { 0.7f @Font @OneRow + { 90d @Rotate parenleft ^/0.008f + /0.008f 90d @Rotate parenright } } + r + } + + def "~~" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { approxequal } r + } + + def "=~" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { congruent } r + } + + def bowtie + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { non triangleright non triangleleft } r + } + + def propto + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { proportional } r + } + + def models + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @Base vctr "|" &0.05fo vctr equal } r + } + + def trieqsym + { + @OneRow @HContract {&0.5rt small triangle^/0.15f equal} + } + + def trieq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { trieqsym } r + } + + def doteqsym + { + @OneRow @HContract { &0.5rt dotmath^/0.15f equal } + } + + def doteq + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { doteqsym } r + } + + def perp + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { perpendicular } r + } + + def notsub + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { notsubset } r + } + + def notin + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { notelement } r + } + + def "!=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { notequal } r + } + + def "<->" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowboth } r + } + + def "<--" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowleft } r + } + + def "-->" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowright } r + } + + def up + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowup } r + } + + def down + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdown } r + } + + def "<=>" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdblboth } r + } + + def "<==" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdblleft } r + } + + def "==>" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdblright } r + } + + def dblup + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdblup } r + } + + def dbldown + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { arrowdbldown } r + } + + def ":" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { colon } r + } + + def "::" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { @OneCol {colon ` colon} } r + } + + def ":=" + precedence @RelationPrec + associativity left + left l + named neg { "no" } + right r + { + l rel neg { neg } op { colon{ //0.05fo equal } } r + } ################################################################### # # - # Group 5 (digits) # + # Punctuation symbols (Knuth's Group 13) # + # # + ################################################################### + + def punct + precedence @PunctuationPrec + associativity left + left l + named symbol { "punct" } + right r + { + l &0.0ce symbol &@CurrPunctSpaceGap r + } + + def ";" + precedence @PunctuationPrec + associativity left + left l + right r + { + l punct symbol { semicolon } r + } + + def "," + precedence @PunctuationPrec + associativity left + left l + right r + { + l punct symbol { comma } r + } + + def col + precedence @PunctuationPrec + associativity left + left l + right r + { + l punct symbol { colon } r + } + + + ################################################################### + # # + # Ordinary symbols (to get Roman font) - continued # # # ################################################################### @@ -2099,6 +2901,11 @@ def @Math def "9" { nine } + ################################################################### + # # + # The result object # + # # + ################################################################### basefont @Font { Slope xheight2mark nostrut } @Font { initialspace } @Space @@ -2110,5 +2917,11 @@ def @Math @End @Math -# In-line equations. + +############################################################################### +# # +# In-line equations # +# # +############################################################################### + macro @M { @HContract @VContract @Math initialstyle { "text" } } diff --git a/include/npf b/include/npf index 7c04721..a2599f2 100644 --- a/include/npf +++ b/include/npf @@ -428,8 +428,9 @@ def @NonpareilSetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @Nonpareil diff --git a/include/perlf b/include/perlf index 28b699a..4c2cfc7 100644 --- a/include/perlf +++ b/include/perlf @@ -420,8 +420,9 @@ def @PerlSetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @Perl diff --git a/include/picture b/include/picture index 006dece..533e6e3 100644 --- a/include/picture +++ b/include/picture @@ -44,6 +44,7 @@ # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour + # @InitialBackgroundColour { white } # initial background colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading # @FixedWidthFont { Courier Base -1p } # font for @F @@ -290,6 +291,7 @@ # @IntroPageNumbers { Roman } # intro page numbers # @IntroFirstPageNumber{ 1 } # number of first intro page # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers # @OddTop { @Centre{- @PageNum -} } # Simple page headers # @OddFoot { @Null } diff --git a/include/pythonf b/include/pythonf index c05e4f4..6a93e4a 100644 --- a/include/pythonf +++ b/include/pythonf @@ -424,8 +424,9 @@ def @PythonSetup def "''" { "''" } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @Python diff --git a/include/report b/include/report index a0b82c0..2a66c8e 100644 --- a/include/report +++ b/include/report @@ -48,6 +48,7 @@ # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour + # @InitialBackgroundColour { white } # initial background colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading # @FixedWidthFont { Courier Base -1p } # font for @F @@ -294,6 +295,7 @@ # @IntroPageNumbers { Roman } # intro page numbers # @IntroFirstPageNumber{ 1 } # number of first intro page # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers # @OddTop { @Centre{- @PageNum -} } # Simple page headers # @OddFoot { @Null } diff --git a/include/rslf b/include/rslf index a708e3b..a0f45e8 100644 --- a/include/rslf +++ b/include/rslf @@ -478,8 +478,9 @@ def @RSLSetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @RSL diff --git a/include/rubyf b/include/rubyf index 1d30c54..6acd7c5 100644 --- a/include/rubyf +++ b/include/rubyf @@ -423,8 +423,9 @@ def @RubySetup macro "$>" { {} & } + Programming @Language { @InitFontFamily Base @InitSize } @Font @InitSpace @Space - { @InitLine lines nohyphen "blanklinescale" @InitBLS } @Break @Body + { @InitLine lines "blanklinescale" @InitBLS } @Break @Body @End @Ruby diff --git a/include/save_bsf b/include/save_bsf deleted file mode 100644 index 40e15f7..0000000 --- a/include/save_bsf +++ /dev/null @@ -1,1826 +0,0 @@ - -############################################################################### -# # -# Lout @BasicSetup package # -# # -# Jeffrey H. Kingston # -# # -# This package contains basic symbols used widely throughout many # -# documents, for font changes, particular characters, standard words in # -# the current language, date and time, paragraphs, lists, colours, # -# rules, and boxes. # -# # -############################################################################### - -@SysInclude { lengths } # @PSLengths -@SysInclude { coltex } # @ColourCommand and @TextureCommand -@SysPrependGraphic { bsf.lpg } # rules, boxes, margin note setup - - -############################################################################### -# # -# The following symbols are defined outside @BasicSetup so that # -# they can be invoked when setting its parameters in the @Use clause. # -# # -############################################################################### - -def @OrIfPlain - precedence 80 - left x - right y -{ - @BackEnd @Case { - PlainText @Yield y - else @Yield x - } -} - -########################################################################### -# # -# @Colour, @Color # -# # -########################################################################### - -def @Colour @Color left col right y { {@ColourCommand col} @SetColour y } - - -########################################################################### -# # -# @ColouredUnderline, @ColoredUnderline # -# # -########################################################################### - -def @ColouredUnderline @ColoredUnderline left col right y { - {@ColourCommand col} @SetUnderlineColour @Underline y -} - - -########################################################################### -# # -# @Texture # -# # -########################################################################### - - -def @Texture - left type - named scale { 1 } - named hscale { 1 } - named vscale { 1 } - import @PSLengths named angle { 0d } - import @PSLengths named hshift { 0i } - import @PSLengths named vshift { 0i } - import @PSLengths named width { "dft" } - import @PSLengths named height { "dft" } - import @PSLengths named gap { "dft" } - import @PSLengths named radius { "dft" } - import @PSLengths named linewidth { "dft" } - named font { "dft" } - import @PSLengths named size { "dft" } - named value { "dft" } - right x -{ - { type @TextureCommand - scale { scale } - hscale { hscale } - vscale { vscale } - angle { angle } - hshift { hshift } - vshift { vshift } - width { width } - height { height } - gap { gap } - radius { radius } - linewidth { linewidth } - font { font } - size { size } - value { value } - } @SetTexture x -} - - -############################################################################### -# # -# Symbols exported by @BasicSetup. # -# # -############################################################################### - -export - - @InitialFont @InitialBreak @InitialOutdent @InitialSpace @InitialLanguage - @InitialColour @OptimizePages @HeadingFont - @ParaGap @ParaIndent @DisplayGap @DisplayIndent @DefaultIndent - @DisplayNumStyle @WideIndent @VeryWideIndent - @ListGap @ListIndent @ListRightIndent - @ListLabelWidth @ListLabelRight @ListLabelRightGap @ListFont @ListBreak - @NumberSeparator - - @Pipe @PipeVerbatim @PipeRawVerbatim - - @Word @Roman @UCRoman @Alpha @UCAlpha @FnBullets @FnSymbols - @Months @ShortMonths @WeekDays @ShortWeekDays - @TwelveHours @ShortHours @MeriDiems @ShortMeriDiems - - @Sym @Ding @R @I @B @BI @S @F @II - "~" "~~" "``" "''" ",," "--" "---" "..." - - @Bullet @ParSym @SectSym @Dagger @DaggerDbl @CDot @Sterling @Yen @Florin - @Star @Degree @Minute @Second @Multiply @Divide @Lozenge @Register - @CopyRight @TradeMark @Euro - - @Date @Time @DateTimeFormat @DropCapTwo @DropCapThree @Centre @Right - @NoDotSep @NoDotJoin @Join @Sep @DotSep @ColonSep @DotJoin @DashJoin - @NumSep @VStrut @ZeroWidth @ZeroHeight @OverStrike @Sup @Sub @HClip @VClip - @FullWidthRule @LocalWidthRule @Box @CurveBox @ShadowBox @BoundaryMarks - @NumberMarker @NumberOf @TitleMarker @TitleOf - @PageMarker @PageMark @NoLinkPageMark @PageOf @CrossLink @ExternalLink - - @BeginDisplayCounter - - @Heading "^" "&-" @If @Not @And @Or @True - @PP @LP @LLP @DP @LOP @NP @CNP - - @BeginAlignedDisplays - @EndAlignedDisplays - - @Display - @LeftDisplay - @IndentedDisplay - @QuotedDisplay - @CentredDisplay - @RightDisplay - @AlignedDisplay - @LeftAlignedDisplay - @IndentedAlignedDisplay - @QuotedAlignedDisplay - @CentredAlignedDisplay - @RightAlignedDisplay - @NumberedDisplay - @LeftNumberedDisplay - @IndentedNumberedDisplay - @QuotedNumberedDisplay - @CentredNumberedDisplay - @RightNumberedDisplay - @AlignedNumberedDisplay - @LeftAlignedNumberedDisplay - @IndentedAlignedNumberedDisplay - @QuotedAlignedNumberedDisplay - @CentredAlignedNumberedDisplay - @RightAlignedNumberedDisplay - - @RawDisplay - @RawLeftDisplay - @RawIndentedDisplay - @RawQuotedDisplay - @RawCentredDisplay - @RawRightDisplay - @RawAlignedDisplay - @RawLeftAlignedDisplay - @RawIndentedAlignedDisplay - @RawQuotedAlignedDisplay - @RawCentredAlignedDisplay - @RawRightAlignedDisplay - @RawNumberedDisplay - @RawLeftNumberedDisplay - @RawIndentedNumberedDisplay - @RawQuotedNumberedDisplay - @RawCentredNumberedDisplay - @RawRightNumberedDisplay - @RawAlignedNumberedDisplay - @RawLeftAlignedNumberedDisplay - @RawIndentedAlignedNumberedDisplay - @RawQuotedAlignedNumberedDisplay - @RawCentredAlignedNumberedDisplay - @RawRightAlignedNumberedDisplay - - @ListItem - @ParagraphItem - @ListInterruptItem - @ListNewPage - @DropListItem - @TagItem - @DropTagItem - - @EndList - @RawEndList - - @RawList - @RawLeftList - @RawIndentedList - @RawQuotedList - @RawCentredList @RawCenteredList - @RawNumberedList - @RawParenNumberedList - @RawRomanList - @RawParenRomanList - @RawUCRomanList - @RawParenUCRomanList - @RawAlphaList - @RawParenAlphaList - @RawUCAlphaList - @RawParenUCAlphaList - @RawBulletList - @RawStarList - @RawDashList - @RawTaggedList - @RawWideTaggedList - @RawVeryWideTaggedList - - @List - @LeftList - @IndentedList - @QuotedList - @CentredList @CenteredList - @NumberedList - @ParenNumberedList - @RomanList - @ParenRomanList - @UCRomanList - @ParenUCRomanList - @AlphaList - @ParenAlphaList - @UCAlphaList - @ParenUCAlphaList - @BulletList - @StarList - @DashList - @TaggedList - @WideTaggedList - @VeryWideTaggedList - - -############################################################################### -# # -# The @BasicSetup package. # -# # -############################################################################### - -def @BasicSetup - named @InitialFont { Times Base 12p } # initial font - named @InitialBreak { {adjust 1.20fx hyphen} @OrIfPlain - {ragged 1fx nohyphen} } # initial break - named @InitialOutdent { 2f @OrIfPlain 4s } # initial outdent - named @InitialSpace { lout } # initial space style - named @InitialLanguage{ English } # initial language - named @InitialColour { black } # initial colour - named @OptimizePages { No } # optimize page breaks? - named @HeadingFont { Bold } # font for @Heading - named @FixedWidthFont { Courier Base -1p } # font for @F - named @ParaGap { 1.3vx @OrIfPlain 1f } # gap between paragraphs - named @ParaIndent { 2.0f @OrIfPlain 5s } # first-line indent for @PP - named @DisplayGap { 1.0v @OrIfPlain 1f } # gap above, below displays - named @DisplayIndent { 2.0f @OrIfPlain 5s } # @IndentedDisplay indent - named @DefaultIndent { 0.5rt } # @Display indent - named @DisplayNumStyle - right num { (num) } # display number style - named @WideIndent { 4.0f @OrIfPlain 10s } # @WideTaggedList indent - named @VeryWideIndent { 8.0f @OrIfPlain 20s } # @VeryWideTaggedList indent - named @ListOuterGap { 1.0v @OrIfPlain 1f } # gap before, after list - named @ListGap { 1.0v @OrIfPlain 1f } # gap between list items - named @ListIndent { 0s } # indent of list items - named @ListRightIndent{ 0s } # right indent of list items - named @ListLabelWidth { 2.0f @OrIfPlain 5s } # width allowed for list tags - named @ListLabelRight { No } # right align label - named @ListLabelRightGap { 2s } # right align gap - named @ListFont { } # font style of list item - named @ListBreak { } # break style of list item - named @NumberSeparator{ . } # separates numbers like 2.3.7 - import @BasicSetup - named @CrossLinkFormat - right @Body { @Body } # format for cross links - import @BasicSetup - named @ExternalLinkFormat - right @Body { @Body } # format for external links -@Begin - - ########################################################################### - # # - # 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 - } - } - - - ########################################################################### - # # - # @Pipe, @PipeVerbatim, and @PipeRawVerbatim # - # # - ########################################################################### - - def @Pipe - left command - right x - { - def @Filter { "cat" @FilterIn "|" command ">" @FilterOut } - - x - } - - def @PipeVerbatim - left command - right x - { - def @Filter { - "(echo @Verbatim @Begin ; (cat" @FilterIn "|" command "); echo @End @Verbatim ) >" @FilterOut } - - x - } - - def @PipeRawVerbatim - left command - right x - { - def @Filter { - "(echo @RawVerbatim @Begin ; (cat" @FilterIn "|" command "); echo @End @Verbatim ) >" @FilterOut } - - x - } - - - ########################################################################### - # # - # @Sym, @Ding font symbols, and miscellaneous special characters. # - # # - ########################################################################### - - 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 @II - right x - { - { @CurrFace @Case { - Bold @Yield BoldSlope - else @Yield Slope - } } @Font x - } - - def "~" left x right y { x &1su y } - def "~~" left x right y { x &2s y } - - def "``" { @Char "quotedblleft" @OrIfPlain "``" } - def "''" { @Char "quotedblright" @OrIfPlain "''" } - def ",," { @Char "quotedblbase" @OrIfPlain ",," } - def "--" { @Char "endash" @OrIfPlain "--" } - def "---" { @Char "emdash" @OrIfPlain "---"} - def "..." { @Char "ellipsis" @OrIfPlain "..."} - def @Bullet { @Char "bullet" @OrIfPlain "o" } - def @ParSym { @Char "paragraph" @OrIfPlain "P" } - def @SectSym { @Char "section" @OrIfPlain "$" } - def @Dagger { @Char "dagger" @OrIfPlain "+" } - def @DaggerDbl { @Char "daggerdbl" @OrIfPlain "++" } - def @CDot { @Char "periodcentered" @OrIfPlain "." } - def @Sterling { @Char "sterling" @OrIfPlain "&" } - def @Yen { @Char "yen" @OrIfPlain "Y" } - def @Florin { @Char "florin" @OrIfPlain "f" } - - def @Star { @Sym "asteriskmath" @OrIfPlain "*" } - def @Degree { @Sym "degree" @OrIfPlain "o" } - def @Minute { @Sym "minute" @OrIfPlain "'" } - def @Second { @Sym "second" @OrIfPlain "''" } - def @Multiply { @Sym "multiply" @OrIfPlain "x" } - def @Divide { @Sym "divide" @OrIfPlain "/" } - def @Lozenge { @Sym "lozenge" @OrIfPlain "O" } - def @Register { @Sym "registersans" @OrIfPlain "R" } - def @CopyRight { @Sym "copyrightsans" @OrIfPlain "C" } - def @TradeMark { @Sym "trademarksans" @OrIfPlain "TM" } - - def @Euro - { - @BackEnd @Case { - - PostScript @Yield { - 0.65w @VShift @VContract @HContract - "xsize ysize ysize 0.07 mul louteuro" @Graphic { - 0.7f @High 0.735f @Wide - } - } - - PDF @Yield { EUR } - - PlainText @Yield { EUR } - } - } - - - ########################################################################### - # # - # Symbols stored in the "standard" database # - # # - # @Word language-spacific words such as Chapter, etc. # - # @Roman lower case Roman numerals i, ii, ... , cc # - # @UCRoman upper case Roman numerals I, II, ... , CC # - # @Alpha lower case Roman alphabet a, b, ... , z # - # @UCAlpha upper case Roman alphabet A, B, ... , Z # - # @FnBullets bullets as footnote markers # - # @FnSymbols traditional footnote symbols asterisk, dagger, etc. # - # @Months months of the year: January, ... , December # - # @ShortMonths months of the year, abbreviated: Jan, ..., Dec # - # @WeekDays days of the week: Sunday, ... , Saturday # - # @ShortWeekDays days of the week, abbreviated: Sun, ... , Sat # - # @TwelveHours hours, from 1 to 12 # - # @ShortHours hours, from 0 to 23 # - # @DateTimeFormat format of results of @Date and @Time # - # # - ########################################################################### - - def @Word left @Tag right @Val { @Val } - def @Roman left @Tag right @Val { @Val } - def @UCRoman left @Tag right @Val { @Val } - def @Alpha left @Tag right @Val { @Val } - def @UCAlpha left @Tag right @Val { @Val } - def @FnBullets left @Tag right @Val { @Val } - def @FnSymbols left @Tag right @Val { @Val } - def @Months left @Tag right @Val { @Val } - def @ShortMonths left @Tag right @Val { @Val } - def @WeekDays left @Tag right @Val { @Val } - def @ShortWeekDays left @Tag right @Val { @Val } - def @TwelveHours left @Tag right @Val { @Val } - def @ShortHours left @Tag right @Val { @Val } - def @MeriDiems left @Tag right @Val { @Val } - def @ShortMeriDiems left @Tag right @Val { @Val } - - export @Value - def @DateTimeFormat left @Tag - named @Value - named @Year {} - named @ShortYear {} - named @Month {} - named @ShortMonth {} - named @MonthNum {} - named @Day {} - named @ShortDay {} - named @DayNum {} - named @MeriDiem {} - named @ShortMeriDiem {} - named @Hour {} - named @TwelveHour {} - named @ShortHour {} - named @Minute {} - named @Second {} - {} - {} - - @SysDatabase @Word @Roman @UCRoman @Alpha @UCAlpha @FnBullets @FnSymbols - @Months @ShortMonths @WeekDays @ShortWeekDays @TwelveHours - @ShortHours @MeriDiems @ShortMeriDiems @DateTimeFormat - { standard } - - - ########################################################################### - # # - # @Date and @Time: the date and time now. # - # # - ########################################################################### - - def @Date - named @Format - named @Year { @Moment&&now @Open { {@Century}@Year }} - named @ShortYear { @Moment&&now @Open { @Year }} - named @Month { @Moment&&now @Open { @Months&&@Month }} - named @ShortMonth { @Moment&&now @Open { @ShortMonths&&@Month }} - named @MonthNum { @Moment&&now @Open { @Month }} - named @Day { @Moment&&now @Open { @WeekDays&&@WeekDay }} - named @ShortDay { @Moment&&now @Open { @ShortWeekDays&&@WeekDay}} - named @DayNum { @Moment&&now @Open { @Day }} - named @MeriDiem { @Moment&&now @Open { @MeriDiems&&@Hour }} - named @ShortMeriDiem{ @Moment&&now @Open { @ShortMeriDiems&&@Hour }} - named @Hour { @Moment&&now @Open { @Hour }} - named @TwelveHour { @Moment&&now @Open { @TwelveHours&&@Hour }} - named @ShortHour { @Moment&&now @Open { @ShortHours&&@Hour }} - named @Minute { @Moment&&now @Open { @Minute }} - named @Second { @Moment&&now @Open { @Second }} - { - @DateTimeFormat&&date @Open { @Value - @Year { @Year } - @ShortYear { @ShortYear } - @Month { @Month } - @ShortMonth { @ShortMonth } - @MonthNum { @MonthNum } - @Day { @Day } - @ShortDay { @ShortDay } - @DayNum { @DayNum } - @MeriDiem { @MeriDiem } - @ShortMeriDiem { @ShortMeriDiem } - @Hour { @Hour } - @TwelveHour { @TwelveHour } - @ShortHour { @ShortHour } - @Minute { @Minute } - @Second { @Second } - } - } - { @Format } - - def @Time - named @Format - named @Year { @Moment&&now @Open { {@Century}@Year }} - named @ShortYear { @Moment&&now @Open { @Year }} - named @Month { @Moment&&now @Open { @Months&&@Month }} - named @ShortMonth { @Moment&&now @Open { @ShortMonths&&@Month }} - named @MonthNum { @Moment&&now @Open { @Month }} - named @Day { @Moment&&now @Open { @WeekDays&&@WeekDay }} - named @ShortDay { @Moment&&now @Open { @ShortWeekDays&&@WeekDay}} - named @DayNum { @Moment&&now @Open { @Day }} - named @MeriDiem { @Moment&&now @Open { @MeriDiems&&@Hour }} - named @ShortMeriDiem{ @Moment&&now @Open { @ShortMeriDiems&&@Hour }} - named @Hour { @Moment&&now @Open { @Hour }} - named @TwelveHour { @Moment&&now @Open { @TwelveHours&&@Hour }} - named @ShortHour { @Moment&&now @Open { @ShortHours&&@Hour }} - named @Minute { @Moment&&now @Open { @Minute }} - named @Second { @Moment&&now @Open { @Second }} - { - @DateTimeFormat&&time @Open { @Value - @Year { @Year } - @ShortYear { @ShortYear } - @Month { @Month } - @ShortMonth { @ShortMonth } - @MonthNum { @MonthNum } - @Day { @Day } - @ShortDay { @ShortDay } - @DayNum { @DayNum } - @MeriDiem { @MeriDiem } - @ShortMeriDiem { @ShortMeriDiem } - @Hour { @Hour } - @TwelveHour { @TwelveHour } - @ShortHour { @ShortHour } - @Minute { @Minute } - @Second { @Second } - } - } - { @Format } - - - ########################################################################### - # # - # @DropCapTwo and @DropCapThree # - # # - ########################################################################### - - def @DropCapTwo - left y - named height { 1.5v } - right x - { - def @ParPlace { @Galley } - def @EndParPlace { @Galley } - - def @LineList - { - @PAdjust @ParPlace - //1vx @LineList - } - - def @ParGalley horizontally into { @ParPlace&&preceding } - right x - { - x - } - - def @EndPar force into { @EndParPlace&&following } { @Null } - - def @Cap - { - -0.25f @VShift 1.0w @VShift { - -90d @Rotate height @Wide @Scale 90d @Rotate y - } - } - - |1s @PAdjust @ParPlace - /1vo @Cap @ParGalley {x & @EndPar &1rt } | @PAdjust @ParPlace - //1vx @LineList - // @EndParPlace - } - - def @DropCapThree - left y - named height { 2.5v } - right x - { - def @ParPlace { @Galley } - def @EndParPlace { @Galley } - - def @LineList - { - @PAdjust @ParPlace - //1vx @LineList - } - - def @ParGalley force horizontally into { @ParPlace&&preceding } - right x - { - x - } - - def @EndPar force into { @EndParPlace&&following } { @Null } - - def @Cap - { - -0.25f @VShift 1.0w @VShift { - -90d @Rotate height @Wide @Scale 90d @Rotate y - } - } - - |1s @PAdjust @ParPlace - /1vo @ParGalley { x & @EndPar &1rt } | @PAdjust @ParPlace - /1vo @Cap | @PAdjust @ParPlace - //1vx @LineList - // @EndParPlace - } - - - ########################################################################### - # # - # @Centre, @Center, @Right, @NoDotSep, @NoDotJoin, @DotSep, # - # @ColonSep, @DotJoin, @DashJoin, @NumSep # - # # - ########################################################################### - - macro @Centre @Center { |0.5rt @HContract } - - def @Right - precedence 50 - left x - right y - { x |1.0rt @OneCol { 2f @Wide {} | y } } - - def @NoDotSep left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { x |2s y } - } - } - } - } - - def @NoDotJoin left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { x{y} } - } - } - } - } - - def @DotSep left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { x. |2s y } - } - } - } - } - - def @ColonSep left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { x: |2s y } - } - } - } - } - - def @DotJoin left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { x.y } - } - } - } - } - - def @DashJoin left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { x--y } - } - } - } - } - - def @NumSep left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { - @CurrLang @Case { - Hungarian @Yield { y. x } - else @Yield { x y } - } - } - } - } - } - } - - - ########################################################################### - # # - # @VStrut, @ZeroWidth, @ZeroHeight # - # # - ########################################################################### - - - def @VStrut - named above { 0.5f } - named below { 0.5f } - right x - { - x &0iu @VContract { above @High ^/ below @High } - } - - - def @ZeroWidth right x { @HContract { |0io x |0io } } - - def @ZeroHeight right x { @VContract { /0io x /0io } } - - - ########################################################################### - # # - # @OverStrike, @Sup and @Sub # - # # - ########################################################################### - - def @OverStrike left x right y - { - @OneRow { @HContract @VContract x /0io @HContract @VContract y } - } - - def @Sup - left x - named gap { 0.40fk } - right y - { - @HContract @VContract - { - | 0.7f @Font y ^/gap x - } - } - - def @Sub - left x - named gap { 0.40fk } - right y - { - @HContract @VContract - { - x /gap | 0.7f @Font y - } - } - - - ########################################################################### - # # - # @HClip and @VClip # - # # - ########################################################################### - - def @HClip - named shift { 0.0 } - right x - { - { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize lineto" - "closepath clip gsave" // "grestore" } @Graphic - { - |{{shift}"rt"} @ZeroWidth {{shift}"w"} @HShift x | - } - } - - def @VClip - named shift { 0.0 } - right x - { - { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize lineto" - "closepath clip gsave" // "grestore" } @Graphic - { - /{{shift}"rt"} @ZeroHeight {{shift}"w"} @VShift x / - } - } - - - ########################################################################### - # # - # @AddPaint, @StrokeCommand # - # # - ########################################################################### - - def @AddPaint - left col - right texture - { - col @Case { - none @Yield "" - nochange @Yield { - @BackEnd @Case { - PostScript @Yield { "gsave" texture "fill grestore" } - PDF @Yield { "q f Q" } - PlainText @Yield { "" } - } - } - else @Yield { - @BackEnd @Case { - PostScript @Yield {"gsave" @ColourCommand col texture "fill grestore"} - PDF @Yield { "q" @ColourCommand col "f Q" } - PlainText @Yield { "" } - } - } - } - } - - def @StrokeCommand right linewidth - { - @BackEnd @Case { - PostScript @Yield { - linewidth @Case { - "" @Yield { "stroke" } - none @Yield { } - else @Yield { linewidth "setlinewidth stroke" } - } - } - PDF @Yield { - linewidth @Case { - "" @Yield { "S" } - none @Yield { } - else @Yield { linewidth "w S" } - } - } - else @Yield "" - } - } - - - - ########################################################################### - # # - # @FullWidthRule, @Box, @CurveBox, and @ShadowBox # - # # - ########################################################################### - - def @FullWidthRule - import @PSLengths named linewidth {} - { - @BackEnd @Case { - - PostScript @Yield @HExpand { - { "LoutRule" @StrokeCommand linewidth } @Graphic { 0.5p @High } - } - - PDF @Yield @HExpand { - { "0 0 m __xsize 0 l" @StrokeCommand linewidth } @Graphic { 0.5p @High } - } - - PlainText @Yield { "-" @PlainGraphic 1f @High } - } - } - - def @LocalWidthRule - import @PSLengths named linewidth {} - { - @BackEnd @Case { - - PostScript @Yield { - { "LoutRule" @StrokeCommand linewidth } @Graphic { 0.5p @High } - } - - PDF @Yield { - { "0 0 m __xsize 0 l" @StrokeCommand linewidth } @Graphic { 0.5p @High } - } - - PlainText @Yield { "-" @PlainGraphic 1f @High } - } - } - - def @Box - named margin { 0.3f } - import @PSLengths named linewidth {} - named paint { none } - import @TextureImport named texture {} - right x - { - @BackEnd @Case { - - PostScript @Yield @VContract @HContract 0c @HShift { - {"LoutBox" paint @AddPaint texture @StrokeCommand linewidth } - @Graphic - { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } - } - - PDF @Yield @VContract @HContract 0c @HShift { - { "0 0 m __xsize 0 l __xsize __ysize l 0 __ysize l h" - paint @AddPaint texture @StrokeCommand linewidth } @Graphic - { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } - } - - PlainText @Yield @VContract @HContract 0c @HShift { - ^/margin ^|margin 0c @HShift @OneRow x |margin /margin - } - } - } - - def @CurveBox - named margin { 0.3f } - import @PSLengths named linewidth {} - named paint { none } - import @TextureImport named texture {} - right x - { - def @PDFStuff - { - "__xmark 0 m" - "__sub(__xsize, __xmark) 0 l" - "__sub(__xsize, __div(__mul(11, __xmark), 24)) 0" - "__xsize __div(__mul(11, __xmark), 24)" - "__xsize __xmark c" - "__xsize __sub(__ysize, __xmark) l" - "__xsize __sub(__ysize, __div(__mul(11, __xmark), 24))" - "__sub(__xsize, __div(__mul(11, __xmark), 24)) __ysize" - "__sub(__xsize, __xmark) __ysize c" - "__xmark __ysize l" - "__div(__mul(11, __xmark), 24) __ysize" - "0 __sub(__ysize, __div(__mul(11, __xmark), 24))" - "0 __sub(__ysize, __xmark) c" - "0 __xmark l" - "0 __div(__mul(11, __xmark), 24)" - "__div(__mul(11, __xmark), 24) 0" - "__xmark 0 c" - "h" - paint @AddPaint texture @StrokeCommand linewidth - } - - @VContract @HContract 0c @HShift @BackEnd @Case { - - PostScript @Yield { - {"LoutCurveBox" paint @AddPaint texture @StrokeCommand linewidth } - @Graphic - { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } - } - - PlainText @Yield { - ^/margin ^|margin 0c @HShift @OneRow x |margin /margin - } - - PDF @Yield { - @PDFStuff @Graphic - { ^/margin ^|margin 0c @HShift @OneRow x |margin /margin } - } - } - } - - def @ShadowBox - named margin { 0.3f } - import @PSLengths named linewidth {} - named paint { none } - import @TextureImport named texture {} - named shadow { 0.2f } - right x - { - @VContract @HContract 0c @HShift @BackEnd @Case { - - PostScript @Yield { - "LoutShadowBox fill" @Graphic - { ^/shadow ^|shadow 0c @HShift - @Box - margin {margin} - paint {paint} - texture { texture } - linewidth {linewidth} x - |shadow /shadow - } - } - - PlainText @Yield { - ^/shadow ^|shadow 0c @HShift - @Box - margin { margin } - paint { paint } - texture { texture } - linewidth {linewidth} x - |shadow /shadow - } - - PDF @Yield { - { - "__mul(__xmark, 2) 0 m __xsize 0 l" - "__xsize __sub(__ysize, __mul(__xmark, 2)) l" - "__sub(__xsize, __xmark) __sub(__ysize, __mul(__xmark, 2)) l" - "__sub(__xsize, __xmark) __xmark l" - "__mul(__xmark, 2) __xmark l h f" - } - @Graphic - { ^/shadow ^|shadow 0c @HShift - @Box - margin { margin } - paint { paint } - texture { texture } - linewidth { linewidth } x - |shadow /shadow - } - } - } - } - - - ########################################################################### - # # - # @BoundaryMarks # - # # - ########################################################################### - - def @BoundaryMarks - import @PSLengths named linewidth { 0.2p } - import @PSLengths named length { 0.5c } - import @PSLengths named gap { 0.5c } - import @PSLengths named lout { 0c } - import @PSLengths named rout { 0c } - import @PSLengths named uout { 0c } - import @PSLengths named dout { 0c } - { - def @UpStroke { "0" gap "rmoveto" "0" length "rlineto" } - def @DownStroke { "0" gap "neg" "rmoveto" "0" length "neg rlineto" } - def @LeftStroke { gap "neg" "0" "rmoveto" length "neg" "0 rlineto" } - def @RightStroke { gap "0" "rmoveto" length "0 rlineto" } - - def @LLSpot { lout "neg" dout "neg" moveto } - def @LRSpot { xsize rout "add" dout "neg" moveto } - def @ULSpot { lout "neg" ysize uout "add" moveto } - def @URSpot { xsize rout "add" ysize uout "add" moveto } - - def @PDFStuff { - "__sub(-"gap", "lout") __sub(0, "dout") m " - "__sub(__sub(-"gap", "lout"), "length") __sub(0, "dout") l" - "__sub(0, "lout") __sub(-"gap", "dout") m " - "__sub(0, "lout") __sub(__sub(-"gap", "dout"), "length") l" - "__add(__xsize,"rout") __sub(-"gap", "dout") m " - "__add(__xsize,"rout") __sub(__sub(-"gap", "dout"), "length") l" - "__add(__add(__xsize,"rout"),"gap") __sub(0, "dout") m " - "__add(__add(__add(__xsize,"rout"),"gap"),"length") __sub(0, "dout") l" - " __sub(__sub(0, "lout"), "gap") __add(__ysize, "uout") m " - "__sub(__sub(__sub(0, "lout"), "gap"), "length") __add(__ysize, "uout") l" - "__sub(0, "lout") __add(__add(__ysize, "uout"), "gap") m " - "__sub(0, "lout") __add(__add(__add(__ysize, "uout"), "gap"), "length") l" - " __add(__add(__xsize, "rout"), "gap") __add(__ysize, "uout") m " - "__add(__add(__add(__xsize, "rout"), "gap"), "length") __add(__ysize, "uout") l" - "__add(__xsize, "rout") __add(__add(__ysize, "uout"), "gap") m " - "__add(__xsize, "rout") __add(__add(__add(__ysize, "uout"), "gap"), "length") l" - - linewidth "w S" - } - - @BackEnd @Case { - - PostScript @Yield { - { - @LLSpot @LeftStroke - @LLSpot @DownStroke - @LRSpot @DownStroke - @LRSpot @RightStroke - @ULSpot @LeftStroke - @ULSpot @UpStroke - @URSpot @RightStroke - @URSpot @UpStroke - - linewidth "setlinewidth stroke" - } @Graphic {} - } - - PlainText @Yield "" - - PDF @Yield { @PDFStuff @Graphic {} } - } - } - - ########################################################################## - # # - # @NumberMarker, @NumberOf, @TitleMarker, @TitleOf, # - # @PageMark, @PageOf, @CrossLink, @ExternalLink # - # # - # NB the default value ?? is desperately important for unsorted # - # reference lists numbered by first appearance (@NumberOf @Tag), # - # because it is the special sort key value that prevents merging, # - # hence allowing all the references to be printed even though # - # their sort keys are all ?? initially. # - # # - ########################################################################## - - export @Tag @Value - def @NumberMarker - named @Tag {} - named @Value { "??" } - { - @Null - } - - def @NumberOf - right tag - { - @NumberMarker&&tag @Open { @Value } - } - - - export @Tag @Value - def @TitleMarker - named @Tag {} - named @Value { "??" } - { - @Null - } - - def @TitleOf - right tag - { - @TitleMarker&&tag @Open { @Value } - } - - - export num rawnum @Tag - def @PageMarker - named @Tag {} - named num {} - named rawnum {} - { - @PageLabel num - } - - def @PageMark - right tag - { - tag @LinkDest @Null & @PageMarker&&preceding @Tagged tag - } - - def @NoLinkPageMark - right tag - { - @PageMarker&&preceding @Tagged tag - } - - def @PageOf - right tag - { - @PageMarker&&tag @Open { num } - } - - def @CrossLink - left tag - named @Format right @Body { @CrossLinkFormat @Body } - right obj - { - @HContract @VContract { - tag @LinkSource @Format obj - } - } - - def @ExternalLink - left tag - named @Format right @Body { @ExternalLinkFormat @Body } - right obj - { - @HContract @VContract { - tag @URLLink @Format obj - } - } - - - ########################################################################### - # # - # @Join and @Sep # - # # - # Join two objects together with @NumberSeparator, unless one is # - # empty in which case just return the other. # - # # - ########################################################################### - - def @Join left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { x{@NumberSeparator}y } - } - } - } - } - - def @Sep left x right y - { - x @Case { - {} @Yield y - else @Yield { - y @Case { - {} @Yield x - else @Yield { x{@NumberSeparator} |2s y } - } - } - } - } - - - ########################################################################### - # # - # Miscellaneous. # - # # - ########################################################################### - - def @Heading right x { ragged @Break @HeadingFont @Font x } - def "^" { {} ^& {} } - def "&-" left x right y { x &0ch y } - - - ########################################################################### - # # - # @If @Not @And @Or @True # - # # - # Used in databases to make optional fields format nicely. # - # # - ########################################################################### - - def @If - precedence 97 - left x - right y - { - y @Case { - {} @Yield @Null - else @Yield { @Null{x} } - } - } - - def @Not - precedence 100 - right y - { - y @Case { - {} @Yield "*" - else @Yield "" - } - } - - def @And - precedence 99 - left x - right y - { - x @Case { - {} @Yield {} - else @Yield y - } - } - - def @Or - precedence 98 - left x - right y - { - x @Case { - {} @Yield y - else @Yield x - } - } - - def @True { "*" } - - - ########################################################################### - # # - # Paragraphs. # - # # - ########################################################################### - - macro @PP { //@ParaGap @ParaIndent @Wide &{0i} } - macro @LP { //{@ParaGap} } - macro @LLP { //{1vx} } - macro @DP { //{@DisplayGap} } - macro @LOP { //{@ListOuterGap} } - macro @NP { //{1.1b} } - macro @CNP { // 3.2v @High //0io //{} } - - - ########################################################################### - # # - # Beginning and ending of aligned displays. # - # # - ########################################################################### - - def @APlace { @Galley } - def @EndAlignedPlace { @Galley } - def @AlignedPlace { @Galley } - - def @BAligned into { @APlace&&preceding } - { - def @AlignedList { @AlignedPlace /1.1b @AlignedList } - - //1.1b @AlignedList - // @EndAlignedPlace - } - - macro @BAD @BeginAlignedDisplays { // @APlace | @BAligned } - def @EAD @EndAlignedDisplays force into { @EndAlignedPlace&&preceding } {} - - - ########################################################################### - # # - # New code for numbered displays that will cross section boundaries # - # # - ########################################################################### - - export @Tag val - def @NumDispCounterMarker - named @Tag {} - named val {} - { - @Null - } - - def @NumDispNum right tag - { - @NumDispCounterMarker&&tag @Open { @Next val } - } - - def @NumDispCounterIncrement - named @BypassNumber { "dft" } - right tag - { - def @DisplayNumber - { - @BypassNumber @Dft { @NumDispNum tag } - } - - @NumDispCounterMarker&&preceding @Tagged tag - # @NumDispCounterMarker val { @NumDispNum tag } - # @NumberMarker @Tag { tag } @Value { @NumDispNum tag } - @NumDispCounterMarker val { @DisplayNumber } - @NumberMarker @Tag { tag } @Value { @DisplayNumber } - } - - def @NN - { - @NumDispCounterMarker&&preceding @Open { @DisplayNumStyle val } - } - - def @Do - left x - right y - { - x @Case { - { No None } @Yield @Null - else @Yield y - } - } - - def @BeginDisplayCounter - left condition - right prefix - { - condition @Do @NumDispCounterMarker val { prefix @Join 0 } - } - - - ########################################################################### - # # - # Galleys that carry displays to their places. # - # # - ########################################################################### - - def @DispPlace { @Galley } - - def @Disp into { @DispPlace&&preceding } - right x - { - x - } - - def @NDisp into { @DispPlace&&preceding } - named @Tag {} - named @BypassNumber { "dft" } - right x - { - @OneRow { - @NumDispCounterIncrement @Tag - # @NumDispCounterIncrement @BypassNumber { @BypassNumber } @Tag - @PageMark @Tag - ^// - @OneRow x - } - } - - def @ADisp into { @AlignedPlace&&preceding } - right x - { - x - } - - def @ANDisp into { @AlignedPlace&&preceding } - named @Tag {} - named @BypassNumber { "dft" } - right x - { - @OneRow { - @NumDispCounterIncrement @Tag - # @NumDispCounterIncrement @BypassNumber { @BypassNumber } @Tag - @PageMark @Tag - ^/ - @OneRow x - } - } - - - ########################################################################### - # # - # Displays and raw displays. # - # # - ########################################################################### - - macro @G { |@DefaultIndent } - macro @LG { | } - macro @IG { |@DisplayIndent } - macro @CG { |0.5rt } - macro @RG { |1.0rt } - macro @QR { @DisplayIndent @Wide { |1rt @NN } } - macro @DX { @DispPlace } - macro @DY { @Disp } - macro @AX { @APlace } - macro @AY { @ADisp } - macro @NY { @NDisp } - macro @MY { @ANDisp } - - macro @D @Display { @DP @G @DX | @DP // @DY } - macro @LD @LeftDisplay { @DP @LG @DX | @DP // @DY } - macro @ID @IndentedDisplay { @DP @IG @DX | @DP // @DY } - macro @QD @QuotedDisplay { @DP @IG @DX @IG @DP // @DY } - macro @CD @CentredDisplay - @CenteredDisplay { @DP @CG @DX | @DP // @DY } - macro @RightDisplay { @DP @RG @DX | @DP // @DY } - - - macro @AD @AlignedDisplay { @DP @G @AX | @DP // @AY } - macro @LAD @LeftAlignedDisplay { @DP @LG @AX | @DP // @AY } - macro @IAD @IndentedAlignedDisplay { @DP @IG @AX | @DP // @AY } - macro @QAD @QuotedAlignedDisplay { @DP @IG @AX @IG @DP // @AY } - macro @CAD @CentredAlignedDisplay - @CenteredAlignedDisplay { @DP @CG @AX | @DP // @AY } - macro @RightAlignedDisplay { @DP @RG @AX | @DP // @AY } - - macro @ND @NumberedDisplay { @DP @G @DX |1rt @NN @DP // @NY } - macro @LND @LeftNumberedDisplay { @DP @LG @DX |1rt @NN @DP // @NY } - macro @IND @IndentedNumberedDisplay { @DP @IG @DX |1rt @NN @DP // @NY } - macro @QND @QuotedNumberedDisplay { @DP @IG @DX |1rt @QR @DP // @NY } - macro @CND @CentredNumberedDisplay - @CenteredNumberedDisplay { @DP @CG @DX |1rt @NN @DP // @NY } - macro @RightNumberedDisplay { @DP @RG @DX |1rt @NN @DP // @NY } - - macro @AND @AlignedNumberedDisplay { @DP @G @AX |1rt @NN @DP // @MY } - macro @LAND @LeftAlignedNumberedDisplay { @DP @LG @AX |1rt @NN @DP // @MY } - macro @IAND @IndentedAlignedNumberedDisplay{ @DP @IG @AX |1rt @NN @DP // @MY } - macro @QAND @QuotedAlignedNumberedDisplay { @DP @IG @AX |1rt @QR @DP // @MY } - macro @CAND @CentredAlignedNumberedDisplay - @CenteredAlignedNumberedDisplay{ @DP @CG @AX |1rt @NN @DP // @MY } - macro @RightAlignedNumberedDisplay { @DP @RG @AX |1rt @NN @DP // @MY } - - - macro @RD @RawDisplay { @G @DX | // @DY } - macro @RLD @RawLeftDisplay { @LG @DX | // @DY } - macro @RID @RawIndentedDisplay { @IG @DX | // @DY } - macro @RQD @RawQuotedDisplay { @IG @DX @IG | // @DY } - macro @RCD @RawCentredDisplay - @RawCenteredDisplay { @CG @DX | | // @DY } - macro @RRD @RawRightDisplay { @RG @DX | // @DY } - - - macro @RAD @RawAlignedDisplay { @G @AX | // @AY } - macro @RLAD @RawLeftAlignedDisplay { @LG @AX | // @AY } - macro @RIAD @RawIndentedAlignedDisplay { @IG @AX | // @AY } - macro @RQAD @RawQuotedAlignedDisplay { @IG @AX @IG | // @AY } - macro @RCAD @RawCentredAlignedDisplay - @RawCenteredAlignedDisplay { @CG @AX | // @AY } - macro @RRAD @RawRightAlignedDisplay { @RG @AX | // @AY } - - macro @RND @RawNumberedDisplay { @G @DX |1rt @NN // @NY } - macro @RLND @RawLeftNumberedDisplay { @LG @DX |1rt @NN // @NY } - macro @RIND @RawIndentedNumberedDisplay { @IG @DX |1rt @NN // @NY } - macro @RQND @RawQuotedNumberedDisplay { @IG @DX |1rt @QR // @NY } - macro @RCND @RawCentredNumberedDisplay - @RawCenteredNumberedDisplay { @CG @DX |1rt @NN // @NY } - macro @RRND @RawRightNumberedDisplay { @RG @DX |1rt @NN // @NY } - - macro @RAND @RawAlignedNumberedDisplay { @G @AX |1rt @NN // @MY } - macro @RLAND @RawLeftAlignedNumberedDisplay { @LG @AX |1rt @NN // @MY } - macro @RIAND @RawIndentedAlignedNumberedDisplay { @IG @AX |1rt @NN // @MY } - macro @RQAND @RawQuotedAlignedNumberedDisplay { @IG @AX |1rt @QR // @MY } - macro @RCAND @RawCentredAlignedNumberedDisplay - @RawCenteredAlignedNumberedDisplay { @CG @AX |1rt @NN // @MY } - macro @RRAND @RawRightAlignedNumberedDisplay{ @RG @AX |1rt @NN // @MY } - - - ########################################################################### - # # - # Lists and raw lists. # - # # - ########################################################################### - - - def @ItemPlace { @Galley } - def @ParagraphItemPlace { @Galley } - def @InterruptItemPlace { @Galley } - def @NewPageItemPlace { @Galley } - def @TagPlace { @Galley } - def @EndListPlace { @Galley } - - def @RawList - named style right num { num } - named type right num { num } - named gap { @ListGap } - named indent { @ListIndent } - named itemindent { 0c } - named rightindent { @ListRightIndent } - named labelwidth { @ListLabelWidth } - named labelright { @ListLabelRight } - named labelrightgap { @ListLabelRightGap } - named start { 1 } - named font { @ListFont } - named break { @ListBreak } - named colnum { 1 } - named colgap { 1.0c } - named colheight { 5.0c } - { - def @MakeList right num - { - def @NormalItem - { - def @Align right x - { - labelright @Case { - { Yes yes } @Yield { labelwidth @Wide { |1rt @OneCol { x |labelrightgap } } } - else @Yield x - } - } - - |indent - labelwidth @Wide { - # @NumberMarker @Value {style num} {style num} &0io - # @NumberMarker @Value {num} {style type num} &0io - @NumberMarker @Value {type num} {@Align style type num} &0io - } - |itemindent break @Break font @Font @ItemPlace |rightindent - //gap @MakeList @NotRevealed @Next num - } - - def @ParagraphItem - { - @NumberMarker @Value {num} {style type num} &0io - |indent break @Break font @Font @ParagraphItemPlace |rightindent - //gap @MakeList @NotRevealed @Next num - } - - def @InterruptItem - { - @InterruptItemPlace - //gap @MakeList @NotRevealed num - } - - def @NewPageItem - { - @NewPageItemPlace - //1.1b @MakeList @NotRevealed num - } - - @OneOf - { - @NormalItem - @ParagraphItem - @InterruptItem - @NewPageItem - } - } - - def @ListGalleyPlace { @Galley } - - def @ListGalley into { @ListGalleyPlace&&preceding } - { - @MakeList start // @EndListPlace - } - - def @ColPieceTwo - { - colheight @High 500c @Wide @ListGalleyPlace ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed - } - - def @ColPieceThree - { - colheight @High 500c @Wide @ListGalleyPlace ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed - } - - def @ColPieceFour - { - colheight @High 500c @Wide @ListGalleyPlace ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed - } - - def @ColPieceFive - { - colheight @High 500c @Wide @ListGalleyPlace ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed ||colgap - colheight @High 500c @Wide @ListGalleyPlace @NotRevealed - } - - colnum @Case - { - 1 @Yield @ListGalleyPlace - 2 @Yield @ColPieceTwo - 3 @Yield @ColPieceThree - 4 @Yield @ColPieceFour - 5 @Yield @ColPieceFive - else @Yield @ListGalleyPlace - } - // - @ListGalley - } - - def listitem into { @ItemPlace&&preceding } - named @Tag {} - right x - { - @NumberMarker&&preceding @Tagged @Tag - // x - // @PageMark @Tag # weird placement, but @PageMark is definite now - } - - def paragraphitem - named @Tag {} - named style right tag { @ParaIndent @Wide & tag. &2s } - right x - { - - def sendparagraphitem into { @ParagraphItemPlace&&preceding } - named tag { @Tag } - { - @NumberMarker&&preceding @Tagged @Tag - // { style @NumberMarker&&@Tag @Open { @Value } } @Insert x - // @PageMark @Tag - } - - sendparagraphitem - } - - def droplistitem into { @ItemPlace&&preceding } - named @Tag {} - right x - { - @NumberMarker&&preceding @Tagged @Tag - // @PageMark @Tag - //1vx x - } - - def tagitem into { @ItemPlace&&preceding } - named tag {} - right x - { - def sendtag into { @TagPlace&&preceding } { tag } - - sendtag // x - } - - def droptagitem into { @ItemPlace&&preceding } - named tag {} - right x - { - def sendtag into { @TagPlace&&preceding } { tag } - - sendtag // //1vxu x - } - - def endlist force into { @EndListPlace&&preceding } {} - - def listnewpage into { @NewPageItemPlace&&preceding } {} - - def listinterruptitem into { @InterruptItemPlace&&preceding } - right x - { - x - } - - - macro @LI @ListItem { // listitem } - macro @PI @ParagraphItem { // paragraphitem } - macro @LII @ListInterruptItem { // listinterruptitem } - macro @LNP @ListNewPage { // listnewpage } - macro @DLI @DropListItem { // droplistitem } - macro @TI @TagItem { // tagitem tag } - macro @DTI @DropTagItem { // droptagitem tag } - macro @REL @RawEndList { // & endlist // } - macro @EL @EndList { // & endlist @LOP } - - - macro @RLL @RawLeftList { @RawList style {} - labelwidth { 0c } } - macro @RIL @RawIndentedList { @RawList style {} } - macro @RQL @RawQuotedList { @RawList style {} - rightindent {@DisplayIndent}} - macro @RCL @RawCentredList { @RawList style {} - labelwidth {0c} - itemindent {0.5rt} } - macro @RawCenteredList { @RawCentredList } - macro @RNL @RawNumberedList { @RawList style { num. } } - macro @RPNL @RawParenNumberedList { @RawList style { (num) } } - macro @RRL @RawRomanList { @RawList type { @Roman&&num } - style { num. } } - macro @RPRL @RawParenRomanList { @RawList type { @Roman&&num } - style { (num) } } - macro @RUCRL @RawUCRomanList { @RawList type { @UCRoman&&num } - style { num. } } - macro @RPUCRL @RawParenUCRomanList { @RawList type { @UCRoman&&num } - style { (num) } } - macro @RAL @RawAlphaList { @RawList type { @Alpha&&num } - style { num. } } - macro @RPAL @RawParenAlphaList { @RawList type { @Alpha&&num } - style { (num) } } - macro @RUCAL @RawUCAlphaList { @RawList type { @UCAlpha&&num } - style { num. } } - macro @RPUCAL @RawParenUCAlphaList { @RawList type { @UCAlpha&&num } - style { (num) } } - macro @RBL @RawBulletList { @RawList style { @Bullet } } - macro @RSL @RawStarList { @RawList style { @Star } } - macro @RDL @RawDashList { @RawList style { -- } } - macro @RTL @RawTaggedList { @RawList type { @TagPlace } } - macro @RWTL @RawWideTaggedList { @RawList type { @TagPlace } - labelwidth { @WideIndent } } - macro @RVWTL @RawVeryWideTaggedList{ @RawList type { @TagPlace } - labelwidth { @VeryWideIndent } } - - - macro @L @List { @LOP @RawList } - macro @LL @LeftList { @LOP @RawLeftList } - macro @IL @IndentedList { @LOP @RawIndentedList } - macro @QL @QuotedList { @LOP @RawQuotedList } - macro @CL @CentredList { @LOP @RawCentredList } - macro @CenteredList { @LOP @RawCenteredList } - macro @NL @NumberedList { @LOP @RawNumberedList } - macro @PNL @ParenNumberedList { @LOP @RawParenNumberedList } - macro @RL @RomanList { @LOP @RawRomanList } - macro @PRL @ParenRomanList { @LOP @RawParenRomanList } - macro @UCRL @UCRomanList { @LOP @RawUCRomanList } - macro @PUCRL @ParenUCRomanList { @LOP @RawParenUCRomanList } - macro @AL @AlphaList { @LOP @RawAlphaList } - macro @PAL @ParenAlphaList { @LOP @RawParenAlphaList } - macro @UCAL @UCAlphaList { @LOP @RawUCAlphaList } - macro @PUCAL @ParenUCAlphaList { @LOP @RawParenUCAlphaList } - macro @BL @BulletList { @LOP @RawBulletList } - macro @SL @StarList { @LOP @RawStarList } - macro @DL @DashList { @LOP @RawDashList } - macro @TL @TaggedList { @LOP @RawTaggedList } - macro @WTL @WideTaggedList { @LOP @RawWideTaggedList } - macro @VWTL @VeryWideTaggedList { @LOP @RawVeryWideTaggedList } - -@End @BasicSetup diff --git a/include/slides b/include/slides index 91886ba..23ce202 100644 --- a/include/slides +++ b/include/slides @@ -46,6 +46,7 @@ # @InitialSpace { lout } # initial space style # @InitialLanguage { English } # initial language # @InitialColour { black } # initial colour + # @InitialBackgroundColour { white } # initial background colour # @OptimizePages { No } # optimize page breaks? # @HeadingFont { Bold } # font for @Heading # @FixedWidthFont { Courier Base -1p } # font for @F @@ -295,6 +296,7 @@ # @IntroPageNumbers { Roman } # intro page numbers # @IntroFirstPageNumber{ 1 } # number of first intro page # @StructPageNums { No } # make structured page numbers + # @PageNumberFormat { number } # format of all page numbers # @OddTop { @Centre{- @PageNum -} } # Simple page headers # @OddFoot { @Null } @@ -357,6 +359,10 @@ # @OverheadNumbers { Arabic } # kind of overhead numbers # @FirstOverheadNumber { 1 } # first overhead num # @TitlePageFont { Helvetica Base 1.5f } # title page font + # @TitleFormat { @Center clines @Break title } # title line + # @AuthorFormat { @Center clines @Break author } # author line + # @InstitutionFormat { @Center clines @Break @I institution } # inst + # @DateLineFormat { @Center date } # date line # @AboveTitleGap { 0.5i } # gap above title # @AboveAuthorGap { 1.0i } # gap above author # @AboveInstitutionGap { 0.5i } # gap above inst diff --git a/include/slidesf b/include/slidesf index a870454..3853e3c 100644 --- a/include/slidesf +++ b/include/slidesf @@ -21,6 +21,14 @@ def @OverheadSetup named @OverheadNumbers { Arabic } named @FirstOverheadNumber { 1 } named @TitlePageFont { Helvetica Base } + named @TitleFormat + right title { @Center clines @Break title } + named @AuthorFormat + right author { @Center clines @Break author } + named @InstitutionFormat + right institution { @Center clines @Break @I institution } + named @DateLineFormat + right date { @Center date } named @AboveTitleGap { 0.5i } named @AboveAuthorGap { 1.0i } named @AboveInstitutionGap { 0.5i } @@ -144,9 +152,9 @@ def @OverheadSetup def @DatePart { @DateLine @Case { - No @Yield { @Null } - Yes @Yield { |0.5rt @Date | } - else @Yield { |0.5rt @DateLine | } + No @Yield { @Null } + Yes @Yield { @Date } + else @Yield { @DateLine } } } @@ -155,11 +163,11 @@ def @OverheadSetup @TitlePageFont @Font @InitialBreak @Break @InitialSpace @Space clines @Break { //0.5i - //@AboveTitleGap |0.5rt 1.5f @Font @InitialBreak @Break - @InitialSpace @Space clines @Break @Title | - //@AboveAuthorGap |0.5rt clines @Break @Author | - //@AboveInstitutionGap |0.5rt clines @Break @I @Institution | - //@AboveDateLineGap @DatePart + //@AboveTitleGap 1.5f @Font @InitialBreak @Break + @InitialSpace @Space @TitleFormat @Title | + //@AboveAuthorGap @AuthorFormat @Author | + //@AboveInstitutionGap @InstitutionFormat @Institution | + //@AboveDateLineGap @DateLineFormat @DatePart | } } |