15/07/2010

HowTo edit lilypond with TeXworks

Apart from jEdit, which is awfully bloated, there is no decent Lilypond editor for Windows and it sucks to close the Acrobat Reader every time you recompile - which you do really often while typesetting music.
Edit (07/2012): As of now, there is a decent Windows editor for Lilypond, as Wilbert Berendsen has made his excellent Frescobaldi editor KDE independent. Find a full installer here.
It is, however, possible to tweak TeXworks (included in MikTeX), whose PDF viewer doesn't create a lock that keeps lilypond from compiling. You have to do two things: create a lilypond compiler profile in TeXworks and edit one of Lilypond's scheme files to prevent the PDF file from being deleted (else you get the "backend-library.scm Permission denied" error). I got the trick from this comp.tex.texworks thread (by Helge Kruse).

Compiler profile: Edit→Preferences→Typesetting: add <Windows program directory>/LilyPond/usr/bin to the list of paths on top and create a new processing tool "lilypond" with the app lilypond-windows.exe and the $fullname argument.

Lilypond tweak: Open the file <Windows program directory>/LilyPond/usr/share/lilypond/current/scm/backend-library.scm in an editor with admin permissions, search for these two lines:
(if (access? pdf-name W_OK)
   (delete-file pdf-name))))
and comment them out (keep two closing parentheses):
;;(if (access? pdf-name W_OK)
   ;;(delete-file pdf-name))
   ))
Remember to do this each time you update Lilypond.


No comments: