tex3patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. # Auxiliary script to work around TeX 3.0 bug. ---- tex3patch ----
  3. # patches texinfo.tex in current directory, or in directory given as arg.
  4. ANYVERSION=no
  5. for arg in $1 $2
  6. do
  7. case $arg in
  8. --dammit | -d ) ANYVERSION=yes ;;
  9. * ) dir=$arg
  10. esac
  11. done
  12. if [ -z "$dir" ]; then
  13. dir='.'
  14. fi
  15. if [ 2 -lt $# ] || [ ! -f "$dir/texinfo.tex" ]; then
  16. echo "To patch texinfo.tex for peaceful coexistence with Unix TeX 3.0,"
  17. echo "run $0"
  18. echo "with no arguments in the same directory as texinfo.tex; or run"
  19. echo " $0 DIRECTORY"
  20. echo "(where DIRECTORY is a path leading to texinfo.tex)."
  21. exit
  22. fi
  23. if [ -z "$TMPDIR" ]; then
  24. TMPDIR=/tmp
  25. fi
  26. echo "Checking for \`dummy.tfm'"
  27. ( cd $TMPDIR; tex '\relax \batchmode \font\foo=dummy \bye' )
  28. grep -s '3.0' $TMPDIR/texput.log
  29. if [ 1 = "$?" ] && [ "$ANYVERSION" != "yes" ]; then
  30. echo "You probably do not need this patch,"
  31. echo "since your TeX does not seem to be version 3.0."
  32. echo "If you insist on applying the patch, run $0"
  33. echo "again with the option \`--dammit'"
  34. exit
  35. fi
  36. grep -s 'file not found' $TMPDIR/texput.log
  37. if [ 0 = $? ]; then
  38. echo "This patch requires the dummy font metric file \`dummy.tfm',"
  39. echo "which does not seem to be part of your TeX installation."
  40. echo "Please get your TeX maintainer to install \`dummy.tfm',"
  41. echo "then run this script again."
  42. exit
  43. fi
  44. rm $TMPDIR/texput.log
  45. echo "Patching $dir/texinfo.tex"
  46. sed -e 's/%%*\\font\\nullfont/\\font\\nullfont/' \
  47. $dir/texinfo.tex >$TMPDIR/texinfo.tex
  48. mv $dir/texinfo.tex $dir/texinfo.tex-distrib; mv $TMPDIR/texinfo.tex $dir
  49. if [ 0 = $? ]; then
  50. echo "Patched $dir/texinfo.tex to avoid TeX 3.0 bug."
  51. echo "The original version is saved as $dir/texinfo.tex-distrib."
  52. else
  53. echo "Patch failed. Sorry."
  54. fi
  55. ----------------------------------------tex3patch ends