Changing the width of ledger lines: Difference between revisions
Appearance
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 |
m New category Tags: Mobile edit Mobile web edit |
||
| (One intermediate revision by the same user not shown) | |||
| Line 39: | Line 39: | ||
[[Category:Tweaks and overrides]] | [[Category:Tweaks and overrides]] | ||
[[Category:Snippet]] | |||
Latest revision as of 23:17, 21 November 2025
If you want to modify the width of ledger lines (for example to make them wider) you can do this by overriding the values of LedgerLineSpanner.length-fraction and (optionally) LedgerLineSpanner.minimum-length-fraction.
\version "2.24"
% Override LedgerLineSpanner.length-fraction to change the width
% of ledger lines. Its default setting is 0.25 which extends ledger
% lines beyond the note head on each side by 0.25 times the width
% of the note head. (1.0 is equal to the width of the note head.)
%
% LilyPond will automatically shorten ledger lines to avoid collisions.
% LedgerLineSpanner.minimum-length-fraction sets their minimum
% length (i.e. smallest possible length) for such cases of potential
% collision. It guarantees that ledger lines will always be at least
% that wide. Its default setting is 0.25 (It should always be less
% than or equal to the value of LedgerLineSpanner.length-fraction.)
%
% See the illustrations here:
% http://lilypond.1069038.n5.nabble.com/Widening-ledger-lines-by-overriding-LedgerLineSpanner-td162842.html#a162850
notes = {
d4 e f g
c''' d''' e''' f'''
}
<<
\new Staff \with {
instrumentName = "default "
} {
\notes
}
\new Staff \with {
instrumentName = "wider "
\override LedgerLineSpanner.length-fraction = #0.45
\override LedgerLineSpanner.minimum-length-fraction = #0.45
} {
\notes
}
>>