Toby Thurston | 28 Jul 09:21 2015

Bug with simple number comparisons with new number systems

I'm getting strange results comparing numbers with the new number systems.

Consider this program:

    show 0.0001 < 0.001, numbersystem, mpversion; end.

With the default number system this gives

>> true
>> "scaled"
>> "1.999" )

on my log. But with the other number systems I get: 

>> true
>> "double"
>> "1.999" )

>> false
>> "binary"
>> "1.999" )

>> false
>> "decimal"
>> "1.999" )

which is a bit unexpected...

I'm using a version I compiled myself from source after you fixed the normaldeviate bug a couple of months ago.
Testing with V1.902, the only other version I have on hand, I only get the error with "decimal". But it does
(Continue reading)

Daniel H. Luecking | 3 Jun 00:16 2015

Change in behavior of booleans with numbersystem=decimal

Dear Metapostals:

I don't know whether --numbersystem=decimal is considered

ready to use, but I have observed some odd behavior for the

following file:

show known (0,0,.5,.5);

show cmykcolor (0,0,.5,.5);


The command

    mpost test

returns true and true, but the command

    mpost --numbersystem=decimal test

returns false and false. This is causing mfpic to fail when

the decimal numbersystem is used.

The fact that these are cmykcolor values seems to be irrelevant.

I get similar behavior with pairs and paths. The boolean

"known X" simply seems to not work. Also the booleans

"cmykcolor X", "pair X" and "path X" (those are the only

ones I've tried so far).

I'm using MetaPost, version 1.999 (TeX Live 2015/W32TeX)

under windows 7.


Daniel H. Luecking [luecking <at>]
Graduate Coordinator
Department of Mathematical Sciences
1 University of Arkansas
Fayetteville, AR, USA 72701-1201
Toby Thurston | 19 May 12:44 2015

Testing with mpost compiled from trunk

I'd like to try out the latest version of mpost which contains a couple of fixes to bugs I've reported.

Can someone point me at a simple set of instructions for trying the new mpost executable without clobbering
my existing TeXLive distribution?

I have successfully cloned "trunk" into a local directory using anonymous svn and the ran without
error and produced a new mpost exectable in ./build/texk/web2c, and if I run "./build/texk/web2c/mpost
-v" I get

>  MetaPost 1.999 (TeX Live 2015) (kpathsea version 6.2.1)
>  etc...
>  etc...

as expected.

But if I try to run "./build/texk/web2c/mpost"  I get

> warning: kpathsea: configuration file texmf.cnf not found in these directories: [... long list of
directories under . ]
> Sorry, I can't find the 'mpost' preload file; will try 'plain'.
> I can't find the 'plain' preload file!

and it stops.  So I guess I need to build a preload file or point it at one.  

Are the instructions documented somewhere?

Thanks Toby

Troy Henderson | 16 May 15:37 2015

Stroke Font

Is there a preferred method for converting a

btex Here is my sentence etex

from a picture to an array of closed paths that can be filled and stroked different colors?  Thus, I would like to convert the btex ... etex sentence picture into an array of outlines for each letter (in the current font) used in the sentence so that I can fill the outlines one color and draw them with another color.

Thanks in advance,

Troy Henderson
Karel | 9 May 15:46 2015

problem with Type1 font

I have problem with typesetting six symbols from Type1 font with metapost
which refuse to read the corresponding line in given
containing just one line
bor  <bor.pfb
(the same problem arises with mp1.999 also with virtual fonts, but in 
that case helps to give the corresponding line as fontmapline directly, 
which does not help here:
path s;

fontmapfile "";
% fontmapline "bor  <bor.pfb";

\font\astro     bor scaled 1095

w:=30u; h:=24u;
s:=fullcircle xscaled w yscaled h;
z1=point a of s;
z2=point 2 of s;
z1=point 4-a of s;
for k=4 upto 6: z[k]=z[k-3] rotated180; endfor
label(btex C  etex,z[incr i]);
label(btex \i etex,z[incr i]);
label(btex A  etex,z[incr i]);
label(btex D  etex,z[incr i]);
label(btex I  etex,z[incr i]);
label(btex U  etex,z[incr i]);
label(btex E  etex,z[incr i]);


The resulting mpx file seems to be OK, but mpost or stops completely, or 
gives the following log:

This is MetaPost, version 1.999 (TeX Live 2014/W32TeX) (kpathsea version 
6.2.0)  9 MAY 2015 15:32
**\nonstopmode; input q
Preloading the plain mem file, version 1.004) )
! Emergency stop.
l.4 fontmapfile "";

