aboutsummaryrefslogblamecommitdiffstats
path: root/include/bookf
blob: 3c2b21f983925c9254380a13d76061ceaeb57f93 (plain) (tree)
1
2
3
4
5
6
7
8
9





                                                                           


                                                                           
















                                                                           


                                                                           
                                                                               










                                                                         
                                                                         



                                                                         
                                                                         


                                                                         
                                                                         
 



                                                                         
























                                                                         









                                                                         































                                                                         

                                                                         





                                                                         
                                                                         
                                                                         

                                                                         
                                                                         








                                                                         
                                                                         


                                                                         
                                                                         





                                                                         
                                                                         












                                                                         
 

                                                                         







                                                                         

                                                                         







                                                                         

                                                                         







                                                                         

                                                                         







                                                                         









                                                                         

                                                                         









                                                                         
                                                                         




                                                                         
                                                                         


                                                                         
                                                                         
















                                                                           













                                                              















































                                                                           

                                                                           









                                                                           
                                           







                                                                           


                                                                           


                                                                           
                            
     


                                                                        




                                  
                             
















                                                                             
                                           




































                                                                           

                                             
                                                 







                                                             
                                             


                                         





























































































                                                                                




















                                                                    













                                                                  
                                                            

                                              
                                                 




                                        
























                                                                   
                                                          







                                            






















                                                                  
                                          
                                               
                                                       






























                                                                  
                                           
                                                
                                                        






























                                                                  
                                           
                                                
                                                        







                                          























                                                                  
                                                          







                                            


                                                               
                                        
















                                                                  



                                                                   









                                                                             
                                                                    










                                                       
                                               














                                                        
                                               




                                                             
                                        
















                                                                  



                                                                   










                                                           
                                               














                                                        
                                               

         


                                                                              





                                                



                                                   















                                                                              



                                                   




                                                         

                                                                

























                                                                              
                                                        






                                                        















                                                                          
                                 






















                                                                     
                                                            










                                                                     
                                                       
                                                     
                                    

                     











                                                              
                                                     

































                                                                           
                                                           














                                                                           
                                                                       







                                                                  















                                                                                    
                                 






















                                                                          
                                                                 










                                                                          
                                                            
                                                          
                                    


                     










                                                              
                                                          




                                            


















                                                                           
                                 
























                                                                         

                                                                                
















                                                            
                                 





























                                                                              
                                     





























                                                                                  
                                         












                                                                                
                                                                       










                                                                                
                                                                  
                                                                
                                            












                                                                         
                                                                










                                                                         
                                                           
                                                         
                                        













                                                                  
                                                         










                                                                  
                                                    
                                                  
                                    
















                                                               
                                                      






                                          





                                      













                                                              
                                                     

                                                                       








                                                              
                                                
                                             

































































                                                                              
                                 




























                                                                                        
                                     












                                                                             
                                                                    










                                                                             
                                                               
                                                             
                                        













                                                                      
                                                             










                                                                      
                                                        
                                                      
                                    
















                                                               
                                                      






                                          





                                      













                                                               
                                                      









                                                               
                                                 
                                             






                                        
















                                                                           
               

###########################################################################
#                                                                         #
#  @BookSetup extension to @DocumentSetup.                                #
#                                                                         #
#  Jeffrey H. Kingston                                                    #
#                                                                         #
#  This package extends DocumentSetup with definitions for books.         #
#                                                                         #
#  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 @Book @Preface @Abbreviations @Introduction @Chapter @Appendix @Colophon
def @BookSetup
    named @TitlePageFont		{  Helvetica Base		}
    named @SeparateIntroNumbering	{  Yes				}
    named @PrefaceAfterContents		{  No				}
    named @ChapterStartPages		{  Any				}
    named @ReferencesBeforeAppendices	{  No				}

    named @PrefaceWord			{  preface			}
    named @ContentsWord			{  contents			}
    named @FigureListWord		{  figurelist			}
    named @TableListWord		{  tablelist			}
    named @FloaterListWord		{  floaterlist			}
    named @IntroductionWord		{  introduction			}
    named @AbbreviationsWord		{  abbreviations		}
    named @ChapterWord			{  chapter			}
    named @AppendixWord			{  appendix			}
    named @GlossaryWord			{  glossary			}
    named @IndexWord			{  index			}
    named @IndexAWord			{  index			}
    named @IndexBWord			{  index			}
    named @ColophonWord			{  colophon			}

    named @SubPrefaceNumbers		{  None				}
    named @FirstSubPrefaceNumber	{  1				}
    named @SubIntroductionNumbers	{  None				}
    named @FirstSubIntroductionNumber	{  1				}
    named @ChapterNumbers		{  Arabic			}
    named @FirstChapterNumber		{  1				}
    named @SectionNumbers		{  Arabic			}
    named @FirstSectionNumber		{  1				}
    named @SubSectionNumbers		{  Arabic			}
    named @FirstSubSectionNumber	{  1				}
    named @SubSubSectionNumbers		{  Arabic			}
    named @FirstSubSubSectionNumber	{  1				}
    named @AppendixNumbers		{  UCAlpha			}
    named @FirstAppendixNumber		{  1				}
    named @SubAppendixNumbers		{  Arabic			}
    named @FirstSubAppendixNumber	{  1				}
    named @SubSubAppendixNumbers	{  Arabic			}
    named @FirstSubSubAppendixNumber	{  1				}

    named @PartHeadingFont		{  Helvetica Base 2.50f		}
    named @PartHeadingBreak		{  clines 1.2fx nohyphen	}
    named @PartHeadingFormat
	left number right title		{  @CD number @DP @CD title	}

    named @ChapterHeadingFont		{  Bold 2.00f			}
    named @ChapterHeadingBreak		{  ragged 1.2fx nohyphen   	}
    named @ChapterHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @SubPrefaceHeadingFont	{  Bold				}
    named @SubPrefaceHeadingBreak	{  ragged 1.2fx nohyphen	}
    named @SubPrefaceHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @SubIntroductionHeadingFont	{  Bold				}
    named @SubIntroductionHeadingBreak	{  ragged 1.2fx nohyphen	}
    named @SubIntroductionHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @SectionHeadingFont		{  Bold				}
    named @SectionHeadingBreak		{  ragged 1.2fx nohyphen	}
    named @SectionHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @SubSectionHeadingFont	{  Bold				}
    named @SubSectionHeadingBreak	{  ragged 1.2fx nohyphen	}
    named @SubSectionHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @SubSubSectionHeadingFont	{  Slope			}
    named @SubSubSectionHeadingBreak	{  ragged 1.2fx nohyphen	}
    named @SubSubSectionHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @AppendixHeadingFont		{  Bold 2.00f			}
    named @AppendixHeadingBreak		{  ragged 1.2fx nohyphen   	}
    named @AppendixHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @SubAppendixHeadingFont	{  Bold				}
    named @SubAppendixHeadingBreak	{  ragged 1.2fx nohyphen   	}
    named @SubAppendixHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @SubSubAppendixHeadingFont	{  Slope			}
    named @SubSubAppendixHeadingBreak	{  ragged 1.2fx nohyphen   	}
    named @SubSubAppendixHeadingFormat
	left number right title		{  number @DotSep title    	}

    named @AbovePartGap			{  4.00f			}
    named @AboveChapterGap		{  3.00f			}
    named @SubPrefaceGap		{  2.0v  @OrIfPlain 3f		}
    named @SubIntroductionGap		{  2.0v  @OrIfPlain 3f		}
    named @SectionGap			{  2.0v  @OrIfPlain 3f		}
    named @SubSectionGap		{  1.5v  @OrIfPlain 2f		}
    named @SubSubSectionGap		{  1.5v  @OrIfPlain 2f		}
    named @SubAppendixGap		{  2.0v  @OrIfPlain 3f		}
    named @SubSubAppendixGap		{  1.5v  @OrIfPlain 2f		}

    named @PrefaceInContents		{  Yes 				}
    named @SubPrefaceInContents		{  No 				}
    named @AbbreviationsInContents	{  Yes				}
    named @IntroductionInContents	{  Yes				}
    named @SubIntroductionInContents	{  No				}
    named @PartInContents		{  Yes				}
    named @ChapterInContents		{  Yes				}
    named @SectionInContents		{  Yes				}
    named @SubSectionInContents		{  Yes				}
    named @SubSubSectionInContents	{  No				}
    named @AppendixInContents		{  Yes				}
    named @SubAppendixInContents	{  Yes				}
    named @SubSubAppendixInContents	{  No				}
    named @ReferencesInContents		{  Yes				}
    named @GlossaryInContents		{  Yes				}
    named @IndexInContents		{  Yes				}
    named @IndexAInContents		{  Yes				}
    named @IndexBInContents		{  Yes				}
    named @ColophonInContents		{  Yes				}

    named @PrefaceContentsIndent	{  0f 				}
    named @SubPrefaceContentsIndent	{  3f 				}
    named @AbbreviationsContentsIndent	{  0f				}
    named @IntroductionContentsIndent	{  0f				}
    named @SubIntroductionContentsIndent{  3f				}
    named @PartContentsIndent		{  0.5rt			}
    named @ChapterContentsIndent	{  0f				}
    named @SectionContentsIndent	{  3f				}
    named @SubSectionContentsIndent	{  6f				}
    named @SubSubSectionContentsIndent	{  9f				}
    named @AppendixContentsIndent	{  0f				}
    named @SubAppendixContentsIndent	{  3f				}
    named @SubSubAppendixContentsIndent	{  6f				}
    named @ReferencesContentsIndent	{  0f				}
    named @GlossaryContentsIndent	{  0f				}
    named @IndexContentsIndent		{  0f				}
    named @IndexAContentsIndent		{  0f				}
    named @IndexBContentsIndent		{  0f				}
    named @ColophonContentsIndent	{  0f				}

    named @SubPrefaceNumInTheorems	{  No				}
    named @SubIntroductionNumInTheorems	{  No				}
    named @ChapterNumInTheorems		{  Yes				}
    named @SectionNumInTheorems		{  No				}
    named @SubSectionNumInTheorems	{  No				}
    named @SubSubSectionNumInTheorems	{  No				}
    named @AppendixNumInTheorems	{  Yes				}
    named @SubAppendixNumInTheorems	{  No				}
    named @SubSubAppendixNumInTheorems	{  No				}

    named @SubPrefaceNumInDisplays	{  No				}
    named @SubIntroductionNumInDisplays	{  No				}
    named @ChapterNumInDisplays		{  Yes				}
    named @SectionNumInDisplays		{  Yes				}
    named @SubSectionNumInDisplays	{  No				}
    named @SubSubSectionNumInDisplays	{  No				}
    named @AppendixNumInDisplays	{  Yes				}
    named @SubAppendixNumInDisplays	{  Yes				}
    named @SubSubAppendixNumInDisplays	{  No				}

    named @SubPrefaceNumInFigures	{  No				}
    named @SubIntroductionNumInFigures	{  No				}
    named @ChapterNumInFigures		{  Yes				}
    named @SectionNumInFigures		{  No				}
    named @SubSectionNumInFigures	{  No				}
    named @SubSubSectionNumInFigures	{  No				}
    named @AppendixNumInFigures		{  Yes				}
    named @SubAppendixNumInFigures	{  No				}
    named @SubSubAppendixNumInFigures	{  No				}

    named @SubPrefaceNumInTables	{  No				}
    named @SubIntroductionNumInTables	{  No				}
    named @ChapterNumInTables		{  Yes				}
    named @SectionNumInTables		{  No				}
    named @SubSectionNumInTables	{  No				}
    named @SubSubSectionNumInTables	{  No				}
    named @AppendixNumInTables		{  Yes				}
    named @SubAppendixNumInTables	{  No				}
    named @SubSubAppendixNumInTables	{  No				}

    named @SubPrefaceNumInFloaters	{  No				}
    named @SubIntroductionNumInFloaters	{  No				}
    named @ChapterNumInFloaters		{  Yes				}
    named @SectionNumInFloaters		{  No				}
    named @SubSectionNumInFloaters	{  No				}
    named @SubSubSectionNumInFloaters	{  No				}
    named @AppendixNumInFloaters	{  Yes				}
    named @SubAppendixNumInFloaters	{  No				}
    named @SubSubAppendixNumInFloaters	{  No				}

    named @SubPrefaceNumInRunners	{  No				}
    named @SubIntroductionNumInRunners	{  No				}
    named @SectionNumInRunners		{  Yes				}
    named @SubSectionNumInRunners	{  No				}
    named @SubSubSectionNumInRunners	{  No				}
    named @SubAppendixNumInRunners	{  Yes				}
    named @SubSubAppendixNumInRunners	{  No				}

    named @PrefacePrefix		{				}
    named @ContentsPrefix		{				}
    named @FigureContentsPrefix		{				}
    named @TableContentsPrefix		{				}
    named @FloaterContentsPrefix	{				}
    named @AbbreviationsPrefix		{				}
    named @IntroductionPrefix		{				}
    named @ChapterPrefix		{				}
    named @AppendixPrefix		{				}
    named @ReferencesPrefix		{				}
    named @GlossaryPrefix		{				}
    named @IndexPrefix			{				}
    named @IndexAPrefix			{				}
    named @IndexBPrefix			{				}
    named @ColophonPrefix		{				}

@Begin

    #######################################################################
    #                                                                     #
    #  Lists of chapters, sections, sub(-sub)sections, and appendices.    #
    #                                                                     #
    #######################################################################

    export num
    def @ChapterList named @Tag {} right num
    {
	    @Galley
        //  @ChapterList @Next num
    }

    export num
    def @SubPrefaceList named @Tag {} right num
    {
	@Galley
        //@SubPrefaceGap	@SubPrefaceList @Next num
    }

    export num
    def @SubIntroductionList named @Tag {} right num
    {
	@Galley
        //@SubIntroductionGap	@SubIntroductionList @Next num
    }

    export num
    def @SectionList named @Tag {} right num
    {
	@Galley
        //@SectionGap	@SectionList @Next num
    }

    export num
    def @SubSectionList named @Tag {} right num
    {
	@Galley
        //@SubSectionGap    @SubSectionList @Next num
    }

    export num
    def @SubSubSectionList named @Tag {} right num
    {
	@Galley
        //@SubSubSectionGap @SubSubSectionList @Next num
    }

    export num
    def @AppendixList named @Tag {} right num
    {
	@Galley
        //	@AppendixList @Next num
    }

    export num
    def @SubAppendixList named @Tag {} right num
    {
	@Galley
        //@SubAppendixGap   @SubAppendixList @Next num
    }

    export num
    def @SubSubAppendixList named @Tag {} right num
    {
	@Galley
        //@SubSubAppendixGap   @SubSubAppendixList @Next num
    }

    def @PrefacePlace { @Galley }
    def @AbbreviationsPlace { @Galley }
    def @IntroductionPlace { @Galley }


    #######################################################################
    #                                                                     #
    #  @Full - this sends text to a full-width place on a new page, even  #
    #  if @ChapterStartPages is SamePage.                                 #
    #                                                                     #
    #######################################################################

    def @Full right x
    {
	def @Any  force into { @FullPlace&&following     } right x { x }
	def @Odd  force into { @OddFullPlace&&following  } right x { x }
	def @Even force into { @EvenFullPlace&&following } right x { x }

	@ChapterStartPages @Case {
	    { Any SamePage } @Yield @Any  x
	    Odd  @Yield @Odd  x
	    Even @Yield @Even x
	}
    }


    #######################################################################
    #                                                                     #
    #  @ChapterFull - this sends text to a full-width place on a new      #
    #  page, unless @ChapterStartPages is SamePage, in which case it      #
    #  doesn't send the text anywhere.                                    #
    #                                                                     #
    #######################################################################

    def @ChapterFull right x
    {
	def @Any  force into { @FullPlace&&following     } right x { x }
	def @Odd  force into { @OddFullPlace&&following  } right x { x }
	def @Even force into { @EvenFullPlace&&following } right x { x }

	@ChapterStartPages @Case {
	    Any  @Yield @Any  x
	    Odd  @Yield @Odd  x
	    Even @Yield @Even x
	    SamePage @Yield x
	}
    }


    #######################################################################
    #                                                                     #
    #  @IntroFull - this sends text to a full-width intro place.          #
    #                                                                     #
    #######################################################################

    def @IntroFull right x
    {
	def @Any  force into { @IntroFullPlace&&following     } right x { x }
	def @Odd  force into { @IntroOddFullPlace&&following  } right x { x }
	def @Even force into { @IntroEvenFullPlace&&following } right x { x }

	@ChapterStartPages @Case {
	    { Any SamePage } @Yield @Any  x
	    Odd  @Yield @Odd  x
	    Even @Yield @Even x
	}
    }


    #######################################################################
    #                                                                     #
    #  @ChooseFull - this sends either to introfull or ordinary full      #
    #                                                                     #
    #######################################################################

    def @ChooseFull right x
    {
	@SeparateIntroNumbering @Case {
	    No  @Yield @Full x
	    Yes @Yield @IntroFull x
	}
    }


    #######################################################################
    #                                                                     #
    #  Book.                                                              #
    #                                                                     #
    #######################################################################

    def @Book
	named @Tag {}
        named @Title {}
        named @Author {}
        named @Edition {}
        named @Publisher {}
        named @BeforeTitlePage {}
        named @OnTitlePage {}
        named @AfterTitlePage {}
        named @AtEnd { dft }
        named @InitialFont { @InitialFont }
        named @InitialBreak { @InitialBreak }
        named @InitialOutdent { @InitialOutdent }
        named @InitialSpace { @InitialSpace }
        named @InitialLanguage { @InitialLanguage }
        named @PageOrientation { @PageOrientation }
        named @PageHeaders { @PageHeaders }
        named @ColumnNumber { @ColumnNumber }
        named @FirstPageNumber { @FirstPageNumber }
        named @IntroFirstPageNumber { @IntroFirstPageNumber }
	named @OptimizePages { @OptimizePages }
	named @GlossaryText { @GlossaryText }
	named @IndexText { @IndexText }
	named @IndexAText { @IndexAText }
	named @IndexBText { @IndexBText }
    {
	def @Before
	{
	    @BeforeTitlePage @Case {
		""   @Yield @Null
		else @Yield @BeforeTitlePage
	    }
	}

	def @On
	{
	    @OnTitlePage @Case {
		"" @Yield {
		    	//1i    |0.5rt 2.5f @Font {1.2fx clines} @Break @Title |
			//2i    |0.5rt clines @Break @Author |
			//1i    |0.5rt clines @Break @Edition |
			//1rt   @OneRow @Publisher
		}
		else @Yield @OnTitlePage
	    }
	}

	def @After
	{
	    @AfterTitlePage @Case {
		""   @Yield @Null
		else @Yield  { @AfterTitlePage // None @Runner }
	    }
	}

	def @ContentsPart
	    named @Tag {}
	{

	    @LargeScaleStructure
		tag { @Tag }
		type { ExtraMajorIntro }
		initiallanguage { @InitialLanguage }
		title { contents @WordVal @ContentsWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		incontents { No }
		pnprefix { @ContentsPrefix }
		inrunners { Yes }
		majortitle { contents @WordVal @ContentsWord }
		sendheader { @ChooseFull @Body }
		innergap { @SectionGap }
		@ContentsSection
	}

	def @FigureContentsPart
	    named @Tag {}
	{
	    @LargeScaleStructure
		tag { @Tag }
		type { ExtraMajorIntro }
		initiallanguage { @InitialLanguage }
		title { figurelist @WordVal @FigureListWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		incontents { No }
		pnprefix { @FigureContentsPrefix }
		inrunners { Yes }
		majortitle { figurelist @WordVal @FigureListWord }
		sendheader { @ChooseFull @Body }
		innergap { @SectionGap }
		@FigureContentsSection
	}

	def @TableContentsPart
	    named @Tag {}
	{
	    @LargeScaleStructure
		tag { @Tag }
		type { ExtraMajorIntro }
		initiallanguage { @InitialLanguage }
		title { tablelist @WordVal @TableListWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		incontents { No }
		pnprefix { @TableContentsPrefix }
		inrunners { Yes }
		majortitle { tablelist @WordVal @TableListWord }
		sendheader { @ChooseFull @Body }
		innergap { @SectionGap }
		@TableContentsSection
	}

	def @FloaterContentsPart
	    named @Tag {}
	{
	    @LargeScaleStructure
		tag { @Tag }
		type { ExtraMajorIntro }
		initiallanguage { @InitialLanguage }
		title { floaterlist @WordVal @FloaterListWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		incontents { No }
		pnprefix { @FloaterContentsPrefix }
		inrunners { Yes }
		majortitle { floaterlist @WordVal @FloaterListWord }
		sendheader { @ChooseFull @Body }
		innergap { @SectionGap }
		@FloaterContentsSection
	}

	def @ReferencesPart
	    named @Tag {}
	{
	    @LargeScaleStructure
		tag { @Tag }
		type { ExtraMajor }
		initiallanguage { @InitialLanguage }
		title { @RefHeading @RefListTitle }
		majortitle { @RefHeading @RefListTitle }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		incontents { @ReferencesInContents }
		contentsindent { @ReferencesContentsIndent }
		pnprefix { @ReferencesPrefix }
		inrunners { Yes }
		sendheader { @ChapterFull @Body }
		innergap { @SectionGap }
		@ReferencesSection

	}

	def @GlossaryPart
	    named @Tag {}
	{
	    def @Run
	    {
		NonStart @Runner
		    @MajorNum {}
		    @MajorTitle { glossary @WordVal @GlossaryWord }
		    @MinorNum {}
		    @MinorTitle { glossary @WordVal @GlossaryWord }
		    @Owner { @Tag }
		    @Prefix { @GlossaryPrefix }
	    }

	    @LargeScaleStructure
		tag { @Tag }
		type { Major }
		initiallanguage { @InitialLanguage }
		title { glossary @WordVal @GlossaryWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		headingtext { @GlossaryText }
		incontents { @GlossaryInContents }
		contentsindent { @GlossaryContentsIndent }
		pnprefix { @GlossaryPrefix }
		inrunners { Yes }
		sendheader { @Full @Body }
		innergap { @SectionGap }
		wantindefinite { Yes }
		@GlossarySection @Run
	}

	def @IndexPart
	    named @Tag {}
	{
	    def @Run
	    {
		NonStart @Runner
		    @MajorNum {}
		    @MajorTitle { index @WordVal @IndexWord }
		    @MinorNum {}
		    @MinorTitle { index @WordVal @IndexWord }
		    @Owner { @Tag }
		    @Prefix { @IndexPrefix }
	    }

	    @LargeScaleStructure
		tag { @Tag }
		type { Major }
		initiallanguage { @InitialLanguage }
		title { index @WordVal @IndexWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		headingtext { @IndexText }
		incontents { @IndexInContents }
		contentsindent { @IndexContentsIndent }
		pnprefix { @IndexPrefix }
		inrunners { Yes }
		sendheader { @Full @Body }
		innergap { @SectionGap }
		wantindefinite { Yes }
		@IndexSection @Run
	}

	def @IndexAPart
	    named @Tag {}
	{
	    def @RunA
	    {
		NonStart @Runner
		    @MajorNum {}
		    @MajorTitle { index @WordVal @IndexAWord }
		    @MinorNum {}
		    @MinorTitle { index @WordVal @IndexAWord }
		    @Owner { @Tag }
		    @Prefix { @IndexAPrefix }
	    }

	    @LargeScaleStructure
		tag { @Tag }
		type { Major }
		initiallanguage { @InitialLanguage }
		title { index @WordVal @IndexAWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		headingtext { @IndexAText }
		incontents { @IndexAInContents }
		contentsindent { @IndexAContentsIndent }
		pnprefix { @IndexAPrefix }
		inrunners { Yes }
		sendheader { @Full @Body }
		innergap { @SectionGap }
		wantindefinite { Yes }
		@IndexASection @RunA
	}

	def @IndexBPart
	    named @Tag {}
	{
	    def @RunB
	    {
		NonStart @Runner
		    @MajorNum {}
		    @MajorTitle { index @WordVal @IndexBWord }
		    @MinorNum {}
		    @MinorTitle { index @WordVal @IndexBWord }
		    @Owner { @Tag }
		    @Prefix { @IndexBPrefix }
	    }

	    @LargeScaleStructure
		tag { @Tag }
		type { Major }
		initiallanguage { @InitialLanguage }
		title { index @WordVal @IndexBWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		headingtext { @IndexBText }
		incontents { @IndexBInContents }
		contentsindent { @IndexBContentsIndent }
		pnprefix { @IndexBPrefix }
		inrunners { Yes }
		sendheader { @Full @Body }
		innergap { @SectionGap }
		wantindefinite { Yes }
		@IndexBSection @RunB
	}

	def @ColophonPart
	    named @Tag {}
	{
	    def @RunC
	    {
		NonStart @Runner
		    @MajorNum {}
		    @MajorTitle { index @WordVal @ColophonWord }
		    @MinorNum {}
		    @MinorTitle { index @WordVal @ColophonWord }
		    @Owner { @Tag }
		    @Prefix { @ColophonPrefix }
	    }

	    @LargeScaleStructure
		tag { @Tag }
		type { Major }
		initiallanguage { @InitialLanguage }
		title { colophon @WordVal @ColophonWord }
		aboveheadinggap { @AboveChapterGap }
		headingfont { @ChapterHeadingFont }
		headingbreak { @ChapterHeadingBreak }
		headingformat { @Num @ChapterHeadingFormat @Body }
		incontents { @ColophonInContents }
		contentsindent { @ColophonContentsIndent }
		pnprefix { @ColophonPrefix }
		inrunners { Yes }
		sendheader { @Full @Body }
		innergap { @SectionGap }
		wantindefinite { Yes }
		@ColophonSection @RunC
	}

        def @BookIntro force into { @IntroColPlace&&preceding }
	    named @Optimize { @OptimizePages }
        {
		    @NoLinkPageMark @Tag
	    //	    @Before
            //1.1b  @TitlePageFont @Font @On
            //1.1b  @After
            //	    Start @Runner @Owner { @Tag }
            //1.1b  @PrefaceAfterContents @NoDo @PrefacePlace
            //      @MakeContents @Case {
			{ Yes Bypass }	@Yield @ContentsPart
			else		@Yield @Null
		    }
            //      @MakeFigureContents @Case {
			{ Yes Bypass }	@Yield @FigureContentsPart
			else		@Yield @Null
		    }
            //      @MakeTableContents @Case {
			{ Yes Bypass }	@Yield @TableContentsPart
			else		@Yield @Null
		    }
            //      @MakeFloaterContents @Case {
			{ Yes Bypass }	@Yield @FloaterContentsPart
			else		@Yield @Null
		    }
            //1.1b  @PrefaceAfterContents @Do @PrefacePlace
        }

        def @BookBody force into { @ColPlace&&preceding }
	    named @Optimize { @OptimizePages }
        {
	    # The first component of @BookBody must be indefinite, so that
	    # its flushing is delayed until we reach the body galleys, either
	    # @Introduction or @Chapter.  If not, @BookBody will free up
	    # @PrefacePlace etc. too soon, producing a "no @PrefacePlace
	    # precedes this @PrefacePlace&&preceding" error message.

	        @AbbreviationsPlace
	    //  @IntroductionPlace
	    //	@ChapterList @FirstChapterNumber
	    //	@ReferencesBeforeAppendices @Do {
		    @MakeReferences @Do @ReferencesPart
		}
            //	@AppendixList @FirstAppendixNumber
	    //	@ReferencesBeforeAppendices @NoDo {
		    @MakeReferences @Do @ReferencesPart
		}
	    //	@MakeGlossary @Do @GlossaryPart
	    //	@MakeIndexA @Do @IndexAPart
	    //  @MakeIndexA @Case {
		  Bypass  @Yield @BypassBeginIndexAPlace
		  else    @Yield @Null
		}
	    //	@MakeIndexB @Do @IndexBPart
	    //  @MakeIndexB @Case {
		  Bypass  @Yield @BypassBeginIndexBPlace
		  else    @Yield @Null
		}
	    //	@MakeIndex  @Do @IndexPart
	    //  @MakeIndex @Case {
		  Bypass  @Yield @BypassBeginIndexPlace
		  else    @Yield @Null
		}
            //  @MakeColophon @Do @ColophonPart
        }

	def @BookCombined force into { @ColPlace&&preceding }
	    named @Optimize { @OptimizePages }
	{
		    @NoLinkPageMark @Tag
	    //	    @Before
            //1.1b  @TitlePageFont @Font @On
            //1.1b  @After
            //	    Start @Runner @Owner { @Tag }
            //1.1b  @PrefaceAfterContents @NoDo @PrefacePlace
            //      @MakeContents @Case {
			{ Yes Bypass }	@Yield @ContentsPart
			else		@Yield @Null
		    }
            //      @MakeFigureContents @Case {
			{ Yes Bypass }	@Yield @FigureContentsPart
			else		@Yield @Null
		    }
            //      @MakeTableContents @Case {
			{ Yes Bypass }	@Yield @TableContentsPart
			else		@Yield @Null
		    }
            //      @MakeFloaterContents @Case {
			{ Yes Bypass }	@Yield @FloaterContentsPart
			else		@Yield @Null
		    }
            //1.1b  @PrefaceAfterContents @Do @PrefacePlace
	    //  @AbbreviationsPlace
	    //  @IntroductionPlace
	    //	@ChapterList @FirstChapterNumber
	    //	@ReferencesBeforeAppendices @Do {
		    @MakeReferences @Do @ReferencesPart
		}
            //	@AppendixList @FirstAppendixNumber
	    //	@ReferencesBeforeAppendices @NoDo {
		    @MakeReferences @Do @ReferencesPart
		}
	    //	@MakeGlossary @Do @GlossaryPart
	    //	@MakeIndexA @Do @IndexAPart
	    //  @MakeIndexA @Case {
		  Bypass  @Yield @BypassBeginIndexAPlace
		  else    @Yield @Null
		}
	    //	@MakeIndexB @Do @IndexBPart
	    //  @MakeIndexB @Case {
		  Bypass  @Yield @BypassBeginIndexBPlace
		  else    @Yield @Null
		}
	    //	@MakeIndex  @Do @IndexPart
	    //  @MakeIndex @Case {
		  Bypass  @Yield @BypassBeginIndexPlace
		  else    @Yield @Null
		}
            //  @MakeColophon @Do @ColophonPart
	}

        @InitialFont @Font { @InitialBreak setoutdent @InitialOutdent } @Break
	@InitialLanguage @Language @InitialSpace @Space
	{ @ColourCommand @InitialColour } @SetColour
        {

	    @SeparateIntroNumbering @Case {

		No  @Yield {
		        Yes @BeginAllCounters {}
		    //  Yes @BeginDisplayCounter {}
		    //  Yes @BeginFigureCounter {}
		    //  Yes @BeginTableCounter {}
		    //  Yes @BeginFloaterCounter {}
		    //	@PageList
			    @ColumnNumber { @ColumnNumber }
			    @PageHeaders { @PageHeaders }
			    @Orient { @PageOrientation }
			    @FirstPageNumber
		    //	@BookCombined
		    //	NonStart @Runner @Owner { @Tag }
		    //  @AtEnd @Case {
			    dft @Yield @Null
			    else @Yield
				 @EvenPage @Orient { @PageOrientation } @AtEnd
			}
		}

		Yes @Yield {
		        Yes @BeginAllCounters {}
		    //  Yes @BeginDisplayCounter {}
		    //  Yes @BeginFigureCounter {}
		    //  Yes @BeginTableCounter {}
		    //  Yes @BeginFloaterCounter {}
		    //  @IntroPageList
			    @ColumnNumber { 1 }
			    @PageHeaders { @PageHeaders }
			    @Orient { @PageOrientation }
			    @IntroFirstPageNumber
		    # //	NonStart @Runner @Owner { @Tag }
		    //	None @Runner @Owner { @Tag }
		    //	@PageList
			    @ColumnNumber { @ColumnNumber }
			    @PageHeaders { @PageHeaders }
			    @Orient { @PageOrientation }
			    extra { Yes }
			    @FirstPageNumber
		    //	@BookIntro
		    //	@BookBody
		    //	NonStart @Runner @Owner { @Tag }
		    //  @AtEnd @Case {
			    dft @Yield @Null
			    else @Yield
				 @EvenPage @Orient { @PageOrientation } @AtEnd
			}
		}
	    }
        }
    }


    #######################################################################
    #                                                                     #
    #  Preface.                                                           #
    #                                                                     #
    #######################################################################

    export @BeginSubPrefaces @EndSubPrefaces @SubPreface
    def @Preface force into { @PrefacePlace&&preceding }
        named @Tag {}
        named @Title { preface @WordVal @PrefaceWord }
        named @RunningTitle { dft }
	named @InitialLanguage {}
        body @Body
    {
        def @EndSubPrefacesPlace { @Galley }

        def @EndSubPrefaces force into { @EndSubPrefacesPlace&&preceding }
	{}

        macro @BeginSubPrefaces
	{   //@SubPrefaceGap @SubPrefaceList @FirstSubPrefaceNumber
	    // @EndSubPrefacesPlace //
	}

        def @SubPreface force into { @SubPrefaceList&&preceding }
            named @Tag {}
            named @Title {}
            named @RunningTitle { dft }
	    named @InitialLanguage { @InitialLanguage }
	    named @BypassNumber { dft }
	    named @NewPage { No }
            body @Body
        {

	    def @SubPrefaceShortNum
	    {
		@SubPrefaceNumbers @Then {
		    @BypassNumber @Dft {
			@SubPrefaceNumbers @Num
			{ @SectionList&&@Tag @Open { num } }
		    }
		}
	    }

	    @LargeScaleStructure
		tag { @Tag }
		type { Minor }
		initiallanguage { @InitialLanguage }
		title { @Title }
		runningtitle { @RunningTitle }
		headingfont { @SubPrefaceHeadingFont }
		headingbreak { @SubPrefaceHeadingBreak }
		headingformat { @Num @SubPrefaceHeadingFormat @Body }
		incontents { @SubPrefaceInContents }
		contentsindent { @SubPrefaceContentsIndent }
		numbers { @SubPrefaceNumbers }
		attachnum { @SubPrefaceList&&preceding @Tagged @Tag }
		retrievenum { @SubPrefaceList&&@Tag @Open { num } }
		bypassnumber { @BypassNumber }
		prefix { @Null }
		majornum { @Null }
		majortitle { @Null }
		intheorems { @SubPrefaceNumInTheorems }
		indisplays { @SubPrefaceNumInDisplays }
		infigures { @SubPrefaceNumInFigures }
		intables { @SubPrefaceNumInTables }
		infloaters { @SubPrefaceNumInFloaters }
		inrunners { @SubPrefaceNumInRunners }
		newpage { @NewPage }
		@Body
        }

	@LargeScaleStructure
	    tag { @Tag }
	    type { ExtraMajorIntro }
	    initiallanguage { @InitialLanguage }
	    title { @Title }
	    runningtitle { @RunningTitle }
	    aboveheadinggap { @AboveChapterGap }
	    headingfont { @ChapterHeadingFont }
	    headingbreak { @ChapterHeadingBreak }
	    headingformat { @Num @ChapterHeadingFormat @Body }
	    incontents { @PrefaceInContents }
	    contentsindent { @PrefaceContentsIndent }
	    pnprefix { @PrefacePrefix }
	    sendheader { @ChooseFull @Body }
	    innergap { @SectionGap }
	    inrunners { Yes }
	    @Body

    }


    #######################################################################
    #                                                                     #
    #  Abbreviations.                                                     #
    #                                                                     #
    #######################################################################

    def @Abbreviations force into { @AbbreviationsPlace&&preceding }
        named @Tag {}
        named @Title { abbreviations @WordVal @AbbreviationsWord }
        named @RunningTitle { dft }
	named @InitialLanguage {}
        body @Body
    {

	@LargeScaleStructure
	    tag { @Tag }
	    type { Major }
	    initiallanguage { @InitialLanguage }
	    title { @Title }
	    runningtitle { @RunningTitle }
	    aboveheadinggap { @AboveChapterGap }
	    headingfont { @ChapterHeadingFont }
	    headingbreak { @ChapterHeadingBreak }
	    headingformat { @Num @ChapterHeadingFormat @Body }
	    incontents { @AbbreviationsInContents }
	    contentsindent { @AbbreviationsContentsIndent }
	    pnprefix { @AbbreviationsPrefix }
	    sendheader { @Full @Body }
	    innergap { @SectionGap }
	    inrunners { Yes }
	    @Body

    }


    #######################################################################
    #                                                                     #
    #  Introduction.                                                      #
    #                                                                     #
    #######################################################################

    export @BeginSubIntroductions @EndSubIntroductions @SubIntroduction
    def @Introduction force into { @IntroductionPlace&&preceding }
        named @Tag {}
        named @Title { introduction @WordVal @IntroductionWord }
        named @RunningTitle { dft }
	named @InitialLanguage {}
        body @Body
    {

        def @EndSubIntroductionsPlace { @Galley }

        def @EndSubIntroductions force into { @EndSubIntroductionsPlace&&preceding }
	{}

        macro @BeginSubIntroductions
	{   //@SubIntroductionGap @SubIntroductionList @FirstSubIntroductionNumber
	    // @EndSubIntroductionsPlace //
	}

        def @SubIntroduction force into { @SubIntroductionList&&preceding }
            named @Tag {}
            named @Title {}
            named @RunningTitle { dft }
	    named @InitialLanguage { @InitialLanguage }
	    named @BypassNumber { dft }
	    named @NewPage { No }
            body @Body
        {

	    def @SubIntroductionShortNum
	    {
		@SubIntroductionNumbers @Then {
		    @BypassNumber @Dft {
			@SubIntroductionNumbers @Num
			{ @SectionList&&@Tag @Open { num } }
		    }
		}
	    }

	    @LargeScaleStructure
		tag { @Tag }
		type { Minor }
		initiallanguage { @InitialLanguage }
		title { @Title }
		runningtitle { @RunningTitle }
		headingfont { @SubIntroductionHeadingFont }
		headingbreak { @SubIntroductionHeadingBreak }
		headingformat { @Num @SubIntroductionHeadingFormat @Body }
		incontents { @SubIntroductionInContents }
		contentsindent { @SubIntroductionContentsIndent }
		numbers { @SubIntroductionNumbers }
		attachnum { @SubIntroductionList&&preceding @Tagged @Tag }
		retrievenum { @SubIntroductionList&&@Tag @Open { num } }
		bypassnumber { @BypassNumber }
		prefix { @Null }
		majornum { @Null }
		majortitle { @Null }
		intheorems { @SubIntroductionNumInTheorems }
		indisplays { @SubIntroductionNumInDisplays }
		infigures { @SubIntroductionNumInFigures }
		intables { @SubIntroductionNumInTables }
		infloaters { @SubIntroductionNumInFloaters }
		inrunners { @SubIntroductionNumInRunners }
		newpage { @NewPage }
		@Body
        }

	@LargeScaleStructure
	    tag { @Tag }
	    type { Major }
	    initiallanguage { @InitialLanguage }
	    title { @Title }
	    runningtitle { @RunningTitle }
	    aboveheadinggap { @AboveChapterGap }
	    headingfont { @ChapterHeadingFont }
	    headingbreak { @ChapterHeadingBreak }
	    headingformat { @Num @ChapterHeadingFormat @Body }
	    incontents { @IntroductionInContents }
	    contentsindent { @IntroductionContentsIndent }
	    pnprefix { @IntroductionPrefix }
	    sendheader { @Full @Body }
	    innergap { @SectionGap }
	    inrunners { Yes }
	    @Body
    }


    #######################################################################
    #                                                                     #
    #  Chapters containing sections and subsections.                      #
    #                                                                     #
    #######################################################################

    export @BeginSections @EndSections @Section
    def @Chapter force into { @ChapterList&&preceding }
        named @Tag {}
        named @Title {}
        named @RunningTitle { dft }
	named @InitialLanguage {}
	named @PartNumber {}
	named @PartTitle {}
	named @PartText {}
        named @BypassNumber { dft }
	named @BypassWord { dft }
        body @Body
    {

        def @EndSectionsPlace { @Galley }

        def @EndSections force into { @EndSectionsPlace&&preceding }
	{}

        macro @BeginSections
	{   //@SectionGap @SectionList @FirstSectionNumber
	    // @EndSectionsPlace //
	}

	def @ChapterShortNum
	{
	    @ChapterNumbers @Then {
		@BypassNumber @Dft {
		    @ChapterNumbers @Num @ChapterList&&@Tag @Open { num }
		}
	    }
	}

	def @MajorNum
	{
	    @ChapterNumbers @Then @InitialLanguage @Language {
               # chapter @WordVal @ChapterWord @ChapterShortNum
	       @BypassWord @Dft {chapter @WordVal @ChapterWord} @ChapterShortNum
	    }
	}

	def @MajorTitle
	{
	    @InitialLanguage @Language {
		@RunningTitle @Dft @Title
	    }
	}

        export @BeginSubSections @EndSubSections @SubSection
        def @Section force into { @SectionList&&preceding }
            named @Tag {}
            named @Title {}
            named @RunningTitle { dft }
	    named @InitialLanguage { @InitialLanguage }
	    named @BypassNumber { dft }
	    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 {
			@ChapterShortNum @Join @SectionNumbers @Num
			{ @SectionList&&@Tag @Open { num } }
		    }
		}
	    }

	    export @BeginSubSubSections @EndSubSubSections @SubSubSection
            def @SubSection force into { @SubSectionList&&preceding }
		named @Tag {}
		named @Title {}
		named @RunningTitle { dft }
		named @InitialLanguage { @InitialLanguage }
		named @BypassNumber { dft }
		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 { @MajorNum }
			majortitle { @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 { @MajorNum }
		    majortitle { @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 } }
		bypassnumber { @BypassNumber }
		prefix { @ChapterShortNum }
		majornum { @MajorNum }
		majortitle { @MajorTitle }
		intheorems { @SectionNumInTheorems }
		indisplays { @SectionNumInDisplays }
		infigures { @SectionNumInFigures }
		intables { @SectionNumInTables }
		infloaters { @SectionNumInFloaters }
		inrunners { @SectionNumInRunners }
		newpage { @NewPage }
		@Body

        }

	def @Part
	    named @Tag {}
	{
	    @LargeScaleStructure
	        type { VeryMajor }
		initiallanguage { @InitialLanguage }
		title { @PartTitle }
		aboveheadinggap { @AbovePartGap }
		headingfont { @PartHeadingFont }
		headingbreak { @PartHeadingBreak }
		headingformat { @Num @PartHeadingFormat @Body }
		bypassnumber { @PartNumber }
		incontents { @PartInContents }
		contentsindent { @PartContentsIndent }
		sendheader { @Full @Body }
		inrunners { Yes }
		tag { @Tag }
		@PartText
	}

	@PartNumber @Case {
	    ""   @Yield {
		 @PartTitle @Case {
		     "" @Yield @Null
		     else @Yield @Part
		 }
	    }
	    else @Yield @Part
	}
	//
	@LargeScaleStructure
	    tag { @Tag }
	    type { Major }
	    initiallanguage { @InitialLanguage }
	    title { @Title }
	    runningtitle { @RunningTitle }
	    aboveheadinggap { @AboveChapterGap }
	    headingfont { @ChapterHeadingFont }
	    headingbreak { @ChapterHeadingBreak }
	    headingformat { @Num @ChapterHeadingFormat @Body }
	    incontents { @ChapterInContents }
	    contentsindent { @ChapterContentsIndent }
            # word { chapter @WordVal @ChapterWord }
	    word { @BypassWord @Dft { chapter @WordVal @ChapterWord } }
	    numbers { @ChapterNumbers }
	    attachnum { @ChapterList&&preceding @Tagged @Tag }
	    retrievenum { @ChapterList&&@Tag @Open { num } }
	    bypassnumber { @BypassNumber }
	    pnprefix { @ChapterPrefix }
	    intheorems { @ChapterNumInTheorems }
	    indisplays { @ChapterNumInDisplays }
	    infigures { @ChapterNumInFigures }
	    intables { @ChapterNumInTables }
	    infloaters { @ChapterNumInFloaters }
	    sendheader { @ChapterFull @Body }
	    innergap { @SectionGap }
	    inrunners { Yes }
	    @Body

    }


    #######################################################################
    #                                                                     #
    #  Appendices.                                                        #
    #                                                                     #
    #######################################################################

    export @BeginSubAppendices @EndSubAppendices @SubAppendix
    def @Appendix force into { @AppendixList&&preceding }
        named @Tag {}
        named @Title {}
        named @RunningTitle { dft }
	named @InitialLanguage {}
	named @PartNumber {}
	named @PartTitle {}
	named @PartText {}
        named @BypassNumber { dft }
        body @Body
    {

        def @EndSubAppendicesPlace { @Galley }

        def @EndSubAppendices force into { @EndSubAppendicesPlace&&preceding }
	{}

        macro @BeginSubAppendices
	{   //@SubAppendixGap @SubAppendixList @FirstSubAppendixNumber
	    // @EndSubAppendicesPlace //
	}

	def @AppendixShortNum
	{
	    @AppendixNumbers @Then {
		@BypassNumber @Dft {
		    @AppendixNumbers @Num @AppendixList&&@Tag @Open { num }
		}
	    }
	}

	def @MajorNum
	{
	    @AppendixNumbers @Then @InitialLanguage @Language {
		appendix @WordVal @AppendixWord @AppendixShortNum
	    }
	}

	def @MajorTitle
	{
	    @InitialLanguage @Language {
		@RunningTitle @Dft @Title
	    }
	}

        export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix
        def @SubAppendix force into { @SubAppendixList&&preceding }
            named @Tag {}
            named @Title {}
            named @RunningTitle { dft }
	    named @InitialLanguage { @InitialLanguage }
	    named @BypassNumber { dft }
	    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 { @MajorNum }
		    majortitle { @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 { @MajorNum }
		majortitle { @MajorTitle }
		intheorems { @SubAppendixNumInTheorems }
		indisplays { @SubAppendixNumInDisplays }
		infigures { @SubAppendixNumInFigures }
		intables { @SubAppendixNumInTables }
		infloaters { @SubAppendixNumInFloaters }
		inrunners { @SubAppendixNumInRunners }
		newpage { @NewPage }
		@Body

        }

	def @Part
	    named @Tag {}
	{
	    @LargeScaleStructure
	        type { VeryMajor }
		initiallanguage { @InitialLanguage }
		title { @PartTitle }
		aboveheadinggap { @AbovePartGap }
		headingfont { @PartHeadingFont }
		headingbreak { @PartHeadingBreak }
		headingformat { @Num @PartHeadingFormat @Body }
		bypassnumber { @PartNumber }
		incontents { @PartInContents }
		contentsindent { @PartContentsIndent }
		sendheader { @Full @Body }
		inrunners { Yes }
		tag { @Tag }
		@PartText
	}

	@PartNumber @Case {
	    ""   @Yield {
		 @PartTitle @Case {
		     "" @Yield @Null
		     else @Yield @Part
		 }
	    }
	    else @Yield @Part
	}
	//
	@LargeScaleStructure
	    tag { @Tag }
	    type { Major }
	    initiallanguage { @InitialLanguage }
	    title { @Title }
	    runningtitle { @RunningTitle }
	    aboveheadinggap { @AboveChapterGap }
	    headingfont { @AppendixHeadingFont }
	    headingbreak { @AppendixHeadingBreak }
	    headingformat { @Num @AppendixHeadingFormat @Body }
	    incontents { @AppendixInContents }
	    contentsindent { @AppendixContentsIndent }
	    word { appendix @WordVal @AppendixWord }
	    numbers { @AppendixNumbers }
	    attachnum { @AppendixList&&preceding @Tagged @Tag }
	    retrievenum { @AppendixList&&@Tag @Open { num } }
	    bypassnumber { @BypassNumber }
	    pnprefix { @AppendixPrefix }
	    intheorems { @AppendixNumInTheorems }
	    indisplays { @AppendixNumInDisplays }
	    infigures { @AppendixNumInFigures }
	    intables { @AppendixNumInTables }
	    infloaters { @AppendixNumInFloaters }
	    sendheader { @ChapterFull @Body }
	    innergap { @SubAppendixGap }
	    inrunners { Yes }
	    @Body

    }


    #######################################################################
    #                                                                     #
    #  Colophon.                                                          #
    #                                                                     #
    #######################################################################

    def @Colophon into { @ColophonList&&preceding }
        named @Tag {}
	named @InitialLanguage {}
        body @Body
    {

        @InitialLanguage @Language @Body

    }


@End @BookSetup