Closed Man-Ting-Fang closed 7 years ago
Reply from Japan: I cannot read chinese, but is this related to pTeX/upTeX, not only ApTeX? If so, I will be glad if the comments are translated into English. Thanks -- Hironobu Yamashita (from Japanese TeX Development Community)
Google translation helped me for understanding the last one:
最后,是一个小问题,对如下代码,所有pTeX系列引擎都无法自动生成最后一行那里的汉字西文间距,请问这是就是如此设计的嘛?
It is a known behavior in Japan, and some users think it is a bad behavior; however, pTeX is a very old engine (more than 25 years), so nobody in dev group remembers the reason why \xkanjiskip disappears when a box is raised/lowered. The same behavior can be seen with \ybaselineshift (a primitive which sets the shift amount of Latin-chars from JP-chars), and it is also problematic, I think.
(I apologize for my unfluent English.)
Typos in all pTeX-related engines, i.e., pTeX/epTeX/upTeX/eupTeX/ApTeX:
If the user writes \tracingall (or the like) in .tex file, then the primitive \jcharwidowpenalty will be misspelt as \jchrwidowpenalty in .log file (the letter "a" in "char" disappeared). And there are several \chrwidowpenalty in ptexdoc.pdf, which seem misspelt too.
MWE:
\tracingall
文字文字文字
\bye
Typos in ascii-jplain.tex, ptex.tex and uptex.tex:
The comment "at signs are no longer letters" appears twice in each file, but when the catcode of @ changes to 11, the comment should be (as in plain.tex; please pay attention to the name of format near the end of sentence, which is plain in plain.tex, but may be changed in source files of other formats):
We make @ signs act like letters, temporarily, to avoid conflict between user names and internal control sequences of plain format.
(In my opinion, these comments are not necessary in ascii-jplain.tex, ptex.tex and uptex.tex.)
Typo in uptex.tex only:
There is an extra letter "u" in the comment "ugothic(KANJI)" which damages the consistency:
% mincho(KANJI) % ugothic(KANJI) % mincho(KANJI,tate) % gothic(KANJI,tate)
(And why is there no space after certain halfwidth punctuation marks?)
The last problem:
Please test the following code: All pTeX-related engines can not produce the \xkanjiskip automatically in the last line:
漢.字
漢\hbox{.}字
漢\raise0.33zh\hbox{.}字
\bye
Is this a feature? (I'm a novice, sorry.)
Thank you!
It is a known behavior in Japan, and some users think it is a bad behavior; however, pTeX is a very old engine (more than 25 years), so nobody in dev group remembers the reason why \xkanjiskip disappears when a box is raised/lowered. The same behavior can be seen with \ybaselineshift (a primitive which sets the shift amount of Latin-chars from JP-chars), and it is also problematic, I think.
Thanks for your kind explanation!
Thank you very much! I think I can fix the typos mentioned in your first 3 issues (ptexdoc.pdf, ascii-jplain.tex / ptex.tex / uptex.tex, and uptex.tex). The files are in texjporg/ptex-base repository, and I can commit the changes.
The typo of \jchrwidowpenalty in pTeX can be a feature, so I'll see more carefully (a change may break some test cases, I fear). Also, I will later discuss your last question (problem with \xkanjiskip and \raise/\lower) again in JP dev forum. When some conclusion comes out, I will let you know.
Thank you very much!
Code fragments in pTeX 2.1.4 (11/21/95):
@d penalty_node=14 {|type| of a penalty node}
@d widow_pena=1 {|subtype| of penalty nodes from \.{\\chrwidowpenalty}}
@d kinsoku_pena=2 {|subtype| of penalty nodes from kinsoku}
@x
@ @<Display penalty |p|@>=
begin print_esc("penalty "); print_int(penalty(p));
end
@y
@ @<Display penalty |p|@>=
begin print_esc("penalty "); print_int(penalty(p));
if subtype(p)=widow_pena then print("(for \chrwidowpenalty)")
else if subtype(p)=kinsoku_pena then print("(for kinsoku)");
end
@z
Code fragments in pTeX 2.1.5 (08/27/97):
@d penalty_node=14 {|type| of a penalty node}
@d widow_pena=1 {|subtype| of penalty nodes from \.{\\jchrwidowpenalty}}
@d kinsoku_pena=2 {|subtype| of penalty nodes from kinsoku}
@x [12.194] l.3828 - pTeX: Display penalty usage
begin print_esc("penalty "); print_int(penalty(p));
end
@y
begin print_esc("penalty "); print_int(penalty(p));
if subtype(p)=widow_pena then print("(for \jchrwidowpenalty)")
else if subtype(p)=kinsoku_pena then print("(for kinsoku)");
end
@z
The upstream of TeX Live fixed the typo.
nobody in dev group remembers the reason why \xkanjiskip disappears when a box is raised/lowered.
I came to a conclusion that we should be more careful about modifying this behavior.
It would be relatively easy to patch ptex-base.ch as follows, to make \xkanjiskip (and \kanjiskip as well) work even when the box is shifted:
--- texk/web2c/ptexdir/ptex-base.ch.1~ Sat Mar 05 08:09:17 2016
+++ texk/web2c/ptexdir/ptex-base.ch Sun Mar 19 00:38:57 2017
@@ -6668,12 +6668,10 @@
@ @<Insert hbox surround spacing@>=
begin find_first_char:=true; first_char:=null; last_char:=null;
-if shift_amount(p)=0 then
- begin if check_box(list_ptr(p)) then
- begin if first_char<>null then @<Insert a space before the |first_char|@>;
- if last_char<>null then
- begin @<Insert a space after the |last_char|@>;
- end else insert_skip:=no_skip;
+if check_box(list_ptr(p)) then
+ begin if first_char<>null then @<Insert a space before the |first_char|@>;
+ if last_char<>null then
+ begin @<Insert a space after the |last_char|@>;
end else insert_skip:=no_skip;
end else insert_skip:=no_skip;
end
However, this can cause another problem (of course a \ruby-like macro below is silly enough, but it would be an easy way of visualizing the problem)
\documentclass{article}
\def\rubytest#1{\raise10pt\hbox to 0pt{\tiny #1\hss}}
\begin{document}
この\rubytest{Kanji}漢字の
\end{document}
Current pTeX does not insert a space between "の" and "漢". When the above patch is applied, then a space (originating from \xkanjiskip between "の" and "K") appears, which should be an unexpected result. I guess this is the reason why the original pTeX authors disabled \xkanjiskip insertion surrounding shifted boxes.
Current pTeX does not insert a space between "の" and "漢". When the above patch is applied, then a space (originating from \xkanjiskip between "の" and "K") appears, which should be an unexpected result. I guess this is the reason why the original pTeX authors disabled \xkanjiskip insertion surrounding shifted boxes.
Thanks! It seems that a box is considered as an independent unit when it is shifted.
今天偶然发现,用\tracingall时,log文件中\jcharwidowpenalty漏掉了一个字母a,变成了\jchrwidowpenalty,这个在所有pTeX系列引擎里都写错了。另外,在ptexdoc.pdf中还出现了\chrwidowpenalty。
(以下不是ApTeX的问题,但是也有关系,一并写在这里吧。)
其次,ascii-jplain.tex、ptex.tex、uptex.tex中,开头重定义脚注那里,注释很明显是复制错了,写成: \catcode
@=11 % at signs are no longer letters …… \catcode
@=12 % at signs are no longer letters 前边那儿要么照抄plain.tex,要么干脆不写注释。再次,uptex.tex中定义字体时的注释也不一致,横排哥特体那里多了一个字母u(另外,半角标点后都不空格……): % mincho(KANJI) % ugothic(KANJI) % mincho(KANJI,tate) % gothic(KANJI,tate)
最后,是一个小问题,对如下代码,所有pTeX系列引擎都无法自动生成最后一行那里的汉字西文间距,请问这是就是如此设计的嘛?代码: 漢.字
漢\hbox{.}字
漢\raise0.33zh\hbox{.}字
\bye
谢谢!