Page setup1 texml

From ConTeXt wiki
<?xml version="1.0"?>
<!DOCTYPE TeXML SYSTEM "/home/paul/Documents/data/dtds/texml.dtd"

[
<!ENTITY swans_way1 SYSTEM "../source_files/swans_way1.txt">
<!ENTITY dawkins SYSTEM "../source_files/dawkins.txt">
<!ENTITY knuth SYSTEM "../source_files/knuth.txt">


]>
<TeXML>
    <cmd name="setuppagenumbering" nl2="1">
  <opt>state=stop</opt>
 </cmd>
 <cmd name="enableregime" nl2="1">
  <opt>utf</opt>
 </cmd>
 <cmd name="showframe" nl2="1"/>
 <env name="text">
<!--Chapter one-->
     <cmd name="part" nl2="1" nl1="1">
         <parm/>
     </cmd>
     Chapter One: use defaults
     <cmd name="par" nl2="1"/>
     &dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>


<!--Chapter Two
Change outermost, non-writeable regions and define paper size
-->
<!--start a page run-->
<cmd name="part" nl2="1">
    <parm/>
</cmd>
<cmd name="definepapersize" nl1="1">
    <opt>chap2</opt>
    <opt>width=8.5in, 
    height=11in</opt>
</cmd>
<cmd  name="setuppapersize" nl1="1">
    <opt>chap2</opt>
</cmd>

<!--define the layout for the page-->
<cmd name="definelayout" nl1="1">
    <opt>chap2</opt>
    <opt>
        topspace=2in, 
        backspace=2in,  
        cutspace=2in, 
        bottomspace=2in,         
    </opt>
</cmd>
<cmd name="setuplayout" nl2="1">
    <opt>chap2</opt>
</cmd>
Chapter 2: change backspace, cutspace, etc
<cmd name="par" nl2="1"/>

<!--input text from other documents-->

     &dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>

<!--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                   %
%  Add footer and header space, as well as right and left margin.   %
%                                                                   %
%  When we increase the footer and header margins, we decrease the  %
%  areas for our body text. In contrast, increasing the left and    %
%  right margin has no affect on the the text width.                %
%                                                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-->

<!--start a page run-->
<cmd name="part" nl2="1">
    <parm/>
</cmd>


<!--define paper size-->
<cmd name="definepapersize" nl1="1">
    <opt>chap3</opt>
    <opt>width=8.5in, 
    height=11in</opt>
</cmd>
<cmd  name="setuppapersize" nl1="1">
    <opt>chap3</opt>
</cmd>

<!--define the layout for the page-->
<cmd name="definelayout" nl1="1">
    <opt>chap3</opt>
    <opt>
        topspace=2in, 
        backspace=2in,  
        cutspace=2in, 
        bottomspace=2in,         
        header=1.5in,
        footer=1.5in,
        leftmargin=1.5in,
        rightmargin=1.5in,
    </opt>
</cmd>

<cmd name="setuplayout" nl2="1">
    <opt>chap3</opt>
</cmd>
Chapter 3: Add header space, footer space, right and left margin
<cmd name="par" nl2="1"/>

<!--input text from other documents-->

     &dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>

<!--

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                     %
%  Changing the default width and height of the body area.            %
%                                                                     %
%  The heigth is equal to the body text plus the footers and          %
%  headers. The width indicates just the body text width.             %
%                                                                     %
%  To control height and width as a percentage of the normal widht    %
%  and height, use the \makeupwidth and \makeupheigth variables. If   %
%  I wanted my width to be 90 percent of the normal width, I use;     %
%  width=.9\makeupwidth If I wanted my height to be 90 percent of my  %
%  normal height, I use height=.9\makeupheight                        %
%                                                                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-->

<!--start a page run-->
<cmd name="part" nl2="1">
    <parm/>
</cmd>


<!--define paper size-->
<cmd name="definepapersize" nl1="1">
    <opt>chap4</opt>
    <opt>width=8.5in, 
    height=11in</opt>
</cmd>
<cmd  name="setuppapersize" nl1="1">
    <opt>chap4</opt>
</cmd>

<!--define the layout for the page-->
<cmd name="definelayout" nl1="1">
    <opt>chap4</opt>
    <opt>
        topspace=2in, 
        backspace=2in,  
        cutspace=2in, 
        bottomspace=2in,         
        header=1.5in,
        footer=1.5in,
        leftmargin=1.5in,
        rightmargin=1.5in,
        width=5.5in,
        height=8in, 
    </opt>
