aboutsummaryrefslogblamecommitdiffstats
path: root/include/bookf
blob: f555e1f88725c34d3995c0e0fe5fc7c661af244d (plain) (tree)
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059



































































































































































































































                                                                           

                                                                           









                                                                           
                                           







                                                                           


                                                                           


                                                                           
                            
     


                                                                        




                                  
                             
















                                                                             
                                           





























































































































































                                                                                
                                                 







































































































                                                                  
                                        


























































                                                                             
                                        


































































































































































































































































































































































































































































                                                                                  
                                             





































































































































































































                                                                                        
                                             







                                        

###########################################################################
#                                                                         #
#  @BookSetup extension to @DocumentSetup.                                #
#                                                                         #
#  Jeffrey H. Kingston                                                    #
#  17 September 1999                                                      #
#                                                                         #
#  This package extends DocumentSetup with definitions for books.         #
#                                                                         #
###########################################################################

extend @BasicSetup @DocumentSetup
export @Book @Preface @Abbreviations @Introduction @Chapter @Appendix
def @BookSetup
    named @TitlePageFont		{  Helvetica Base		}
    named @SeparateIntroNumbering	{  Yes				}
    named @PrefaceAfterContents		{  No				}
    named @ChapterStartPages		{  Any				}
    named @ReferencesBeforeAppendices	{  No				}

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

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

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

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

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

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

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

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

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

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

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

    named @PrefaceInContents		{  No 				}
    named @AbbreviationsInContents	{  Yes				}
    named @IntroductionInContents	{  Yes				}
    named @PartInContents		{  Yes				}
    named @ChapterInContents		{  Yes				}
    named @SectionInContents		{  Yes				}
    named @SubSectionInContents		{  Yes				}
    named @SubSubSectionInContents	{  No				}
    named @AppendixInContents		{  Yes				}
    named @SubAppendixInContents	{  Yes				}
    named @SubSubAppendixInContents	{  No				}
    named @ReferencesInContents		{  Yes				}
    named @IndexInContents		{  Yes				}
    named @IndexAInContents		{  Yes				}
    named @IndexBInContents		{  Yes				}
    named @PartContentsIndent		{  0.5rt			}

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

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

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

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

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

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

