[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: landscape mode in lilypond-book doesn't calculate line length correc

From: Reinhold Kainhofer
Subject: Re: landscape mode in lilypond-book doesn't calculate line length correctly
Date: Sun, 12 Aug 2012 11:30:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0

On 2012-08-11 21:57, David Kastrup wrote:
Laura Conrad <address@hidden> writes:

"Laura" == Laura Conrad <address@hidden> writes:

     Laura> When run on the attached file, lilypond-book sets the line
     Laura> length of the music to be much less than the actual width of
     Laura> the page that latex is using (which you can see by where it
     Laura> puts the footers.)

I think I have a clue as to the source of this problem.  I did
some investigation, since this is a blocking bug for a project with a
tight deadline in early September.

I looked at the lilypond-book python code, and it does indeed seem to be
setting the width wider for a landscape page than for a portrait page.
However, at some point when lilypond-book is running lilypond, I get the
following warning:

warning: systems run off the page due to improper paper settings,
setting default values

It looks like whatever code writes this warning thinks that no page
should ever be more than about 9 inches wide.  This might be good enough
for my purposes, although I was thinking about using smaller than 1 inch
margins, and certainly there are some purposes for which you would
definitely want minimal margins.

So can someone who understands where that message comes from check
whether there's some inappropriate hard coding of the maximum width of a
page which is too small for a letter paper in landscape?

No such luck, it is in LilyPond itself that you have

   if (to_boolean (c_variable ("check-consistency")))
       // Consistency checks. If values don't match, set defaults.
       if (abs (paper_width - line_width - left_margin - right_margin) > 1e-6)
           line_width = line_width_default;
           left_margin = left_margin_default;
           right_margin = right_margin_default;
           warning (_ ("margins do not fit with line-width, setting default 
       else if ((left_margin < 0) || (right_margin < 0))
           line_width = line_width_default;
           left_margin = left_margin_default;
           right_margin = right_margin_default;
           warning (_ ("systems run off the page due to improper paper settings, 
setting default values"));

Have you tried setting the paper type in your lilypond-book snippets?
LilyPond-book only siphons off

     # Retrieve dimensions from LaTeX

so it does not bother getting/setting paper info.

Ah, good point. It actually took me a while to see what you mean: This snippet correctly extracts the actual line width for the snippet, but the snippet uses the default lilypond paper size rather than the paper size implied by the latex document... Nice Catch!

When I worked on these parts of lilypond-book, I tested with various page settings, but apparently forgot to check with larger page sizes than A4 portrait...

The apparent solution is to also print out the paper page width/height and all the margins (to avoid e.g. too much vertical stretching of staff groups)...

I'll try to come up with a patch.


Fragments may use the

      Where STRING is a paper size defined in `scm/paper.scm' i.e.
      `a5', `quarto', `11x17' etc.

      Values not defined in `scm/paper.scm' will be ignored, a warning
      will be posted and the snippet will be printed using the default
      `a4' size.

option.  Embarrassingly, there is no way to get a4 landscape in
LilyPond-book right now, but a3 should do the trick I guess, at some
loss of performance.

Inside of LilyPond, #(set-default-paper-size "a4" 'landscape) would

Hmm, to make life for .ly file generators easier, maybe it would be a good idea to additionally define paper sizes a4landscape and the like...


Reinhold Kainhofer, address@hidden, http://www.kainhofer.com
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * Edition Kainhofer, Music Publisher, http://www.edition-kainhofer.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]