[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-users
Subject:    Re: Lilypond integration
From:       Guenter Milde <milde () users ! berlios ! de>
Date:       2009-04-01 8:32:55
Message-ID: gqv8rn$si5$1 () ger ! gmane ! org
[Download RAW message or body]

On 2009-03-23, Helge Hafting wrote:

>> I don't know if it's possible, but the ideal solution (for me) would be 
>> some kind of lilypond environment (somewhat like the math environment), 
>> where you can type in your lilypond code directly. 

This could be done, best in a "lilypond.module".

>> After leaving this environment, the graphic is rendered and put into
>> place in the LyX document. If you need to change it, you just click on
>> the graphic and the code environment pops up again.

This is rather hard. With lilypond-book, you will have to live with
the source code in LyX.

> Support for lilypond-book would be interesting. And sure - if you 
> volunteer to do some work then you will get it faster.

> This process can be divided into several steps, you won't have to do it 
> all at once.

> 1. Work on the support for lilypond-book.
>     This will have LyX create latex output as usual,
>     then, add code to run lilypond-book on the produced file
>     Finally, let LyX run latex/pdflatex on the file produced, as usual.
>     So this step is mostly about inserting an invocation
>     of "lilypond-book" into the existing workflow.

We have an example of "latex-preprocessing" with the literate
programming (noweb) support. It is already (ab)used for R code with
sweave. I would very much like a generalisation, where a module could
trigger such preprocessing an set the preprocessor. 

Idea:

In the module:

  Style Lilypond
    ...
    ExportsTo  lilytex
  End  

-> Would call the created LaTeX source <filename.lilytex>.

In the Converters:

   LilyTeX -> LaTeX (plain):  lilypond-book $$i $$a
   
>     At this point, use a new document settings to decide whether
>     lyx should do this lilypond-book step or not. Many lyx documents
>     have no lilypond content, and many lyx users don't have lilypond.

This is why I want to define the Lilypond style in a module. This
would also allow combination with any (?) document class.


> 2. With lilypond-book working, start on the lilypond environment.
>     first figure out if it ought to be a inset, a layout module, or
>     whatever. I guess an inset will be the way.
>     Then add the rule about how LyX produces latex code when processing
>     a lilypond inset. This is easy - just output \begin{lilypond}
>     followed by the inset contents, followed by \end{lilypond}

>     At this point, you have working lilypond-book!

This step can even be tried before the first step -- if you export to
latex and run lilypond-book and latex by hand.

> 3. Some fine-tuning. Remove the document setting that specifies if this
>     is a lilypond document. Instead, add logic so that LyX will run
>     lilypond-book whenever the document contains a lilypond inset.
>     You can perhaps make use of similiar logic that add latex packages
>     on an as-needed basis.

As stated above, I would prefer a generalization of the code for
literate programming.

> 4. The preview. Arrange so Lyx runs the inset content through
>     lilypond, and display the resulting .png if this succeeds.
>     I am not sure how to do this part, but look at how it is done
>     for math and graphichs insets.

If a preview is important, it might be simpler to go a completely
different route: amend the external inset so that it allows in-place
editing of the source instead of relying on an external file.

Günter

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic