lilypond-user
[Top][All Lists]
Advanced

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

Re: Choose paper size and layout with command line options?


From: M Sun
Subject: Re: Choose paper size and layout with command line options?
Date: Mon, 8 Aug 2022 10:39:35 -0700

Thanks Knute. The problem is not only the paper size, but also this part:

  #(set-global-staff-size 18)
  \paper {
    top-margin = 0
    bottom-margin = 0
    left-margin = 5
    right-margin = 0
  }

I need to enable these with the "kobo" size, but not in us-letter.

On Sun, Aug 7, 2022 at 8:12 PM Knute Snortum <ksnortum@gmail.com> wrote:
>
> On Sun, Aug 7, 2022 at 4:03 PM M Sun <chris.corsair@gmail.com> wrote:
> >
> > Hi all,
> >
> > I’m writing a sheet targeting two different paper sizes, with some
> > layout adjustments. My goal is to be able to specify (maybe
> > indirectly) the paper size in command line, without changing the
> > lilypond file itself. My initial set up was this:
> >
> >   \version "2.23.2"
> >   #(set! paper-alist
> >     (cons '("kobo" . (cons (* 15.7 cm) (* 20.9 cm))) paper-alist))
> >   #(set-global-staff-size 18)
> >   \paper {
> >     top-margin = 0
> >     bottom-margin = 0
> >     left-margin = 5
> >     right-margin = 0
> >   }
> >   #(set-default-paper-size "kobo")
> >   \score { \new Staff {a b c}}
> >
> > As you can see this is a cramped layout for a small paper size. Now I
> > also want a version with a normal layout on us-letter size, so I
> > removed the set-global-staff-size line, and the paper block, and
> > changed the paper size to “letter”. The file became this:
> >
> >   \version "2.23.2"
> >   #(set! paper-alist
> >     (cons '("kobo" . (cons (* 15.7 cm) (* 20.9 cm))) paper-alist))
> >   #(set-default-paper-size "letter")
> >   \score { \new Staff {a b c}}
> >
> > These worked. But like I mentioned my goal is to be able to switch
> > between these two setups in command line, without changing the file.
> > My idea was to set a variable in the command line using “-e”, and in
> > the file choose the layout and paper size based on the variable.
> > Here’s my code:
> >
> >   \version "2.23.2"
> >
> >   #(define (configOutput spec)
> >     (cond
> >      ((eqv? spec 'letter) (set-default-paper-size "letter"))
> >      ((eqv? spec 'kobo)
> >       (set! paper-alist
> >        (cons '("kobo" . (cons (* 15.7 cm) (* 20.9 cm))) paper-alist))
> >       (set-global-staff-size 18)
> >       #{ \paper {
> >       top-margin = 0
> >       bottom-margin = 0
> >       left-margin = 5
> >       right-margin = 0 }
> >       #}
> >       (set-default-paper-size "kobo"))
> >      (default nil)))
> >
> >   #(use-modules (guile-user))
> >   #(configOutput output-spec)
> >
> >   \score { \new Staff {a b c}}
> >
> > Then in the shell I ran a command like this:
> >
> >   lilypond -e "(define-public output-spec 'kobo)" test.ly
> >
> > This produced the output with the “kobo” paper size. Or I could change
> > that “kobo” to “letter” and it’d produce with the “letter” paper size.
> >
> > This *almost* worked, except that the \paper block didn’t take effect.
> > This is where I’m lost. How should I make this work?
>
> I believe it's as easy as:
>
> lilypond -dpaper-size="kobo" test.ly
>
> --
> Knute Snortum



-- 
Fear  is  the  path  to  the  dark  side.
Fear  leads  to  anger,
Anger  leads  to  hate,
Hate  leads  to  suffering.



reply via email to

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