How to create LaTeX booklets

The easiest way to print a booklet out of any PDF

If you are printing a lot of... well, anything, sure you would love to make booklets out of what you print. If you happen to be a mathematician, you sure are printing lots of papers with more than 20 pages, which turn to 10 unmanageable pages when double-sided. But making a booklet allows you to turn them to just a little folded thing that you can read easier.

When printing in MacOSX you can print booklets, but they are supposed to be cut, not folded across as you would do to bind a book. But there is a clean solution using LaTeX to print your A4 booklets (and even your A6 booklets!) The LaTeX package pdfpages lets you make the booklets you've always loved. You'll need a .tex file with the following content:
explain later]{complete path to your pdf file}
If you take a look to a nearby book, you'll see that it is formed by a certain number of packages which consist of folded pages. The signature is the number of pages you want to have in each package, and must be a multiple of 4. This said, if you just have something small (around 40 or 50 pages) you can ignore this setting and set it as a multiple of 4 which exceeds the number of pages (32 is a good guess). I set usually this to 32, unless what I print is between 32 and 64 pages, then I adjust for the largest multiple of 4. If I'm doing something more like a book, I'll go for 44, as in my tutorial Easy Paperback Bookbinding How-to.

Fill in the gaps, and compile with pdflatex to get a nice pdf booklet.

If you happen to be also an Emacs junkie (and know something about Emacs Lisp), below you can find a function definition. If not, be sure to check related posts for some other interesting (maybe!) things.
(defun Booklet (NumPag)
(interactive "sNumPĂ g:")
(let ((bookletprev (buffer-file-name (current-buffer))))
(set-buffer (find-file "/Users/YourUser/Documents/Booklets.tex"))
(insert (concat "\\documentclass[a4paper]{article}
(* (/ (+ 1 (string-to-number NumPag)) 4) 4))
(substring bookletprev 0 (- (length bookletprev) 4))
;(tex-run-command "LaTeX")
I have this function assigned to C-M-b. It takes the current buffer (which should be a PDF document with no blank spaces in its name) and asks for the number of pages, rounding up to a multiple of 4. It creates a new file "/Users/YourUser/Documents/Booklets.tex" (you should edit this to match your tastes) ready to be compiled by pdfLatex.

If you found this post useful be sure to digg it, stumble, share with friends or whatever you feel like doing. Thanks!

Related posts:
Written by Ruben Berenguel