[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-devel
Subject:    Re: landscape mode in lilypond-book doesn't calculate line length correctly
From:       Reinhold Kainhofer <reinhold () kainhofer ! com>
Date:       2012-08-12 9:30:56
Message-ID: 502777D0.2020708 () kainhofer ! com
[Download RAW message or body]

On 2012-08-11 21:57, David Kastrup wrote:
> Laura Conrad <lconrad@laymusic.org> writes:
> 
> > > > > > > "Laura" == Laura Conrad <lconrad@laymusic.org> 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 values"));
> }
> 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
> LATEX_INSPECTION_DOCUMENT = r'''
> \nonstopmode
> %(preamble)s
> \begin{document}
> \typeout{textwidth=\the\textwidth}
> \typeout{columnsep=\the\columnsep}
> \makeatletter\if@twocolumn\typeout{columns=2}\fi\makeatother
> \end{document}
> 
> 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.

Cheers,
Reinhold


Fragments may use the
> 
> `papersize=STRING'
> 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
> work.

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...

Cheers,
Reinhold


-- 
------------------------------------------------------------------
Reinhold Kainhofer, reinhold@kainhofer.com, 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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic