lilypond-user
[Top][All Lists]
Advanced

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

Re: The LilyPond Report: a new weekly opinion column about Lily's world


From: Karl Hammar
Subject: Re: The LilyPond Report: a new weekly opinion column about Lily's world
Date: Mon, 7 Apr 2008 23:52:45 +0200 (CEST)

Villenave:
> A new issue of the "LilyPond Report" is out:
> 
> http://valentin.villenave.info/spip.php?article62
...

Qouting from above link:
L> This week, Karl Hammar shared with us a rather unusual set of macros
L> that somehow replace lilypond-book with some gcc makefiles.

Hmm, I don't see them as unusual, I see it more like that I bend
lilypond-book to the way I am used to when developing program and using
latex.

It boils down to

. using makefiles
. having something that finds out dependencies, like gcc -M
. not preprocessing my latex files by lilypond-book

I found out it was not really convenient preprocessing my latex files
when using bibtex,makeindex and friends. So I tried using
\includegraphics{lily-<horrible_number>-1.eps}, but I could not guess
what number lilypond would use so I looked into the whole process.

>From what I understand, lilypond-book do

a, run latex on the file.lytex to find out linewidth
 (I've had some problems with this when lilypond-book couldn't find
 latex, even though I could)

b, for every \lilypond* create an .ly file, say lily-1229701558.ly
 containing roughly:

  scheme code to make the output file cropped (without "margins")
  a \paper section with the line length found out above
  the rest of your lilypond code

c, run lilypond on lily-1229701558.ly (and the other lily-xxx files) to
 produce

 lily-1229701558-1.eps
 lily-1229701558-systems.tex
 lily-1229701558-systems.texi
 lily-1229701558.eps
 lily-1229701558.txt

d, it also makes an snippet-map.ly to remember which lily-xxx file is
 related to what \lilypond* directive

 #(define version-seen? #t)
 #(ly:add-file-name-alist '(
 ("lily-595343642.ly" . "all.lytex:128 (lily-595343642.ly)")
 ("lily-1065716787.ly" . "all.lytex:152 (lily-1065716787.ly)")
 ("lily-1045984756.ly" . "all.lytex:171 (lily-1045984756.ly)")
 ("lily-897287110.ly" . "all.lytex:181 (lily-897287110.ly)")
 ("lily-1636488540.ly" . "all.lytex:187 (lily-1636488540.ly)")
 ("lily-1229701558.ly" . "all.lytex:200 (lily-1229701558.ly)")
 ("lily-60504210.ly" . "all.lytex:233 (lily-60504210.ly)")
 ))

e, since every lily-xxx-xx.eps file is without fonts to save space,
 lilypond-book reads all lily-xxx.eps files (which includes the needed
 fonts) and creates an file.psfonts with the grand total fonts needed to
 be used by dvips to include them in the end result

---

I replaced step a, with an \include which has an paper block whith the
right linewidth, like \include "choirbook.ly" or \include "a4paper.ly".
For small snippets, I could either set it in the .ly or using e.g.
\includegraphics[width=22mm]{file-1.eps}.

Step b, is also solved by an \include, in current lilypond it is
\include "lilypond-book-preamble.ly".

Step c, is 
 lilypond --ps -b eps file.ly            # for 2.10
 lilypond --ps -dbackend=eps file.ly     # for 2.11

Step d, is not needed any longer.

step e, is with a shrinked lilypond-book, ending with

 ... 
 def main ():
         files = sys.argv[2:]
         file = sys.argv[1]
         fontextract.extract_fonts (file,files)

 if __name__ == '__main__':
         main ()

Regards
/Karl






reply via email to

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