Carl Sorensen wrote:
> I disagree with the idea that the simplest solution is to
> move the \relative outside the \repeat.

I've attached a new patch following your suggestions.
Okay to push?

- Mark


      
From 40270827b0ac9ee4500b36038ee9ca83178e6e71 Mon Sep 17 00:00:00 2001
From: Mark Polesky <markpole...@yahoo.com>
Date: Fri, 30 Apr 2010 09:42:15 -0700
Subject: [PATCH] Doc: Clarify \relative inside \repeat issue.

---
 Documentation/notation/repeats.itely |   12 ++++++++--
 Documentation/usage/running.itely    |   36 +++++++++++++++++----------------
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/Documentation/notation/repeats.itely b/Documentation/notation/repeats.itely
index 9e2b53e..113b681 100644
--- a/Documentation/notation/repeats.itely
+++ b/Documentation/notation/repeats.itely
@@ -109,9 +109,10 @@ Normal repeats with alternate endings:
 c1
 @end lilypond
 
-...@warning{do not include @co...@bs{}relative} inside a
-...@code{@bs{}repeat}.  It will cause unwanted staves to appear.
-See @rprogram{An extra staff appears}.}
+...@warning{if you include @co...@bs{}relative} inside a
+...@code{@bs{}repeat} without explicitly instantiating the
+...@code{voice} context, extra (unwanted) staves will appear.  See
+...@rprogram{an extra staff appears}.}
 
 @cindex repeat with upbeat
 @cindex upbeat in a repeat
@@ -385,6 +386,11 @@ c1
 c1
 @end lilypond
 
+...@warning{if you include @co...@bs{}relative} inside a
+...@code{@bs{}repeat} without explicitly instantiating the
+...@code{voice} context, extra (unwanted) staves will appear.  See
+...@rprogram{an extra staff appears}.}
+
 
 @seealso
 Snippets:
diff --git a/Documentation/usage/running.itely b/Documentation/usage/running.itely
index 93c0c3a..eeba9e8 100644
--- a/Documentation/usage/running.itely
+++ b/Documentation/usage/running.itely
@@ -649,17 +649,17 @@ line to break.  For details, see @ruser{Bar lines}.
 @node An extra staff appears
 @unnumberedsubsec An extra staff appears
 
-If contexts are not created explicitly with @code{\new} they will be
-silently created as soon as a command is encountered which cannot
-be applied to an existing context.  In simple scores the automatic
-creation of contexts is useful, and most of the examples in the
-LilyPond manuals take advantage of this simplification.  But
-occasionally the silent creation of contexts can give rise to
-unexpected new staves or scores.  For example, it might be expected
-that the following code would cause all note heads within the
-following staff to be colored red, but in fact it results in two
-staves with the note heads remaining the default black in the lower
-staff.
+If contexts are not created explicitly with @code{\new} or
+...@code{\context}, they will be silently created as soon as a
+command is encountered which cannot be applied to an existing
+context.  In simple scores the automatic creation of contexts is
+useful, and most of the examples in the LilyPond manuals take
+advantage of this simplification.  But occasionally the silent
+creation of contexts can give rise to unexpected new staves or
+scores.  For example, it might be expected that the following code
+would cause all note heads within the following staff to be
+colored red, but in fact it results in two staves with the note
+heads remaining the default black in the lower staff.
 
 @lilypond[quote,verbatim,relative=2]
 \override Staff.NoteHead #'color = #red
@@ -680,23 +680,25 @@ correct code to color all note heads red is
 @end lilypond
 
 As a second example, if a @code{\relative} command is placed inside
-a @code{\repeat} command two staves result, the second offset from
+a @code{\repeat} command, two staves result, the second offset from
 the first, because the @code{\repeat} command generates two
 @code{\relative} blocks, which each implicitly create @code{Staff}
 and @code{Voice} blocks.
 
 @lilypond[quote,verbatim]
 \repeat unfold 2 {
-  \relative c' { c d e f }
+  \relative c' { c4 d e f }
 }
 @end lilypond
 
-The correct way is to reverse the @code{\repeat} and
-...@code{\relative} commands, like this:
+Explicitly instantiating the @code{Voice} context fixes the
+problem:
 
 @lilypond[quote,verbatim]
-\relative c' {
-  \repeat unfold 2 { c d e f }
+\new Voice {
+  \repeat unfold 2 {
+    \relative c' { c4 d e f }
+  }
 }
 @end lilypond
 
-- 
1.6.3.3

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to