Jump to content

Adding an extra staff at a line break: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
When adding a new staff at a line break, some extra space is unfortunately added at the end of the line before the break (to fit in a key signature change, which will never be printed anyway). The workaround is to add a setting of <code>Staff.explicitKeySignatureVisibility</code> as is shown in the example.
When adding a new staff at a line break, some extra space is unfortunately added at the end of the line before the break (to fit in a key signature change, which will never be printed anyway). The workaround is to set the <code>explicitKeySignatureVisibility</code> property of the <code>Staff</code> grob as is shown in the example.
 
<lilypond version="2.24.0" full>
\paper { tagline = ##f }


<lilypond version="2.24">
\score {
\score {
   \new StaffGroup \relative c'' {
   \new StaffGroup \relative c'' {
Line 19: Line 17:
     << { c1 | c }
     << { c1 | c }
       \new Staff {
       \new Staff {
         \once \set Staff.explicitKeySignatureVisibility = #end-of-line-invisible
         \once \set Staff.explicitKeySignatureVisibility =
          #end-of-line-invisible
         \key f \major
         \key f \major
         \once \omit Staff.TimeSignature
         \once \omit Staff.TimeSignature
Line 29: Line 28:
</lilypond>
</lilypond>


[[Category:Staff notation]]
[[Category:Staff notation]]
[[Category:Breaks]]
[[Category:Breaks]]
[[Category:Contexts and engravers]]
[[Category:Contexts and engravers]]
[[Category:Staff notation]]
[[Category:Workaround]]
[[Category:Workaround]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 07:53, 5 December 2025

When adding a new staff at a line break, some extra space is unfortunately added at the end of the line before the break (to fit in a key signature change, which will never be printed anyway). The workaround is to set the explicitKeySignatureVisibility property of the Staff grob as is shown in the example.

\version "2.24"

\score {
  \new StaffGroup \relative c'' {
    \new Staff
    \key f \major
    c1 c^"Unwanted extra space" \break
    << { c1 | c }
       \new Staff {
         \key f \major
         \once \omit Staff.TimeSignature
         c1 | c
       } 
    >>
    c1 | c^"Fixed here" \break
    << { c1 | c }
       \new Staff {
         \once \set Staff.explicitKeySignatureVisibility =
           #end-of-line-invisible
         \key f \major
         \once \omit Staff.TimeSignature
         c1 | c
       }
    >>
  }
}