# Changes

Jump to navigation Jump to search
,  17:44, 19 February 2018
Hints about different layouts
< [[Visuals]]| [[Layers]] | [[Columns]] | [[Visual Debugging]] | [[Paper sizes]] >
You can use these For more on [http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf layout and page design areas in your page] see the [http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf manual chapter].
<table> <tr style="background:#cccccc;"> <td style="background:#ffffff;"></td> <td styleTypesetting areas ="text-align:center;">leftedge </td> <td style="text-align:center;">leftmargin </td> <td style="text-align:center;">text </td> <td style="text-align:center;">rightmargin </td> <td style="text-align:center;">rightedge </td> </tr> <tr style="background:#cccccc;"> <td> top </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> </tr> <tr style="background:#cccccc;"> <td> header </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> <td style="text-align:center;">header </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> </tr> <tr style="background:#cccccc;"> <td> text </td> <td style="text-align:center;">. </td> <td style="text-align:center;">marginals </td> <td style="text-align:center;">text </td> <td style="text-align:center;">marginals </td> <td style="text-align:center;">. </td> </tr> <tr style="background:#cccccc;"> <td> footer </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> <td style="text-align:center;">footer </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> </tr> <tr style="background:#cccccc;"> <td> bottom </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> <td style="text-align:center;">. </td> </tr> </table>
The 25 typesetting areas of a ConTeXt page are divided into 5 columns and 5 rows. From left to right, one encounters {{code|leftedge}}, {{code|leftmargin}}, {{code|text}}, {{code|rightmargin}}, and {{code|rightedge}}. From top to bottom, the areas are called: {{code|top}}, {{code|header}}, {{code|text}}, {{code|footer}}, {{code|bottom}}. E.g. {{code|leftmargin}} is the margin area to the left of the main text area; {{code|{leftmargin,bottom}|}} is below it, at the same height as the {{code|bottom}} area. In between the two lies the area {{code|{leftmargin,footer}|}}.
The graphic below illustrates the areas and dimensions. The row and column names are written
along the edges of the page. The arrows correspond to layout dimensions; the
more important a dimension is (i.e. the more of the layout is pushed around
when you change it), the thicker its arrow and the larger its name.
You can make all the geometry information visible with <tt>[[Image:layout.svg||||Diagram of \showlayout</tt>.setuplayout[] dimensions]]
See <tt>\setuplayout</tt> in == Defining the manual.layout ==
By Positioning the areas is by setting the following dimensions using {{cmd|setuplayout|[backspace=5cm,...]}}. The dimensions are mentioned in order of how ‘primitive’ they are: e.g. altering the {{code|topspace}} pushes around all other vertical dimensions, but altering the {{code|header}} affects only the {{code|headerdistance}} and the {{code|textheight}}. You always define a right page; if you use a double page layout, 'right' and 'left' values are mirrored on a left page. Doublesided typesetting is activated with {{cmd|setuppagenumbering|[alternative=doublesided]}}. # Set the {{code|backspace}} and {{code|width}}, and the {{code|topspace}} and {{code|height}}. The {{code|width}} is the width of the main typesetting area; the {{code|backspace}} is its distance from the left edge of the page. The {{code|height}} is the distance ''from the top of the header to the bottom of the footer''; the {{code|topspace}} is the distance from the top edge of the page to the top of the header.# Set the {{code|header}} and {{code|headerdistance}}, and the {{code|footer}} and {{code|footerdistance}}. The {{code|header}} is the vertical size of the header area; the {{code|headerdistance}} is the distance from the header area to the text area. The {{code|footer}} and {{code|footerdistance}} work likewise.# Once the header(distance) and footer(distance) are subtracted from the {{code|height}}, what remains is the {{code|textheight}}: the height of the main typesetting area. Although it would be very useful, you cannot set this dimension directly.# If you want to typeset anything above the header, define {{code|topdistance}} (the distance from the top of the header to the bottom of the topmost typesetting area) and {{code|top}} (the height of the topmost typesetting area). For typesetting below the footer, define {{code|bottomdistance}} and {{code|bottom}}.# As for the horizontal dimensions apart from the {{code|width}}: starting at the left edge of the main text area, and moving away from the center, one first sets the {{code|leftmargindistance}}; then one sets the width {{code|leftmargin}} of the margin typesetting area; then one sets the {{code|leftedgedistance}}; and then there is the {{code|leftedge}} typesetting area. On the right: {{code|rightmargindistance}}, {{code|rightmargin}}, {{code|rightedgedistance}}, {{code|rightedge}}. == Paper size == Page size and paper size are set with {{cmd|setuppapersize}}. Many paper sizes are already defined by name; see the list of [[PaperSizes|paper sizes]]. To define a new paper size, use {{cmd|definepapersize}}. {{todo | Merge with [[PaperSetup]] }} == Example layout == <texcode>\setuppapersize[A4][A4] % this is the default and may be omitted\setuplayout[backspace=20mm, width=160mm, topspace=20mm, header=0mm, footer=0mm, height=250mm]</texcode> == Multiple layouts == If you need to use different layouts in some parts of the document, you can set up a global layout, and then define additional named layouts for the deviating parts. You only need to specify the dimensions that differ: unspecified dimensions will be inherited from the global layout. To switch to a different layout, call it up in the appropriate place in the document. To revert back to the global layout, use {{cmd|setuplayout|[reset]}}. <texcode>\setuplayout[...] % global layout\definelayout[wide][...] % layout of the first page \setuplayout[wide] % switch to layout called 'wide'\setuplayout[reset] % switch back to the global layout</texcode> To specify in advance that you want to change layouts starting from page 4 (e.g.), use {{cmd|definelayout|[4][...]}}. Resetting the layout must be done explicitly; else, the new layout will be used until the end of the document. <texcode>% different layout for first two pages\definelayout[1][wide]\definelayout[3][reset]</texcode> For the page numbers you can use absolute numbers (as above), relative numbers (like +1, -2) or the keywords odd, even, first and last. <texcode>\setuplayout[ % default layout (right page)...]\definelayout[even][ % different layout on left pages...]</texcode> If you define additional layouts in a doublepage (duplex) setup, remember to think mirrored: leftmargin defines the right margin, backspace is the distance from the spine to the right edge of the text area etc. .<div style="border: 3px solid red; background: #ffcccc; padding: 0.4em;"><div style="font-size: 1.3em; fontweight: bold">Warning!</div>At the moment a layoutchange (setuplayout) inside a page is not proper working in mkiv duplex mode.For more details and actual state see mailing list and [http://wiki.contextgarden.net/User_talk:Zenlima Bug Layoutchange inside page while duplexmode].</div> == Advanced features == * To allow Acrobat Reader users (among others?) to make layersvisible/invisible at will, add the following command at the start of your file:<texcode>\showlayoutcomponents</texcode> * If you have a certain run of text that you want to keep together, you can also place elements test for the number of lines available on the current page with {{cmd|testpage|[''n'']}}, where ''n'' is the number of lines required. If there are not ''n'' lines available, a page break will be inserted at specific placesthe location of the {{cmd|testpage}} command. * If you need absolute positioning of objects (text, pictures) on the page, but ad-hoc rather than systematic, the [[Layers]] mechanism is more suitable. * For layout from a [[Formatting Objects|XML/FO]] perspective, with some descriptive pictures, as done see At [http://getfo.sourceforge.net/context_xml/index.html Paul Tremblay's] [[XML]] ConTeXt site. == Table of Parameters == The first colum is the name by which the variable is set in {{cmd|setuplayout}}. The second column is the name by which TeX stores the variable. This name is usually the same, but sometimes different; knowing it allows you to invoke it with code like <code>The paper's height is \the\paperheight.</code> Any remarks (usually a short description) are given in the third column. {| class=wikitable! \setuplayout[...] !! dimension !! Remarks|-| paperheight| {{cmd|paperheight}}| height of paper page|-| paperwidth| {{cmd|paperwidth}}| width of paper page|-| printpaperheight| {{cmd|printpaperheight}}| differs from paperheight when using [[Imposition]] (arranging)|-| printpaperwidth| {{cmd|printpaperwidth}}| differs from paperwidth when using [BusinessCard[Imposition]] (arranging)|-| topspace| {{cmd|topspace}}| above header: from top rim of paper to to top rim of header|-| backspace| {{cmd|backspace}}| from left rim of paper to left rim of main text area|-| height| {{cmd|makeupheight}}| sum of heights of text area, header and footer (plus distances)|-| width| {{cmd|makeupwidth}}| width of the main text area. {{cmd|makeupwidth}} is normally same as {{cmd|textwidth}}, but it can be different, for examplein columns|-| top| {{cmd|topheight}}| height of the top area|-| topdistance| {{cmd|topdistance}}| between top and header|-| header| {{cmd|headerheight}}| height of header area|-| headerdistance| {{cmd|headerdistance}}| between header and text|-| textheight| {{cmd|textheight}}| height of text area|-| footerdistance| {{cmd|footerdistance}}| between text and footer|-| footer| {{cmd|footerheight}}| height of footer area|-| bottomdistance| {{cmd|bottomdistance}}| between footer and bottom|-| bottom| {{cmd|bottomheight}}| space below footer (but isn't calculated automatically)|-| bottomspace| {{cmd|bottomspace}}| space from bottom footer to bottom rim of paper|-| cutspace| {{cmd|cutspace}}| from right rim of paper to right rim of main text area|-| leftedge| {{cmd|leftedgewidth}}| from left rim of paper to left rim of left margin|-| leftedgedistance| {{cmd|leftedgedistance}}| between leftegde and left margin|-| leftmargin| {{cmd|leftmarginwidth}}| width of left margin (marginals space)|-| leftmargindistance| {{cmd|leftmargindistance}}| between left margin and text|-| textwidth| {{cmd|textwidth}}| width of text area. when columns are used, the value of {{cmd|textwidth}} can differ from {{cmd|makeupwidth}}|-| rightmargindistance| {{cmd|rightmargindistance}}| between text area and right margin|-| rightmargin| {{cmd|rightmarginwidth}}| width of right margin (marginals area)|-| rightedgedistance| {{cmd|rightedgedistance}}| between right margin and right edge|-| rightedge| {{cmd|rightedgewidth}}| from right margin to right rim of paper|-| horoffset| ?| bleed from left of paper|-| voroffset| ?| bleed from top of paper|} '''Note:''' *width=middle<code> if cutspace == 0pt then cutspace = backspace end makeupwidth = paperwidth- backspace -cutspace</code>*width=fit<code> if cutspace == 0pt then cutspace = backspace end makeupwidth = paperwidth-cutspace scratchdimen = backspace - leftedgewidth-leftedgedistance-leftmarginwidth-leftmargindistance if scratchdimen< 0pt then scratchdimen = 0pt end makeupwidth = makeupwidth - rightmargindistance-rightmarginwidth- rightedgedistance-rightedgewidth- scratchdimen</code>* otherwise:<code> makeupwidth=width if cutspace == 0pt then cutspace = paperwidth-makeupwidth-backspace else % A kind of inconsistent specification, but used % in for instance s-pre-19.tex; the cutspace is % used only for determining some kind of right % margin; don't use this in doublesided mode pass end</code>(From {{src|page-lay.mkiv}}.) {{Getting started navbox}} [[Category:ConTeXt-Issues]]
gardener
1,090

edits