[metapost] generate selected figures

Zhi-Wei Huang zwhuang at gmail.com
Wed Dec 17 07:55:01 CET 2008


Hi,
It is convenient to keep the source codes of many figures in a single
mp file. All these figures are internally labeled by 1, 2, ..., n. By
using

    $ mpost foo.mp

foo.1, foo.2, ... figures will be generated by default. When new
figures with labels m, ... are added to the source file, one has to
run mpost to regenerate foo.1, foo.2, ..., foo.n, foo.m, ....
Generally, it is redundant to regenerate the completed 1, 2, ..., n
figures. One can use "if false: ... fi;" to comment the codes of the
1, 2, ..., n figures, while this is not a convenient way to achieve
the goal. Furthermore, changing source code is not always feasible.

The following pattens are convenient to generate selected figures, if
it is possible to add "pic/page selecting" mechanism to mpost, :)

    $ mpost -p 2,5,9    foo.mp
    $ mpost -p 2..6,9.. foo.mp
    $ mpost -p -1..-4    foo.mp

The first line selects three figures of labels 2,5,9; the second line
selects figures of labels 2,3,4,5,6, and 9 up to the maximum; the
third line selects the last four figures.

Regards,
Huang


More information about the metapost mailing list