</cmd>

<cmd name="setuplayout" nl2="1">
    <opt>chap4</opt>
</cmd>
Chapter 4: Control the width of the body text
<cmd name="par" nl2="1"/>

<!--input text from other documents-->

     &dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>

<!--

%%%%%%%%%%%%%%%%%%%%%%%%%
%                       %
%  Headers and Footers  %
%                       %
%%%%%%%%%%%%%%%%%%%%%%%%%
-->

<!--start a page run-->
<cmd name="part" nl2="1">
    <parm/>
</cmd>


<!--define paper size-->
<cmd name="definepapersize" nl1="1">
    <opt>chap5</opt>
    <opt>width=8.5in, 
    height=11in</opt>
</cmd>
<cmd  name="setuppapersize" nl1="1">
    <opt>chap5</opt>
</cmd>

<!--define the layout for the page-->
<cmd name="definelayout" nl1="1">
    <opt>chap5</opt>
    <opt>
        topspace=2in, 
        backspace=2in,  
        cutspace=2in, 
        bottomspace=2in,         
        header=1.5in,
        footer=1.5in,
        headerdistance=.25in, 
        footerdistance=.25in, 
        location=middle,
        height=8in, 
    </opt>
</cmd>

<cmd name="setupheadertexts" nl2="1">
    <opt>header</opt>
    <opt></opt>
    <opt></opt>
    <opt>header</opt>
</cmd>
<cmd name="setupfootertexts" nl2="1">
    <opt>header</opt>
    <opt></opt>
    <opt></opt>
    <opt>header</opt>
</cmd>

<cmd name="setuplayout" nl2="1">
    <opt>chap5</opt>
</cmd>


Chapter 5: Add headers and footers
<cmd name="par" nl2="1"/>

<!--input text from other documents-->

     &dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>

<!--

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                 %
%  Different odd and even pages.  %
%                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-->

<!--start a page run-->
<cmd name="part" nl2="1">
    <parm/>
</cmd>


<!--define paper size-->
<cmd name="definepapersize" nl1="1">
    <opt>chap5</opt>
    <opt>width=8.5in, 
    height=11in</opt>
</cmd>

<cmd name="definelayout">
    <opt>odd</opt>
    <opt>
         topspace=1in,
         backspace=2in, 
         header=1in,
         footer=1in,
         leftmargin=1in,
         rightmargin=1in,
         width=5.5in,
         height=7.5in
        
    </opt>
</cmd>

<cmd name="definelayout">
    <opt>even</opt>
    <opt>
         topspace=1in,
         backspace=2in, 
         header=1in,
         footer=1in,
         leftmargin=1in,
         rightmargin=1in,
         width=5.5in,
         height=9.5in
        
    </opt>
</cmd>

<cmd name="setupheadertexts" nl2="1">
    <opt>even</opt>
    <opt></opt>
    <opt></opt>
    <opt>odd</opt>
</cmd>
<cmd name="setupfootertexts" nl2="1">
    <opt>even</opt>
    <opt></opt>
    <opt></opt>
    <opt>odd</opt>
</cmd>

<cmd name="setuplayout" nl2="1"/>


Chapter 6: Odd and Even Pages
<cmd name="par" nl2="1"/>
     &dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par" nl2="1"/>

<!--

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                        %
%  Different first, odd and even pages.  %
%                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-->
<cmd name="definetext" nl2="1">
    <opt>chapStart7</opt>
    <opt>header</opt>
    <opt>Chapter 7</opt>
</cmd>

<!--set up the head-->
<cmd name="setuphead" nl2="1">
    <opt>part</opt>
    <opt>header=chapStart7, footer=empty</opt>
</cmd>

<!--start a page run-->
<cmd name="part" nl2="1">
    <parm/>
</cmd>


<!--define paper size-->
<cmd name="definepapersize" nl1="1">
    <opt>chap5</opt>
    <opt>width=8.5in, 
    height=11in</opt>
</cmd>

<!--define layout for first page-->
<cmd name="definelayout">
    <opt>1</opt>
    <opt>
         topspace=1in,
         backspace=2in, 
         header=1in,
         footer=1in,
         leftmargin=1in,
         rightmargin=1in,
         width=5.5in,
         height=7.5in
    </opt>
</cmd>


