From 0ce1e6868415544da24d76898f604f5353972fb1 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:11:00 +0000 Subject: [PATCH] lilypond-0.1.61 --- Documentation/man/ly2dvi.pod | 78 ++++++++++++------- bin/ly2dvi.sh | 140 +++++++++++++++++++++++------------ tex/headers.tex | 12 +++ 3 files changed, 154 insertions(+), 76 deletions(-) create mode 100644 tex/headers.tex diff --git a/Documentation/man/ly2dvi.pod b/Documentation/man/ly2dvi.pod index 60968cf9d5..7e585743e7 100644 --- a/Documentation/man/ly2dvi.pod +++ b/Documentation/man/ly2dvi.pod @@ -27,32 +27,46 @@ Set debug mode. There are two levels - in level one some debug info is written, in level two the command C 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 @@ file. They are overridden by corresponding command line options. =over 5 -=item B +=item B -Specify papersize. +Specify LaTeX language -=item B +=item B -Set orientation. +Specify additional LaTeX headers file -=item B +=item B -Specify LaTeX language +Set orientation. -=item B +=item B Specify the width (pt, mm or cm) of the printed lines. +=item B + +Specify papersize. + =back =head1 ENVIRONMENT @@ -143,27 +161,31 @@ In the current version the following are allowed: =over 5 -=item B +=item B -Set orientation - portrait is the default. +Specify LaTeX language. -=item B +=item B -Specify LaTeX language. +Specify additional LaTeX headers file -=item B +=item B -Set output directory. +Additional directories for input files. -=item B +=item B -Specify papersize. +Set orientation - portrait is the default. -=item B +=item B -Additional directories for input files. +Set output directory. -=item B +=item B + +Specify papersize. + +=item B Temporary directory name. diff --git a/bin/ly2dvi.sh b/bin/ly2dvi.sh index 11c15cfeb6..2f048fb4da 100644 --- a/bin/ly2dvi.sh +++ b/bin/ly2dvi.sh @@ -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 @@ KEEP_LILY_OUTPUT=N # 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 @@ Generate dvi file from mudela or lilypond output 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 @@ fi 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 @@ done 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 @@ SEPFILE=N # # "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 @@ do [ $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 @@ do k ) KEEP_LY2DVI_OUTPUT=Y ;; - K ) - KEEP_LILY_OUTPUT=Y - ;; - l ) LANGUAGE=$OPTARG ;; @@ -277,29 +306,41 @@ do -) $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 @@ BN=`basename $File .tex` 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 @@ fi # 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 @@ MARG=`expr $MARG / 2`"pt" # # Write LaTeX file # -cat << EOF > $LF +cat << EOF > $LatF % Creator: $IDENTIFICATION % Automatically generated from $IF, $NOW @@ -427,8 +480,9 @@ cat << EOF > $LF \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 @@ $LLNG \geometry{width=$TW, left=$MARG} \input lilyponddefs \input titledefs +$LLHF \begin{document} EOF # @@ -449,12 +504,12 @@ do 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 @@ EOF # 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 @@ then cp $FN.dvi $RESULT fi # -# Clean up -# -cleanup -# # Output some info # cat << EOF @@ -598,7 +649,7 @@ do FFile=$File startFile fi - cat << EOF >> $LF + cat << EOF >> $LatF \input{$File} EOF if [ $SEPFILE = Y ] @@ -613,13 +664,6 @@ if [ $SEPFILE = N ] then endFile fi - - - -if [ $KEEP_LILY_OUTPUT = N ] -then - rm $LILY_OUTPUT_FILES -fi # # OK - finished # diff --git a/tex/headers.tex b/tex/headers.tex new file mode 100644 index 0000000000..915d3c1388 --- /dev/null +++ b/tex/headers.tex @@ -0,0 +1,12 @@ + + +\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} -- 2.39.5