3 # Written by Jan Arne Fagertun <Jan.A.Fagertun@energy.sintef.no>
4 # Sat Nov 22 22:26:43 CET 1997
6 # Script to make a latex file for Lilypond
11 # should use header info or locale --HWN
16 echo "lytodvi.sh $VERSION" 1>&2
20 D
) set -x;DEBUG
="-v";;
26 shift `expr $OPTIND - 1`
35 echo $0" - no input file name given" 1>&2
40 # Check if input file exists...
46 echo $0" - input file not found " 1>&2
56 echo "usage : "$0" [-D -h -k] file"
61 file may be input to or output from lilypond
67 # Check whether input file is the input to or output from lilypond
70 OP
=`echo $L1 | grep "^% Creator: GNU LilyPond"`
74 # OK - it's the output from lilypond.
75 # Get lilypond source file name
78 IFL
=`grep mudelafilename $OF`
81 IF
=`echo $IFL | sed -e s/^.*{// | sed -e s/"}*.$"//`
83 # Check if source file exists
87 echo $0" - mudela file not found."
91 echo $0" - mudela file name not found."
96 # I have to assume this is the lilypond input file
97 # Find output file name, if defined
100 OFS
=`egrep "paper|midi|output" $IF`
101 OF1
=`echo $OFS | sed -e s/".midi.*$"// | sed -e s/"^.*paper"//`
104 OF1
=`echo $OFS | sed -e s/"^.*paper"// | sed -e s/".midi.*$"//`
110 OF2
=`echo $OF1 | grep output`
115 OF
=`echo $OF2 | sed -e s/'";.*'$// | sed -e s/^'.*"'//`
123 # Run lilypond - exit if unsuccessfull
125 lilypond
$IF ||
exit 3
134 TWL
=`grep linewidth $IF`
137 TW
=`echo $TWL | sed -e s/^.*=// | sed -e s/";.*$"// | \\
138 sed -e s/.mm/mm/ | sed -e s/.cm/cm/ | sed -e s/.p/p/`
145 # More parameters from input file
147 # Well - seems like some more info is needed:
148 # Arranger (I use mudelacopyright now)
149 # Instrument (I use mudelaremarks now)
153 if [ "$KEEP" != "Y" ]
161 echo $0" - temporary directory "$TMP" not found, set to /tmp"
170 # Should copy a "header file" instead....
173 \documentclass[a4paper]{article}
174 \usepackage[$LANGUAGE]{babel}
175 \usepackage[T1]{fontenc}
176 \addtolength{\oddsidemargin}{-1cm}
177 \addtolength{\topmargin}{-1cm}
180 # why two <<EOF constructs? --HWN
181 echo "\setlength{\textwidth}{"$TW"}" >> $LF
189 # Include \def\mudela-definitions - strip off \def\mudela.
190 # Hmm - why not just change titledefs?
192 for L
in mudelatitle mudelasubtitle mudelacomposer mudelaarranger mudelainstrument
197 echo $LL |
sed -e s
/d.
*mudela
//g
>> $LF
201 echo "\makelilytitle" >> $LF
202 echo "\input{"$OF"}" >> $LF
203 echo "\vfill\hfill{(\LilyIdString)}" >> $LF
204 echo "\end{document}" >> $LF
213 if [ "$KEEP" != "Y" ]