Trouble making basic MetaPost graphics using ConTeXt Minimals
![](https://secure.gravatar.com/avatar/6c852b9d68d65d7ab7e7438a1ec98f2d.jpg?s=120&d=mm&r=g)
Using a fresh install of ConTeXt Minimals today (ConTeXt version 2011.07.14 16:09, luatex version beta-0.70.1-2011051918) I am trying to build the following MetaPost graphics: ---8<--- file: test.mp fontmapfile "=lm-math.map" ; beginfig(1) draw fullcircle scaled 3cm ; endfig ; beginfig(2) ; fill fullcircle scaled 5cm withcolor red ; endfig ; beginfig(3); numeric u; u = 1cm; draw (0,2u)--(0,0)--(4u,0); pickup pencircle scaled 1pt; draw (0,0){up} for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor; label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); label.bot(btex $x$ etex, (2u,0)); label.lft(btex $y$ etex, (0,u)); endfig; end . ---8<--- Building the file using "mpost test.mp" I get the following: This is MetaPost, version 1.504 (kpathsea version 6.0.0) (mpost.mp (/opt/tools/ConTeXt/beta/tex/texmf/metapost/base/plain.mp Preloading the plain mem file, version 1.004)) (./test.mp{pdftex.map}{lm-math.map} [1] [2]/opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/base/switch.rb:570:in `locateseries': undefined method `each' for "tex":String (NoMethodError) from /opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/base/switch.rb:397:in `block in expand' from /opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/base/switch.rb:392:in `each' from /opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/base/switch.rb:392:in `expand' from /opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/texexec.rb:789:in `<main>'
test.mp test.mpx ! Unable to make mpx file. l.18 label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); 2 output files written: test.1 .. test.2
The first two graphics are produced correctly, but there is no output for the third graphic with the labels. Building the file using "texexec --mptex test.mp" all three graphics are produced, but the label $\sqrt x$ does not produce the square root symbol. Am I doing something obviously wrong? Can anyone reproduce this? Thanks, Kevin
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Fri, Jul 15, 2011 at 2:59 AM, Kevin D. Robbins
Using a fresh install of ConTeXt Minimals today (ConTeXt version 2011.07.14 16:09, luatex version beta-0.70.1-2011051918) I am trying to build the following MetaPost graphics:
---8<--- file: test.mp fontmapfile "=lm-math.map" ;
beginfig(1) draw fullcircle scaled 3cm ; endfig ;
beginfig(2) ; fill fullcircle scaled 5cm withcolor red ; endfig ;
beginfig(3); numeric u; u = 1cm; draw (0,2u)--(0,0)--(4u,0); pickup pencircle scaled 1pt; draw (0,0){up} for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor; label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); label.bot(btex $x$ etex, (2u,0)); label.lft(btex $y$ etex, (0,u)); endfig;
end . ---8<---
Building the file using "mpost test.mp" I get the following:
This is MetaPost, version 1.504 (kpathsea version 6.0.0) (mpost.mp (/opt/tools/ConTeXt/beta/tex/texmf/metapost/base/plain.mp Preloading the plain mem file, version 1.004)) (./test.mp{pdftex.map}{lm-math.map} [1] [2]/opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/base/switch.rb:570:in `locateseries': undefined method `each' for "tex":String (NoMethodError) from /opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/base/switch.rb:397:in `block in expand' from /opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/base/switch.rb:392:in `each' from /opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/base/switch.rb:392:in `expand' from /opt/tools/ConTeXt/beta/tex/texmf-context/scripts/context/ruby/texexec.rb:789:in `<main>'
test.mp test.mpx ! Unable to make mpx file. l.18 label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); 2 output files written: test.1 .. test.2
The first two graphics are produced correctly, but there is no output for the third graphic with the labels.
Building the file using "texexec --mptex test.mp" all three graphics are produced, but the label $\sqrt x$ does not produce the square root symbol.
Am I doing something obviously wrong? Can anyone reproduce this?
Thanks,
Kevin ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
This is one of the preferrred way to deal with metapost in mkiv \starttext \startMPpage numeric u; u = 1cm; draw (0,2u)--(0,0)--(4u,0); pickup pencircle scaled 1pt; draw (0,0){up} for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor; label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); label.bot(btex $x$ etex, (2u,0)); label.lft(btex $y$ etex, (0,u)); \stopMPpage \stoptext It's ok with latest minimals -- luigi
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 15-7-2011 3:04, luigi scarso wrote:
Building the file using "texexec --mptex test.mp" all three graphics
how about "context --mp test.mp" ? Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/6114858d84b0f40cf715f12237ab67a1.jpg?s=120&d=mm&r=g)
On Fri, Jul 15, 2011 at 09:44, Hans Hagen
On 15-7-2011 3:04, luigi scarso wrote:
Building the file using "texexec --mptex test.mp" all three graphics
how about "context --mp test.mp" ?
context --mp test
metapost | loading 'metafun.mp' (experimental metapost version two)Error in mp.find_file: ...text/tex/texmf-context/tex/context/base/mlib-run.lua:75: attempt to call field 'checktexts' (a nil value) metapost | processing 'test.mp'Error in mp.find_file: ...text/tex/texmf-context/tex/context/base/mlib-run.lua:75: attempt to call field 'checktexts' (a nil value) Error in mp.find_file: ...text/tex/texmf-context/tex/context/base/mlib-run.lua:75: attempt to call field 'checktexts' (a nil value) metapost | error: Warning: cannot open font map file pdftex.map Warning: cannot open font map file lm-math.map (Please type a command or say `end') [1] (Please type a command or say `end') [2] (Please type a command or say `end') ! You can only use `btex' or `verbatimtex' in a file. <*> label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); ! Missing `,' has been inserted. <to be read again> sqrt <*> label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u);
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Fri, Jul 15, 2011 at 9:47 AM, Mojca Miklavec
On Fri, Jul 15, 2011 at 09:44, Hans Hagen
wrote: On 15-7-2011 3:04, luigi scarso wrote:
Building the file using "texexec --mptex test.mp" all three graphics
how about "context --mp test.mp" ?
context --mp test
metapost | loading 'metafun.mp' (experimental metapost version two)Error in mp.find_file: ...text/tex/texmf-context/tex/context/base/mlib-run.lua:75: attempt to call field 'checktexts' (a nil value)
metapost | processing 'test.mp'Error in mp.find_file: ...text/tex/texmf-context/tex/context/base/mlib-run.lua:75: attempt to call field 'checktexts' (a nil value) Error in mp.find_file: ...text/tex/texmf-context/tex/context/base/mlib-run.lua:75: attempt to call field 'checktexts' (a nil value)
metapost | error: Warning: cannot open font map file pdftex.map Warning: cannot open font map file lm-math.map
(Please type a command or say `end')
[1] (Please type a command or say `end')
[2] (Please type a command or say `end')
! You can only use `btex' or `verbatimtex' in a file. <*> label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); ! Missing `,' has been inserted. <to be read again> sqrt <*> label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u);
Even with mkiv metapost depends to pdftex ora some files from pdftex. That's way \startMPpage..\stopMPpage is better. -- luigi
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 15-7-2011 9:47, Mojca Miklavec wrote:
On Fri, Jul 15, 2011 at 09:44, Hans Hagen
wrote: On 15-7-2011 3:04, luigi scarso wrote:
Building the file using "texexec --mptex test.mp" all three graphics
how about "context --mp test.mp" ?
context --mp test
metapost | loading 'metafun.mp' (experimental metapost version two)Error in mp.find_file: ....text/tex/texmf-context/tex/context/base/mlib-run.lua:75: attempt to call field 'checktexts' (a nil value)
hm, i'll look into it later Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/6c852b9d68d65d7ab7e7438a1ec98f2d.jpg?s=120&d=mm&r=g)
On Thu, Jul 14, 2011 at 7:04 PM, luigi scarso
This is one of the preferrred way to deal with metapost in mkiv \starttext \startMPpage numeric u; u = 1cm; draw (0,2u)--(0,0)--(4u,0); pickup pencircle scaled 1pt; draw (0,0){up} for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor; label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); label.bot(btex $x$ etex, (2u,0)); label.lft(btex $y$ etex, (0,u)); \stopMPpage \stoptext
It's ok with latest minimals
Thanks, Luigi. This works on my system, too. Kevin
![](https://secure.gravatar.com/avatar/6114858d84b0f40cf715f12237ab67a1.jpg?s=120&d=mm&r=g)
I'm not able to reproduce the problem, but there is one weird thing (unrelated to your problem): The original file "test.mp" is copied to "test.mp.keep" and a new file "test.mp" is created with a newer timestamp and two additional blank lines at the end. So repeating the compilation hundred times leads me to a file with 200 blank lines at the end and I cannot recover the original file back (in each run the .keep file is overwritten). Hans - would it be possible to fix that please? Mojca
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 15-7-2011 9:13, Mojca Miklavec wrote:
I'm not able to reproduce the problem, but there is one weird thing (unrelated to your problem):
The original file "test.mp" is copied to "test.mp.keep" and a new file "test.mp" is created with a newer timestamp and two additional blank lines at the end.
So repeating the compilation hundred times leads me to a file with 200 blank lines at the end and I cannot recover the original file back (in each run the .keep file is overwritten).
Hans - would it be possible to fix that please?
hm, I though that it was fixed, was a catch for older mp's Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/6c852b9d68d65d7ab7e7438a1ec98f2d.jpg?s=120&d=mm&r=g)
On Fri, Jul 15, 2011 at 1:13 AM, Mojca Miklavec
The original file "test.mp" is copied to "test.mp.keep" and a new file "test.mp" is created with a newer timestamp and two additional blank lines at the end.
I hadn't noticed this yesterday, but I see the same behavior, but only when building with "texexec --mptex test.mp". Kevin
participants (4)
-
Hans Hagen
-
Kevin D. Robbins
-
luigi scarso
-
Mojca Miklavec