Re: extending \lilypondfile was: Re: Extracting header fields for use by e.g. LaTeX?
On Tue, 2005-12-13 at 23:32 -0500, Michael Haynie wrote: 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? It looks like some scheme names have changed change between versions 2.6.x and 2.7.x. Lines 554-558 of l-m read: #(set! toplevel-score-handler print-score-with-defaults) #(set! toplevel-music-handler (lambda (p m) (print-score-with-defaults p (scorify-music m p I copied these straight from l-b the 2.7.x version of l-b. The 2.6.x version has: #(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 Try replacing the lines with the old version. A word of warning if you don't know Python: the lines are _inside_ a Python multi-line string which is then written into a .ly file. So if you want to comment out the 2.7.x code you have to use lilypond comments _not_ Python comments. Also be aware that to get a % - the lilypond comment symbol yo have to type %% good luck /Bernard 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 (./tmpVa0Kzy.tex 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. (/sw/share/texmf-dist/tex/latex/base/article.cls Document Class: article 2004/02/16 v1.4f Standard LaTeX document class (/sw/share/texmf-dist/tex/latex/base/size12.clo)) (/sw/share/texmf-dist/tex/latex/graphics/graphics.sty (/sw/share/texmf-dist/tex/latex/graphics/trig.sty) (/sw/share/texmf-dist/tex/latex/graphics/graphics.cfg) (/sw/share/texmf-dist/tex/latex/graphics/dvips.def)) No file tmpVa0Kzy.aux. textwidth=390.0pt columnsep=10.0pt (./tmpVa0Kzy.aux) ) No pages of output. Transcript written on tmpVa0Kzy.log. Dissecting... 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. Processing... Invoking `lilypond --formats=ps --backend eps -I '/Users/mbh/SheetMusic/booktest' snippet-map.ly lilyKAGHGDCBAII lilyKBBGEFADHC lilyKABBAFJDFFI lilyKAIGDDBADDD'GNU LilyPond 2.6.4 Processing `snippet-map.ly' Parsing... Processing `working.ltx:11 (lilyKAGHGDCBAII.ly)' Parsing...lilyKAGHGDCBAII.ly:1:1: In expression (set! toplevel-score-handler print-score-with-defaults): lilyKAGHGDCBAII.ly:1:1: 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' snippet-map.ly lilyKAGHGDCBAII lilyKBBGEFADHC lilyKABBAFJDFFI lilyKAIGDDBADDD exited unsuccessfully. Removing `working.tex' Traceback (most recent call last): File /Applications/LilyPond.app//Contents/Resources/bin/lilypond-macros, line 1670, in ? main () File /Applications/LilyPond.app//Contents/Resources/bin/lilypond-macros, line 1653, in main ly.exit (1) File /Applications/LilyPond.app/Contents/Resources/share/lilypond/current/ python/lilylib.py, line 139, in exit raise _ ('Exiting (%d)...') % i Exiting (1)... lilypond-macros -- Bernard Hurley [EMAIL PROTECTED] ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: [Spam:SpamScore 16.1] Re: extending \lilypondfile was: Re: Extracting header fields for use by e.g. LaTeX?
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 (./tmpVa0Kzy.tex 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. (/sw/share/texmf-dist/tex/latex/base/article.cls Document Class: article 2004/02/16 v1.4f Standard LaTeX document class (/sw/share/texmf-dist/tex/latex/base/size12.clo)) (/sw/share/texmf-dist/tex/latex/graphics/graphics.sty (/sw/share/texmf-dist/tex/latex/graphics/trig.sty) (/sw/share/texmf-dist/tex/latex/graphics/graphics.cfg) (/sw/share/texmf-dist/tex/latex/graphics/dvips.def)) No file tmpVa0Kzy.aux. textwidth=390.0pt columnsep=10.0pt (./tmpVa0Kzy.aux) ) No pages of output. Transcript written on tmpVa0Kzy.log. Dissecting... 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. Processing... Invoking `lilypond --formats=ps --backend eps -I '/Users/mbh/SheetMusic/booktest' snippet-map.ly lilyKAGHGDCBAII lilyKBBGEFADHC lilyKABBAFJDFFI lilyKAIGDDBADDD'GNU LilyPond 2.6.4 Processing `snippet-map.ly' Parsing... Processing `working.ltx:11 (lilyKAGHGDCBAII.ly)' Parsing...lilyKAGHGDCBAII.ly:1:1: In expression (set! toplevel-score-handler print-score-with-defaults): lilyKAGHGDCBAII.ly:1:1: 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' snippet-map.ly lilyKAGHGDCBAII lilyKBBGEFADHC lilyKABBAFJDFFI lilyKAIGDDBADDD exited unsuccessfully. Removing `working.tex' Traceback (most recent call last): File /Applications/LilyPond.app//Contents/Resources/bin/lilypond-macros, line 1670, in ? main () File /Applications/LilyPond.app//Contents/Resources/bin/lilypond-macros, line 1653, in main ly.exit (1) File /Applications/LilyPond.app/Contents/Resources/share/lilypond/current/ python/lilylib.py, 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! /Bernard On Tue, 2005-12-13 at 08:55 +, Bernard Hurley wrote: Hi, 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 and: 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
Re: extending \lilypondfile was: Re: Extracting header fields for use by e.g. LaTeX?
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: \lilypondfile[options]{filename}{reference} 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 +, Bernard Hurley wrote: Hi, This discussion, started on the user list. However it now seems more appropriate for the developer. We started discussing how header fields 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{song.ly}). It should be possible for anyone interested to pick it up from here. Sorry it wouldn't quite work like this. Perhaps something like \lilypondfile[options]{filename,reference} would be better -- Bernard Hurley [EMAIL PROTECTED] ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: extending \lilypondfile was: Re: Extracting header fields for use by e.g. LaTeX?
On Thu, 2005-12-01 at 14:02 +, Bernard Hurley wrote: Hi, This discussion, started on the user list. However it now seems more appropriate for the developer. We started discussing how header fields 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{song.ly}). It should be possible for anyone interested to pick it up from here. Sorry it wouldn't quite work like this. Perhaps something like \lilypondfile[options]{filename,reference} would be better -- Bernard Hurley [EMAIL PROTECTED] ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel