GeneralBinding

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Binding

Post by thedoctor818 »

Is there any way in LaTeX to take a full size doc & print it out so it comes out ready for binding in four pages? As in one page is now four pages so u can fold & bind on the horizontal & vertical axes?
Thanks,

-The Doctor (Michael)
-Michael D

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Binding

Post by frabjous »

Are you looking for something like this:
Image
Except with the pages at the top upside down, so that when folded, you get something akin to a greeting card?

Am I right in thinking that you'd need them to be arranged:

1 4
2 3

?

And is your document only four pages? (The page layout gets more complicated if you're going to have one of these little booklets inside another.) You're not planning on cutting anything are you?

Anyway, I made the above with the pdfpages package, which does have options for rearranging a flipping pages, but getting exactly what you want might be difficult or require multiple pass-throughs if using pdfpages alone.

Perhaps someone will know of better options.
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Re: Binding

Post by thedoctor818 »

Yes, that is exactly what I am looking for w/ the: 1 4
2 3
layout; but my document IS more than one page. So, what r my options again?

-The Doctor
-Michael D
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Re: Binding

Post by thedoctor818 »

I mean more than 4 pages of course.
-Michael D
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Binding

Post by frabjous »

I wrote a quick and dirty script that will do it, using Bash. To use it, you'd have to be on a system that had bash installed, along with pdftk and pdflatex.

You'd first compile your file to a pdf, then run

[scriptname] mypdf.pdf ##

where ## is the number of pages in the document. (With more time, I could have it calculate that, but I'm too lazy at the moment.)

The output would be a file called 4.pdf, arranged as you wanted.

It gives you

1 4
2 3

then

5 8
6 7

But I'm not sure if that's how you'd bind it. (You have to put one folded piece of paper after another rather than inside one another. If you want them inside one another, it's a bit more complicated, but I could probably script that too.)

Code: Select all

#!/bin/bash

fn="$1"
pps="$2"
i="1"
S="S"

if [ -f $fn ]
then
	cp $fn tempin.pdf
else
	echo "File not found."
	exit 1
fi

runcmd="pdftk tempin.pdf cat"

while [ $i -le $pps ]
do
	runcmd="$runcmd $i$S"
	if [ $((i+3)) -le $pps ] 
	then 
		runcmd="$runcmd $((i+3))$S" 
	fi
	if [ $((i+1)) -le $pps ] 
	then 
		runcmd="$runcmd $((i+1))" 
	fi
	if [ $((i+2)) -le $pps ] 
	then 
		runcmd="$runcmd $((i+2))" 
	fi
	i=$[$i+4]
done

runcmd="$runcmd output prepareout.pdf"

$runcmd
echo "" > 4out.tex
echo "\\documentclass{article}" >> 4out.tex
echo "\\usepackage{pdfpages}" >> 4out.tex
echo "\\begin{document}" >> 4out.tex
echo "\\includepdf[nup=2x2,pages=-]{prepareout.pdf}" >> 4out.tex
echo "\\end{document}" >> 4out.tex

pdflatex -interaction=nonstopmode 4out.tex
rm 4out.tex
rm prepareout.pdf
rm tempin.pdf
User avatar
T3.
Posts: 208
Joined: Fri Mar 14, 2008 12:58 pm

Binding

Post by T3. »

thedoctor818 wrote:So, what r my options again?
There is a number of latex packages that can be used: pdfpages, booklet, quire (part of midnight package), pgfpages (distributed with pgf package) and perhaps others. Look them up and see which one has the features you want.

Cheers,

Tomek
Post Reply