+++ /dev/null
-mailto(daboys@bga.com)
-manpage(LilyPond)
- (1)
- (1998)
- (The LilyPond package)
- (Ly2dvi32)
-
-metalC(Automatically generated by yodl(1) from ly2dvi32.yo.)
-
-manpagename(Ly2dvi32)(Python utility to convert mudela to DVI)
-
-manpagedescription()
-ly2dvi is a Python script which creates input file for LaTeX,
-based on information from the output files from LilyPond.
-The script handles multiple files. If a mudela file name is
-specified LilyPond is run to make an output (TeX) file.
-
-One or more LaTeX files are created, based on information found
-in the output (TeX) files, and latex is finally run to create
-one or more DVI files.
-
-The majority of this utility came from a bourne script written by Jan
-Arne Fagertun name file(ly2dvi).
-
-manpagesynopsis()
-
- ly2dvi32 [options] inputfile[.ly] [....]
-
-manpageoptions()
-
-description(
-dit(-D,--debug)
- Set debug mode. There are two levels - in level one some debug
- info is written, in level two the command bf(set -x) is run, which
- echoes every command in the ly2dvi script.
-dit(-F,--headers=)
- Name of additional LaTeX headers file. This is included in the
- tex file at the end of the headers, last line before code(\begin{document})
-dit(-H,--Heigth=)
- Set paper heigth (points). Used together with width and LaTeX name of
- papersize in case of papersize unknown to ly2dvi.
-dit(-F,--headers=)
- Name of additional LaTeX headers file. This is included in the
- tex file at the end of the headers, last line before code(\begin{document})
-dit(-K,--keeplilypond)
- Keep LilyPond output after the run.
-dit(-L,--landscape)
- Set landscape orientation - portrait is the default.
- (bf(-L) produces code(\usepackage[landscape]{article}))
-dit(-N,--nonumber)
- Switch off page numbering.
-dit(-O,--orientation=)
- Set orientation landscape - obsolete, use bf(-L) instead.
-dit(-P,--postscript)
- In addition to the DVI file, also Generate a postsript file.
-dit(-W,--Width=)
- Set paper width (points). Used together with heigth and LaTeX name of
- papersize in case of papersize unknown to ly2dvi.
-dit(-d,--dependencies)
- Tell lilypond to make dependencies file.
-dit(-h,--help)
- Print help.
-dit(-k,--keeply2dvi)
- Keep the LaTeX file after the run.
-dit(-l,--language=)
- Specify LaTeX language.
- (bf(-l norsk) produces code(\usepackage[norsk]{babel})).
-dit(-o,--output=)
- Set output directory.
-dit(-p,--papersize=)
- Specify papersize.
- (bf(-p a4) produces code(\usepackage[a4paper]{article}))
-dit(-s,--separate)
- Normally all output files are included into one LaTeX file.
- With this switch all files are run separately, to produce one
- DVI file for each.
-)
-
-manpagesection(Features)
-
-ly2dvi responds to several parameters specified in the mudela
-file. They are overridden by corresponding command line options.
-
-description(
-dit(language="";)
- Specify LaTeX language
-dit(latexheaders="";)
- Specify additional LaTeX headers file
-dit(orientation="";)
- Set orientation.
-dit(paperlinewidth="";)
- Specify the width (pt, mm or cm) of the printed lines.
-dit(papersize="";)
- Specify name of papersize.
-)
-
-manpagesection(Environment)
-
-description(
-dit(LILYPONDPREFIX)
- Sets the root directory of the LilyPond installation
-dit(LILYINCLUDE)
- Additional directories for input files.
-dit(TMP)
- Temporary directory name. Default is /tmp
-)
-
-manpagesection(Files)
-
-file(titledefs.tex) is inspected for definitions used to extract
-additional text definitions from the mudela file. In the current
-version the following are defined:
-
-description(
-dit(title)
- The title of the music. Centered on top of the first page.
-dit(subtitle)
- Subtitle, centered below the title.
-dit(poet)
- Name of the poet, leftflushed below the below subtitle.
-dit(composer)
- Name of the composer, rightflushed below the subtitle.
-dit(metre)
- Meter string, leftflushed below the below poet.
-dit(opus)
- Name of the opus, rightflushed below the below composer.
-dit(arranger)
- Name of the arranger, rightflushed below the opus.
-dit(instrument)
- Name of the instrument, centered below the arranger
-dit(piece)
- Name of the piece, leftflushed below the instrument
-)
-
-file($LILYPONDPREFIX/share/.lilyrc $HOME/.lilyrc ./.lilyrc) are files
-to set up default running conditions. On Windows OS initialization
-files are named file(_lilyrc). The file syntax is as follows:
-
-verb(VARIABLE-NAME=VALUE)
-
-Where bf(VARIABLE-NAME) is the name of the variable documented below
-and bf(VALUE) is either a string, a 1, or a 0. All files are parsed,
-in the shown sequence. In the current version the following are
-allowed:
-
-description(
-dit(DEBUG=value)
-This turns off (default) or on the debug capabilities. Possible
-values are 0 (off) and 1 (on).
-dit(DEPENDENCIES=value)
-This turns off (default) or on the ability to generate a Makefile
-dependency list. Possible values are 0 (off) and 1 (on).
-dit(KEEPLILYPOND=value)
-This turns off (default) or on the ability to keep the log file
-associated with the LilyPond job. Possible values are 0 (off) and 1
-(on).
-dit(KEEPLY2DVI=value)
-This turns off (default) or on the ability to keep the temporary files
-that are generated by the ly2dvi job. Possible values are 0 (off) and
-1 (on)
-dit(LANGUAGE=value)
-Specify LaTeX language. Possible value is a valid LaTeX language.
-dit(LATEXHF=value)
-Specify additional LaTeX headers file. Possible value is a file
-specification.
-dit(LILYINCLUDE=value)
-Additional directories for input files. Possible value is a delimited
-directory path list.
-dit(LILYPONDPREFIX=value)
-This defines the LilyPond root directory. Possible value is a valid
-directory specification to the LilyPond distribution location.
-dit(NONUMBER=value)
-This turns off (default) or on the page numbering capability.
-Possible values are 0 (page numbering enabled) and 1 (page numbering
-disabled).
-dit(ORIENTATION=value)
-This sets the image orientation. Possible values are
-portrait (default) and landscape.
-dit(OUTPUTDIR=value)
-This defines the directory where the resultant files will be
-generated. Possible value is a valid directory specification.
-Default is the current working directory.
-dit(PAPERSIZE=value)
-This defines the papersize the image will be sized to fit. Possible
-values are a0, a1, a2, a3, a4 (default), a5, a6, a7, a8, a9, a10, b0,
-b1, b2, b3, b4, b5, archA, archB, archC, archD, archE, flsa, flse,
-halfletter, ledger, legal, letter, or note.
-dit(PHEIGHT=value)
-Specify paperheight (points - an inch is 72.27, a cm is 28.453 points).
-dit(POSTSCRIPT=value)
-This turns off (default) or on the capability of additionally
-generating a postscript file. Possible values are 0 (off) and 1 (on).
-dit(PWIDTH=value)
-Specify paperwidth (points - an inch is 72.27, a cm is 28.453 points).
-dit(SEPARATE=value)
-This turns off (default) or on the capability of generating multiple
-dvi and postscript files from multiple source files. The default is
-to generate a concatenation of the source files. Possible values are
-0 (single file) and 1 (separate files).
-dit(TMP=value)
-This defines the emporary directory. Actually this is not used at the
-present. Possible value is a valid directory specification that is
-writable to the user.
-)
-
-manpagesection(Initialization Sequence)
-The initialization process reads inputs for several sources. Below is
-a list of priorities for lowest to hightest proirity.
-
-itemize(
-it() Program's defaults
-it() Values found in LilyPond output file
-it() Environment variables
-it() $LILYPONDPREFIX/share/lilypond/.lilyrc
-it() $HOME/.lilyrc
-it() ./.lilyrc
-it() command line options
-)
-
-Note that this differs slightly from the original bourne shell
-version.
-
-
-manpagesection(See Also)
-
-lilypond(1), tex(1), latex(1)
-
-manpagesection(Bugs)
-
-If you have found a bug, you should send a bugreport.
-
-itemize(
-it()Send a copy of the input which causes the error.
-it()Send a description of the platform you use.
-it()Send a description of the LilyPond and ly2dvi version you use.
-it()Send a description of the bug itself.
-it()Send it to email(bug-gnu-music@gnu.org) (you don't have to subscribe
- to this mailinglist).
-)
-
-manpagesection(Remarks)
-
-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
-
-manpageauthor()
-Python Version author:
-nemail(Jeffrey B. Reed)(daboys@bga.com),
-lurl(http://www.realtime.net/~daboys/lilypond/)
-
-Original bourne shell version author:
-nemail(Jan Arne Fagertun)(Jan.A.Fagertun@energy.sintef.no),
-lurl(http://www.termo.unit.no/mtf/people/janaf/)
-
-
-
+++ /dev/null
-#!/bin/sh
-#
-# Script to make a LaTeX file for Lilypond
-#
-# Written by Jan Arne Fagertun <Jan.A.Fagertun@energy.sintef.no>
-# Sat Nov 22 22:26:43 CET 1997
-#
-# $Id: ly2dvi-old.sh,v 1.1 1998/10/19 10:09:06 fred Exp $
-#
-# Original LaTeX file made by Mats Bengtsson, 17/8 1997
-#
-
-VERSION="0.12.jcn1"
-NAME=ly2dvi.sh
-IDENTIFICATION="$NAME $VERSION"
-NOW=`date`
-echo "$IDENTIFICATION" 1>&2
-
-# TODO:
-# prevent orphaned "Lily is here" strings
-
-# NEWS
-
-# 0.12.jcn1
-# - mudelaDefs really fixed (sorry, PC)
-
-# 0.12
-# - -S/--sourcedir switch
-
-#
-#0.11.jcn3
-# - mudelaDefs fixes, (thanks PC)
-#0.11.jcn2
-# - pass -I, --include to Lily
-# - bf: split $LILYINCLUDE and try all dirs
-# - bf: geometry left/top
-#
-#0.11.pc
-# - fix backslash gobbling, reduce number of separate processes used
-# - require readable rc files, allow rc file in /usr/local/share/lilypond/lilyrc
-# - use latex path, not tex path
-# - Don't override if kpsepath returns non-NULL
-# - Don't clobber x.tex if it wasn't created by ly2dvi
-#
-#
-#0.11.jcn1
-# - find .fly files too
-#
-#0.11.hwn1
-# - height vs heigth
-# - robustification: give \nonstopmode as LaTeX arg; no hanging if no TeX file.
-# - robustification: notice failed cp.
-
-#0.11
-# - more papersizes (thanks Han-Wen) - don't expect LaTeX to accept all...
-# - -W,--Width= : set paper width (points)
-# - -H,--Height= : set paper height (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.jcn1
-# - HEIGHT -> HEIGHT
-# - vertical margins (for a4), same on both sides
-# - textheight from lilypond output file (mudelapapertextheight)
-# - piece titling
-# - mudelapiece, mudelaopus
-#
-#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
-# - More human-readable variables
-# - Some logics concerning rc-files
-# 0.7
-# - Improved Lilypond error checking
-# - Output orientation (landscape...). Overrides mudela file
-# variable orientation="landscape";
-# - Paper width and height put into variables (only A4!)
-# - Adjusted top margin to default.....
-#
-#TODO
-# - Include more papersizes.
-# - Manual page.......
-# 0.6.jaf2
-# - LILYINCLUDE update
-#
-# 0.6.hwn1
-# - handle LILYINCLUDE
-# - --output
-#
-# 0.6
-# - Source rc-files, if present. Files are:
-# /usr/local/share/lilyrc /etc/lilyrc $HOME/.lilyrc ./.lilyrc
-# - tee output from Lilypond
-# - 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
-# is replaced by grabbing output file names from Lilypond.
-# = Detects multiple output files - adds them when running
-# LaTeX.
-# - Works with multiple input files - no matter if they are
-# (a mix of) input to or output from Lilypond.
-#
-#TODO
-# - Still no margins handling.
-# - We have to discuss how to handle multiple output files
-# from Lilypond - 'ly2dvi standchen' gives a rather odd
-# result....
-
-# 0.4.1
-# - Always exit after printing help info
-# 0.4
-# - Changes to ensure for more strict grep'ing of parameters
-# Thanks to from G.B.Stott@bolton.ac.uk
-# - More efficient use of sed -e 's///' -e 's///'
-# Thanks to Johan Vromans <jvromans@squirrel.nl> and GBS
-# - Ask tex for location of titledefs.tex (Thanks to JV)
-# - Accept only exact match of "\def\mudelacomposer{"
-# (or whatever mudela* defined in titledefs.tex)
-# - Even more efficient use of sed (Thanks to JV)
-# - Default file name for single output file implemented.
-# - Moved help into function - finally included from 0.1.jcn1
-#
-#TODO
-# - Still doesn't handle \include
-# - The Q&D for finding output file name from the sequence of
-# \paper \output \midi \output really needs to be looked at.
-# I have improved it a lot, but it's only capable of finding
-# one (the last) file name.
-# Well, I have to rewrite this entirely to handle \include,
-# then I can fix it.
-# - Still no margins handling.
-#
-#WARNING
-# - Some lines of output from lilypond do NOT start
-# at first character position, therefore I have removed "^"
-# in sed'ing and grep'ing.
-
-# 0.3.hwn1
-# - add "Creator: " line to output
-#
-# 0.3
-# - multiple input files to make score from several files
-# (extra files assumed to be Lilypond output)
-# - cp dvi-file instead of mv, to allow for xdvi reload
-# - check for illegal long options
-# - put in pt in text width, if not given
-# - put in \nonstopmode in LaTeX file
-# - restored LaTeX exit value check
-
-# 0.2.1
-# - temporarily omit LaTeX exit value check
-# - remove ALL temporary files
-
-# 0.2
-# - fix for solaris - included from 0.1.jcn1
-# - long option hack - included from 0.1.jcn1 - modified
-# - moved help into function - NOT included from 0.1.jcn1 yet
-# - various improvements - included from 0.1.jcn1
-# - find mudela definitions from titledefs.tex
-# - find papersize from lilypond output file (mudelapapersize),
-# overridden by option '-p size' or '--papersize=size'
-# - option -l lang or --language=lang overrides
-# lilypond output file definition (mudelalanguage)
-# - textwidth from lilypond output file (mudelapaperlinewidth)
-
-# 0.1.jcn1
-# - fix for solaris
-# - long option hack
-# - moved help into function
-
-#
-# Clean up
-#
-cleanup() {
- if [ "$KEEP_LY2DVI_OUTPUT" != "Y" ]
- then
- [ -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
-}
-
-#
-# print usage
-#
-help() {
- cat << EOF
-Generate dvi file from mudela or lilypond output
-Usage: $0 [OPTION]... [FILE]...
-
-Options:
- -D,--debug increase verbosity
- -F,--headers= name of additional LaTeX headers file
- -H,--Height= set paper height (points) (see manual page)
- -I,--include=DIR add DIR to search path of LilyPond
- -K,--keeplilypond keep lilypond output files
- -L,--landscape set landscape orientation
- -N,--nonumber switch off page numbering
- -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)
- -o,--output= set output directory
- -p,--papersize= give LaTeX papersize (eg. a4)
- -s,--separate run all files separately through LaTeX
- -S,--sourcedir set sourcedir
-
- files may be (a mix of) input to or output from lilypond(1)
-EOF
-}
-
-
-#
-# SVr4 echo swallows backslashes, and there's no way to turn it off.
-# Therefore use Echo whenever backslashes may be important.
-# printf is in the posix.2 standard -- which means it's in
-# all modern shells.
-#
-Echo() {
- printf "%s\n" "$@"
-}
-
-#
-setPaperZize() {
-case "$PAPERSIZE" in
- a0*)
- PWIDTH=2389
- PHEIGHT=3381
- PAPERSIZE=a0paper
- ;;
- a1|a1p*)
- PWIDTH=1690
- PHEIGHT=2389
- PAPERSIZE=a1paper
- ;;
- a2*)
- PWIDTH=1194
- PHEIGHT=1690
- PAPERSIZE=a2paper
- ;;
- a3*)
- PWIDTH=845
- PHEIGHT=1194
- PAPERSIZE=a3paper
- ;;
- a4*)
- PWIDTH=597
- PHEIGHT=845
- PAPERSIZE=a4paper
- ;;
- a5*)
- PWIDTH=423
- PHEIGHT=597
- PAPERSIZE=a5paper
- ;;
- a6*)
- PWIDTH=298
- PHEIGHT=423
- PAPERSIZE=a6paper
- ;;
- a7*)
- PWIDTH=211
- PHEIGHT=298
- PAPERSIZE=a7paper
- ;;
- a8*)
- PWIDTH=305
- PHEIGHT=211
- PAPERSIZE=a8paper
- ;;
- a9*)
- PWIDTH=105
- PHEIGHT=305
- PAPERSIZE=a9paper
- ;;
- a10*)
- PWIDTH=74
- PHEIGHT=105
- PAPERSIZE=a10paper
- ;;
- b0*)
- PWIDTH=2847
- PHEIGHT=4023
- PAPERSIZE=b0paper
- ;;
- b1*)
- PWIDTH=2012
- PHEIGHT=2847
- PAPERSIZE=b1paper
- ;;
- b2*)
- PWIDTH=1423
- PHEIGHT=2012
- PAPERSIZE=b2paper
- ;;
- b3*)
- PWIDTH=1006
- PHEIGHT=1423
- PAPERSIZE=b3paper
- ;;
- b4*)
- PWIDTH=712
- PHEIGHT=1006
- PAPERSIZE=b4paper
- ;;
- b5*)
- PWIDTH=503
- PHEIGHT=712
- PAPERSIZE=b5paper
- ;;
- archA)
- PWIDTH=650
- PHEIGHT=867
- ;;
- archB)
- PWIDTH=867
- PHEIGHT=1301
- ;;
- archC)
- PWIDTH=1301
- PHEIGHT=1734
- ;;
- archD)
- PWIDTH=1734
- PHEIGHT=2602
- ;;
- archE)
- PWIDTH=2602
- PHEIGHT=3469
- ;;
- flsa|flse)
- PWIDTH=614
- PHEIGHT=940
- ;;
- halfletter)
- PWIDTH=397
- PHEIGHT=614
- ;;
- ledger)
- PWIDTH=1229
- PHEIGHT=795
- ;;
- legal)
- PWIDTH=614
- PHEIGHT=1012
- ;;
- letter)
- PWIDTH=614
- PHEIGHT=795
- ;;
- note)
- PWIDTH=542
- PHEIGHT=723
- ;;
- *)
- echo ""
- echo $0": unknown papersize -- "$PAPERSIZE
- echo ""
- ;;
-esac
-}
-
-doRcFiles()
-{
-#
-# RC-files ?
-#
-for D in /usr/local/share/ /usr/local/share/lilypond/ /etc/ $HOME/. ./.
-do
- RCfile=$D"lilyrc"
- [ -r $RCfile ] && . $RCfile
-done
-fORI=$ORIENTATION
-fLNG=$LANGUAGE
-fPSZ=$PAPERSIZE
-fLHF=$LATEXHF
-unset ORIENTATION LANGUAGE PAPERSIZE LATEXHF
-}
-
-
-
-#
-# Trap function (cleanup)
-#
-
-
-
-trap cleanup 0 9 15
-
-
-
-#
-# Various defaults
-#
-[ -z "$TMP" ] && TMP=/tmp
-if [ ! -d $TMP ]
-then
- $debug_echo $IDENTIFICATION": temporary directory "$TMP" not found, set to /tmp"
- TMP=/tmp
-fi
-LOGFILE=$TMP/lilylog.$$ # Logfile for lilypond
-PAPERSIZE=a4 # Default papersize name
-PWIDTH=597 # Default paperwidth
-PHEIGHT=845 # Default paperheight
-PNUM="%" # Page numbering on
-LILYOPTS="" # Options to lilypond
-SOURCEDIR=""
-LILYPOND_EXECUTABLE=lilypond
-doRcFiles
-
-
-
-# Keywords defined in titledefs.tex
-#
-TF="`kpsewhich -n latex tex titledefs.tex`"
-MU_DEF=""
-if [ -r "${TF:=/usr/local/share/texmf/tex/lilypond/titledefs.tex}" ]
-then
- MU_DEF=`sed -n -e 's/.*newcommand\*{.\(mudela[^}]*\)}.*$/\1/p' "$TF"`
-fi
-
-: "${MU_DEF:=mudelatitle mudelasubtitle mudelacomposer \
- mudelameter mudelaopus mudelaarranger mudelapiece \
- mudelapoet mudelainstrument \
- }"
-
-#
-# debugging
-#
-debug_echo=:
-#
-# All files in one LaTeX run
-#
-SEPFILE=N
-#
-# Find command line options and switches
-#
-# "x:" x takes argument
-#
-switches="DF:H:I:KLNO:W:dhkl:o:p:S:s\?"
-options=""
-#
-# ugh, "\-" is a hack to support long options
-# while getopts \-:$options$switches O
-# must be in double quotes for bash-2.0
-while getopts "\-:$options$switches" O
-do
- $debug_echo "O: \`$O'"
- $debug_echo "arg: \`$OPTARG'"
- case $O in
- D )
- [ $debug_echo = echo ] && set -x
- debug_echo=echo
- ;;
- F )
- LATEXHF=$OPTARG
- ;;
- H )
- PHEIGHT=$OPTARG
- ;;
- I )
- LILYOPTS="$LILYOPTS -I $OPTARG"
- LILYINCLUDE="$LILYINCLUDE:$OPTARG"
- ;;
- K )
- KEEP_LILY_OUTPUT=Y
- ;;
- L )
- ORIENTATION=landscape
- ;;
- O )
- ORIENTATION=$OPTARG
- ;;
- N )
- PNUM="\pagestyle{empty}"
- ;;
- W )
- PWIDTH=$OPTARG
- ;;
- d )
- LILYOPTS=$LILYOPTS" -d"
- ;;
- h )
- help;
- exit 0
- ;;
- k )
- KEEP_LY2DVI_OUTPUT=Y
- ;;
- l )
- LANGUAGE=$OPTARG
- ;;
- o )
- OUTPUTDIR=$OPTARG
- ;;
- p )
- PAPERSIZE=$OPTARG
- ;;
- s )
- SEPFILE=Y
- ;;
- S )
- SOURCEDIR=$OPTARG
- ;;
- \? )
- help;
- exit -1
- ;;
- # a long option!
- -)
- $debug_echo "long option: \`$OPTARG'"
- case "$OPTARG" in
- He*|-He*)
- PHEIGHT"`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"=
- ;;
- W*|-W*)
- PWIDTH="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"
- ;;
- dep*|-dep*)
- LILYOPTS="$LILYOPTS -d"
- ;;
- d*|-d*)
- [ $debug_echo = echo ] && set -x
- debug_echo=echo
- ;;
- hea*|-hea*)
- LATEXHF="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"
- ;;
- h*|-h*)
- help;
- exit 0
- ;;
- i*|-i*)
- dir="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"
- LILYOPTS="$LILYOPTS --include=$dir"
- LILYINCLUDE="$LILYINCLUDE:$dir"
- ;;
- keepli*|-keepli*)
- KEEP_LILY_OUTPUT=Y
- ;;
- k*|-k*)
- KEEP_LY2DVI_OUTPUT=Y
- ;;
- land*|-land*)
- ORIENTATION=landscape
- ;;
- lang*|-lang*)
- LANGUAGE="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"
- ;;
- n*|-n*)
- PNUM="\pagestyle{empty}"
- ;;
- or*|-or*)
- ORIENTATION="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"
- ;;
- ou*|-ou*)
- OUTPUTDIR="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"
- ;;
- p*|-p*)
- PAPERSIZE="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"
- ;;
- separa*|-sep*)
- SEPFILE=Y
- ;;
- sourcedir*|-sourcedir*)
- SOURCEDIR=$OPTARG
- ;;
- *|-*)
- echo "$0: illegal option -- \"$OPTARG\""
- help;
- exit -1
- ;;
- esac
- esac
-done
-shift `expr $OPTIND - 1`
-
-if [ "$SOURCEDIR" != "" ]; then
-# apparently MakeTeXTFM can't handle relative dirs
- SOURCEDIR=`cd $SOURCEDIR; pwd`
- LILYINCLUDE="$SOURCEDIR/init:$SOURCEDIR/mf/out:$LILYINCLUDE"
- TEXINPUTS="$SOURCEDIR/tex:$TEXINPUTS:"
- MFINPUTS="$SOURCEDIR/mf:$MFINPUTS:"
- LILYPOND_EXECUTABLE="$SOURCEDIR/lily/out/lilypond"
- export MFINPUTS LILYPOND_EXECUTABLE TEXINPUTS SOURCEDIR
-fi
-
-#
-# Input file name
-#
-if [ "$1" = "" ]
-then
- help
- $debug_echo "$IDENTIFICATION: No input file name given"
- exit 1
-fi
-# regexp_quote -- quote a string as a regular expression for egrep or sed
-regexp_quote(){
- Echo "$@" | sed 's/\([]\[\.*?+^$]\)/\\\1/g'
-}
-#
-#
-mudelaDefs(){
-# Include \def\mudela-definitions
-# The aim here is to pick up the definition for the
-# current file, then any other file.
-#
-mudelatmp=$TMP/mudelaDefs$$
-# Use `cat' to prevent filenames being prepended
-#
-cat "$File" $OF | fgrep "$MU_DEF" > $mudelatmp
-for L in $MU_DEF
-do
- # This converts \def\mudelatitle{fred}
- # to \mudelatitle{fred} or to
- # \def\mudelatitle{fred}
- # and stops after the first one found.
- sed -n '/\\def\\'"$L"'{\([^}]*\)}.*$/{
- s//'"`regexp_quote \"$1\"`"'\\'"$L"'{\1}%/p
- q
- }' $mudelatmp >> $LatF
-done
-rm -f $mudelatmp
-}
-#
-#
-startFile(){
-#
-# LaTeX file name
-#
-BN=`basename "$File" .tex`
-FN="$BN.$$"
-if [ "$KEEP_LY2DVI_OUTPUT" != "Y" ]
-then
- LatF="$TMP/$FN.tex"
-else
- LatF="$FN.tex"
-fi
-#
-# Find:
-# paper size (PAPERSIZE, overridden by command line option -p)
-# paper orientation (ORIENTATION, overridden by option -o)
-# language (LANGUAGE, overridden by option -l)
-# textwidth
-#
-eval `sed -n \\
- -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\\\\mudelapapertextheight{\([^}]*\).*$/THN=\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"
-fi
-if [ -n "$PAPERSIZE" ]
-then
- setPaperZize
- PAPEROPT="$PAPERSIZE"
-fi
-#
-if [ -z "$ORIENTATION" ]
-then
- ORIENTATION="$fORI"
-fi
-if [ -n "$ORIENTATION" ]
-then
- if [ -z "$PAPEROPT" ]
- then
- PAPEROPT="$ORIENTATION"
- else
- PAPEROPT="$PAPEROPT,$ORIENTATION"
- fi
-fi
-#
-if [ -n "$PAPEROPT" ]
-then
- PAPER="[$PAPEROPT]"
-fi
-#
-if [ -z "$LANGUAGE" ]
-then
- LANGUAGE="$fLNG"
-fi
-if [ -n "$LANGUAGE" ]
-then
- LLNG="\usepackage[$LANGUAGE]{babel}"
-else
- LLNG="%"
-fi
-
-#
-# Find textwidth
-#
-if [ -n "$TWN" ]
-then
- TW="$TWN"
- case "$TW" in
- *mm)
- ;;
- *cm)
- ;;
- *pt)
- ;;
- *)
- TW="${TW}pt"
- ;;
- esac
- $debug_echo "Text width = $TW"
-fi
-TWp=`Echo $TW | sed -e 's/\..*$//'`
-PWp="$PWIDTH"
-#
-# Find textheight
-#
-if [ -n "$THN" ]
-then
- TH=$THN
- case $TH in
- *mm)
- ;;
- *cm)
- ;;
- *pt)
- ;;
- *)
- TH="${TH}pt"
- ;;
- esac
- $debug_echo "Text height = $TH"
-fi
-THp="`echo $TH | sed -e 's/\..*$//'`"
-PHp="$PHEIGHT"
-if [ "$ORIENTATION" = "landscape" ]
-then
- PWp="$PHEIGHT"
- PHp="$PWIDTH"
-fi
-HMARG="`expr '(' $PWp - $TWp ')' / 2`"pt
-$debug_echo "Text left = $HMARG"
-VMARG="`expr '(' $PHp - $THp ')' / 2`"pt
-$debug_echo "Text top = $VMARG"
-#
-# Geometry: /var/lib/texmf/latex/geometry/geometry.dvi
-#
-#
-# Write LaTeX file
-#
-cat << EOF > $LatF
-% Creator: $IDENTIFICATION
-% Automatically generated from $IF, $NOW
-
-\documentclass$PAPER{article}
-
-$LLNG
-\usepackage{geometry}
-\usepackage[latin1]{inputenc}
-%\usepackage[T1]{fontenc}
-$PNUM
-%\addtolength{\oddsidemargin}{-1cm}
-%\addtolength{\topmargin}{-1cm}
-%\setlength{\textwidth}{$TW}
-%\setlength{\textheight}{$TH}
-\geometry{width=$TW, left=$HMARG, height=$TH, top=$VMARG}
-\input lilyponddefs
-\input titledefs
-$LLHF
-\begin{document}
-EOF
-mudelaDefs
-cat << EOF >> $LatF
-\cmrtwenty% ugh
-\makelilytitle
-EOF
-}
-nextFile(){
-cat << EOF >> $LatF
-\def\theopus{}%
-\def\thepiece{}%
-\def\mudelaopus{}%
-\def\mudelapiece{}%
-EOF
-mudelaDefs "\\def"
-cat << EOF >> $LatF
-\def\theopus{\mudelaopus}% ugh
-\def\thepiece{\mudelapiece}%
-\makelilypiecetitle
-EOF
-}
-#
-# Conclusion
-#
-endFile(){
-cat << EOF >> $LatF
-\vfill\hfill{\LilyIdString}
-\end{document}
-EOF
-#
-# Run LaTeX
-#
-latex '\nonstopmode \input '$LatF || exit 5
-#
-# Rename dvi file
-#
-if [ -f $FN.dvi ]
-then
- RESULT="$BN.dvi"
- [ -n "$OUTPUTDIR" ] && RESULT="$OUTPUTDIR/$RESULT"
-
- cp "$FN.dvi" "$RESULT" || exit 5
-fi
-#
-# Output some info
-#
-cat << EOF
-
-$IDENTIFICATION: dvi file name is $RESULT
-
-EOF
-}
-
-# ugh. GF is side-effect.
-findInput() {
-# should check for LILYINCLUDE
- OIFS="$IFS"
- IFS=':'
- x=`echo $LILYINCLUDE | sed "s!:! !g"`
- IFS="$OIFS"
- for lypath in . $x
- do
- if [ -f "$lypath/$1" ]
- then
- GF="$lypath/$1"
- return
- fi
-
- if [ -f "$lypath/$1.ly" ]
- then
- GF="$lypath/$1.ly"
- return
- fi
- if [ -f "$lypath/$1.fly" ]
- then
- GF="$lypath/$1.fly"
- return
- fi
- done
- $debug_echo "$IDENTIFICATION: Input file \"$GF\" not found"
- echo "$NAME: Input file \"$GF\" not found" 1>&2
- exit 2
-}
-#
-# Loop through all files
-#
-
-LILY_OUTPUT_FILES=
-
-for GF
-do
- findInput $GF
-
- #
- # Check whether the file is input to or output from lilypond
- #
- L1=`head -1 $GF`
- OP=`echo $L1 | grep "^% Creator: GNU LilyPond"`
- if [ -n "$OP" ]
- then
- #
- # OK - it's the output from lilypond.
- #
- # Get lilypond source file name
- #
- OF=$GF
- IFL=`grep mudelafilename $OF`
- if [ "$IFL" != "" ]
- then
- IF=`echo $IFL | sed -e 's/.*{//' -e 's/}*.$//'`
- #
- # Check if source file exists
- #
- if [ ! -f $IF ]
- then
- $debug_echo $IDENTIFICATION": Mudela file not found."
- TW=15.5cm
- TH=25.0cm
- fi
- else
- $debug_echo $IDENTIFICATION": Mudela file name not found."
- TW=15.5cm
- TH=25.0cm
- fi
- else
- #
- # I have to assume this is the lilypond input file
- # Find output file name, if defined
- #
- IF=$GF
- #
- # Run lilypond
- # Grab output file names
- #
- $debug_echo "lilypond "$LILYOPTS $IF
-
- $LILYPOND_EXECUTABLE $LILYOPTS $IF 2>&1 | tee $LOGFILE
- OF="`sed -n -e 's/TeX output to \([^\.]*\.tex\)\.\.\.$/\1/p' $LOGFILE`"
- $debug_echo "==> $OF"
- LILY_OUTPUT_FILES="$LILY_OUTPUT_FILES $OF"
- STATUS=`egrep -i "error|segmentation|abort" $LOGFILE`
- echo $STATUS
- if [ ! -z "$STATUS" ]
- then
- exit 10
- fi
- fi
- #
- # "Spin through" all the files
- #
- for File in $OF
- do
- $debug_echo "--- "$File
- #
- # Check if output file is generated
- #
- if [ ! -f "$File" ]
- then
- $debug_echo "$IDENTIFICATION: hmm, I could not find the output file $File"
- exit 4
- fi
- #
- # Is this the first file?
- #
- if [ -z "$FFile" ]
- then
- FFile="$File"
- startFile
- else
- nextFile
- fi
- cat << EOF >> $LatF
-\input{$File}
-EOF
- if [ $SEPFILE = Y ]
- then
- FFile=""
- endFile
- fi
- done
-done
-if [ $SEPFILE = N ]
-then
- endFile
-fi
-#
-# OK - finished
-#
+++ /dev/null
-%!PS-Adobe-3.0: lilyponddefs
-
-% hmm
-/setgray { 1 add } bind def
-
-/xoffset 30 def
-/yoffset 700 def
-/staffrulethickness 1 def
-/staffheight 20 def
-
-% round cappings
-1 setlinecap
-
-/placebox
-{
- /object exch def
- gsave
- %exch translate
- translate
- 0 0 moveto
- object
- grestore
-} bind def
-
-/settext % '(' text ')'
-{
- gsave
- % urg
- /Times-Roman findfont 12 scalefont setfont
- show
- grestore
-} bind def
-
-/setfinger % '(' text ')'
-{
- gsave
- % urg
- /feta-nummer5 findfont 12 scalefont setfont
- show
- grestore
-} bind def
-
-/setitalic % '(' text ')'
-{
- gsave
- % urg
- /Times-Italic findfont 12 scalefont setfont
- show
- grestore
-} bind def
-
-/vrule % width height depth
-{
- gsave
- 3 -1 roll setlinewidth
- neg 0 exch moveto
- 0 exch lineto stroke
- grestore
-} bind def
-
-/draw_stem % kern width height depth
-{
- gsave
- 4 -1 roll neg 0 translate
- vrule
- grestore
-} bind def
-
-/widthbar % height width
-{
- gsave
- setlinewidth
- 2 div dup neg 0 exch moveto
- 0 exch lineto stroke
- 2 div
- grestore
-} bind def
-
-/thickbar % height
-{
- stafflinethickness 2 mul widthbar
-} bind def
-
-/thinbar % height
-{
- stafflinethickness 1.6 mul widthbar
-} bind def
-
-/maatstreep % height
-{
- thinbar
-} bind def
-
-/finishbar
-{
- thickbar
-} bind def
-
-/generalmeter % num den
-{
- pop pop
-} bind def
-
-/pianobrace
-{
- gsave
- /feta-braces20 findfont 12 scalefont setfont%
- show
- grestore
-} bind def
-
-/repeatbar
-{
-} bind def
-
-/start_line
-{
- gsave
- xoffset yoffset translate
-} bind def
-
-/stop_line
-{
- /object exch def
- 0 0 moveto pathbbox exch pop sub exch pop
- object
- grestore
- yoffset add /yoffset exch def
- % urg...
- yoffset staffheight 8 mul sub /yoffset exch def
-} bind def
-
-/unknown { (U) show} bind def
-/empty {(E) show} bind def
-
-/turnOnExperimentalFeatures { } bind def
-
-/rulesym % thick length
-{
- gsave
- exch setlinewidth
- 0 lineto stroke
- grestore
-} bind def
-
-/draw_beam % width slope thick
-{
- 2 div /beam_thick exch def
- /beam_slope exch def
- /beam_wd exch def
- beam_slope beam_wd mul /beam_ht exch def
- 0 beam_thick neg moveto
- beam_wd beam_ht rlineto
- 0 beam_thick 2 mul rlineto
- 0 beam_thick lineto
- closepath fill
-} bind def
-%
-/draw_decresc
- {
- staffrulethickness setlinewidth
- /cresc_cont exch def
- /cresc_ht exch def
- /cresc_wd exch def
-%
- cresc_wd cresc_cont moveto
- 0 cresc_ht lineto
- stroke
- cresc_wd cresc_cont neg moveto
- 0 cresc_ht neg lineto
- stroke
- }
- bind def
- /draw_cresc
- {
- staffrulethickness setlinewidth
- /cresc_cont exch def
- /cresc_ht exch def
- /cresc_wd exch def
-%
- 0 cresc_cont moveto
- cresc_wd cresc_ht lineto
- stroke
- 0 cresc_cont neg moveto
- cresc_wd cresc_ht neg lineto
- stroke
- }
- bind def
- /lily_distance {
- 1 copy mul exch 1 copy mul add sqrt
- } bind def
-staffrulethickness 1.2 mul /plet_t exch def
-/draw_plet
-{
- plet_t setlinewidth
- true setstrokeadjust
- 1 setlinecap
- 1 setlinejoin
- /dir exch def
- /plet_dy exch def
- /plet_dx exch def
- staffheight 2 div /plet_gapx exch def
- plet_dy plet_dx div plet_gapx mul /plet_gapy exch def
- staffheight 4 div dir mul /plet_h exch def
-%
- 0 0 moveto
- 0 plet_h lineto
- plet_dx plet_gapx sub 2 div
- plet_dy plet_gapy sub 2 div plet_h add lineto
- plet_dx plet_gapx add 2 div
- plet_dy plet_gapy add 2 div plet_h add moveto
- plet_dx plet_dy plet_h add lineto
- plet_dx plet_dy lineto
- stroke
-} bind def
-%
-/draw_slur
-{
- staffrulethickness setlinewidth
- moveto
- curveto
- lineto
- curveto
- gsave
- fill
- grestore
- stroke
-} bind def
-%
-/draw_dashed_slur
-{
- 1 setlinecap
- 1 setlinejoin
- setdash
- setlinewidth
- moveto
- curveto
- stroke
-} bind def
-%
-staffheight 4 div /interline exch def
-%
-/bracket_traject
-{
- /traject_ds exch def
- /traject_alpha exch def
- traject_ds traject_alpha sin mul add
- exch
- traject_ds traject_alpha cos mul add
- exch
-} bind def
-%
-% too fat for 20pt
-% interline 2 div /bracket_b exch def
-interline 3 div /bracket_b exch def
-interline 2 mul /bracket_w exch def
-staffrulethickness /stafflinethickness exch def
-stafflinethickness 2 mul /bracket_t exch def
-interline 1.5 mul /bracket_v exch def
-bracket_v /bracket_u exch def
-50 /bracket_alpha exch def
-%
-/half_bracket
-{
-%6
- 0 0
-%5a
- bracket_b bracket_v add bracket_h bracket_t sub bracket_u add
- bracket_alpha bracket_v -0.15 mul bracket_traject
-%5b
- 1 bracket_h
- 0 bracket_v 0.5 mul bracket_traject
-%5c
- 0 bracket_h
-%4a
- bracket_b bracket_h bracket_t sub
- 0 bracket_v 0.4 mul bracket_traject
-%4b
- bracket_b bracket_v add bracket_h bracket_t sub bracket_u add
- bracket_alpha bracket_v -0.25 mul bracket_traject
-%4c
- bracket_b bracket_v add bracket_h bracket_t sub bracket_u add
-%3
- bracket_b bracket_h bracket_t sub
-%2
- bracket_b 0
-%1
- 0 0
-} bind def
-%
-/draw_half_bracket {
- moveto
- lineto
- lineto
- curveto
- curveto
- lineto
- gsave
- fill
- grestore
-} bind def
-%
-/draw_bracket
-{
- 2 div bracket_b add /bracket_h exch def
- bracket_t setlinewidth
- true setstrokeadjust
- 1 setlinecap
- 1 setlinejoin
- half_bracket
- 20 copy
- 1 -1 scale
- draw_half_bracket
- stroke
- 1 -1 scale
-% ugh, ugh:
- 0.05 0 translate
- draw_half_bracket
- stroke
-} bind def
-
-stafflinethickness setlinewidth
-
-% see if we're there...
-% 10 setlinewidth 0 0 moveto 400 800 lineto stroke