Hi Abraham and Robin and Jean et. al.

Thank you for the help on using set-global-staff-size correctly. I must have gotten it mixed up with the layout-set-staff-size option somehow.

Having used the wrong one, my project now needs some tinkering, but it looks much better.

I've reviewed the documentation again, specifically section 4.2.2, and based on the methods mentioned there, I feel slightly vindicated for having done as mentioned in option 2. I understand now that there is a bug with regards to layout-set-staff-size, but it's not mentioned in the /Known issues and warnings /section.

Best wishes,
Jakob

On 23.05.2023 19.41, Abraham Lee wrote:
Hey, Jakob!

On Tue, May 23, 2023 at 8:57 AM Jakob Pedersen <jak...@vivaldi.net> wrote:

    Dear Abraham and Xavier

    Thank you for this! I must have read the documentation wrong.

    That – unfortunately – causes new problems, because my project is
    in different files and scores in different bookparts.

    I'm getting a warning: set-global-staff-size: not in toplevel
    scope error when compiling. That's with the size set in the
    top-level doc layout block. Same if I add it to the actual score
    document.

    If I add anything to the actual score layout block, it ignores my
    top-level document layout, which isn't practical, but can be
    fixed, I suppose, by editing the score files.

    Have I organised my score badly? I have attached my top-level
    document and a score document.

    My apologies for not including this in the first email. I didn't
    think it could be a problem with the file(s) structure.

    Best wishes,
    Jakob

    On 23.05.2023 15.58, Abraham Lee wrote:
    Hi, Jakob!

    On Tue, May 23, 2023 at 7:44 AM Jakob Pedersen
    <jak...@vivaldi.net> wrote:

        Greetings!

        I'm writing some chorales for playing hymns on the organ.
        I've chosen a larger staff size to improve readability.

        Having adjusted #(layout-set-staff-size ##) to 26, I'm
        noticing some less-than-fortunate side effects.

        The key signature is very, very close to the clef, and the
        notes are too close to the bar line.



        Is there an elegant way to adjust this to the larger staff size?

        A minimal example:

        \version "2.24.1"
        \language "deutsch"

        global = {
          \key f \major
          \time 3/2
        }

        rightOne = \relative c' {
          \global
        f4 g f2 c | d4 e f2 a |
        }

        rightTwo = \relative c' {
          \global
        c2 c a | b a c |
        }

        leftOne = \relative c {
          \global
        a'4 g a2 a | f4 g c,2 f |
        }

        leftTwo = \relative c {
          \global
        f4 e f2 f | b,4 g f2 f |
        }

        \score {
          \new PianoStaff <<
            \new Staff = "right" <<
              \new Voice = "soprano" {
                \voiceOne << \rightOne >>
              }
              \new Voice = "alto" {
                \voiceTwo << \rightTwo >>
              }
            >>
            \new Staff = "left" <<
              \clef bass
              \new Voice = "tenor" {
                \voiceOne << \leftOne >>
              }
              \new Voice = "bass" {
                \voiceTwo << \leftTwo >>
              }
            >>
          >>

          \layout {
            #(layout-set-staff-size 26)
          }

        }


        Best wishes,

        Jakob


    layout-set-staff-size is intended to resize an individual staff
    within a group of others at a default size. In your case, you've
    resized (but not respaced) all the Staffs relative to the
    implicit default 20 pt staff height, which is why things got
    cramped. What you want to do instead is put this command near the
    top of your file:

    #(set-global-staff-size 26)

    This changes the default staff size and respaces accordingly. By
    doing this, you can then remove the layout-set-staff-size command
    completely as it is no longer necessary.

    Hope that helps,
    Abraham


I looked at your files and obviously I didn't explain the solution very well lol. Let me try again. And in fairness, the manual doesn't fully explain any of the usage details I explain below.

The set-global-staff-size command does have some conditions and implications for use. As you discovered, it's a "top level" command, meaning that it can only be applied to an entire \book and not to an individual \bookpart or \score. Also, it needs to be called outside any \layout block.

