On Thu, 2005-02-10 at 13:03 +0100, Georg Baum wrote: > Maybe. Maybe it is also a good idea to use $$p for converters, but we need > to know why the converter needs that flag in order to decide that. >
O.K. Let me explain what I am doing. I use Lilypond to typeset music. It is a program that turns lilypond source code into LaTeX code which is then run through LaTeX to generate the typeset music. It generates extremely high quality output but access to normal LaTeX functionality is extremely limited. So for instance if you can't generate things like contents pages. A _very_ _simple_ Lilypond score song.ly for a Song might look like: ++++++++++++++++++++++++++++++++ + ...... + + \include "voicepart.ly" + + ...... + + \include "pianopart.ly" + + ...... + + \include "lyrics.txt" + + ...... + + ...... + ++++++++++++++++++++++++++++++++ song.ly One reason for structuring it like this, apart form keeping myself sane, is that I can then extract the piano part or the voice part independently. In order to avail yourself of full LaTeX functionality, Lilypond comes with a utility called lilypond-book that (among other things) allows you to put Lilypond code inside a LaTeX document. The Lilypond manual says: =========== start of quote ============= For LaTeX, music is entered using \begin[options,go,here]{lilypond} YOUR LILYPOND CODE \end{lilypond} \lilypondfile[options,go,here]{filename} or \lilypond{ YOUR LILYPOND CODE } Running lilypond-book yields a file that can be processed with LaTeX. ============= end of quote ============= It is possible to use \begin -- \end {lilypond} or \lilypond within ERT, and it works but is only suitable if you have a couple of bars of music. So if I were putting my song in a LyX document I would use: \lilypondfile{path to song.ly} I don't want to use an absolute path because I work on this stuff on more than one computer and use CVS. I also sometimes check it out into a different directory when I want to see what changes are needed for a new version of Lilypond. A book on music might reference 80 or 90 Lilypond scores I would not want to change them all just because I had checked it out in a different directory! When I first started doing this I would export the LyX file to LaTeX and then run lilypond-book and dvips by hand. But this is an awful pain especially if you make a lot of small changes and want to look at the results after every one. Using a converter makes much more sense because it allows you to generate the postscript from within LyX. Unfortunately copying the LyX file to a temporary file messes up all the references. Copying the Lilypond file doesn't solve the problem because to do this I would need a "song-wrapper.ly" in the same directory as the LyX file, but song-wrapper.ly would have to reference song.ly using an absolute path. My present solution is that I have a script exports an environmental variable MYDIR=`pwd` and then calls LyX. This variable is then picked up by the converter. But of course converter will only work for LyX files in one directory so I might need several instances of LyX running! If LyX passed the directory of the LyX file as a parameter it would make life much easier for me! But it would also mean that anyone else who wanted the converter could use it without hassle. Thanks, Bernard