New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upTeX] Unexpected behaviour in kinsoku processing #57

Closed
Man-Ting-Fang opened this Issue Apr 12, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@Man-Ting-Fang

Man-Ting-Fang commented Apr 12, 2018

In the following example, U+301C and U+301E are also affected, but this is not what I want. Did I misunderstand something?

\def\TEST#1{%
  \the\prebreakpenalty\ucs"#1\relax\quad
  \the\postbreakpenalty\ucs"#1\relax\quad
  \ifnum\ucs"#1<256\relax
    \the\xspcode\ucs"#1\relax\quad
  \fi
  \the\inhibitxspcode\ucs"#1\relax\par}

\def\test{\TEST{0022}\TEST{301C}\TEST{301E}\bigskip}

\prebreakpenalty\ucs"301C=10000\relax
%\inhibitxspcode\ucs"301C=0\relax % ukinsoku.tex
\prebreakpenalty\ucs"301E=10000\relax
\inhibitxspcode\ucs"301E=1\relax

\def\AA{\prebreakpenalty"22=0\relax\xspcode"22=0\relax}
\def\BB{\prebreakpenalty"22=10000\relax\xspcode"22=2\relax}

\tt\test
\AA\test
\BB\test
\AA\test
\BB\test

\bye

knsk

@aminophen

This comment has been minimized.

Member

aminophen commented Apr 28, 2018

@Man-Ting-Fang Thanks for the report.

Some background:

  • pTeX has two internal tables, called "KINSOKU table" (for registering \prebreakpenalty / \postbreakpenalty) and "INHIBIT table" (for registering \inhibitxspcode). In the following explanation, I'll focus only on "KINSOKU table" for simplicity.
  • Each entry is comprised of [1] a character code (e.g. U+301C), [2] the place for insertion (pre or post), and [3] the penalty value (e.g. 10000). The table can save only 256 entries.
  • When typesetting, pTeX searches through the KINSOKU table, and inserts a penalty when an entry for the character code is found.

Recent changes (between TeX Live 2017 and 2018):

  • The documentation (from ancient days!) said that "the table region is freed when the value is set to the default (0 for KINSOKU / 3 for INHIBIT)"; however it was not true until pTeX 3.8.0, as the table is never freed forever once it is occupied".
  • We fixed that behavior in pTeX 3.8.0, so that it frees a table entry when it is set to default, as described in #26 (in Japanese).
  • However, we overlooked that the search routine was incomplete; when an entry is freed, the table becomes discontinuous and the routine fails to go through the whole table. This can be an unexpected regression introduced in TeX Live 2018.

The patch by @h-kitagawa (master...search_kinsoku) fixes this issue.

@aminophen aminophen closed this in 73e16f9 Apr 28, 2018

@aminophen

This comment has been minimized.

Member

aminophen commented Apr 28, 2018

Done (r47477).

@Man-Ting-Fang

This comment has been minimized.

Man-Ting-Fang commented Apr 29, 2018

@aminophen @h-kitagawa Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment