file contents, rather \include them, so default linewidth is set.
(ly_options): make BOOKPAPER set of options. Move linewidth
settings there.
* Documentation/user/examples.itely: new file. Templates are to be
moved here.
* Documentation/user/programming-interface.itely: move chapter.
* scm/document-markup.scm (doc-markup-function): add @code
* stepmake/stepmake/texinfo-rules.make: remove chmod.
+2004-07-25 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * scripts/lilypond-book.py (Lilypond_file_snippet.ly): don't copy
+ file contents, rather \include them, so default linewidth is set.
+ (ly_options): make BOOKPAPER set of options. Move linewidth
+ settings there.
+
+ * Documentation/user/examples.itely: new file. Templates are to be
+ moved here.
+
+ * Documentation/user/programming-interface.itely: move chapter.
+
+ * scm/document-markup.scm (doc-markup-function): add @code
+
+ * stepmake/stepmake/texinfo-rules.make: remove chmod.
+
2004-07-24 Han-Wen Nienhuys <hanwen@xs4all.nl>
* scm/page-layout.scm (plain-header): add printpagenumber boolean
--- /dev/null
+@node Example templates
+@chapter Example templates
+
+[TODO]
@{/usr/share/lilypond/1.6.0,@{!!/usr/share/texmf@}@}
@end example
-
-@item GS_LIB
-For processing PostScript output (obtained with
-@code{-f ps}) with Ghostscript you have to set @code{GS_LIB} to
-point to the directory containing library PS files.
-
-@item GS_FONTPATH
-For processing PostScript output (obtained with
-@code{-f ps}) with Ghostscript you have to set @code{GS_FONTPATH} to
-point to the directory containing PFA files.
-
-When you print direct PS output, remember to send the PFA files to the
-printer as well.
@end table
-@cindex ghostscript
@cindex PostScript
-@cindex GS_FONTPATH
-@cindex GS_LIB
@cindex TEXMF
@cindex printing postscript
* Preface:: Preface.
* Introduction:: What, Why, How.
* Tutorial:: A tutorial introduction.
+* Example templates:: Larger examples
* Notation manual:: All notation supported, and how to
produce it.
* Changing defaults:: Tuning output.
+* Interfaces for programmers::
* Invoking LilyPond:: Operation.
* Converting from other formats:: Converting to lilypond source format.
* lilypond-book manual:: Integrating text and music with lilypond-book.
* Unified index::
* Notation manual details::
* Literature list::
-* Interfaces for programmers::
* Cheat sheet::
* GNU Free Documentation License:: FDL.
@end menu
@include preface.itely
@include introduction.itely
@include tutorial.itely
+@include examples.itely
+@include invoking.itexi
@include notation.itely
@include changing-defaults.itely
-@include invoking.itexi
+@include programming-interface.itely
@include lilypond-book.itely
@include converters.itely
@include literature.itely
-@include programming-interface.itely
-
@include cheatsheet.itely
@include fdl.itexi
@ifnottex
-@macro texisharp {word}
-#
-@end macro
+ @macro texisharp {word}
+ #
+ @end macro
+ @macro texiflat {word}
+ b
+ @end macro
@end ifnottex
@iftex
-@macro texisharp {word}
-@tex
-\\raise0.5ex\\fetachar\\fetasharp
-@end tex
-@end macro
+ @macro texiflat {word}
+ @tex
+ \\kern0.15em\\fetachar\\fetaflat
+ @end tex
+ @end macro
+ @macro texisharp {word}
+ @tex
+ \\raise0.5ex\\fetachar\\fetasharp
+ @end tex
+ @end macro
@end iftex
-@ifnottex
-@macro texiflat {word}
-b
-@end macro
-@end ifnottex
-
-@iftex
-@macro texiflat {word}
-@tex
-\\kern0.15em\\fetachar\\fetaflat
-@end tex
-@end macro
-@end iftex
@macro arrow{}
@iftex
@c dup?
+
@ifhtml
-@macro internalsref{NAME}
-@uref{../lilypond-internals/\NAME\.html,\NAME\}@c
-@c should we do this?
-@cindex @code{\NAME\}
-@end macro
+ @c ***** HTML *****
+ @macro internalsref{NAME}
+ @uref{../lilypond-internals/\NAME\.html,\NAME\}@c
+ @c should we do this?
+ @cindex @code{\NAME\}
+ @end macro
-@macro inputfileref{DIR,NAME}
-@uref{../../../../\DIR\/out-www/collated-files.html#\NAME\,@file{\DIR\/\NAME\}}@c
-@end macro
+ @macro hyphenatedinternalsref{NAME,NODENAME}
+ @uref{../lilypond-internals/\NODENAME\.html,\NAME\}@c
+ @c should we do this?
+ @cindex @code{\NAME\}
+ @end macro
+
+ @macro inputfileref{DIR,NAME}
+ @uref{../../../../\DIR\/out-www/collated-files.html#\NAME\,@file{\DIR\/\NAME\}}@c
+ @end macro
@end ifhtml
@ifinfo
+
+@c **** INFO ****
@macro internalsref{NAME}
@inforef{\NAME\,,lilypond/lilypond-internals}@c
@cindex \NAME\@c
@end macro
+@macro hyphenatedinternalsref{NAME,NODENAME}
+@inforef{\NODENAME\,,lilypond-internals}@c
+@c should we do this?
+@cindex @code{\NAME\}
+@end macro
+
@macro inputfileref{DIR,NAME}
@file{\DIR\/\NAME\}
@end macro
+
+@macro usermanref{NAME}
+@ref{\NAME\,,,lilypond/lilypond}@c
+@end macro
+
@end ifinfo
@iftex
+@c **** TEX ****
+
@macro internalsref{NAME}@c
-@cindex \NAME\@c
+@cindex @code{\NAME\} @c
@code{\NAME\}@c
@end macro
+
@macro inputfileref{DIR,NAME}@c
@file{\DIR\/\NAME\}@c
@end macro
-@end iftex
+
+@macro hyphenatedinternalsref{NAME,NODENAME}
+@code{\NAME\}@c
+@c should we do this?
+@cindex @code{\NAME\} @c
+@end macro
+
-@iftex
@macro seeinternals{NAME}
internals document, @internalsref{\NAME\}
@end macro
@end iftex
+@c **** not TEX ****
+
@ifnottex
-@macro seeinternals{NAME}
-@internalsref{\NAME\}
-@end macro
+ @macro seeinternals{NAME}
+ @internalsref{\NAME\}
+ @end macro
@end ifnottex
-@ifinfo
-@macro usermanref{NAME}
-@ref{\NAME\,,,lilypond/lilypond}@c
-@end macro
-@end ifinfo
-
@ifnotinfo
-@macro usermanref{NAME}
-@ref{\NAME\}@c
-@end macro
+ @macro usermanref{NAME}
+ @ref{\NAME\}@c
+ @end macro
@end ifnotinfo
@macro refbugs
@end example
-@cindex skipTypesetting
+@cindex @code{skipTypesetting}
Failed bar checks are caused by entering incorrect
durations. Incorrect durations often completely garble up the score,
@code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
is set to a string, a bar line of that type is created.
-@cindex whichBar
+@cindex @code{whichBar}
@cindex @code{repeatCommands}
-@cindex defaultBarType
+@cindex @code{defaultBarType}
You are encouraged to use @code{\repeat} for repetitions. See
@ref{Repeats}.
\set Score.beatLength = #(ly:make-moment 1 8)
c16[ c c c c c c c]
@end lilypond
-@cindex subdivideBeams
+@cindex @code{subdivideBeams}
Kneed beams are inserted automatically, when a large gap is detected
between the note heads. This behavior can be tuned through the object
}
@end lilypond
-@cindex minimumFret
+@cindex @code{minimumFret}
@cindex fret
When no string is specified, the first string that does not give a
following properties
@table @code
-@cindex chordNameExceptions
+@cindex @code{chordNameExceptions}
@item chordNameExceptions
This is a list that contains the chords that have special formatting.
For an example, see
@cindex exceptions, chord names.
-@cindex majorSevenSymbol
+@cindex @code{majorSevenSymbol}
@item majorSevenSymbol
This property contains the markup object used for the 7th step, when
it is major. Predefined options are @code{whiteTriangleMarkup} and
@code{blackTriangleMarkup}. See
@inputfileref{input/regression,chord-name-major7.ly} for an example.
-@cindex chordNameSeparator
+@cindex @code{chordNameSeparator}
@item chordNameSeparator
Different parts of a chord name are normally separated by a
slash. By setting @code{chordNameSeparator}, you can specify other
}
@end lilypond
-@cindex chordRootNamer
+@cindex @code{chordRootNamer}
@item chordRootNamer
The root of a chord is usually printed as a letter with an optional
alteration. The transformation from pitch to letter is done by this
@code{\semiGermanChords} set these variables.
-@cindex chordNoteNamer
+@cindex @code{chordNoteNamer}
@item chordNoteNamer
The default is to print single pitch, e.g. the bass note, using the
@code{chordRootNamer}. The @code{chordNoteNamer} property can be set
@cindex bar numbers
@cindex measure numbers
-@cindex currentBarNumber
+@cindex @code{currentBarNumber}
Bar numbers are printed by default at the start of the line. The
-number itself is stored in the
-@code{currentBarNumber} property,
-which is normally updated automatically for every measure.
+number itself is stored in the @code{currentBarNumber} property, which
+is normally updated automatically for every measure.
Bar numbers can be typeset at regular intervals instead of at the
beginning of each line. This is illustrated in the following example,
@refcommands
-@cindex \setEasyHeads
+@cindex @code{\setEasyHeads}
@code{\setEasyHeads}
@node Sound
@c -*-texinfo-*-
@node Interfaces for programmers
-@appendix Interfaces for programmers
+@chapter Interfaces for programmers
@end menu
@node Programmer interfaces for input
-@appendixsec Programmer interfaces for input
+@section Programmer interfaces for input
@menu
* Input variables and Scheme::
@end menu
@node Input variables and Scheme
-@appendixsubsec Input variables and Scheme
+@subsection Input variables and Scheme
The input format supports the notion of variable: in the following
Mixing Scheme and lily identifiers is not possible with @code{--safe}.
@node Internal music representation
-@appendixsubsec Internal music representation
+@subsection Internal music representation
When a music expression is parsed, it is converted into a set of
Scheme music objects. The defining property of a music object is that
music name: Each music expression has a name, for example, a note
leads to a @internalsref{NoteEvent}, and @code{\simultaneous} leads to
a @internalsref{SimultaneousMusic}. A list of all expressions
-available is in the internals manual, under @internalsref{Music
-expressions}.
+available is in the internals manual, under
+@hyphenatedinternalsref{Music expressions,Music-expressions}.
@item
- `type' or interface: Each music name has several `types' or interface,
- for example, a note is an @code{event},
- but it is also a @code{note-event},
- a @code{rhythmic-event} and
- a @code{melodic-event}.
+ `type' or interface: Each music name has several `types' or
+interfaces, for example, a note is an @code{event}, but it is also a
+@code{note-event}, a @code{rhythmic-event} and a @code{melodic-event}.
All classes of music are listed in the internals manual, under
- @internalsref{Music classes}.
-@item
-C++ object: Each music object is represented by a C++ object. For technical
-reasons, different music objects may be represented by different C++
-object types. For example, a note is @code{Event} object, while
-@code{\grace} creates a @code{Grace_music} object.
+ @hyphenatedinternalsref{Music classes,Music-classes}.
+
+ @item
+C++ object: Each music object is represented by a C++ object. For
+technical reasons, different music objects may be represented by
+different C++ object types. For example, a note is @code{Event}
+object, while @code{\grace} creates a @code{Grace_music} object.
We expect that distinctions between different C++ types will disappear
in the future.
@node Extending music syntax
-@appendixsubsec Extending music syntax
+@subsection Extending music syntax
The syntax of composite music expressions, like
@code{\repeat}, @code{\transpose} and @code{\context}
@file{ly/music-functions-init.ly}.
@node Manipulating music expressions
-@appendixsubsec Manipulating music expressions
+@subsection Manipulating music expressions
Music objects and their properties can be accessed and manipulated
directly, through the @code{\applymusic} mechanism.
@node Using LilyPond syntax inside Scheme
-@appendixsubsec Using LilyPond syntax inside Scheme
+@subsection Using LilyPond syntax inside Scheme
Creating music expressions in scheme can be tedious, as they are
heavily nested and the resulting scheme code is large. For some
@node Markup programmer interface
-@appendixsec Markup programmer interface
+@section Markup programmer interface
@menu
@end menu
@node Markup construction in scheme
-@appendixsubsec Markup construction in scheme
+@subsection Markup construction in scheme
@cindex defining markup commands
@end lisp
@node Markup command definition
-@appendixsubsec Markup command definition
+@subsection Markup command definition
New markup commands can be defined
with the @code{def-markup-command} scheme macro.
@node Contexts for programmers
-@appendixsec Contexts for programmers
+@section Contexts for programmers
@menu
@end menu
@node Context evaluation
-@appendixsubsec Context evaluation
+@subsection Context evaluation
@cindex calling code during interpreting
@cindex @code{\applycontext}
@node Running a function on all layout objects
-@appendixsubsec Running a function on all layout objects
+@subsection Running a function on all layout objects
@cindex calling code on layout objects
|| make_ps
|| make_png
|| make_pdf))
- make_pdf = true;
+ {
+ make_pdf = true;
+ make_ps = true;
+ if (found_tex)
+ {
+ make_dvi = true;
+ make_tex = true;
+ }
+ }
}
static void
LILYPOND = $(builddir)/lily/$(outconfbase)/lilypond
LILYPOND_BOOK = $(script-dir)/lilypond-book.py
LILYPOND_BOOK_INCLUDES = -I $(pwd) -I $(outdir) -I$(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(builddir)/mf/$(outconfbase)/ -I $(builddir)/mf/out/
-LILYPOND_BOOK_FLAGS = --process="lilypond-bin -f tex --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"
+LILYPOND_BOOK_FLAGS = --process="lilypond -f tex --tex --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"
#texi-html for www only:
LILYPOND_BOOK_FORMAT=$(if $(subst out-www,,$(notdir $(outdir))),texi,texi-html)
"\n\n@item @code{\\" c-name "} " signature-str
"\n@findex " f-name "\n"
- "\n@cindex " c-name "\n"
+ "\n@cindex @code{" c-name "}\n"
(if (string? doc-str)
doc-str
(define-public (convert-to-pdf book name)
(let*
((defs (ly:paper-book-book-paper book))
- (size (ly:output-def-lookup book 'papersize)))
+ (size (ly:output-def-lookup defs 'papersize)))
(postscript->pdf (if (string? size) size "a4")
(string-append
(if (number? resolution)
(number->string resolution)
"90")
- " "
+ (if (ly:get-option 'verbose)
+ "--verbose "
+ " ")
name)))
(define-public (lilypond-main files)
import glob
import stat
import string
+
+#
+# TODO:
+#
+# * should have a sane default --process setting
+#
+# * use --png --ps --pdf for making images?
+#
+
################################################################
# Users of python modules should include this snippet
# and customize variables below.
process_cmd = lilypond_binary
default_ly_options = {}
+#
+# is this pythonic? Personally, I find this rather #define-nesque. --hwn
+#
AFTER = 'after'
-FILTER = 'filter'
BEFORE = 'before'
+BOOKPAPER = 'bookpaper'
EXAMPLEINDENT = 'exampleindent'
+FILTER = 'filter'
FRAGMENT = 'fragment'
HTML = 'html'
INDENT = 'indent'
PAPER = 'paper'
PREAMBLE = 'preamble'
PRINTFILENAME = 'printfilename'
+QUOTE = 'quote'
RAGGEDRIGHT = 'raggedright'
RELATIVE = 'relative'
-QUOTE = 'quote'
STAFFSIZE = 'staffsize'
TEXIDOC = 'texidoc'
TEXINFO = 'texinfo'
ly_options = {
NOTES: {
- RELATIVE: r'''\relative c%(relative_quotes)s''',
+ RELATIVE: r'''\relative c%(relative_quotes)s''',
},
- PAPER: {
- EXAMPLEINDENT : '',
- INDENT : r'''
+ BOOKPAPER: {
+ INDENT : r'''
indent = %(indent)s''',
'linewidth' : r'''
linewidth = %(linewidth)s''',
- NOINDENT : r'''
- indent = 0.0\mm''',
- NOTIME : r'''
- \context {
- \Staff
- \remove Time_signature_engraver
- }''',
- QUOTE : r'''
+ NOINDENT : r'''
+ indent = 0.0\mm''',
+ QUOTE : r'''
linewidth = %(linewidth)s - 2.0 * %(exampleindent)s
''',
- RAGGEDRIGHT : r'''
+ RAGGEDRIGHT : r'''
indent = 0.0\mm
raggedright = ##t''',
},
+
+ ##
+ PAPER: {
+ EXAMPLEINDENT : '',
+
+ NOTIME : r'''
+ \context {
+ \Staff
+ \remove Time_signature_engraver
+ }''',
+ },
+
+ ##
PREAMBLE: {
- STAFFSIZE: r'''
+ STAFFSIZE: r'''
#(set-global-staff-size %(staffsize)s)''',
- },
+ },
}
output = {
p (ly:music-scorify m))
))
%(preamble_string)s
-\paper {%(paper_string)s
+\bookpaper {%(bookpaper_string)s
+}
+\paper { %(paper_string)s
}
+
'''
FRAGMENT_LY = r'''
override[EXAMPLEINDENT] = r'9.0 \mm'
option_string = string.join (options, ',')
- notes_options = []
- paper_options = []
- preamble_options = []
+
+ options_dict = {}
+ option_types = [NOTES, PREAMBLE, PAPER, BOOKPAPER]
+ for a in option_types:
+ options_dict[a] = []
+
for i in options:
c = classic_lilypond_book_compatibility (i)
if c:
override[key] = value
else:
key = i
- if i not in override.keys ():
+ if not override.has_key (i):
override[i] = None
- if key in ly_options[NOTES].keys ():
- notes_options.append (ly_options[NOTES][key])
- elif key in ly_options[PREAMBLE].keys ():
- preamble_options.append (ly_options[PREAMBLE][key])
- elif key in ly_options[PAPER].keys ():
- paper_options.append (ly_options[PAPER][key])
- elif key not in (FRAGMENT, NOFRAGMENT, PRINTFILENAME,
- RELATIVE, VERBATIM, TEXIDOC):
+ found = 0
+ for type in option_types:
+ if ly_options[type].has_key (key):
+
+ options_dict[type].append (ly_options[type][key])
+ found = 1
+ break
+
+ if not found and key not in (FRAGMENT, NOFRAGMENT, PRINTFILENAME,
+ RELATIVE, VERBATIM, TEXIDOC):
ly.warning (_("ignoring unknown ly option: %s") % i)
#URGS
relative_quotes += "'" * relative
program_name = __main__.program_name
- paper_string = string.join (paper_options, '\n ') % override
- preamble_string = string.join (preamble_options, '\n ') % override
- notes_string = string.join (notes_options, '\n ') % vars ()
+
+ paper_string = string.join (options_dict[PAPER], '\n ') % override
+ bookpaper_string = string.join (options_dict[BOOKPAPER], '\n ') % override
+ notes_string = string.join (options_dict[NOTES], '\n ') % vars ()
+ preamble_string = string.join (options_dict[PREAMBLE], '\n ') % override
return (PREAMBLE_LY + body) % vars ()
+
# BARF
# use lilypond for latex (.lytex) books,
# and lilypond --preview for html, texinfo books?
if s:
return compose_ly (s, self.options)
return ''
-
+
+ # todo: use md5?
def get_hash (self):
if not self.hash:
self.hash = abs (hash (self.full_ly ()))
class Lilypond_file_snippet (Lilypond_snippet):
def ly (self):
name = self.substring ('filename')
- return '\\renameinput \"%s\"\n' % name\
- + open (find_file (name)).read ()
+ contents = open (find_file (name)).read ()
+ checksum = abs (hash (contents))
+ width = default_ly_options[LINEWIDTH]
+ return r'''
+%% hash of included file: %(checksum)d
+
+\include "%(name)s"
+''' % locals()
+
snippet_type_to_class = {
global default_ly_options
textwidth = 0
- if LINEWIDTH not in default_ly_options.keys ():
+ if not default_ly_options.has_key (LINEWIDTH):
if format == LATEX:
textwidth = get_latex_textwidth (source)
default_ly_options[LINEWIDTH] = '''%.0f\\pt''' \
$(outdir)/%.texi: %.texi
rm -f $@
cp $< $@
- chmod -w $@