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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#!/bin/sh
#
# This opustex Perl script automates the three-pass TeX compilation
# of a OpusTeX music score file. It basically runs the command:
# $ tex filename.tex ; opusflex filename ; tex filename.tex
#
# Adapted by Anthony Fok <foka@gpu.srv.ualberta.ca> for Debian GNU/Linux
# from the DOS batch file in the OpusTeX User Manual by OpusTeX's authors.
#
# Initial version: Mon, 14 Jul 1997 07:15:00 -0600
# Last modified: Mon, 28 Jul 1997 00:28:26 -0600
PACKAGE=opustex
PKG_NAME=OpusTeX
FLEX=opusflex
usage() {
cat <<EOF
This script automates the three-pass TeX compilation of $PKG_NAME
music score files. Note: This script may not work for certain files.
You may run tex/latex and $flex manually in such cases.
Usage: $PACKAGE file.tex [TeX options]
For more information, please refer to "/usr/doc/$PACKAGE/README.debian".
EOF
}
# Main program
usage()
break
if [ $#ARGV == -1 ]; then
usage()
fi
FILENAME = shift @ARGV;
# Strip trailing file extension (.tex), if any.
FILENAME=``/`.`
# Strip paths from filename
BASENAME=`basename $FILENAME`
# Note: TeX writes its output to the current directory.
# Therefore, we use musixflex to process the file in the
# current directory.
if [ -e "$filename.tex" ]; then
rm $BASENAME.ox1 $BASENAME.ox2
# or die "Can't remove old $basename.ox1 and $basename.ox2 files: $!"
tex \&$PACKAGE $FILENAME.tex @ARGV
# or die "First pass of TeX failed on $filename.tex: $!";
$FLEX, $BASENAME
# or die "$flex failed to process $basename.ox1: $!";
tex \&$PACKAGE $FILENAME.tex @ARGV
# or die "Second pass of TeX failed on $filename.tex: $!";
else
echo STDERR "$0: $filename.tex does not exist!\n\n"
usage()
fi
|