lilypond-user
[Top][All Lists]
Advanced

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

Re: Lilypond structure / implicit - explicit / with statement


From: Noeck
Subject: Re: Lilypond structure / implicit - explicit / with statement
Date: Mon, 4 Apr 2016 22:06:48 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

Hi Bernard,

I would like to try and explain it in other words as the manual:

music with implicit voice and staff:
{ c' }

music with explicit staff and implicit voice:
\new Staff { c' }

adding a with statement:
\new Staff \with { clefPosition = 2 } { c' }

Please note here: There must be no { after Staff, because that would
start a music expression. The braces are not just for grouping things
but they start a music expression and \with must come before the music
starts. Think of it as a function, if the first argument starts with {
it is music and not a \with block:

\new Staff   \with { clefPosition = 2 }     { c' }
^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^^^^^^^^^     ^^^^^^
function     optional argument (not music)  music

Alternatively, you can put this into a layout block:

\layout {
  \context {
    \Staff
    clefPosition = 2
  }
}
%or
\layout {
  \set Staff.clefPosition = 2
}



## Contexts and objects

Contexts are different from graphical objects and their properties
(prop) are changed differently (explained in the docs). Just a summary
here (val means value):

contexts (Staff, Voice, …) Ctx  |  graphical objects (Clef, …) obj
-----------------------------------------------------------------------
in music:
{ \set Ctx.prop = val }         | { \override Ctx.obj.prop = val }

in with block:
\with { prop = val }            | \with { \override Ctx.obj.prop = val }

in layout block (variant 1):
\layout { \context { \Ctx       | \layout { \context { \Ctx
  prop = val }                  |   \override obj.prop = val }

in layout block (variant 2):
\layout { \set Ctx.prop = val } | \layout{\override Ctx.obj.prop = val }


td;dr: (1) be careful with {}
       (2) read the input as functions with some optional arguments
       (3) context properties and object properties are different

HTH,
Joram


PS: I know you said you won't try any longer, but perhaps this will help
someone.



reply via email to

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