5

I'm truing to use different staff sizes for different scores or at least book-parts in LilyPond "2.18.2".

There is a question on here about setting the staff-size globally, which does not solve my problem. The answer is linking to the "2.19" sollution in which you can use the #(layout-set-staff-size NN) within a \layout block. This does not work in "2.18.2":

\version "2.18.2"

\score {
  \relative c' {
    c4( d e f
    g1) \bar "|."
  }
  \layout {
    #(layout-set-staff-size 24)
  }
}

\score {
  \relative c'' {
    g4( f e d
    c1) \bar "|."
  }
  \layout {
    #(layout-set-staff-size 10)
  }
}

gives this output:

enter image description here

Is there a way to use different staff sizes in "2.18.2"?
it was ok if I could set an individual staff size at least for a \bookpart {}.

2
  • 1
    This isn't a problem specific to 2.18. It also misbehaves in 2.19. I was able to get some of what you want by using these commands, but I found when playing with various permutations that this too doesn't behave consistently. So I'm not going to post a general answer yet, as I'm not quite sure what's going wrong with the internal commands (and don't have time right now to sort it out). But in the meantime, maybe that link can help.
    – Athanasius
    Dec 8, 2019 at 21:20
  • @Athanasius just found that layout-set-staff-size is already suggested in the "2.18.2" docs, did not know this...
    – nath
    Dec 10, 2019 at 7:04

1 Answer 1

3

I found a Snippet with a function in the LilyPond Snippet Repository(LSR):

\version "2.18.2"

staffSize = #(define-music-function (parser location new-size) (number?)
  #{
    \set fontSize = #new-size
    \override StaffSymbol.staff-space = #(magstep new-size)
    \override StaffSymbol.thickness = #(magstep new-size)
  #})

\score {
  \new Staff        % default size
  \relative c' {
    c4( d e f
    g1) \bar "|."
  }
  \layout {}
}

\score {
  \new Staff \with { \staffSize #-4 } 

  \relative c'' {
    g4( f e d
    c1) \bar "|."
  }
  \layout {}
}

enter image description here

it does not change the staff-sizes for whole \bookpart blocks, but serves the purpose, even though it does look a little bit streched.

Note: the \with { \staffSize #-4 }needs to be added to every single \new Staff:

\version "2.18.2"

staffSize = #(define-music-function (parser location new-size) (number?)
  #{
    \set fontSize = #new-size
    \override StaffSymbol.staff-space = #(magstep new-size)
    \override StaffSymbol.thickness = #(magstep new-size)
  #})

melody = \relative c'' {
  \repeat unfold 3 {
    g4( f e d) 
    e2 e
  }
  g8( f e d c d e f)
  g( f e d c d e f)
  g( f e d c2)~
  c1 \bar "|."
}

basscl = \relative c' {
  \clef bass
  \repeat unfold 3 {
    g2 e
    e c
  }
  g1
  d
  f2. c4~
  c1 \bar "|."
}


\score {
  \new StaffGroup \with {
    instrumentName = "minus 4"}
  <<
  \new Staff \with { \staffSize #-4 }
    \melody 
  \new Staff \with { \staffSize #-4 }
    \basscl
  >>
  \layout {}
}

\score {
  \new StaffGroup \with {
    instrumentName = "default"}
  <<
  \new Staff
    \melody 
  \new Staff
    \basscl
  >>
  \layout {}
}

\score {
  \new StaffGroup \with {
    instrumentName = "plus 4"}
  <<
  \new Staff \with { \staffSize #4 }
    \melody 
  \new Staff \with { \staffSize #4 }
    \basscl
  >>
  \layout {}
}

enter image description here

also the distance between the staffs gets smaller and smaller the bigger the score gets and vice versa. This needs to be tweaked manually. No ideal solution at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.