########################################################################### # # # @OrdinarySetup extension to @DocumentSetup. # # # # Jeffrey H. Kingston # # # # This package extends DocumentSetup for ordinary documents. # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either Version 3, or (at your option) # # any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA # # # # As a special exception, when this file is read by Lout when processing # # a Lout source document, you may use the result without restriction. # # # ########################################################################### extend @BasicSetup @DocumentSetup export @Doc @Document @Text def @OrdinarySetup named @IndexWord { index } named @IndexAWord { index } named @IndexBWord { index } named @AppendixWord { appendix } named @SectionNumbers { Arabic } named @FirstSectionNumber { 1 } named @SubSectionNumbers { Arabic } named @FirstSubSectionNumber { 1 } named @SubSubSectionNumbers { Arabic } named @FirstSubSubSectionNumber { 1 } named @AppendixNumbers { UCAlpha } named @FirstAppendixNumber { 1 } named @SubAppendixNumbers { Arabic } named @FirstSubAppendixNumber { 1 } named @SubSubAppendixNumbers { Arabic } named @FirstSubSubAppendixNumber { 1 } named @SectionHeadingFont { Bold } named @SectionHeadingBreak { ragged 1.2fx nohyphen } named @SectionHeadingFormat left number right title { number @Sep title } named @SubSectionHeadingFont { Bold } named @SubSectionHeadingBreak { ragged 1.2fx nohyphen } named @SubSectionHeadingFormat left number right title { number @Sep title } named @SubSubSectionHeadingFont { Slope } named @SubSubSectionHeadingBreak { ragged 1.2fx nohyphen } named @SubSubSectionHeadingFormat left number right title { number @Sep title } named @AppendixHeadingFont { Bold } named @AppendixHeadingBreak { ragged 1.2fx nohyphen } named @AppendixHeadingFormat left number right title { number @Sep title } named @SubAppendixHeadingFont { Bold } named @SubAppendixHeadingBreak { ragged 1.2fx nohyphen } named @SubAppendixHeadingFormat left number right title { number @Sep title } named @SubSubAppendixHeadingFont { Slope } named @SubSubAppendixHeadingBreak { ragged 1.2fx nohyphen } named @SubSubAppendixHeadingFormat left number right title { number @Sep title } named @ReferencesHeadingFont { Bold } named @ReferencesHeadingBreak { ragged 1.2fx nohyphen } named @ReferencesHeadingFormat right title { title } named @IndexHeadingFont { Bold } named @IndexHeadingBreak { ragged 1.2fx nohyphen } named @IndexHeadingFormat right title { title } named @IndexAHeadingFont { Bold } named @IndexAHeadingBreak { ragged 1.2fx nohyphen } named @IndexAHeadingFormat right title { title } named @IndexBHeadingFont { Bold } named @IndexBHeadingBreak { ragged 1.2fx nohyphen } named @IndexBHeadingFormat right title { title } named @SectionGap { 2.0v @OrIfPlain 3f } named @SubSectionGap { 1.5v @OrIfPlain 2f } named @SubSubSectionGap { 1.5v @OrIfPlain 2f } named @AppendixGap { 2.0v @OrIfPlain 3f } named @SubAppendixGap { 1.5v @OrIfPlain 2f } named @SubSubAppendixGap { 1.5v @OrIfPlain 2f } named @SectionInContents { Yes } named @SubSectionInContents { Yes } named @SubSubSectionInContents { No } named @AppendixInContents { Yes } named @SubAppendixInContents { Yes } named @SubSubAppendixInContents { No } named @ReferencesInContents { Yes } named @IndexInContents { Yes } named @IndexAInContents { Yes } named @IndexBInContents { Yes } named @SectionContentsIndent { 0f } named @SubSectionContentsIndent { 3f } named @SubSubSectionContentsIndent { 6f } named @AppendixContentsIndent { 0f } named @SubAppendixContentsIndent { 3f } named @SubSubAppendixContentsIndent { 6f } named @ReferencesContentsIndent { 0f } named @IndexContentsIndent { 0f } named @IndexAContentsIndent { 0f } named @IndexBContentsIndent { 0f } named @SectionNumInTheorems { No } named @SubSectionNumInTheorems { No } named @SubSubSectionNumInTheorems { No } named @AppendixNumInTheorems { No } named @SubAppendixNumInTheorems { No } named @SubSubAppendixNumInTheorems { No } named @SectionNumInDisplays { Yes } named @SubSectionNumInDisplays { No } named @SubSubSectionNumInDisplays { No } named @AppendixNumInDisplays { Yes } named @SubAppendixNumInDisplays { No } named @SubSubAppendixNumInDisplays { No } named @SectionNumInFigures { No } named @SubSectionNumInFigures { No } named @SubSubSectionNumInFigures { No } named @AppendixNumInFigures { No } named @SubAppendixNumInFigures { No } named @SubSubAppendixNumInFigures { No } named @SectionNumInTables { No } named @SubSectionNumInTables { No } named @SubSubSectionNumInTables { No } named @AppendixNumInTables { No } named @SubAppendixNumInTables { No } named @SubSubAppendixNumInTables { No } named @SectionNumInFloaters { No } named @SubSectionNumInFloaters { No } named @SubSubSectionNumInFloaters { No } named @AppendixNumInFloaters { No } named @SubAppendixNumInFloaters { No } named @SubSubAppendixNumInFloaters { No } named @SectionNumInRunners { Yes } named @SubSectionNumInRunners { No } named @SubSubSectionNumInRunners { No } named @AppendixNumInRunners { Yes } named @SubAppendixNumInRunners { No } named @SubSubAppendixNumInRunners { No } named @SectionPrefix { } named @AppendixPrefix { } named @ReferencesPrefix { } named @IndexPrefix { } named @IndexAPrefix { } named @IndexBPrefix { } @Begin ####################################################################### # # # Lists of sections, sub(-sub)sections, appendices, etc. # # # ####################################################################### def @TextPlace { @Galley } export num def @SectionList named @Tag {} right num { @Galley //@SectionGap @SectionList @Next num } export num def @SubSectionList named @Tag {} right num { @Galley //@SubSectionGap @SubSectionList @Next num } export num def @SubSubSectionList named @Tag {} right num { @Galley //@SubSubSectionGap @SubSubSectionList @Next num } export num def @AppendixList named @Tag {} right num { @Galley //@AppendixGap @AppendixList @Next num } export num def @SubAppendixList named @Tag {} right num { @Galley //@SubAppendixGap @SubAppendixList @Next num } export num def @SubSubAppendixList named @Tag {} right num { @Galley //@SubSubAppendixGap @SubSubAppendixList @Next num } ####################################################################### # # # @SendFull - send full-width text. # # # ####################################################################### def @SendFull force into { @FullPlace&&following } right x { x } ####################################################################### # # # Document. # # # ####################################################################### def @Document named @InitialFont { @InitialFont } named @InitialBreak { @InitialBreak } named @InitialOutdent { @InitialOutdent } named @InitialSpace { @InitialSpace } named @InitialLanguage { @InitialLanguage } named @PageOrientation { @PageOrientation } named @PageHeaders { @PageHeaders } named @ColumnNumber { @ColumnNumber } named @FirstPageNumber { @FirstPageNumber } named @OptimizePages { @OptimizePages } named @Unpaginated { No } named @IndexText { @IndexText } named @IndexAText { @IndexAText } named @IndexBText { @IndexBText } { def @ReferencesPart named @Tag {} { @LargeScaleStructure tag { @Tag } type { Major } initiallanguage { @InitialLanguage } title { @RefHeading @RefListTitle } headingfont { @ReferencesHeadingFont } headingbreak { @ReferencesHeadingBreak } headingformat { @ReferencesHeadingFormat @Body } incontents { @ReferencesInContents } contentsindent { @ReferencesContentsIndent } pnprefix { @ReferencesPrefix } majornum {} majortitle {} minornum {} minortitle { @RefHeading @RefListTitle } inrunners { Yes } sendheader { @Body } aboveheadinggap { 0f } { //@RefListGap @ReferencesSection } } def @IndexPart named @Tag {} { def @Run { NonStart @Runner @MajorNum {} @MajorTitle { index @WordVal @IndexWord } @MinorNum {} @MinorTitle {} @Owner { @Tag } @Prefix { @IndexPrefix } } @LargeScaleStructure tag { @Tag } type { Major } initiallanguage { @InitialLanguage } title { index @WordVal @IndexWord } headingfont { @IndexHeadingFont } headingbreak { @IndexHeadingBreak } headingformat { @IndexHeadingFormat @Body } headingtext { @IndexText } incontents { @IndexInContents } contentsindent { @IndexContentsIndent } pnprefix { @IndexPrefix } inrunners { Yes } majornum {} majortitle {} minornum {} minortitle { index @WordVal @IndexWord } sendheader { @SendFull @Body } innergap { @SectionGap } wantindefinite { Yes } @IndexSection @Run } def @IndexAPart named @Tag {} { def @Run { NonStart @Runner @MajorNum {} @MajorTitle { index @WordVal @IndexAWord } @MinorNum {} @MinorTitle {} @Owner { @Tag } @Prefix { @IndexAPrefix } } @LargeScaleStructure tag { @Tag } type { Major } initiallanguage { @InitialLanguage } title { index @WordVal @IndexAWord } headingfont { @IndexAHeadingFont } headingbreak { @IndexAHeadingBreak } headingformat { @IndexAHeadingFormat @Body } headingtext { @IndexAText } incontents { @IndexAInContents } contentsindent { @IndexAContentsIndent } pnprefix { @IndexAPrefix } inrunners { Yes } majornum {} majortitle {} minornum {} minortitle { index @WordVal @IndexAWord } sendheader { @SendFull @Body } innergap { @SectionGap } wantindefinite { Yes } @IndexASection @Run } def @IndexBPart named @Tag {} { def @Run { NonStart @Runner @MajorNum {} @MajorTitle { index @WordVal @IndexBWord } @MinorNum {} @MinorTitle {} @Owner { @Tag } @Prefix { @IndexBPrefix } } @LargeScaleStructure tag { @Tag } type { Major } initiallanguage { @InitialLanguage } title { index @WordVal @IndexBWord } headingfont { @IndexBHeadingFont } headingbreak { @IndexBHeadingBreak } headingformat { @IndexBHeadingFormat @Body } headingtext { @IndexBText } incontents { @IndexBInContents } contentsindent { @IndexBContentsIndent } pnprefix { @IndexBPrefix } inrunners { Yes } majornum {} majortitle {} minornum {} minortitle { index @WordVal @IndexBWord } sendheader { @SendFull @Body } innergap { @SectionGap } wantindefinite { Yes } @IndexBSection @Run } def @DocumentBody force into { @ColPlace&&preceding } named @Optimize { @OptimizePages } { # this whole comment is now obsolete: # It's important that the first component of @DocumentBody be # indefinite. If it was definite, then @DocumentBody would # attach immediately to the first page. This would prevent # @FullWidth from attaching to that page, with the result that # a document starting with @FullWidth would start on page 2! // @FootNoteThrough @Do @BeginFootNoteCounter // @TextPlace //@SectionGap @EndFigureList //@SectionGap @EndNoteList 1 //@SectionGap @MakeReferences @Do @ReferencesPart // @MakeIndexA @Do @IndexAPart // @MakeIndexB @Do @IndexBPart // @MakeIndex @Do @IndexPart // NonStart @Runner } @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break @InitialLanguage @Language @InitialSpace @Space { @ColourCommand @InitialColour } @SetColour { Yes @BeginAllCounters {} // Yes @BeginDisplayCounter {} // Yes @BeginFigureCounter {} // Yes @BeginTableCounter {} // Yes @BeginFloaterCounter {} // @BackEnd @Case { PlainText @Yield { @Unpaginated @Case { { Yes yes } @Yield { @ContinuousPageList @Orient { @PageOrientation } } { No no } @Yield { @PageList @ColumnNumber { @ColumnNumber } @PageHeaders { @PageHeaders } @Orient { @PageOrientation } extra { Yes } @FirstPageNumber } } } else @Yield { @PageList @ColumnNumber { @ColumnNumber } @PageHeaders { @PageHeaders } @Orient { @PageOrientation } extra { Yes } @FirstPageNumber } } // @DocumentBody } } macro @Doc { @Document // } ####################################################################### # # # @Text containing sections, appendices, etc. # # # ####################################################################### export @ContentsGoesHere @FullWidth @BeginSections @EndSections @Section @BeginAppendices @EndAppendices @Appendix def @Text force into { @TextPlace&&preceding } body @Body { def @ContentsGoesHere { @ContentsSection } export @ContentsGoesHere def @FullWidth body @Body { def @ContentsGoesHere {} @SendFull { Start @Runner // @Body } & NonStart @Runner & &2.1b & } def @EndSectionsPlace { @Galley } def @EndSections force into { @EndSectionsPlace&&preceding } {} macro @BeginSections { //@SectionGap @SectionList @FirstSectionNumber // @EndSectionsPlace // } export @BeginSubSections @EndSubSections @SubSection @Title def @Section force into { @SectionList&&preceding } named @Tag {} named @Title {} named @RunningTitle { dft } named @InitialLanguage {} named @BypassNumber { dft } named @NewPage { No } body @Body { def @EndSubSectionsPlace { @Galley } def @EndSubSections force into { @EndSubSectionsPlace&&preceding } {} macro @BeginSubSections { //@SubSectionGap @SubSectionList @FirstSubSectionNumber // @EndSubSectionsPlace // } def @SectionShortNum { @SectionNumbers @Then { @BypassNumber @Dft { @SectionNumbers @Num @SectionList&&@Tag @Open { num } } } } export @BeginSubSubSections @EndSubSubSections @SubSubSection def @SubSection force into { @SubSectionList&&preceding } named @Tag {} named @Title {} named @RunningTitle { dft } named @InitialLanguage { @InitialLanguage } named @BypassNumber { dft } named @NewPage { No } body @Body { def @EndSubSubSectionsPlace { @Galley } def @EndSubSubSections force into { @EndSubSubSectionsPlace&&preceding } {} macro @BeginSubSubSections { //@SubSubSectionGap @SubSubSectionList @FirstSubSubSectionNumber // @EndSubSubSectionsPlace // } def @SubSectionShortNum { @SubSectionNumbers @Then { @BypassNumber @Dft { @SectionShortNum @Join @SubSectionNumbers @Num { @SubSectionList&&@Tag @Open { num } } } } } def @SubSubSection force into { @SubSubSectionList&&preceding } named @Tag {} named @Title {} named @RunningTitle { dft } named @InitialLanguage { @InitialLanguage } named @BypassNumber { dft } named @NewPage { No } body @Body { @LargeScaleStructure tag { @Tag } type { Minor } initiallanguage { @InitialLanguage } title { @Title } runningtitle { @RunningTitle } headingfont { @SubSubSectionHeadingFont } headingbreak { @SubSubSectionHeadingBreak } headingformat { @Num @SubSubSectionHeadingFormat @Body } incontents { @SubSubSectionInContents } contentsindent { @SubSubSectionContentsIndent } numbers { @SubSubSectionNumbers } attachnum { @SubSubSectionList&&preceding @Tagged @Tag } retrievenum { @SubSubSectionList&&@Tag @Open { num } } bypassnumber { @BypassNumber } prefix { @SubSectionShortNum } majornum {} majortitle {} intheorems { @SubSubSectionNumInTheorems } indisplays { @SubSubSectionNumInDisplays } infigures { @SubSubSectionNumInFigures } intables { @SubSubSectionNumInTables } infloaters { @SubSubSectionNumInFloaters } inrunners { @SubSubSectionNumInRunners } newpage { @NewPage } @Body } @LargeScaleStructure tag { @Tag } type { Minor } initiallanguage { @InitialLanguage } title { @Title } runningtitle { @RunningTitle } headingfont { @SubSectionHeadingFont } headingbreak { @SubSectionHeadingBreak } headingformat { @Num @SubSectionHeadingFormat @Body } incontents { @SubSectionInContents } contentsindent { @SubSectionContentsIndent } numbers { @SubSectionNumbers } attachnum { @SubSectionList&&preceding @Tagged @Tag } retrievenum { @SubSectionList&&@Tag @Open { num } } bypassnumber { @BypassNumber } prefix { @SectionShortNum } majornum {} majortitle {} intheorems { @SubSectionNumInTheorems } indisplays { @SubSectionNumInDisplays } infigures { @SubSectionNumInFigures } intables { @SubSectionNumInTables } infloaters { @SubSectionNumInFloaters } inrunners { @SubSectionNumInRunners } newpage { @NewPage } @Body } @LargeScaleStructure tag { @Tag } type { Minor } initiallanguage { @InitialLanguage } title { @Title } runningtitle { @RunningTitle } headingfont { @SectionHeadingFont } headingbreak { @SectionHeadingBreak } headingformat { @Num @SectionHeadingFormat @Body } incontents { @SectionInContents } contentsindent { @SectionContentsIndent } numbers { @SectionNumbers } attachnum { @SectionList&&preceding @Tagged @Tag } retrievenum { @SectionList&&@Tag @Open { num } } pnprefix { @SectionPrefix } majornum {} majortitle {} bypassnumber { @BypassNumber } intheorems { @SectionNumInTheorems } indisplays { @SectionNumInDisplays } infigures { @SectionNumInFigures } intables { @SectionNumInTables } infloaters { @SectionNumInFloaters } inrunners { @SectionNumInRunners } newpage { @NewPage } @Body } def @EndAppendicesPlace { @Galley } def @EndAppendices force into { @EndAppendicesPlace&&preceding } {} macro @BeginAppendices { //@AppendixGap @AppendixList @FirstAppendixNumber // @EndAppendicesPlace // } export @BeginSubAppendices @EndSubAppendices @SubAppendix def @Appendix force into { @AppendixList&&preceding } named @Tag {} named @Title {} named @RunningTitle { dft } named @InitialLanguage {} named @BypassNumber { dft } named @NewPage { No } body @Body { def @EndSubAppendicesPlace { @Galley } def @EndSubAppendices force into { @EndSubAppendicesPlace&&preceding } {} macro @BeginSubAppendices { //@SubAppendixGap @SubAppendixList @FirstSubAppendixNumber // @EndSubAppendicesPlace // } def @AppendixShortNum { @AppendixNumbers @Then { @BypassNumber @Dft { @AppendixNumbers @Num @AppendixList&&@Tag @Open { num } } } } export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix def @SubAppendix force into { @SubAppendixList&&preceding } named @Tag {} named @Title {} named @RunningTitle { dft } named @InitialLanguage { @InitialLanguage } named @BypassNumber { dft } named @NewPage { No } body @Body { def @EndSubSubAppendicesPlace { @Galley } def @EndSubSubAppendices force into { @EndSubSubAppendicesPlace&&preceding } {} macro @BeginSubSubAppendices { //@SubSubAppendixGap @SubSubAppendixList @FirstSubSubAppendixNumber // @EndSubSubAppendicesPlace // } def @SubAppendixShortNum { @SubAppendixNumbers @Then { @BypassNumber @Dft { @AppendixShortNum @Join @SubAppendixNumbers @Num { @SubAppendixList&&@Tag @Open { num } } } } } def @SubSubAppendix force into {@SubSubAppendixList&&preceding} named @Tag {} named @Title {} named @RunningTitle { dft } named @InitialLanguage { @InitialLanguage } named @BypassNumber { dft } named @NewPage { No } body @Body { @LargeScaleStructure tag { @Tag } type { Minor } initiallanguage { @InitialLanguage } title { @Title } runningtitle { @RunningTitle } headingfont { @SubSubAppendixHeadingFont } headingbreak { @SubSubAppendixHeadingBreak } headingformat { @Num @SubSubAppendixHeadingFormat @Body } incontents { @SubSubAppendixInContents } contentsindent { @SubSubAppendixContentsIndent } numbers { @SubSubAppendixNumbers } attachnum { @SubSubAppendixList&&preceding @Tagged @Tag } retrievenum { @SubSubAppendixList&&@Tag @Open { num } } bypassnumber { @BypassNumber } prefix { @SubAppendixShortNum } majornum {} majortitle {} intheorems { @SubSubAppendixNumInTheorems } indisplays { @SubSubAppendixNumInDisplays } infigures { @SubSubAppendixNumInFigures } intables { @SubSubAppendixNumInTables } infloaters { @SubSubAppendixNumInFloaters } inrunners { @SubSubAppendixNumInRunners } newpage { @NewPage } @Body } @LargeScaleStructure tag { @Tag } type { Minor } initiallanguage { @InitialLanguage } title { @Title } runningtitle { @RunningTitle } headingfont { @SubAppendixHeadingFont } headingbreak { @SubAppendixHeadingBreak } headingformat { @Num @SubAppendixHeadingFormat @Body } incontents { @SubAppendixInContents } contentsindent { @SubAppendixContentsIndent } numbers { @SubAppendixNumbers } attachnum { @SubAppendixList&&preceding @Tagged @Tag } retrievenum { @SubAppendixList&&@Tag @Open { num } } bypassnumber { @BypassNumber } prefix { @AppendixShortNum } majornum {} majortitle {} intheorems { @SubAppendixNumInTheorems } indisplays { @SubAppendixNumInDisplays } infigures { @SubAppendixNumInFigures } intables { @SubAppendixNumInTables } infloaters { @SubAppendixNumInFloaters } inrunners { @SubAppendixNumInRunners } newpage { @NewPage } @Body } @LargeScaleStructure tag { @Tag } type { Minor } initiallanguage { @InitialLanguage } title { @Title } runningtitle { @RunningTitle } headingfont { @AppendixHeadingFont } headingbreak { @AppendixHeadingBreak } headingformat { @Num @AppendixHeadingFormat @Body } incontents { @AppendixInContents } contentsindent { @AppendixContentsIndent } word { appendix @WordVal @AppendixWord } numbers { @AppendixNumbers } attachnum { @AppendixList&&preceding @Tagged @Tag } retrievenum { @AppendixList&&@Tag @Open { num } } pnprefix { @AppendixPrefix } majornum {} majortitle {} bypassnumber { @BypassNumber } intheorems { @AppendixNumInTheorems } indisplays { @AppendixNumInDisplays } infigures { @AppendixNumInFigures } intables { @AppendixNumInTables } infloaters { @AppendixNumInFloaters } inrunners { Yes } newpage { @NewPage } @Body } //1.1f // Start @Runner // @Body // NonStart @Runner } @End @OrdinarySetup