Re: PATCH: Doc: Clarify \relative inside \repeat issue.
Hello, Graham Percival wrote: I think the always add explicit {} apart from ones that would surround an entire example might the best way to go; if we encounter any more exceptions to the always use them rule, we can add them later. This guideline has been added to the CG. James ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
Hello, Graham Percival wrote: On Thu, Apr 29, 2010 at 2:24 PM, Carl Sorensen c_soren...@byu.edu wrote: If you want to use the minumum number of { and indentation levels, you can write \context Voice \repeat unfold 2 \relative c' { c2 d } or \context Voice \repeat unfold 2 \relative c' { c2 d } but back when the GDP was established the LilyPond format rules said we needed to use { } even if it wasn't required. I couldn't find this rule in section 3.4.3 of Contributing, so maybe it's gone away. No, that's still around. James, could you add this rule to the CG? I'm still not really clear on what this rule should be from this whole thread. Are you talking about notes within { } when using any LilyPond Command before said notes? Taking a random example in the doc for errr... Chord Repetition, the example is c e g q q q There are no { } there and it seems they would look awkward. { c e g q q q } Does that make sense or have I missed something? James ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
On 5/11/10 10:27 AM, James Lowe james.l...@datacore.com wrote: Hello, Graham Percival wrote: On Thu, Apr 29, 2010 at 2:24 PM, Carl Sorensen c_soren...@byu.edu wrote: If you want to use the minumum number of { and indentation levels, you can write \context Voice \repeat unfold 2 \relative c' { c2 d } or \context Voice \repeat unfold 2 \relative c' { c2 d } but back when the GDP was established the LilyPond format rules said we needed to use { } even if it wasn't required. I couldn't find this rule in section 3.4.3 of Contributing, so maybe it's gone away. No, that's still around. James, could you add this rule to the CG? I'm still not really clear on what this rule should be from this whole thread. Are you talking about notes within { } when using any LilyPond Command before said notes? Taking a random example in the doc for errr... Chord Repetition, the example is c e g q q q There are no { } there and it seems they would look awkward. { c e g q q q } Does that make sense or have I missed something? The rule is you need to follow a call to a new context with { \new Voice { In the case of the snippet you mention, {} are required around the snippet in order to get it to compile, but those are automatically added, as is described in the Learning Manual. In the example above: \context Voice \repeat unfold 2 \relative c' {c2 d}, \relative c' { c2 d } is a single music expression, so it doesn't need {} around it to turn it into a sequence in order to work with \repeat unfold 2. Similarly, \repeat unfold 2 music is a single music expression, so it doesn't need {} to turn it into a sequence to work with \relative c'. But in order to avoid the confusion that can arise, the GDP standards say that even a single music expression should be surrounded by {} when is is an argument to a lilypond command or music function. So we would go \context Voice {% { not strictly needed by LilyPond syntax \repeat unfold 2 {% { not strictly needed \relative c' { % { needed; c2 d is *not* a single music expression c2 d } } } HTH, Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
On 5/11/10 10:40 AM, Carl Sorensen c_soren...@byu.edu wrote: In the example above: \context Voice \repeat unfold 2 \relative c' {c2 d}, \relative c' { c2 d } is a single music expression, so it doesn't need {} around it to turn it into a sequence in order to work with \repeat unfold 2. Similarly, \repeat unfold 2 music is a single music expression, so it doesn't need {} to turn it into a sequence to work with \relative c'. Oops -- I had a thinko there: s/\\relative c'/\\context Voice/ in the final sentence above. But in order to avoid the confusion that can arise, the GDP standards say that even a single music expression should be surrounded by {} when is is an argument to a lilypond command or music function. So we would go \context Voice {% { not strictly needed by LilyPond syntax \repeat unfold 2 {% { not strictly needed \relative c' { % { needed; c2 d is *not* a single music expression c2 d } } } HTH, Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
(sorry for the excessive quoting, but it's relevant) On Tue, May 11, 2010 at 05:27:02PM +0100, James Lowe wrote: Graham Percival wrote: On Thu, Apr 29, 2010 at 2:24 PM, Carl Sorensen c_soren...@byu.edu wrote: If you want to use the minumum number of { and indentation levels, you can write \context Voice \repeat unfold 2 \relative c' { c2 d } or \context Voice \repeat unfold 2 \relative c' { c2 d } but back when the GDP was established the LilyPond format rules said we needed to use { } even if it wasn't required. I couldn't find this rule in section 3.4.3 of Contributing, so maybe it's gone away. No, that's still around. James, could you add this rule to the CG? I'm still not really clear on what this rule should be from this whole thread. Are you talking about notes within { } when using any LilyPond Command before said notes? Taking a random example in the doc for errr... Chord Repetition, the example is c e g q q q There are no { } there and it seems they would look awkward. { c e g q q q } Does that make sense or have I missed something? Hmm. Maybe the rule should be Always use { } in conjuction with a \new or \context ? or maybe Always use { }, even if they aren't required, other than the ones that would surround the entire example if we didn't use the [fragment] option ? Trouble is, I'm not certain which commands we require the {} for, in addition to \new and \context, but I have the feeling there were a few. I mean, given an example, I could unambiguously state them... oh, hey, there's \relative and \transpose as well... but I'm not confident in giving the entire list. I think the always add explicit {} apart from ones that would surround an entire example might the best way to go; if we encounter any more exceptions to the always use them rule, we can add them later. Cheers, - Graham ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
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
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
LGTM Trevor - Original Message - From: Mark Polesky markpole...@yahoo.com To: Carl Sorensen c_soren...@byu.edu; Graham Percival gra...@percival-music.ca Cc: lilypond-devel lilypond-devel@gnu.org Sent: Friday, April 30, 2010 5:46 PM Subject: Re: PATCH: Doc: Clarify \relative inside \repeat issue. 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 ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
Looks good to me. As a matter of fact, I really like it. Carl On 4/30/10 10:46 AM, Mark Polesky markpole...@yahoo.com wrote: 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 ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
On 4/29/10 1:42 AM, Mark Polesky markpole...@yahoo.com wrote: Carl, you didn't reply to all, but here's my response anyway: Oh, I'm sorry. I didn't mean to not reply to all. Thanks for covering for me. - Mark Carl Sorensen wrote: I disagree with the idea that the simplest solution is to move the \relative outside the \repeat. Well, I disagree too, but the wording currently in the docs is even stronger: The correct way is to reverse the \repeat and \relative commands... -- AU 1.4 Common errors * An extra staff appears This changes the music. Good point. I think the simplest solution is to explicitly declare the Voice: \context Voice { \repeat unfold 2 { \relative c' { c2 d } } } Nice. But wouldn't the code below be just as good? It would prevent an extra level of {...}, along with the additional indentation: \repeat unfold 2 \context Voice { \relative c' { c d } } Personally, I think that it's better to put the \context Voice outside, but this way works as well. If you want to use the minumum number of { and indentation levels, you can write \context Voice \repeat unfold 2 \relative c' { c2 d } or \context Voice \repeat unfold 2 \relative c' { c2 d } but back when the GDP was established the LilyPond format rules said we needed to use { } even if it wasn't required. I couldn't find this rule in section 3.4.3 of Contributing, so maybe it's gone away. Perhaps we need a (sub)section in Notation on implicit Staff and Voice creation that explains the LilyPond constructs that cause implicit Staff creation so that users can know what to look for. What about AU 1.4 Common errors * An extra staff appears ? Perfect! Thanks, Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
Sending to list for completeness. On 4/28/10 12:39 AM, Mark Polesky markpole...@yahoo.com wrote: 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? In my opinion, the tone of your addition is more Learning Manual than Notation Reference. I disagree with the idea that the simplest solution is to move the \relative outside the \repeat. This changes the music. Consider \relative c' { \repeat unfold 2 { c d e f g } } as opposed to \repeat unfold 2 { \relative c' { c d e f g } } The notes will be different in these two cases. I think the simplest solution is to explicitly declare the Voice: \context Voice { \repeat unfold 2 { \relative c' { c2 d } } } works just fine. And this is a *consistent* solution. Any time unexpected staffs show up, the solution is to explicitly declare a Voice or a Staff. SO I'd prefer to just teach the simple solution, and I'd probably move it to the Troubleshooting section. I don't think it's worth a section in repeats, when the problem occurs in other places as well. Perhaps we need a (sub)section in Notation on implicit Staff and Voice creation that explains the LilyPond constructs that cause implicit Staff creation so that users can know what to look for. Thanks, Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
On Thu, Apr 29, 2010 at 2:24 PM, Carl Sorensen c_soren...@byu.edu wrote: If you want to use the minumum number of { and indentation levels, you can write \context Voice \repeat unfold 2 \relative c' { c2 d } or \context Voice \repeat unfold 2 \relative c' { c2 d } but back when the GDP was established the LilyPond format rules said we needed to use { } even if it wasn't required. I couldn't find this rule in section 3.4.3 of Contributing, so maybe it's gone away. No, that's still around. James, could you add this rule to the CG? Cheers, - Graham ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
PATCH: Doc: Clarify \relative inside \repeat issue.
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 markpole...@yahoo.com 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 lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: PATCH: Doc: Clarify \relative inside \repeat issue.
On Tue, Apr 27, 2010 at 11:39:27PM -0700, Mark Polesky wrote: 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? As usual, I have no insights about the content, but in case there's any doubt, the formatting is great and can be pushed at any time that you're confident about the content. Cheers, - Graham ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel