home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / wvhtm064.zip / wv / wvDVI < prev    next >
Text File  |  2000-10-19  |  788b  |  46 lines

  1. #!/bin/sh
  2.  
  3. # argument checking
  4. if [ ${#} -ne "2" ]; then
  5.     echo "Usage: ${0} <word document> <dvi output file>"
  6.     exit 1
  7. fi
  8.  
  9. which wvLatex >/dev/null 2>&1
  10. if [ ${?} -ne "0" ]; then
  11.     echo "Could not find required program 'wvLatex'"
  12.     exit 1
  13. fi
  14.  
  15. which latex >/dev/null 2>&1
  16. if [ ${?} -ne "0" ]; then
  17.     echo "Could not find required program 'latex'"
  18.     exit 1
  19. fi
  20.  
  21. #
  22. LATEX_FILE="${2}.tex"
  23.  
  24. wvLatex "${1}" "${LATEX_FILE}" >/dev/null 2>&1
  25. if [ ${?} -ne "0" ]; then
  26.     echo "Error converting into LaTeX"
  27.     exit 1
  28. fi
  29.  
  30. DIRNAME=`dirname "$2"`
  31. BASENAME=`basename "$LATEX_FILE"`
  32. (
  33. cd "$DIRNAME"
  34.  
  35. latex --interaction=batchmode "${BASENAME}" >/dev/null 2>&1
  36. if [ ${?} -ne "0" ]; then
  37.     echo "Conversion into dvi failed"
  38.     exit 1
  39. fi
  40.  
  41. )
  42.  
  43. # clean up after ourselves
  44. rm -f "${LATEX_FILE}" 
  45. mv "${2}.dvi" "${2}"
  46.