[metapost] About MetaPost

Justin Bailey jgbailey at gmail.com
Thu Mar 29 06:32:24 CEST 2018

This isn't exactly what you asked for, but it might help. I wrote an
article about typesetting the literate sources for MetaPost as a PDF
(similar to how TeX: The Program can be produced from the TeX sources).

Some of the info is probably out of date as I wrote this a few years ago,
but maybe it can help you navigate the MetaPost sources? Here is the
original markdown text. Enjoy!

---- begin here ---

Donald Knuth invented the WEB language for literate programming. A
literate program reads like a book (or very long article) and can be
compiled into executable code. Literate programming does NOT mean
fancy documentation; it means the programmer can present source code
in the order most suitable for exposition. WEB allows the programmer
to express how to extract a TeX document from the source code and
how to extract a set of source files from the same code that
can be compiled.

In any case, METAPOST is written in WEB, meaning both a TeX document
and an executable can be created from the same source. This article
describes how to get a TeX document from the METAPOST sources.

A WEB program is turned into a TeX document using the WEAVE program;
similarly, the TANGLE program will produce source code that can be
compiled. There isn't a single WEB language for all types of source
code; rather, specific WEBs exist for each source language. METAPOST
is written in CWEB, the WEB for the C language. Therefore, the WEAVE
and TANGLE programs for CWEB are CWEAVE and CTANGLE.

The METAPOST project is hosted at
http://foundry.supelec.fr/gf/project/metapost. The sources are in SVN
and can be downloaded from that page. The METAPOST source itself is
located a ways down the directory tree:
/trunk/metapost/source/texk/web2c/mplibdir. In mplibdir you will find
9 ".w" files, each representing a portion of METAPOST: mp.w, mpmath.w,
mpmathdouble.w, mpost.w, mpstrings.w, mpxout.w, psout.w, svgout.w, and

To create TeX documents from these files, simply execute CWEAVE on
them. If you have a modern TeX distribution installed (such as TeXLive
2011), then CWEAVE should already exist on your system:

  cweave mp.w
  cweave mpmath.w

Each invocation will produce a corresponding .tex file (e.g., "mp.tex",
"mpmath.tex", etc.). Producing a PDF is easy as:

  pdftex mp
  pdftex mpmath

Some TeX errors seem to have crept into the source (when was the last time
someone tried this, I wonder?), but even so you still get a book size
describing the implementation of METAPOST.

On Wed, Mar 28, 2018 at 4:55 PM, Estevão Vinícius Candia <
estevao.candia at ifms.edu.br> wrote:

> Hi,
> My name is Estevão Vinícius, I teach mathematics at Federal Institute of
> Mato Grosso do Sul, Brazil. I'm also getting my Master's Degree in
> Mathematics. My research is about how math is inside MetaPost and we hope
> to persuade teachers and professors to use it to their latex papers, tests,
> ect.
> My mentor and I are happy to produce metapost material in portuguese. We
> couldn't find any researches about it in our language. I talked to John
> Hobby these days about it and he's allowed me to publish a portuguese
> version of  "MetaPost - a user’s manual" and sent me the files he has from
> it. But he only has the older version.
> I asked him about this version of February 19th, 2018 and he wasn't aware
> of it. He said he gave Taco Hoekwater and all the MetaPost development
> team the freedom to do whatever you guys want. So I hope I can get an
> answer from you guys.
> Is it possible to you send me the files (.tex, .mp, ....) so I can
> translate it to brazilian portuguese?  This would be a helping hand for
> me to create a top quality translation material.
> I'd like to add another question: do you know anything about a mathematics
> research group studying MetaPost? I can't find anything.
> Thank you in advance and I hope to talk to you soon again!
> Att.,
> --
> *Estevão Vinícius Candia*
> Professor EBTT de Matemática
> Instituto Federal de Mato Grosso do Sul - Campus Corumbá
> --
> http://tug.org/metapost/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20180328/2f87a249/attachment.html>

More information about the metapost mailing list