lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme in \layout to produce relative dimensions


From: Graham Percival
Subject: Re: scheme in \layout to produce relative dimensions
Date: Tue, 16 May 2006 12:35:13 -0700


On 16-May-06, at 11:32 AM, Nicolas Sceaux wrote:

I don't know what exactly you're trying to do, but maybe this example may
help you:

At the moment, I'm investigating the line-width bug in lilypond-book, but this is good general info anyway. :)

\paper {
  left-margin = 15\mm
  right-margin = 15\mm
  #(define line-width (- paper-width (* 30 mm)))
}

This resizes the margins (15mm left and right), and then set accordingly
the line width.

Thanks, that works. But can this be done inside a \score{} ? (to work in lilypond-book)

\score{
  \relative c'' {
    \repeat unfold 16 {a4 b c d}
  }
  \layout{
    #(define line-width (- paper-width (* 30 mm)))
  }
}

produces
----
spark:~/tmp gperciva$ lilypond fff.ly
GNU LilyPond 2.8.2
Processing `fff.ly'
Parsing...ERROR: Unbound variable: paper-width
----

(I really need to clean out my ~/tmp/ directory; I've run out of foo.ly, bar.ly, baz.ly, bug.ly, and baa.ly :)

I tried a few variations of the #(define...) line without success, but since it works in \paper{} I figure I probably need to do something like
#page:paper-width
to access this variable inside a \score{ \layout{}}.


Indeed, the paper width being set when the paper size is defined (using
set-default-paper-size for instance), the line width can be computed as
follow:
  line-width = paper-width - left-margin - right-margin
that is, in scheme:
  #(define line-width (- paper-width left-margin right-margin))

Is this working now? There's a @refbug in 10.4.2 Page formatting that says that right-margin doesn't actually work yet, and that one should simply set left-margin and line-width. I don't know how old this report is, though.

Cheers,
- Graham





reply via email to

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