lilypond-user
[Top][All Lists]
Advanced

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

Re: Layout integrating LaTeX and music


From: Karl Hammar
Subject: Re: Layout integrating LaTeX and music
Date: Thu, 3 Jan 2008 18:04:34 +0100 (CET)

address@hidden:
...
> Hi Tobias,
> 
> >I don't use lilypond-book, but call
> >lilypond from within latex. This approach has some advantages and some
> >drawbacks.
> 
> 1) I'd like to know how you call lilypond from within latex.
> 
> 2)Could you tell me the advantages and disadvantages of this approach?

Hello Patrick.

lilypond-book seems to do the following:
 (text below i valid for \version "2.6.5", yes I know it is old, and I 
 only tried it with \lilypondfile)

a, run latex to get linewidth

b, makes a new ly-file (e.g. lily-1045984756.ly) that sets the line width and
   basically prepends this to the original ly-file:

   #(set! toplevel-score-handler ly:parser-print-score)
   #(set! toplevel-music-handler (lambda (p m)
                                  (ly:parser-print-score
                                   p (ly:music-scorify m p))))

   the above make the eps "cropped", else it has some space above and 
   the the left

c, runs lilypond --ps -b eps on the new file which gives you:
   the whole score in AA.eps (AA = eg. lily-1045984756)
   one system per file in AA-xx.eps
   lines of \includegraphics{AA-xx.eps}, one per system, in 
     AA-systems.tex
   (plus a few other files)

d, extracts the fonts from AA.eps to <origname>.psfonts
   (the AA.eps includes the fonts, AA-xx.eps does not)

e, modifies your .lytex file -> .tex by replacing \lilypondfile etc. with 
   \input AA-systems.tex

===

So to solve you 1) you have to do the same.

You can manually set the linewidth and add the b, part to your ly-files.
c, is a simple, just run the command
To extract the fonts, you can cp lilypond-book to a new file and modify
the end of it to (ie. leave out all other stuff):

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

  if __name__ == '__main__':
          main ()

Use e.g \includegraphics[width=39mm]{myfile-1.eps} etc. where you want
your music.

===

Pro:
 easier to see errors in your latex file
 easier to work with bibtex and makeindex
 you can put your \includegraphics in an macro,
  does not work with \lilypondfile
 fewer files in your directory (all "those" lily-xxx-files)
 easier to do (different) things between (different) system
 lilypond-book does not sometime run lilypond --ps -b eps
  ie. when some \inlude'd file is changed
 easier integration into makefiles

  all.dvi:      all.tex litt.bib Arcadelt.eps ...
          latex all 
          bibtex all > log
          makeindex all >> log
          latex all >> log
          latex all >> log

  # lilypond-psfonts == the modified lilypond-book
  %.ps: %.dvi
          ./lilypond-psfonts $*.psfonts *[a-z].eps
          dvips -h $*.psfonts $< >> log
          ps2pdf14 $*.ps $*.pdf # if you want pdf's

  Arcadelt.eps: arcadelt.ly header.ly layout.ly vars.ly short.ly
  ...

  %.eps:        %.ly
          rm -f $*-*.eps # the number of systems might have changed
          lilypond --ps -b eps $<

Con:
 you must handle the linewidth yourself
 you must have one \includegraphics per system and handle that
  yourself somehow, maybe someone could write a latexpackage for that
  create the AA-systems.tex yourself
 you must have all your lilypondfragments and such in ly-files

The rationale for me --- easier handling of latex.

Regards,
/Karl

-----------------------------------------------------------------------
Karl Hammar                    Aspö Data               address@hidden
Lilla Aspö 2340                                                Networks
S-742 94 Östhammar          +46  173 140 57                   Computers
Sweden                     +46  70 511 97 84                 Consulting
-----------------------------------------------------------------------






reply via email to

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