[Top][All Lists]

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

Re: [Spam:SpamScore 16.1] Re: extending \lilypondfile was: Re: Extractin

From: Michael Haynie
Subject: Re: [Spam:SpamScore 16.1] Re: extending \lilypondfile was: Re: Extracting header fields for use by e.g. LaTeX?
Date: Tue, 13 Dec 2005 23:32:28 -0500

Glad to hear you were only _distracted_ by the events at Hemel Hempstead.

Thanks for the script.

I've been trying to test it, but I'm stuck. The problem may be the result of a change between 2.6.x and 2.7.x or bad configuration on my part. The script complains about an undefined variable, print-score-with-defaults. That word is mentioned in the generated lilyK*.ly file, but I can't find a definition, though. Any ideas?

The execution trace follows:

% lilypond-macros -f latex -V --psfonts working.ltx
datadir is /home/invisible/share/lilypond/2.7.23
lilypond_binary is lilypond
lilypond-macros (GNU LilyPond) 2.7.21
Reading working.ltx...
Invoking `latex tmpVa0Kzy.tex'This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
entering extended mode
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
kish, ukrainian, nohyphenation, loaded.

Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
No file tmpVa0Kzy.aux.
(./tmpVa0Kzy.aux) )
No pages of output.
Transcript written on tmpVa0Kzy.log.

Writing snippets...
lilyKAGHGDCBAII-verb1.tex is up to date.
lilyKBBGEFADHC-verb1.tex is up to date.
lilyKABBAFJDFFI-verb1.tex is up to date.
lilyKAIGDDBADDD-verb1.tex is up to date.

Invoking `lilypond --formats=ps --backend eps -I '/Users/mbh/SheetMusic/booktest' lilyKAGHGDCBAII lilyKBBGEFADHC lilyKABBAFJDFFI lilyKAIGDDBADDD'GNU LilyPond 2.6.4
Processing `'
Processing `working.ltx:11 (' In expression (set! toplevel-score-handler print-score-with-defaults): Unbound variable: print-score-with-defaults
lilypond-macros: warning: `lilypond' failed (status 2) (ignored)

lilypond-macros: error: Process lilypond --formats=ps --backend eps -I '/Users/mbh/SheetMusic/booktest' lilyKAGHGDCBAII lilyKBBGEFADHC lilyKABBAFJDFFI lilyKAIGDDBADDD exited unsuccessfully.
Removing `working.tex'
Traceback (most recent call last):
File "/Applications/", line 1670, in ?
    main ()
File "/Applications/", line 1653, in main
    ly.exit (1)
File "/Applications/ python/", line 139, in exit
    raise _ ('Exiting (%d)...') % i
Exiting (1)...

On Dec 13, 2005, at 5:15 AM, Bernard Hurley wrote:

Sorry, forgot the attachment!


On Tue, 2005-12-13 at 08:55 +0000, Bernard Hurley wrote:

I was going to post this stuff on Sunday, however I live in Hemel
Hempstead and have been a bit pre-occupied with other things. Here is a
first attempt at solving the problem.  I might not have much time to
work on this in the near future, but would appreciate any suggestions.

I attach a file called "lilypond-macros" (not a very good name -maybe
someone can think of another one). You will have to do a bit of editing to get it working on your system (I think I have documented it enough in the file - if you search for "invisible" you should find the lines that
need changing).

If you compare the effect of running:

        lilypond-book -V --psfonts <name>.lytex


        lilypond-macros -V --psfonts <name>.lytex

You will see that l-b substitutes inline code for the embedded LaTeX
code whereas l-m substitutes a call to "\lilyInputSystems". This macro
is contained in a file "<name>.mac" that is "\input" at the top of the
resulting .tex file.

From now on "<name>.mac" can be used in _any_ TeX file. You must write:

        \usepackage{graphics}  %% or: \usepackage{graphicx}
        \include <name>.mac

in your preamble. The macros available are:

1] \lilyInputSystems{<song name>}

This macro causes the music to be displayed so that it looks identical
the corresponding inline code generated by l-b. It takes account of
parameters "quote" and "verbatim" if they have been used in the
original .lytex file. The macros below do _not_ do this.

2] \lilyInputSingle{<song name>}{<system number>}

         A single system is displayed.

3] \lilyInputRange{<song name>}{<first system>}{<last system>}

        a Range of systems is displayed

4] \lilyInputVerbatim{<song name>}

        the verbatim lilypond code is displayed

5] \lilyHeader{<song name>}{<header name>}

        The lilypond header named "<header name>" is displayed.
At present l-m only finds the _first_ header block in the code. Also the
macro is fragile so you should write:




Some points:

A] The song names are at present generated by l-m etc. and have the form "SongA", "SongB" etc... And you will have to look in the generated .tex
code to see what they are.

B] The systems are numbered starting from "1". You will obviously have
to turn the generated .tex into .ps or .pdf to find out how many there

C] If you are happy with the generated macros you don't actually have to
run l-m again. You can simply work with .tex

D] At present you cannot "\import" two .mac files into the same LaTeX
file. Eventually it should be possible to gnerate libraries of songs for
use in LaTeX.

e] You don't need all the generated files to use the macros. The ones
you need in addition to the .mac file are:


And if you are using the --psfonts option, <name>.psfonts will be needed
by dvips.


On Sat, 2005-12-10 at 21:37 -0500, Michael Haynie wrote:
OK, I'm back from Alaska.  Sorry for the delay.

LaTeX macros with multiple parameters typically separate them with {},
so it would look like this:


I thought we'd have lilypond-book provide the reference number, so I'm
not sure what the reference would be, but I suppose that it could be
provided by lilypond-book during the rewrite step.  The rewrite is
currently replacing the call with stuff surrounding an \input. I think
I'd replace the \input with a call to yet another macro to be user
defined, maybe following the \ifx pattern used by pre and post
LilyPondExample.  Something like:

\includeLilypondSystems{reference number}{system count}

The user would define includeLilypondSystems to e.g. discard the title,
print the first system, or whatever.  The main weakness that I see is
that users would have to redefine the macro if they need to use several
definitions in the same book.  I'm not sure I know why one would want
to do that, but my need to do my own titles suggests that others might
need to do similarly odd things.

On Dec 2, 2005, at 8:53 AM, Bernard Hurley wrote:

On Thu, 2005-12-01 at 14:02 +0000, Bernard Hurley wrote:

This discussion, started on the "user" list. However it now seems more
appropriate for the "developer". We started discussing how header
might be used in lilypond-book and got on to discussing a possible
extension to \lilypondfile, with an optional extra parameter (As in
\lilypondfile[mysong{}). It should be possible for anyone
interested to pick it up from here.

Sorry it wouldn't quite work like this. Perhaps something like
would be better
Bernard Hurley <address@hidden>

Bernard Hurley <address@hidden>

reply via email to

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