Hi guys and dolls

New version of ly2dvi, version 0.10

# NEWS

#0.10
#       - -K,--keeplilypond : Keep lilypond output files (default delete)
#       - -k,--keeply2dvi   : Keep ly2dvi   output files (default delete)
#       - -L,--landscape    : Set landscape orientation
#       - -N,--nonumber     : Turn off page numbering (\pagestyle{empty})
#       - Could not reinsert "\usepackage[T1]{fontenc}" because
#         "los-toros" won't work with it
#       - Ekstra LaTeX headers from input file

In addition, a little patch to los-toros-oboe.ly, to make it work with
ly2dvi.

A new facility is made to ly2dvi, the ability to include additional
LaTeX headers from a file. I have included "headers", which contains
LaTeX headers info to make output similar to from the distributed
tex files los-toros-oboe-16.tex and los-toros-oboe-20.tex

I have also added the option "-N" to turn off page numbering. This is
handy when you want the music in one page, even if it doesn't fit.
Just make one postscript file per page (save each page from 'gv'), and
use 'xfig' to  combine the pages. 'xfig' scales the output to fit into
the page.

-- 
       Jan Arne Fagertun <[EMAIL PROTECTED]>
http://www.termo.unit.no/mtf/people/janaf/          Phone: +47 73533036
NTNU => NT, Not Unix... http://www.nvg.ntnu.no/ntnu/ - better use Linux
--- los-toros-oboe.ly.orig      Sat May  2 19:11:06 1998
+++ los-toros-oboe.ly   Sat May  2 19:08:12 1998
@@ -1,10 +1,12 @@
 \header{
 filename =      "los-toros-oboe.ly";
-title =                 "La Feria\\normalsize\\[2ex]Los Toros";
+title =                 "La Feria";
+subtitle =      "Los Toros";
 opus =          "";
 composer =      "Paul Lac\\^ome d'Estalenx (1838-1920)";
 enteredby =     "jcn";
 copyright =     "public domain";
+latexheaders=    "headers";
 } 
 
 %{
\usepackage{fancyheadings}
\lhead{}
\rhead{}
\chead{}
\lfoot{}
\cfoot{\ifnum\thepage=1{\hfill\LilyIdString}\fi}
\rfoot{\ifnum\thepage>1{\hfill\thepage\hfill}\fi}
\headrulewidth0mm
\pagestyle{fancy}
\thispagestyle{fancy}
--- ly2dvi.pod  Sat May  2 19:15:38 1998
+++ ly2dvi.pod-0.10     Sat May  2 19:15:16 1998
@@ -27,32 +27,46 @@
 info is written, in level two the command C<set -x> is run, which
 echoes every command in the ly2dvi script.
 
+=item B<-H,--headers=>
+
+Name of additional LaTeX headers file. This is included in the
+tex file at the end of the headers, last line before \begin{document}
+
+=item B<-K,--keeplilypond>
+
+Keep LilyPond output after the run.
+
+=item B<-L,--landscape>
+
+Set landscape orientation - portrait is the default.
+(C<-L> produces C<\usepackage[landscape]{article}>)
+
+=item B<-N,--nonumber>
+
+Switch off page numbering.
+
 =item B<-O,--orientation=>
 
 Set orientation - portrait is the default.
 (C<-O> landscape produces C<\usepackage[landscape]{article}>)
 
-=item B<-o,--output=>
-
-Set output directory.
-
 =item B<-h,--help>
 
 Print help.
 
-=item B<-k,--keep>
+=item B<-k,--keeply2dvi>
 
 Keep the LaTeX file after the run.
 
-=item B<-K>
-
-Keep LilyPond output after the run.
-
-=item B<-l,--language>
+=item B<-l,--language=>
 
 Specify LaTeX language.
 (C<-l norsk> produces C<\usepackage[norsk]{babel}>).
 
+=item B<-o,--output=>
+
+Set output directory.
+
 =item B<-p,--papersize=>
 
 Specify papersize.
@@ -73,22 +87,26 @@
 
 =over 5
 
-=item B<papersize>
+=item B<language="";>
 
-Specify papersize.
+Specify LaTeX language
 
-=item B<orientation>
+=item B<latexheaders="";>
 
-Set orientation.
+Specify additional LaTeX headers file
 
-=item B<language>
+=item B<orientation="";>
 
-Specify LaTeX language
+Set orientation.
 
-=item B<paperlinewidth>
+=item B<paperlinewidth="";>
 
 Specify the width (pt, mm or cm) of the printed lines.
 
+=item B<papersize="";>
+
+Specify papersize.
+
 =back
 
 =head1 ENVIRONMENT
@@ -143,27 +161,31 @@
 
 =over 5
 
-=item B<ORIENTATION>
+=item B<LANGUAGE=>
 
-Set orientation - portrait is the default.
+Specify LaTeX language.
 
-=item B<LANGUAGE>
+=item B<LATEXHF=>
 
-Specify LaTeX language.
+Specify additional LaTeX headers file
 
-=item B<OUTPUTDIR>
+=item B<LILYINCLUDE=>
 
-Set output directory.
+Additional directories for input files.
 
-=item B<PAPERSIZE>
+=item B<ORIENTATION=>
 
-Specify papersize.
+Set orientation - portrait is the default.
 
-=item B<LILYINCLUDE>
+=item B<OUTPUTDIR=>
 
-Additional directories for input files.
+Set output directory.
 
-=item B<TMP>
+=item B<PAPERSIZE=>
+
+Specify papersize.
+
+=item B<TMP=>
 
 Temporary directory name.
 
--- ly2dvi.sh   Sat May  2 19:13:58 1998
+++ ly2dvi.sh-0.10      Sat May  2 19:14:13 1998
@@ -8,24 +8,29 @@
 #  Original LaTeX file made by Mats Bengtsson, 17/8 1997
 #
 
-VERSION="0.9"
+VERSION="0.10"
 NAME=ly2dvi.sh
 IDENTIFICATION="$NAME $VERSION" 
 NOW=`date`
 echo "$IDENTIFICATION" 1>&2
 
-KEEP_LILY_OUTPUT=N
-
 # NEWS
 
+#0.10
+#      - -K,--keeplilypond : Keep lilypond output files (default delete)
+#      - -k,--keeply2dvi   : Keep ly2dvi   output files (default delete)
+#      - -L,--landscape    : Set landscape orientation
+#      - -N,--nonumber     : Turn off page numbering (\pagestyle{empty})
+#      - Could not reinsert "\usepackage[T1]{fontenc}" because
+#        "los-toros" won't work with it
+#      - Ekstra LaTeX headers from input file
+
 #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
@@ -137,12 +142,22 @@
 # Clean up
 #
 cleanup() {
-  $debug_echo "("$LF")("$FN")("$LOGFILE")"
   if [ "$KEEP_LY2DVI_OUTPUT" != "Y" ]
   then
-    [ -n "$LF" -a -f "$LF" ]           && rm -f $LF
+    [ -n "$LatF" -a -f "$LatF" ]       && rm -f $LatF
     [ -n "$LOGFILE" -a -f "$LOGFILE" ] && rm -f $LOGFILE
     [ -n "$FN" ]                       && rm -f $FN.*
+    for F in *$$* $TMP/*$$*
+    do
+      rm -f $F
+    done
+  fi
+  if [ "$KEEP_LILY_OUTPUT" != "Y" ]
+  then
+    for F in $LILY_OUTPUT_FILES
+    do
+      [ -f $F ] && rm -f $F
+    done
   fi
 }
 #
@@ -154,14 +169,18 @@
 Usage: $0 [options] file[s]
 
 Options:
-  -D, --debug           set debug mode
-  -O, --orientation=    set orientation (landscape or portrait (default))
-  -o, --output=         set output directory
-  -h, --help            this help text
-  -k, --keep            keep LaTeX file
-  -l, --language=       give LaTeX language (babel)
-  -p, --papersize=      give LaTeX papersize (eg. a4paper)
-  -s, --separate        run all files separately through LaTeX
+  -D,--debug           set debug mode
+  -H,--headers=        name of additional LaTeX headers file
+  -K,--keeplilypond    keep lilypond output files
+  -L,--landscape       set landscape orientation
+  -N,--nonumber        switch off page numbering
+  -O,--orientation=    set orientation (landscape or portrait (default))
+  -o,--output=         set output directory
+  -h,--help            this help text
+  -k,--keeply2dvi      keep ly2dvi output files
+  -l,--language=       give LaTeX language (babel)
+  -p,--papersize=      give LaTeX papersize (eg. a4paper)
+  -s,--separate        run all files separately through LaTeX
 
   files may be (a mix of) input to or output from lilypond(1)
 EOF
@@ -182,6 +201,7 @@
 LOGFILE=$TMP/lilylog.$$                        # Logfile for lilypond
 PWIDTH=600;                            # Width of A4 paper!
 PHEIGTH=845;                            # Heigth of A4 paper!
+PNUM="%"                                # Page numbering on
 #
 # RC-files ?
 #
@@ -193,7 +213,8 @@
 fORI=$ORIENTATION
 fLNG=$LANGUAGE
 fPSZ=$PAPERSIZE
-unset ORIENTATION LANGUAGE PAPERSIZE
+fLHF=$LATEXHF
+unset ORIENTATION LANGUAGE PAPERSIZE LATEXHF
 # 
 # Keywords defined in titledefs.tex
 #
@@ -228,7 +249,7 @@
 #
 # "x:" x takes argument
 #
-switches="DO:hkl:o:Kp:s\?"
+switches="DH:KLNO:hkl:o:p:s\?"
 options=""
 #
 # ugh, "\-" is a hack to support long options
@@ -243,9 +264,21 @@
       [ $debug_echo = echo ] && set -x
       debug_echo=echo
       ;;
+    H  )
+      LATEXHF=$OPTARG
+      ;;
+    K  )
+      KEEP_LILY_OUTPUT=Y
+      ;;
+    L  )
+      ORIENTATION=landscape
+      ;;
     O  )
       ORIENTATION=$OPTARG
       ;;
+    N  )
+      PNUM="\pagestyle{empty}"
+      ;;
     h  )
       help;
       exit 0
@@ -253,10 +286,6 @@
     k  )
       KEEP_LY2DVI_OUTPUT=Y
       ;;
-    K  )
-      KEEP_LILY_OUTPUT=Y
-      ;;
-    
     l  )
       LANGUAGE=$OPTARG
       ;;
@@ -277,29 +306,41 @@
     -)
       $debug_echo "long option: \`$OPTARG'"
       case "$OPTARG" in
-        D*|-D*)
+        d*|-d*)
           [ $debug_echo = echo ] && set -x
           debug_echo=echo
           ;;
+        hea*|-hea*)
+          LATEXHF=`echo $OPTARG | sed -e s/"^.*="//`
+          ;;
         h*|-h*)
           help;
          exit 0
           ;;
+        keepli*|-keepli*)
+          KEEP_LILY_OUTPUT=Y
+          ;;
         k*|-k*)
           KEEP_LY2DVI_OUTPUT=Y
           ;;
-        l*|-l*)
-          LANGUAGE=`echo $OPTARG | sed -e s/"^.*="//`
+        land*|-land*)
+          ORIENTATION=landscape
           ;;
-        p*|-p*)
-          PAPERSIZE=`echo $OPTARG | sed -e s/"^.*="//`
+        lang*|-lang*)
+          LANGUAGE=`echo $OPTARG | sed -e s/"^.*="//`
           ;;
+       n*|-n*)
+         PNUM="\pagestyle{empty}"
+         ;;
        or*|-or*)
          ORIENTATION=`echo $OPTARG | sed -e s/"^.*="//`
          ;;
        ou*|-ou*)
          OUTPUTDIR=`echo $OPTARG | sed -e s/"^.*="//`
          ;;
+        p*|-p*)
+          PAPERSIZE=`echo $OPTARG | sed -e s/"^.*="//`
+          ;;
         s*|-s*)
          SEPFILE=Y
           ;;
@@ -330,9 +371,9 @@
 FN=$BN.$$
 if [ "$KEEP_LY2DVI_OUTPUT" != "Y" ]
 then
-  LF=$TMP/$FN.tex
+  LatF=$TMP/$FN.tex
 else
-  LF=$FN.tex
+  LatF=$FN.tex
 fi
 #
 # Find:
@@ -342,11 +383,23 @@
 #   textwidth
 #
 eval `sed -n \\
-  -e 's/\\\\def\\\\mudelapapersize{\([^}]*\).*$/fPSZ=\1;/p' \\
-  -e 's/\\\\def\\\\mudelaorientation{\([^}]*\).*$/fORI=\1;/p' \\
   -e 's/\\\\def\\\\mudelalanguage{\([^}]*\).*$/fLNG=\1;/p' \\
+  -e 's/\\\\def\\\\mudelalatexheaders{\([^}]*\).*$/fLHF=\1;/p' \\
+  -e 's/\\\\def\\\\mudelaorientation{\([^}]*\).*$/fORI=\1;/p' \\
   -e 's/\\\\def\\\\mudelapaperlinewidth{\([^}]*\).*$/TWN=\1;/p' \\
+  -e 's/\\\\def\\\\mudelapapersize{\([^}]*\).*$/fPSZ=\1;/p' \\
     $File`
+#
+if [ -z "$LATEXHF" ]
+then
+  LATEXHF=$fLHF
+fi
+LLHF="%"
+if [ -n "$LATEXHF" ]
+then
+  [ -f $LATEXHF ] && LLHF="\input{$LATEXHF}"
+fi
+#
 if [ -z "$PAPERSIZE" ]
 then
   PAPERSIZE=$fPSZ
@@ -419,7 +472,7 @@
 #
 # Write LaTeX file
 #
-cat << EOF > $LF
+cat << EOF > $LatF
 % Creator: $IDENTIFICATION
 % Automatically generated from  $IF, $NOW
 
@@ -427,8 +480,9 @@
 \nonstopmode
 $LLNG
 \usepackage{geometry}
-%\usepackage[T1]{fontenc}
 \usepackage[latin1]{inputenc}
+%\usepackage[T1]{fontenc}
+$PNUM
 %\addtolength{\oddsidemargin}{-1cm}
 %\addtolength{\topmargin}{-1cm}
 \setlength{\textwidth}{$TW}
@@ -436,6 +490,7 @@
 \geometry{width=$TW, left=$MARG}
 \input lilyponddefs
 \input titledefs
+$LLHF
 \begin{document}
 EOF
 #
@@ -449,12 +504,12 @@
     LLL=`echo $LL | sed -e 's/}.*$//' -e 's/.*{//'`
     if [ "$LLL" != "" ]
     then
-      echo "\\"$L'{'$LLL'}%'                                >> $LF
+      echo "\\"$L'{'$LLL'}%'                                >> $LatF
     fi
   fi
 done
 #
-cat << EOF >> $LF
+cat << EOF >> $LatF
 \makelilytitle
 EOF
 }
@@ -462,14 +517,14 @@
 # Conclusion
 #
 endFile(){
-cat << EOF >> $LF
+cat << EOF >> $LatF
 \vfill\hfill{\LilyIdString}
 \end{document}
 EOF
 #
 # Run LaTeX
 #
-latex $LF || exit 5
+latex $LatF || exit 5
 #
 # Rename dvi file
 #
@@ -480,10 +535,6 @@
     cp $FN.dvi $RESULT
 fi
 #
-# Clean up
-#
-cleanup
-#
 # Output some info
 #
 cat << EOF
@@ -598,7 +649,7 @@
       FFile=$File
       startFile
     fi
-    cat << EOF >> $LF
+    cat << EOF >> $LatF
 \input{$File}
 EOF
     if [ $SEPFILE = Y ]
@@ -612,13 +663,6 @@
 if [ $SEPFILE = N ]
 then
   endFile
-fi
-
-
-
-if [ $KEEP_LILY_OUTPUT = N ]
-then
-    rm $LILY_OUTPUT_FILES
 fi
 #
 # OK - finished

Reply via email to