Changes

Jump to navigation Jump to search
653 bytes added ,  14:55, 22 September 2020
example pages have utterly disappeared. removed section
<pre>
 
<fo:simple-page-master
master-name="first"
</fo:simple-page-master>
 
</pre>
Note how both page dimensions (the physical hieght height of a page) and
the layout (the margins) are contained in the simple-page-master
element. In ConTeXt, these two qualities are separate.
=Pysical Physical Page Dimensions=
Let's build different layouts in a ConTeXt document, starting
<texcode>
 
\enableregime[utf]
\setuppagenumbering[state=stop, way=bytext]
\starttext
 
</texcode>
<texcode>
 
\part{}
 
</texcode>
<texcode>
 
\definepapersize[firstPart][width=8.5in, height=11in]
\setuppapersize[firstPart]  
</texcode>
<texcode>
 
 
Some text for our first part.
 
</texcode>
<texcode>
 
 
\part{}
\definepapersize[secondPart][width=8.5in, height=11in]
\setuppapersize[secondPart]
Text for second part.
\stoptext
 
</texcode>
<texcode>
 
 
\part{}
\definepapersize[firstdPart][width=8.5in, height=11in]
\setuppapersize[firstPart]
% define layout for first part
\definelayout[
topspace=.5in, bottomspace=.5in, cutspace=1in, backspace=1in, header=2in, footer=2in, rightmargin=1in, leftmargin=1in, width=5in, height=10in, ]
Text for first part.
 
 
</texcode>
regions.
If you pages are not doublesided double sided (not part of a book), the
"backspace" value will determine how much space occurs between
the left edge of the paper and any text. It always touches the
"leftmargin" region. If you have a doublesided double sided layout, the
"backspace" value will flip from right to left side of your
pages, but will always be in the gutter, or the spine of a book
margin-top="2in"/>, <fo:region-body region-after="2in"/>,
<fo:region-body region-start="1in"/>, and <fo:region-body
region-end="1in"/> respectively. Like their FO conterpartscounterparts, the
ConTeXt values set up margins at the top, bottom, left, and right
of the page for marginal notes.
The values "leftmargin" and "rightmargin" have no affect on the
actual width of the body text. You could set "leftmargin" to 5in,
and your body text would not change its width. When you setwidth to 5 inches, the width of your body text will in fact be 5inches. (This contrasts with height, as I explain below.) If you the sum ofyour "backspace", margins, and width exceed the total pagewidth, your layout will not work. In contrast, the "header" and"footer" do change the overall height of your body text. If youincreased the header by one inch, your body text would be 1 inchsmaller. You control the width and height of your body text bythe "width" and "height" values.
In contrast, the "header" and "footer" do change the overallheight of your body text. If you increased the header by oneinch, your body text would be 1 inch smaller. The height actuallyrefers to the total height of the toppace, header, body text,footer, and bottomspace. If you set the header to 2 inches, andset the footer to 2 inches, and set the height to 4 inches, thenthe actual body height would be: 4 - 2 - 2 = 0 (!) You would have no room for your body text at all. If you meant toset your body height to 4 inches, you would set height to 8inches (2 + 2 + 4 = 8). <table borderstyle="2border:1px solid #DDDDDD" >
<caption>
FO ConTeXt conversions for physical page layouts </caption>
 
<tr style="background-color:#DDDDDD">
<th>
FO </th>
<th>
ConTeXt </th>
</tr>
<tr>
 
<td>
 FO <pre><fo:simple-page-master margin-top="x"></pre> </td> 
<td>
 ConTeXt <texcode>\definelayout topspace=x</texcode> </td> 
</tr>
<trstyle="background-color:#EEEEEE"
<td>
 <pre><fo:simple-page-master margin-topbottom="x"></pre> </td> 
<td>
 <tttexcode>\definelayout</tt> <tt>topspacebottomspace=x</tttexcode> </td> 
</tr>
<tr>
 
<td>
 <fo:pre><simple-page-master margin-bottomleft="x"></pre> </td> 
<td>
 <tttexcode>\definelayout</tt> <tt>bottomspacebackspace=x</tttexcode> </td> 
</tr>
<trstyle="background-color:#EEEEEE"
<td>
 <pre><simple-page-master margin-leftright="x"></pre> </td> 
<td>
 <tttexcode>\definelayout</tt> <tt>backspacecutspace=x</tttexcode> </td> 
</tr>
<tr>
 
<td>
 <simple-pagepre><fo:region-master body margin-righttop="x"/></pre> </td> 
<td>
 <tttexcode>\definelayout</tt> <tt>cutspaceheaderdistance=x</tttexcode> </td> 
