[COLUG] Embedding PdfLaTeX Commands in Shell Scripts

Richard Holbert holbert.13 at osu.edu
Thu Dec 7 18:02:11 EST 2006


I just figured out how to embed PdfLaTeX commands in shell scripts.

This is quite useful for turning eBooks into real books.

Here's an example script that takes a pdf file name as its command line 
argument, and produces an imposed  book.pdf:

"""
#!/bin/sh

pdflatex=/usr/bin/pdflatex

cp $1 in.pdf

$pdflatex \\batchmode \
'\documentclass[letterpaper,landscape]{book}\
\usepackage{pdfpages}\
\begin{document}\
\includepdf[pages=-, signature=4]{in.pdf}\
\end{document}'2>&1 > /dev/null

rm in.pdf
"""

Changing the 11th line to the following:

\includepdf[pages=-, doublepagestwist*, nup=2]{in.pdf}\

Produces a "bandsaw" imposed book with two copies of the book printed 
back to back so that the cut edge is the covered spine.

Another slight modification produces saddle stitch booklets.

man pdfpages for other interesting settings...



More information about the colug432 mailing list