lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

next patch for lilypond-book


From: Werner LEMBERG
Subject: next patch for lilypond-book
Date: Thu, 26 Sep 2002 06:27:55 +0200 (CEST)

Another round to clean up the TeX frontend...

  tex <lilypond-output>

still works with this patch but you might get overfull boxes since
there is no longer an explicit \parindent 0pt; instead,

  latex <lilypond-output>

should be used.

I've added another option for lilypond-book, `noquote' which prevents
the lilypond code being put into a quotation block.


    Werner


PS: Please avoid leading spaces in texinfo documents; makeinfo doesn't
    remove them, causing ugly formatted info files.  The same is true
    for more than a single space between words.

    Another bad habit is to do this: address@hidden''.  This causes
    three ` and ' in the info file.  A better solution is to use
    @samp{...} instead.

    I've removed some @separate calls.  At least for the dvi and info
    output, it is a no-op.  What are they good for?  I want to get rid
    of them.

======================================================================

2002-09-23  Werner Lemberg  <address@hidden>

        * scripts/lilypond-book.py (output_dict): Fix handling of
        various environments by avoid extraneous newlines.
        Rename `output-all' regexp for html to `output-html'.
        Replace `output-all' regexp for texi with `output-texi-quote'
        and `output-texi-noquote'.
        (compose_full_body): Don't override `linewidth' user option
        for `singleline'.
        (schedule_lilypond_block): Don't indent text specified with
        `intertext' option.
        Add new option `noquote'.
        (compile_all_files): Use latex instead of tex to compile ly
        files directly.

        * Documentation/user/lilypond-book.itely: Updated and revised.
        Improve layout.

        * Documentation/user/glossary.tely,
        Documentation/user/introduction.itely,
        Documentation/user/tutorial.itely,
        Documentation/user/refman.itely,
        Documentation/user/appendices.itely: Fix overfull LilyPond
        boxes caused by the new lilypond-book code.  Other minor
        fixes.

        * Documentation/user/macros.itexi (@texiflat): Don't emit
        trailing space.

        * scm/tex.scm (end-output, header-end): Add preamble and
        postamble to make lilypond output directly compilable with
        latex.


======================================================================


--- ./Documentation/user/glossary.tely.old      Mon Sep 23 11:50:58 2002
+++ ./Documentation/user/glossary.tely  Wed Sep 25 08:05:12 2002
@@ -813,7 +813,7 @@
 music of the baroque era, has been one of the most popular polyphonic
 composition methods.
 
address@hidden
address@hidden,noquote]
 \property Score.TimeSignature \override #'style = #'()
 \notes\context PianoStaff <
   \context Staff = SA \relative c' {
@@ -1128,7 +1128,7 @@
   }
 @end lilypond
 
address@hidden,notime]
address@hidden,notime,linewidth=110mm]
 \property Score.barNonAuto = ##t
 \property Score.LyricText \set #'font-style = #'large
 \property Score.TextScript \set #'font-style = #'large
--- ./Documentation/user/introduction.itely.old Mon Aug 19 04:27:17 2002
+++ ./Documentation/user/introduction.itely     Tue Sep 24 23:58:41 2002
@@ -3,16 +3,15 @@
 @node Introduction
 @chapter Introduction
 
-
-LilyPond is a program to print sheet music. If you have used notation
+LilyPond is a program to print sheet music.  If you have used notation
 programs before, then the way to use this program might be surprising
-at first sight. To print music with lilypond, you have to enter
-musical codes in a file. Then you run LilyPond on the file, and the
-music is produced without any further intervention. For example,
+at first sight.  To print music with lilypond, you have to enter
+musical codes in a file.  Then you run LilyPond on the file, and the
+music is produced without any further intervention.  For example,
 something like this:
 
 @lilypond[fragment,verbatim, relative 1, intertext="produces this"]
-\key c \minor r8 c16 b c8 g as c16 b c8 d | g,4 
+\key c \minor r8 c16 b c8 g as c16 b c8 d | g,4
 @end lilypond
 
 @cindex encoding music
@@ -30,10 +29,10 @@
 design, and how this approach affects you as a user.
 
 @menu
-* Batch processing::            
-* Music engraving::             
-* Music representation::        
-* About this manual::           
+* Batch processing::
+* Music engraving::
+* Music representation::
+* About this manual::
 @end menu
 
 @node Batch processing
@@ -41,7 +40,7 @@
 
 @cindex GUI
 @cindex Batch
address@hidden UNIX 
address@hidden UNIX
 
 When we started developing LilyPond, we were still studying at the
 university.  We were interested in music notation, not as publishers
@@ -111,22 +110,22 @@
 admired at first.
 
 
address@hidden
address@hidden
 #(define magfact 3.0)
 \score {  \notes { as'2 r4 }
-         \paper {
-             linewidth = -1. 
-             \translator {
-                 \ScoreContext
-                 AccidentalPlacement \override #'right-padding = #3.0
-                 StaffSymbol \override #'transparent =   ##t
-                 Clef \override #'transparent = ##t
-                 TimeSignature \override #'transparent = ##t             
-                 Accidental \override #'font-magnification = #magfact
-                 Rest \override #'font-magnification = #magfact
-                 NoteHead \override #'font-magnification = #magfact
-                 Stem \override #'transparent = ##t
-                 } } }
+          \paper {
+              linewidth = -1.
+              \translator {
+                  \ScoreContext
+                  AccidentalPlacement \override #'right-padding = #3.0
+                  StaffSymbol \override #'transparent =   ##t
+                  Clef \override #'transparent = ##t
+                  TimeSignature \override #'transparent = ##t
+                  Accidental \override #'font-magnification = #magfact
+                  Rest \override #'font-magnification = #magfact
+                  NoteHead \override #'font-magnification = #magfact
+                  Stem \override #'transparent = ##t
+                  } } }
 @end lilypond
 
 @cindex musical symbols
@@ -157,7 +156,7 @@
 @c I can only see the motive printed two times!!! /Mats
 
 @cindex optical spacing
address@hidden
address@hidden
     \score { \notes {
       \property Staff.NoteSpacing \set #'stem-spacing-correction
         = #0.6
@@ -168,7 +167,7 @@
       \property Staff.StaffSpacing \override #'stem-spacing-correction
       = #0.0
       c'4 e''4 e'4 b'4 |
-      \stemDown b'4 e''4 a'4 e''4|      
+      \stemDown b'4 e''4 a'4 e''4|
     }
     \paper { linewidth = -1. } }
 @end lilypond
@@ -298,7 +297,7 @@
 @cindex variables
 @cindex properties
 @cindex lilypond-internals
address@hidden internal documentation 
address@hidden internal documentation
 
 For those who really want to get their hands dirty: it is even
 possible to add your own functionality, by extending LilyPond in the
--- ./Documentation/user/lilypond-book.itely.old        Mon Sep 23 11:50:58 2002
+++ ./Documentation/user/lilypond-book.itely    Thu Sep 26 06:26:30 2002
@@ -21,20 +21,20 @@
 @code{html} source.
 
 @command{lilypond-book} provides you with a way to automate this
-process: this program extracts snippets of music from your document,
-runs lilypond on them, and substitutes the resulting pictures back.
-The line width and font size definitions for the music are adjusted so
-they match the layout of your document.
+process: This program extracts snippets of music from your document,
+runs LilyPond on them, and substitutes the resulting pictures back.
+The line width and font size definitions for the music are adjusted
+to match the layout of your document.
 
 It can work on address@hidden, @code{html} or texinfo documents.  A tutorial
 on using lilypond-book is in @ref{Integrating text and music}.
 
 @menu
-* Integrating Texinfo and music::  
-* Integrating address@hidden and music::  
-* Integrating HTML and music::  
-* Music fragment options::      
-* Invoking lilypond-book::      
+* Integrating Texinfo and music::
+* Integrating address@hidden and music::
+* Integrating HTML and music::
+* Music fragment options::
+* Invoking lilypond-book::
 @end menu
 
 
@@ -50,62 +50,76 @@
 @section Integrating Texinfo and music
 
 You specify the LilyPond code like this:
+
 @example
 @@lilypond[options, go, here]
   YOUR LILYPOND CODE
 @@end lilypond
-@@lilypond[option, go, address@hidden YOUR LILYPOND CODE @}
-@@lilypondfile[options, go,address@hidden@address@hidden
+@@lilypond[options, go, address@hidden YOUR LILYPOND CODE @}
+@@lilypondfile[options, go, address@hidden@address@hidden
 @end example
 
-We show two simple examples here. First a complete block:
+We show two simple examples here.  First a complete block:
+
 @example
 @@lilypond[26pt]
-c' d' e' f' g'2 g'
+  c' d' e' f' g'2 g'
 @@end lilypond
 @end example
 
address@hidden
 produces this music:
+
 @lilypond
-c' d' e' f' g'2 g'
+  c' d' e' f' g'2 g'
 @end lilypond
 
 Then the short version:
+
 @example
 @@address@hidden<c' e' g'>@}
 @end example
 
address@hidden
 and its music:
 
 @lilypond[11pt]{<c' e' g'>}
 
address@hidden knows the default margins, and a few paper
-sizes. One of these commands should be in the beginning of the document:
address@hidden knows the default margins and a few paper
+sizes.  One of these commands should be in the beginning of the document:
+
 @itemize @bullet
 @item @code{@@afourpaper}
 @item @code{@@afourlatex}
 @item @code{@@afourwide}
 @item @code{@@smallbook}
 @end itemize
+
address@hidden
 @code{@@pagesizes} are not yet supported.
 
 When producing texinfo, lilypond-book also generates bitmaps of the
 music, so you can make a HTML document with embedded music.
 
+
 @node Integrating address@hidden and music
 @section Integrating address@hidden and music
 
-You specify the LilyPond code like this:
+You specify LilyPond code like this:
+
 @example
-\begin[option, go, address@hidden@}
- YOUR LILYPOND CODE
+\begin[options, go, address@hidden@}
+  YOUR LILYPOND CODE
 address@hidden@}
 @end example
 
 @example
 \lilypondfile[options, go,address@hidden@address@hidden
 @end example
-or 
+
address@hidden
+or
+
 @example
 address@hidden YOUR LILYPOND CODE @}
 @end example
@@ -114,40 +128,42 @@
 
 @example
 address@hidden@}
-c' d' e' f' g'2 g'2
+  c' d' e' f' g'2 g'2
 address@hidden@}
 @end example
 
address@hidden
 produces this music:
 
 @lilypond[26pt]
-c' d' e' f' g'2 g'2
+  c' d' e' f' g'2 g'2
 @end lilypond
 
 Then the short version:
+
 @example
 address@hidden<c' e' g'>@}
 @end example
 
address@hidden
 and its music:
 
 @lilypond[11pt]{<c' e' g'>}
 
-
 You can use whatever commands you like in the document preamble,
-that is the part of the document before @address@hidden@}}.
+the part of the document before @address@hidden@}}.
 @command{lilypond-book} will send it to address@hidden to find out how wide
 the text is and adjust the linewidth variable in the paper definition of
-you music according to that.
+your music according to that.
 
 After @address@hidden@}} you must be a little more careful
 when you use commands that change the width of the text and how
-many columns there are. @command{lilypond-book} know about the
+many columns there are.  @command{lilypond-book} knows about the
 @code{\onecolumn} and @code{\twocolumn} commands and the @code{multicols}
 environment from the multicol package.
 
 The music will be surrounded by @code{\preLilypondExample} and
address@hidden The variables are 
address@hidden  The variables are
 defined to nothing by default, and the user can redefine them
 to whatever he wants.
 
@@ -155,229 +171,261 @@
 @node Integrating HTML and music
 @section Integrating HTML and music
 
-You specify the LilyPond code like this:
+You specify LilyPond code like this:
 
address@hidden
 @example
 <lilypond relative1 verbatim>
   \key c \minor r8 c16 b c8 g as c16 b c8 d | g,4
-</lilypond> 
+</lilypond>
 @end example
address@hidden quotation
 
address@hidden
 produces
 
address@hidden
 @example
 <lilypond relative1 verbatim>
   \key c \minor r8 c16 b c8 g as c16 b c8 d | g,4
-</lilypond> 
+</lilypond>
 @end example
+
 @lilypond[relative1]
   \key c \minor r8 c16 b c8 g as c16 b c8 d | g,4
 @end lilypond
address@hidden quotation
 
 Inline picture:
 
address@hidden
 @example
 Some music in <lilypond a b c/> a line of text.
 @end example
address@hidden quotation
+
 
 @node Music fragment options
 @section Music fragment options
 
-The commands for lilypond-book have room to specify options. These are
+The commands for lilypond-book have room to specify options.  These are
 all of the options:
 
 @table @code
 @item eps
 This will create the music as eps graphics and include it into the
-document with the @code{\includegraphics} command. It works in
+document with the @code{\includegraphics} command.  It works in
 address@hidden only.
 
 This enables you to place music examples in the running text (and not in
-a separate paragraph). To avoid that address@hidden places the music on a line
+a separate paragraph).  To avoid that address@hidden places the music on a line
 of its own, there should be no empty lines between the normal text and
 the LilyPond environment. For inline music, you probably also need a
-smaller music font size (eg. 11 pt or 13 pt) 
-
+smaller music font size (e.g.@: address@hidden or address@hidden)
 
 @item verbatim
-    CONTENTS is copied into the source enclosed in a verbatim block,
-    followed by any text given with the @code{intertext} option, then
-    the actual music is displayed. This option does not work with
-    the short version of the LilyPond blocks:
+CONTENTS is copied into the source enclosed in a verbatim block,
+followed by any text given with the @code{intertext} option, then
+the actual music is displayed.  This option does not work with
+the short version of the LilyPond blocks:
 
-    @code{ @@address@hidden CONTENTS @} } and @code{ address@hidden CONTENTS 
@} }
address@hidden @@address@hidden CONTENTS @} } and @code{ address@hidden 
CONTENTS @} }
 
 @item smallverbatim
-      like @code{verbatim}, but in a smaller font.
+Like @code{verbatim}, but in a smaller font.
 
 @item intertext="@var{text}"
-    Used in conjunction with @code{verbatim} option: this puts
address@hidden between the code and the music.
+Used in conjunction with @code{verbatim} option: This puts
address@hidden between the code and the music (without indentation).
+
 @item filename="@var{filename}"
-    Save the LilyPond code to @var{filename}. By default, a hash value
+Save the LilyPond code to @var{filename}.  By default, a hash value
 of the code is used.
 
address@hidden @code{11pt}
address@hidden 11pt
 @lilypond[11pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
+\relative c' {
+  r16 [c d e][f d e c] [g'8 c][b-\prall c] |
+  [d16 g, a b][c a b g][d'8 g f-\prall g]
+}
 @end lilypond
address@hidden @code{13pt}
+
address@hidden 13pt
 @lilypond[13pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
+\relative c' {
+  r16 [c d e][f d e c] [g'8 c][b-\prall c] |
+  [d16 g, a b][c a b g][d'8 g f-\prall g]
+}
 @end lilypond
address@hidden @code{16pt}
+
address@hidden 16pt
 @lilypond[16pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
+\relative c' {
+  r16 [c d e][f d e c] [g'8 c][b-\prall c] |
+}
 @end lilypond
address@hidden @code{20pt}
+
address@hidden 20pt
 @lilypond[20pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-    [d16 g, a b][c a b g][d'8 g f-\prall g]
-  }
+\relative c' {
+  r16 [c d e][f d e c] [g'8 c][b-\prall c] |
+}
 @end lilypond
address@hidden @code{26pt}
+
address@hidden 26pt
 @lilypond[26pt, eps]
-  \relative c'{
-    r16 [c d e][f d e c] [g'8 c][b-\prall c] |
-  }
+\relative c' {
+  r16 [c d e][f d e c] [g'8 c][b-\prall c] |
+}
 @end lilypond
 
 @item singleline
-  Produce a single naturally spaced, unjustified line. (i.e.: linewidth = -1).
+Produce a single, naturally spaced, unjustified line
+(i.e., linewidth = @minus{}1).
+
 @item multiline
-  The opposite of @code{singleline}: justify and break lines.
+The opposite of @code{singleline}: Justify and break lines.
+
 @item address@hidden@var{unit}
-    Set linewidth to @var{size}, where @var{unit} = cm, mm, in or pt.
+Set linewidth to @var{size}, where @var{unit} = cm, mm, in, or pt.
+This option affects LilyPond output, not the text layout.
+
 @item notime
-    Don't print time signature.
+Don't print time signature.
+
 @item fragment
address@hidden nofragment
-    Override @command{lilypond-book} auto detection of what type of code is in 
the
-    LilyPond block, voice contents or complete code.
address@hidden nofragment
+Override @command{lilypond-book} auto detection of what type of code is
+in the LilyPond block, voice contents or complete code.
+
 @item address@hidden@var{unit}
-    Set first line indent to @var{size}, where @var{unit} = cm, mm, in or pt.
+Set indentation of the first music system to @var{size},
+where @var{unit} = cm, mm, in, or pt.  This option affects LilyPond,
+not the text layout.  For single-line fragments the default is to
+use no indentation.
+
 @item noindent
-    Set first line indent to zero.
+Set indentation of the first music system to zero.  This option
+affects LilyPond, not the text layout.
+
address@hidden noquote
+By default, @command{lilypond-book} puts both address@hidden and texinfo output
+into a quotation block.  Using this option prevents this; no indentation
+will be used.
+
 @item printfilename
-    Prints the file name before the music example. Useful in conjunction
+Prints the file name before the music example.  Useful in conjunction
 with @code{\lilypondfile}.
+
 @item relative, relative @var{N}
-    Use relative octave mode. By default, notes are specified relative 
-    central C. The optional integer argument specifies how many octaves 
-    higher (positive number) or lower (negative number) to place the 
-    starting note.
+Use relative octave mode.  By default, notes are specified relative
+central C.  The optional integer argument specifies how many octaves
+higher (positive number) or lower (negative number) to place the
+starting note.
 @end table
 
+
 @node Invoking lilypond-book
 @section Invoking lilypond-book
 
 When you run @command{lilypond-book} it will generate lots of small
-files that LilyPond will process. So to avoid all the garbage in
+files that LilyPond will process.  To avoid all the garbage in
 your source directory, you should either change to a temporary
-directory, or use the @code{--outdir} command line options:
+directory, or use the @option{--outdir} command line options:
 
 @code{cd out && lilypond-book ../yourfile.tex}
 
 @code{lilypond-book --outdir=out yourfile.tex}
 
-
-For latex input, the file to give to latex has extension @file{.latex}.
+For address@hidden input, the file to give to address@hidden has extension 
@file{.latex}.
 Texinfo input will be written to a file with extension @file{.texi}.
 
-If you use @code{--outdir}, you should also @code{cd} to that directory
-before running LaTeX or makeinfo. This may seem a little kludgey, but
-both Latex and makeinfo expect picture files (the music) to be in the
-current working directory. Moreover, if you do this, LaTeX will not
-clutter you normal working directory  with output files.
+If you use @option{--outdir}, you should also @code{cd} to that directory
+before running address@hidden or @command{makeinfo}.  This may seem a little
+kludgy, but both address@hidden and @command{makeinfo} expect picture files
+(the music) to be in the current working directory.  Moreover, if you do
+this, address@hidden will not clutter your normal working directory with output
+files.
 
 @cindex titling and lilypond-book
 @cindex lilypond-book and titling
address@hidden \header in LaTeX documents
address@hidden @code{\header} in address@hidden documents
 
 If you want to add titling from the @code{\header} section of the
-files, you should add  the following to the top of your LaTeX
+files, you should add the following to the top of your address@hidden file:
+
 @example
 \input titledefs.tex
 address@hidden@address@hidden@}
 @end example
 
-lilypond-book accepts the following command-line options: 
address@hidden accepts the following command line options:
+
 @table @code
address@hidden @option{-f}, @option{--format=}
-    Specify the document type to process: @code{html}, @code{latex} or
address@hidden (default).  @command{lilypond-book} usually figures this
address@hidden @option{-f @var{format}}, @address@hidden
+Specify the document type to process: @code{html}, @code{latex} or
address@hidden (the default).  @command{lilypond-book} usually figures this
 out automatically.
 
address@hidden address@hidden
-    Set the fontsize to use for LilyPond if no fontsize is given
-    as option.
address@hidden address@hidden
-    Force all LilyPond to use this fontsize, overriding options
-    given to @address@hidden@}}
address@hidden -I @var{DIR}, address@hidden
-    Add @var{DIR} to the include path.
address@hidden -M, --dependencies
-        Write dependencies to @file{filename.dep}
address@hidden address@hidden
-        prepend @code{PREF} before each @code{-M} dependency
address@hidden -n, --no-lily
-        don't run LilyPond, but do generate the @code{.ly} files
address@hidden --no-music
-        strip all  LilyPond blocks from the file.
address@hidden --no-pictures
-        don't generate pictures when processing Texinfo.
address@hidden --read-lys
-        don't write ly files. This way you can do
address@hidden
- lilypond-book file.tely
- convert-ly
- lilypond-book --read-lys
address@hidden example
-
address@hidden address@hidden
-    The name of address@hidden file to output. If this option  is not given,
-    the output name is derived from the input name.
address@hidden address@hidden
-         place generated files in @var{DIR}.
address@hidden --version
-        print version information
address@hidden --help
-        Print a short help message
address@hidden @address@hidden
+Set the fontsize to use for LilyPond if no fontsize is given
+as option.
+
address@hidden @address@hidden
+Force all LilyPond code to use this fontsize, overriding options
+given to @address@hidden@}}.
+
address@hidden @option{-I @var{dir}}, @address@hidden
+Add @var{DIR} to the include path.
+
address@hidden @option{-M}, @option{--dependencies}
+Write dependencies to @file{filename.dep}.
+
address@hidden @address@hidden
+Prepend @var{pref} before each @option{-M} dependency.
+
address@hidden @option{-n}, @option{--no-lily}
+Don't run LilyPond, but do generate the @code{.ly} files.
+
address@hidden @option{--no-music}
+Strip all  LilyPond blocks from the file.
+
address@hidden @option{--no-pictures}
+Don't generate pictures when processing Texinfo.
+
address@hidden @option{--read-lys}
+Don't write ly files.  This way you can do
+
address@hidden
+lilypond-book file.tely
+convert-ly
+lilypond-book --read-lys
address@hidden example
+
address@hidden @address@hidden
+The name of address@hidden file to output.  If this option is not given,
+the output name is derived from the input name.
+
address@hidden @address@hidden
+Place generated files in @var{dir}.
+
address@hidden @option{--version}
+Print version information.
+
address@hidden @option{--help}
+Print a short help message.
 @end table
 
 
 @section Bugs
-  
-The address@hidden address@hidden@} command is ignored.
+
+The address@hidden @address@hidden@}} command is ignored.
 
 The Texinfo command @code{pagesize} is on the TODO list for LilyPond
-1.6, but changing the linewidth in other ways will not give you a
+1.8, but changing the linewidth in other ways will not give you a
 straight right margin.
 
 Almost all address@hidden commands that change margins and line widths are
 ignored.
 
-There is no way to automatically apply convert-ly only to fragments
+There is no way to automatically apply @command{convert-ly} only to fragments
 inside a lilypond-book file.
 
address@hidden processes all music fragments in one big run. The
address@hidden processes all music fragments in one big run.  The
 state of the GUILE interpreter is not reset between fragments; this
-means that global GUILE definitions, eg. done with @code{#(define
-.. )} and @code{#(set! .. )} can leak from one fragment into a next
-fragment.
+means that global GUILE definitions, e.g., done with @code{#(define @dots{})}
+and @code{#(set! @dots{})} can leak from one fragment into the next fragment.
--- ./Documentation/user/tutorial.itely.old     Sun Sep 22 19:25:46 2002
+++ ./Documentation/user/tutorial.itely Thu Sep 26 00:51:37 2002
@@ -24,7 +24,7 @@
 * End of tutorial::             The end
 @end menu
 
-Operating lilypond is done through text files: to print a piece of
+Operating lilypond is done through text files: To print a piece of
 music, you enter the music in a file.  When you run lilypond (normally
 using the program @code{ly2dvi}) on that file, the program produces
 another file which contains sheet music that you can print or view.
@@ -32,112 +32,82 @@
 This tutorial starts with a small introduction to the LilyPond music
 language.  After this first contact, we will show you how to run
 LilyPond to produce printed output; you should then be able to create
-your first sheets of music. The tutorial continues with more and more
+your first sheets of music.  The tutorial continues with more and more
 complex examples.
 
+
 @node First steps
 @section First steps
 
 We start off by showing how very simple music is entered in
-LilyPond:  you get a note simply by typing its note name, from
address@hidden through @code{g}. So if you enter
address@hidden
+LilyPond: You get a note simply by typing its note name, from
address@hidden through @samp{g}.  So if you enter
+
 @example
 c d e f g a b
 @end example
address@hidden quotation
+
address@hidden
 then the result looks like this:
address@hidden
address@hidden
+
address@hidden
 \property Score.timing = ##f
-\property Staff.TimeSignature = \turnOff
 \transpose c'' { c d e f g a b }
 @end lilypond
address@hidden quotation
address@hidden
 
-We will continue with this format: first we show a snippet of input,
+We will continue with this format: First we show a snippet of input,
 then the resulting output.
 
-The length of a note is specified by adding a number, address@hidden'' for a
-whole note, address@hidden'' for a half note, and so on:
+The length of a note is specified by adding a number, @samp{1} for a
+whole note, @samp{2} for a half note, and so on:
 
address@hidden
 @example
 a1 a2 a4 a16 a32
 @end example
 
address@hidden missing clef seems to raise more questions than actual pitch of 
notes,
address@hidden as these are snippets anyway
address@hidden
address@hidden
 \property Score.timing = ##f
-\property Staff.TimeSignature = \turnOff
 \property Staff.autoBeaming = ##f
-%\property Staff.Clef = \turnOff
-\transpose c'' { a1 a2 a4 a16 a32 }
-s16_" "
+\transpose c'' { a1 a2 a4 a16 a32 s16_" " }
 @end lilypond
address@hidden quotation
address@hidden
 
 If you don't specify a duration, the previous one is used: 
address@hidden
+
 @example
 a4 a a2 a
 @end example
 
address@hidden missing clef seems to raise more questions than actual pitch of 
notes,
address@hidden as these are snippets anyway
address@hidden
address@hidden
 \property Score.timing = ##f
-\property Staff.TimeSignature = \turnOff
-%\property Staff.Clef = \turnOff
-\transpose c'' { a a a2 a }
-s16_" "
+\transpose c'' { a a a2 a s16_" " }
 @end lilypond
address@hidden quotation
address@hidden
 
-A sharp (@texisharp{}) is made by adding address@hidden'', a flat
-(@texiflat{}) by adding address@hidden''.  As you would expect, a
-double-sharp or double-flat is made by adding address@hidden'' or
address@hidden'':
+A sharp (@texisharp{}) is made by adding @samp{is}, a flat
+(@texiflat{}) by adding @samp{es}.  As you would expect, a
+double-sharp or double-flat is made by adding @samp{isis} or
address@hidden:
 
address@hidden
 @example
 cis1 ees fisis aeses
 @end example
 
address@hidden
address@hidden
 \property Score.timing = ##f
-\property Staff.TimeSignature = \turnOff
-\transpose c'' { cis1 ees fisis aeses }
-s16_" "
+\transpose c'' { cis1 ees fisis aeses s16_" " }
 @end lilypond
address@hidden quotation
address@hidden
 
-Add a dot address@hidden'' after the duration to get a dotted note:
address@hidden
+Add a dot @samp{.} after the duration to get a dotted note:
 @example
 a2. a4 a8. a16
 @end example
 
address@hidden missing clef seems to raise more questions than actual pitch of 
notes,
address@hidden as these are snippets anyway
address@hidden
address@hidden
 \property Score.timing = ##f
-\property Staff.TimeSignature \set #'transparent = ##t
-%\property Staff.Clef = \turnOff
-\transpose c'' { a2. a4 a8. a16 }
-s16_" "
+\transpose c'' { a2. a4 a8. a16 s16_" " }
 @end lilypond
address@hidden quotation
address@hidden
 
 The meter (or time signature) can be set with the @code{\time} command:
 
address@hidden
 @example
 \time 3/4
 \time 6/8
@@ -145,7 +115,7 @@
 @end example
 
 @c a clef here may lead to confusion
address@hidden
address@hidden
 \property Staff.Clef \set #'transparent = ##t 
 \time 3/4
 s4_" "
@@ -154,15 +124,12 @@
 \time 4/4
 s16_" "
 @end lilypond
address@hidden quotation
address@hidden
 
-The clef can be set using the address@hidden'' command:
+The clef can be set using the @code{\clef} command:
 
 @c what is more common name treble or violin?
 @c in Dutch, its violin.
 @c in English its definitely treble.
address@hidden
 @example
 \clef treble
 \clef bass
@@ -170,9 +137,8 @@
 \clef tenor
 @end example
 
address@hidden
address@hidden
 \property Score.timing = ##f
-\property Staff.TimeSignature = \turnOff
 \clef violin
 s4_" "
 \clef bass
@@ -182,51 +148,42 @@
 \clef tenor
 s16_" "
 @end lilypond
address@hidden quotation
address@hidden
 
address@hidden From these commands and notes, a piece of music can be formed.  
A piece
address@hidden of music is made by enclosing it in address@hidden @{ ... @}}''.
address@hidden     rephrased:
 When you enter these commands in a file, you must to enclose them in
address@hidden @{ .. @}}''.  This lets LilyPond know that music (and
address@hidden @address@hidden@}}.  This lets LilyPond know that music (and
 not lyrics, for example) follows:
 
address@hidden
 @example
 \notes @{
-   \time 3/4
-   \clef bass
-   c2 e4 g2.
-   f4 e d c2.
+  \time 3/4
+  \clef bass
+  c2 e4 g2.
+  f4 e d c2.
 @}
 @end example
address@hidden quotation
address@hidden
 
 Now the piece of music is almost ready to be printed.  The final step is to
 combine the music with a printing command.
 
-The printing command is the so-called address@hidden'' block.  Later on
+The printing command is the so-called @code{\paper} block.  Later on
 you will see that the @code{\paper} block is used to customize
 printing specifics.  The music and the @code{\paper} block are combined by
-enclosing them in address@hidden @{ ... @}}''.  This is what a full
+enclosing them in @code{\score @{ ... @}}.  This is what a full
 LilyPond source file looks like:
 
address@hidden
 @example
 \score @{
   \notes @{
-     \time 3/4
-     \clef bass
-     c2 e4 g2.
-     f4 e d c2.
+    \time 3/4
+    \clef bass
+    c2 e4 g2.
+    f4 e d c2.
   @}
   \paper @{ @}
 @}
 @end example
 
address@hidden
address@hidden
 \score {
   \notes {
      \time 3/4
@@ -234,11 +191,11 @@
      c2 e4 g2.
      f4 e d c2.
   }
-  \paper { linewidth = 60 * \staffspace }
+  \paper {
+    linewidth = 55 * \staffspace
+  }
 }
 @end lilypond
address@hidden quotation
address@hidden
 
 
 @node Running LilyPond
@@ -395,8 +352,7 @@
 @item @code{1 2 8 16}
 @tab durations 
 @tab
address@hidden, relative 1]
-\property Staff.TimeSignature = \turnOff
address@hidden 1, noquote, notime]
 \property Staff.autoBeaming = ##f
 \property Staff.Clef = \turnOff
 c1 c2 c8 c16
@@ -405,8 +361,7 @@
 @item @code{. ..}
 @tab augmentation dots
 @tab
address@hidden, relative 1]
-\property Staff.TimeSignature = \turnOff
address@hidden 1, noquote, notime]
 \property Staff.Clef = \turnOff
 c4. c4..  
 @end lilypond
@@ -414,8 +369,7 @@
 @item @code{c d e f g a b }
 @tab scale 
 @tab
address@hidden, relative 1]
-\property Staff.TimeSignature = \turnOff
address@hidden 1, noquote, notime]
 \property Staff.Clef = \turnOff
 c d e f g a b
 @end lilypond
@@ -423,8 +377,7 @@
 @item @code{\clef treble \clef bass }
 @tab clefs
 @tab
address@hidden
-\property Staff.TimeSignature \set #'transparent = ##t 
address@hidden, notime]
 \clef treble
 s4_" "
 \clef bass
@@ -434,7 +387,7 @@
 @item @code{\time 3/4 \time 4/4 }
 @tab time signature
 @tab
address@hidden
address@hidden
 \property Staff.Clef \set #'transparent = ##t 
 \time 3/4
 s4_" "
@@ -681,30 +634,25 @@
 @item @code{r4 r8}
 @tab rest 
 @tab
address@hidden, relative 1]
-\property Staff.TimeSignature = \turnOff
address@hidden 1, noquote, notime]
 \property Staff.Clef = \turnOff
 r4 r8
 @end lilypond
 
-
 @item @code{~}
 @tab tie
 @tab
address@hidden, relative 1]
address@hidden 1, noquote, notime]
 \property Score.timing = ##f
-\property Staff.TimeSignature = \turnOff
 \property Staff.autoBeaming = ##f
 \property Staff.Clef = \turnOff
 d ~ d
 @end lilypond
 
-
 @item @code{\key es \major }
 @tab key signature
 @tab
address@hidden
-\property Staff.TimeSignature \set #'transparent = ##t
address@hidden, notime]
 \clef treble
 \key es \major
 s4 
@@ -713,9 +661,8 @@
 @item @address@hidden'}
 @tab raise octave
 @tab
address@hidden, relative 1]
address@hidden 1, noquote, notime]
 \property Score.timing = ##f
-\property Staff.TimeSignature = \turnOff
 \property Staff.autoBeaming = ##f
 \property Staff.Clef = \turnOff
 a a'
@@ -724,9 +671,8 @@
 @item @address@hidden,}
 @tab lower octave
 @tab
address@hidden, relative 1]
address@hidden 1, noquote, notime]
 \property Score.timing = ##f
-\property Staff.TimeSignature = \turnOff
 \property Staff.autoBeaming = ##f
 \property Staff.Clef = \turnOff
 c c,
@@ -1762,7 +1708,7 @@
 Battista Sammartini, composed around 1740.  It's in the source
 package under the name @file{input/tutorial/sammartini.ly}.
 
address@hidden
address@hidden,noquote]{sammartini.ly}
 
 As you can see, this example features multiple voices on one staff.  To
 make room for those voices, their notes should be stemmed in opposite
@@ -1948,12 +1894,12 @@
 @cindex @code{\translator}
 
 @example
-       \translator Staff = down
-       \stemUp
-       c8
-       \translator Staff = up
-       \stemDown
-       c'8 @}
+\translator Staff = down
+\stemUp
+c8
+\translator Staff = up
+\stemDown
+c'8 @}
 @end example
 Voices can switch between staves.  Here you see two staff switching
 commands.  The first one moves to the lower staff, the second one to
@@ -2190,7 +2136,7 @@
 it a little to the left, and 1.8 staff space downwards.
 @example
  \property Voice.Fingering \set #'extra-offset = #'(-0.3 . -1.8) 
address@hidden example     
address@hidden example   
 The @code{extra-offset} is a low-level feature: it moves around
 objects in the printout; the formatting engine is completely oblivious
 to these offsets.  The unit of these offsets are staff-spaces.  The
@@ -2270,7 +2216,7 @@
 going down), there should be more space.  This space is controlled by
 @code{padding}, so we increase it.
 @example
-           \property Voice.DynamicLineSpanner \override #'padding = #5.0
+\property Voice.DynamicLineSpanner \override #'padding = #5.0
 @end example
 
 This command is almost like the command for setting slur attachments,
@@ -2293,8 +2239,8 @@
 snippet of code.
 
 @example
-        \property Voice.Stem \set #'transparent = ##t
-         d'
+\property Voice.Stem \set #'transparent = ##t
+d'
 @end example
 Blanking the stem should be done for only one object. One of the ways
 to achieve that, is by setting the property before a note. Reverting
@@ -2452,7 +2398,7 @@
     >
     \context StaffGroup = brass <
       \context Staff = trombe <
-       \property Staff.midiInstrument = #"trumpet"
+        \property Staff.midiInstrument = #"trumpet"
         \property Staff.instrument = #`(lines "2 Trombe" "(C)")
         \property Staff.instr = #`(lines "Tbe." "(C)")
         \Key
@@ -2474,7 +2420,7 @@
   >
   \paper @{
     indent = 15 * \staffspace
-    linewidth = 60 * \staffspace
+    linewidth = 55 * \staffspace
     textheight = 90 * \staffspace
     address@hidden
       \HaraKiriStaffContext
@@ -2645,8 +2591,8 @@
 
 @separate
 @example
-       \property Staff.instrument = #`(lines "Corno"
-          (columns "(E" ,text-flat ")"))
+\property Staff.instrument = #`(lines "Corno"
+  (columns "(E" ,text-flat ")"))
 @end example
 The french horn (``Corno'') has the most complex scheme markup name, made
 up of two lines of text.  The second line has three elements (columns) --
@@ -2675,7 +2621,7 @@
 @separate
 @example
     indent = 15 * \staffspace
-    linewidth = 60 * \staffspace
+    linewidth = 55 * \staffspace
 @end example
 We specify a big indent for the first line and a small linewidth for this
 tutorial.
@@ -2876,9 +2822,14 @@
 In a lilypond-book document, you can freely mix music and text. For
 example:
 @lilypond
-  \score { \notes \relative c' {
-     c2 g'2 \times 2/3 { f8 e d } c'2 g4
-  } }
+\score {
+  \notes \relative c' {
+    c2 g'2 \times 2/3 { f8 e d } c'2 g4
+  }
+  \paper {
+    linewidth = -1
+  }
+}
 @end lilypond
 Notice that the music line length matches the margin settings of the
 document.
@@ -2909,7 +2860,7 @@
 If you include large examples into the text, it may be more convenient
 to put the example in a separate file:
 
address@hidden
address@hidden,noquote]{sammartini.ly}
 
 The @code{printfilename} option adds the file name to the output.
 @node  End of tutorial
--- ./Documentation/user/refman.itely.old       Sun Sep 15 21:25:28 2002
+++ ./Documentation/user/refman.itely   Thu Sep 26 01:03:36 2002
@@ -244,14 +244,13 @@
 longer than a whole you must use identifiers.
 
 @example 
- c'\breve  
+c'\breve  
 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 
 r\longa r\breve  
 r1 r2 r4 r8 r16 r32 r64 r64 
 @end example 
 
-
address@hidden
address@hidden,noquote]
 \score {
   \notes \relative c'' {
     a\breve  \autoBeamOff
@@ -361,7 +360,7 @@
 notes. This is done by replacing the @code{Note_heads_engraver} by the
 @code{Completion_heads_engraver}. 
 
address@hidden,center]
address@hidden,noindent,noquote]
 \score{
   \notes\relative c'{ \time 2/4
   c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 
@@ -1205,7 +1204,7 @@
 \property Score.beatLength = #(make-moment 1 8)
 [c32 c c c c c c c c c c c c c c c]
 @end example
address@hidden
address@hidden,noquote]
 \score {
     \notes \relative c' {
         [c16 c c c c c c c]
@@ -1871,8 +1870,8 @@
       }
     >
     \paper {
-      linewidth = 5.875\in
-      indent    = 0.0
+      linewidth = 5.1\in
+      indent    = 0.0\mm
     }
   }
 @end lilypond
@@ -2465,8 +2464,9 @@
 Currently the following lists are defined in @file{scm/drums.scm}:
 @table @code
 @item 'drums
-To typeset a typical drum kit on a five line staff.
address@hidden
+To typeset a typical drum kit on a five-line staff.
+
address@hidden
 \include "drumpitch-init.ly"
 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
     bd sn ss tomh tommh tomml toml tomfh tomfl }
@@ -2481,6 +2481,7 @@
         \context Lyrics \nam 
     >
     \paper {
+        linewidth = 100.0\mm
         \translator {
             \StaffContext
             \remove Bar_engraver
@@ -2494,6 +2495,7 @@
    }   
 }
 @end lilypond
+
 Notice that the scheme supports six different toms.
 If you are using fewer toms then you simply select the toms that produce
 the desired result - i.e. to get toms on the three middle lines you
@@ -2990,7 +2992,7 @@
 \property TabStaff.minimumFret = #8
 e8 fis gis a b cis' dis' e'
 @end example
address@hidden
address@hidden,noquote]
 frag = \notes {
     \key e \major
     e8 fis gis a b cis' dis' e'
@@ -3303,7 +3305,7 @@
 
 @c too long?
 @c maybe just junk verbatim option?
address@hidden,singleline]
address@hidden,singleline,noquote]
 scheme = \chords {
   c1 c:5^3 c:4^3 c:5+
   c:m7+ c:m5-.7
@@ -3421,7 +3423,7 @@
   #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
 \property Score.BarNumber \override #'font-relative-size = #0
 @end example
address@hidden
address@hidden,noquote]
 \score {
     \context Staff \notes \transpose c''' {
        \property Score.BarNumber \override #'break-visibility = 
#end-of-line-invisible
@@ -3725,7 +3727,7 @@
 thus helps the player or singer to manage line breaks during
 performance, thus enhancing readability of a score.
 
address@hidden
address@hidden,noquote]
 \score {
   \notes { c'1 \break
         \property Staff.Custos \set #'style = #'mensural
--- ./Documentation/user/macros.itexi.old       Sat Jul 13 19:07:18 2002
+++ ./Documentation/user/macros.itexi   Wed Sep 25 00:12:08 2002
@@ -62,7 +62,7 @@
 @iftex
 @macro texiflat {word}
 @tex
-$\\flat$
+$\\flat$%
 @end tex
 @end macro
 @end iftex
--- ./Documentation/user/appendices.itely.old   Thu Sep  5 00:36:05 2002
+++ ./Documentation/user/appendices.itely       Thu Sep 26 00:46:10 2002
@@ -38,8 +38,7 @@
 @section American Chords
 
 
address@hidden
address@hidden
address@hidden, noquote, noindent, notime]
 \include "english.ly"
 
 scheme = \chords {
@@ -75,6 +74,7 @@
     \context Staff \transpose c'' \scheme
   >
   \paper {
+    linewidth = 5.7\in
     \translator { 
       \ChordNamesContext
       ChordName \override #'word-space = #1 
@@ -83,15 +83,14 @@
   }
 }
 @end lilypond
address@hidden quotation
 
 @node Jazz chords
 @section Jazz chords
 
 Similarly, Jazz style chord names are implemented as a variation on
 American style names:
address@hidden
address@hidden
+
address@hidden, noquote, noindent, notime]
 scheme = \chords {
   % major chords
   c
@@ -139,6 +138,7 @@
     \context Staff \transpose c'' \scheme
   >
   \paper {
+    linewidth = 5.7\in
     \translator { 
       \ChordNamesContext
       ChordName \override #'word-space = #1 
@@ -147,7 +147,6 @@
   }
 }
 @end lilypond
address@hidden quotation
 
 @c [barnumbers look silly, fixme.]
 
@@ -208,7 +207,7 @@
 accessed directly using text markup such as 
 @code{g^#'(music "scripts-segno")}, see @ref{Text markup}.
 
address@hidden
address@hidden,noindent]{feta16list.ly}
 
 @c parmesan is too big. Apparently pythons re's choke on this.
 @c @lil ypondfile{parmesan16list.ly}
--- ./scm/tex.scm.old   Sat Sep 21 10:33:06 2002
+++ ./scm/tex.scm       Thu Sep 26 00:29:54 2002
@@ -142,7 +142,19 @@
   (begin
                                        ; uncomment for some stats about lily 
memory      
                                        ;               (display (gc-stats))
-    (string-append "%\n\\endgroup\\EndLilyPondOutput\n"
+    (string-append
+     "%\n"
+     "\\EndLilyPondOutput\n"
+     "\\begingroup\n"
+     "\\ifx\\LilyPondDocument\\undefined\n"
+     "  \\def\\x{\\endgroup}%\n"
+     "\\else\n"
+     "  \\def\\x{%\n"
+     "    \\endgroup\n"
+     "    \\enddocument\n"
+     "  }\n"
+     "\\fi\n"
+     "\\x\n"
                                        ; Put GC stats here.
                   )))
 
@@ -178,10 +190,30 @@
                                 (ly-gulp-file "music-drawing-routines.ps") 
'pre " %\n" 'post)
        (ly-gulp-file "music-drawing-routines.ps"))
 ;   (if (defined? 'ps-testing) "/testing true def%\n" "")
-   "}"
+   "}%\n"
+   "\\begingroup\n"
+   "\\catcode address@hidden"
+   "\\expandafter\\ifx\\csname @nodocument\\endcsname \\relax\n"
+   "  \\def\\x{\\endgroup}%\n"
+   "\\else\n"
+   "  \\def\\x{%\n"
+   "    \\endgroup\n"
+   "    \\def\\LilyPondDocument{}\n"
+   "    \\documentclass{article}\n"
+   ; argh, we can't say \begin{document} because \begin is defined as
+   ; \outer in texinfo
+   "    \\begingroup\n"
+   "    \\document\n"
+   "    \\ifdim\\lilypondpaperlinewidth\\lilypondpaperunit > 0pt\n"
+   "      \\hsize\\lilypondpaperlinewidth\\lilypondpaperunit\n"
+   "    \\fi\n"
+   "    \\parindent 0pt\n"
+   "  }\n"
+   "\\fi\n"
+   "\\x\n"
    "\\input lilyponddefs\n"
    "\\outputscale=\\lilypondpaperoutputscale \\lilypondpaperunit\n"
-   "\\turnOnPostScript\\begingroup\\parindent0pt\n"))
+   "\\turnOnPostScript\n"))
 
 ;; Note: this string must match the string in ly2dvi.py!!!
 (define (header creator generate) 
--- ./scripts/lilypond-book.py.old      Mon Sep 23 11:51:20 2002
+++ ./scripts/lilypond-book.py  Wed Sep 25 23:51:40 2002
@@ -173,7 +173,7 @@
                self.m_document_preamble = []
                self.m_num_cols = 1
                self.m_multicols = 1
-               
+
        def find_latex_dims(self):
                if g_outdir:
                        fname = os.path.join(g_outdir, "lily-tmp.tex")
@@ -216,13 +216,13 @@
 
                                if countdown == 0:
                                        break
-                               
+
                                if countdown > 0:
                                        countdown = countdown -1
 
                        sys.stderr.write ("  ... (further messages 
elided)...\n")
                        sys.exit (1)
-                       
+
                lns = open ('lily-tmp.log').readlines()
                for ln in lns:
                        ln = string.strip(ln)
@@ -230,7 +230,7 @@
                        if m:
                                if m.groups()[0] in ('textwidth', 'columnsep'):
                                        self.__dict__['m_%s' % m.groups()[0]] = 
float(m.groups()[1])
-                                       
+
                try:
                        os.remove (fname)
                        os.remove (os.path.splitext(fname)[0]+".aux")
@@ -240,7 +240,7 @@
 
                if not self.__dict__.has_key ('m_textwidth'):
                        raise 'foo!'
-               
+
        def get_linewidth(self):
                if self.m_num_cols == 1:
                        w = self.m_textwidth
@@ -296,9 +296,9 @@
                        unit = m.group (2)
                        num = string.atof(m.group (1))
                        conv =  dimension_conversion_dict[m.group(2)]
-                       
+
                        value = conv(num)
-               
+
                elif re.match ("^[0-9.]+$",value):
                        value = float(value)
 
@@ -331,7 +331,7 @@
        ('PREF', '',  'dep-prefix', 'prepend PREF before each -M dependency'),
        ('', 'n', 'no-lily', 'don\'t run lilypond'),
        ('', '', 'no-pictures', "don\'t generate pictures"),
-       ('', '', 'no-music', "strip all lilypond blocks from output"),  
+       ('', '', 'no-music', "strip all lilypond blocks from output"),
        ('', '', 'read-lys', "don't write ly files."),
        ('FILE', 'o', 'outname', 'filename main output file'),
        ('FILE', '', 'outdir', "where to place generated files"),
@@ -341,14 +341,17 @@
 
 # format specific strings, ie. regex-es for input, and % strings for output
 output_dict= {
+
+
        'html' : {
+
                'output-lilypond': '''<lilypond%s>
 %s
 </lilypond>''',
                'output-filename' : r'''
 <!-- %s >
 <a href="%s">
-<pre>%s</pre></a>:''', 
+<pre>%s</pre></a>:''',
                'output-lilypond-fragment': '''<lilypond%s>
 \context Staff\context Voice{ %s }
 </lilypond>''',
@@ -357,23 +360,27 @@
 ''',
                ## maybe <hr> ?
                'pagebreak': None,
+               # Verbatim text is always finished with \n.  FIXME: For HTML,
+               # this newline should be removed.
                'output-verbatim': r'''<pre>
-%s
-</pre>''',
+%s</pre>''',
+               # Verbatim text is always finished with \n.  FIXME: For HTML,
+               # this newline should be removed.
                'output-small-verbatim': r'''<font size=-1><pre>
-%s
-</pre></font>''',
-
+%s</pre></font>''',
                ## Ugh we need to differentiate on origin:
                ## lilypond-block origin wants an extra <p>, but
                ## inline music doesn't.
                ## possibly other center options?
-               'output-all': r'''
+               'output-html': r'''
 <a href="%(fn)s.png">
 <img align="center" valign="center" border="0" src="%(fn)s.png" alt="[picture 
of music]"></a>
 ''',
                },
+
+
        'latex': {
+
                'output-lilypond-fragment' : 
r'''\begin[eps,singleline,%s]{lilypond}
   \context Staff <
     \context Voice{
@@ -381,8 +388,7 @@
     }
   >
 \end{lilypond}''',
-               'output-filename' : r'''
-\verb+%s+:
+               'output-filename' : r'''\verb+%s+:\\
 %% %s
 %% %s
 ''',
@@ -390,9 +396,14 @@
 %s
 \end{lilypond}
 ''',
-               'output-verbatim': r'''\begin{verbatim}%s\end{verbatim}%%
+               # verbatim text is always finished with \n
+               'output-verbatim': r'''\begin{verbatim}
+%s\end{verbatim}
+''',
+               # verbatim text is always finished with \n
+               'output-small-verbatim': r'''{\small\begin{verbatim}
+%s\end{verbatim}}
 ''',
-               'output-small-verbatim': 
r'''{\small\begin{verbatim}%s\end{verbatim}}%%''',
                'output-default-post': "\\def\postLilypondExample{}\n",
                'output-default-pre': "\\def\preLilypondExample{}\n",
                'usepackage-graphics': '\\usepackage{graphics}\n',
@@ -403,46 +414,58 @@
                'output-tex': '{\\preLilypondExample \\input %(fn)s.tex 
\\postLilypondExample\n}',
                'pagebreak': r'\pagebreak',
                },
-       
+
+
        'texi' : {
+
                'output-lilypond': '''@lilypond[%s]
 %s
 @end lilypond
 ''',
-               'output-filename' : r'''
address@hidden
address@hidden:
+               'output-filename' : r'''@ifnothtml
address@hidden:@*
 @end ifnothtml
 @ifhtml
 @uref{%s,@file{%s}}
 @end ifhtml
-''',   
+''',
                'output-lilypond-fragment': '''@lilypond[%s]
 \context Staff\context Voice{ %s }
 @end lilypond ''',
                'output-noinline': r'''
address@hidden generated: %(fn)s.png            
address@hidden generated: %(fn)s.png
 ''',
                'pagebreak': None,
+               # verbatim text is always finished with \n
                'output-small-verbatim': r'''@smallexample
-%s
address@hidden smallexample
address@hidden smallexample
 ''',
+               # verbatim text is always finished with \n
                'output-verbatim': r'''@example
-%s
address@hidden example
address@hidden example
 ''',
-
-# do some tweaking: @ is needed in some ps stuff.
-# override EndLilyPondOutput, since @tex is done
-# in a sandbox, you can't do \input lilyponddefs at the
-# top of the document.
-
-# should also support fragment in
-
-# ugh, the <p> below breaks inline images...
-               
-               'output-all': r'''
+               # do some tweaking: @ is needed in some ps stuff.
+               # override EndLilyPondOutput, since @tex is done
+               # in a sandbox, you can't do \input lilyponddefs at the
+               # top of the document.
+               #
+               # ugh, the <p> below breaks inline images...
+               'output-texi-noquote': r'''@tex
address@hidden
+\parindent 0pt
+\input lilyponddefs
+\def\EndLilyPondOutput{}
+\input %(fn)s.tex
address@hidden
address@hidden tex
address@hidden
+<p>
+<a href="%(fn)s.png">
+<img border=0 src="%(fn)s.png" alt="[picture of music]">
+</a><p>
address@hidden html
+''',
+               'output-texi-quoted': r'''@quotation
 @tex
 address@hidden
 \input lilyponddefs
@@ -450,6 +473,7 @@
 \input %(fn)s.tex
 address@hidden
 @end tex
address@hidden quotation
 @html
 <p>
 <a href="%(fn)s.png">
@@ -458,7 +482,7 @@
 @end html
 ''',
                }
-       
+
        }
 
 def output_verbatim (body, small):
@@ -467,7 +491,6 @@
                body = re.sub ('>', '&gt;', body)
                body = re.sub ('<', '&lt;', body)
        elif __main__.format == 'texi':
-               
                # clumsy workaround for python 2.2 pre bug.
                body = re.sub ('@', '@@', body)
                body = re.sub ('{', '@{', body)
@@ -480,75 +503,75 @@
        return get_output (key) % body
 
 
-#warning: this uses extended regular expressions. Tread with care.
-
+# Warning: This uses extended regular expressions.  Treat with care.
+#
 # legenda
-
-# (?P  -- name parameter
+#
+# (?P<name>regex) -- assign result of REGEX to NAME
 # *? -- match non-greedily.
-# (?m)  -- ?
+# (?m) -- multiline regex: make ^ and $ match at each line
+# (?s) -- make the dot match all characters including newline
 re_dict = {
        'html': {
-                'include':  no_match,
-                'input': no_match,
-                'header': no_match,
-                'preamble-end': no_match,
-                'landscape': no_match,
-                'verbatim': r'''(?s)(?P<code><pre>\s.*?</pre>\s)''',
-                'verb': r'''(?P<code><pre>.*?</pre>)''',
-                'lilypond-file': 
r'(?m)(?P<match><lilypondfile(?P<options>[^>]+)?>\s*(?P<filename>[^<]+)\s*</lilypondfile>)',
-                'lilypond' : 
'(?m)(?P<match><lilypond((?P<options>[^:]*):)(?P<code>.*?)/>)',
-                'lilypond-block': 
r'''(?ms)(?P<match><lilypond(?P<options>[^>]+)?>(?P<code>.*?)</lilypond>)''',
-                 'option-sep' : '\s*',
-                 'intertext': r',?\s*intertext=\".*?\"',
-                 'multiline-comment': 
r"(?sm)\s*(address@hidden)(?P<code><!--\s.*?!-->)\s",
-                 'singleline-comment': no_match,
-                 'numcols': no_match,
-                 'multicols': no_match,
-                },
-       
-       'latex': {'input': r'(?m)^[^%\n]*?(?P<match>\\mbinput{?([^}\t \n}]*))',
-                 'include': 
r'(?m)^[^%\n]*?(?P<match>\\mbinclude{(?P<filename>[^}]+)})',
-                 'option-sep' : ',\s*',
-                 'header': r"\n*\\documentclass\s*(\[.*?\])?",
-                 'preamble-end': r'(?P<code>\\begin\s*{document})',
-                 'verbatim': 
r"(?s)(?P<code>\\begin\s*{verbatim}.*?\\end{verbatim})",
-                 'verb': r"(?P<code>\\verb(?P<del>.).*?(?P=del))",
-                 'lilypond-file': 
r'(?m)^[^%\n]*?(?P<match>\\lilypondfile\s*(\[(?P<options>.*?)\])?\s*\{(?P<filename>.+)})',
-                 'lilypond' : 
r'(?m)^[^%\n]*?(?P<match>\\lilypond\s*(\[(?P<options>.*?)\])?\s*{(?P<code>.*?)})',
-                 'lilypond-block': 
r"(?sm)^[^%\n]*?(?P<match>\\begin\s*(\[(?P<options>.*?)\])?\s*{lilypond}(?P<code>.*?)\\end{lilypond})",
-                 'def-post-re': r"\\def\\postLilypondExample",
-                 'def-pre-re': r"\\def\\preLilypondExample",
-                 'usepackage-graphics': r"\usepackage\s*{graphics}",
-                 'intertext': r',?\s*intertext=\".*?\"',
-                 'multiline-comment': no_match,
-                 'singleline-comment': 
r"(?m)^.*?(?P<match>(?P<code>^%.*$\n+))",
-                 'numcols': r"(?P<code>\\(?P<num>one|two)column)",
-                 'multicols': 
r"(?P<code>\\(?P<be>begin|end)\s*{multicols}({(?P<num>\d+)?})?)",
-                 },
+               'include':  no_match,
+               'input': no_match,
+               'header': no_match,
+               'preamble-end': no_match,
+               'landscape': no_match,
+               'verbatim': r'''(?s)(?P<code><pre>\s.*?</pre>\s)''',
+               'verb': r'''(?P<code><pre>.*?</pre>)''',
+               'lilypond-file': 
r'(?m)(?P<match><lilypondfile(?P<options>[^>]+)?>\s*(?P<filename>[^<]+)\s*</lilypondfile>)',
+               'lilypond' : 
'(?m)(?P<match><lilypond((?P<options>[^:]*):)(?P<code>.*?)/>)',
+               'lilypond-block': 
r'''(?ms)(?P<match><lilypond(?P<options>[^>]+)?>(?P<code>.*?)</lilypond>)''',
+               'option-sep' : '\s*',
+               'intertext': r',?\s*intertext=\".*?\"',
+               'multiline-comment': 
r"(?sm)\s*(address@hidden)(?P<code><!--\s.*?!-->)\s",
+               'singleline-comment': no_match,
+               'numcols': no_match,
+               'multicols': no_match,
+               },
 
+       'latex': {
+               'input': r'(?m)^[^%\n]*?(?P<match>\\mbinput{?([^}\t \n}]*))',
+               'include': 
r'(?m)^[^%\n]*?(?P<match>\\mbinclude{(?P<filename>[^}]+)})',
+               'option-sep' : ',\s*',
+               'header': r"\n*\\documentclass\s*(\[.*?\])?",
+               'preamble-end': r'(?P<code>\\begin\s*{document})',
+               'verbatim': 
r"(?s)(?P<code>\\begin\s*{verbatim}.*?\\end{verbatim})",
+               'verb': r"(?P<code>\\verb(?P<del>.).*?(?P=del))",
+               'lilypond-file': 
r'(?m)^[^%\n]*?(?P<match>\\lilypondfile\s*(\[(?P<options>.*?)\])?\s*\{(?P<filename>.+)})',
+               'lilypond' : 
r'(?m)^[^%\n]*?(?P<match>\\lilypond\s*(\[(?P<options>.*?)\])?\s*{(?P<code>.*?)})',
+               'lilypond-block': 
r"(?sm)^[^%\n]*?(?P<match>\\begin\s*(\[(?P<options>.*?)\])?\s*{lilypond}(?P<code>.*?)\\end{lilypond})",
+               'def-post-re': r"\\def\\postLilypondExample",
+               'def-pre-re': r"\\def\\preLilypondExample",
+               'usepackage-graphics': r"\usepackage\s*{graphics}",
+               'intertext': r',?\s*intertext=\".*?\"',
+               'multiline-comment': no_match,
+               'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>^%.*$\n+))",
+               'numcols': r"(?P<code>\\(?P<num>one|two)column)",
+               'multicols': 
r"(?P<code>\\(?P<be>begin|end)\s*{multicols}({(?P<num>\d+)?})?)",
+               },
 
        # why do we have distinction between @mbinclude and @include?
 
-       
        'texi': {
-                'include':  '(?m)^[^%\n]*?(?P<match>@mbinclude[ 
\n\t]+(?P<filename>[^\t \n]*))',
-                'input': no_match,
-                'header': no_match,
-                'preamble-end': no_match,
-                'landscape': no_match,
-                'verbatim': r'''(?s)(?P<code>@address@hidden example\s)''',
-                'verb': r'''(?P<code>@code{.*?})''',
-                'lilypond-file': 
'(?m)^(?P<match>@lilypondfile(\[(?P<options>[^]]*)\])?{(?P<filename>[^}]+)})',
-                'lilypond' : 
'(?m)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?{(?P<code>.*?)})',
-                'lilypond-block': 
r'''(?ms)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?\s(?P<code>.*?)@end 
+lilypond)\s''',
-                'option-sep' : ',\s*',
-                'intertext': r',?\s*intertext=\".*?\"',
-                'multiline-comment': 
r"(?sm)^\s*(address@hidden)(?P<code>@address@hidden ignore)\s",
-                'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>@c.*$\n+))",
-                'numcols': no_match,
-                'multicols': no_match,
-                }
+               'include':  '(?m)^[^%\n]*?(?P<match>@mbinclude[ 
\n\t]+(?P<filename>[^\t \n]*))',
+               'input': no_match,
+               'header': no_match,
+               'preamble-end': no_match,
+               'landscape': no_match,
+               'verbatim': r'''(?s)(?P<code>@address@hidden example\s)''',
+               'verb': r'''(?P<code>@code{.*?})''',
+               'lilypond-file': 
'(?m)^(?P<match>@lilypondfile(\[(?P<options>[^]]*)\])?{(?P<filename>[^}]+)})',
+               'lilypond' : 
'(?m)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?{(?P<code>.*?)})',
+               'lilypond-block': 
r'''(?ms)^(?P<match>@lilypond(\[(?P<options>[^]]*)\])?\s(?P<code>.*?)@end 
+lilypond)\s''',
+               'option-sep' : ',\s*',
+               'intertext': r',?\s*intertext=\".*?\"',
+               'multiline-comment': 
r"(?sm)^\s*(address@hidden)(?P<code>@address@hidden ignore)\s",
+               'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>@c.*$\n+))",
+               'numcols': no_match,
+               'multicols': no_match,
+               }
        }
 
 
@@ -566,7 +589,7 @@
                        raise "Invalid re"
        re_dict[r] = newdict
 
-       
+
 def uniq (list):
        list.sort ()
        s = list
@@ -575,7 +598,7 @@
                if x not in list:
                        list.append (x)
        return list
-               
+
 
 def get_output (name):
        return  output_dict[format][name]
@@ -593,7 +616,7 @@
        str = fd.read ()
        s = re.search('%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)', str)
        if s:
-               
+
                gs = map (lambda x: string.atoi (x), s.groups ())
                return (int (gs[2] - gs[0] + 0.5),
                        int (gs[3] - gs[1] + 0.5))
@@ -624,7 +647,7 @@
                if m:
                        f = float (m.group (1))
                        indent = 'indent = %f\\%s' % (f, m.group (2))
-                       
+
                m = re.match ('linewidth=([-.0-9]+)(cm|in|mm|pt)', o)
                if m:
                        f = float (m.group (1))
@@ -641,9 +664,10 @@
 
        if is_fragment and not 'multiline' in opts:
                opts.append('singleline')
-               
+
        if 'singleline' in opts:
-               linewidth = 'linewidth = -1.0'
+               if not linewidth:
+                       linewidth = 'linewidth = -1.0'
                if not indent:
                        indent = 'indent = 0.0\mm'
        elif not linewidth:
@@ -678,7 +702,7 @@
                                pitch = pitch + '\'' * v
 
                        body = '\\relative %s { %s }' %(pitch, body)
-       
+
        if is_fragment:
                body = r'''
 \score {
@@ -730,7 +754,7 @@
                break
 
 
-       # Then we add everythin before \begin{document} to
+       # Then we add everything before \begin{document} to
        # paperguru.m_document_preamble so that we can later write this header
        # to a temporary file in find_latex_dims() to find textwidth.
        while idx < len(chunks) and chunks[idx][0] != 'preamble-end':
@@ -742,7 +766,7 @@
 
        if len(chunks) == idx:
                error ("Didn't find end of preamble (\\begin{document})")
-               
+
        paperguru.find_latex_dims()
 
 def scan_texi_preamble (chunks):
@@ -762,7 +786,7 @@
                scan_latex_preamble (chunks)
        elif __main__.format == 'texi':
                scan_texi_preamble (chunks)
-               
+
 
 def completize_preamble (chunks):
        if __main__.format != 'latex':
@@ -779,7 +803,7 @@
                        m = get_re('def-post-re').search(chunk[1])
                        if m:
                                post_b = 1
-                               
+
                if chunk[0] == 'input':
                        m = get_re('usepackage-graphics').search(chunk[1])
                        if m:
@@ -790,7 +814,7 @@
 
        if x == len(chunks):
                return chunks
-       
+
        if not pre_b:
                chunks.insert(x, ('input', get_output ('output-default-pre')))
        if not post_b:
@@ -859,9 +883,9 @@
 
        Find @lilypondfile{bla.ly} occurences and substitute bla.ly
        into a @lilypond .. @end lilypond block.
-       
+
        '''
-       
+
        if m.group('options'):
                options = m.group('options')
        else:
@@ -875,11 +899,11 @@
 def make_lilypond_block(m):
        if not g_do_music:
                return []
-       
+
        if m.group('options'):
                options = get_re('option-sep').split (m.group('options'))
        else:
-           options = []
+               options = []
        options = filter(lambda s: s != '', options)
        return [('lilypond', m.group('code'), options)]
 
@@ -925,14 +949,14 @@
 
 def determine_format (str):
        if __main__.format == '':
-               
+
                html = re.search ('(?i)<[dh]tml', str[:200])
                latex = re.search (r'''\\document''', str[:200])
                texi = re.search ('@node|@setfilename', str[:200])
 
                f = ''
                g = None
-               
+
                if html and not latex and not texi:
                        f = 'html'
                elif latex and not html and not texi:
@@ -950,7 +974,7 @@
                        g = LatexPaper ()
                elif __main__.format == 'texi':
                        g = TexiPaper ()
-                       
+
                __main__.paperguru = g
 
 
@@ -959,15 +983,14 @@
        '''
        (str, path) = find_file(filename)
        determine_format (str)
-       
+
        chunks = [('input', str)]
-       
+
        # we have to check for verbatim before doing include,
        # because we don't want to include files that are mentioned
        # inside a verbatim environment
        chunks = chop_chunks(chunks, 'verbatim', make_verbatim)
 
-
        chunks = chop_chunks(chunks, 'verb', make_verb)
        chunks = chop_chunks(chunks, 'multiline-comment', do_ignore)
        #ugh fix input
@@ -986,7 +1009,6 @@
        Return: a chunk (TYPE_STR, MAIN_STR, OPTIONS, TODO, BASE)
 
        TODO has format [basename, extension, extension, ... ]
-       
        '''
        (type, body, opts) = chunk
        assert type == 'lilypond'
@@ -1037,7 +1059,7 @@
                        if m:
                                newbody = newbody + get_output 
("output-filename") % (m.group(1), basename + '.ly', m.group(1))
                                break
-               
+
 
        if 'smallverbatim' in opts:
                newbody = newbody + output_verbatim (body, 1)
@@ -1047,8 +1069,13 @@
        for o in opts:
                m = re.search ('intertext="(.*?)"', o)
                if m:
-                       newbody = newbody  + m.group (1) + "\n\n"
-       
+                       newbody = newbody + "\n"
+                       if format == 'texi':
+                               newbody = newbody + "@noindent\n"
+                       elif format == 'latex':
+                               newbody = newbody + "\\noindent\n"
+                       newbody = newbody + m.group (1) + "\n"
+
        if 'noinline' in opts:
                s = 'output-noinline'
        elif format == 'latex':
@@ -1056,8 +1083,13 @@
                        s = 'output-eps'
                else:
                        s = 'output-tex'
-       else: # format == 'html' or format == 'texi':
-               s = 'output-all'
+       elif format == 'texi':
+               if 'noquote' in opts:
+                       s = 'output-texi-noquote'
+               else:
+                       s = 'output-texi-quoted'
+       else: # format == 'html'
+               s = 'output-html'
        newbody = newbody + get_output (s) % {'fn': basename }
        return ('lilypond', newbody, opts, todo, basename)
 
@@ -1100,7 +1132,7 @@
        gr = []
        if m:
                gr = map (string.atoi, m.groups ())
-       
+
        return gr
 
 def make_pixmap (name):
@@ -1109,14 +1141,14 @@
        fo = open (name + '.trans.eps' , 'w')
        fo.write ('%d %d translate\n' % (-bbox[0]+margin, -bbox[1]+margin))
        fo.close ()
-       
+
        res = 90
 
        x = (2* margin + bbox[2] - bbox[0]) * res / 72.
        y = (2* margin + bbox[3] - bbox[1]) * res / 72.
 
        cmd = r'''gs -g%dx%d -sDEVICE=pnggray  -dTextAlphaBits=4 
-dGraphicsAlphaBits=4  -q -sOutputFile=%s -r%d -dNOPAUSE %s %s -c quit '''
-       
+
        cmd = cmd % (x, y, name + '.png', res, name + '.trans.eps', name + 
'.eps')
        status = 0
        try:
@@ -1185,15 +1217,15 @@
                                f.close ()
 
        for e in eps:
-               cmd = r"echo $TEXMF; tex '\nonstopmode \input %s'" % e
-               quiet_system (cmd, 'TeX')
-               
+               cmd = r"echo $TEXMF; latex '\nonstopmode \input %s'" % e
+               quiet_system (cmd, 'LaTeX')
+
                cmd = r"dvips -E -o %s %s" % (e + '.eps', e)
                quiet_system (cmd, 'dvips')
-               
+
        for g in png:
                make_pixmap (g)
-               
+
        os.chdir (d)
 
 
@@ -1213,7 +1245,7 @@
                f = open (name , 'w')
                f.write (body)
                f.close ()
-       
+
        return not same
 
 
@@ -1235,14 +1267,14 @@
 
 def option_help_str (o):
        "Transform one option description (4-tuple ) into neatly formatted 
string"
-       sh = '  '       
+       sh = '  '
        if o[1]:
                sh = '-%s' % o[1]
 
        sep = ' '
        if o[1] and o[2]:
                sep = ','
-               
+
        long = ''
        if o[2]:
                long= '--%s' % o[2]
@@ -1365,17 +1397,17 @@
                        dims = bounding_box_dimensions (filename)
 
                        return '%fpt' % (dims[0] *lmag)
-       
+
                body = re.sub (r'''\\lilypondepswidth{(.*?)}''', 
replace_eps_dim, c[1])
                newchunks.append(('lilypond', body, c[2], c[3], c[4]))
-                       
+
        return newchunks
 
 
 ##docme: why global?
 foutn=""
-def do_file(input_filename):
 
+def do_file(input_filename):
        chunks = read_doc_file(input_filename)
        chunks = chop_chunks(chunks, 'lilypond', make_lilypond, 1)
        chunks = chop_chunks(chunks, 'lilypond-file', make_lilypond_file, 1)
@@ -1401,7 +1433,6 @@
        x = 0
        chunks = completize_preamble (chunks)
 
-
        global foutn
 
        if outname:
@@ -1410,8 +1441,8 @@
                my_outname = '-'
        else:
                my_outname = os.path.basename 
(os.path.splitext(input_filename)[0]) + '.' + format
-       my_depname = my_outname + '.dep'                
-       
+       my_depname = my_outname + '.dep'
+
        if my_outname == '-' or my_outname == '/dev/stdout':
                fout = sys.stdout
                foutn = "<stdout>"
@@ -1437,7 +1468,7 @@
        sys.exit(1)
 
 do_deps = 0
-for opt in options:    
+for opt in options:
        o = opt[0]
        a = opt[1]
 
@@ -1494,7 +1525,7 @@
 setup_environment ()
 for input_filename in files:
        do_file(input_filename)
-       
+
 #
 # Petr, ik zou willen dat ik iets zinvoller deed,
 # maar wat ik kan ik doen, het verandert toch niets?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]