Skleroza | 7 Feb 17:20 2016


Anybody working on creating ruby wraper|library to mpost?


Toby Thurston | 30 Nov 00:07 2015

Color brewer for Metapost

I've prepared a small file that defines all the colours as RGB colours for MP.  Is this of
general interest?  If so I'd welcome feedback on my design and whether I should submit it to CTAN.

Toby Thurston

Attachment ( application/octet-stream, 67 KiB

Tom Vethaak | 19 Nov 14:56 2015

Directory management in Metapost


It seems that Metapost doesn't recognize folder paths, or in command line terms, doesn't obey the -output-directory. This makes it impossible to call it on files that are located in different folders.
As an example/illustration of this issue, it restricts the file management in drawing diagrams in LaTeX (see e.g.

Kind regards,
Tom Vethaak
Toby Thurston | 15 Aug 21:52 2015

Long numerical tokens with new number systems

The syntax for <numeric token> that MP inherits from Metafont allows for "one or more" decimal digits in the
fractional part of a number.  So it's legal to write:

numeric pi;
pi = 3.141592653589793238462643383279502884197169399375105820974944592;
show pi;

This works ok with all the number systems except "decimal" which complains about excessive precision.
Here's what I get with each number system

>> "scaled"
>> 3.14159 )

>> "double"
>> 3.1415926535897931 )

>> "binary"
>> 3.1415926535897932384626433832795028 )

>> "decimal"
! Number is too precise (numberprecision = 34).
l.80 ...643383279502884197169399375105820974944592
>> 3.141592653589793238462643383279503 )

Doesn't this behaviour seem to be a bit inconsistent?

Clearly, with decimal it would be possible to avoid the error message by writing this sort of thing:

   if numbersystem="decimal": numberprecision := 64; fi

before defining the constant, but it would be nice to have a consistent syntax across all number systems.

One other thing that I notice is that the final digit rounding looks wrong for double and binary.

Any comments?

Thanks, Toby

Olivier Péault | 13 Aug 17:09 2015

mpost or luamplib ?

I'm looking for a way to know whether my metapost code is processed by
metapost itself or by luamplib in lualatex. Reading the luamplib code
(which I don't understand!!!) I found that the boolean mplib could do
the job. Is it right ? Can I be sure that if mplib exists and is true,
my code is processed by luamblib ?
Thank you in advance


Toby Thurston | 4 Aug 17:41 2015

A modest proposal

Now that the higher precision number systems are maturing, and being used more, it might be a good time to
update "" to remove the hard coded 5-figure decimals.  In all cases it's fairly easy to find an
equivalent definition which would work accurately at full numeric precision regardless of which engine
is being used.

The values I can see are 

> eps := .00049;    % this is a pretty small positive number
> infinity := 4095.99998;    % and this is the largest
> .
> .
> .
> %% units of measure
> mm=2.83464;      pt=0.99626;        dd=1.06601;      bp:=1;
> cm=28.34645;     pc=11.95517;       cc=12.79213;     in:=72;
> vardef magstep primary m = mexp(46.67432m) enddef;

The definition of epsilon shows us a better way

> epsilon := 1/256/256;   % but this is the smallest

Adopting that strategy we can write the following which work well regardless of number system

eps := 1/2048;
infinity := 64*64-epsilon;

The units require a little bit more thought (and a quick reference to the Texbook for "dd"), but
nevertheless here are some exact definitions that would also work with all number systems

1 = 1 bp;
72 = 1 in;
800 = 803 pt;
360  = 127 mm;
3600 = 127 cm;
1 pc = 12 pt;
1 cc = 12 dd;
1157 dd = 1238 pt;

Finally for magstep we could have 

vardef magstep primary m = mexp(mlog(1.2)*m) enddef;

Any thoughts?  Could these be changes in the next version of

Toby T.

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
not appear to matter what numbers I use.  I get the same results  with "1<2", or "1/4<1/2", etc

This is MetaPost, version 1.902 (TeX Live 2014) (kpathsea version 6.2.0)
>> true
>> "scaled" )
This is MetaPost, version 1.902 (TeX Live 2014) (kpathsea version 6.2.0)
>> true
>> "double" )
This is MetaPost, version 1.902 (TeX Live 2014) (kpathsea version 6.2.0)
>> true
>> "binary" )
This is MetaPost, version 1.902 (TeX Live 2014) (kpathsea version 6.2.0)
>> false
>> "decimal" )

I've posted an entry on the tracker.  Toby

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