BAIL_OUT ()
{
+ test $# -eq 1 && echo $1
+
# Remove everything except the original .tex file.
FILES=`ls ${BASE}* | sed -e "/${BASE}\.tex/d"`
rm -f ${FILES} texput.log
exit 1
fi
+# We use latex, dvips and gs, so check that they're all there.
+FIND_IT ${LATEX}
+FIND_IT ${DVIPS}
+FIND_IT ${GS}
+
# Extract the params from the argument list.
DIR=`dirname $1`
BASE=`basename $1 .tex`
GSDEVICE=png16m
GSSUFFIX=png
else
- echo "Unrecognised output format ${OUTPUTFORMAT}."
- echo "Expected either \"ppm\" or \"png\"."
- BAIL_OUT
+ BAIL_OUT "Unrecognised output format ${OUTPUTFORMAT}. \
+ Expected either \"ppm\" or \"png\"."
fi
-# We use latex, dvips and gs, so check that they're all there.
-FIND_IT ${LATEX}
-FIND_IT ${DVIPS}
-FIND_IT ${GS}
-
# Initialise some variables.
TEXFILE=${BASE}.tex
LOGFILE=${BASE}.log
cd ${DIR}
${LATEX} ${TEXFILE} ||
{
- echo "Failed: ${LATEX} ${TEXFILE}"
- BAIL_OUT
+ BAIL_OUT "Failed: ${LATEX} ${TEXFILE}"
}
# Parse ${LOGFILE} to obtain bounding box info to output to
# "Preview: Snippet".
grep -E 'Preview: [ST]' ${LOGFILE} > ${METRICSFILE} ||
{
- echo "Failed: grep -E 'Preview: [ST]' ${LOGFILE}"
REQUIRED_VERSION ${LOGFILE}
- BAIL_OUT
+ BAIL_OUT "Failed: grep -E 'Preview: [ST]' ${LOGFILE}"
}
# Parse ${LOGFILE} to obtain ${RESOLUTION} for the gs process to follow.
# not found.
LINE=`grep 'Preview: Fontsize' ${LOGFILE}` ||
{
- echo "Failed: grep 'Preview: Fontsize' ${LOGFILE}"
REQUIRED_VERSION ${LOGFILE}
- BAIL_OUT
+ BAIL_OUT "Failed: grep 'Preview: Fontsize' ${LOGFILE}"
}
# The sed script strips out everything that won't form a decimal number
# from the line. It bails out after the first match has been made in
# DVI -> PostScript
${DVIPS} -o ${PSFILE} ${DVIFILE} ||
{
- echo "Failed: ${DVIPS} -o ${PSFILE} ${DVIFILE}"
- BAIL_OUT
+ BAIL_OUT "Failed: ${DVIPS} -o ${PSFILE} ${DVIFILE}"
}
# PostScript -> Bitmap files
-dGraphicsAlphaBit=${ALPHA} -dTextAlphaBits=${ALPHA} \
-r${RESOLUTION} ${PSFILE} ||
{
- echo "Failed: ${GS} ${PSFILE}"
- BAIL_OUT
+ BAIL_OUT "Failed: ${GS} ${PSFILE}"
}
# All has been successful, so remove everything except the bitmap files