MetaPost in TextWrangler
Since TeXShop does not support syntax coloring for MetaPost (yet), I use TextWrangler to write my MetaPost programs. The TextWrangler’s syntax definition file included in the archive at the bottom of this page offers
- support for all MetaFont and Plain MetaPost keywords, plus most of the MetaFun macros;
- macro definitions,
begincharin the pop-up function menu.
Besides, the archive includes some AppleScript scripts that can be used to typeset MetaPost programs using my engines directly from TextWrangler and preview the result in TeXShop or in another PDF viewer.
The scripts require my TeXShop engines for MetaPost.
- 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).
- Copy the .scpt files into the Scripts folder (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 .mp suffix is associated to MetaPost syntax.
- Add another suffix mapping by clicking on the Add… button. In the dialog, write
.mfin the Extension field and choose MetaPost 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
.mfdocument, and double-click on one of the scripts 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?
Compile MetaPost.scpt and
Compile MetaFun.scpt 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.