2009/7/27 Werner <mey....@web.de>: >> Are the two sentences in "Known issues and warnings" in the Horizontal >> dimensions section clear enough? > > Sorry - I hadn't seen this. It is clear. So the doc is OK. > But the feature-request to provide right-margin remains.
Wondering why this is so difficult that it has been an issue for such a long time, I took a look at scm/page.scm and played around with the code there. It turned out that it's relatively easy to make Lilypond take the setting for right-margin into account (see attached patch) but I ran into the following problems: 1) The code in scm/page.scm is able to test whether left-margin and/or right-margin was specified by the user in the \paper block (if this isn't the case, the value is #f). However, the same doesn't seem to be true for line-width because this variable _always_ has a value (i.e., it cannot be undefined like the other two). Thus I cannot check whether both the left+right margins *and* the line-width were specified by the user. As Werner pointed out, we should print a warning in this case and discard one of the values. BTW, how can I find out which of the values was specified last in the .ly file so that that's the one taken into account? 2) With the attached patch, the following works as expected. === BEGIN CODE === \paper { left-margin = 2 \cm right-margin = 3 \cm } \relative c' { \repeat unfold 100 { f } } === END CODE === When adding the line line-width = 10 \cm to the \paper block it still kinda "works" (the line-width value is simply discarded so that the margins are as specified). Interestingly, however, the value of line-width still has an effect on the *spacing* of the notes. Namely, the notes are spaced as if the line-width were truly 10cm but then the line gets stretched to account for the margin values. How can this be avoided? Or is it even a feature rather than a bug? (I can imagine that some users might want to make use of this to achieve tighter or wider spacing, although I'm not sure that's a good idea.) Thanks for any help, Max
diff --git a/scm/page.scm b/scm/page.scm index a486219..a9c921f 100644 --- a/scm/page.scm +++ b/scm/page.scm @@ -221,15 +221,25 @@ ((paper-height (ly:output-def-lookup layout 'paper-height)) (paper-width (ly:output-def-lookup layout 'paper-width)) (lmargin (ly:output-def-lookup layout 'left-margin #f)) + (rmargin (ly:output-def-lookup layout 'right-margin #f)) + (lwidth (ly:output-def-lookup layout 'line-width)) (left-margin (if lmargin lmargin - (/ (- paper-width - (ly:output-def-lookup layout 'line-width)) 2))) + (if rmargin + (- paper-width lwidth rmargin) + (/ (- paper-width lwidth) 2)))) (bottom-edge (- paper-height (ly:output-def-lookup layout 'bottom-margin)) ) (top-margin (ly:output-def-lookup layout 'top-margin)) ) + (if (and lmargin rmargin) + ;; FIXME: If both margins _and_ the line-width was specified + ;; in the ly file then we should print a warning here. Also, + ;; curiously, setting the line-width still has an effect on + ;; the spacing of the notes even when both margins are given. + (ly:output-def-set-variable! layout 'line-width (- paper-width lmargin rmargin))) + `((paper-height . ,paper-height) (paper-width . ,paper-width) (left-margin . ,left-margin)
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel