Dashed individual staff lines: Difference between revisions

m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
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 &quot;dashedStaffSymbolLines&quot; that replaces specified lines of a <code>StaffSymbol</code> with dashed lines. For example, the following will replace the center line of the staff with a dashed line:
You can customize a staff so that some (or all) of its lines are dashed instead of solid. This snippet defines a command called <code>\dashedStaffSymbolLines</code> that replaces specified lines of a <code>StaffSymbol</code> grob with dashed lines. For example, the following replaces the center line of the staff with a dashed line.


<code>\dashedStaffSymbolLines #'( #f #f #t #f #f )</code>
\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)
A list containing booleans (<code>#t</code> and <code>#f</code>) indicates which lines are to be dashed. (<code>#t</code> means dashed, <code>#f</code> 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):
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 creates wider dashes (1.5) with more space between them (1.2).


<code>\dashedStaffSymbolLines #'(1.5 . 1.2) #'(#f #f #t #f #f)</code>
\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.
The function also works with staves that have different numbers of lines and/or different line positions.


<lilypond version="2.24">
<lilypond version="2.24">
%%http://lsr.di.unimi.it/LSR/Item?id=880
% original code (for zig-zag lines) by Thomas Morley (Harm)
% original code (for zig-zag lines) by Thomas Morley (Harm)
% -> http://lists.gnu.org/archive/html/lilypond-user/2012-12/msg00715.html
% -> http://lists.gnu.org/archive/html/lilypond-user/2012-12/msg00715.html
Line 164: Line 162:
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Scheme]]
[[Category:Scheme]]
[[Category:Symbols and glyphs]]
[[Category:Contemporary notation]]
[[Category:Contemporary notation]]
[[Category:Snippet]]