@Begin

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

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

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

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

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

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

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

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

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


    #######################################################################
    #                                                                     #
    #  @Full - this sends text to a full-width place 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 @AtAfter { dft }
        named @InitialFont { @InitialFont }
        named @InitialBreak { @InitialBreak }
        named @InitialSpace { @InitialSpace }
        named @InitialLanguage { @InitialLanguage }
        named @PageOrientation { @PageOrientation }
        named @PageHeaders { @PageHeaders }
        named @ColumnNumber { @ColumnNumber }
        named @FirstPageNumber { @FirstPageNumber }
        named @IntroFirstPageNumber { @IntroFirstPageNumber }
	named @OptimizePages { @OptimizePages }
    {
	def @Before
	{
	    @BeforeTitlePage @Case {
		""   @Yield @Null
		else @Yield @BeforeTitlePage
	    }
	}

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

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

	def @ContentsPart
	    named @Tag {}
	{

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

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

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

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

	}

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

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

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

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

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

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

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

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

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

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

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

	    @SeparateIntroNumbering @Case {

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

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


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

    def @Preface force into { @PrefacePlace&&preceding }
        named @Tag {}
        named @Title { preface @WordVal @PrefaceWord }
        named @RunningTitle { dft }
	named @InitialLanguage {}
        body @Body
    {

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

    }


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

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

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

    }


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

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

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

    }


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

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

        def @EndSectionsPlace { @Galley }

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

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

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

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

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

        export @BeginSubSections @EndSubSections @SubSection
        def @Section force into { @SectionList&&preceding }
            named @Tag {}
            named @Title {}
            named @RunningTitle { dft }
	    named @InitialLanguage { @InitialLanguage }
	    named @BypassNumber { dft }
            body @Body
        {

            def @EndSubSectionsPlace { @Galley }

            def @EndSubSections force into { @EndSubSectionsPlace&&preceding }
	    {}

            macro @BeginSubSections
            {	//@SubSectionGap @SubSectionList @FirstSubSectionNumber
		// @EndSubSectionsPlace //
	    }

	    def @SectionShortNum
	    {
		@SectionNumbers @Then {
		    @BypassNumber @Dft {
			@ChapterShortNum @Join @SectionNumbers @Num
			{ @SectionList&&@Tag @Open { num } }
		    }
		}
	    }

	    export @BeginSubSubSections @EndSubSubSections @SubSubSection
            def @SubSection force into { @SubSectionList&&preceding }
		named @Tag {}
		named @Title {}
		named @RunningTitle { dft }
		named @InitialLanguage { @InitialLanguage }
		named @BypassNumber { dft }
		body @Body
            {

                def @EndSubSubSectionsPlace { @Galley }

                def @EndSubSubSections force into
		    { @EndSubSubSectionsPlace&&preceding }
		{}

                macro @BeginSubSubSections
                { //@SubSubSectionGap @SubSubSectionList @FirstSubSubSectionNumber
		  // @EndSubSubSectionsPlace //
		}

		def @SubSectionShortNum
		{
		    @SubSectionNumbers @Then {
			@BypassNumber @Dft {
			    @SectionShortNum @Join @SubSectionNumbers @Num
			    { @SubSectionList&&@Tag @Open { num } }
			}
		    }
		}

		def @SubSubSection force into { @SubSubSectionList&&preceding }
		    named @Tag {}
		    named @Title {}
		    named @RunningTitle { dft }
		    named @InitialLanguage { @InitialLanguage }
		    named @BypassNumber { dft }
		    body @Body
		{
                
		    @LargeScaleStructure
			tag { @Tag }
			type { Minor }
			initiallanguage { @InitialLanguage }
			title { @Title }
			runningtitle { @RunningTitle }
			headingfont { @SubSubSectionHeadingFont }
			headingbreak { @SubSubSectionHeadingBreak }
			headingformat { @Num @SubSubSectionHeadingFormat @Body }
			incontents { @SubSubSectionInContents }
			contentsindent { 9f }
			numbers { @SubSubSectionNumbers }
			attachnum { @SubSubSectionList&&preceding @Tagged @Tag }
			retrievenum { @SubSubSectionList&&@Tag @Open { num } }
			bypassnumber { @BypassNumber }
			prefix { @SubSectionShortNum }
			majornum { @MajorNum }
			majortitle { @MajorTitle }
			intheorems { @SubSubSectionNumInTheorems }
			indisplays { @SubSubSectionNumInDisplays }
			infigures { @SubSubSectionNumInFigures }
			intables { @SubSubSectionNumInTables }
			inrunners { @SubSubSectionNumInRunners }
			@Body
	        }

		@LargeScaleStructure
		    tag { @Tag }
		    type { Minor }
		    initiallanguage { @InitialLanguage }
		    title { @Title }
		    runningtitle { @RunningTitle }
		    headingfont { @SubSectionHeadingFont }
		    headingbreak { @SubSectionHeadingBreak }
		    headingformat { @Num @SubSectionHeadingFormat @Body }
		    incontents { @SubSectionInContents }
		    contentsindent { 6f }
		    numbers { @SubSectionNumbers }
		    attachnum { @SubSectionList&&preceding @Tagged @Tag }
		    retrievenum { @SubSectionList&&@Tag @Open { num } }
		    bypassnumber { @BypassNumber }
		    prefix { @SectionShortNum }
		    majornum { @MajorNum }
		    majortitle { @MajorTitle }
		    intheorems { @SubSectionNumInTheorems }
		    indisplays { @SubSectionNumInDisplays }
		    infigures { @SubSectionNumInFigures }
		    intables { @SubSectionNumInTables }
		    inrunners { @SubSectionNumInRunners }
		    @Body

            }

	    @LargeScaleStructure
		tag { @Tag }
		type { Minor }
		initiallanguage { @InitialLanguage }
		title { @Title }
		runningtitle { @RunningTitle }
		headingfont { @SectionHeadingFont }
		headingbreak { @SectionHeadingBreak }
		headingformat { @Num @SectionHeadingFormat @Body }
		incontents { @SectionInContents }
		contentsindent { 3f }
		numbers { @SectionNumbers }
		attachnum { @SectionList&&preceding @Tagged @Tag }
		retrievenum { @SectionList&&@Tag @Open { num } }
		bypassnumber { @BypassNumber }
		prefix { @ChapterShortNum }
		majornum { @MajorNum }
		majortitle { @MajorTitle }
		intheorems { @SectionNumInTheorems }
		indisplays { @SectionNumInDisplays }
		infigures { @SectionNumInFigures }
		intables { @SectionNumInTables }
		inrunners { @SectionNumInRunners }
		@Body

        }

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

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

    }


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

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

        def @EndSubAppendicesPlace { @Galley }

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

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

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

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

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

        export @BeginSubSubAppendices @EndSubSubAppendices @SubSubAppendix
        def @SubAppendix force into { @SubAppendixList&&preceding }
            named @Tag {}
            named @Title {}
            named @RunningTitle { dft }
	    named @InitialLanguage { @InitialLanguage }
	    named @BypassNumber { dft }
            body @Body
        {

            def @EndSubSubAppendicesPlace { @Galley }

            def @EndSubSubAppendices force into { @EndSubSubAppendicesPlace&&preceding }
	    {}

            macro @BeginSubSubAppendices
            {	//@SubSubAppendixGap @SubSubAppendixList @FirstSubSubAppendixNumber
		// @EndSubSubAppendicesPlace //
	    }

	    def @SubAppendixShortNum
	    {
		@SubAppendixNumbers @Then {
		    @BypassNumber @Dft {
			@AppendixShortNum @Join @SubAppendixNumbers @Num
			{ @SubAppendixList&&@Tag @Open { num } }
		    }
		}
	    }

            def @SubSubAppendix force into { @SubSubAppendixList&&preceding }
		named @Tag {}
		named @Title {}
		named @RunningTitle { dft }
		named @InitialLanguage { @InitialLanguage }
		named @BypassNumber { dft }
		body @Body
            {

		@LargeScaleStructure
		    tag { @Tag }
		    type { Minor }
		    initiallanguage { @InitialLanguage }
		    title { @Title }
		    runningtitle { @RunningTitle }
		    headingfont { @SubSubAppendixHeadingFont }
		    headingbreak { @SubSubAppendixHeadingBreak }
		    headingformat { @Num @SubSubAppendixHeadingFormat @Body }
		    incontents { @SubSubAppendixInContents }
		    contentsindent { 6f }
		    numbers { @SubSubAppendixNumbers }
		    attachnum { @SubSubAppendixList&&preceding @Tagged @Tag }
		    retrievenum { @SubSubAppendixList&&@Tag @Open { num } }
		    bypassnumber { @BypassNumber }
		    prefix { @SubAppendixShortNum }
		    majornum { @MajorNum }
		    majortitle { @MajorTitle }
		    intheorems { @SubSubAppendixNumInTheorems }
		    indisplays { @SubSubAppendixNumInDisplays }
		    infigures { @SubSubAppendixNumInFigures }
		    intables { @SubSubAppendixNumInTables }
		    inrunners { @SubSubAppendixNumInRunners }
		    @Body

            }

	    @LargeScaleStructure
		tag { @Tag }
		type { Minor }
		initiallanguage { @InitialLanguage }
		title { @Title }
		runningtitle { @RunningTitle }
		headingfont { @SubAppendixHeadingFont }
		headingbreak { @SubAppendixHeadingBreak }
		headingformat { @Num @SubAppendixHeadingFormat @Body }
		incontents { @SubAppendixInContents }
		contentsindent { 3f }
		numbers { @SubAppendixNumbers }
		attachnum { @SubAppendixList&&preceding @Tagged @Tag }
		retrievenum { @SubAppendixList&&@Tag @Open { num } }
		bypassnumber { @BypassNumber }
		prefix { @AppendixShortNum }
		majornum { @MajorNum }
		majortitle { @MajorTitle }
		intheorems { @SubAppendixNumInTheorems }
		indisplays { @SubAppendixNumInDisplays }
		infigures { @SubAppendixNumInFigures }
		intables { @SubAppendixNumInTables }
		inrunners { @SubAppendixNumInRunners }
		@Body

        }

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

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

    }


@End @BookSetup