From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: [NTG-context] Re: In LuaMetaTeX, `\read` sometimes doesn't grab the entire balanced text
Date: Tue, 23 Sep 2025 11:49:15 +0200 [thread overview]
Message-ID: <5679d48e-a7ca-422e-88d4-1e0ceb70fd2b@xs4all.nl> (raw)
In-Reply-To: <175861885487.2547.5587108795209483374@cgl.ntg.nl>
On 9/23/2025 11:14 AM, witiko@gmail.com wrote:
> I am seeing some other issues with `\read` as well. For example, `\def\first{hello world}` (notice the two spaces) will store 11 tokens "hello␣world" in `\first` but storing `hello world` in a text file named `example.txt` and reading that file with `\newread\example \openin\example=example.txt \read\example to\second` in LuaMetaTeX stores 13 tokens "hello␣␣world\n" in `\second`. LuaTeX and other TeX engines would store just 12 tokens "hello␣world\n". This is less of an issue than the one described in the original post and can likely be fixed by using `\scantokens` on `\second`.
On my machine from this:
\starttext
\newread\example
\openin\example=example.txt
\read\example to\hello
\read\example to\world
\closein\example
(\meaningfull\hello)
(\meaningfull\world)
[\hello\ \world]
\stoptext
I now get:
(global macro:{hello})
(global macro:world)
[hello world]
For
{%
hello}
world
But I used a patched version of \read that is not yet uploaded.
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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2025-09-23 9:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 21:46 [NTG-context] " witiko
2025-09-20 10:15 ` [NTG-context] " Hans Hagen via ntg-context
2025-09-20 10:51 ` Joseph Wright
2025-09-21 18:37 ` Hans Hagen via ntg-context
2025-09-23 9:14 ` witiko
2025-09-23 9:49 ` Hans Hagen via ntg-context [this message]
2025-09-23 10:09 ` witiko
2025-09-23 11:27 ` Hans Hagen via ntg-context
2025-09-23 11:40 ` witiko
2025-09-23 12:58 ` Hans Hagen via ntg-context
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=5679d48e-a7ca-422e-88d4-1e0ceb70fd2b@xs4all.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@xs4all.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).