# preview.sty can be obtained from CTAN/macros/latex/contrib/supported/preview.
-# This script takes three arguments:
+# This script takes two arguments:
# TEXFILE: the name of the .tex file to be converted.
-# SCALEFACTOR: scale factor, used to ascertain the resolution of the
+# SCALEFACTOR: a scale factor, used to ascertain the resolution of the
# generated image which is then passed to gs.
-# NDIGITS: the number of digits in the filenames generated by gs,
-# ${BASE}%0${NDIGITS}d.ppm.
# If successful, this script will leave in dir ${DIR}:
-# ${BASE}[0-9]\{${NDIGITS}\}.ppm: a (possibly large) number of image files.
-# ${BASE}.metrics: a file containing info needed by LyX to
-# position the images correctly on the screen.
+# ${BASE}\([0-9]*\).ppm: a (possibly large) number of image files.
+# ${BASE}.metrics: a file containing info needed by LyX to position the
+# images correctly on the screen.
# All other files ${BASE}* will be deleted.
# Three helper functions.
}
# Preliminary check.
-if [ $# -ne 3 ]; then
+if [ $# -ne 2 ]; then
exit 1
fi
BASE=`basename $1 .tex`
SCALEFACTOR=$2
-NDIGITS=$3
TEXFILE=${BASE}.tex
LOGFILE=${BASE}.log
fi
gs -q -dNOPAUSE -dBATCH -dSAFER \
- -sDEVICE=pnmraw -sOutputFile=${BASE}%0${NDIGITS}d.ppm \
+ -sDEVICE=pnmraw -sOutputFile=${BASE}%d.ppm \
-dGraphicsAlphaBit=${ALPHA} -dTextAlphaBits=${ALPHA} -r${RESOLUTION} \
${PSFILE}
# All has been successful, so remove everything except the bitmap files
# and the metrics file.
FILES=`ls ${BASE}* | \
- sed -e "/${BASE}.metrics/d" -e "/${BASE}[0-9]\{${NDIGITS}\}.ppm/d"`
-rm -f ${FILES}
+ sed -e "/${BASE}.metrics/d" -e "/${BASE}\([0-9]*\).ppm/d"`
+rm -f ${FILES} texput.log