Jump to content

Removing the first empty line: Difference between revisions

From LilyPond wiki
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:
The first empty staff can also be removed from the score by setting the <code>VerticalAxisGroup</code> property <code>remove-first</code>. This can be done globally inside the <code>\layout</code> block, or locally inside the specific staff that should be removed. In the latter case, you have to specify the context (<code>Staff</code> applies only to the current staff) in front of the property.
To remove the first empty staff from a score, set the <code>remove-first</code> property of the <code>VerticalAxisGroup</code> grob to <code>#t</code>. This can be done globally inside the <code>\layout</code> block or locally inside the specific staff that should be removed. In the latter case, you have to specify the context (<code>Staff</code> applies only to the current staff) in front of the property.


The lower staff of the second staff group is not removed, because the setting applies only to the specific staff inside of which it is written.
The lower staff of the second staff group is not removed, because the setting applies only to the specific staff inside of which it is written.


<lilypond version="2.24" full>
<lilypond version="2.24">
\layout {
\layout {
   \context {  
   \context {  
Line 24: Line 24:
   }
   }
>>
>>
\new StaffGroup <<
\new StaffGroup <<
   \new Staff \relative c' {
   \new Staff \relative c' {
Line 34: Line 35:
   }
   }
>>
>>
\paper { tagline = ##f }
</lilypond>
</lilypond>


[[Category:Breaks]]
[[Category:Staff notation]]
[[Category:Staff notation]]
[[Category:Staff notation]]
[[Category:Breaks]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 19:45, 10 December 2025

To remove the first empty staff from a score, set the remove-first property of the VerticalAxisGroup grob to #t. This can be done globally inside the \layout block or locally inside the specific staff that should be removed. In the latter case, you have to specify the context (Staff applies only to the current staff) in front of the property.

The lower staff of the second staff group is not removed, because the setting applies only to the specific staff inside of which it is written.

\version "2.24"

\layout {
  \context { 
    \Staff \RemoveEmptyStaves 
    % To use the setting globally, uncomment the following line:
    % \override VerticalAxisGroup.remove-first = ##t
  }
}
\new StaffGroup <<
  \new Staff \relative c' {
    e4 f g a \break
    c1
  }
  \new Staff {
    % To use the setting globally, comment this line,
    % uncomment the line in the \layout block above
    \override Staff.VerticalAxisGroup.remove-first = ##t
    R1 \break
    R
  }
>>

\new StaffGroup <<
  \new Staff \relative c' {
    e4 f g a \break
    c1
  }
  \new Staff {
    R1 \break
    R
  }
>>