> Le 12 déc. 2020 à 13:20, Hans Hagen <j.ha...@xs4all.nl> a écrit : > > On 12/12/2020 12:19 PM, Jean-Philippe Rey wrote: >>> Le 12 déc. 2020 à 11:58, Hans Hagen <j.ha...@xs4all.nl >>> <mailto:j.ha...@xs4all.nl>> a écrit : >>> >>> On 12/12/2020 10:36 AM, Jean-Philippe Rey wrote: >>>> Dear list, >>>> I am unable to draw a plot using an external file with LMTX. Here is a >>>> minimal example >>>> ===================== >>>> \usemodule[pgfplots] >>>> \starttext >>>> \starttikzpicture >>>> \startaxis >>>> \addplot table [x=t, y=E] {mfe-addplot.dat}; >>>> \stopaxis >>>> \stoptikzpicture >>>> \stoptext >>>> ===================== >>>> The ConTeXt run fails with an "Undefined control sequence" error (see >>>> attached log file). I don't know if this is an LMTX or PGF issue. The >>>> example works fine with MkIV. I tried with the tikz version available on >>>> ConTeXt garden (pgf 3.0.1, pgfplots 1.16) and the last one from CTAN (pgf >>>> 3.1.7a, pgfplots 1.17) with the same result. > > wipe t-tikz.* on your machine in order to use m-tikz.mkiv in the distribution > because it looks like it does a bad catcode table change ... that went > unnoticed because a chardef'd constant gets typeset (and when that happens > before \starttext you won't see it but it actually does introduce some funny > char); in lmtx we don't use chardef for that so that can give an error then > when loading > > anyway, you're not suffering from that i think but better use the right > module loader anyway
I wiped t-tikz. The only noticeable difference is that now I need to explicitly \usemodule[tikz] in order to use pgfplots. I checked and found the line \usemodule[t][tikz] in t-pgfplots.tex. I guess that explains it. > then you can define the \PackageError macro (I did it with some trial and > error but the next seems to work: > > \let\PackageError\writestatus > > so I'll add something like that to m-tikz.mkiv As Wolfgang pointed out, \PackageError takes three parameters, the third is meant to be displayed when the user types H to an error prompt. I defined it as \def/PackageError#1#2#3{\writestatus{#1}{#2 (#3)}} that effectively displays the error message in the console and the log file. > which still looks bad but at least you don't crash .. i'll look into that > later today (as i'm splitting mkiv/lmtx code i use a slightly different file > reader so maybe that's it) I guess that you've pinpointed the problem. By default, pgfplotstable breaks lines at white space (tab or space according to the pgfplotstable manual). I used tabs as column separators in my demo file. With MKiV, the columns are correctly split but with LMTX, pgfplotstable sees a single column. I explicitly stated that the columns are separated with tabs: \addplot table [x=t, y=E, col sep=tab] {mfe-addplot.dat}; and it works. I tried to change the columns separator to a space, instead of a tab and it also works. I don't know what pgfplotstable uses to split columns, but the conclusion is that with MkIV 'col sep=space' means space or tab, whereas with LMTX it means strictly a space character. Thank you very much for your help. -- Jean-Philippe Rey jean-philippe....@centralesupelec.fr <mailto:jean-philippe....@centralesupelec.fr> 91192 Gif-sur-Yvette Cedex - France Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________