fj@iesd.auc.dk (Frank Jensen) (02/26/91)
In article <1991Feb26.044246.1252@ccu1.aukuni.ac.nz> russell@ccu1.aukuni.ac.nz (Russell J Fulton;ccc032u) writes:
I am using dvips to print files generated by LaTeX and A5.sty.
What I want to do is postprocess the output from dvips to print the pages
two up on A4 paper. The catch is that I also want to reorder the pages so
that they are in the correct order for stapling into a booklet.
i.e. if there are 4 pages in the document then page 1 of the A4 output
should have pages 1 & 4 of the original and page 2 should have 2 & 3.
Get `up.shar' from `tut.cis.ohio-state.edu' (directory `pub/perl/scripts'
- yes, you need Perl!). Since you're using A4/A5 paper formats, I enclose
my version of `up.rc' and a sample config file for dvips that does what
you want.
Contrary to common beliefs, dvips works together with the `up' program
without problems.
Thanks, Russell.
--
Russell Fulton, Computer Center, University of Auckland, New Zealand.
<rj_fulton@aukuni.ac.nz>
--
Frank Jensen, fj@iesd.auc.dk
Department of Mathematics and Computer Science
Aalborg University
DENMARK
#!/bin/sh
# This is a shell archive (shar 3.24)
# made 02/26/1991 13:55 UTC by fj@indigo
# Source directory /tmp_mnt/net/orange/fj/TeX/FTP/tut.cis.ohio-state.edu
#
# existing files WILL be overwritten
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 3616 -r--r--r-- up.rc
# 82 -r--r--r-- config.lwa5s
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
then TOUCH=touch
else TOUCH=true
fi
# ============= up.rc ==============
echo "x - extracting up.rc (Text)"
sed 's/^X//' << 'SHAR_EOF' > up.rc &&
X# jgreely@cis.ohio-state.edu, 89/10/23
X#
X
X# this is the normal prolog, and defines everything used below
X#
Xprolog=
X/inch {72 mul} def
X/a4height 2 sqrt sqrt 250 mul 25.4 div inch def
X/a4width a4height 2 sqrt div def
X/a5height a4width def
X/a5width a4height 2 div def
Xuserdict /@a5 { /vsize y def } dup 1 a5height 72 div 1 sub put put % for `dvips'
X/moveU {0 a4height translate} def
X/moveR {a4width 0 translate} def
X/moveD {0 a4height neg translate} def
X/moveL {a4width neg 0 translate} def
X/rotR {-90 rotate} def
X/rotL {90 rotate} def
X/doSpiral {moveU moveR rotR 0.67 dup scale} def
X/moveHU { 0 5.5 inch translate} def
X/doRevSpiral {moveHU rotL 0.67 dup scale} def
X.
X
X# up is a synonym for twoup, since my code doesn't work correctly for
X# the case n==1. Until I robustify it, this will stay.
X#
Xname=up
Xmodulus=2
Xscale=moveR rotL 0.5 sqrt dup scale
X1=
X2=moveR
X.
X
Xname=2up
Xmodulus=2
Xscale=moveR rotL 0.5 sqrt dup scale
X1=
X2=moveR
X.
X
X# two-up with even pages rotated, for double-siding
X#
Xname=pup
Xmodulus=2
Xeven=moveU moveR rotR rotR
Xodd=
Xscale=moveR rotL 0.5 sqrt dup scale
X1=
X2=moveR
X.
X
X# a special version of two-up meant to output TeX (no scaling is done)
X#
Xname=a5tex
Xmodulus=2
Xscale=moveR rotL
X1=
X2=a5width 0 translate
X.
X
X# a special version of two-up meant to output TeX
X# (no scaling is done, and even pages are rotated for double-siding)
X#
Xname=a5texs
Xmodulus=2
Xeven=moveR moveU -1 -1 scale
Xodd=
Xscale=moveR rotL
X1=
X2=a5width 0 translate
X.
X
X# note that 4up is scaled a bit smaller than you might think. If I
X# just scaled by .5, I'd lose my top and bottom edges (printer
X# limitations)
X#
Xname=4up
Xmodulus=4
Xscale=0.2125 inch 0.275 inch translate 0.475 dup scale
X1=moveU
X2=moveR
X3=moveL moveD
X4=moveR
X.
X
X# this does a greeting-card format, designed to be folded into
X# fourths. If you're not sure how it's supposed to look, run:
X# makeup 4 | up -n card | lpr
X#
Xname=card
Xmodulus=4
Xscale=0.2125 inch 0.275 inch translate 0.475 dup scale
X1=moveU moveU moveR rotR rotR
X2=moveU moveU moveR rotR rotR
X3=moveR
X4=moveU moveU moveR rotR rotR
X.
X
X# this is about the limit for a 300 dpi device, unless it's reasonably
X# new and you have good eyes. I like it at 400 dpi.
X#
Xname=6up
Xmodulus=6
Xscale=0.25 inch 0.75 inch translate rotL 4 11 div dup scale
X1=moveD
X2=moveR
X3=moveR
X4=moveD moveL moveL
X5=moveR
X6=moveR
X.
X
X# this is a bit too far for casual reading. It's entering magnifying
X# glass territory, which is bad, unless you need to carry lots of RFCs
X# around.
X#
Xname=8up
Xmodulus=8
Xscale=0.7 inch 0 translate rotL 11 34 div dup scale
X1=moveD
X2=moveR
X3=moveR
X4=moveR
X5=moveD moveL moveL moveL
X6=moveR
X7=moveR
X8=moveR
X.
X
X# Steve Romig's contribution to evil PostScript hacking. To see what
X# it does, run:
X# makeup 10 | up -n spiral | lpr
X#
Xname=spiral
Xmodulus=10
Xscale=7.75 inch 0 translate rotL 11 17 div dup scale
X1=
X2=doSpiral
X3=doSpiral
X4=doSpiral
X5=doSpiral
X6=doSpiral
X7=doSpiral
X8=doSpiral
X9=doSpiral
X10=doSpiral
X.
X
X# More from Steve, this time in the other direction
X#
Xname=revspiral
Xmodulus=10
Xscale=7.75 inch 0 translate rotL 11 17 div dup scale
X1=moveR
X2=doRevSpiral
X3=doRevSpiral
X4=doRevSpiral
X5=doRevSpiral
X6=doRevSpiral
X7=doRevSpiral
X8=doRevSpiral
X9=doRevSpiral
X10=doRevSpiral
X.
X
X# this is not legible on anything under 400 dpi, and even then you'll
X# probably want a magnifying glass. You *can* read it with the naked
X# eye, but not for long.
X#
Xname=16up
Xmodulus=16
Xscale=0.25 0.25 scale
X1=moveU moveU moveU
X2=moveR
X3=moveR
X4=moveR
X5=moveD moveL moveL moveL
X6=moveR
X7=moveR
X8=moveR
X9=moveD moveL moveL moveL
X10=moveR
X11=moveR
X12=moveR
X13=moveD moveL moveL moveL
X14=moveR
X15=moveR
X16=moveR
X.
SHAR_EOF
$TOUCH -am 0226145591 up.rc &&
chmod 0444 up.rc ||
echo "restore of up.rc failed"
set `wc -c up.rc`;Wc_c=$1
if test "$Wc_c" != "3616"; then
echo original size 3616, current size $Wc_c
fi
# ============= config.lwa5s ==============
echo "x - extracting config.lwa5s (Text)"
sed 's/^X//' << 'SHAR_EOF' > config.lwa5s &&
X* Output destination
Xo !parr -s|up -n a5texs|lpr -Plw
X
X* Use A5 paper format
Xt a5
SHAR_EOF
$TOUCH -am 0226145591 config.lwa5s &&
chmod 0444 config.lwa5s ||
echo "restore of config.lwa5s failed"
set `wc -c config.lwa5s`;Wc_c=$1
if test "$Wc_c" != "82"; then
echo original size 82, current size $Wc_c
fi
exit 0
piet@cs.ruu.nl (Piet van Oostrum) (03/01/91)
>>>>> russell@ccu1.aukuni.ac.nz (Russell J Fulton;ccc032u) (RJF) writes:
RJF> I am using dvips to print files generated by LaTeX and A5.sty.
RJF> What I want to do is postprocess the output from dvips to print the pages
RJF> two up on A4 paper. The catch is that I also want to reorder the pages so
RJF> that they are in the correct order for stapling into a booklet.
RJF> i.e. if there are 4 pages in the document then page 1 of the A4 output
RJF> should have pages 1 & 4 of the original and page 2 should have 2 & 3.
You could use dvidvi, but this would process your dvi file rather than the
postscript. The resulting dvi file can be printed normally with dvips or
whatever program you have.
I use these parameters:
4:-1,2'(148mm,0)'
4:-3,0'(148mm,0)'
Useful for printing a little booklet on A5, four pages
to a sheet, double-sided, for stapling in the middle.
Print the first one, put the stack back into the printer
upside down, and print the second.
--
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31 30 531806 Uucp: uunet!mcsun!ruuinf!piet
Telefax: +31 30 513791 Internet: piet@cs.ruu.nl (*`Pete')