On 09/01/2023 23:00, Kevin Cole wrote:
Is there a way, within a .ly file to conditionally include sections
based on command line options?

Specifically, I would like to have \paper settings go one way for
"lilypond --pdf" and another way for "lilypond --svg".

The function ly:command-line-options returns a string with all the -d options. The backend option is set to svg when when generating svg output and absent by default.

\version "2.22.0"

#(let* ((options (ly:command-line-options))
        (svg     (string-contains options "(backend . svg)")))
  (if (integer? svg) (ly:message "svg") (ly:message "not svg")))

{
  c''1
}

--
Timothy Lanfear, Bristol, UK.

Reply via email to