lilypond-user
[Top][All Lists]
Advanced

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

Re: Get the paper size in scheme


From: David Kastrup
Subject: Re: Get the paper size in scheme
Date: Thu, 10 Aug 2017 13:42:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Robert Kubosz <address@hidden> writes:

> Hi everyone!
>
> I am currently creating a template for a book. I want to create a scheme
> function, which adapts markup according to paper size. The problem is,
> that I don't know how to get current paper size.

Markup commands get a "layout" argument.

You can then access the paper-width variable inside.  Dimensions are in
units depending on staff spaces, so you usually want to adjust for
that.  Which is reasonably easy, given that units are also expressed in
staff spaces.  There may be rounding errors due to that.

#(define-markup-command (print-width layout props unit) (symbol?)
  (interpret-markup layout props
   (format #f "~f ~s" (/ (ly:output-def-lookup layout 'paper-width)
                      (ly:output-def-lookup layout unit)) unit)))

\markup { "Paperwidth is" \print-width #'cm "." }

-- 
David Kastrup

reply via email to

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