15

I have a doubled-sided A5 landscape document with the following page order:

page order: page 1 front, page 1 back, page 2 front, page 2 back, page 3 front, page 3 back, ...

As my printer supports only A4 paper, I want to print two of these pages on one portrait A4 paper so that I can cut it in half to get sheets of the original size. In other words, what I need is the following page layout:

desired result

(The line separating the two pages is for demonstration purposes only, it is not part of the final result.)

How can I achieve this layout with pdfpages?


The "naive" approach

\documentclass[a4paper]{article}
\usepackage{pdfpages}
\begin{document}
    \includepdf[pages=-,nup=1x2]{a5-document}
\end{document}

yields

naive approach

so the front and back side of each page are one the same side of the paper, instead of appearing on opposite faces.


At the moment, I'm using the following manual solution, which is quite tedious and error-prone, especially for large documents:

\documentclass[a4paper]{article}
\usepackage{pdfpages}
\begin{document}
    \includepdf[pages={1,3,2,4,5,7,6,8,...},nup=1x2]{a5-document}
\end{document}
7
  • 1
    Do you need a latex-solution? I think the using of pdftk in combination with a small script is also possible. Commented Nov 29, 2011 at 18:46
  • 3
    Isn't \includepdf[pages=-,signature=4,landscape]{doc} what you're looking for?
    – egreg
    Commented Nov 29, 2011 at 18:47
  • @MarcoDaniel A pdftk solution would also be acceptable.
    – diabonas
    Commented Nov 29, 2011 at 19:22
  • @egreg With \includepdf[pages=-,signature=4,landscape]{doc}, the pages are placed at the correct position. They are, however, shrunk and rotated by 90 degrees (see the attached image).
    – diabonas
    Commented Nov 29, 2011 at 19:29
  • @diabonas: try with \includepdf[pages=-,signature=4]{doc}. I guess it'll work. :) Commented Nov 29, 2011 at 19:42

4 Answers 4

9

Here is a way how to do this in ConTeXt:

\setuppagenumbering [location=]

\setuppapersize [A5, landscape] [A4]
\setuparranging [2TOPSIDE]

\starttext
    \dorecurse{8}{%
        \centerline{\definedfont[Serif at 256pt]\recurselevel}\page}
\stoptext

The result looks like this:

result

The \setuppapersize command states, that you want to write an A5 landscape document that should be printed on an A4 paper. \setuparranging is used to arrange the pages in the way you wish. Many more schemes are possible.

5
  • Pretty cool :-) Is there some way to include my existing document (which is written in LaTeX, but not in ConTeXt) with something like pdfpages, or do I have to rewrite it using ConTeXt?
    – diabonas
    Commented Nov 29, 2011 at 19:54
  • 1
    You can use \insertpages or e.g. \externalfigure. See include pages from PDF document
    – Marco
    Commented Nov 29, 2011 at 20:18
  • Great! I used \insertpages[a5-document.pdf] and I added \setuplayout[backspace=0pt,topspace=0pt,width=middle,height=middle,location=middle,header=0pt,footer=0pt] as described on Imposition to make the included pages full width. Thank you very much! (I'll wait some time before I accept your answer.)
    – diabonas
    Commented Nov 29, 2011 at 20:31
  • BTW: Your code is missing a }.
    – diabonas
    Commented Nov 29, 2011 at 20:32
  • 2
    @diabonas It's these dwarfs again! They wander around random poeples' computer and eat innocent braces. Not they also discovered TeX.SE :(
    – Marco
    Commented Nov 29, 2011 at 22:53
8

I was curious about an answer to this question, so a lot of search presented me with this great solution provided by Andreas Matthias, the author of pdfpages, posted in comp.text.tex. Since it has an interesting background, I'll provide the whole text, as it's fantastic.

Marked as community-wiki for obvious reasons. :)

Text from Andreas:


pdfpages imposes the pages such that they should be turned over the long edge (while printing), whereas with psnup they should be turned over the short edge. In Postscript this is called /Tumble which can be set to true or false.

Today all duplex printer should be able to do printing in short edge mode as well as long edge mode. So this shouldn't be a big issue.

However, if you like short edge printing more you can direct pdftex (xetex) to rotate every second page. Here's an example:

\documentclass[a4paper,final]{article}
\usepackage{pdfpages}
\usepackage{ifpdf,ifxetex}
\makeatletter
\ifpdf
  \EveryShipout{\ifodd\c@page\else\pdfpageattr{/Rotate 180}\fi}%
\fi
\ifxetex
  \EveryShipout{\ifodd\c@page\special{pdf: put @thispage << /Rotate 180 >>}%
\fi
}

\fi
\makeatother

\begin{document}
\includepdf[pages=-, nup=1x2, booklet=true, landscape]{a5.pdf}
\end{document}

[...]

Ciao

Andreas


Note: \EveryShipout is provided by the everyshi package. :)

Thanks to Andreas and this awesome code, I think the following code will help you:

\documentclass[a4paper]{article}
\usepackage{pdfpages}
\usepackage{ifpdf,ifxetex,everyshi}
\makeatletter
\ifpdf
  \EveryShipout{\ifodd\c@page\else\pdfpageattr{/Rotate 180}\fi}%
\fi
\ifxetex
  \EveryShipout{\ifodd\c@page\special{pdf: put @thispage << /Rotate 180 >>}%
\fi
}

\fi
\makeatother

\begin{document}
\includepdf[pages=-,signature=4,angle=180]{a5-document}
\end{document}

Now I'm sure I know nothing about the ways of the TeX force. :)

1
  • The trick how to rotate pages is really great! The problem in this context, however, is that the page is rotated as a whole. This leads to a wrong placement of the pages, e.g. page 1 front on page 2 front instead of page 1 front on page 1 back (see the example output). To fix this, one would have to rotate the single A5 pages instead. I think this could be done by selectively rotating the pages of the original a5-document.pdf, but I think I'll go with Marco's answer as it is more straightforward :-)
    – diabonas
    Commented Dec 1, 2011 at 20:55
0

For newbies like me:

  • create your pdf that needs to be in A5 format. (i named it "book.pdf")
  • create a tex empty project (i named it "bookA5print.tex")
  • paste/write this in your new .tex file:

    \documentclass[a4paper,final]{article}
    
    \usepackage{pdfpages}
    \usepackage{ifpdf,ifxetex,everyshi}
    \makeatletter
    
    \ifpdf
    \EveryShipout{\ifodd\c@page\else\pdfpageattr{/Rotate 180}\fi}%
    \fi
    
    \ifxetex
    \EveryShipout{\ifodd\c@page\special{pdf: put @thispage << /Rotate 180 >>}%
    \fi
    }
    
    \fi
    \makeatother
    
    \begin{document}
    \includepdf[pages=-, nup=1x2, booklet=true, landscape]{book.pdf}
    \end{document}
    

then execute on your terminal xelatex bookA5print.tex

this avoids the rotation problem.

thanks to Paolo Cereda and Andreas

0

This can be done using the 4 on 2, odd then even layout of pgfmorepages. This puts two logical pages on one physical page, but uses the order 1,3,2,4 (repeated). When printed double sided, this would put the 1st and 2nd pages back to back and the 3rd and 4th, and so on.

You must log in to answer this question.

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