Jump to content

Dashed individual staff lines: Difference between revisions

From LilyPond wiki
No edit summary
m New category
Tags: Mobile edit Mobile web edit
Line 165: Line 165:
[[Category:Scheme]]
[[Category:Scheme]]
[[Category:Symbols and glyphs]]
[[Category:Symbols and glyphs]]
[[Category:Contemporary notation]][[Category:Snippet]]
[[Category:Contemporary notation]]
[[Category:Snippet]]

Revision as of 23:28, 21 November 2025

You can customize a staff so that some (or all) of its lines are dashed instead of solid. This snippet defines a music function called "dashedStaffSymbolLines" that replaces specified lines of a StaffSymbol with dashed lines. For example, the following will replace the center line of the staff with a dashed line:

\dashedStaffSymbolLines #'( #f #f #t #f #f )

A list containing booleans (#t and #f) indicates which lines are to be dashed. (#t means dashed, #f means normal and unchanged)

The width of the dashes and the spacing between them can optionally be customized by adding a pair of values as the first argument when calling the function. The first number of the pair is the width, the second is the spacing. (The default is 0.5 for both.) The following will create wider dashes (1.5) with more space between them (1.2):

\dashedStaffSymbolLines #'(1.5 . 1.2) #'(#f #f #t #f #f)

The function also works with staves that have different numbers of lines and/or different line positions.

LilyPond rendering error

No release of LilyPond 2.24 found.