Metapost Mode Help
Name:Metapost Mode
Version:3.1
Last update:2020-05-27 14:28:46





Introduction

MetapostMode is a mode for the text editor Alpha: it is designed to make writing, processing and testing of Metapost source files much easier. Metapost is the programming language written by John Hobby in order to create all kinds of figures, graphs, pictures to include in a document prepared with TeX or with Troff. Its syntax is very much like Metafont's syntax but Metapost outputs are Postscript encapsulated files. Once Metapost mode is installed, the opening of a Metapost source file (i-e with extension .mp) invokes a new menu (called Metapost) in the menu bar with the following features: Note that both CMacTeX Metapost and OzMetapost are supported. MetapostMode is compatible with MetafontMode.

Description

Metapost menu items:
Switch To Metapost
Launches the Metapost application in front.
Process Current Window
Calls up the Metapost application and processes the current window.
Process a File
Prompts you for a Metapost source file to run.

Metapost Utilities submenu

Open plain.mp
Edit this file (read-only).
Open mfplain.mp
Edit this file (read-only).
Open plain.mf
Edit this file (read-only).
Open modes.mf
Edit this file (read-only).
New Figs File Template
Builds a template for a complete new figures source file. User is asked for the number of figures in the file. They are numbered automatically.
Delete Auxiliary Files...
Prompts you to specify the extensions of auxiliary files to delete.
Menu Shortcuts...
Define custom shortcuts for the menu items.
Display Bindings
Display the bindings currently defined in Metafont mode

Metapost Editing submenus

All the following submenus contain the basic Metapost commands and macros: any item you choose will be inserted in your file at the cursor's current position with electric tabs for those commands which need arguments. In some cases, you will be asked to enter a number (see makegrid for instance). All the macros relevant to a particular aspect have been collected together in a (supposedly) logical way. When clicking on a submenu, try the option, command, control or shift keys to get variants. For instance: In the case of 'dotlabels' you will be prompted to set the number of arguments. ((li in the Graph.mp Macros... submenu, the setcoords item will become: li)) ul))

List of the macros submenus:

Macros from additionnal packages:

File marking

Various elements are marked: macros definitions, character definitions, related files, input files etc. and can be easily accessed through pop-up menus and option or commed clicking.

The Mark pop-up menu

If you choose to mark your file from the Marks pop-up menu (top right of your editing window), all the def, vardef and beginfig declarations in your source file will be marked. Remember that the beginfig command is customizable (in the Mode Setup) and any change you make there will be taken into account for marking. If the Auto Mark checkbox is checked in the Prefs, the file is automatically marked at opening.

The Functions pop-up menu

The Functions pop-up menu (top right of your editing window) contains the functions and macros defined in your source file. We list here all the def, primarydef, secondarydef, tertiarydef and vardef definitions as well as the files input with an input command.

Shift-Command double clicking a word

If you Shift-Command-Double-Click on a keyword you access its definition. This procedure looks first for a definition in the current file itself, then in the list of primitives, then in all the Metapost macros files (boxes.mp, mfplain.mp, plain.mp etc. Note that plain.mp is scanned first) and finally in the other .mp text files called in the current file by an 'input' command and located at the same level (typically they are user defined macros files).

Option clicking the title bar

If you Option-Click in the title bar, you get a list of all the .mp or .mpx files located in the folder of your current window. Selecting any item in this list will open it in a window or bring its window to front if it is already open.

Completions

Metapost Mode has a rich set of completion procedures:

Key Bindings

A few key bindings are defined in Metapost mode. Use the command Mp ↣ Metapost Utilities ↣ Display Bindings to display them.

Metapost mode preferences

If the current window is in Metapost mode, select the command Alpha ↣ Mode Setup ↣ Mode Preferences… to display the Mp Mode Preferences. They should be self-explanatory.
Here is the meaning of some of them:

Known problems

Please report any problem or bug you encounter to Alpha's Bug Tracker.

License and Disclaimer

Copyright (c) 2000-2020, Bernard Desgraupes.
All rights reserved.
The Metapost Mode package is free software and distributed under the terms of the new BSD license:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BERNARD DESGRAUPES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.