[NTG-context] metapost graph and ConTeXt LMTX

Jean-Philippe Rey jean-philippe.rey at centralesupelec.fr
Sun Jan 3 19:12:31 CET 2021


Dear List,

I have used TikZ and pgfplots for a few years and I am considering switching to metapost/metafun which appears more efficient with LMTX. I have already designed several figures with metapost/metafun and some with the help of metaobj and I am fully satisfied with the result.

I am now trying to draw graphs with the metapost graph module, but I haven't been integrated to my ConTeXt LMTX document. The following example works perfectly well when compiled directly with metapost (from TeXlive 2020).

===== mpost example =============
beginfig(1)
input graph

draw begingraph(150mm, 100mm);
	gdraw "test-mpgraph.txt";
	endgraph;
endfig;
end
=================================

Here is my demo data file

==== test-mpgraph.txt ========
0 0
1 1
2 2
3 1
4 3
5 2
6 1
==============================

I tried the following to draw directly from a ConTeXt document

==== LMTX example =================
\starttext
\startMPcode
troffmode:=0;
prologues:=0;
input graph

draw begingraph(150mm, 100mm);
	gdraw "test-mpgraph.txt";
	endgraph;
\stopMPcode
\stoptext
===================================

I had to define troffmode and prologues, otherwise I get error messages about undecidable expressions and now I get an error that I don't understand (see attached log file).

I also tried \usemodule[graph] as documented on the wiki (https://wiki.contextgarden.net/MPgraph) but without success.

I guess I am doing something wrong. Could someone help me see my error?

Thanks,

-- 
Jean-Philippe Rey
jean-philippe.rey at centralesupelec.fr
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-mpgraph.log
Type: application/octet-stream
Size: 16518 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20210103/456a8e31/attachment.obj>


More information about the ntg-context mailing list