I know others have answered, but here's my take.  A pair of curly braces { } 
enclose a block of code.  That block usually has a command of some sort that 
applies to it.  So 

  \relative c' { c4 c c c }

would mean that the \relative command applies to all 4 notes within the braces. 
 It's quite common to have blocks of code within blocks of code.  So - if we 
have a new staff and some music relative to c' within it, we could write:

 \new Staff { \relative c' { c4 c c c } }

This can happen with many blocks-within-blocks.  So to try to make it clearer 
where the blocks are, it's standard practice to indent each block of code.  So 
the code I wrote above would become:

\new Staff {
  \relative c' {
    c4 c c c
  }
}

So the lowest brace lines up with the \new and the one higher lines up with the 
\relative, and it's not too hard to see how the braces match.  But this is only 
a convention - LilyPond doesn't care about indents and lining up in the 
slightest - she simply requires that the braces match up to form proper blocks.

Hope that helps.

--
Phil Holmes


  ----- Original Message ----- 
  From: Seth Williamson 
  To: lilypond-user Mailinglist 
  Sent: Monday, January 24, 2011 9:07 PM
  Subject: Understanding herd of curly braces


  I have turned out a few simple jobs with LilyPond, mainly simple copying jobs 
just for practice and -- as a practical matter -- a few pieces that I needed to 
transpose into another key.


  However, as I look at LilyPond code generated by others, it's not obvious to 
me (usually near the end of a document) what each closing curly brace refers to.


  Am I even SUPPOSED to be able to figure that out by looking at all the closed 
curly braces, usually at different indentations on different lines?  Are you 
supposed to see these things and know to what they apply in the code above?  Is 
there a logic here that I'm missing?


  I am trying to figure out the logic of why the close braces (in particular) 
appear where they are and at a given indentation.  So far there's nothing 
intuitive about it.


  Such documentation as I've been able to find at the LilyPond site and 
elsewhere has been of limited utility in this regard.


  Is this something you just learn by doing?  Or can anybody help me out?


  Seth Williamson


------------------------------------------------------------------------------


  _______________________________________________
  lilypond-user mailing list
  [email protected]
  http://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to