The stencil property

This property controls the appearance of the bar lines by specifying the symbol (glyph) that should be printed. In common with many other properties, it can be set to print nothing by setting its value to #f. Let’s try it, as before, omitting the implied context, Voice.

\relative {
  \time 12/16
  \override BarLine.stencil = ##f
  c''4 b8 c d16 c d8 |
  g,8 a16 b8 c d4 e16 |
  e8
}

[image of music]

The bar lines are still printed. What is wrong? Go back to the IR and look again at the page giving the properties of BarLine. At the top of the page it says “BarLine objects are created by: Bar_engraver”. Go to the Bar_engraver page. At the bottom it gives a list of contexts in which the bar engraver operates. All of them are of the type Staff, so the reason the \override command failed to work as expected is because BarLine is not in the default Voice context. If the context is specified incorrectly, the command simply does not work, without producing an error message or warning. Let’s try correcting it by adding the correct context:

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

[image of music]

Now the bar lines have vanished. Setting the stencil property to #f is such a frequent operation that there is a shorthand for it called \omit:

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

[image of music]

Note, though, that setting the stencil property to #f will cause errors when the dimensions of the object are required for correct processing. For example, errors will be generated if the stencil property of the NoteHead object is set to #f. If this is the case, you can instead use the point-stencil function, which sets the stencil to an object with zero size:

\relative {
  c''4 c
  \once \override NoteHead.stencil = #point-stencil
  c4 c
}

[image of music]


LilyPond Learning Manual v2.25.13 (development-branch).