lilypond-user
[Top][All Lists]
Advanced

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

updated margins-a4-letter.ly


From: Graham Percival
Subject: updated margins-a4-letter.ly
Date: Sat, 4 Oct 2008 07:57:06 -0700

Here's a slightly updated version of my "produce the same score on
A4 and letter paper".  Should be easier to understand.

Valentin, could you add a wishlist for LSR: snippets that don't
produce any output.  I'd like to check a box and have LSR not even
attempt to compile this snippet; I think it'll complain since it
doesn't produce any pdf or png.  All stylesheets will need this
extra option.

No, I don't like the "solution" of adding a { c'4 } to the bottom
of the page.

Note that the testing code has been removed from this version.

Cheers,
- Graham


% run with
%   lilypond -d paper-size=\"letter\" margins-a4-letter.ly
% for letter size
\version "2.11.59"

#(define is-letter? (string=? (ly:get-option 'paper-size)
"letter"))

% A4: 210 x 297 mm
% USletter: 216 x  279 mm
% => Difference: letter is 6mm wider, A4 is 18mm taller

\paper{
  min-vertical-margins = 10\mm
  min-horizontal-margins = 10\mm


  % VERTICAL
  % a4 needs an extra 9mm on both sides
  #(define (letter-margin-height min-margin)
    (if is-letter?
        (+ min-margin (* 0 mm))
        (+ min-margin (* 9 mm))))
  top-margin = #(letter-margin-height min-vertical-margins)
  bottom-margin = #(letter-margin-height min-vertical-margins)

  % HORIZONTAL 
  % letter needs an extra 3mm on both sides
  #(define (letter-margin-width min-margin)
    (if is-letter?
        (+ min-margin (* 3 mm))
        (+ min-margin (* 0 mm))))
  left-margin = #(letter-margin-width min-horizontal-margins)
  right-margin = #(letter-margin-width min-horizontal-margins)
  line-width = #(- paper-width (+ left-margin right-margin))
}






reply via email to

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