mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
* Improve error reporting.
* Make it work with scary_eqns.lyx by repeating the LaTeX run if it failed first time round, but this time remove the showlabels option from preview.sty. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4704 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6206e59009
commit
c723c2aeff
@ -1,3 +1,7 @@
|
|||||||
|
2002-07-18 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* lyxpreview2ppm.sh: clean-up. Get it to work with scary_eqns.lyx.
|
||||||
|
|
||||||
2002-07-17 André Pönitz <poenitz@gmx.net>
|
2002-07-17 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
* configure.m4: fix typo in last change
|
* configure.m4: fix typo in last change
|
||||||
|
@ -21,52 +21,73 @@ if [ $# -ne 2 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# A couple of helper functions
|
# A couple of helper functions
|
||||||
FIND_EXECUTABLE=""
|
|
||||||
FIND_IT () {
|
FIND_IT () {
|
||||||
which ${FIND_EXECUTABLE} > /dev/null
|
which ${EXECUTABLE} > /dev/null
|
||||||
STATUS=$?
|
STATUS=$?
|
||||||
if [ ${STATUS} -ne 0 ]; then
|
if [ ${STATUS} -ne 0 ]; then
|
||||||
echo "Unable to find \"${FIND_EXECUTABLE}\". Please install."
|
echo "Unable to find \"${EXECUTABLE}\". Please install."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_STATUS () {
|
BAIL_OUT () {
|
||||||
if [ ${STATUS} -ne 0 ]; then
|
# Remove everything except the original .tex file.
|
||||||
echo "${EXECUTABLE} failed."
|
FILES=`ls ${BASE}* | sed -e "/${BASE}.tex/d"`
|
||||||
# Remove everything except the original .tex file.
|
rm -f ${FILES} texput.log
|
||||||
FILES=`ls ${BASE}* | sed -e "/${BASE}.tex/d"`
|
exit 1
|
||||||
rm -f ${FILES}
|
|
||||||
exit ${STATUS}
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# We use latex, dvips and gs, so check that they're all there.
|
# We use latex, dvips and gs, so check that they're all there.
|
||||||
FIND_EXECUTABLE=latex; FIND_IT
|
EXECUTABLE=latex; FIND_IT
|
||||||
FIND_EXECUTABLE=dvips; FIND_IT
|
EXECUTABLE=dvips; FIND_IT
|
||||||
FIND_EXECUTABLE=gs; FIND_IT
|
EXECUTABLE=gs; FIND_IT
|
||||||
|
|
||||||
# Initialise some variables.
|
# Initialise some variables.
|
||||||
TEXFILE=$1
|
TEXFILE=`basename $1`
|
||||||
RESOLUTION=$2
|
RESOLUTION=$2
|
||||||
|
|
||||||
DIR=`dirname ${TEXFILE}`
|
DIR=`dirname $1`
|
||||||
BASE=`basename ${TEXFILE} .tex`
|
BASE=`basename $1 .tex`
|
||||||
DVIFILE=${BASE}.dvi
|
DVIFILE=${BASE}.dvi
|
||||||
PSFILE=${BASE}.ps
|
PSFILE=${BASE}.ps
|
||||||
METRICS=${BASE}.metrics
|
METRICS=${BASE}.metrics
|
||||||
|
|
||||||
# Perform the conversion.
|
# LaTeX -> DVI.
|
||||||
cd ${DIR}
|
cd ${DIR}
|
||||||
latex ${TEXFILE}
|
latex ${TEXFILE}
|
||||||
STATUS=$?
|
STATUS=$?
|
||||||
EXECUTABLE="latex ${TEXFILE}"; CHECK_STATUS
|
if [ ${STATUS} -ne 0 ]; then
|
||||||
|
# LaTeX failed.
|
||||||
|
# preview.sty has known problems with the showlabels option,
|
||||||
|
# so remove it and try again.
|
||||||
|
sed -e "/^[\]usepackage\(.*\){preview}/s/,showlabels//" \
|
||||||
|
< ${TEXFILE} > .${TEXFILE}
|
||||||
|
cmp -s ${TEXFILE} .${TEXFILE}
|
||||||
|
STATUS=$?
|
||||||
|
if [ ${STATUS} -eq 0 ]; then
|
||||||
|
rm -f .${TEXFILE}
|
||||||
|
echo "Failed: latex ${TEXFILE}"
|
||||||
|
BAIL_OUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv -f .${TEXFILE} ${TEXFILE}
|
||||||
|
latex ${TEXFILE}
|
||||||
|
STATUS=$?
|
||||||
|
if [ ${STATUS} -ne 0 ]; then
|
||||||
|
echo "Failed: latex ${TEXFILE}"
|
||||||
|
BAIL_OUT
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# DVI -> PostScript
|
||||||
dvips -o ${PSFILE} ${DVIFILE}
|
dvips -o ${PSFILE} ${DVIFILE}
|
||||||
|
|
||||||
STATUS=$?
|
STATUS=$?
|
||||||
EXECUTABLE="dvips ${DVIFILE}"; CHECK_STATUS
|
if [ ${STATUS} -ne 0 ]; then
|
||||||
|
echo "Failed: dvips -o ${PSFILE} ${DVIFILE}"
|
||||||
|
BAIL_OUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
# PostScript -> Bitmap files
|
||||||
# Older versions of gs have problems with a large degree of anti-aliasing
|
# Older versions of gs have problems with a large degree of anti-aliasing
|
||||||
# at high resolutions
|
# at high resolutions
|
||||||
ALPHA=4
|
ALPHA=4
|
||||||
@ -79,7 +100,10 @@ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pnmraw -sOutputFile=${BASE}%03d.ppm \
|
|||||||
${PSFILE}
|
${PSFILE}
|
||||||
|
|
||||||
STATUS=$?
|
STATUS=$?
|
||||||
EXECUTABLE="gs ${PSFILE}"; CHECK_STATUS
|
if [ ${STATUS} -ne 0 ]; then
|
||||||
|
echo "Failed: gs ${PSFILE}"
|
||||||
|
BAIL_OUT
|
||||||
|
fi
|
||||||
|
|
||||||
# Attempt to generate a file ${METRICS} that contains only the tightpage
|
# Attempt to generate a file ${METRICS} that contains only the tightpage
|
||||||
# bounding box info, extract from ${PSFILE}
|
# bounding box info, extract from ${PSFILE}
|
||||||
@ -110,9 +134,7 @@ EOF
|
|||||||
|
|
||||||
# 2. Run sed!
|
# 2. Run sed!
|
||||||
sed -f ${SEDSCRIPT} < ${PSFILE} > ${METRICS}
|
sed -f ${SEDSCRIPT} < ${PSFILE} > ${METRICS}
|
||||||
STATUS=$?
|
|
||||||
rm -f ${SEDSCRIPT}
|
rm -f ${SEDSCRIPT}
|
||||||
EXECUTABLE="extracting metrics"; CHECK_STATUS
|
|
||||||
|
|
||||||
# The ppm files have spurious (?! say some !) white space on the left and right
|
# The ppm files have spurious (?! say some !) white space on the left and right
|
||||||
# sides. If you want this removed set REMOVE_WS=1.
|
# sides. If you want this removed set REMOVE_WS=1.
|
||||||
@ -139,5 +161,5 @@ fi
|
|||||||
|
|
||||||
# All was successful, so remove everything except the ppm files and the
|
# All was successful, so remove everything except the ppm files and the
|
||||||
# metrics file.
|
# metrics file.
|
||||||
FILES=`ls ${BASE}* | sed -e "/${BASE}.metrics/d" -e "/${BASE}.*.ppm/d"`
|
FILES=`ls ${BASE}* | sed -e "/${BASE}.metrics/d" -e "/${BASE}[0-9]\{3\}.ppm/d"`
|
||||||
rm -f ${FILES}
|
rm -f ${FILES}
|
||||||
|
Loading…
Reference in New Issue
Block a user