ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: LMTX and addplot table
Date: Sat, 12 Dec 2020 15:35:23 +0100	[thread overview]
Message-ID: <15F67B25-2C61-47FD-B228-809CCC3FAE81@centralesupelec.fr> (raw)
In-Reply-To: <a7af8291-692f-70b2-f5fe-87f60f171435@xs4all.nl>


[-- Attachment #1.1: Type: text/plain, Size: 3372 bytes --]



> Le 12 déc. 2020 à 13:20, Hans Hagen <j.hagen@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.hagen@xs4all.nl <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


[-- Attachment #1.2: Type: text/html, Size: 7574 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  parent reply	other threads:[~2020-12-12 14:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-12  9:36 Jean-Philippe Rey
2020-12-12 10:58 ` Hans Hagen
     [not found]   ` <EB02BBB4-B1B6-45B9-BAA1-0729B3651B32@centralesupelec.fr>
2020-12-12 12:20     ` Hans Hagen
2020-12-12 12:28       ` Wolfgang Schuster
2020-12-12 14:35       ` Jean-Philippe Rey [this message]
2020-12-12 16:01         ` Hans Hagen
2020-12-12 16:03         ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15F67B25-2C61-47FD-B228-809CCC3FAE81@centralesupelec.fr \
    --to=jean-philippe.rey@centralesupelec.fr \
    --cc=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).