lilypond-devel
[Top][All Lists]
Advanced

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

Re: Fix 2732: Extract the full page geometry in lilypond-book (issue 645


From: reinhold . kainhofer
Subject: Re: Fix 2732: Extract the full page geometry in lilypond-book (issue 6454139)
Date: Fri, 24 Aug 2012 13:13:39 +0000

Reviewers: dak,


http://codereview.appspot.com/6454139/diff/1/python/book_latex.py
File python/book_latex.py (right):

http://codereview.appspot.com/6454139/diff/1/python/book_latex.py#newcode262
python/book_latex.py:262: textwidth = (textwidth + columnsep) / columns
- columnsep
On 2012/08/12 13:24:37, dak wrote:
Why not use the value of \columnwidth in the first place here?

Good idea, I wasn't aware that this length existed. You are right, this
is much better.

Note that this
does not help with full-width figures:
\begin{figure*}
...
\end{figure*}

For those you'll have to specify an explicit line-width parameter to the
snippet anyway.

http://codereview.appspot.com/6454139/diff/1/python/book_snippets.py
File python/book_snippets.py (right):

http://codereview.appspot.com/6454139/diff/1/python/book_snippets.py#newcode128
python/book_snippets.py:128: MARGIN_LEFT: r'''left-margin =
%(left-margin)s''',
On 2012/08/12 13:24:37, dak wrote:
I have a hard time imagining the margins to make any sense since TeX
applies
them to the included material anyway.

Neither do I. I just figured it might not be wrong if the lilypond
snippet uses the exact same position on the paper as the latex document
(i.e. don't center the line-width on the paper, but use the latex
left-/right margins). But then, I can't think of a situation where
lilypond would give a different cropped result for different margins,
but same line-width...

The top-/bottom-margins might have an influence for vertical
stretching/compressing of multi-staff systems in a snippet. If the latex
margins are quite large, without top-/bottom margins lilypond would
create a snippet image that is too high for the latex textheight.

However, I don't think that these margin settings should be documented.
They are not meant to be used as snippet options manually, only for the
auto-extracted page geometry.

Description:
Fix 2732: Extract the full page geometry in lilypond-book

So far, lilypond-book tried to extract the line-width from the latex
settings,
but not the full page geometry (height, width, margins). Instead, it
simply used
the extracted line-with with the default paper size.

If the latex paper size is larger than the lilypond default paper size,
then the
line-width will be larger than the page. Lilypond detects this and
ignores the
wrong line-width.

The proper solution is to extract the full page geometry from the latex
document
and use that for the lilypond snippet, too (unless an explicit papersize
or
line-width was given, of course...)

As a side-effect, we now have some more snippet options:
-) paper-width
-) left-margin

-) paper-height
-) top-margin
-) bottom-margin

The latter options only have an effect on vertical stretching of
multi-staff groups.

This patch also fixes a small mis-calculation of the text-width for
multi-column
texts (the columnsep was subtracted only once rather than once per
separation...)

Please review this at http://codereview.appspot.com/6454139/

Affected files:
  A input/regression/lilypond-book/tex-papersize-detection.lytex
  M python/book_base.py
  M python/book_latex.py
  M python/book_snippets.py
  M python/book_texinfo.py





reply via email to

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