Changes

Jump to navigation Jump to search
3,979 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:
==What is Imposition?==* Placing four A5 pages on both sides of an A4 sheet: 1 and 4 on the back, 2 and 3 on the front.* Placing 64 inner pages of a book on one printing sheet, to produce one signature.* One of those brochures made by folding an A4 sheet into three pieces. One could typeset this brochure as two pages with three columns each, or once could make six pages and impose them.* Printing address labels on an A4 sheet, eight labels per sheet.
To impose means to order pages on a bigger sheet In general, imposition is accessed in a wayConTeXt using {{cmd|setuparranging}}, that you get a booklet (or something similar) with correct page order after folding.In from the simplest case you impose four A5 pages on both sides of an A4 sheet.command line as follows:<pre>In a print shop it could be that you've to place 64 inner pages of a book on one printing sheet. For private use you could want to zigzagcontext --fold an A4 sheet as a brochure that fits nicely in a business envelope. You could make two pages with three columns each, or you could make six pages and impose them. Another "style" of imposition is to place several identical templates on one sheet, epdfarrange=.g. labels.</pre>
==Imposition schemas==
===Default schemas===
ConTeXt has some built-in imposition schemas (see "arranging pages" in the manual):
* 2*4*2 : section of 16 pages: 2 sheets, 4 pages front and backside
* 2*2*4 : section of 16 pages: 4 sheets, 2 pages front and backside
* XY : one sheet with x rows and y columns, you can control the number with [[{{cmd:setuppaper|\setuppaper]]}}[nx=...,ny=...,dx=...,dy=...]
"form" means "one side of a sheet".
You can access this feature via* <cmd>setuparranging</cmd>* <tt>texexec --pdfarrange=...</tt>* [http://www.ntg.nl:8061/impose.pdf online interface]{{todo|some graphical examples}}
{{todo|some graphical examples}}===XY schema===
===Additional schemas===Beware, you need to set up your XY arranging in the right order:
Hraban needed a "3SIDE" schema to fit three "filius" planner pages on one A4 sheet. Willi wrote it:
<texcode>
\unprotectsetuppapersize[A7][A4,landscape]\setuppaper[nx=4, ny=2] % New must come before \setuparranging!\setuplayout[page ][location=middle, marking=on]\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: <context source=yes>\setuppapersize[A9, landscape][A7, landscape]  % the schema being tested\setuparranging [2*4]  % text describing the schema being tested, to print on the pages\def\Style{[2*4]} % Visuals\setupbodyfont[ss,10pt] \setuplayout [margin=0pt, width=fit, header=2.8ex, footer=2.8ex] \setuppagenumbering [alternative=doublesided,location=footer]\setupheadertexts[\CONTEXT\ imposition scheme 3SIDE by Willi Egger 2003-07-21test]
\installpagearrangement 3SIDEshowframe {\dosetuparrangement{3}{1}{6}{4}{2}% \pusharrangedpageTHREESIDE\poparrangedpagesAB\relax}setupbackgrounds [text][text][background=color,backgroundcolor=lightgray]
\def\pusharrangedpageTHREESIDE#1% Willi's approach {\doglobal\increment\arrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN \or \handlearrangedpageXandY{#1}000\arrangedpageA % 1 \or \handlearrangedpageXandY{#1}010\arrangedpageA % 2 \or \handlearrangedpageXandY{#1}020\arrangedpageA % 3 \or \handlearrangedpageXandY{#1}000\arrangedpageB % 4setupcolors [state=start] \or \handlearrangedpageXandY{#1}010\arrangedpageB % 5Where the block of pages is placed on the sheet \or \handlearrangedpageXandY{#1}020\arrangedpageB % 6 \poparrangedpages(Not relevant in this example, but relevant if there is space left over.) \fi}setuplayout [location=middle,marking=on]
\protectstartbuffer[Fakepage]</texcode> \strutYou can use this code simply in your environment file. The other schemas are in <tt> \blank \midaligned{\Style} \vfill \midaligned{This is page-imp.tex</tt>.\recurselevel} \vfill\stopbuffer
Use it like this:<texcode>\starttext \definepapersize [filius][width=92mm, height=172mm]dorecurse{16}{\setuppapersize [filius]getbuffer[A4,landscapeFakepage]\setuparranging [3SIDE]page}\setuplayout [location=middle, alternative=singlesided, grid=no, marking=on, leftmargin=10mm, leftmargindistance=0mm, topspace=2mm, header=4mm, footer=0mm, width=77mm, height=166mm]stoptext</texcodecontext>
=== Rearranging existing PDF s===
ConTeXt is also handy when you need to '''rearrange an existing pdf''' into a booklet. This is a trial-and-error solution by Mari for rearranging an A4 pdf file into 2*8 spreads on A3 sheet (-> A6 pages when printed and cut). The texexec.tex file that was created by the first tries with <tt>texexec --pdfarrange</tt> (which didn't seem to have enough options) was a great help while working towards this solution.
Not sure about the margins on the final A6 pages (the original has equal left and right margins, some extra inside margin might be a good thing), but at least otherwise this seems to do the trick:
\setuppapersize[A6][A3] %individual page A6 size, print size A3
\setuparranging[2*8,rotated] %makes an 8 page gathering when folded (duplex printing!)
\setupoutput[pdf]
\setuplayout
[backspace=0pt,
</texcode>
For proofing one sometimes wants to pick just some pages and when the original is A5, it is kind of handy to put them side-by-side for proofing. The command {{cmd|filterpages}} allows you to define exactly what pages are needed. Be warned, though, that the page numbers refer to the pages in the pdf file, not the page numbers.  <texcode>\setuppapersize[A5][A4] %individual page A5 size, print size A4\setuparranging[2SIDE,rotated] %2 pages side by side, rotated to landscape to fit portrait A4\setuplayout [backspace=0pt, topspace=0pt, width=Testing schemasmiddle, height=middle, location=middle, header=0pt, footer=0pt]\setuppagenumbering[alternative=doublesided] \starttext \filterpages [file.pdf][2,5,16:19][width=0pt] %picks pdf pages 2, 5, and 16-19. \stoptext</texcode> For more information, see the article on [[Including pages from PDF documents]]. === Custom imposition schema=== 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=installpagearrangement Let's say we want this page arrangement on one sheet (R = page upside down): <pre>P4 P1R3 R2</pre> This is a mirrored/reversed version of {{cmd|setuparranging}}<code>[1*4]</code>, which gives:
Here's a convenient test file to help choose a schema or write a new one:<pre>R1 R4P2 P3</pre>
<texcodecontext source=yes>\setupbodyfont[ss,10pt]\setuppapersize [A7][A4] \setuparranging [2*2*4,doublesided] %% the schema you want to test\setuppagenumbering [alternative=doublesided,location=footer]\setuplayout [margin=0pt,width=fit] \setupbackgrounds [text][text][background=screen,backgroundscreen=0Adapted from page-imp.7] \setupcolors [state=start] \setuplayout [location=middle,marking=on]\setuptolerance [tolerant] mkiv
\definstallpagearrangement 1*4*reversed {\Styledosetuparrangement{[2*}{2*}{4}{3}{3}% X,Y,Total,hcutmarks,doublesided]vcutmarks \pusharrangedpageFOURSINGLESIDEDFOLDEDREVERSED\poparrangedpagesTWO\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
\poparrangedpages
\fi}
\startbuffersetuppapersize [FakepageA10][A8] \strutsetuparranging [1*4*reversed] \blank \midaligned{\Style} \vfill \midaligned{This is page \recurselevel} \vfill\stopbuffersetuplayout [margin=0pt, width=fit]
\setupheadertexts[\CONTEXT\ imposition test document]showframe
\starttext
% \showframe\dorecurse{164}{\getbuffer[Fakepage]vbox to \textheight{\vfill\midaligned{\tfd ABC}\vfill}\page}\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 P1R3 R2 P5 P6P7 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>\stoptextpoparrangedpagesAB</texcodecode>).
== Cut marks ==
ConTeXt also allows to place cut marks. This can be controlled using the <tt>marking</tt> option of [[{{cmd:setuplayout|\setuplayout]]}}; possible values are:
* '''on''' show cut marks and page number
== Caveat: common troubles ==
Note that some features (e.g. table of contentcontents, 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>
== Getting the last page of a Booklet ==
When you use imposition to print a booklet you want to put something on the very last page, the <code>quadruple</code> pagebreak did not always fill the remaining pages untill until you get a quadruple number of pages.
<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>
 
 
[[Category:Layout]]

Navigation menu