# [NTG-context] Is it possible to define a custom imposition schema? (sure it is, but how?)

Marco Pessotto melmothx at gmail.com
Tue May 29 19:06:23 CEST 2012

Hello there.

I'd need a custom imposition schema, just like the 2*4*2, but first the
sheets will be folded, then inserted in signatures of 16 pages, and then
finally bound. (They said the machine can fold only one sheet).

I came up with 3 "solutions" (or 3 hacks, as you wish):

1. psutils/pstops

2. layers

3. hack page-imp.mkiv

1. The first solution would be the faster, but after spending a day on
it I gave up, because I have endless issue with cropped pages, paper
dimension not correctly set, and I only scratched the surface. I don't
know if exists some support for psutils (doesn't look so), but I have
the feeling that software is pretty dead.

2. Layers: I'm attaching the code below. Does it seem sensible, or is
there a better way to do it? (I'll create a template from that, and will
loop over every 16 pages with the usual perl hack). It seems to work,
even if visually it looks a bit shifted to right (I can adjust
it manually). [An alternate approach could be just various \hbox, but
maybe the layer solution is better for absolute positioning]

3. page-imp.mkiv would be the best solution (obviously). I've dug a bit
into the code, but I'm in deep waters. I can't understand where the
sequence of the pages is defined. the \pusharrangedpageSCHEMA seems just
to define the position inside the page, not the sequence of the shipped
out page. Also, what are \c_page_marks_nx and \c_page_marks_ny?  Any
hint about how this machinery works?

Thanks

Best wishes

% start draft

\definepapersize[carta][width=320mm,height=440mm]
\setuppapersize[carta][carta]
\setuplayout
[topspace=0pt,
backspace=0pt,
footer=0pt,
margin=0pt,
marking=on,
width=320mm,
height=440mm,
location=middle]

\setuppagenumbering[alternative=doublesided,location=]
\setuprotate[location=depth,rotation=180]

% \showframe

\starttext

% page one

\definelayer[PageLayer1][position=no]
\setuplayer
[PageLayer]
[preset=topleft,
height=\paperheight,width=\paperwidth]

\setlayer[PageLayer1][x=0mm,y=0mm]{
\rotate{
\externalfigure[libretto.pdf][page=13]
}
}
\setlayer[PageLayer1][x=160mm,y=0mm]{
\rotate{
\externalfigure[libretto.pdf][page=4]
}
}
\setlayer[PageLayer1][x=0mm,y=220mm]{
\externalfigure[libretto.pdf][page=16]
}
\setlayer[PageLayer1][x=160mm,y=220mm]{
\externalfigure[libretto.pdf][page=1]
}
\placelayer[PageLayer1]

%%% page 2

\definelayer[PageLayer2][position=no]
\setuplayer
[PageLayer]
[preset=topleft,
option=test,
height=\paperheight,width=\paperwidth]

\setlayer[PageLayer2][x=0mm,y=0mm]{
\rotate{
\externalfigure[libretto.pdf][page=3]
}
}
\setlayer[PageLayer2][x=160mm,y=0mm]{
\rotate{
\externalfigure[libretto.pdf][page=14]
}
}
\setlayer[PageLayer2][x=0mm,y=220mm]{
\externalfigure[libretto.pdf][page=2]
}
\setlayer[PageLayer2][x=160mm,y=220mm]{
\externalfigure[libretto.pdf][page=15]
}
\placelayer[PageLayer2]

%page 3

\definelayer[PageLayer3][position=no]
\setuplayer
[PageLayer]
[preset=topleft,
option=test,
height=\paperheight,width=\paperwidth]

\setlayer[PageLayer3][x=0mm,y=0mm]{
\rotate{
\externalfigure[libretto.pdf][page=9]
}
}
\setlayer[PageLayer3][x=160mm,y=0mm]{
\rotate{
\externalfigure[libretto.pdf][page=8]
}
}
\setlayer[PageLayer3][x=0mm,y=220mm]{
\externalfigure[libretto.pdf][page=12]
}
\setlayer[PageLayer3][x=160mm,y=220mm]{
\externalfigure[libretto.pdf][page=5]
}
\placelayer[PageLayer3]

% page 4
\definelayer[PageLayer4][position=no]
\setuplayer
[PageLayer]
[preset=topleft,
option=test,
height=\paperheight,width=\paperwidth]

\setlayer[PageLayer4][x=0mm,y=0mm]{
\rotate{
\externalfigure[libretto.pdf][page=7]
}
}
\setlayer[PageLayer4][x=160mm,y=0mm]{
\rotate{
\externalfigure[libretto.pdf][page=10]
}
}
\setlayer[PageLayer4][x=0mm,y=220mm]{
\externalfigure[libretto.pdf][page=6]
}
\setlayer[PageLayer4][x=160mm,y=220mm]{
\externalfigure[libretto.pdf][page=11]
}
\placelayer[PageLayer4]

\stoptext

--
Marco