buffer overflow: (1025,1024) at file ./psout.w, line 1216

Thanks for help,
Karel horak


Taco Hoekwater | 12 Mar 16:52 2015

Fwd: problem with mpost number of strings exceeded

Begin forwarded message:

Date: 12 Mar 2015 16:49:43 CET
From: Denis Roegel <denis.roegel <at>>
To: Taco Hoekwater <taco <at>>
Subject: problem with mpost number of strings exceeded

Hi Taco,

I am running into a problem with a metapost file which generates about 20 files,
each being about 500kb. These files use a lot of labels (with latexmp) and eventually
I get metapost capacity exceeded [number of strings = 31228]
(on an old distribution). I have tried to increase max_strings to 200000, pool_size to
more than a million, main_memory has been set to 3000000, (I changed texmf.cnf
and regenerated the format with fmtutil), but I still get that error.
What should I increase? In the worst case, I could split my file to generate a smaller
number of figures.



Franck Pastor | 9 Mar 17:01 2015

Bug with the binary operator `point ... on ...` from Metafun

I’ve just encountered a very puzzling bug with the binary operator `point <len> of <path>` defined in the
Metafun format.

In the Metafun manual (, p. 61, this
binary operator is defined as such:

primarydef len of pat =
  (arctime len of pat) of pat

So if I write `point 0 on pat`, it should return the starting point of the path <pat>, right? But n. To the
contrary, it returns the end point of <pat>! Stranger yet, if I try `point (arctime 0 of pat) of pat`, it
returns the starting point, as expected. 

This weird behavior is illustrated by the following program, to be run with the Metafun format of course:

path line[]; line1 = origin -- 3cm*right; line2 = line1 yshifted -1cm;
draw line1; draw line2;
pickup pencircle scaled 3bp;
draw point 0 of line1; % draw a dot at the start point, as expected
draw point 0 on line1; % draws a dot at the end point!!!!!
draw point (arctime 0 of line2) of line2; % draws a dot at the starting point…

An idea about what is wrong? 

I use MetaPost 1.902 and Metafun version 1.004, from TeX Live 2014.

Thanks in advance,

Franck Pastor

luigi scarso | 21 Jan 09:14 2015

Turning Number and QuickSort

It seems that the University College Cork has some problem to deliver emails to the metapost list,
so I forward some notes that 
Marc van Dongen has sent to me last days:

I have noticed lots of problems with standard metapost, including
lots of problems related to rounding and an error in turningnumber.

I re-implemented turningnumber (in mpost) and it seems to work for
my purpose. The implementation is quite simple and it avoids rounding
errors. (It's still possible to reduce more rounding but I don't
think it's needed.) Please let me know if you want the implementation.
(I still have to do some proper testing on it.)
The files are in attachment.

% This is a simple implementation to determine whether a  path
% is drawn anti clockwise. To do this, it computes the signed
% area of the path consisting of the support points of the path.
% ASSUMPTION: _pat_ does have a non-zero area.
vardef IsAntiClockwise( expr pat ) =
    ((cycle pat) and (Area( pat ) > AREA_ACCURACY))
    %(turningnumber( pat ) > 0)

vardef Area( expr pat ) =
    save a, len, sum; numeric a[], len[], sum;
    len := length pat;
    % First we compute (twice) the signed areas of the triangles
    % _(0,0) -- (point i of pat) -- (point (i + 1) of pat) -- cycle_
    for i = len - 1 downto 0:
        a[ i ] := Det( point i of pat, point (i + 1) of pat );
    % Since adding the sizes may result in large rounding errors,
    % we sort them in descending order
    SortAbsGeq( a )( len );
    % The remaining statements compute the sum of the signed areas
    % in a ``robust'' fashion, trying to minimise rounding. A little
    % bit more robust would be to first compute the frequencies of
    % the entries in _a_, then multiplying each unique number in
    % _a_ by its frequency, then sorting the products, and finally
    % adding the products.
    % e.g. [1,2,1,1];
    % sort it -> [2,1,1,1];
    % compute frequencies -> [2:1,1:3];
    % compute products -> [2,3];
    % sort -> [2,3];
    % add -> 5.
    sum := 0;
    for i = len - 1 downto 0:
        sum := sum + a[ i ];
    % We could have just returned _sum_ but
    % this way we get the actual signed area.

vardef QuickSort( suffix a, cmp )( expr size ) =
    QuickSort_( a, cmp )( 0, size - 1 );

vardef QuickSort_( suffix a, cmp )( expr lo, hi ) =
    if lo < hi:
        save sep; numeric sep;
        %Swop( a )( lo, floor( (lo + hi) / 2 ) );
        Swop( a )( lo, lo + floor( uniformdeviate( hi - lo - 1 ) ) );
        sep := Partition( a, cmp, lo, hi );
        Swop( a )( lo, sep );
        QuickSort_( a, cmp )( lo, sep - 1 );
        QuickSort_( a, cmp )( sep + 1, hi );

vardef Partition( suffix a, cmp )( expr lo, hi ) =
    save dest, pivot; numeric dest, pivot;

    dest := lo;
    pivot := a[ lo ];
    for i = lo + 1 upto hi:
        if cmp( a[ i ], pivot ):
            dest := dest + 1;
            Swop( a )( dest, i );

vardef Swop( suffix a )( expr fst, snd ) =
    save tmp; numeric tmp;
    tmp := a[ fst ];
    a[ fst ] := a[ snd ];
    a[ snd ] := tmp;

vardef SortAbsGeq( suffix a )( expr size ) =
    save CMP__;
    vardef CMP__( expr fst, snd ) =
        (abs( fst ) >= abs( snd ))
    QuickSort( a, CMP__ )( size );

dongen | 5 Jan 11:55 2015

Problem Installing MPost Development Version


A few days ago I downloaded the most recent development
version of metapost. When I tried to install it I got the
following error:

gcc: error:
/home/dongen/LaTeX/MetPost/metapost-1.999/build/libs/gmp/gmp-build/.libs/libgmp.a: No such
file or directory
make: *** [mpost] Error 1
strip: 'build/texk/web2c/mpost': No such file
ls: cannot access build/texk/web2c/mpost: No such file or directory

FWIW I do have libgmp installed but (obviously) it's not
in /home/dongen/LaTeX/MetPost/metapost-1.999/build/libs/gmp/.

Any suggestions?

Thanks in advance for your help.


Marc van Dongen

Wojciech A. Koszek | 3 Dec 10:17 2014

With prologues=3 and SVG output, METAPOST dies with SIGSEGV


I wanted to document my solution to a problem from the ``Cracking the coding
interview'' on measuring angles between clock's pointers. I have 1 figure
for this for now, and METAPOST crashes when I try to compile my image.

I figured it works fine with prologues=1 or 2 for both MPS and SVG output.

For prologues=3 it works fine with MPS, but gets a SIGSEGV with SVG as an


Will finish OK:

	wget -O

No go and make g_use_svg = 1. It will fails with ``Segmentation fault''.


	wkoszek|1:08:06|0|/home/wkoszek/o/mp$ mpost --version

	MetaPost 1.208
	Copyright 2009 AT&T Bell Laboratories.
	There is NO warranty.  Redistribution of this software is
	covered by the terms of both the MetaPost copyright and
	the Lesser GNU Lesser General Public License.
	For more information about these matters, see the files
	named COPYING, COPYING.LESSER and the MetaPost source.
	Primary author of MetaPost: John Hobby.
	Current maintainer of MetaPost: Taco Hoekwater.


Wojciech A. Koszek
wkoszek <at>

Wojciech A. Koszek | 3 Dec 10:16 2014

Command "show" on a non-empty "path" makes mpost(1) return with error code 1


This is what I expected: ``show'' called with any valid argument should be
fine to put and shouldn't be modifying mpost(1) exit behavior. In
particular: return code should always be 0.

What I see: ``show'', when placed in a figure's script, is changing a
return code of the ``mpost'', if the thing I try to show is a path, and it's
not empty. This destroys my Makefile-based flow.


	wget -O
	path	circle;
	%circle = (0,0);
	%circle = fullcircle;
	show circle;

If you call as is:

	$ mpost > /dev/null
	$ echo $?

If you uncomment line 3:

	$ mpost > /dev/null
	$ echo $?

I think it's a bug.


Wojciech A. Koszek
wkoszek <at>