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 build.sh 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 test.mp"  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
--
http://tug.org/metapost/
(Continue reading)

Troy Henderson | 16 May 15:37 2015
Picon

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
--
http://tug.org/metapost/
Karel | 9 May 15:46 2015
Picon

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 curr.map
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:

%q.mp
path s;

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

verbatimtex
\font\astro     bor scaled 1095
\astro
etex

beginfig(4);
w:=30u; h:=24u;
s:=fullcircle xscaled w yscaled h;
a:=.5;
z0=origin;
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
i:=-1;
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]);
endfig;

end

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
(c:/texlive/2013/texmf-dist/metapost/base/mpost.mp
(c:/texlive/2013/texmf-dist/metapost/base/plain.mp
Preloading the plain mem file, version 1.004) )
(./q.mp{curr.map
! Emergency stop.
l.4 fontmapfile "curr.map";

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

Thanks for help,
Karel horak

--
http://tug.org/metapost/

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> loria.fr>
To: Taco Hoekwater <taco <at> elvenkind.com>
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.

Thanks,

Denis

--
http://tug.org/metapost/
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 (http://www.pragma-ade.com/general/manuals/metafun-p.pdf), p. 61, this
binary operator is defined as such:

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

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:

beginfig(1);
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…
endfig;
end.

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

--
http://tug.org/metapost/
luigi scarso | 21 Jan 09:14 2015
Picon

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.


--
luigi
% 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)
enddef;

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 );
    endfor
    % 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 ];
    endfor
    % We could have just returned _sum_ but
    % this way we get the actual signed area.
    0.5sum
enddef;

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

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 );
    fi
enddef;

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 );
        fi
    endfor
    dest
enddef;

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

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

endinput
--
http://tug.org/metapost/
dongen | 5 Jan 11:55 2015
Picon

Problem Installing MPost Development Version


Howsagoin,

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.

Regards,

Marc van Dongen
--
http://tug.org/metapost/

Wojciech A. Koszek | 3 Dec 10:17 2014
Picon

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

Hello,

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
output.

SVG

Will finish OK:

	wget -O bug_2.mp http://pastebin.com/5irnjVHB
	mpost bug_2.mp

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

My METAPOST:

	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> FreeBSD.czest.pl
http://www.koszek.com/
--
http://tug.org/metapost/

Wojciech A. Koszek | 3 Dec 10:16 2014
Picon

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

Hello,

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.

Snippet:

	wget -O sample.mp http://pastebin.com/YNkg4E05

---sample.mp---
beginfig(4);
	path	circle;
	%circle = (0,0);
	%circle = fullcircle;
	show circle;
endfig;
end
---

If you call as is:

	$ mpost sample.mp > /dev/null
	$ echo $?
	0

If you uncomment line 3:

	$ mpost sample.mp > /dev/null
	$ echo $?
	1

I think it's a bug.

--

-- 
Wojciech A. Koszek
wkoszek <at> FreeBSD.czest.pl
http://www.koszek.com/
--
http://tug.org/metapost/

William Adams | 21 Nov 20:29 2014

Use metaflow.mp in lualatex using mplib?

Metflow is a package which allows one to do flow charts in metapost:

http://www.utdallas.edu/~hamlen/metaflow.pdf
http://www.utdallas.edu/~hamlen/metaflow.mp
http://www.utdallas.edu/~hamlen/mftext.tex

When I try to use it, I get the error:

! Incomplete string token has been flushed.

How do I fix this?

William

--

-- 
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

--
http://tug.org/metapost/

Graham Douglas | 5 Nov 13:27 2014
Picon

Re: MPlib: some observations on the mp_gr_copy_object(MP mp, mp_graphic_object*p) function

On 05/11/2014 11:00, metapost-request <at> tug.org wrote:
> Send metapost mailing list submissions to
> 	metapost <at> tug.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://tug.org/mailman/listinfo/metapost
> or, via email, send a message with subject or body 'help' to
> 	metapost-request <at> tug.org
>
> You can reach the person managing the list at
> 	metapost-owner <at> tug.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of metapost digest..."
>
>
> Today's Topics:
>
>    1. MPlib: some observations on the mp_gr_copy_object(MP mp,
>       mp_graphic_object*p) function (Graham Douglas)
>    2. Re: MPlib: some observations on the mp_gr_copy_object(MP mp,
>       mp_graphic_object*p) function (luigi scarso)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 3 Nov 2014 22:33:20 +0000
> From: Graham Douglas <graham.douglas <at> readytext.co.uk>
> To: <metapost <at> tug.org>
> Subject: [metapost] MPlib: some observations on the
> 	mp_gr_copy_object(MP mp, mp_graphic_object*p) function
> Message-ID: <545802B0.5060200 <at> readytext.co.uk>
> Content-Type: text/plain; charset="ISO-8859-1"
>
<<snip>>

Hi All

Just to update/close this post, I made a note of this as a tracker item
at http://tracker.luatex.org/
should it be considered worth looking into.

Best wishes
Graham
http://readytext.co.uk
--
http://tug.org/metapost/


Gmane