The transparent property

We see from the properties specified in the grob-interface page in the IR that the transparent property is a Boolean. This should be set to #t to make the grob transparent. In this next example let us make the time signature invisible rather than the bar lines. To do this we need to find the grob name for the time signature. Back to the ‘All layout objects’ page in the IR to find the properties of the TimeSignature layout object. This is produced by the Time_signature_engraver; you can check that it also lives in the Staff context and also supports the grob-interface. So the command to make the time signature transparent is

\relative {
  \time 12/16
  \override Staff.TimeSignature.transparent = ##t
  c''4 b8 c d16 c d8 |
  g,8 a16 b8 c d4 e16 |
  e8
}

[image of music]

Again, setting the transparent property is a rather frequent operation, so we have a shorthand for it called \hide.

\relative {
  \time 12/16
  \hide Staff.TimeSignature
  c''4 b8 c d16 c d8 |
  g,8 a16 b8 c d4 e16 |
  e8
}

[image of music]

In either case, the time signature is gone, but this command leaves a gap where the time signature should be. Maybe this is what is wanted for an exercise for the student to fill it in, but in other circumstances a gap might be undesirable. To remove it, the stencil for the time signature should be set to #f instead:

\relative {
  \time 12/16
  \omit Staff.TimeSignature
  c''4 b8 c d16 c d8 |
  g,8 a16 b8 c d4 e16 |
  e8
}

[image of music]

and the difference is obvious: setting the stencil to #f (possibly via \omit) removes the object entirely; making the object transparent (which can be done using \hide) leaves it where it is, but makes it invisible.


LilyPond 学习手册 v2.25.21 (开发分支).