abenori / jlreq

Other
125 stars 18 forks source link

\expandafter immediately after \tatechuyoko #99

Closed minamotorin closed 2 years ago

minamotorin commented 2 years ago

When I was writing a macro, I realized that the following code causes ! Argument of \@secondoftwo has an extra }. with latest jlreq (4b760c7).

% This program is in the public domain.
\documentclass[tate]{jlreq}
\begin{document}
\tatechuyoko{A}\expandafter BC
\end{document}

I don't know if it's correct and why the following patch solves the issue, but the patch works.

# This patch is in the public domain.
diff --git a/jlreq.cls b/jlreq.cls
index 9a7d5b1..bc4adb5 100644
--- a/jlreq.cls
+++ b/jlreq.cls
@@ -500,7 +500,7 @@

 % #1の先頭が文字か
 \long\def\jlreq@ifletter#1{%
-  \jlreq@iffirsttoken{#1}{ }{\@secondoftwo}{%
+  \jlreq@iffirsttoken{#1}{~}{\@secondoftwo}{%
     \expandafter\expandafter\expandafter\jlreq@helper@ifletter\jlreq@getfirsttoken#1\jlreq@uniqtoken{}\jlreq@endmark@
   }%
 }

This error doesn't occur in jlreq up to a4c1608.

Category code of ` where\jlreq@ifletteris defined changed in a commit 4628414, the commit after a4c1608, because of scope of expl3 syntax. However, in\jlreq@ifletterwas not replaced by~`.

Thanks.

abenori commented 2 years ago

Thanks! You are completely right. I used your correction. c903cce

minamotorin commented 2 years ago

I confirmed c903cce. Thanks!

By the way, as I expected from the time I read the code of \tatechuyoko, sometimes putting control sequence after\tatechuyoko may not be good.

% This program is in the public domain.
\documentclass[tate]{jlreq}
\usepackage{bxghost}
\begin{document}

\tatechuyoko{A}B

\tatechuyoko{A}\relax B

\jghostguarded{\tatechuyoko{A}}B

\end{document}

tatechuyoko

In the first, I realized that \jghostguarded of bxghost pakcage doesn't work with jlreq.

% This program is in the public domain.
\documentclass{jlreq}
%\documentclass{ltjsarticle}
\usepackage{bxghost}% 2020/01/31 v0.3.0
\begin{document}

AB

\jghostguarded{A}B

%\catcode`\ =12

aaaa aaaa

aaaa□aaaa

\end{document}

The cause of this seems to be that \xkanjiskip is not inserted around   in jlreq and   doesn't work as Japanese ghost.

Do you have any idea to use Japanese ghost without changing behavior of  ?

minamotorin commented 2 years ago

In LuaLaTeX, \xkanjiskip is inserted before  . This is different from (u)pLaTeX.

% This program is in the public domain.
\documentclass{jlreq}
\begin{document}

aaaa\ □□

□□□\ aaa

aaaa □□% <- This

aaaa□□□

□□□ aaa

□□□□aaa

\ifx\undefined\directlua\else
  \catcode`\ =12

  aaaa □□

  aaaa□□□

  □□□ aaa

  □□□□aaa

\fi

\end{document}
minamotorin commented 2 years ago

Inserting of \xkanjiskip before   only happens when using jfm-jlreq.lua of 3a7010fbd8e07 or later. I have no idea what is wrong.

abenori commented 2 years ago

I added kanjiskip_natural = 1 to jfm-jlreq.lua which means that kanjiskip added to the glue between characters between   and alchar (here, alchar means non-Japanese character). But xkanjiskip is inserted. I don't know this is expected or not.

I do not remember why I added kanjiskip_natural = 1 here. I'll look it again.

abenori commented 2 years ago

I added kanjiskip_natural = 1 to jfm-jlreq.lua which means that kanjiskip added to the glue between characters between   and alchar (here, alchar means non-Japanese character). But xkanjiskip is inserted. I don't know this is expected or not.

See https://osdn.net/projects/luatex-ja/ticket/43512

minamotorin commented 2 years ago

After updating luatexja to 20220103.0, inserting of xkanjiskip before   doesn't occur. Thanks!

About Japanese Ghost, I'll ask in wtsnjp/BXghost.