Today's Random Photos:
René van Bevern
view out of a train window


For some reason, the MetaPost mode of Emacs contains no function to quickly view the MetaPost figures. The package metapreview.el contains a function meta-preview-fig that opens the figure of the beginfig environment currently containing the cursor in GhostView (including LaTeX labels and with support for filename templates). If the MetaPost compilation fails, the *Metapost* buffer is opened, which shows the output of MetaPost.

Just put metapreview.el in some directory specified in your load-path variable (check with "M-: load-path RET"). Then, bind the preview functionality to a key, say C-C, by adding the following lines to your .emacs configuration file:

(require 'metapreview)

(add-hook 'meta-mode-load-hook
 '(lambda () (define-key meta-mode-map
   (kbd "C-c C-c") 'meta-preview-fig)))

© 2010 René van Bevern. Last modified 2010-07-29.