So, here's how I would restructure the files you provided:

%<-----------------------------------scorebook.ly------------------------------------------
\version "2.24.1"

#(set-global-staff-size 26)  % <----- put it here

\header {
  tagline = ##f
}

\include "hymn.ly <http://hymn.ly>"

\paper {
  #(set-paper-size "a4landscape")
}

\layout {
  indent = 0.0
  \context {
    \Score
    \remove "Bar_number_engraver"
  }
  % don't put it here
}

% A hymn begins here
% \bookpart { ... etc. }

% This hymn begins here
  \bookpart {

    \header {
      title = "123. This a hymn"
      composer = \markup { \vspace #1.5 Something German ~1550 }
    }

    \hymnscore

  }

% Another hymn begins here
% \bookpart { ... etc. }

%<-----------------------------------hymn.ly------------------------------------------

\version "2.24.1"
\language "deutsch"

global = {
  \key f \major
  \time 3/2
}

rightOne = \relative c' {
  \global
f4 g f2 c | d4 e f2 a |
}

rightTwo = \relative c' {
  \global
c2 c a | b a c |
}

leftOne = \relative c {
  \global
a'4 g a2 a | f4 g c,2 f |
}

leftTwo = \relative c {
  \global
f4 e f2 f | b,4 g f2 f |
}

hymnscore = \score {
  \new PianoStaff <<
    \new Staff = "right" <<
      \new Voice = "soprano" {
        \voiceOne << \rightOne >>
      }
      \new Voice = "alto" {
        \voiceTwo << \rightTwo >>
      }
    >>
    \new Staff = "left" <<
      \clef bass
      \new Voice = "tenor" {
        \voiceOne << \leftOne >>
      }
      \new Voice = "bass" {
        \voiceTwo << \leftTwo >>
      }
    >>
  >>

  \layout {
    % don't put it here either, or anywhere else in this file
  }
}

%<------------------------------------------------------------------------------------------------

Some other things to note about using set-global-staff-size as you continue to expand the hymnal with multiple sections (not that you'll likely have a score with this drastically different staff sizes, but just for example):

1. This DOES NOT work (the last call takes precedence because they're both within the same implicit \book):

#(set-global-staff-size 26)
\score { ... }

#(set-global-staff-size 13)
\score { ... }

2. This DOES NOT work either (same reason as #1, they're both implicitly within the same \book, so that last call gets applied to both):

#(set-global-staff-size 26)
\bookpart {
  \score { ... }
}

#(set-global-staff-size 13)
\bookpart {
  \score { ... }
}

3. This DOES work because they're in separate \book blocks (but now you have separate output files instead of them being in the same one):

#(set-global-staff-size 26)
\book {
  \score { ... }
}

#(set-global-staff-size 13)
\book {
  \score { ... }
}

I hope that has made it more clear about when/how/why to use this command.

Best,
Abraham

@Devs (if any are reading through this), to the point of the OP's original question, and related to what's described in Section 2 of https://lilypond.org/doc/v2.24/Documentation/notation/setting-the-staff-size, this is not entirely accurate to say you can use layout-set-staff-size for individual scores. I mean, yes, layout-set-staff-size can be used, but the layout engine still horizontally spaces things as if it was whatever the global staff size is (as shown by the OP's picture). For small size changes, or decreasing the size, like changing it to 18 vs a global 20, then it's not so noticeable, but a big change, or going up in size, like changing it to 26 with a global 20, then the spacing issue becomes considerably more apparent. I am not a Dev and I have no idea what's required to fix this behavior, but not being able to cleanly adjust the staff size of individual book parts or scores within the same \book is a long-standing complaint I've had. I've worked around it by creating separate \book blocks and then spliced them together later, but it's a hassle. Why not just have it do the right/expected thing from the beginning? Thanks for all you do! LP continues to be my go-to engraver and I thank you for keeping it running!

Reply via email to