diff options
-rw-r--r-- | Makefile | 8 | ||||
-rwxr-xr-x | lib/sbin/FixPageNumbersInPostscript.pl | 44 |
2 files changed, 48 insertions, 4 deletions
@@ -16,7 +16,7 @@ # # # @enddesc -# @version $Id: Makefile,v 1.128 2002-01-28 23:15:02 allen Exp $ +# @version $Id: Makefile,v 1.129 2002-03-15 13:01:14 tradke Exp $ # @@*/ ################################################################################## @@ -904,7 +904,7 @@ UsersGuide: latex -interaction=nonstopmode UsersGuide.tex > LATEX_MESSAGES 2>&1; \ latex -interaction=nonstopmode UsersGuide.tex > LATEX_MESSAGES 2>&1; \ echo " Running dvips...."; \ - dvips ./UsersGuide.dvi -o $(CCTK_HOME)/UsersGuide.ps > DVIPS_MESSAGES 2>&1 + dvips -f ./UsersGuide.dvi 2> DVIPS_MESSAGES | $(CCTK_HOME)/lib/sbin/FixPageNumbersInPostscript.pl > $(CCTK_HOME)/UsersGuide.ps @echo " Done." @echo $(DIVIDER) @@ -923,7 +923,7 @@ MaintGuide: latex MaintGuide.tex > LATEX_MESSAGES 2>&1; \ latex MaintGuide.tex > LATEX_MESSAGES 2>&1; \ echo " Running dvips...."; \ - dvips ./MaintGuide.dvi -o $(CCTK_HOME)/MaintGuide.ps > DVIPS_MESSAGES 2>&1 + dvips -f ./MaintGuide.dvi 2> DVIPS_MESSAGES | $(CCTK_HOME)/lib/sbin/FixPageNumbersInPostscript.pl > $(CCTK_HOME)/MaintGuide.ps @echo " Done." @echo $(DIVIDER) @@ -946,7 +946,7 @@ ThornGuide: latex -interaction=nonstopmode ThornGuide.tex > LATEX_MESSAGES 2>&1; \ latex -interaction=nonstopmode ThornGuide.tex > LATEX_MESSAGES 2>&1; \ echo " Running dvips...."; \ - dvips ./ThornGuide.dvi -o $(CCTK_HOME)/ThornGuide.ps > DVIPS_MESSAGES 2>&1 + dvips -f ./ThornGuide.dvi 2> DVIPS_MESSAGES | $(CCTK_HOME)/lib/sbin/FixPageNumbersInPostscript.pl > $(CCTK_HOME)/ThornGuide.ps @echo " Done." @echo $(DIVIDER) diff --git a/lib/sbin/FixPageNumbersInPostscript.pl b/lib/sbin/FixPageNumbersInPostscript.pl new file mode 100755 index 00000000..f8253eaa --- /dev/null +++ b/lib/sbin/FixPageNumbersInPostscript.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl -w +#/*@@ +# @routine FixPageNumbersInPostscript.pl +# @date Fri 15 Mar 2002 +# @author Thomas Radke +# @desc +# Fixes the line numbers in the postscript versions of the +# Cactus UsersGuide, ThornGuide, and MaintGuide +# @enddesc +# @version $Header$ +#@@*/ + +# $part counts the parts (chapters) in the postscript file +$part = 0; + +# @part_letters lists the numbering for all the parts +# the first two parts (title page and table of contents) are skipped +@part_letters = ('', '', 'A' .. 'Z'); + +# $last_line must match EOP in order to check for a new page +$last_line = "eop\n"; + + +# skip all lines in the postscript setup and prolog +while (<>) +{ + print; + last if (/^%%EndProlog\n$/); +} + + +while (<>) +{ + if ($last_line =~ /eop$/ && /^%%Page: (\d+) (\d+)$/) + { + $part++ if ($1 == 1); + $_ = "%%Page: ${part_letters[$part]}$1 $2\n"; + } + + print; + $last_line = $_; +} + +1; |