Changing the width of ledger lines: Difference between revisions
Appearance
Import snippet from LSR |
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 |
||
| Line 1: | Line 1: | ||
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 <code>LedgerLineSpanner.length-fraction</code> and (optionally) <code>LedgerLineSpanner.minimum-length-fraction</code>. | 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 <code>LedgerLineSpanner.length-fraction</code> and (optionally) <code>LedgerLineSpanner.minimum-length-fraction</code>. | ||
<lilypond version="2.24 | <lilypond version="2.24"> | ||
% Override LedgerLineSpanner.length-fraction to change the width | % Override LedgerLineSpanner.length-fraction to change the width | ||
% of ledger lines. Its default setting is 0.25 which extends ledger | % of ledger lines. Its default setting is 0.25 which extends ledger | ||
Revision as of 18:44, 16 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
}
>>