Jump to content

Vertically aligned StaffGroups without connecting SystemStartBar: Difference between revisions

From LilyPond wiki
m New category
Tags: Mobile edit Mobile web edit
m Reduce staff size to make it fit one system in PDF documentation.
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
This snippet shows how to achieve vertically aligned <code>StaffGroups</code> with a <code>SystemStartBar</code> for each <code>StaffGroup</code>, but without connecting them.
This snippet shows how to achieve vertically aligned <code>StaffGroups</code> with a <code>SystemStartBar</code> for each <code>StaffGroup</code>, but without connecting them.
Note that this only works properly for music that can be printed as a single system.


<lilypond version="2.24" full>
<lilypond version="2.24" full>
#(set-global-staff-size 18)
#(set-global-staff-size 15)
 
\header { tagline = ##f }


\paper {
\paper {
  indent = 0
   ragged-right = ##f
   ragged-right = ##f
   print-all-headers = ##t
   print-all-headers = ##t
  tagline = ##f
}
}


Line 43: Line 43:
% First StaffGroup "exercise"
% First StaffGroup "exercise"


eI =
eI = \relative c' {
\relative c' {
   \textMark \markup {
   \textMark \markup {
          \bold Teacher:
    \bold Teacher:
          This is a simple setting of the choral. Please improve it.
    This is a simple setting of the choral. Please improve it. }
          }
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
   \voiceOne
   \voiceOne
    
    
   \partial 4
   \partial 4 e4
  e4
   a b c b
   a b c b
   a b gis2
   a b gis2
Line 63: Line 60:
}
}


eII =
eII = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
   \voiceTwo
   \voiceTwo
   \partial 4
   \partial 4 c4
  c4
   e e e gis
   e e e gis
   a f e2
   a f e2
Line 78: Line 73:
}
}


eIII =
eIII = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
Line 85: Line 79:
   \voiceOne
   \voiceOne
    
    
   \partial 4
   \partial 4 a4
  a4
   c b a b
   c b a b
   c d b2
   c d b2
Line 94: Line 87:
}
}


eIV =
eIV = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
Line 101: Line 93:
   \voiceTwo
   \voiceTwo
    
    
   \partial 4
   \partial 4 a,4
  a,4
   a' gis a e
   a' gis a e
   a, d e2
   a, d e2
Line 111: Line 102:
}
}


exercise =
exercise = \new StaffGroup = "exercise" <<
\new StaffGroup = "exercise"
   \new Staff <<
<<
    \new Voice \eI
 
    \new Voice \eII
   \new Staff
  >>
    <<
      \new Voice \eI
      \new Voice \eII
    >>


   \new Lyrics \txt
   \new Lyrics \txt


   \new Staff
   \new Staff <<
    <<
    \new Voice \eIII
      \new Voice \eIII
    \new Voice \eIV
      \new Voice \eIV
  >>
    >>
>>
>>


% Second StaffGroup "simple Bach"
% Second StaffGroup "simple Bach"


sbI =
sbI = \relative c' {
\relative c' {
   \textMark \markup { \bold" Pupil:" Here's my version! }
   \textMark \markup { \bold" Pupil:" Here's my version! }
   \key a \minor
   \key a \minor
Line 139: Line 125:
   \voiceOne
   \voiceOne
    
    
   \partial 4
   \partial 4 e4
  e4
   a b c b
   a b c b
   a b gis2
   a b gis2
Line 149: Line 134:
}
}


sbII =
sbII = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
   \voiceTwo
   \voiceTwo
   \partial 4
   \partial 4 c8 d
  c8 d
   e4 e e8 f g4
   e4 e e8 f g4
   f f e2
   f f e2
Line 164: Line 147:
}
}


sbIII =
sbIII = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
Line 171: Line 153:
   \voiceOne
   \voiceOne
    
    
   \partial 4
   \partial 4 a8 b
  a8 b
   c4 b a b8 c
   c4 b a b8 c
   d4 d8 c b2
   d4 d8 c b2
Line 180: Line 161:
}
}


sbIV =
sbIV = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
Line 187: Line 167:
   \voiceTwo
   \voiceTwo
    
    
   \partial 4
   \partial 4 a,4
  a,4
   a' gis a e
   a' gis a e
   f8 e d4 e2
   f8 e d4 e2
Line 197: Line 176:
}
}


simpleBach =
simpleBach = \new StaffGroup = "simple Bach" <<
\new StaffGroup = "simple Bach"
   \new Staff <<
