Im new to tex so I'm sorry if this is something is actually easy to do but I cannot find a solution.

I want to print a signature/booklet of my book by printing two separate parts of the sig on one piece of paper. Here's an example with a 16 page signature

   |  Page 1  A side  |  Page 1  B side  |  |  Page 2  A side  |  Page 2  B side  |
   |                  |                  |  |                  |                  |
   |   P        A     |     B       O    |  |   L         E    |   F         K    |
   |                  |                  |  |                  |                  |
   | Page 16  Page 1  |   Page 2 Page 15 |  | Page 12   Page 5 | Page 6   Page 11 |
   |                  |                  |  |                  |                  |
   |   N        C     |    D       M     |  |   J         G    |    H        I    |
   |                  |                  |  |                  |                  |
   | Page 14  Page 3  |  Page 4  Page 13 |  | Page 10   Page 7 |  Page 8   Page 9 |     

I would then cut the pages in half and put the signatures together. Before I discovered TEX I would use a regular word processing program and output the pdfs by specifying the order by hand like this:


which is fine when it's something as small as this but figuring out the order and checking for typos for 40+ pages in each of the 8 signatures in a book takes a long time as you can imagine.

What I'm asking is, Is there a way or a package to automatically preform this kind of page ordering when outputting a pdf in TEX?

Many thanks in advance.

Edit: I just wanted to add to add a quick bat code I use to quickly run a pdf through the tex code that Malipivo posted (thanks again!) without having to run each file one by one


SET /P UserInput=Please Enter File Name(including path):

copy %UserInput% "c:\path to the tex files folder\Book.pdf"

cd "c:\path to the tex files folder\"

pdflatex order.tex

pdflatex order2.tex

pdflatex order3.tex

pdflatex order4.tex

%This part is optional but it's nice to automatically move the finished file out of the working folder
rename order4.pdf Signature.pdf

move Signature.pdf Signatures\
  • You mention that you have a book - a finished PDF version of a document - already. You can use TeX to arrange this layout in a document via pdfpages, which wouldn't require you to "check for typos for 40+ pages...
    – Werner
    Commented May 19, 2014 at 17:22
  • Possible duplicate: tex.stackexchange.com/questions/36558/… When using the pdfpages package there is a booklet option or you could use signature=40 (any number which is a multiple of 4 is fine) if that option wouldn't be sufficient for you.
    – Malipivo
    Commented May 19, 2014 at 18:35
  • @werner Ah I dont have the pdf. Sorry, by book I was referring to my doc. Ill edit the post to prevent further misunderstandings. I already had the document formatted in another program when i discovered TEX I was going to use a converting program like writer2latex. I'll try making a pdf in the other program after reading through the documentation for pdfpages and see how it goes. Commented May 19, 2014 at 18:43
  • @Malipivo Ah thanks for the link! It's similar to what I need but unless I'm misunderstanding, this is only for 2 full pages on each side of the sheet and not the 4 full pages on each side plus the booklet mode. I'll try changing some of the options and see if it'll work though in a bit (I assume [2TOPSIDE] needs to be [4TOPSIDE]) Commented May 19, 2014 at 19:14
  • I also found this question too that might help me a lot while working on this. Commented May 19, 2014 at 19:21

4 Answers 4


When we cannot use one- nor two-step arranging, why not to use an approach with even more steps? I haven't found better way so far, ConTeXt is probably offering solution out-of-box.

I've prepared a series of TeX files:

  • A book with specific number of pages (mal-arrange-0.tex). Let it be 16 pages as in the OP's example. A multiple of 8 should be used. I've tested other pages (20, 21, 22) and rearranging is working but there are empty pages added upto nearest multiple of 8.
  • A basic booklet rearranging of the book (mal-arrange-1.tex). In production we wouldn't use frame parameter.
  • A rotation of even pages by 180 degrees (mal-arrange-2.tex) for further use.
  • The final arrangement of one paper using basic nup=2x2 (mal-arrange-3.tex). This is the version the OP is asking for.
  • Splitting up paper into two pages (Side A, Side B) (mal-arrange-4.tex), if needed.

We can run any major LaTeX engine - I've tested pdflatex, xelatex, and lualatex, e.g.

pdflatex mal-arrange-0.tex  
pdflatex mal-arrange-1.tex  
pdflatex mal-arrange-2.tex  
pdflatex mal-arrange-3.tex  
pdflatex mal-arrange-4.tex  

An alternative. In Linux-like environments we would probably use something like this:

# Getting the PDF files...
echo -n "Step"
engine="pdflatex" # pdflatex, xelatex or lualatex
for number in {0..4}; do
  echo -n " "$number
  $engine mal-arrange-$number.tex 1>/dev/null 2>/dev/null

Optional. We can clean up the files in Linux/CygWin by executing the following lines:

# Cleaning up files...
rm mal-arrange-{0..4}.{aux,log}  
rm mal-arrange-{0..3}.pdf  

I enclose the TeX files and a preview of the PDF files. The blue rectangles represent pages.

% any LaTeX engine; mal-arrange-0.tex
\def\numberofpages{16} % to be changed from 16, e.g. 48; 
% any number can be used, there will be empty pages upto a multiple of 8, 
% e.g. when 17 pages is used, you will find 7 empty pages...
\font\mfont=cmr10 at 250pt \mfont
  \advance\malc by 1
\ifnum\malc<\numberofpages\repeat % e.g. 16 or 48, a multiple of 8 is best

mwe, part 0, the initial part

% any LaTeX engine; mal-arrange-1.tex
\includepdf[pages={-},booklet,landscape,frame]{mal-arrange-0.pdf}%frame to be turned off in production

mwe, part 1

% any LaTeX engine; mal-arrange-2.tex
% there is some shift if xelatex engine is run with letterpaper (?)
\ifxetex % xelatex
\else % pdflatex+lualatex
\newcount\mcounter \mcounter=0
\advance\mcounter by 1
\fi % End of \ifodd...

mwe, part 2

% any LaTeX engine; mal-arrange-3.tex
\pdfpagewidth=\paperwidth % for xelatex
\pdfpageheight=\paperheight % for xelatex

mwe, part 3

% any LaTeX engine; mal-arrange-4.tex
\ifxetex % xelatex
\else % pdflatex+lualatex
\newcount\mcounter \mcounter=0
\advance\mcounter by 1
\includepdf[pages={\the\mcounter},viewport=0 0 {0.5\paperheight} {\paperwidth},clip]{\mfile} % left half
\includepdf[pages={\the\mcounter},viewport={0.5\paperheight} 0 {\paperheight} {\paperwidth},clip]{\mfile} % right half

mwe, part 4, the final part

  • 2
    Thank thank thank thANKS A LOT! This solved it perfectly! You have saved me a ton of grief. Commented May 20, 2014 at 21:24
  • 3
    This is really impressive stuff. I wish that I had a need to use it!
    – cfr
    Commented Jun 1, 2014 at 23:01

Use makebook:


This is a bash script which automates all the process of making a new document to compile your document with pdfpages. It has lots of options: paper size, scaling, offsets (for binding corrections, for example), signature size, and so forth. I'm on my phone, so I can't try it; but off the top of my head, the command you'd need is:

makebook -t octavo -H 2.75in -w 2.125in -i mydoc.pdf

This will output mydoc_sigs.pdf, which will be the original document rearranged on octavo signatures (sixteen pages per sheet, eight per side). This assumes that you designed your pages for this small size; if that's not true, you'll need some different options. It also assumes vertical page orientation.

Disclaimer: I wrote and use makebook, so my opinion on its utility is biased.


This is not a solution but it is too long for a comment. The reason I'm posting it is in the hopes that somebody else might be able to turn it into a solution. pdfpages can create the signatures. It can also (with a bit of manual config) put the resulting signature pages on the correct physical pages of the final document. However, every other physical page has its logical signature pages upside down and I can't figure out how to prevent this.

I used this code to compile a 16 page PDF in A6 size. Obviously not what you'll have but just for demonstration purposes it should work. This code is actually irrelevant. I just needed a 16 page PDF to experiment with.


  \@for \xx:=\mynos\do{%
    \Huge Page \xx




I renamed the PDF to mypages.pdf. Then this code:





produces this output:

Signature pages on A5

So if you planned to print the signatures at this point on A5 (or US equivalent), all would by hunky-dory. I renamed the PDF mypages-sig.pdf.

You can use pdfpages again to get things onto the right bits of physical paper but this takes a bit of manual intervention:





Not very elegant. Worse still, the result is unfortunately not what you want:

Deformed signatures on A4

If it were possible to create a one-sided signature in the first step which did not try to arrange things for two-sided printing, it might work. But I am not sure whether that's possible. pdfpages rotates the pages as if for two-sided printing regardless, it seems. So the results always end up wrong at the final stage.

The other thing to look at might be pgfpages. This is no good for the first stage which creates the signatures. But maybe for the second stage...


The package pgfmorepages can handle this sort of thing. There isn't a predefined layout for 8 pages on 1 in booklet layout (there's an 8 pages on 4 in booklet layout, and an 8 pages on 1 in normal layout) but more layouts can be defined. See the documentation for details.

You must log in to answer this question.

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