Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(85)

Issue 6454139: Fix 2732: Extract the full page geometry in lilypond-book (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 8 months ago by Reinhold
Modified:
8 years, 2 months ago
Reviewers:
dak
CC:
lilypond-devel_gnu.org
Base URL:
http://git.savannah.gnu.org/gitweb/?p=lilypond.git/trunk/
Visibility:
Public.

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

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+117 lines, -45 lines) Patch
A input/regression/lilypond-book/tex-papersize-detection.lytex View 1 chunk +24 lines, -0 lines 0 comments Download
M python/book_base.py View 1 chunk +3 lines, -6 lines 0 comments Download
M python/book_latex.py View 3 chunks +61 lines, -23 lines 2 comments Download
M python/book_snippets.py View 5 chunks +27 lines, -12 lines 2 comments Download
M python/book_texinfo.py View 1 chunk +2 lines, -4 lines 0 comments Download

Messages

Total messages: 2
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 ...
11 years, 8 months ago (2012-08-12 13:24:37 UTC) #1
Reinhold
11 years, 8 months ago (2012-08-24 13:13:39 UTC) #2
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.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b