# Original LaTeX file made by Mats Bengtsson, 17/8 1997
#
-VERSION="0.8"
+VERSION="0.9"
NAME=ly2dvi.sh
IDENTIFICATION="$NAME $VERSION"
NOW=`date`
echo "$IDENTIFICATION" 1>&2
+KEEP_LILY_OUTPUT=N
+
# NEWS
+#0.9.hwn1
+# - option to remove output of lily
+
+# 0.9 - Trap Lilypond abort
+# - Replaced "\usepackage[T1]{fontenc}" with
+# \usepackage[latin1]{inputenc} (takk, Mats)
+# - Removed "()" around "\LilyIdString" (Janne didn't want it)
+
# 0.8 - Trap Lilypond segmentation fault
# - Function for cleanup
# - Trap line
# - More human-readable variables
# - Some logics concerning rc-files
-
# 0.7
# - Improved Lilypond error checking
# - Output orientation (landscape...). Overrides mudela file
# - Handles margins for A4 paper (equal on both sides)
# - new option -s (--separate) for one LaTeX run per file,
# else all files are run together
-
+#
# 0.5
# - More useful ("two-level") debug.
# - The Q&D hack to find file names and not handling \include
#
cleanup() {
$debug_echo "("$LF")("$FN")("$LOGFILE")"
- if [ "$KEEP" != "Y" ]
+ if [ "$KEEP_LY2DVI_OUTPUT" != "Y" ]
then
[ -n "$LF" -a -f "$LF" ] && rm -f $LF
[ -n "$LOGFILE" -a -f "$LOGFILE" ] && rm -f $LOGFILE
fi
LOGFILE=$TMP/lilylog.$$ # Logfile for lilypond
PWIDTH=600; # Width of A4 paper!
-PHEIGTH=830; # Heigth of A4 paper!
+PHEIGTH=845; # Heigth of A4 paper!
#
# RC-files ?
#
#
# "x:" x takes argument
#
-switches="DO:hkl:o:p:s\?"
+switches="DO:hkl:o:Kp:s\?"
options=""
#
# ugh, "\-" is a hack to support long options
exit 0
;;
k )
- KEEP=Y
+ KEEP_LY2DVI_OUTPUT=Y
+ ;;
+ K )
+ KEEP_LILY_OUTPUT=Y
;;
+
l )
LANGUAGE=$OPTARG
;;
exit 0
;;
k*|-k*)
- KEEP=Y
+ KEEP_LY2DVI_OUTPUT=Y
;;
l*|-l*)
LANGUAGE=`echo $OPTARG | sed -e s/"^.*="//`
#
BN=`basename $File .tex`
FN=$BN.$$
-if [ "$KEEP" != "Y" ]
+if [ "$KEEP_LY2DVI_OUTPUT" != "Y" ]
then
LF=$TMP/$FN.tex
else
\nonstopmode
$LLNG
\usepackage{geometry}
-\usepackage[T1]{fontenc}
+%\usepackage[T1]{fontenc}
+\usepackage[latin1]{inputenc}
%\addtolength{\oddsidemargin}{-1cm}
%\addtolength{\topmargin}{-1cm}
\setlength{\textwidth}{$TW}
LLL=`echo $LL | sed -e 's/}.*$//' -e 's/.*{//'`
if [ "$LLL" != "" ]
then
- echo '\'$L'{'$LLL'}%' >> $LF
+ echo "\\"$L'{'$LLL'}%' >> $LF
fi
fi
done
#
endFile(){
cat << EOF >> $LF
-\vfill\hfill{(\LilyIdString)}
+\vfill\hfill{\LilyIdString}
\end{document}
EOF
#
#
# Loop through all files
#
+
+LILY_OUTPUT_FILES=
+
for GF in $*
do
findInput $GF
OF=`egrep '^TeX output to ' $LOGFILE | \\
sed -e 's/TeX output to//' -e 's/\.\.\.//'`
$debug_echo "==> "$OF
- STATUS=`egrep -i "error|segmentation" $LOGFILE`
+ STATUS=`egrep -i "error|segmentation|abort" $LOGFILE`
echo $STATUS
if [ ! -z "$STATUS" ]
then
FFile=""
endFile
fi
+ LILY_OUTPUT_FILES="$LILY_OUTPUT_FILES $OF"
done
done
if [ $SEPFILE = N ]
then
endFile
fi
+
+
+
+if [ $KEEP_LILY_OUTPUT = N ]
+then
+ rm $LILY_OUTPUT_FILES
+fi
#
# OK - finished
#