<<
    \new Voice \sbI
 
    \new Voice \sbII
   \new Staff
  >>
    <<
      \new Voice \sbI
      \new Voice \sbII
    >>


   \new Lyrics \txt
   \new Lyrics \txt


   \new Staff
   \new Staff <<
    <<
    \new Voice \sbIII
      \new Voice \sbIII
    \new Voice \sbIV
      \new Voice \sbIV
  >>
    >>
>>
>>


% Third StaffGroup "chromatic Bach"
% Third StaffGroup "chromatic Bach"


cbI =
cbI = \relative c' {
\relative c' {
   \textMark \markup {
   \textMark \markup {
     \bold "Teacher:"
     \bold "Teacher:"
Line 231: Line 205:
   \voiceOne
   \voiceOne
    
    
   \partial 4
   \partial 4 e4
  e4
   a b c b
   a b c b
   a b gis4. fis8
   a b gis4. fis8
Line 241: Line 214:
}
}


cbII =
cbII = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
   \voiceTwo
   \voiceTwo
   \partial 4
 
  c8 d
   \partial 4 c8 d
   e4 e e8 fis gis4
   e4 e e8 fis gis4
   a8 g! f!4 e2
   a8 g! f!4 e2
Line 256: Line 228:
}
}


cbIII =
cbIII = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
Line 263: Line 234:
   \voiceOne
   \voiceOne
    
    
   \partial 4
   \partial 4 a8 b
  a8 b
   c[ b] a gis8 a4 d,
   c[ b] a gis8 a4 d,
   e8[ e'] d c b4. a8
   e8[ e'] d c b4. a8
Line 272: Line 242:
}
}


cbIV =
cbIV = \relative c' {
\relative c' {
   \key a \minor
   \key a \minor
   \time 4/4
   \time 4/4
Line 279: Line 248:
   \voiceTwo
   \voiceTwo
    
    
   \partial 4
   \partial 4 a4
  a4
   c, e a, b
   c, e a, b
   c d e2
   c d e2
Line 289: Line 257:
}
}


chromaticBach =
chromaticBach = \new StaffGroup = "chromatic Bach" <<
\new StaffGroup = "chromatic Bach"
   \new Staff <<
<<
    \new Voice \cbI
 
    \new Voice \cbII
   \new Staff
  >>
    <<
      \new Voice \cbI
      \new Voice \cbII
    >>


   \new Lyrics \txt
   \new Lyrics \txt


   \new Staff
   \new Staff <<
    <<
    \new Voice \cbIII
      \new Voice \cbIII
    \new Voice \cbIV
      \new Voice \cbIV
  >>
    >>
>>
>>


Line 319: Line 282:
    
    
   \header {
   \header {
     title = \markup
     title = \markup \column {
              \column {
              \combine \null \vspace #1
                \combine \null \vspace #1
              "Exercise: Improve the given choral"
                "Exercise: Improve the given choral"
              " "
                " "
            }
                }
   }
   }
   \layout {
   \layout {
     \context {
     \context {
Line 335: Line 298:
</lilypond>
</lilypond>


[[Category:Paper and layout]]
[[Category:Staff notation]]
[[Category:Staff notation]]
[[Category:Syntax and expressions]]
[[Category:Syntax and expressions]]
[[Category:Paper and layout]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]
[[Category:Snippet]]

Latest revision as of 10:16, 11 December 2025

This snippet shows how to achieve vertically aligned StaffGroups with a SystemStartBar for each StaffGroup, but without connecting them.

Note that this only works properly for music that can be printed as a single system.

\version "2.24"

#(set-global-staff-size 15)

\paper {
  ragged-right = ##f
  print-all-headers = ##t
  tagline = ##f
}

\layout {
  \context {
    \StaffGroup
    \consists Text_mark_engraver
    \consists Staff_collecting_engraver
    systemStartDelimiterHierarchy =
      #'(SystemStartBrace (SystemStartBracket a b))
  }

  \context {
    \Score
    \remove Text_mark_engraver
    \remove Staff_collecting_engraver
    \override SystemStartBrace.style = #'bar-line
    \omit SystemStartBar
    \override SystemStartBrace.padding = #-0.1
    \override SystemStartBrace.thickness = #1.6
    \override StaffGrouper.staffgroup-staff-spacing.basic-distance = #15
  }
}

%%%% EXAMPLE

txt =
\lyricmode {
  Wer4 nur den lie -- ben Gott läßt wal2 -- ten4
  und4 hof -- fet auf ihn al -- le Zeit2.
}

% First StaffGroup "exercise"

eI = \relative c' {
  \textMark \markup {
    \bold Teacher:
    This is a simple setting of the choral. Please improve it. }
  \key a \minor
  \time 4/4
  \voiceOne
  
  \partial 4 e4
  a b c b
  a b gis2
  e4\fermata g! g f
  e a a gis
  a2.\fermata
  \bar ":|."
}

eII = \relative c' {
  \key a \minor
  \time 4/4
  \voiceTwo
  \partial 4 c4
  e e e gis
  a f e2
  b4 b d d
  c c d d
  c2.
  \bar ":|."
}

eIII = \relative c' {
  \key a \minor
  \time 4/4
  \clef bass
  \voiceOne
  
  \partial 4 a4
  c b a b
  c d b2
  gis4 g g b
  c a f e
  e2.
}

eIV = \relative c' {
  \key a \minor
  \time 4/4
  \clef bass
  \voiceTwo
  
  \partial 4 a,4
  a' gis a e
  a, d e2
  e,4\fermata e' b g
  c f d e
  a,2.\fermata
  \bar ":|."
}

