Key signatures for small staves: 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 |
Revised. |
||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
Traditionally, smaller staves | Traditionally, the spacing of key signatures in smaller staves is larger in comparison to full-size staves. | ||
Here | Here is a function that extends <code>\magnifyStaff</code> to automatically calculate the right key signature spacing according to the staff size. | ||
<lilypond version="2.24" | <lilypond version="2.24"> | ||
scaleStaff = | |||
#(define-music-function (scaleFac) (number?) | |||
#{ | #{ | ||
\ | \magnifyStaff #scaleFac | ||
\override KeySignature.padding = #(* 2/3 (- 1 scaleFac)) | |||
\override KeySignature.padding = #(* 2/3 (- 1 | |||
#}) | #}) | ||
| Line 21: | Line 15: | ||
\markup\italic "Default output:" | \markup\italic "Default output:" | ||
<< | << | ||
\new Staff \with { | \new Staff \with { \magnifyStaff #5/7 } \keyTest | ||
\new Staff \keyTest | |||
\new Staff \keyTest | |||
>> | >> | ||
\markup\italic "Traditional output:" | \markup\italic "Traditional output:" | ||
<< | << | ||
\new Staff \with { \ | \new Staff \with { \scaleStaff #5/7 } \keyTest | ||
scaleStaff | |||
\new Staff \keyTest | \new Staff \keyTest | ||
>> | >> | ||
</lilypond> | </lilypond> | ||
| Line 61: | Line 29: | ||
[[Category:Vocal music]] | [[Category:Vocal music]] | ||
[[Category:Spacing]] | [[Category:Spacing]] | ||
[[Category:Tweaks and overrides]] | [[Category:Tweaks and overrides]] | ||
[[Category:Specific notation]] | [[Category:Specific notation]] | ||
[[Category:Workaround]] | [[Category:Workaround]] | ||
[[Category:Snippet]] | |||
Latest revision as of 18:11, 18 March 2026
Traditionally, the spacing of key signatures in smaller staves is larger in comparison to full-size staves.
Here is a function that extends \magnifyStaff to automatically calculate the right key signature spacing according to the staff size.
\version "2.24"
scaleStaff =
#(define-music-function (scaleFac) (number?)
#{
\magnifyStaff #scaleFac
\override KeySignature.padding = #(* 2/3 (- 1 scaleFac))
#})
keyTest = { \key cis\major s4*4 \bar "" }
\markup\italic "Default output:"
<<
\new Staff \with { \magnifyStaff #5/7 } \keyTest
\new Staff \keyTest
>>
\markup\italic "Traditional output:"
<<
\new Staff \with { \scaleStaff #5/7 } \keyTest
\new Staff \keyTest
>>