[issue:252] Fwd: regexpatch: error on (u)pTeX with Japanese char

Hironobu Yamashita h.y.acetaminophen @ gmail.com
2019年 1月 17日 (木) 11:37:45 JST

前に転送した egreg さんのメールに対する私の返信です。 -- Hironobu Yamashita

---------- Forwarded message ----------
From: Hironobu Yamashita <h.y.acetaminophen @ gmail.com>
Date: Wed, 16 Jan 2019 23:25:36 +0900
Subject: Re: regexpatch: error on (u)pTeX with Japanese char
To: Enrico Gregorio <enrico.gregorio @ univr.it>


The problem seems to be solved, but just for your information:

> If there is a sane way to check whether a character token will
> give a character code illegal with \catcode, then I guess a
> further check can be added when the engine is epTeX.

I think you can detect whether a character token is JP char
or non-JP char by following code, for example.
By design, the behavior of \kcatcode is different between
pTeX and upTeX (the latter one allows flexible changing of
JP / non-JP classification), so different code should be used here.

\def\@ifisjp#1{% pTeX version
    \expandafter\@secondoftwo % non-JP
    \expandafter\@firstoftwo % JP
\def\@ifisjp#1{% upTeX version
    \expandafter\@secondoftwo % non-JP
    \expandafter\@firstoftwo % JP

The test case is shown at

Best regards,

issue メーリングリストの案内