LilyPond in TextWrangler
The package at the bottom of the page contains a LilyPond syntax colouring file and scripts to typeset LilyPond documents in TextWrangler.
The scripts require my TeXShop engines for LilyPond. If you do not use TeXShop, you still need to download the above engines, but you will need to edit the scripts (see Customization below).
- In the Finder, browse to ~/Library/Applications Support/TextWrangler (~ is a shorthand for the path to your home folder).
Language Modulesfolder (create the folder if it does not exist).
Engrave Book.scptinto the
Scriptsfolder (create the folder if it does not exist).
- Re-open TextWrangler.
- Go to TextWrangler > Preferences… > Languages. In the Suffix Mappings list you should see that the
.lysuffix is associated to LilyPond syntax.
- Add another suffix mapping by clicking on the Add… button. In the dialog, write
.lytexin the Extension field and choose LilyPond from the Map to: pop-up menu. Click Add. Close the Preferences window.
- Go to Window > Palettes > Scripts to open the Scripts palette.
- Open a
.lytexdocument, and double-click on Engrave or Engrave Book, respectively, in the Scripts palette.
- If there are no compilation errors, you should see the resulting PDF in TeXShop. If there are compilation errors, the log file is automatically opened in TextWrangler.
Q: How to change the PDF previewer?
A: Open each *.scpt file with the AppleScript Editor (which is located in /Applications/Utilities) and change the line that reads
property PDFVIEWER : "TeXShop"
to your favourite PDF viewer. For example, if you want to view the PDF in Skim, use
property PDFVIEWER : "Skim"
If you want to use Preview, use
property PDFVIEWER : "Preview"
and so on. Then compile and save the script.
Q: How to use the scripts without TeXShop?
A: First, change the default PDF previewer (see above). Then, download my TeXShop engines for LilyPond. Put them somewhere, say in ~/Documents/LilyPond-Engines. Then edit each *.scpt and change the
ENGINE variable to point to the above location. For example:
set ENGINE to the POSIX path of (path to documents folder from user domain) & "LilyPond-Engines/" & LILYENGINE
Compile and save the script.
Adds compatibility with TextWrangler 4.x.