Difference between revisions of "Imposition"

From Wiki
Jump to navigation Jump to search
m (Lowercase switch name)
(24 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
< [[Structurals]] | [[Visuals]] >
 
< [[Structurals]] | [[Visuals]] >
  
==What is Imposition?==
+
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:
  
To impose means to order pages on a bigger sheet in a way, that you get a booklet (or something similar) with correct page order after folding.
+
* Placing four A5 pages on both sides of an A4 sheet: 1 and 4 on the back, 2 and 3 on the front.
In the simplest case you impose four A5 pages on both sides of an A4 sheet.
+
* 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.
  
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 zigzag-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.
+
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>
  
Another "style" of imposition is to place several identical templates on one sheet, e.g. labels.
+
== Imposition schemas ==
  
==What can ConTeXt do for me?==
+
=== Default schemas ===
  
 
ConTeXt has some built-in imposition schemas (see "arranging pages" in the manual):
 
ConTeXt has some built-in imposition schemas (see "arranging pages" in the manual):
  
* 2UP
+
* 2UP : 2 pages next to each other, n sheets arranged for a single booklet
* 2DOWN
+
* 2DOWN : 2 pages above each other,  n sheets arranged for a single booklet
* 2SIDE : 2 pages per form, side by side in pagination order (no real imposition, only paper saving)
+
* 2SIDE : 2 pages per form, side by side in pagination order, single sided only (no real imposition, only paper saving)
* 2*2 : 2 pages per form, for single sheets with front and back
+
* 2TOP : 2 pages above each other, single sided only
* 2**2 : 2 pages per form, for book ordering
+
* 2TOPSIDE: 2 odd pages on one side, two even pages verso, above each other
* 2*4 : 4 pages per form, 2x2 pages head to head
+
* 2*2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for single sheets with front and back)
* 2*8
+
* 2**2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for book ordering)
* 2*16
+
* 2*4 : section: one sheet 2 x 4 pages = 8 pages (4 pages per form, 2x2 pages head to head)
* XY ''(not mentioned in the manual)'' : you can control the number with [[cmd:setuppaper|\setuppaper]][nx=...,ny=...,dx=...,dy=...]
+
* 2*8 : section: one sheet 2 x 8 pages = 16 pages
 +
* 2*16 : section: one sheet 2 x 16 pages = 32 pages
 +
* 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}}[nx=...,ny=...,dx=...,dy=...]
  
 
"form" means "one side of a sheet".
 
"form" means "one side of a sheet".
  
You can access this feature via
+
{{todo|some graphical examples}}
* <cmd>setuparranging</cmd>
 
* <tt>texexec --pdfarrange=...</tt>
 
* [http://www.ntg.nl:8061/impose.pdf online interface]
 
  
{{todo|some graphical examples}}
+
===XY schema===
  
==More==
+
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>
 
<texcode>
\unprotect
+
\setuppapersize[A7][A4,landscape]
% New page imposition scheme 3SIDE by Willi Egger 2003-07-21
+
\setuppaper[nx=4, ny=2] % must come before \setuparranging!
 +
\setuplayout[page][location=middle, marking=on]
 +
\setuparranging [XY]
 +
</texcode>
 +
 
 +
===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>
 +
\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 test]
  
\installpagearrangement 3SIDE
+
\showframe
  {\dosetuparrangement{3}{1}{6}{4}{2}%
+
\setupbackgrounds [text][text][background=screen,backgroundscreen=0.7]
        \pusharrangedpageTHREESIDE\poparrangedpagesAB\relax}
 
  
\def\pusharrangedpageTHREESIDE#1% Willi's approach
+
\setupcolors [state=start]
  {\doglobal\increment\arrangedpageN
+
% Where the block of pages is placed on the sheet
  \reportarrangedpage\arrangedpageN
+
% (Not relevant in this example, but relevant if there is space left over.)
  \ifcase\arrangedpageN
+
\setuplayout [location=middle,marking=on]
  \or \handlearrangedpageXandY{#1}000\arrangedpageA %  1
 
  \or \handlearrangedpageXandY{#1}010\arrangedpageA %  2
 
  \or \handlearrangedpageXandY{#1}020\arrangedpageA %  3
 
  \or \handlearrangedpageXandY{#1}000\arrangedpageB %  4
 
  \or \handlearrangedpageXandY{#1}010\arrangedpageB % 5
 
  \or \handlearrangedpageXandY{#1}020\arrangedpageB % 6
 
        \poparrangedpages
 
  \fi}
 
  
\protect
+
\startbuffer[Fakepage]
</texcode>
+
    \strut
You can use this code simply in your environment file. The other schemas are in <tt>page-imp.tex</tt>.
+
    \blank
 +
    \midaligned{\Style}
 +
    \vfill
 +
    \midaligned{This is page \recurselevel}
 +
    \vfill
 +
\stopbuffer
  
Use it like this:
+
\starttext
<texcode>
+
    \dorecurse{16}{\getbuffer[Fakepage]\page}
\definepapersize [filius][width=92mm, height=172mm]
+
\stoptext
\setuppapersize [filius][A4,landscape]
+
</context>
\setuparranging [3SIDE]
 
\setuplayout [location=middle,
 
alternative=singlesided,
 
grid=no, marking=on,
 
leftmargin=10mm, leftmargindistance=0mm,
 
topspace=2mm, header=4mm, footer=0mm,
 
width=77mm, height=166mm]
 
</texcode>
 
  
 +
=== 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.
+
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).  
 
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:
 
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:
  
Line 81: Line 99:
 
\setuppapersize[A6][A3] %individual page A6 size, print size A3
 
\setuppapersize[A6][A3] %individual page A6 size, print size A3
 
\setuparranging[2*8,rotated] %makes an 8 page gathering when folded (duplex printing!)
 
\setuparranging[2*8,rotated] %makes an 8 page gathering when folded (duplex printing!)
\setupoutput[pdf]
 
 
\setuplayout
 
\setuplayout
 
   [backspace=0pt,
 
   [backspace=0pt,
Line 100: Line 117:
  
 
</texcode>
 
</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=middle,
 +
      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/?search=%5C%5Cdef%5C%5Csetuparranging
 +
 +
Let's say we want this page arrangement on one sheet (R = page upside down):
 +
 +
<pre>P4 P1
 +
R3 R2</pre>
 +
 +
This is a mirrored/reversed version of {{cmd|setuparranging}}<code>[1*4]</code>, which gives:
 +
 +
<pre>R1 R4
 +
P2 P3</pre>
 +
 +
<context source=yes>
 +
% Adapted from page-imp.mkiv
 +
 +
\installpagearrangement 1*4*reversed
 +
  {\dosetuparrangement{2}{2}{4}{3}{3}% X,Y,Total,hcutmarks,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}
 +
 +
\setuppapersize [A10][A8]
 +
\setuparranging [1*4*reversed]
 +
\setuplayout    [margin=0pt, width=fit]
 +
 +
\showframe
 +
 +
\starttext
 +
\dorecurse{4}{\vbox to \textheight{\vfill\midaligned{\tfd ABC}\vfill}\page}
 +
\stoptext
 +
</context>
  
 
== Cut marks ==
 
== 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:
+
ConTeXt also allows to place cut marks. This can be controlled using the <tt>marking</tt> option of {{cmd|setuplayout}}; possible values are:
  
 
* '''on''' show cut marks and page number
 
* '''on''' show cut marks and page number
Line 123: Line 210:
 
== Caveat: common troubles ==
 
== Caveat: common troubles ==
  
Note that some features (e.g. table of content, internal references) are always disabled in imposition mode. So, they will not be included in the pdf if you ask for imposition.
+
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 texexec.  
 
To get rid of this you can use the "arrange" key for texexec.  
  
Line 132: Line 219:
 
This will run the document at first without page arrangement and impose the pages in a separate run after table of contents etc are created.
 
This will run the document at first without page arrangement and impose the pages in a separate run after table of contents etc are created.
  
'''Note for Scite/Win-ConTeXt users''': The command <tt>Process and Arrange</tt> in the Tools menu runs this command in Scite.
+
In '''SciTe/WinConTeXt''' you can run this command by choosing ''Process and Arrange'' in the ''Tools'' menu in SciTe.
  
 
== Getting the last page of a Booklet ==
 
== 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 you get a quadruple number of pages.
+
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 until you get a quadruple number of pages.
  
 
<texcode>
 
<texcode>
Line 223: Line 310:
 
\stoptext
 
\stoptext
 
</texcode>
 
</texcode>
 +
 +
== Imposition by signatures ==
 +
 +
Sometimes you want a booklet, but the pages are too many to be folded together. This is true especially when the number of pages rises above 80. So you need to pass the output PDF to an imposer, like pdfjam or psbook or pdfpages. The problem is that you need to get the "right" number of pages.
 +
 +
E.g., if the original pages are 128, no problem, the signature is 64 and you can impose it without problems.
 +
 +
But, if the original pages are 129, the optimal signature is 44, so
 +
you need to add 3 pages during the PDF compiling.
 +
 +
First, create the following imposer.lua file
 +
 +
<pre>
 +
-- translated from perl to lua. Original code is in
 +
-- http://theanarchistlibrary.org/docs/altools-6.6.tar.gz
 +
 +
local maxsignature = 80 -- define the maximum of the signature
 +
local minsignature = 20 -- define the minimum of the signature
 +
function optimize_signature(pages)
 +
  local originalpages = pages
 +
  -- be sure we don't mess up
 +
  assert(numberpage ~= 0, "I can't work with 0 pages")
 +
 +
  --set needed pages to and and signature to 0
 +
  local neededpages, signature = 0,0
 +
 +
  -- this means that we have to work with n*4, if not, add them to
 +
  -- needed pages
 +
  local modulo = pages % 4
 +
  if modulo==0 then
 +
      signature=pages
 +
  else
 +
      neededpages = 4 - modulo
 +
  end
 +
 +
  -- add the needed pages to pages
 +
  pages = pages + neededpages
 +
 
 +
  -- give a try with the signature
 +
  signature = find_signature(pages)
 +
 
 +
  -- if the pages, are more than the max signature, find the right one
 +
  if pages>maxsignature then
 +
      while signature<minsignature do
 +
pages = pages + 4
 +
neededpages = 4 + neededpages
 +
signature = find_signature(pages)
 +
      end
 +
  end
 +
 
 +
  print("ImposerMessage:: Original pages: " .. originalpages .. "; " ..
 +
"Signature is " .. signature .. ", " ..
 +
neededpages .. " pages are needed, " ..
 +
pages ..  " of output")
 +
  -- let's do it
 +
  tex.print("\\dorecurse{" .. neededpages .. "}{\\page[empty]}")
 +
 +
end
 +
 +
function find_signature(number)
 +
  assert(number ~= 0, "I can't find the signature for 0 pages")
 +
  assert((number % 4) == 0, "I suppose something is wrong, not a n*4")
 +
  local i = maxsignature
 +
  while i>0 do
 +
      if (number % i) == 0 then
 +
return i
 +
      end
 +
      i = i - 4
 +
  end
 +
end
 +
 +
</pre>
 +
 +
The ImposerMessage is important if you want to pass the output of the ConTeXt run to a script to do the imposing.
 +
 +
Then the master file
 +
 +
<texcode>
 +
\def\fillthesignature#1{
 +
  \directlua{dofile("imposer.lua")
 +
    optimize_signature(#1)}}
 +
\starttext
 +
 +
\dorecurse{53}{
 +
\chapter{test}
 +
\input tufte
 +
\section{\the\realpageno}}
 +
 +
 +
\page[yes] % reset the page
 +
\fillthesignature{\the\realpageno}
 +
 +
And this is the last page (the backcover)
 +
 +
\stoptext
 +
 +
</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}}

Revision as of 13:31, 20 April 2019

< 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:

  • 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.

In general, imposition is accessed in ConTeXt using \setuparranging, or from the command line as follows (mkiv and mkii, respectively):

context --pdfarrange=...
texexec --pdfarrange=...

Imposition schemas

Default schemas

ConTeXt has some built-in imposition schemas (see "arranging pages" in the manual):

  • 2UP : 2 pages next to each other, n sheets arranged for a single booklet
  • 2DOWN : 2 pages above each other, n sheets arranged for a single booklet
  • 2SIDE : 2 pages per form, side by side in pagination order, single sided only (no real imposition, only paper saving)
  • 2TOP : 2 pages above each other, single sided only
  • 2TOPSIDE: 2 odd pages on one side, two even pages verso, above each other
  • 2*2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for single sheets with front and back)
  • 2**2 : section: one sheet 2 x 2 pages = 4 pages (2 pages per form, for book ordering)
  • 2*4 : section: one sheet 2 x 4 pages = 8 pages (4 pages per form, 2x2 pages head to head)
  • 2*8 : section: one sheet 2 x 8 pages = 16 pages
  • 2*16 : section: one sheet 2 x 16 pages = 32 pages
  • 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 \setuppaper[nx=...,ny=...,dx=...,dy=...]

"form" means "one side of a sheet".


TODO: some graphical examples (See: To-Do List)


XY schema

Beware, you need to set up your XY arranging in the right order:

\setuppapersize[A7][A4,landscape]
\setuppaper[nx=4, ny=2] % must come before \setuparranging!
\setuplayout[page][location=middle, marking=on]
\setuparranging [XY]

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.)

\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 test]

\showframe
\setupbackgrounds [text][text][background=screen,backgroundscreen=0.7] 

\setupcolors [state=start]
% Where the block of pages is placed on the sheet 
% (Not relevant in this example, but relevant if there is space left over.)
\setuplayout [location=middle,marking=on]

\startbuffer[Fakepage]
    \strut
    \blank
    \midaligned{\Style}
    \vfill
    \midaligned{This is page \recurselevel}
    \vfill
\stopbuffer

\starttext
    \dorecurse{16}{\getbuffer[Fakepage]\page}
\stoptext

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). 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!)
\setuplayout
  [backspace=0pt,
    topspace=0pt,
       width=middle,
      height=middle,
    location=middle,
      header=0pt,
      footer=0pt]
\setuppagenumbering[alternative=doublesided]

\starttext

\insertpages
  [original_file.pdf][width=0pt]

\stoptext

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 \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.

\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=middle,
      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

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 page-imp.mkiv and find the closest one to work with. You can access the file online:

https://source.contextgarden.net/?search=%5C%5Cdef%5C%5Csetuparranging

Let's say we want this page arrangement on one sheet (R = page upside down):

P4 P1
R3 R2

This is a mirrored/reversed version of \setuparranging[1*4], which gives:

R1 R4
P2 P3
% Adapted from page-imp.mkiv

\installpagearrangement 1*4*reversed
   {\dosetuparrangement{2}{2}{4}{3}{3}% X,Y,Total,hcutmarks,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}

\setuppapersize [A10][A8]
\setuparranging [1*4*reversed]
\setuplayout    [margin=0pt, width=fit]

\showframe

\starttext
\dorecurse{4}{\vbox to \textheight{\vfill\midaligned{\tfd ABC}\vfill}\page}
\stoptext

Cut marks

ConTeXt also allows to place cut marks. This can be controlled using the marking option of \setuplayout; possible values are:

  • on show cut marks and page number
  • screen ditto, but also print a grey-scale colour bar
  • colour ditto, but also print a colour bar
  • text print a text, defaults to empty

The default settings are

\def\pagecutmarksymbol    {\the\realpageno}
\def\pagecutmarklength    {.5cm}
\let\pagecutmarktoptext    \empty
\let\pagecutmarkbottomtext \empty

To obtain register marks (or also called registration marks) you can use the small crop module which was posted to the mailing list.

Caveat: common troubles

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 texexec.

texexec --arrange yourFilename

This will run the document at first without page arrangement and impose the pages in a separate run after table of contents etc are created.

In SciTe/WinConTeXt you can run this command by choosing Process and Arrange in the Tools menu in SciTe.

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 quadruple pagebreak did not always fill the remaining pages until you get a quadruple number of pages.

\unprotect

\startvariables    all
    nextquadruple: nextquadruple
\stopvariables

\installpagebreakhandler \v!nextquadruple
  {\ifdoublesided
     \!!counta\realpageno
     \!!countb\realpageno
     \advance\!!counta 4
     \divide\!!counta 4
     \multiply\!!counta 4
     \advance\!!countb 1
     \advance\!!counta-\!!countb
     \executepagebreakhandler\v!yes
     \dorecurse\!!counta{\executepagebreakhandler\v!empty}%
   \fi}

\protect

\setuppapersize[A5][A4]
\setuparranging[2UP,rotated,doublesided]
\setuppagenumbering[alternative=doublesided]

\starttext

\subject{Front Cover}

\dorecurse{10}{\input tufte \par}

\page[nextquadruple]

Back Cover

\stoptext

Getting to the Back Cover of a Booklet

When using imposition to print an a5 booklet (a4 folded in half) John Devereux wanted to specify content for the back cover, independently of the actual number of pages in the booklet. Here is a way that worked (thanks to Wolfgang Schuster on the mailing list). \page[beforequadruple] gets to the inside back cover. Another \page gets to the outside back cover.

\unprotect

\startvariables    all
  beforequadruple: beforequadruple
\stopvariables

\installpagebreakhandler \v!beforequadruple
  {\ifdoublesided
     \!!counta\realpageno
     \!!countb\realpageno
     \advance\!!counta 5
     \divide\!!counta 4
     \multiply\!!counta 4
     \advance\!!countb 2
     \advance\!!counta-\!!countb
     \executepagebreakhandler\v!yes
     \dorecurse\!!counta{\executepagebreakhandler\v!empty}%
   \fi}

\protect

\setuppapersize[A5][A4]
\setuparranging[2UP,rotated,doublesided]
\setuppagenumbering[alternative=doublesided]

\starttext

\subject Front Cover

\dorecurse{10}{\input tufte \par}

\page[beforequadruple]

Imprint

\page

Back Cover

\stoptext

Imposition by signatures

Sometimes you want a booklet, but the pages are too many to be folded together. This is true especially when the number of pages rises above 80. So you need to pass the output PDF to an imposer, like pdfjam or psbook or pdfpages. The problem is that you need to get the "right" number of pages.

E.g., if the original pages are 128, no problem, the signature is 64 and you can impose it without problems.

But, if the original pages are 129, the optimal signature is 44, so you need to add 3 pages during the PDF compiling.

First, create the following imposer.lua file

-- translated from perl to lua. Original code is in
-- http://theanarchistlibrary.org/docs/altools-6.6.tar.gz

local maxsignature = 80 -- define the maximum of the signature
local minsignature = 20 -- define the minimum of the signature
function optimize_signature(pages)
   local originalpages = pages
   -- be sure we don't mess up
   assert(numberpage ~= 0, "I can't work with 0 pages")

   --set needed pages to and and signature to 0
   local neededpages, signature = 0,0

   -- this means that we have to work with n*4, if not, add them to
   -- needed pages 
   local modulo = pages % 4
   if modulo==0 then
      signature=pages
   else
      neededpages = 4 - modulo
   end

   -- add the needed pages to pages
   pages = pages + neededpages
   
   -- give a try with the signature
   signature = find_signature(pages)
   
   -- if the pages, are more than the max signature, find the right one
   if pages>maxsignature then
      while signature<minsignature do
	 pages = pages + 4
	 neededpages = 4 + neededpages
	 signature = find_signature(pages)
      end
   end
   
   print("ImposerMessage:: Original pages: " .. originalpages .. "; " .. 
	 "Signature is " .. signature .. ", " ..
	 neededpages .. " pages are needed, " .. 
	 pages ..  " of output")
   -- let's do it
   tex.print("\\dorecurse{" .. neededpages .. "}{\\page[empty]}")

end

function find_signature(number)
   assert(number ~= 0, "I can't find the signature for 0 pages")
   assert((number % 4) == 0, "I suppose something is wrong, not a n*4")
   local i = maxsignature
   while i>0 do
      if (number % i) == 0 then
	 return i
      end
      i = i - 4
   end
end

The ImposerMessage is important if you want to pass the output of the ConTeXt run to a script to do the imposing.

Then the master file

\def\fillthesignature#1{
  \directlua{dofile("imposer.lua") 
    optimize_signature(#1)}}
\starttext

\dorecurse{53}{
\chapter{test}
\input tufte
\section{\the\realpageno}}


\page[yes] % reset the page
\fillthesignature{\the\realpageno}

And this is the last page (the backcover)

\stoptext

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.

Template:Getting started navbox