Monday, July 29, 2013

LaTeX PocketMod

A few weeks ago I wanted to produce a so-called "PocketMod" in LaTeX. The idea is to print 8 small pages of content onto one actual page of paper and then folding it as shown here to get a little booklet. I've since found several different ways of doing it, but here's what I came up with as a "pure LaTeX" solution.

First: Put your actual content into a content.tex file and use the geometry package to adjust the page size. I used this:

\usepackage[
paperwidth=2.75in,

paperheight=4.25in,
margin=0.1in,

includefoot,
footskip=0.2in,
]{geometry}


I prefer working at the actual size instead of shrinking larger pages down later only to find that the font is unreadable. Use pdflatex to generate the PDF for your tiny 8 pages worth of stuff.

Second: Use pdfpages and the following rotate.tex file to adjust the individual pages appropriately (some need to be upside-down, others need to remain unchanged):

\documentclass[letterpaper]{article}
\usepackage[final]{pdfpages}
\begin{document}
\includepdf[pages=1,fitpaper=true]{content.pdf}
\includepdf[pages=2,angle=180,fitpaper=true]{content.pdf}
\includepdf[pages=3,angle=180,fitpaper=true]{content.pdf}
\includepdf[pages=4,angle=180,fitpaper=true]{content.pdf}
\includepdf[pages=5,angle=180,fitpaper=true]{content.pdf}
\includepdf[pages=6,fitpaper=true]{content.pdf}
\includepdf[pages=7,fitpaper=true]{content.pdf}
\includepdf[pages=8,fitpaper=true]{content.pdf}
\end{document}


Of course I should have used a macro to avoid repeating myself 8 times, but copy-paste won and I never refactored. Feel free to post a better version!

Third: Use pdfpages and the following booklet.tex file to put everything on a single letter-sized page in landscape:

\documentclass[letterpaper]{article}
\usepackage[final]{pdfpages}
\begin{document}
\includepdf[pages={5,4,3,2,6,7,8,1},frame=true,nup=2x4,landscape]{rotate.pdf}
\end{document}


I like having the thin frame around all the pages but if you want to get rid of it just remove that option. And you're done!

2 comments: