Re: [NTG-context] LMTX and addplot table
On 12/12/2020 12:19 PM, Jean-Philippe Rey wrote:
Le 12 déc. 2020 à 11:58, Hans Hagen
mailto:j.hagen@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.
looks like \PackageError is undefined which is something PGF
but maybe you should
! Package pgfplots Warning: running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \pgfplotsset{compat=1.17} into your preamble.
use that setting in order to not end up at that command
Thanks Hans, but it doesn't seem to change anything.
I am not really a tikz user but can run it here 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 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 after all that I get this: PGFPlots: reading {mfe-addplot.dat} pgfplots > Sorry, could not retrieve column 't' from table '\\pgfplotstableread@filename@@table@name '. Please check spelling (or introduce name aliases). pgfplots > Sorry, could not retrieve column 'E' from table '\\pgfplotstableread@filename@@table@name '. Please check spelling (or introduce name aliases). pgfplots > Sorry, the requested column number '' in table 'mfe-addplot.dat' does not exist!? Please verify you used the correct index 0 <= i < N. pgfplots > Sorry, the requested column number '' in table 'mfe-addplot.dat' does not exist!? Please verify you used the correct index 0 <= i < N. NOTE: coordinate (,) has been dropped because of a coordinate filter. (see also unbounded coords=jump). pgfplots > Sorry, the requested column number '' in table 'mfe-addplot.dat' does not exist!? Please verify you used the correct index 0 <= i < N. pgfplots > Sorry, the requested column number '' in table 'mfe-addplot.dat' does not exist!? Please verify you used the correct index 0 <= i < N. NOTE: coordinate (,) has been dropped because of a coordinate filter. (see also unbounded coords=jump). pgfplots > Sorry, the requested column number '' in table 'mfe-addplot.dat' does not exist!? Please verify you used the correct index 0 <= i < N. pgfplots > Sorry, the requested column number '' in table 'mfe-addplot.dat' does not exist!? Please verify you used the correct index 0 <= i < N. NOTE: coordinate (,) has been dropped because of a coordinate filter. (see also unbounded coords=jump). pgfplots > Sorry, the requested column number '' in table 'mfe-addplot.dat' does not exist!? Please verify you used the correct index 0 <= i < N. pgfplots > Sorry, the requested column number '' in table 'mfe-addplot.dat' does not exist!? Please verify you used the correct index 0 <= i < N. NOTE: coordinate (,) has been dropped because of a coordinate filter. (see also unbounded coords=jump). ! Package pgfplots Warning: the current plot has no coordinates (or all have been filtered away) [warning /pgfplots/warning/plot without coordinates] ! Package pgfplots Warning: You have an axis with empty range (in direction y). Replacing it with a default range and clearing all plots. [warning /pgfplots/warning/empty range cleared axis] 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) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen schrieb am 12.12.2020 um 13:20:
On 12/12/2020 12:19 PM, Jean-Philippe Rey wrote:
Le 12 déc. 2020 à 11:58, Hans Hagen
mailto:j.hagen@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.
looks like \PackageError is undefined which is something PGF
\PackageError is a LaTeX command which takes 3 argument: \PackageError{<package>}{<error>}{<help>} Wolfgang
Le 12 déc. 2020 à 13:20, Hans Hagen
a écrit : On 12/12/2020 12:19 PM, Jean-Philippe Rey wrote:
Le 12 déc. 2020 à 11:58, Hans Hagen
mailto:j.hagen@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.rey@centralesupelec.fr mailto:jean-philippe.rey@centralesupelec.fr 91192 Gif-sur-Yvette Cedex - France Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
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. I think I have it running now but you have to wait for an update (one of
On 12/12/2020 3:35 PM, Jean-Philippe Rey wrote: those curious border cases where tex bends a rule by turning tabs into spaces (the alternative is to let the tab token flagged as spacer travel around which would permits round trip). Makes me wonder I should have that as option in luametatex (but as I'm now in metapost mode I delay that pondering.) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
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.
On 12/12/2020 3:35 PM, Jean-Philippe Rey wrote: probably ... anyway, when we enable more strong protection of macros in context one needs the mentioned variant anyway (that way I can deal with it .. there a few tikz files in the test suite so they would bark when something fails) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Jean-Philippe Rey
-
Wolfgang Schuster