#!/bin/sh # /******************* self documentation **********************/ DOC () { echo ' ADDRESS - producing DVI file(s) for name tags. address [options] datafile(s) Options: 10 10 tags on one page 20 20 tags on one page 30 30 tags on one page (default) 33 33 tags on one page 0 (zero) produce an example datafile tex will produce *.tex only Outputs: datafile_tag.tex(s) the (plain) TeX file(s) datafile_tag.dvi(s) Empty lines in "datafile(s)" are the separator for different addresses. You may put single or multiple empty lines between two addresses. Empty lines at the beginning or the end of the datafile do not affect the result: "datafile_tag.dvi". You can define macros at the beginning of the datafile(s), e.g. "\def\NAME{Your Name}".' } # /**************** end self doc ********************************/ # Author: Seongjai Kim 11-26-1996 number=30 SRC= idexample=0 idtex=0 app_tex=0 TEMP_PAR="$HOME/0000tmp_par" case $# in 0) DOC | more 1>&2; exit 1 ;; *) for i do case $i in 10) number=$i ;; 20) number=$i ;; 30) number=$i ;; 33) number=$i ;; 0|zero) idexample=1 ;; tex) if test -f $i ; then if test $app_tex -eq 0 ; then SRC="$SRC $i" else idtex=1 fi app_tex=1 else idtex=1 fi ;; *) SRC="$SRC $i" ;; esac done esac if test $idexample -eq 1; then EDOUT='Example_Data000' # echo "Producing $EDOUT ......" echo '\def\NAME{Your Name} ' > $EDOUT iter=1 while test $iter -le 5; do echo '\NAME Department of Mathematics University of Kentucky Lexington, KY 40506-0027 USA ' >> $EDOUT iter=`expr $iter + 1` done echo "$EDOUT : produced ..." exit 1 fi hoffset=-.886truein voffset=-.98truein hsize=8.3truein vsize=10.96truein vboxskip=.98truein #vboxskip=.983truein lineskip=12truept #edit: lineskip=10truept font='cmss10' ncolumn=3 if test $number -eq 10 ; then hoffset=-.886truein voffset=-.60truein hsize=8.3truein vsize=10.2truein vboxskip=2.0truein ncolumn=2 font='cmss10 at 13 truept' lineskip=15truept elif test $number -eq 20 ; then hoffset=-.886truein voffset=-.60truein hsize=8.3truein vsize=10.2truein vboxskip=.986truein ncolumn=2 elif test $number -eq 30; then hoffset=-.886truein voffset=-.085truein hsize=8.3truein vsize=10.6truein # edit vboxskip=1.04truein fi echo "ncolumn= $ncolumn" > $TEMP_PAR #===================== for file in $SRC; do #===================== if test -f $file; then Tagfile=${file}_Tag echo "\hoffset$hoffset \voffset$voffset \hsize=$hsize \vsize=$vsize \newdimen\vboxskip \vboxskip=$vboxskip \baselineskip $lineskip \font\ss=$font \ss \nopagenumbers\frenchspacing \settabs $ncolumn\columns" > $Tagfile.tex cp /dev/null temp00000 awk '{ if(NR == 1) ncol=$2 else if(NF != 0) { if($1 ~/^\\def/) print $0 >> "temp00000" else if($1 !~/^\%/) {count++ ; line[count]=$0} } else{ if(count>0){ column++ if (column==1) { printf("%s\n","\\+") >> "temp00000" } else { printf("%s\n","&") >> "temp00000" } printf("%s\n","\\hfil\\vbox to \\vboxskip{\\obeylines\\vfil") >> "temp00000" for(i=1;i<=count;i++) print line[i] >> "temp00000" printf("%s\n","\\vfil}\\hfil") >> "temp00000" if (column==ncol) { printf("%s\n","\\cr") >> "temp00000" column=0 } } count=0 } } END{ if(count>0){ column++ if (column==1) { printf("%s\n","\\+") >> "temp00000" } else { printf("%s\n","&") >> "temp00000" } printf("%s\n","\\hfil\\vbox to \\vboxskip{\\obeylines\\vfil") >> "temp00000" for(i=1;i<=count;i++) print line[i] >> "temp00000" printf("%s\n%s\n","\\vfil}\\hfil","\\cr") >> "temp00000" } else {if(column!=0) printf("%s\n","\\cr") >> "temp00000" } }' $TEMP_PAR $file cat temp00000 >> $Tagfile.tex echo '\bye' >> $Tagfile.tex /bin/rm temp00000 echo "" echo "$Tagfile.tex : produced" if test $idtex -eq 0 ; then tex $Tagfile.tex dvipdf $Tagfile.dvi echo "Final Product: $Tagfile.pdf" /bin/rm $Tagfile.log $Tagfile.dvi /bin/rm $Tagfile.tex fi else echo "" echo "$file : non-exist" echo "" fi #===================== done #===================== /bin/rm $TEMP_PAR