</tr>
<trstyle="background-color:#EEEEEE"
<td>
 <pre><fo:region-before extent="x"/></pre> </td> 
<td>
 <tttexcode>\definelayout</tt> <tt>header=x</tttexcode> </td> 
</tr>
<tr>
 
<td>
 <pre><fo:region-after extent="x"/></pre> </td> 
<td>
 <tttexcode>\definelayout</tt> <tt>footer=x</tttexcode> </td> 
</tr>
<trstyle="background-color:#EEEEEE"
<td>
 <pre><fo:region-start extent="x"/></pre> </td> 
<td>
 <tttexcode>\definelayout</tt> <tt>left-margin=x</tttexcode> </td> 
</tr>
<tr>
 
<td>
 <pre><fo:region-after extent="x"/></pre> </td> 
<td>
 <tttexcode>\definelayout</tt> <tt>right-margin=x</tttexcode> </td> 
</tr>
=Changing Layouts for First, Odd and Even Pages=
 
Adam Adam corrected me on the following passage. I had had that
you couldn't change the physical descriptions for odd and even
pages, but he showed me you could.
FO lets you create different pages sizes and layouts for the
==First Page==
In order to define different pysical dimmensions physical dimensions for your first
page, use "1" as your first option:
<texcode>
 
\definelayout[1][
topspace=.5in, % the space at the very top of the page backspace=2in, % the space in the gutter header=2in, % the space for headers footer=2in, % the space for footers leftmargin=1in, % the space for margin notes rightmargin=1.5in, % the space for right margin notes width=3in, % the width of the body text height=7in % the height of the body text
]
 
 
 
</texcode>
<texcode>
 
 
\setuppagenumbering[alternative=doublesided, state=stop]
 
</texcode>
<texcode>
 
 
\definelayout[odd]
[backspace=1in, cutspace=1.25in, width=middle, height=9in]
\definelayout[even]
[backspace=1in, cutspace=1.25in, width=middle, height=8in]
\setuplayout % needed to add this or the first page wouldn't format
\starttext
\dorecurse{12}{\input dawkins \par}
\stoptext
 
 
 
</texcode>
<pre>
 
 
<fo:static-content
flow-name="even-page">
Title
</fo:static-content>
 
</pre>
text wherever we want them with the commands
<tt>\setupheadertexts</tt> and <tt>\setupfootertexts</tt>. These
commands takes 4 arguments, the first for the left margin on evenodd
pages, the second for the right margin on odd pages, the third
for the right left margin on odd even pages, and the fourth for the leftrightmargin on odd even pages. For simplicity's sake, let's leave the
middle two options empty, so we get headers and footers on the
even and odd pages, naturally alligned with the left margin,
<texcode>
 
\setupheadertexts[left(even) header][] [][right(odd) header]
\setupfootertexts[left(even) footer][] [][right(odd) footer]
 
</texcode>
<texcode>
 
 
\setupheader[state=high]
\setupfooter[state=high]
 
</texcode>
have been stopped; "empty", which preserves the space for the
header or footer but does not show the text; and none, which
completely elminates eliminates both the space and the text for a header or
foooter.
determines the placement of text on the first page of a division
in a document, such as part. We will use this command in
conjuction conjunction with a <tt>\definetext</tt> command in this way:
<texcode>
 
\definetext[partStart1][header][Part Header]
\setuphead[part][header=partStart1]
\part{}
 
</texcode>
<texcode>
 
 
% force the odd header to the right and the even header to the left
% (where it would appear, anyway).
% forces the word to be centered
\setupheadertexts[left \hfill middle \hfill right][] [][right header]
 
</texcode>
paragraph unit that ConTeXt uses behind the scenes. In order to
break a line inside a <tt>\vbox</tt>, we use <tt>\vskip</tt>.
 
=Example Documents=
 
Here are two example documents, illustrating all the formatting.
The first is a plain old ConTeXt document. The second is a TeXML
document.
 
[[page setup1]]
=Summary=
* We use <tt>\definelayout</tt> to set both the physical properties of a page as well as its layout.
* We place the <tt>\setuphead</tt> command before the <tt>\part</tt> command. We place all other commands after <tt>\part</tt>.
* The <tt>\setuphead</tt> command allows us to control the headers and foooters footers for a new run of pages.
* We use the <tt>\vbox</tt> and <tt>\hfill</tt> commands to format text within a header or footer.
 
 
=To Do=
 
* Find out if there is a corresponding value of footerdistance in FO.
 
[[Category:XML]]

Navigation menu