New version of ly2dvi:

#0.11
#       - more papersizes (thanks Han-Wen) - don't expect LaTeX to accept all...
#       - -W,--Width=       : set paper width  (points)
#       - -H,--Heigth=      : set paper heigth (points)
#       - -H and -W is used only when an unknown papersize is to be specified,
#         and has to be combined with a papersize option known to LaTeX
#NB!    - -F,--headers=     : name of additional LaTeX headers input file.
#NB!      Changed from -H to -F
#       - -d,--dependencies : passed to lilypond

Supported papersizes are:

a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, archA, archB, archC, archD,
archE, b0, b1, b2, b3, b4, b5, flsa, flse, halfletter, ledger, legal,
letter, note

I haven't been able to test all the names, so some names may be unknown
to LaTeX (I know that "a4" should input as "a4paper", I treat all "aN"
and "bN" the same way.)

-- 
       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
--- ly2dvi.pod  Fri May  8 23:28:35 1998
+++ ly2dvi.pod-0.11     Fri May  8 23:04:37 1998
@@ -27,7 +27,17 @@
 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=>
+=item B<-F,--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<-H,--Heigth=>
+
+Set paper heigth (points). Used together with width and LaTeX name of
+papersize in case of papersize unknown to ly2dvi.
+
+=item B<-F,--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}
@@ -47,8 +57,16 @@
 
 =item B<-O,--orientation=>
 
-Set orientation - portrait is the default.
-(C<-O> landscape produces C<\usepackage[landscape]{article}>)
+Set orientation landscape - obsolete, use C<-L> instead.
+
+=item B<-W,--Width=>
+
+Set paper width (points). Used together with heigth and LaTeX name of
+papersize in case of papersize unknown to ly2dvi.
+
+=item B<-d,--dependencies>
+
+Tell lilypond to make dependencies file.
 
 =item B<-h,--help>
 
@@ -70,7 +88,7 @@
 =item B<-p,--papersize=>
 
 Specify papersize.
-(C<-p a4paper> produces C<\usepackage[a4paper]{article}>)
+(C<-p a4> produces C<\usepackage[a4paper]{article}>)
 
 =item B<-s,--separate>
 
@@ -105,7 +123,7 @@
 
 =item B<papersize="";>
 
-Specify papersize.
+Specify name of papersize.
 
 =back
 
@@ -183,12 +201,20 @@
 
 =item B<PAPERSIZE=>
 
-Specify papersize.
+Specify name of papersize.
+
+=item B<PHEIGTH=>
+
+Specify paperheight (points - an inch is 72.27, a cm is 28.453 points).
 
 =item B<TMP=>
 
 Temporary directory name.
 
+=item B<PWIDTH=>
+
+Specify paperwidth (points - an inch is 72.27, a cm is 28.453 points).
+
 =back
 
 =head1 SEE ALSO
@@ -226,7 +252,12 @@
 
 =head1 REMARKS
 
-Only one papersize is supported, A4. Information on other sizes
+Many papersizes are now supported. Information on other sizes
 (LaTeX names, horizontal and vertical sizes) should be mailed to
 the author or to the mailing list.
 
+Supported papersizes are:
+
+a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, archA, archB, archC, archD,
+archE, b0, b1, b2, b3, b4, b5, flsa, flse, halfletter, ledger, legal,
+letter, note
--- ly2dvi.sh   Fri May  8 23:11:34 1998
+++ ly2dvi.sh-0.11      Fri May  8 23:19:53 1998
@@ -5,6 +5,8 @@
 # Written by Jan Arne Fagertun <[EMAIL PROTECTED]>
 #  Sat Nov 22 22:26:43 CET 1997
 #
+# $Id: ly2dvi.sh,v 1.16 1998/05/08 21:18:34 janaf Exp $
+#
 #  Original LaTeX file made by Mats Bengtsson, 17/8 1997
 #
 
@@ -16,6 +18,17 @@
 
 # NEWS
 
+#0.11
+#      - more papersizes (thanks Han-Wen) - don't expect LaTeX to accept all...
+#      - -W,--Width=       : set paper width  (points)
+#       - -H,--Heigth=      : set paper heigth (points)
+#      - -H and -W is used only when an unknown papersize is to be specified,
+#        and has to be combined with a papersize option known to LaTeX
+#NB!   - -F,--headers=     : name of additional LaTeX headers input file.
+#NB!      Changed from -H to -F
+#      - -d,--dependencies : passed to lilypond
+
+
 #0.10
 #      - -K,--keeplilypond : Keep lilypond output files (default delete)
 #      - -k,--keeply2dvi   : Keep ly2dvi   output files (default delete)
@@ -24,10 +37,10 @@
 #      - 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
+# 0.9
+#      - Trap Lilypond abort
 #      - Replaced "\usepackage[T1]{fontenc}" with
 #        \usepackage[latin1]{inputenc} (takk, Mats)
 #      - Removed "()" around "\LilyIdString" (Janne didn't want it)
@@ -170,16 +183,19 @@
 
 Options:
   -D,--debug           set debug mode
-  -H,--headers=        name of additional LaTeX headers file
+  -F,--headers=        name of additional LaTeX headers file
+  -H,--Heigth=         set paper heigth (points) (see manual page)
   -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
+  -O,--orientation=    set orientation (obsolete - use -L instead) 
+  -W,--Width=          set paper width (points) (see manual page)
+  -d,--dependencies    tell lilypond make a dependencies file
   -h,--help            this help text
   -k,--keeply2dvi      keep ly2dvi output files
   -l,--language=       give LaTeX language (babel)
-  -p,--papersize=      give LaTeX papersize (eg. a4paper)
+  -o,--output=         set output directory
+  -p,--papersize=      give LaTeX papersize (eg. a4)
   -s,--separate        run all files separately through LaTeX
 
   files may be (a mix of) input to or output from lilypond(1)
@@ -198,10 +214,151 @@
   $debug_echo $IDENTIFICATION": temporary directory "$TMP" not found, set to /tmp"
   TMP=/tmp
 fi
-LOGFILE=$TMP/lilylog.$$                        # Logfile for lilypond
-PWIDTH=600;                            # Width of A4 paper!
-PHEIGTH=845;                            # Heigth of A4 paper!
+LOGFILE=$TMP/lilylog.$$                        # Logfile for lilypond
+PAPERSIZE=a4                            # Default papersize name
+PWIDTH=597                              # Default paperwidth
+PHEIGTH=845                             # Default paperheigth
 PNUM="%"                                # Page numbering on
