Dear Hans, something broke backward compatibility in MKII. When using buffers like in \startbuffer[buffername] hello world \stopbuffer the code now creates buffername.tmp instead of \jobname-buffername.tmp. This breaks the gnuplot module in weird ways. I can probably fix it in one way or another, but I'm not sure why the behaviour would change. To fix the vim module? :) :) :) OK, I need to take some time and try to use Aditya's code in the background anyway, but I still wonder if the change was intentional or not. Thanks, Mojca
On Fri, 19 Aug 2011, Mojca Miklavec wrote:
Dear Hans,
something broke backward compatibility in MKII.
When using buffers like in
\startbuffer[buffername] hello world \stopbuffer
the code now creates buffername.tmp instead of \jobname-buffername.tmp.
Works fine with 2011.08.04, so something broke in the latest version.
OK, I need to take some time and try to use Aditya's code in the background anyway
In MkIV, with the filter module it is now possible to use preamble and postample buffers for each filters. With this, the basic functionality of the gnuplot module works fine (but I only tested the pdf and png backends, not the context backend). I am also thinking of providing an interface for parsing the buffer content at lua end. That will allow us to implement all the features of the gnuplot and lilypond module using the filter module. But I need some testers, as I don't use either of the programs. Aditya
Am 2011-08-18 um 23:29 schrieb Aditya Mahajan:
I am also thinking of providing an interface for parsing the buffer content at lua end. That will allow us to implement all the features of the gnuplot and lilypond module using the filter module. But I need some testers, as I don't use either of the programs.
I don't understand what you're planning, but I'll do the testing for LilyPond. (Current version works for me, but I never tried to get inline music, and I only use MkIV.) Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
Hi Hraban On Fri, 19 Aug 2011, Henning Hraban Ramm wrote:
Am 2011-08-18 um 23:29 schrieb Aditya Mahajan:
I am also thinking of providing an interface for parsing the buffer content at lua end. That will allow us to implement all the features of the gnuplot and lilypond module using the filter module. But I need some testers, as I don't use either of the programs.
I don't understand what you're planning,
I am planning to add features so that you can say: \startlilypondpreamble global settings \stoplilypondpreamble \startlilypond the score \stoplilypond and get a correct output (this is more or less possible right now). The other thing is to be able to change linespace, papersize, offset, etc using parameters, so that one can say: \startlilypond[linespace=...] ... \stoplilypond This will require some lua side processing.
but I'll do the testing for LilyPond.
Do you know how lilypond numbers its output files. In some cases I get filename-1.pdf sometimes not. Can I force it to always give filename-1.pdf or always give filename.pdf Which OSes do you have access to? Thanks, Aditya
Am 2011-08-19 um 17:08 schrieb Aditya Mahajan:
I don't understand what you're planning,
I am planning to add features so that you can say:
\startlilypondpreamble global settings \stoplilypondpreamble
Ah, that's great - at the moment I just import the same settings.ly file into every score of a songbook. But - can you even support different setups, say \startlilypondpreamble global settings for everything \stoplilypondpreamble \startlilypondpreamble[snippet] global settings for snippets \stoplilypondpreamble \startlilypondpreamble[fullscore] global settings for full scores \stoplilypondpreamble \startlilypond[setup=fullscore] the score \stoplilypond etc.
The other thing is to be able to change linespace, papersize, offset, etc using parameters, so that one can say: \startlilypond[linespace=...] ... \stoplilypond This will require some lua side processing.
You mean, translate ConTeXt-style settings to LilyPond settings, like we did with the old module? That wouldn’t make much sense. LilyPond just has too much settings. And most of them you can set in different ways. To fully support this, you’d need a complete LilyPond parser including Scheme. And a small set of settings is never the right set for everyone. Ok, there are a few settings that we could translate, e.g. set ConTeXt’s main fonts also for LilyPond. We don’t need LilyPond's layout settings, as long as we go the \externalfigure path. I don’t know a solution for line breaking of scores - if you’d set LilyPond’s page size to ConTeXt’s remaining space, it would stay the same for the second page. Perhaps we can get single lines (systems) and let ConTeXt to the page breaking. I’ll look into that. But I don’t know how we can make it "right" WRT LilyPond snippets - I’d want to align a note systems’s base line with ConTeXt’s text baseline, but the height and clipping of a snippet depends on the visible elements. Without some picture analysis (or runtime data from LilyPond, that doesn’t exist AFAIK) you need to adjust your snippets manually.
Do you know how lilypond numbers its output files. In some cases I get filename-1.pdf sometimes not. Can I force it to always give filename-1.pdf or always give filename.pdf
LilyPond adds a number to EPS, if there’s more that one page. But in my songbook setup, I always get a filename-temp-lilypond-##.eps plus an identical filename-temp-lilypond-##-1.eps When you order more than one \midi{} in several \score blocks, the first MIDI file is unnumbered, the second gets number 1 etc.; didn’t try with different \layout blocks yet. Seems like I must do some tests with multipage scores.
Which OSes do you have access to?
Normally I work on OSX Intel 10.5.8; I've access to Windows 7/64 and Ubuntu/Debian machines. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
On Fri, 19 Aug 2011, Henning Hraban Ramm wrote:
Am 2011-08-19 um 17:08 schrieb Aditya Mahajan:
But - can you even support different setups, say
\startlilypondpreamble global settings for everything \stoplilypondpreamble
\startlilypondpreamble[snippet] global settings for snippets \stoplilypondpreamble
\startlilypondpreamble[fullscore] global settings for full scores \stoplilypondpreamble
\startlilypond[setup=fullscore] the score \stoplilypond
etc.
Yes. I can support the following syntax: \startbuffer[snippets] ... \stopbuffer \startbuffer[fullscore] ... \stopbuffer \startbuffer[common] ... \stopbuffer \startlilypond[bufferbefore={snippets,common}, bufferafter={....}] .... \stoplilypond (In fact, provide similar support for anything defined using the filter module).
The other thing is to be able to change linespace, papersize, offset, etc using parameters, so that one can say: \startlilypond[linespace=...] ... \stoplilypond This will require some lua side processing.
You mean, translate ConTeXt-style settings to LilyPond settings, like we did with the old module?
Yes.
That wouldn’t make much sense. LilyPond just has too much settings. And most of them you can set in different ways. To fully support this, you’d need a complete LilyPond parser including Scheme. And a small set of settings is never the right set for everyone.
OK.
Ok, there are a few settings that we could translate, e.g. set ConTeXt’s main fonts also for LilyPond.
Agreed. Does anyone know how to get the name of the current font in MkIV?
We don’t need LilyPond's layout settings, as long as we go the \externalfigure path.
But I think that at least automatic paper size settings (set paper size to be equal to text area) are needed.
I don’t know a solution for line breaking of scores - if you’d set LilyPond’s page size to ConTeXt’s remaining space, it would stay the same for the second page. Perhaps we can get single lines (systems) and let ConTeXt to the page breaking. I’ll look into that.
OK.
But I don’t know how we can make it "right" WRT LilyPond snippets - I’d want to align a note systems’s base line with ConTeXt’s text baseline, but the height and clipping of a snippet depends on the visible elements. Without some picture analysis (or runtime data from LilyPond, that doesn’t exist AFAIK) you need to adjust your snippets manually.
Does lilypond-book handle this at all? It does not appear to. Manually adjusting each inline snippet will be too much work, IMO.
Do you know how lilypond numbers its output files. In some cases I get filename-1.pdf sometimes not. Can I force it to always give filename-1.pdf or always give filename.pdf
LilyPond adds a number to EPS, if there’s more that one page. But in my songbook setup, I always get a filename-temp-lilypond-##.eps plus an identical filename-temp-lilypond-##-1.eps
When you order more than one \midi{} in several \score blocks, the first MIDI file is unnumbered, the second gets number 1 etc.; didn’t try with different \layout blocks yet.
Seems like I must do some tests with multipage scores.
Look at the current version on github. It should be able to handle multi-page snippets. Aditya
Hi Aditya & Hraban, I'm very glad to see improved Lilypond integration being discussed. I can't offer too much besides moral support, but would just point out one solution I've found for proper width/alignment of a snippet with extra-staff material (e.g. a piano staff marker { ): If the ConTeXt textwidth is equal to the Lilypond line-width, aligning the float to the right gives you a snippet nicely aligned with flush text (extra-staff material being pushed towards the left margin). Something like this (as in the example in the garden): \def\readlilypondoutput#1{\setupfloats[location=right,frame=off]\placefigure[]{}}{\externalfigure[#1]}} Regards, David On Aug 20, 2011, at 1:19 AM, Aditya Mahajan wrote:
On Fri, 19 Aug 2011, Henning Hraban Ramm wrote:
Am 2011-08-19 um 17:08 schrieb Aditya Mahajan:
But - can you even support different setups, say
\startlilypondpreamble global settings for everything \stoplilypondpreamble
\startlilypondpreamble[snippet] global settings for snippets \stoplilypondpreamble
\startlilypondpreamble[fullscore] global settings for full scores \stoplilypondpreamble
\startlilypond[setup=fullscore] the score \stoplilypond
etc.
Yes. I can support the following syntax:
\startbuffer[snippets] ... \stopbuffer
\startbuffer[fullscore] ... \stopbuffer
\startbuffer[common] ... \stopbuffer
\startlilypond[bufferbefore={snippets,common}, bufferafter={....}] .... \stoplilypond
(In fact, provide similar support for anything defined using the filter module).
The other thing is to be able to change linespace, papersize, offset, etc using parameters, so that one can say: \startlilypond[linespace=...] ... \stoplilypond This will require some lua side processing.
You mean, translate ConTeXt-style settings to LilyPond settings, like we did with the old module?
Yes.
That wouldn’t make much sense. LilyPond just has too much settings. And most of them you can set in different ways. To fully support this, you’d need a complete LilyPond parser including Scheme. And a small set of settings is never the right set for everyone.
OK.
Ok, there are a few settings that we could translate, e.g. set ConTeXt’s main fonts also for LilyPond.
Agreed. Does anyone know how to get the name of the current font in MkIV?
We don’t need LilyPond's layout settings, as long as we go the \externalfigure path.
But I think that at least automatic paper size settings (set paper size to be equal to text area) are needed.
I don’t know a solution for line breaking of scores - if you’d set LilyPond’s page size to ConTeXt’s remaining space, it would stay the same for the second page. Perhaps we can get single lines (systems) and let ConTeXt to the page breaking. I’ll look into that.
OK.
But I don’t know how we can make it "right" WRT LilyPond snippets - I’d want to align a note systems’s base line with ConTeXt’s text baseline, but the height and clipping of a snippet depends on the visible elements. Without some picture analysis (or runtime data from LilyPond, that doesn’t exist AFAIK) you need to adjust your snippets manually.
Does lilypond-book handle this at all? It does not appear to. Manually adjusting each inline snippet will be too much work, IMO.
Do you know how lilypond numbers its output files. In some cases I get filename-1.pdf sometimes not. Can I force it to always give filename-1.pdf or always give filename.pdf
LilyPond adds a number to EPS, if there’s more that one page. But in my songbook setup, I always get a filename-temp-lilypond-##.eps plus an identical filename-temp-lilypond-##-1.eps
When you order more than one \midi{} in several \score blocks, the first MIDI file is unnumbered, the second gets number 1 etc.; didn’t try with different \layout blocks yet.
Seems like I must do some tests with multipage scores.
Look at the current version on github. It should be able to handle multi-page snippets.
Aditya___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Am 2011-08-20 um 10:19 schrieb Aditya Mahajan:
The other thing is to be able to change linespace, papersize, offset, etc using parameters, so that one can say: \startlilypond[linespace=...] ... \stoplilypond This will require some lua side processing.
You mean, translate ConTeXt-style settings to LilyPond settings, like we did with the old module? Yes. That wouldn’t make much sense. LilyPond just has too much settings. And most of them you can set in different ways. To fully support this, you’d need a complete LilyPond parser including Scheme. And a small set of settings is never the right set for everyone. OK.
Or we support the same set of options as lilypond-book (the LaTeX module), see http://lilypond.org/doc/v2.14/Documentation/usage/music-fragment-options
Ok, there are a few settings that we could translate, e.g. set ConTeXt’s main fonts also for LilyPond.
Agreed. Does anyone know how to get the name of the current font in MkIV?
We don’t need LilyPond's layout settings, as long as we go the \externalfigure path.
But I think that at least automatic paper size settings (set paper size to be equal to text area) are needed.
I wouldn’t try to adapt LilyPond’s paper size, but only set line width and use lilypond-book mode to get cropped scores. Otherwise we would need to account for margins and place the score with negative offset etc. At least for full scores it would make sense to synchronize: - line width to \textwidth - fonts: #(define fonts (make-pango-font-tree "TeX Gyre Schola" "LMSans10" "LMTypewriter10 Regular" (/ 14 20))) I’d even suggest to set Schola as ConTeXt’s default font in t- lilypond. - staff size according to body font (staff size 14 matches bodyfont 8.5pt) General settings: - no point-and-click: #(ly:set-option (quote no-point-and-click)) - no headers/footers/titles/pagination - ragged bottom - no indents (but that might be a matter of taste, since it’s LilyPond default to indent the first line) - keep lyrics inside line: \override PaperColumn #'keep-inside-line = ##t Everything else is just a matter of taste and design, I guess.
I don’t know a solution for line breaking of scores - if you’d set LilyPond’s page size to ConTeXt’s remaining space, it would stay the same for the second page. Perhaps we can get single lines (systems) and let ConTeXt to the page breaking. I’ll look into that. OK.
I’m waiting for answers from the LP ML.
But I don’t know how we can make it "right" WRT LilyPond snippets - I’d want to align a note systems’s base line with ConTeXt’s text baseline, but the height and clipping of a snippet depends on the visible elements. Without some picture analysis (or runtime data from LilyPond, that doesn’t exist AFAIK) you need to adjust your snippets manually.
Does lilypond-book handle this at all? It does not appear to. Manually adjusting each inline snippet will be too much work, IMO.
Probably.
Do you know how lilypond numbers its output files. In some cases I get filename-1.pdf sometimes not. Can I force it to always give filename-1.pdf or always give filename.pdf
LilyPond adds a number to EPS, if there’s more that one page. But in my songbook setup, I always get a filename-temp-lilypond- ##.eps plus an identical filename-temp-lilypond-##-1.eps
When you order more than one \midi{} in several \score blocks, the first MIDI file is unnumbered, the second gets number 1 etc.; didn’t try with different \layout blocks yet.
Seems like I must do some tests with multipage scores.
Look at the current version on github. It should be able to handle multi-page snippets.
Problem is, if a multi-page score starts somewhere mid-page, e.g. below a title, LilyPond doesn’t know to break early enough. Please use -dno-gs-load-fonts i.e. *don’t* let GhostScript load its own fonts, since all needed fonts are in the (E)PS anyway, that makes processing faster. Current version doesn’t work at all: - it writes the buffer with doubled filename and extension parts, i.e. from foo.tex "foo-foo-temp-lilypond.tmp.tmp", but looks for "foo-temp- lilypond.tmp". - even if I rename the buffer file, LilyPond isn’t run. t-filter > current filter : lilypond t-filter > base file : test1-temp-lilypond t-filter > input file : test1-temp-lilypond.tmp t-filter > output file : t-filter > command : Greetlings from Lake Constance --- fiëé visuëlle Henning Hraban Ramm http://www.fiee.net http://angerweit.tikon.ch/lieder/ https://www.cacert.org (I'm an assurer)
Am 2011-08-21 um 14:07 schrieb Henning Hraban Ramm:
I don’t know a solution for line breaking of scores - if you’d set LilyPond’s page size to ConTeXt’s remaining space, it would stay the same for the second page. Perhaps we can get single lines (systems) and let ConTeXt to the page breaking. I’ll look into that. OK. I’m waiting for answers from the LP ML.
Got an answer: If you include the scheme functions from share/lilypond/current/ly/ lilypond-book-preamble.ly, you get one file per system, if you don’t use a \book block within lilypond. The system count is in foo-systems.count, i.e. read the number from that file and use \externalfigure so often. This additional processing takes a lot of time, so we should only do it if we really need page breaking - best make it an option (split=yes).
Do you know how lilypond numbers its output files. In some cases I get filename-1.pdf sometimes not. Can I force it to always give filename-1.pdf or always give filename.pdf
IME there’s always a filename.pdf; you get filename-1.pdf for your first page; if you use the preamble quoted above, you’ll get filename-1.pdf etc. for every system. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
On Sun, 21 Aug 2011, Henning Hraban Ramm wrote:
Current version doesn’t work at all: - it writes the buffer with doubled filename and extension parts, i.e. from foo.tex "foo-foo-temp-lilypond.tmp.tmp", but looks for "foo-temp-lilypond.tmp".
The \savebuffer command has changed!!! \starttext \startbuffer[abc] test \stopbuffer \savebuffer[abc][name.ext] \stoptext now creates a file \jobname-name.ext, rather than name.ext. I'll provide a work around.
- even if I rename the buffer file, LilyPond isn’t run.
t-filter > current filter : lilypond t-filter > base file : test1-temp-lilypond t-filter > input file : test1-temp-lilypond.tmp t-filter > output file : t-filter > command :
With the latest version, I also get this. Strange. Aditya
On 22-8-2011 00:14, Aditya Mahajan wrote:
On Sun, 21 Aug 2011, Henning Hraban Ramm wrote:
Current version doesn’t work at all: - it writes the buffer with doubled filename and extension parts, i.e. from foo.tex "foo-foo-temp-lilypond.tmp.tmp", but looks for "foo-temp-lilypond.tmp".
The \savebuffer command has changed!!!
well, you wanted a jobname as prefix -) (in mkii that only happens with the \protectbuffers flag is set, in mkiv always) Just tell me what you expect Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Mon, 22 Aug 2011, Hans Hagen wrote:
On 22-8-2011 00:14, Aditya Mahajan wrote:
On Sun, 21 Aug 2011, Henning Hraban Ramm wrote:
Current version doesn’t work at all: - it writes the buffer with doubled filename and extension parts, i.e. from foo.tex "foo-foo-temp-lilypond.tmp.tmp", but looks for "foo-temp-lilypond.tmp".
The \savebuffer command has changed!!!
well, you wanted a jobname as prefix -)
In MkII, not MkIV :)
(in mkii that only happens with the \protectbuffers flag is set, in mkiv always)
Just tell me what you expect
My preference is for \savebuffer[...][filename] to write contents in filename. No funny prefix or suffix. If you have to add prefix and suffixes, please make it configurable (like \bufferprefix and \f!temporaryfilenameextension in MkII). With the current MkIV implementation, I cannot directly write the buffer to a file in another directory. Of course, I can work around using file.move, but that is adding one extra step. Aditya
On Sun, 21 Aug 2011, Aditya Mahajan wrote:
On Sun, 21 Aug 2011, Henning Hraban Ramm wrote:
- even if I rename the buffer file, LilyPond isn’t run.
t-filter > current filter : lilypond t-filter > base file : test1-temp-lilypond t-filter > input file : test1-temp-lilypond.tmp t-filter > output file : t-filter > command :
With the latest version, I also get this. Strange.
This took a while to debug. The internal representation of the namespace macros has changed in MkIV. \definenamespace[whatever][...] \definewhatever[something][key=value] now defines a macro \whatever:something:key rather than \whateversomethingkey (note the extra colon). In the filter module, I had: \getparameters[\externalfilter::namespace#1][\s!parent=\externalfilter::namespace,#2] which fails in MkIV. To get a working solution in both MkII and MkIV I need: \setupexternalfilter[#1][\s!parent=\externalfilter::namespace,#2] @Hans and Wolfgang: Is it possible to change the internnal representation in mult-aux.mkii so that MkII and MkIV are consistent again? @Hraban: Long story short, the filter module is working again. Can you test the dev branch from the latest git version? Aditya
Am 2011-08-22 um 03:53 schrieb Aditya Mahajan:
@Hraban: Long story short, the filter module is working again. Can you test the dev branch from the latest git version?
Thank you! LilyPond ist called, but your approach of including the LaTeX file fails, since you don’t define \linebreak from: """ \includegraphics{test1-temp-lilypond-0-1}% \ifx\betweenLilyPondSystem \undefined \linebreak \else \expandafter\betweenLilyPondSystem{1}% \fi """ In my test case (where I include the "one system per file" patch) I can \def\linebreak{\relax} and get a nice multi-page score. Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
On Mon, 22 Aug 2011, Henning Hraban Ramm wrote:
Am 2011-08-22 um 03:53 schrieb Aditya Mahajan:
@Hraban: Long story short, the filter module is working again. Can you test the dev branch from the latest git version?
Thank you! LilyPond ist called, but your approach of including the LaTeX file fails, since you don’t define \linebreak from:
I need bigger test files :) I find creating TeX macros to parse the latex output easier than understanding what lilypond creates (there is very little documentation about what goes on behind the scenes). Even the generated latex output is horrible, but, at least, I understand what it does.
""" \includegraphics{test1-temp-lilypond-0-1}% \ifx\betweenLilyPondSystem \undefined \linebreak \else \expandafter\betweenLilyPondSystem{1}% \fi """
Can you send me the complete example?
In my test case (where I include the "one system per file" patch) I can \def\linebreak{\relax} and get a nice multi-page score.
and also send the "one system per file" patch (is it just including lilypond-book-preamble.ly?). I'll add \let\linebreak\donothing to lilypond::setups. Aditya
I have not tested this, but such a change will also breakthe filter module in MKII.
On Aug 18, 2011, at 6:32 PM, Mojca Miklavec
Dear Hans,
something broke backward compatibility in MKII.
When using buffers like in
\startbuffer[buffername] hello world \stopbuffer
the code now creates buffername.tmp instead of \jobname-buffername.tmp.
This breaks the gnuplot module in weird ways. I can probably fix it in one way or another, but I'm not sure why the behaviour would change. To fix the vim module? :) :) :)
OK, I need to take some time and try to use Aditya's code in the background anyway, but I still wonder if the change was intentional or not.
Thanks, Mojca ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 19-8-2011 00:32, Mojca Miklavec wrote:
Dear Hans,
something broke backward compatibility in MKII.
When using buffers like in
\startbuffer[buffername] hello world \stopbuffer
the code now creates buffername.tmp instead of \jobname-buffername.tmp.
This breaks the gnuplot module in weird ways. I can probably fix it in one way or another, but I'm not sure why the behaviour would change. To fix the vim module? :) :) :)
OK, I need to take some time and try to use Aditya's code in the background anyway, but I still wonder if the change was intentional or not.
Probably a side effect of some cleaning up of filename code deep down. Normally in mkiv buffers are not saved on disk (as with mkii). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Aditya Mahajan
-
David Wooten
-
Hans Hagen
-
Henning Hraban Ramm
-
Mojca Miklavec