a5 booklets with LaTeX

This is how I produce a5 booklets printed on a4 paper (which is then folded once) with LaTeX using the KOMA-Script document class scrbook.

The booklet bash script

#!/bin/sh
#
# This script takes an A5 latex file as input and produces an A4
# document (both ps and pdf) for printing an A5 booklet
#
# Usage:
# booklet [filename without extension]

latex $1
latex $1

# make an a5 ps from dvi:
dvips -t a5 -o $1.ps $1.dvi

# sort pages
psbook $1.ps tmp1.ps

# put two pages on one a4 sheet
psnup -Pa5 -pa4 -2 tmp1.ps tmp2.ps

# change a5 to a4 in ps file
sed 's/^%%DocumentPaperSizes: A5/%%DocumentPaperSizes: a4/g' < tmp2.ps > $1_booklet.ps

# produce pdf files, pdflatex ist used (twice) to get bookmarks
pdflatex $1.tex
pdflatex $1.tex
ps2pdf -sPAPERSIZE=a4 $1_booklet.ps

# delete tmp files
rm tmp1.ps tmp2.ps

The LaTeX file

\documentclass[a5paper,headsepline,titlepage,10pt,normalheadings,DIVcalc]{scrbook}
\usepackage[a5paper,backref]{hyperref}
\begin{document}
\title{An example booklet}
\author{}
\maketitle
\tableofcontents

\chapter{Chapter One
}

\section{Section One}

Some Text

\end{document}
Zuletzt geändert am 01.12.2009 22:00 Uhr