Write music in TeXmacs

The code of the Graph plugin is quite easy to read. I took a look at the code and it turns out the logic for generating pictures using pdflatex is quite straightforward. The program to generate music sheets is called lilypond. It is also uses Scheme.

Please follow the following:

  1. Create a file lilypond.py from pdflatex.py in the folder plugins/tmpy/graph/, change every line of code that has PDFLatex into lilypond; delete the arguments in the cmd0 variable.
  2. add lilypond() where PDFLatex() appears in the file plugins/tmpy/session/tm_graph.py

One should look at other backends such as xypic in order to customize the size of the output.

Now look at the output:

P.S. This is a hack. The credit goes to the original author of Graph plugin.

5 Likes

This is wonderful. I’ve used Lilypond a bit before, and thought it was very great. Didn’t learn that much, because it was sufficient and I’d no more complex project.

Now, unrelatedly, ages later, I’m trying out TeXmacs, which I had seen once or twice but didn’t realise it was a thriving active project… And it works immediately for some simple creation of PDFs I needed, and the documentation and everything looks amazing.

So I’m thrilled, and I join the forum, feeling silly for not trying it out sooner, and ask myself: what is it with Guile and typesetting? Is that a thing?

Then I do a search for Lilypond and see this! How very neat! The circle is completed (somewhat) :yin_yang:

3 Likes

I think you can also use the Fold function to show without the interactive code

2 Likes