lilypond-user
[Top][All Lists]
Advanced

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

Re: How does the lilypond-book-preamble work?


From: karl
Subject: Re: How does the lilypond-book-preamble work?
Date: Sat, 11 Jun 2016 15:18:52 +0200 (CEST)

Joram:
> could someone explain to me how lilypond-book (esp. the preamble) works?
> 
> I read this in ly/lilypond-book-preamble.ly:
> 
> several define ...-handler                  % what is that?

  #(define default-toplevel-book-handler
    print-book-with-defaults-as-systems )

  #(define toplevel-book-handler
    (lambda ( . rest)
    (set! output-empty-score-list #f)
    (apply print-book-with-defaults rest)))

  #(define toplevel-music-handler
    (lambda ( . rest)
     (apply collect-music-for-book rest)))

  #(define toplevel-score-handler
    (lambda ( . rest)
     (apply collect-scores-for-book rest)))

  #(define toplevel-text-handler
    (lambda ( . rest)
     (apply collect-scores-for-book rest)))

Theese:
 print-book-with-defaults-as-systems
 print-book-with-defaults
 collect-music-for-book
 collect-scores-for-book
are defined in scm/lily-library.scm, take a look there.

> #(ly:set-option 'backend 'eps)              % what if I want svg?

Can't you convert your intermediary eps's or final ps/pdf's to svg ?
Inkscape claims to be able to do that:

 
https://en.wikipedia.org/wiki/Wikipedia:Graphic_Lab/Resources/PDF_conversion_to_SVG

> #(ly:set-option (quote no-point-and-click)) % ok
> #(define inside-lilypond-book #t)           % consequences?

$ find . -type f -print0 | xargs -0 grep 'inside-lilypond-book'
./Documentation/misc/ChangeLog-2.10:    inside-lilypond-book
./input/regression/abc2ly/out-test-baseline/share/lilypond/current/ly/lilypond-book-preamble.ly:#(define
 inside-lilypond-book #t)
./input/regression/out-test-baseline/share/lilypond/current/ly/lilypond-book-preamble.ly:#(define
 inside-lilypond-book #t)
./input/regression/musicxml/out-test-baseline/share/lilypond/current/ly/lilypond-book-preamble.ly:#(define
 inside-lilypond-book #t)
./ly/lilypond-book-preamble.ly:#(define inside-lilypond-book #t)

seems to be there for your convenience, i.e. you can check in your
ly/scm code if you are using lilypond-book.

> #(define version-seen #t)                   % ok, I can omit the version
> 
> From the code, I could not find how the cropping, removing of indent,
> removing of the tagline, output as png happens and where the tex, texi
> and count files are produced (I don't need them).

Why don't you include the ly/lilypond-book-preamble.ly verbatim in
some test ly file of yours, like:

  \version "2.19.16"

  \header {
    tagline = ""
  }

  #(define default-toplevel-book-handler
    print-book-with-defaults-as-systems )

  #(define toplevel-book-handler
    (lambda ( . rest)
    (set! output-empty-score-list #f)
    (apply print-book-with-defaults rest)))

  #(define toplevel-music-handler
    (lambda ( . rest)
     (apply collect-music-for-book rest)))

  #(define toplevel-score-handler
    (lambda ( . rest)
     (apply collect-scores-for-book rest)))

  #(define toplevel-text-handler
    (lambda ( . rest)
     (apply collect-scores-for-book rest)))

  #(set! output-empty-score-list #t)

  #(ly:set-option 'backend 'svg)
  #(ly:set-option (quote no-point-and-click))
  %#(define inside-lilypond-book #t)
  %#(define version-seen #t)

  \score {
    \new Staff { a4 b c d }
  }

Doing that I find that scm/framework-svg.scm is missing the
output-classic-framework procedure which the other framework-*.scm
have. Perhaps adding that will solve your problem.

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57



reply via email to

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