#! /bin/sh #-xv # combines all ps file in the current directory into a new ps file # syntax: ps_combine_all [-t ] # returns outfile # written by Jan-Uwe Ness # Oct 2001 out=`mktemp tempXXXXXX` || exit 1 trap "rm -f $out*" 0 1 2 3 5 texfile=$out.tex if [ "x$1" == "x-t" ] then outtex=$2 shift shift fi final=$1 if test -e $1 then echo $1 exists: cannot overwrite if test -e $1.tex then if [ "x$outtex" == "x" ] then exit fi elif [ "x$outtex" == "x" ] then echo will save TeX file $1.tex instead outtex="$1.tex" else echo will save TeX file $outtex instead fi fi files=$(ls *.ps) echo "\documentclass[12pt]{article}" > "$texfile" echo "\pagestyle{empty}" >> "$texfile" echo "\textheight 25.5cm" >> "$texfile" echo "\textwidth 16cm" >> "$texfile" echo "\voffset -3cm" >> "$texfile" echo "\hoffset -2cm" >> "$texfile" echo "\usepackage{graphicx}" >> "$texfile" echo "\begin{document}" >> "$texfile" for ff in $files; do if [ ! $ff == $final ] then echo "\begin{figure}" >> "$texfile" echo "\vspace{-2cm}" >> "$texfile" echo " \hspace{-1cm}\includegraphics[height=29cm]{$ff}" >> "$texfile" echo "\end{figure}" >> "$texfile" echo "\clearpage" >> "$texfile" echo "> including $ff" fi done echo "\end{document}" >> "$texfile" if [ ! -e $final ] then latex $texfile > "$out.output" dvips $out.dvi > "$out.output" mv $out.ps $final echo file $final created! fi if [ "x$outtex" != "x" ] then mv $texfile $outtex echo file $outtex created! fi