Changes

Jump to navigation Jump to search
2,328 bytes added ,  08:28, 2 July 2022
m
Text replacement - "pragma-ade.com" to "pragma-ade.nl"
{{todo | Merge with [[PaperSetup]] and [[Paper sizes]] }}< [[Visuals]] | [[Layers]] | [[Columns]] | [[Visual Debugging]] >__TOC__
For more This page focuses on '''Basics of page design and layout'''. It will allow you to continue on [http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf [#Further reading|further topics]] like [[Presentations|Presentations layout and page design] see the ], [[Visual_Debugging|Visual debugging]], [[Floating Objects]], [[Columns]], [[Layers]], [[Grid typesetting]], [[http://contextPDF Boxes]].aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf manual chapter]But first, one needs to understand the basics of page layout by ConTeXt.
== Typesetting areas ==
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}|}}.
[[Image:layout.svg||||Diagram of \setuplayout[] dimensions]]
== Defining the layout ==
Positioning the areas is by setting the following dimensions using {{cmd|setuplayout|2=[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 When you define a page layout, it's always define a right pagethat you're defining; if you use a double page layout, 'right' and 'left' values are mirrored on a left page. Doublesided typesetting is activated with {{cmd|setuppagenumbering|2=[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.
# 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 See the dedicated page [[PaperSetup|Paper setup]], it includes details on:* {{cmd|setuppapersize}}, to set the page size and paper size are set with * {{cmd|setuppapersizedefinepapersize}}. Many , to define a new paper size,* the [[PaperSetup#Predefined_Paper_Sizes|many paper sizes are already defined by name; see the list of ]]. Their actual dimensions in mm are given by [[PaperSizes|paper Paper sizes]]page. To define a new * [[PaperSetup#Changing paper setup mid-document|Changing paper setup mid-document]]* [[PaperSetup#Setting print size, use {{cmd|definepapersize}}.Setting print size]]* [[PaperSetup#Fitting pages to their content|Fitting pages to their content]]
== Example layout ==
<texcode>
</texcode>
== Let's gather examples here == ; Cover pages: [[Cover Pages]] (2013, 2019); Other: [[Example photo page layout]] (2010) = [[Imposition]] = Imposition is a prepress printing process. It consists of the arrangement of the printed product’s pages on the printer’s sheet, in order to obtain faster printing, simplify binding and reduce paper waste ([https://en.wikipedia.org/wiki/Imposition wikipedia]). We built a dedicated page about '''[[Imposition]]''', because making booklets, to arrange pages in proper order for printing it's a topic in itself. This is where you will use {{cmd|setuppaper}} and {{cmd|setuparranging}}. = 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|2=[reset]}}.
<texcode>
</texcode>
To specify in advance that you want to change layouts starting from page 4 (e.g.), use {{cmd|definelayout|2=[4][...]}}. Resetting the layout must be done explicitly; else, the new layout will be used until the end of the document.
<texcode>
</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>
</div>
== Advanced features =Table of Parameters =
* To allow Acrobat Reader users (among others?) to make layers visible/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 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 the 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, see At [http://getfo.sourceforge.net/context_xml/index.html Paul Tremblay's] [[XML]] ConTeXt site. == Table of Parameters == The first colum column 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
'''Note:'''
*width=middle<codetexcode>
if cutspace == 0pt then
cutspace = backspace
end
makeupwidth = paperwidth- backspace -cutspace
</codetexcode> *width=fit<codetexcode>
if cutspace == 0pt then
cutspace = backspace
end
makeupwidth = makeupwidth - rightmargindistance-rightmarginwidth- rightedgedistance-rightedgewidth- scratchdimen
</codetexcode
* otherwise:
<codetexcode>
makeupwidth=width
if cutspace == 0pt then
pass
end
</codetexcode>
(From {{src|page-lay.mkiv}}.)
{{Getting started navbox}}= Further reading =  * '''[[Presentations]]''': specifics requirements, specific pages (widgets, multimedia, ...)* [[Documentation|Manuals about layout]], and noticeably:** The basics with '''[http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf Page design & Layout chapter]''' from the reference manual (2011)** The more advance '''[http://www.pragma-ade.nl/general/manuals/details.pdf It's in the Details]''' manual (2015), including grid typesetting.* '''[[Visual Debugging#Layout|Visual Debugging]]''': can greatly facilitate the set up of your layout.* After the layout, we can usually focus on the following subjects:** '''[[Floating Objects]]'''** '''[[Columns]]'''** '''[[Layers]]''', for absolute positioning of objects on the page, background, foreground etc.)** '''[[Grid typesetting]]''' (working with fixed distances)** '''[[Delimiter]]''', master line break and page break** '''[[Hiding Content]]'''* About PDF format** [[PDF Boxes]]: the size of PDF pages can have different meanings – e.g. the visible page, the printed page, the cropped printed page. ConTeXt can define the set of boxes defined by the PDF standard** [[PDF Print Options]]** [[Viewer Layers]] PDF has a concept of layers that you can enable and disable (at least in a few viewers). This has nothing to do with ConTeXt’s [[Layers]].** [[PDF/A]], ConTeXt can create PDF/A compliant outputs** [[PDFX]], ConTeXt can create PDF/X compliant outputs, the ISO standard.* For layout from a [[Formatting Objects|XML/FO]] perspective, with some descriptive pictures, see At [http://getfo.sourceforge.net/context_xml/index.html Paul Tremblay's] [[XML]] ConTeXt site. 
[[Category:ConTeXt-IssuesLayout]]

Navigation menu