<!--define layout for odd pages-->
<cmd name="definelayout">
    <opt>odd</opt>
    <opt>
         topspace=1in,
         backspace=2in, 
         header=1in,
         footer=1in,
         leftmargin=1in,
         rightmargin=1in,
         width=5.5in,
         height=7.5in
        
    </opt>
</cmd>

<!--define layout for even pages-->
<cmd name="definelayout">
    <opt>even</opt>
    <opt>
         topspace=1in,
         backspace=2in, 
         header=1in,
         footer=1in,
         leftmargin=1in,
         rightmargin=1in,
         width=5.5in,
         height=9.5in
        
    </opt>
</cmd>

<cmd name="setupheadertexts" nl2="1">
    <opt>even</opt>
    <opt></opt>
    <opt></opt>
    <opt>odd <cmd name="pagenumber"/></opt>
</cmd>
<cmd name="setupfootertexts" nl2="1">
    <opt>even</opt>
    <opt></opt>
    <opt></opt>
    <opt>odd</opt>
</cmd>

<cmd name="setuplayout" nl2="1"/>

Chapter 7: First, Odd and Even Pages

     <cmd name="par" nl2="1"/>

     &dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par"
         nl2="1"/>&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par"
         nl2="1"/>
&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par"
         nl2="1"/>

<!--


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                        %
%  Headers and Footers with Formatting.  %
%                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-->

<!--set up text for first page header-->
<cmd name="definetext">
    <opt>chapStart8</opt>
    <opt>header</opt>
    <opt>
        <cmd name="vbox">
            <parm>
                Chapter 8
                <cmd name="vskip5pt"/>
                Author
            </parm>
        </cmd>
    </opt>
</cmd>

<!--set up text for first page footer-->
<cmd name = "definetext">
    <opt>
        chapStart8Footer
    </opt>
    <opt>
        footer
    </opt>
    <opt>
        <cmd name="vbox">
            <parm>
                left
                <cmd name="hskip2em"/>
                skip space
                <cmd name="hskip3cm"/>
                right
            </parm>
        </cmd>
    </opt>
</cmd>

<!--define head-->
<cmd name="setuphead">
    <opt>part</opt>
    <opt>header=chapStart8</opt>
    <opt>footer=chapStart8Footer</opt>
</cmd>


<!--start a page run-->
<cmd name="part" nl2="1">
    <parm/>
</cmd>


<!--define paper size-->
<cmd name="definepapersize" nl1="1">
    <opt>chap5</opt>
    <opt>width=8.5in, 
    height=11in</opt>
</cmd>

<!--define layout for first page-->
<cmd name="definelayout">
    <opt>1</opt>
    <opt>
         topspace=1in,
         backspace=2in, 
         header=1in,
         footer=1in,
         leftmargin=1in,
         rightmargin=1in,
         width=5.5in,
         height=7.5in
    </opt>
</cmd>


<!--define layout for odd pages-->
<cmd name="definelayout">
    <opt>odd</opt>
    <opt>
         topspace=1in,
         backspace=2in, 
         header=1in,
         footer=1in,
         leftmargin=1in,
         rightmargin=1in,
         width=5.5in,
         height=7.5in
        
    </opt>
</cmd>

<!--define layout for even pages-->
<cmd name="definelayout">
    <opt>even</opt>
    <opt>
         topspace=1in,
         backspace=2in, 
         header=1in,
         footer=1in,
         leftmargin=1in,
         rightmargin=1in,
         width=5.5in,
         height=9.5in
        
    </opt>
</cmd>

<!--set up headers-->
<cmd name="setupheadertexts">
    <opt>author 
        <cmd name="hfill"/>
        <cmd name="pagenumber"/>
        <cmd name="hfill"/>
        title
    </opt>
    <opt/>
    <opt/>
    <opt>odd</opt>
</cmd>

<!--set up footers-->
<cmd name="setupfootertexts">
    <opt>even</opt>
    <opt/>
    <opt/>
    <opt>
        odd
    </opt>
</cmd>

<!--issue the setup command-->

<cmd name="setuplayout"/>


Chapter 8: Fancy headers and footers

     <cmd name="par" nl2="1"/>

     &dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par"
         nl2="1"/>&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par"
         nl2="1"/>
&dawkins;<cmd name="par" nl2="1"/>&knuth;<cmd name="par"
         nl2="1"/>

 </env>
</TeXML>