lilypond-user
[Top][All Lists]
Advanced

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

RE: Using Scheme inside header markup


From: Sven Axelsson
Subject: RE: Using Scheme inside header markup
Date: Wed, 13 Jul 2005 08:43:07 +0200

> From: Graham Percival [mailto:address@hidden 
> On 12-Jul-05, at 12:43 PM, Sven Axelsson wrote:
> 
> >> There is a little subtlety with options: -dno-comment means
> >> that you set
> >> the `comment' option to #f, whereas -dcomment means that you
> >> set comment
> >> to #t.
> 
> > Aargh! That's it alright! Thanks a lot for helping me out here.
> 
> I'm quite interested in this; once you have a working example that
> detects command-line options, could you post it here?  It'd also
> be good to include it in LSR, even if can't display the results of
> different command-line options in LSR.  :)

Sure. Basically it works just as shown in Nicholas Sceaux last mail.

In my case I use it to conditionally include extra fields in the
header, so I do something like this:

\paper {
  bookTitleMarkup = \markup {
    % Normal markup for getting the header fields goes here.
    % Turn my extra field on or off depending on the command line flag.
    #(ly:export (if (ly:get-option 'show-comment) 
                 (markup #:fromproperty 'header:comment)
                 (markup)))
  }
}

and then call Lilypond with

lilypond -dshow-comment file.ly

to turn on the comment field. And as shown in the quoted part above,
do not call your option no-comment (or no-whatever), since
the getopt library uses that as a toggle for boolean flags.
-dcomment is #t, -dno-comment is #f.

You can also use use non-boolean defines, like

lilypond -dmy-option=43 file.ly

and then use the value passed somewhere, like as a parameter 
to some setting in \page or \layout maybe.
-- 
Sven Axelsson





reply via email to

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