+LILYOPTS=""                             # Options to lilypond
+#
+setPaperZize() {
+case "$PAPERSIZE" in
+  a0*)
+    PWIDTH=2389
+    PHEIGTH=3381
+    PAPERSIZE=a0paper
+    ;;
+  a1|a1p*)
+    PWIDTH=1690
+    PHEIGTH=2389
+    PAPERSIZE=a1paper
+    ;;
+  a2*)
+    PWIDTH=1194
+    PHEIGTH=1690
+    PAPERSIZE=a2paper
+    ;;
+  a3*)
+    PWIDTH=845
+    PHEIGTH=1194
+    PAPERSIZE=a3paper
+    ;;
+  a4*)
+    PWIDTH=597
+    PHEIGTH=845
+    PAPERSIZE=a4paper
+    ;;
+  a5*)
+    PWIDTH=423
+    PHEIGTH=597
+    PAPERSIZE=a5paper
+    ;;
+  a6*)
+    PWIDTH=298
+    PHEIGTH=423
+    PAPERSIZE=a6paper
+    ;;
+  a7*)
+    PWIDTH=211
+    PHEIGTH=298
+    PAPERSIZE=a7paper
+    ;;
+  a8*)
+    PWIDTH=305
+    PHEIGTH=211
+    PAPERSIZE=a8paper
+    ;;
+  a9*)
+    PWIDTH=105
+    PHEIGTH=305
+    PAPERSIZE=a9paper
+    ;;
+  a10*)
+    PWIDTH=74
+    PHEIGTH=105
+    PAPERSIZE=a10paper
+    ;;
+  b0*)
+    PWIDTH=2847
+    PHEIGTH=4023
+    PAPERSIZE=b0paper
+    ;;
+  b1*)
+    PWIDTH=2012
+    PHEIGTH=2847
+    PAPERSIZE=b1paper
+    ;;
+  b2*)
+    PWIDTH=1423
+    PHEIGTH=2012
+    PAPERSIZE=b2paper
+    ;;
+  b3*)
+    PWIDTH=1006
+    PHEIGTH=1423
+    PAPERSIZE=b3paper
+    ;;
+  b4*)
+    PWIDTH=712
+    PHEIGTH=1006
+    PAPERSIZE=b4paper
+    ;;
+  b5*)
+    PWIDTH=503
+    PHEIGTH=712
+    PAPERSIZE=b5paper
+    ;;
+  archA)
+    PWIDTH=650
+    PHEIGTH=867
+    ;;
+  archB)
+    PWIDTH=867
+    PHEIGTH=1301
+    ;;
+  archC)
+    PWIDTH=1301
+    PHEIGTH=1734
+    ;;
+  archD)
+    PWIDTH=1734
+    PHEIGTH=2602
+    ;;
+  archE)
+    PWIDTH=2602
+    PHEIGTH=3469
+    ;;
+  flsa|flse)
+    PWIDTH=614
+    PHEIGTH=940
+    ;;
+  halfletter)
+    PWIDTH=397
+    PHEIGTH=614
+    ;;
+  ledger)
+    PWIDTH=1229
+    PHEIGTH=795
+    ;;
+  legal)
+    PWIDTH=614
+    PHEIGTH=1012
+    ;;
+  letter)
+    PWIDTH=614
+    PHEIGTH=795
+    ;;
+  note)
+    PWIDTH=542
+    PHEIGTH=723
+    ;;
+  *)
+    echo ""
+    echo $0": unknown papersize -- "$PAPERSIZE
+    echo ""
+    ;;
+esac
+}
 #
 # RC-files ?
 #
@@ -249,7 +406,7 @@
 #
 # "x:" x takes argument
 #
-switches="DH:KLNO:hkl:o:p:s\?"
+switches="DF:H:KLNO:W:dhkl:o:p:s\?"
 options=""
 #
 # ugh, "\-" is a hack to support long options
@@ -264,9 +421,12 @@
       [ $debug_echo = echo ] && set -x
       debug_echo=echo
       ;;
-    H  )
+    F  )
       LATEXHF=$OPTARG
       ;;
+    H  )
+      PHEIGTH=$OPTARG
+      ;;
     K  )
       KEEP_LILY_OUTPUT=Y
       ;;
@@ -279,6 +439,12 @@
     N  )
       PNUM="\pagestyle{empty}"
       ;;
+    W  )
+      PWIDTH=$OPTARG
+      ;;
+    d  )
+      LILYOPTS=$LILYOPTS" -d"
+      ;;
     h  )
       help;
       exit 0
@@ -306,6 +472,15 @@
     -)
       $debug_echo "long option: \`$OPTARG'"
       case "$OPTARG" in
+        He*|-He*)
+          PHEIGTH=`echo $OPTARG | sed -e s/"^.*="//`
+          ;;
+        W*|-W*)
+          PWIDTH=`echo $OPTARG | sed -e s/"^.*="//`
+          ;;
+        dep*|-dep*)
+          LILYOPTS=$LILYOPTS" -d"
+          ;;
         d*|-d*)
           [ $debug_echo = echo ] && set -x
           debug_echo=echo
@@ -406,6 +581,7 @@
 fi
 if [ -n "$PAPERSIZE" ]
 then
+  setPaperZize
   PAPEROPT=$PAPERSIZE
 fi
 #
@@ -614,9 +790,9 @@
     # Run lilypond
     # Grab output file names
     #
-    $debug_echo "lilypond "$IF
+    $debug_echo "lilypond "$LILYOPTS $IF
 
-    lilypond $IF 2>&1  | tee $LOGFILE
+    lilypond $LILYOPTS $IF 2>&1  | tee $LOGFILE
     OF=`egrep '^TeX output to ' $LOGFILE | \\
         sed -e 's/TeX output to//' -e 's/\.\.\.//'`
     $debug_echo "==> "$OF

Reply via email to