It struck me that there are more options for dealing with
the "\relative inside \repeat" issue. Can someone look over
this to make sure I'm not doing anything sacrililygious?
- Mark
From c3fad3258734b7632d9e7cde7bb414ca07d593fe Mon Sep 17 00:00:00 2001
From: Mark Polesky <[email protected]>
Date: Tue, 27 Apr 2010 23:33:04 -0700
Subject: [PATCH] Doc: Clarify \relative inside \repeat issue.
---
Documentation/notation/repeats.itely | 58 ++++++++++++++++++++++++++++++++++
Documentation/usage/running.itely | 14 ++------
2 files changed, 62 insertions(+), 10 deletions(-)
diff --git a/Documentation/notation/repeats.itely b/Documentation/notation/repeats.itely
index 9e2b53e..c2f0d2b 100644
--- a/Documentation/notation/repeats.itely
+++ b/Documentation/notation/repeats.itely
@@ -59,6 +59,7 @@ Repeat signs can also be controlled manually.
* Normal repeats::
* Manual repeat marks::
* Written-out repeats::
+* Long repeats and relative mode::
@end menu
@cindex volta
@@ -395,6 +396,63 @@ Internals Reference:
@rinternals{UnfoldedRepeatedMusic}.
+...@node Long repeats and relative mode
+...@unnumberedsubsubsec Long repeats and relative mode
+
+
+If a @code{\relative} command is placed inside 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' { c2 d }
+}
+...@end lilypond
+
+The simplest solution is to move the @code{\relative} command to
+the outside of the @code{\repeat} command:
+
+...@lilypond[quote,verbatim]
+\relative c' {
+ \repeat unfold 2 { c2 d }
+}
+...@end lilypond
+
+However, this only works if the entire section to be repeated uses
+only one @code{\relative} command. If you prefer using multiple
+...@code{\relative} blocks sequentially (which can make complex
+scores easier to manage), you'll need to instantiate the
+...@code{staff} context explicitly (with the @code{\context} command)
+to accommodate the @code{\repeat} command. Note that
+...@samp{\new Staff} will not work here, since that would create a
+new staff with each repeat:
+
+...@lilypond[quote,verbatim]
+\repeat unfold 2 \context Staff {
+ \relative c' { c2 d }
+ \relative d' { d2 c }
+}
+...@end lilypond
+
+Notational elements that span from one @code{\relative} block to
+another require explicitly instantiated voices. And as before,
+...@code{\context} is needed instead of @code{\new} to ensure the
+continuity of the spanned elements:
+
+...@lilypond[quote,verbatim]
+\repeat unfold 2 \context Staff {
+ \context Voice \relative c' { c2 d( }
+ \context Voice \relative e' { e2) c~ }
+}
+...@end lilypond
+
+Many situations will also require these contexts to be
+named, especially when polyphony is involved.
+
+
@node Short repeats
@subsection Short repeats
diff --git a/Documentation/usage/running.itely b/Documentation/usage/running.itely
index 93c0c3a..071e1b0 100644
--- a/Documentation/usage/running.itely
+++ b/Documentation/usage/running.itely
@@ -680,25 +680,19 @@ 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' { c2 d }
}
@end lilypond
-The correct way is to reverse the @code{\repeat} and
-...@code{\relative} commands, like this:
-
-...@lilypond[quote,verbatim]
-\relative c' {
- \repeat unfold 2 { c d e f }
-}
-...@end lilypond
+There are several ways of addressing this, depending on the
+situation. See @ruser{Long repeats and relative mode}.
@node Apparent error in ../ly/init.ly
--
1.6.3.3
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel