Changes

Jump to navigation Jump to search
2,198 bytes added ,  07:32, 18 June 2020
m
→‎Custom imposition schema: elaborated a bit more
< [[Structurals]] | [[Visuals]] >
 
To impose means to place pages on a bigger sheet in such a way that one can fold and cut the sheet to get a booklet or something similar. Here are some examples:
* Printing address labels on an A4 sheet, eight labels per sheet.
In general, imposition is accessed in ConTeXt using {{cmd|setuparranging}}, or from the command line as follows (mkiv and mkii, respectively):
<pre>
context --pdfarrange=...texexec --pdfarrange=...</pre>
== Imposition schemas ==
\setuparranging [XY]
</texcode>
 
Here’s an example for [[Labels]].
===Testing schemas===
Here's a convenient test file to help choose a schema or write a new one:
(Note that background=screen is deprecated in MKIV and should be replaced by something like background=color,backgroundcolor=lightgray.)
<context source=yes>
\showframe
\setupbackgrounds [text][text][background=screencolor,backgroundscreenbackgroundcolor=0.7lightgray]
\setupcolors [state=start]
You can create a new imposition schema to meet your needs. To do so, take a look at the imposition definitions stored in <code>page-imp.mkiv</code> and find the closest one to work with. You can access the file online:
https://source.contextgarden.net/tex/context/base/mkiv/page-imp.mkiv?search=%5C%5Cdef%5C%5Csetuparranginginstallpagearrangement
Let's say we want this page arrangement on one sheet (R = page upside down):
<context source=yes>
% Adapted from page-imp.mkiv \installpagearrangement 1*4*Reversedreversed
{\dosetuparrangement{2}{2}{4}{3}{3}% X,Y,Total,hcutmarks,vcutmarks
\pusharrangedpageFOURSINGLESIDEDFOLDEDREVERSED\poparrangedpagesTWO\relax}
\setuppapersize [A10][A8]
\setuparranging [1*4*Reversedreversed]
\setuplayout [margin=0pt, width=fit]
\stoptext
</context>
 
If it is necessary to have a different imposition scheme for the second page it is possible to create an arrangement that spans two physical pages. As an example the following schema arranges the pages like this
 
<pre>P4 P1
R3 R2
 
P5 P6
P7 P8</pre>
 
<context source=yes>
\installpagearrangement 1*4*reversed*1*4
{\dosetuparrangement{2}{2}{4}{3}{3}% X,Y,Total,hcutmarks,vcutmarks
\pusharrangedpageFOURSINGLESIDEDFOLDEDREVERSED\poparrangedpagesAB\relax}
 
\def\pusharrangedpageFOURSINGLESIDEDFOLDEDREVERSED#1%
{\advancearrangedpageN
\reportarrangedpage\arrangedpageN
\ifcase\arrangedpageN
\or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 rot,hskip,vskip
\or \handlearrangedpageXandY{#1}111\arrangedpageA % 2
\or \handlearrangedpageXandY{#1}101\arrangedpageA % 3
\or \handlearrangedpageXandY{#1}000\arrangedpageA % 4
\or \handlearrangedpageXandY{#1}000\arrangedpageB % 5
\or \handlearrangedpageXandY{#1}010\arrangedpageB % 6
\or \handlearrangedpageXandY{#1}001\arrangedpageB % 7
\or \handlearrangedpageXandY{#1}011\arrangedpageB % 8
\poparrangedpages
\fi}
</context>
 
The <code>\arrangedpageA</code> and <code>\arrangedpageB</code> are box registers that you can use to build up your desired output pages. They actually go up to <code>\arrangedpageH</code>.
 
''Note:'' if your imposition scheme needs more than eight physical pages see below [[#Imposition_by_signatures|Imposition by signatures]] on how to interface with an external imposer program.
 
As you can see in
 
https://source.contextgarden.net/tex/context/base/mkiv/page-imp.mkiv?search=poparrangedpages.+
 
there are various alternative definitions of <code>\poparrangedpagesAB</code> that manipulate to box registers in different ways to output the desired imposition. The macro <code>\installpagearrangement</code> makes the generic <code>\poparrangedpages</code> use one of those alternatives (in this case <code>\poparrangedpagesAB</code>).
== Cut marks ==
Note that some features (e.g. table of contents, internal references) are always disabled in imposition mode. So, they will not be included in the pdf if you ask for imposition.
To get rid of this you can use the "arrange" key for texexecthe <code>context</code> command.
<texcode>
texexec context --arrange yourFilename
</texcode>
\stoptext
</texcode>
 
== Adding pages for imposition signature ==
 
With `\setuppagenumbering[alternative=doublesided`, there will always be an even number of pages. If you need to always have a multiple of four pages, use `\page[quadruple]` at the end of the document:
 
<texcode>
% Enable doublesided; there will always be an even number of pages
\setuppagenumbering[alternative=doublesided,location=right]
 
\starttext
\completecontent
\startchapter[title={A Chapter}]
Text of chapter 1
\stopchapter
\startchapter[title={Another Chapter}]
Text of chapter 2
\stopchapter
 
% Make sure there are a multiple of four pages in the document
\page[quadruple]
\stoptext
</texcode>
 
''Is there is a case where the complex solution in the next section would be necessary?''
== Imposition by signatures ==
</texcode>
You can find a complete script to emulate psbook (which needs a conversion from pdf to ps and back to pdf) and pdfbook (which use the latex package pdfpages) at http://gitorious.org/the-anarchist-library-tools/the-anarchist-library-tools/trees/master/context-imposition and consists of a perl script (with --help included), a ConTeXt module and an example.
 
[[Category:ConTeXt-Issues]]
{{Getting started navbox}}[[Category:Layout]]

Navigation menu