Here’s a two step solution I blogged this month (german: Booklets erzeugen):
- make you document in single pages (A5) as you already do
- use the following code to impose a booklet
\documentclass[
paper=296mm:210mm,
]{scrartcl}
\usepackage{xparse}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{
every node/.style = {
inner sep = 0pt,
outer sep = 0pt,
}
}
\ExplSyntaxOn
\int_new:N \l_booklet_sheets_int
\int_new:N \l_booklet_counter_int
\int_new:N \l_booklet_total_pages_int
\int_new:N \l_booklet_total_pages_to_four_int
\dim_new:N \l_booklet_creep_dim
\cs_new:Npn \booklet_get_page:nn #1#2 {
\int_compare:nT { ( #1 ) <= \l_booklet_total_pages_int } {
\includegraphics [
width = 0.5\paperwidth,
height = \paperheight,
keepaspectratio,
page = #1,
] { #2 }
}
}
\NewDocumentCommand { \MakeBooklet } { O{0mm} m } {
\file_if_exist:nTF { #2 .pdf } {
\int_zero:N \l_booklet_counter_int
\dim_zero:N \l_booklet_creep_dim
\pdfximage { #2 .pdf }
\int_set:Nn \l_booklet_total_pages_int
{ \the \pdflastximagepages }
\int_compare:nTF { \int_mod:nn { \l_booklet_total_pages_int } { 4 } != 0 } {
\int_set:Nn \l_booklet_total_pages_to_four_int
{ \l_booklet_total_pages_int + 4 - \int_mod:nn { \l_booklet_total_pages_int } { 4 } }
} {
\int_set_eq:NN \l_booklet_total_pages_to_four_int \l_booklet_total_pages_int
}
\int_set:Nn \l_booklet_sheets_int
{ \l_booklet_total_pages_to_four_int / 2 }
\int_do_while:nn { \l_booklet_counter_int < \l_booklet_sheets_int } {
\clearpage
\int_incr:N \l_booklet_counter_int
\begin{tikzpicture}[remember~picture, overlay]
\clip (current~page.north) rectangle (current~page.south~east);
\node [anchor = west] at ($
(current~page.center)
-
(\dim_use:N \l_booklet_creep_dim, 0)
$) {
\booklet_get_page:nn
{ \int_use:N \l_booklet_counter_int }
{ #2 }
};
\end{tikzpicture}
\begin{tikzpicture}[remember~picture, overlay]
\clip (current~page.north~west) rectangle (current~page.south);
\node [anchor = east] at ($
(current~page.center)
+
(\dim_use:N \l_booklet_creep_dim, 0)
$) {
\booklet_get_page:nn
{ \int_eval:n { \l_booklet_total_pages_to_four_int - \l_booklet_counter_int + 1 } }
{ #2 }
};
\end{tikzpicture}
\clearpage
\int_incr:N \l_booklet_counter_int
\begin{tikzpicture}[remember~picture, overlay]
\clip (current~page.north~west) rectangle (current~page.south);
\node [anchor = east] at ($
(current~page.center)
+
(\dim_use:N \l_booklet_creep_dim, 0)
$) {
\booklet_get_page:nn
{ \int_use:N \l_booklet_counter_int }
{ #2 }
};
\end{tikzpicture}
\begin{tikzpicture}[remember~picture, overlay]
\clip (current~page.north) rectangle (current~page.south~east);
\node [anchor = west] at ($
(current~page.center)
-
(\dim_use:N \l_booklet_creep_dim, 0)
$) {
\booklet_get_page:nn
{ \int_eval:n { \l_booklet_total_pages_to_four_int - \l_booklet_counter_int + 1 } }
{ #2 }
};
\end{tikzpicture}
\dim_set:Nn \l_booklet_creep_dim {
#1 * \l_booklet_counter_int / 2
}
}
} {
\Huge
\noindent \textbf { Error! } \\
File ~ \texttt { #2 .pdf } ~ not ~ found.
}
}
\ExplSyntaxOff
\pagestyle{empty}
\begin{document}
% #1 = shift per sheet (= thickness of paper, see below) [optional]
% #2 = filename without suffix (must be a PDF)
\MakeBooklet[1mm]{singe-pages}
\end{document}
The paper size of the printing sheets is given as class option paper=b:h
with b
= 2 × width of close booklet width and h
= booklet hight. Then one can simply copy the implementation code and use \MakeBooklet
. Run pdflatex
(at least) twice to get the correct positions.
You can finde details about the implementation in my german blog article, linked above …
How to calculate the shift per page?
The shift of the most inner (middle) pages compared to the outer (first and last) pages – the creep - can be calculated with this equation:
creep = (count of pages incl. cover – 4) ÷ 4 × thickness of paper
creep = (count of sheets – 1) × thickness of paper
The shift for pages on a certain sheet – lets call it v – with this one:
v = creep ÷ (count of sheets – 1) × (sheet number – 1)
v = thickness of paper × (sheet number – 1)
Where “page” refers to the pages of the single paged (A5) document and “sheet” to the printed (A4) paper sheets.
geometry
ortypearea
, not both. You already mentionBCOR
, which does the job. But i don't understand why you print on A4 and bind A5 and why you need only every 4th page adjusted. I also don't understand why papers get pushed outside and you need a negative binding correction. Usually, you need a correction greater 0 because you need that space for binding.zwpagelayout
. I've never used it, but it seems to support something like this. However, you would need to switch.