exercise = \new StaffGroup = "exercise" <<
  \new Staff <<
    \new Voice \eI
    \new Voice \eII
  >>

  \new Lyrics \txt

  \new Staff <<
    \new Voice \eIII
    \new Voice \eIV
  >>
>>


% Second StaffGroup "simple Bach"

sbI = \relative c' {
  \textMark \markup { \bold" Pupil:" Here's my version! }
  \key a \minor
  \time 4/4
  \voiceOne
  
  \partial 4 e4
  a b c b
  a b gis2
  e4\fermata g! g f
  e a a gis
  a2.\fermata
  \bar ":|."
}

sbII = \relative c' {
  \key a \minor
  \time 4/4
  \voiceTwo
  \partial 4 c8 d
  e4 e e8 f g4
  f f e2
  b4 b8 c d4 d
  e8 d c4 b8 c d4
  c2.
  \bar ":|."
}

sbIII = \relative c' {
  \key a \minor
  \time 4/4
  \clef bass
  \voiceOne
  
  \partial 4 a8 b
  c4 b a b8 c
  d4 d8 c b2
  gis4 g g8 a b4
  b a8 g f4 e
  e2.
}

sbIV = \relative c' {
  \key a \minor
  \time 4/4
  \clef bass
  \voiceTwo
  
  \partial 4 a,4
  a' gis a e
  f8 e d4 e2
  e,4\fermata e' b a8 g
  c4 f8 e d4 e
  a,2.\fermata
  \bar ":|."
}

simpleBach = \new StaffGroup = "simple Bach" <<
  \new Staff <<
    \new Voice \sbI
    \new Voice \sbII
  >>

  \new Lyrics \txt

  \new Staff <<
    \new Voice \sbIII
    \new Voice \sbIV
  >>
>>


% Third StaffGroup "chromatic Bach"

cbI = \relative c' {
  \textMark \markup {
    \bold "Teacher:"
    \column {
      "Well, you simply copied and transposed a version of J.S.Bach."
      "Do you know this one?"
    }
  }
  \key a \minor
  \time 4/4
  \voiceOne
  
  \partial 4 e4
  a b c b
  a b gis4. fis8
  e4\fermata g! g f
  e a a8 b gis4
  a2.\fermata
  \bar ":|."
}

cbII = \relative c' {
  \key a \minor
  \time 4/4
  \voiceTwo

  \partial 4 c8 d
  e4 e e8 fis gis4
  a8 g! f!4 e2
  b4 e e d
  d8[ cis] d dis e fis e4
  e2.
  \bar ":|."
}

cbIII = \relative c' {
  \key a \minor
  \time 4/4
  \clef bass
  \voiceOne
  
  \partial 4 a8 b
  c[ b] a gis8 a4 d,
  e8[ e'] d c b4. a8
  gis4 b c d8 c
  b[ a] a b c b b c16 d
  c2.
}

cbIV = \relative c' {
  \key a \minor
  \time 4/4
  \clef bass
  \voiceTwo
  
  \partial 4 a4
  c, e a, b
  c d e2
  e4\fermata e a b8 c
  gis[ g] fis f e dis e4
  a,2.\fermata
  \bar ":|."
}

chromaticBach = \new StaffGroup = "chromatic Bach" <<
  \new Staff <<
    \new Voice \cbI
    \new Voice \cbII
  >>

  \new Lyrics \txt

  \new Staff <<
    \new Voice \cbIII
    \new Voice \cbIV
  >>
>>


% Score

\score {
  <<
    \exercise
    \simpleBach
    \chromaticBach
  >>
  
  \header {
    title = \markup \column {
              \combine \null \vspace #1
              "Exercise: Improve the given choral"
              " "
            }
  }

  \layout {
    \context {
      \Lyrics
      \override LyricText.X-offset = #-1
    }
  }
}