summaryrefslogtreecommitdiff
path: root/backends/dvi
blob: ace0cf8df74844997481a0437b1f21d91c4db58e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Backend to convert something into DVI
# Send any comments to Eric Bischoff <eric@caldera.de>
# This program is under GPL license. See LICENSE file for details.

TEXINPUTS="$(dirname "${SGML_FILE}"):${TEXINPUTS}"
export TEXINPUTS

# Convert to TeX
$SGML_JADE -t tex -o ${SGML_FILE_NAME}.tex $SGML_ARGUMENTS
if [ $? -ne 0 ]
then exit 1
fi

# Convert from TeX to DVI
jadetex ${SGML_FILE_NAME}.tex >${SGML_FILE_NAME}.tmp
if [ $? -ne 0 ]
then
  cat ${SGML_FILE_NAME}.tmp
  rm ${SGML_FILE_NAME}.tmp
  rm ${SGML_FILE_NAME}.tex
  exit 2
fi
rm ${SGML_FILE_NAME}.tmp

# If there are unresolved references, re-run jadetex, twice 
if egrep '^LaTeX Warning: There were undefined references.$' ${SGML_FILE_NAME}.log >/dev/null 2>&1
then
    jadetex ${SGML_FILE_NAME}.tex >/dev/null
    jadetex ${SGML_FILE_NAME}.tex >/dev/null
fi
rm ${SGML_FILE_NAME}.log
rm ${SGML_FILE_NAME}.aux
rm ${SGML_FILE_NAME}.tex
rm ${SGML_FILE_NAME}.out

exit 0