10

Friends, consider the following example (mytext.tex):

\documentclass[a5paper,oneside,12pt]{book}

\begin{document}

{\Huge A}

\newpage

{\Huge B}

\newpage

{\Huge C}

\newpage

{\Huge D}

\newpage

{\Huge E}

\newpage

{\Huge F}

\newpage

{\Huge G}

\newpage

{\Huge H}

\end{document}

I'd like to generate and print a booklet using the pdfpages package as suggested in Booklets in memoir class, so my other code looks like this:

\documentclass{scrartcl}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-,booklet,landscape]{mytext.pdf}
\end{document}

It works perfectly, and my booklet is done, with 2 pages from the original document in each page of the new document. This is the result:

   Page 1      |     Page 2       |    Page 3      |     Page 4
  H       A    |    B       G     |   F       C    |    D       E
Page 8  Page 1 |  Page 2  Page 7  | Page 6  Page 3 |  Page 4  Page 5

This is the booklet format. So far, so good.

It happens that I should print it by myself, and this format is not good for my needs. So I'd like if the pdfpages could insert pages in the following format:

   Page 1      |     Page 2       |    Page 3      |     Page 4
  D       A    |    B       C     |   G       D    |    E       F
Page 4  Page 1 |  Page 2  Page 3  | Page 8  Page 5 |  Page 6  Page 7

That way, I could print my document in both sides and cut the pages easily:

Pages

EDIT: Other view (pages 2 and 4 are flipped just to explain their position):

Page

In other words:

Pages

where n is a page number such that n mod 4 = 1.

Could also be [n+2, n], [n+1, n+3] instead of [n+3, n], [n+1, n+2].

As one mentioned, I could manually specify the page order, but it's not feasible for a document with +100 pages.

Any ideas?

4
  • Personally I would just write a quick shell or Perl script printing the requiered page list. But you can also write a TeX loop to do this. Note that you actually can read out the number of pages in an external PDF using a pdfTeX command, which can then be used as upper limit of the loop. I can't however recall it just now. See the pdftex manual. Commented Jun 28, 2011 at 21:13
  • @Martin: Thanks for the idea, I wrote a Python script and it worked perfectly! Anyway, while trying other options, I found an easier solution with no external tools, may I post that as an answer? Commented Jun 28, 2011 at 22:01
  • it's always fine to post an answer yourself. There's some delay before you can accept it though.
    – Alan Munn
    Commented Jun 28, 2011 at 22:22
  • @Alan Thanks! I'll post it. I didn't expect to find an answer by myself. =) Commented Jun 28, 2011 at 22:24

2 Answers 2

9

I was unaware of the following option in the pdfpages package:

signature Creates booklets by rearranging pages into signatures and setting nup=1x2 or nup=2x1, respectively. This option takes one argument specifying the size of the signature, which should be a multiple of 4.

Right after this paragraph, I could discover that the booklet option uses signature under the hood:

booklet This option is just a shortcut of the signature option, if you choose a signature value so large that all pages fit into one signature. Either true or false (or no value, which is equivalent to true). (Default: booklet=false)

So, the solution:

\documentclass{scrartcl}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-,signature=4,landscape]{mytext.pdf}
\end{document}

The output was like I expected. =)

2
  • 1
    And I was just starting to code a nice loop for you :-( ;-) Commented Jun 28, 2011 at 23:18
  • @Martin: Sorry for spoiling the fun. =) I didn't notice that option before. Anyway, I'd love to learn how to code a nice loop for that. =) Commented Jun 29, 2011 at 0:51
1

This can be achieved using the 4 on 2, book format layout of the pgfmorepages package. See the documentation for details.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .