texlive[72242] Master/texmf-dist: luatexja (9sep24)

commits+karl at tug.org commits+karl at tug.org
Mon Sep 9 22:21:27 CEST 2024


Revision: 72242
          https://tug.org/svn/texlive?view=revision&revision=72242
Author:   karl
Date:     2024-09-09 22:21:27 +0200 (Mon, 09 Sep 2024)
Log Message:
-----------
luatexja (9sep24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/luatexja/README
    trunk/Master/texmf-dist/doc/luatex/luatexja/ltjsclasses.pdf
    trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
    trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
    trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.pdf
    trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.tex
    trunk/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx
    trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ivd_aj1.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-array.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-footmisc.sty

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/README
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luatexja/README	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/doc/luatex/luatexja/README	2024-09-09 20:21:27 UTC (rev 72242)
@@ -1,4 +1,4 @@
-The LuaTeX-ja Package 20240714.0
+The LuaTeX-ja Package 20240909.0
 --------------------------------
 Copyright (c) 2011--2024 The LuaTeX-ja project
 License: modified BSD (see COPYING)
@@ -42,7 +42,7 @@
 2. If you must/want to install manually:
 
    a. Download the source archive from CTAN,
-      or tagged as 20240714.0 in the Git repository by
+      or tagged as 20240909.0 in the Git repository by
       <https://github.com/luatexja/luatexja/archive/refs/tags/$VER.zip>
 
    b. Extract the archive and process following three files by LuaLaTeX
@@ -92,4 +92,4 @@
   This file and ltj-kinsoku.lua are not used anymore.
   (Do not remove ltj-kinsoku.tex.)
 
-Last commit date: Sun Jul 14 08:56:04 2024 +0900
+Last commit date: Mon Sep 9 05:16:53 2024 +0900

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/ltjsclasses.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.tex
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.tex	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.tex	2024-09-09 20:21:27 UTC (rev 72242)
@@ -1,7 +1,7 @@
 %#! lualatex
 %%% a test of ruby.
 \documentclass[a4paper,10ptj]{ltjsarticle}
-\usepackage[rgb]{xcolor}
+\usepackage[cmyk]{xcolor}
 \usepackage{enumitem,mleftright,pict2e}
 \usepackage{luatexja-otf,amsmath,bxghost}
 \usepackage[no-math]{fontspec}
@@ -17,15 +17,21 @@
 \def\cs#1{\eghostguarded{\texttt{\textbackslash#1}}}
 \usepackage[textwidth=45\zw, lines=45, footskip=2\zh]{geometry}
 \advance\leftmargini-1\zw\advance\leftmarginii-1\zw
-\protected\def\Param#1{\eghostguarded{\underline{\smash{\textsf{\mdseries #1}}}}}
+\protected\def\Param#1{\texorpdfstring{\eghostguarded{\underline{\smash{\textsf{\mdseries #1}}}}}{#1}}
+\def\Pkg#1{\texorpdfstring{\textsf{#1}}{#1}} % packages/classes
 
 \usepackage{luatexja-ruby,showexpl,booktabs}
-\definecolor{mygreen}{rgb}{0,0.5,0}
+\usepackage{luacolor,lua-ul}
+\definecolor{green}{cmyk}{.75,0,.65,0}
+\definecolor{blue}{cmyk}{1,.45,0,0}
+\definecolor{b_blue}{cmyk}{.3,0,0,0}
 \lstset{
   preset=\normalsize, basicstyle=\small\ttfamily, basewidth=0.5em,
   explpreset={numberstyle=\tiny, numbers=left, numbersep=1em, columns=fixed},
-  morecomment=[l]{\%}, commentstyle=\color{mygreen}
+  morecomment=[l]{\%}, commentstyle=\color{green}
 }
+\newunderlinetype\beginActIntr{\color{blue}\leaders\vrule height -.16\zh depth .24\zh}
+\NewDocumentCommand\ActIntr{+m}{{\beginActIntr#1}}
 \makeatletter\let\SX at Info=\relax\makeatother
 \fboxsep=0mm
 
@@ -37,8 +43,11 @@
 	allcolors=blue,
 	pdftitle={luatexja-ruby.sty}
 }
-\def\Node#1#2{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr
-  #1\mathstrut\cr\noalign{\smallskip\hrule height.4pt\smallskip}\strut\<#2\cr}}}}}\,}
+\makeatletter
+\def\Node{\@ifstar{\@Node[b_blue]}{\@Node[white]}}
+\def\@Node[#1]#2#3{\,\vcenter{\hbox{\fboxsep=1pt\fcolorbox{black}{#1}{%
+  \vbox{\small\halign{\hfil##\hfil\cr
+  #2\mathstrut\cr\noalign{\smallskip\hrule height.4pt\smallskip}\strut\<#3\cr}}}}}\,}
 \def\LuaTeX{Lua\TeX}
 
 % 三分ルビ用
@@ -45,33 +54,12 @@
 \DeclareFontShape{JY3}{mc}{mc}{n}{<-> [0.92487] 
   HaranoAjiMincho-Regular:extend=0.67;jfm=ujisc33}{}
 
-%%%% \ltjruby 内に \texorpdfstring + | 除去を仕込む
-\RequirePackage{xparse}
 \makeatletter
-\def\removevert#1{\if\noexpand#1|%
-    \expandafter\expandafter\expandafter\@firstofone\expandafter{%
-  \else\ifnum0=1}\fi#1%
-    \ifx#1\relax\expandafter\@gobble%
-    \else\expandafter\@firstofone
-    \fi{\expandafter\@firstofone
-  \fi
-  \removevert}}
-\makeatother
-\ExplSyntaxOn
-\cs_set_eq:NN \myorigltjruby \ltjruby
-\DeclareExpandableDocumentCommand {\ltjruby} { O{} m m } {%
-   \texorpdfstring {
-    \exp_not:n { \myorigltjruby[#1]{#2}{#3} }
-  } {
-    \removevert #2 \relax
-  }
-}
-\cs_set_eq:NN \ruby \ltjruby
-\ExplSyntaxOff
-%%%%
-
-\makeatletter
+\let\origunderscore=\_
+\def\_{\ifx\f at family\ttdefault\origunderscore\else
+  \leavevmode \kern .06em\vbox {\hrule \@width .333em}\fi}
 \def\figureautorefname{図}
+\def\tableautorefname{表}
 \def\HyRef at autoref#1#2{%
   \begingroup
     \Hy at safe@activestrue
@@ -79,14 +67,29 @@
   \endgroup\eghostguarded{}%" 欧文ゴースト
 }
 
-\title{\textsf{luatexja-ruby}パッケージ}
+\title{\Pkg{luatexja-ruby}パッケージ}
 \author{\LuaTeX-jaプロジェクトチーム}
 \date{\texttt{\csname ver at luatexja-ruby.sty\endcsname}(\today)}
 \makeatletter
-\def\mybox#1{\unskip\ {\Large \fboxrule=0.1mm\fboxsep=0mm\fcolorbox{cyan}{white}{\hbox{\<\ltjjachar#1\<}}}\ }
+\def\mybox{\@ifnextchar({\mybox@@{2}{0}}{%
+  \@ifnextchar){\mybox@@{0}{2}}{\@ifnextchar={\mybox@@{1}{1}}{\mybox@@{0}{0}.}}}}
+\def\mybox@@#1#2#3#4{\unskip\ {\Large \fboxrule=0.1mm\fboxsep=0mm%
+  \ifnum#1>0\fcolorbox{blue}{b_blue}{\vrule width 0pt height .88\zh depth .12\zh\kern#1\dimexpr.25\zw}\kern-\fboxrule\fi%
+  \fcolorbox{blue}{white}{\hbox{\<\ltjjachar#4\<}}%
+  \ifnum#2>0\kern-\fboxrule\fcolorbox{blue}{b_blue}{\vrule width 0pt height .88\zh depth .12\zh\kern#2\dimexpr.25\zw}\fi%
+}\ }
 
+\def\RULER#1#2{%
+  \noindent
+  \rlap{\smash{\phantom{#1}\ \color{cyan}%
+    \@tempcnta=0
+    \loop\ifnum\@tempcnta<20
+       \kern-.05mm\vrule height \dimexpr-\baselineskip+0.88\zh depth \dimexpr #2\baselineskip+0.12\zh width0.1mm\kern-.05mm%
+       \kern\zw\advance\@tempcnta 1
+    \repeat
+  }}\ignorespaces
+}
 \begin{document}
-
 \catcode`\<=13
 \def<#1>{{\rmfamily\mdseries\itshape$\langle$#1\/$\rangle$}}
 %\fontsize{13.19873}{15}\selectfont%
@@ -94,7 +97,7 @@
 \maketitle
 
 \begin{abstract}
-\textsf{luatexja-ruby}パッケージは,\LuaTeX-jaの機能を利用してルビの組版処理を行う追加パッケージである.
+\Pkg{luatexja-ruby}パッケージは,\LuaTeX-jaの機能を利用してルビの組版処理を行う追加パッケージである.
 \LuaTeX, \LuaTeX-jaの内部処理に割り込むことにより,熟語ルビ中の行分割や,
 行頭形・行中形・行末形の自動検出,また進入許容量の自動設定などを可能とした.
 
@@ -105,15 +108,15 @@
 \tableofcontents
 
 \newpage
-\section{\ltjruby{利|用|方|法}{り|よう|ほう|ほう}}
+\section[利用方法]{\ltjruby{利|用|方|法}{り|よう|ほう|ほう}}
 パッケージ読み込みは,\verb+\usepackage{luatexja-ruby}+ で良く,
 必要ならば自動的に\LuaTeX-ja本体を読み込む.
 plain \LuaTeX でのロードはまだサポートしておらず,
 \LaTeXe のみサポートしている.
 
-\subsection{\ltjruby{用|語}{よう|ご}}
+\subsection[用語]{\ltjruby{用|語}{よう|ご}}
 「進入(intrusion)」「突出(protrusion)」という用語は,
-\href{http://zrbabbler.sp.land.to/pxrubrica.html}{\textsf{pxrubrica}パッケージ}%
+\href{http://zrbabbler.sp.land.to/pxrubrica.html}{\Pkg{pxrubrica}パッケージ}%
 での用法に準ずる.
 
 \begin{quote}
@@ -125,15 +128,15 @@
 
 なお,本パッケージでは親文字と直前・直後の文字の間に0でない和文処理グルー
 \footnote{JFMで指定されたグルーや,標準の和文間空白(\Param{kanjiskip}),標準の和欧文間空白(\Param{xkanjiskip}).}%
-がくることも考慮しているため,「\emph{前後の文字への}\underline{進入(許容)量}」と「進入(許容)量」とは異なる可能性がある.
+がくることも考慮しているため,「\emph{前後の文字への}\ActIntr{進入(許容)量}」と「進入(許容)量」とは異なる可能性がある.
 この文書では次のように称する:
 \begin{description}
-  \item[\underline{文字進入量}] 前後の文字へルビ文字が実際にかかる長さ.常に下線を引くことにする.
+  \item[\ActIntr{文字進入量}] 前後の文字へルビ文字が実際にかかる長さ.常に下線を引くことにする.
   \item[進入量] 前後の文字,およびそれとルビの間の和文処理グルーにかかる長さ
 \end{description}
-多くの場合,和文処理グルーは0以上の長さのため,進入量は\underline{文字進入量}以上である.
+多くの場合,和文処理グルーは0以上の長さのため,進入量は\ActIntr{文字進入量}以上である.
 
-例えば次の例では,直前の文字「来」への\underline{前文字進入量}は0であるが,
+例えば次の例では,直前の文字「来」への\ActIntr{前文字進入量}は0であるが,
 前進入量は(和欧文間空白にかかる分まで含めるので)正である.
 \begin{quote}
   \Large
@@ -145,15 +148,15 @@
 \cs{zw},~\cs{zh}命令で取得できる値を表す.多くの場合は両者は同じ値であるが,いつでもそうであるという保証はない.
 「ルビ全角幅」「ルビ全角高さ」についても同様である.
 
-\subsection{\ruby{命|令}{めい|れい}}
+\subsection[命令]{\ruby{命|令}{めい|れい}}
 \label{ssec:ltjruby}
 \paragraph{\cs{ltjruby}}
-ルビ出力用命令の本体.\verb+\ruby+ という別名を定義している.
+ルビ出力用命令の本体.\cs{ruby}という別名を定義している.
 \begin{quote}
 \ttfamily \textbackslash ltjruby[<option>]\{親|文|字\}\{おや|も|じ\}
 \end{quote}
 のように親文字→ルビの順序で指定する.
-第2・第3引数内の「\verb+|+」はグループの区切りを表す.詳細は\ref{ssec:grp}\nobreak 小節を参照.
+第2・第3引数内の「\texttt{|}」はグループの区切りを表す.詳細は\ref{ssec:grp}\nobreak 小節を参照.
 
 \medskip
 <option>には以下の内容をkey-valueリストで指定可能である.
@@ -162,16 +165,16 @@
 
 \begin{description}
 \def\makelabel#1{\ttfamily\bfseries #1}
-\item[pre=<real>] \underline{前文字進入許容量}をルビ全角単位で指定.
+\item[pre=<real>] \ActIntr{前文字進入許容量}をルビ全角単位で指定.
 負の長さを指定した場合は,ルビの状況や直前の文字に応じた自動指定を意味する.
 既定値は負(つまり,自動指定).
 
-\item[post=<real>] 同様に,\underline{後文字進入許容量}を指定する.既定値は負(自動指定).
+\item[post=<real>] 同様に,\ActIntr{後文字進入許容量}を指定する.既定値は負(自動指定).
 
 \item[mode] 進入処理のモードを表すbit vector.下位2\,bitは,\texttt{pre}や
 \texttt{post}が負である場合にしか効力を発揮しない.既定値は$(00001)_2 = 1$.
 \begin{description}
- \item[bit 0] 前後の\underline{文字への進入}を無効にするならば0,有効にするならば1.
+ \item[bit 0] 前後の\ActIntr{文字への進入}を無効にするならば0,有効にするならば1.
  \item[bit 1] 前進入許容量$B$と後進入許容量$A$が異なった場合,
   そのまま処理する場合は0,小さい方に揃えるならば1.
  \item[bit 2--4] ルビ文字の突出量から実際の前・後進入量の計算方法を指定する.
@@ -186,44 +189,41 @@
 \item[stretchruby=\{<left>\}\{<middle>\}\{<right>\}] 親文字の合計長が
 ルビ文字の合計長より長い時に,ルビ文字の前・間・後に入れる空白の割合であり,
 それぞれ0--7の自然数で指定する.
-既定値は\ \verb+{1}{2}{1}+ である.
+既定値は\>\verb+{1}{2}{1}+\>である.
 <left>はルビ文字の先頭までの空き量,<middle>はルビ文字間の空き量,<right>はルビ文字の末尾からの
 空き量(の比)を表す.以下が例である.
-\begin{LTXexample}[width=0.3\textwidth, preset=\Large]
+\begin{LTXexample}[width=0.25\textwidth, preset=\Large]
 \ltjruby[stretchruby=123,maxmargin=2]%
   {◯◯◯◯}{◆◆}
 \end{LTXexample}
 \item[stretch=\{<left>\}\{<middle>\}\{<right>\}]
 行中形でルビ文字の方が長い場合,親文字の前・中・後に入れる空白の割合.
-既定値は\ \verb+{1}{2}{1}+ である.それ以外の代表的な値としては,例えば次のようなものがある.
+既定値は\>\verb+{1}{2}{1}+\>である.それ以外の代表的な値としては,例えば次のようなものがある.
 \begin{description}
-\item[親文字均等割禁止] \verb+{1}{0}{1}+\ など<middle>を0にした値
+\item[親文字均等割禁止] \verb+{1}{0}{1}+\>など<middle>を0にした値
 \item[前突出禁止] \verb+{0}{1}{1}+
 \item[後突出禁止] \verb+{1}{1}{0}+
 \end{description}
 
 \item[stretchbol=\{<left>\}\{<middle>\}\{<right>\}] 行頭形に対する\texttt{stretch}と同様の指定.
-既定値は\ \verb+{0}{1}{1}+ である.
+既定値は\>\verb+{0}{1}{1}+\>である.
 \item[stretcheol=\{<left>\}\{<middle>\}\{<right>\}] 行末形に対する\texttt{stretch}と同様の指定.
-既定値は\ \verb+{1}{1}{0}+ である.
+既定値は\>\verb+{1}{1}{0}+\>である.
 
 \item[maxmargin=<real>] 親文字の方がルビより長い時に,ルビの先頭と親文字の先頭,及び
-ルビ末尾と親文字の末尾の間に許される最大の空白量.\textbf{親文字全角幅単位}で指定し,既定値は0.5.
+ルビ末尾と親文字の末尾の間に許される最大の空白量.\emph{親文字全角幅単位}で指定し,既定値は0.5.
 
 \medskip
 \item[size=<real>] ルビ文字の親文字に対する大きさ.既定値は0.5.
 \item[intergap=<real>] ルビ文字と親文字との空きを親文字全角高さ単位で指定.既定値は0.
 \item[rubysmash=<bool>] ルビの高さを0にするか.既定値は偽.次が例である.
-\begin{LTXexample}[width=0.3\textwidth, preset=\Large]
+\begin{LTXexample}[width=0.25\textwidth, preset=\Large]
 \ \vrule width 0pt height 2\zw depth 1\zw
 \frame{\ltjruby[rubysmash=false]{本}{ほん}}\ 
 \frame{\ltjruby[rubysmash=true]{本}{ほん}}\ 
-\frame{\ltjruby[rubysmash=false,intergap=0.2]
-  {本}{ほん}}\ 
-\frame{\ltjruby[rubysmash=true,intergap=0.2]
-  {本}{ほん}}\ 
-\frame{\ltjruby[rubysmash=false,intergap=-1.5]
-  {本}{ほん}}
+\frame{\ltjruby[rubysmash=false,intergap=0.2]{本}{ほん}}\ 
+\frame{\ltjruby[rubysmash=true,intergap=0.2]{本}{ほん}}\ 
+\frame{\ltjruby[rubysmash=false,intergap=-1.5]{本}{ほん}}
 \end{LTXexample}
 \item[ybaseheight=<real>] 非負の値が指定された場合,
   \emph{縦組以外での}親文字の高さを親文字全角高さの<real>倍と強制的に固定する.
@@ -233,7 +233,7 @@
   既定値は$0.5$.
 \item[baseheight=<real>] \texttt{ybaseheight},\texttt{tbaseheight}を同時に指定したことと同義.
   次の例や\autoref{fig:ruby_vertical}を参照.
-\begin{LTXexample}[width=0.3\textwidth, preset=\Large]
+\begin{LTXexample}[width=0.25\textwidth, preset=\Large]
 \noindent
 \ltjruby[baseheight=0.88]{本}{ほん}\ 
 \ltjruby[baseheight=0.88]{dvi}{ディーヴィーアイ}\\
@@ -252,7 +252,7 @@
   既定値は$0.5$.
 \item[rubydepth=<real>] \texttt{yrubydepth},\texttt{trubydepth}を同時に指定したことと同義.
   次の例や\autoref{fig:ruby_vertical}を参照.
-\begin{LTXexample}[width=0.3\textwidth, preset=\Large]
+\begin{LTXexample}[width=0.25\textwidth, preset=\Large]
 \noindent
 \ltjruby[rubydepth=0.12]{◆}{ほん}\ 
 \ltjruby[rubydepth=0.12]{◆}{pdf}\ 
@@ -305,21 +305,44 @@
 
 
 \item[kenten=<command>]各文字につく圏点の出力命令を指定する.
-  既定値は「\verb+\textbullet+」である.
+  既定値は「\cs{textbullet}」である.
 
 \item[fontcmd=<command>]ルビ用のフォント切り替え命令を指定する.
 このキーの内容が実行された後に\ \verb+\fontsize...\selectfont+\ が実行されるので,
-このキーの指定では最後に\ \verb+\selectfont+ を加える必要はない.
+このキーの指定では最後に\cs{selectfont}を加える必要はない.
 
-この \texttt{fontcmd} キーの内容は多くの回数実行される.
-例えば,\textsf{luatexja-fontspec}パッケージを用いてOpenTypeフォントを用いる場合,
+この \texttt{fontcmd}キーの内容は多くの回数実行される.
+例えば,\Pkg{luatexja-fontspec}パッケージを用いてOpenTypeフォントを用いる場合,
 \begin{lstlisting}
  fontcmd=\addjfontfeatures{Style=Ruby}
 \end{lstlisting}
 のようにしてルビ用字形を用いることが可能だが,現在の実装ではタイプセットに時間がかかるようになる.
 
+ \item[always\_highlight\_protrusion=<bool>] この\cs{ltjruby}命令が\Pkg{lua-ul}パッケージの提供する「下線」命令
+  \footnote{\cs{underLine}, \cs{highLight},およびそのほか.}の引数に含まれていた場合,
+  ルビの突出部(ただし\ActIntr{文字進入部分}は除く)に「下線」がいつでも引かれるか否か.
+
+  既定値は偽.この場合は,突出部に「下線」が引かれるのは,ルビの前後の文字も同じ「下線」命令の有効範囲になっているときに
+  限られる.\autoref{fig:always-highlight-protrusion}を参照.
 \end{description}
+\begin{figure}[t]
+\begin{LTXexample}[width=13.2\zw, preset=\large]
+  \ltjsetruby{stretchbol=121,stretcheol=121}
+  あ\highLight{\ruby{◆}{□□□□□□□□}}あ
+  い\highLight{\ruby{◆}{□□□□□□□□}い}\\
+  \highLight{う\ruby{◆}{□□□□□□□□}}う\\\kern7\zw
+  あ\highLight{\ruby{◆|◆}{□□□□□|□□□□□}}あ
 
+  \ltjsetruby{always_highlight_protrusion}
+  あ\highLight{\ruby{◆}{□□□□□□□□}}あ
+  い\highLight{\ruby{◆}{□□□□□□□□}い}\\
+  \highLight{う\ruby{◆}{□□□□□□□□}}う\\\kern7\zw
+  あ\highLight{\ruby{◆|◆}{□□□□□|□□□□□}}あ
+\end{LTXexample}
+  \caption{\texttt{always\_highlight\_protrusion}キー有無による組版結果の違い}
+  \label{fig:always-highlight-protrusion}
+\end{figure}
+
 \medskip
 次の2つは,以上で説明した複数のオプションを一度に設定するためのものである.
 普通はこの2\nobreak つのうちいずれかを設定するだけで足りるだろう.
@@ -337,7 +360,7 @@
 \end{description}
 
 \paragraph{\cs{ltjsetruby}\{<option>\}}
-<option>の既定値を指定する.\textsf{luatexja-ruby}読み込み時の値は
+<option>の既定値を指定する.\Pkg{luatexja-ruby}読み込み時の値は
 各項目の所で既に説明してあるが,次のようになっている.
 \begin{verbatim}
   pre=-1, post=-1, mode=1,
@@ -346,24 +369,51 @@
   maxmargin=0.5, size=0.5, intergap=0, rubysmash=false,
   kenten=\textbullet, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5,
   yrubydepth=0.12, trubydepth=0.5,
-  intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip
+  intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip,
+  always_highlight_protrusion=false
 \end{verbatim}
 
 \paragraph{\cs{ltjsetparamater} に追加されるキー}
 \begin{description}
 \item[\Param{rubypreintrusion}\ttfamily =\{<chr\_code>, <pre\_int>\}]
-  文字<chr\_code> に,その\textbf{直後}のルビによって掛けられるルビ文字列の最大長
-  (つまり,\underline{前文字進入許容量})をルビ全角幅単位で指定.
+  文字<chr\_code> に,その\emph{直後}のルビによって掛けられるルビ文字列の最大長
+  (つまり,\ActIntr{前文字進入許容量})をルビ全角幅単位で指定.
 
-  \textbf{v0.5以降での変更点}:もし$-a$~($a>0$)を指定した場合は,実際の\underline{前文字進入許容量}は$a$となるが,
-  文字<chr\_code>の前のJFMグルーに進入が発生した場合には,\underline{前文字進入許容量}が0でなかった場合は,の後のJFMグルーにはルビの進入は発生しない.
-
+  \emph{v0.5以降での変更点}:もし$-a$~($a>0$)を指定した場合は,次のようになる.
+  \begin{itemize}
+    \item 実際の\ActIntr{前文字進入許容量}は$a$となる.
+    \item ただし,文字<chr\_code>の直前のルビによって
+    文字の前のJFMグルーに進入が発生した場合,文字<chr\_code>の直後のルビの前進入は発生しない.
+  \end{itemize}
+  後者の状況の例を以下に載せる.
+\begin{LTXexample}[width=0.25\textwidth, preset=\Large]
+\ltjsetparameter{rubypreintrusion={`\【,-1}}
+\ruby{鴎}{かもめ}【\ruby{隼}{はやぶさ}
+% 「\ruby{鴎}{かもめ}」は,「【」直前のJFMグルーに
+% ルビ半角だけ進入している
+% →「\ruby{隼}{はやぶさ}」の「【」への進入はない.
+\end{LTXexample}
+  
+  
 \item[\Param{rubypostintrusion}\ttfamily =\{<chr\_code>, <post\_int>\}]
-  文字<chr\_code> に,その\textbf{直前}のルビによって掛けられるルビ文字列の最大長
-  (つまり,\underline{後文字進入許容量})をルビ全角幅単位で指定.
+  文字<chr\_code>に,その\emph{直前}のルビによって掛けられるルビ文字列の最大長
+  (つまり,\ActIntr{後文字進入許容量})をルビ全角幅単位で指定.
 
-  \textbf{v0.5以降での変更点}:もし$-a$~($a>0$)を指定した場合は,実際の\underline{後文字進入許容量}は$a$となるが,
-  実際の\underline{後文字進入量}が0でなかった場合は,文字<chr\_code>の後のJFMグルーにはルビの進入は発生しない.
+  \emph{v0.5以降での変更点}:もし$-a$~($a>0$)を指定した場合は,次のようになる.
+  \begin{itemize}
+    \item 実際の\ActIntr{後文字進入許容量}は$a$となる.
+    \item ただし,文字<chr\_code>の直前のルビによってこの文字への実際の\ActIntr{後文字進入}が
+    発生した場合,文字<chr\_code>の直後のJFMグルーにはルビの前進入は発生しない.
+  \end{itemize}
+  今回も後者の状況の例を以下に載せる.
+\begin{LTXexample}[width=0.25\textwidth, preset=\Large]
+\ltjsetparameter{rubypostintrusion={`\】,-1}}
+\ruby{鴎}{かもめ}】\ruby{隼}{はやぶさ}\\
+\hskip.25\zw 鴎】隼\\% 比較用
+% 「\ruby{鴎}{かもめ}」は,「】」にルビ半角だけ進入
+% →「\ruby{隼}{はやぶさ}」は「】」直前のJFMグルー
+% には進入しない.
+\end{LTXexample}
 \end{description}
 以下の文字は\Param{rubypreintrusion},~\Param{rubypostintrusion}とも初期値は1である:
 \begin{quote}
@@ -374,51 +424,51 @@
 \end{quote}
 次に,以下の文字は\Param{rubypreintrusion},~\Param{rubypostintrusion}とも初期値は0.5である:
 \begin{quote}
- 中点類\@for\@tmp:=`\・,`\:,`\; \do{\mybox{\@tmp}}
+ 中点類\@for\@tmp:=`\・,`\:,`\; \do{\mybox={\@tmp}}
 \end{quote}
 また,以下の文字は\Param{rubypreintrusion}のみ初期値は$-1$である:
-\begin{quote}
+\begin{itemize}
+ \item 
   始め括弧類
-  \@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do{\mybox{\@tmp}}\unskip,
-  「文字コード$-1$の文字
-  \footnote{段落開始の\ \cs{parindent}分インデントを表す.
+  \@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do{\mybox({\@tmp}}\unskip
+ \item 「文字コード$-1$の文字
+  \footnote{ここでは段落開始の\ \cs{parindent}分インデントを表す.
     通常の\LuaTeX-jaにおける指定では「文字コード$-1$」は文中数式境界を表していることに注意.}」
-\end{quote}
+\end{itemize}
 さらに,以下の文字は\Param{rubypostintrusion}のみ初期値は$-1$である:
-\begin{quote}
-  閉じ括弧類
-  \@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do{\mybox{\@tmp}}\unskip,
-  句読点類\@for\@tmp:=`\、,`\,,`\。,`\. \do{\mybox{\@tmp}}
-\end{quote}
+\begin{itemize}
+  \item 閉じ括弧類
+  \@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do{\mybox){\@tmp}}
+  \item 句読点類\@for\@tmp:=`\、,`\,,`\。,`\. \do{\mybox){\@tmp}}
+\end{itemize}
 \makeatother
 
 以上で記述されていない\Param{rubypreintrusion},~\Param{rubypostintrusion}の初期値はすべて0である.
 
-
 \paragraph{\cs{ltjkenten}}
 圏点を出力する命令であり,
 \begin{quote}
  \ttfamily\cs{ltjkenten}[<option>]\{親文字\}
 \end{quote}
-のように使用する.複数文字に圏点をつける場合でも,\verb+\ltjruby+ のように「\texttt{|}」を使って
-文字を区切る\textbf{必要はない}(\verb+\kenten+内では「\texttt{|}」は特別な意味を持たない)
+のように使用する.複数文字に圏点をつける場合でも,\cs{ltjruby}のように「\texttt{|}」を使って
+文字を区切る\emph{必要はない}(\cs{kenten}内では「\texttt{|}」は特別な意味を持たない)
 ことに注意してほしい.
 
 圏点として出力される文字は\texttt{kenten}キーによって指定し,
 圏点自身の大きさは(ルビと同様に)\texttt{size}キーで指定する.
 
-\subsection{グループの\ruby{指|定}{し|てい}}
+\subsection[グループの指定]{グループの\ruby{指|定}{し|てい}}
 \label{ssec:grp}
 \begin{quote}
 \ttfamily\cs{ltjruby}[<option>]\{親|文|字\}\{おや|も|じ\}
 \end{quote}
-のように,\verb+\ltjruby+\ の第2・第3引数内の「\verb+|+」はグループの区切りを表す.
+のように,\cs{ltjruby}の第2・第3引数内の「\texttt{|}」はグループの区切りを表す.
 グループの数は両者で一致しなければならず,
 \verb+\ltjruby{紋章}{もん|しよう}+ のようには\emph{できない}.
 
 1グループのみのルビ(単純グループルビ)はグループルビとして組まれる.そのため,
 もしモノルビを使いたければ,面倒でも
-\begin{LTXexample}[width=0.4\textwidth, preset=\Large]
+\begin{LTXexample}[width=0.25\textwidth, preset=\Large]
 の\ltjruby{紋}{もん}\ltjruby{章}{しよう}が
 \end{LTXexample}
 のように,複数回使用すること.
@@ -427,7 +477,7 @@
   実際には\TeX での長さの計算誤差($2^{-16}$~ptの整数倍として計算していることによる)を考慮し,
   親文字全角の$1/1000$だけルビ文字列が長くなることを許容している.
 }であれば,
-単純グループルビの並びとして扱われる.すなわち,次ページ冒頭の2行は全くの等価となる.
+単純グループルビの並びとして扱われる.すなわち,次の2行は全くの等価となる.
 \begin{verbatim}
 \ltjruby{普|通|車}{ふ|つう|しや}
 \ltjruby{普}{ふ}\ltjruby{通}{つう}\ltjruby{車}{しや}
@@ -439,20 +489,23 @@
 \begin{verbatim}
 …の\ltjruby{表|現|力}{ひよう|げん|りよく}は…
 \end{verbatim}
-という入力からは得られる組版結果は,次のいずれかになる.
-\begin{center}
- \begin{tabular}{ll}
+という入力からは得られる組版結果は,\autoref{tab:group_ruby}のいずれかになる.
+\begin{table}[t]
+\centering\small
+ \begin{tabular}{lll}
  \toprule
  改行なし(行中形)&\Large …の\ltjruby{表|現|力}{ひよう|げん|りよく}は…\\
  直前で改行&\Large \vrule \ltjruby[stretch=011]{表|現|力}{ひよう|げん|りよく}は…\\
-&\Large …の\ltjruby[stretch=110]{表}{ひよう}
-    \vrule\ltjruby[stretch=011]{現|力}{げん|りよく}は…\\
-&\Large …の\ltjruby[stretch=110]{表|現}{ひよう|げん}
-    \vrule\ltjruby[stretch=011]{力}{りよく}は…\\
+ 途中で改行&\Large …の\ltjruby[stretch=110]{表}{ひよう}
+    \vrule\ltjruby[stretch=011]{現|力}{げん|りよく}は…
+    &\Large …の\ltjruby[stretch=110]{表|現}{ひよう|げん}
+      \vrule\ltjruby[stretch=011]{力}{りよく}は…\\
  直後に改行&\Large …の\ltjruby[stretch=110]{表|現|力}{ひよう|げん|りよく}\vrule\\
 \bottomrule
  \end{tabular}
-\end{center}
+ \caption{可動グループルビの組まれ方(縦線は行の境目)}
+ \label{tab:group_ruby}
+\end{table}
 \begin{itemize}
  \item これらの行分割によってペナルティは発生しない.
  \item 上記の例で見られるように,
@@ -481,44 +534,44 @@
  \item \cs{kenten}がすでに定義されていない場合に限り,\cs{kenten}が\cs{ltjkenten}の別名として定義される.
 \end{itemize}
 
-\section{\ruby{注|意|点}{ちゆう|い|てん}}
+\section[注意点]{\ruby{注|意|点}{ちゆう|い|てん}}
 \paragraph{前後からのルビ文字のはみ出し1}
 「日本語組版処理の要件」の図117\footnote{2020-08-11版での番号.2012-04-03版では図3.82.}のように,
 前後からのルビ文字のはみ出しが繋がらないようにする処理が組み込まれている.
 例えば,
-\begin{LTXexample}[preset=\Large,width=0.3\textwidth]
+\begin{LTXexample}[preset=\Large,width=0.25\textwidth]
 \ltjruby{陵}{りよう}と\ltjruby{陵}{みささぎ}\\
 \ltjruby{陵}{りよう}と\ltjruby[pre=1]{陵}{みささぎ}
 \end{LTXexample} 
 において,1行目右側の「\ltjruby{陵}{みささぎ}」のルビが前の「と」にかかる量は次のように決まる:
 \begin{enumerate}
-\item 1回目の実行では,行分割前に「\ltjruby{陵}{りよう}」の\underline{後文字進入量}は前もって知ることはでき
+\item 1回目の実行では,行分割前に「\ltjruby{陵}{りよう}」の\ActIntr{後文字進入量}は前もって知ることはでき
       ない.そのため,「\ltjruby{陵}{りよう}」は行中形で組まれるものと想定し,
 「\ltjruby{陵}{みささぎ}」の前文字進入許容量は
 \[
  \underbrace{0.5\,\mathrm{zw}}_{\text{元々の許容量}}
--\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\underline{後文字進入量}(行中形)}}=0.25\,\mathrm{zw}
+-\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\ActIntr{後文字進入量}(行中形)}}=0.25\,\mathrm{zw}
 \]
-となる.行分割後,「\ltjruby{陵}{りよう}」の実際の\underline{後文字進入量}は
+となる.行分割後,「\ltjruby{陵}{りよう}」の実際の\ActIntr{後文字進入量}は
 <jobname>\texttt{.ltjruby}ファイルに記述される.
-\item 2回目以降の実行では,<jobname>\texttt{.ltjruby}ファイルに保存された「\ltjruby{陵}{りよう}」の\underline{後文字進入量}
-を用いて,「\ltjruby{陵}{みささぎ}」の\underline{前文字進入許容量}を次のように計算する:
+\item 2回目以降の実行では,<jobname>\texttt{.ltjruby}ファイルに保存された「\ltjruby{陵}{りよう}」の\ActIntr{後文字進入量}
+を用いて,「\ltjruby{陵}{みささぎ}」の\ActIntr{前文字進入許容量}を次のように計算する:
 \[
  \underbrace{0.5\,\mathrm{zw}}_{\text{元々の許容量}}
--\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\underline{後文字進入量}(from \texttt{.ltjruby})}}=0.25\,\mathrm{zw}.
+-\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\ActIntr{後文字進入量}(from \texttt{.ltjruby})}}=0.25\,\mathrm{zw}.
 \]
 \end{enumerate}
 
-<jobname>\texttt{.ltjruby}ファイルに保存する際,各 \verb+\ltjruby+ 命令の呼び出しを識別するキーが必要になるが,
-そのキーとしては単純に「何個目の \verb+\ltjruby+ 命令か」である.
+<jobname>\texttt{.ltjruby}ファイルに保存する際,各\cs{ltjruby}命令の呼び出しを識別するキーが必要になるが,
+そのキーとしては単純に「何個目の\cs{ltjruby}命令か」である.
 
 なお,以上の処理は,1行目と2行目を比較すれば分かるように,
-「\ltjruby{陵}{みささぎ}」の\emph{\underline{前文字進入許容量}指定(\texttt{pre})が自動}になっている場合のみ
-実施される.
+「\ltjruby{陵}{みささぎ}」の\emph{\ActIntr{前文字進入許容量}指定が自動(\texttt{pre}の値が負)}に
+なっている場合のみ実施される.
 
-
+\newpage
 \paragraph{前後からのルビ文字のはみ出し2}
-また,本パッケージのv0.**以降では,「日本語組版処理の要件」にある
+また,本パッケージでは,「日本語組版処理の要件」にある
 \begin{quote}
   後ろにくる終わり括弧類,句点類若しくは読点類,又は前にくる始め括弧類には,
   最大でルビ文字サイズの全角までルビ文字を掛けてもよい.
@@ -533,17 +586,17 @@
 これは,段落の「本当の」末尾には \verb+\penalty10000\parfillskip+ があるためで,
 ルビ処理用に作った最後のグルー(\ref{ssec:impl}\nobreak 小節の説明では$g_2$)が消去されないことによる.
 
-\verb+\parfillskip+ の長さ(や,場合によっては \verb+\rightskip+)を実測し,
+\cs{parfillskip}(や,場合によっては\cs{rightskip})の長さを実測し,
 それによって処理を変えるのも可能だが,そのようなことはしなかった.
-段落がルビで終わることは普通ない(最低でも句点が続くだろう)と思うからである.
+段落がルビで終わることは普通ない(最低でも句点が続くだろう)と考えられるからである.
 
 \paragraph{段落先頭のルビ}
 同様に,段落先頭のルビは行頭形にはならない.
-\texttt{pre}が負(つまり,自動指定)のとき,段落最初の \verb+\parindent+ 分への
-進入は可能である.ここ\verb+\parindent+ 分のインデントへの\underline{進入許容量}は
+\texttt{pre}が負(つまり,自動指定)のとき,段落最初の\cs{parindent}分への
+進入は可能である.この\cs{parindent}分のインデントへの\ActIntr{進入許容量}は
 「文字$-1$」に対する\Param{rubypreintrusion}(既定値は1,ルビ全角単位)と
-\ \verb+\parindent+ の長さのうち小さい方である.
-\begin{LTXexample}[preset=\Large,width=0.4\textwidth]
+\cs{parindent}の長さのうち小さい方である.
+\begin{LTXexample}[preset=\Large,width=0.25\textwidth]
 \parindent1\zw\noindent 012345\par
 \ltjruby{陵}{みささぎ}は……\par
 \ltjruby{承}{うけたまわ}り……\par
@@ -561,30 +614,28 @@
 
 例えば,標準設定での中黒「・」の直後のルビからの中黒への進入許容量は
 \begin{quote}
-  中黒「・」への\underline{前進入許容量}はルビ全角の半分で,
+  中黒「・」への\ActIntr{前進入許容量}はルビ全角の半分で,
   中黒本体の後の四分空きには進入可能
 \end{quote}
 となっている.そのため,下の例の1, 2行目ともルビの前進入量は0.5\,zwとなる.
 しかし,2行目では詰め量の0.5\,zwがほとんど中黒周囲の四分空きで負担されるため,
 実際には「中黒本体にほぼ0.5\,zwが進入する」という望ましくない結果が得られている.
+      \typeout{===========}
 \begin{LTXexample}[preset=\Large,width=0.4\textwidth]
 \leavevmode\hbox{あ・\ltjruby{◆}{◆◆◆◆}漢字}\\
 \hbox spread-0.5\zw{あ・\ltjruby{◆}{◆◆◆◆}漢字}
 \end{LTXexample}
 
-また,次の例では2行目では前後の\underline{文字進入量}がルビ1字分と等しくなっているが,
-3行目のように1全角伸ばすという調整が行われた後は\underline{文字進入量}が不揃いになってしまっている.
+また,次の例では2行目では前後の\ActIntr{文字進入量}がルビ1字分と等しくなっているが,
+3行目のように1全角伸ばすという調整が行われた後は\ActIntr{文字進入量}が不揃いになってしまっている.
 これはもともと「\texttt{;}」には後側にのみ和欧文間空白が入ることと,3行目ではこの和欧文間空白が
 伸びているためである.
-\begin{LTXexample}[preset=\Large,width=0.4\textwidth]
-\leavevmode\hbox{……に%
-  \ltjruby{\texttt{;}}{セミコロン}という……}\\
-\hbox spread\zw{……に%
-  \ltjruby{\texttt{;}}{セミコロン}という……}
+\begin{LTXexample}[preset=\Large,width=0.25\textwidth]
+\leavevmode\hbox{に\ltjruby{\texttt{;}}{セミコロン}という}\\
+\hbox spread\zw{に\ltjruby{\texttt{;}}{セミコロン}という}
 \end{LTXexample}
 
-\newpage
-\section{\ruby{実|装}{じつ|そう}について}
+\section[実装について]{\ruby{実|装}{じつ|そう}について}
 
 \subsection{進入量の計算}
 \label{ssec:calc_intrusion}
@@ -591,24 +642,24 @@
 ルビ文字を自然に組んだときの幅が親文字のそれより多い場合,
 ルビの前後への進入量は次のように決定される.
 \begin{enumerate}[label=\emph{Step~\arabic*},labelindent=0pt,itemindent=*,itemsep=\medskipamount]
-  \item \underline{前文字進入許容量}$B_0$,\underline{後進入文字許容量}$A_0$の算出.
+  \item \ActIntr{前文字進入許容量}$B_0$,\ActIntr{後進入文字許容量}$A_0$の算出.
   
   ルビ全角の長さを$r$とする.
   \begin{enumerate}
-   \item \texttt{pre}の指定値が非負であった場合は,それに$r$を掛けたものを$B_0$とする.\\
+   \item \texttt{pre}の指定値が非負であった場合は,それに$r$を掛けたものを$B_0$とする.
+
     そうでなかった場合は,「ルビの直前の文字」に対する
-    \Param{rubypreintrusion}の値に$r$を掛けたものを$B_0$とする
+    \Param{rubypreintrusion}の絶対値に$r$を掛けたものを$B_0$とする
     \footnote{%
       なお,「ルビの直前の文字」が段落最初の\cs{parindent}分のインデントであった場合,
       $B_0$を,「文字コード$-1$の文字」\Param{rubypreintrusion}の値に$r$を掛けた値と\cs{parindent}のうち
       小さい方とする.
-    }.
+    }.ここで,もし2つ前の文字がルビで,その直後(つまりいま処理しているルビから見れば直前)
+    の文字へ$a'$だけの進入があった場合,現在のルビについて$B_0←\min(0,B_0-a')$とする.
    \item \texttt{post}の指定値が非負であった場合は,それに$r$を掛けたものを$A_0$とする.\\
     そうでなかった場合は,「ルビの直後の文字」に対する
-    \Param{rubypostintrusion}の値にルビ全角の値を掛けたものを$A_0$とする.
-   \item \texttt{mode}の最下位ビット(bit~0)が0であった場合は,$B_0\leftarrow 0$, $A\leftarrow 0$とする.
-   \item もし2つ前の文字がルビで,その直後(つまりいま処理しているルビから見れば直前)
-    の文字へ$a'$だけの進入があった場合,現在のルビについて$B_0←\min(0,B_0-a')$とする.
+    \Param{rubypostintrusion}の絶対値にルビ全角の値を掛けたものを$A_0$とする.
+   \item \texttt{mode}の最下位ビット(bit~0)が0であった場合は,$B_0\leftarrow 0$, $A_0\leftarrow 0$とする.
   \end{enumerate}
   \item 前進入許容量$B$,後進入許容量$A$の算出.
   \begin{enumerate}
@@ -624,8 +675,8 @@
     それぞれ$g$の自然長を$B$に加算する.
 
     ルビとその直後の文字との間に和文処理グルーが挿入された場合も同様である.
-    
-    \item \texttt{mode}の2番目のビット(bit~1)が0であった場合は,$B$,~$A\leftarrow \min(B,A)$とする.
+
+    \item \texttt{mode}の2番目のビット(bit~1)が1であった場合は,$B$,~$A\leftarrow \min(B,A)$とする.
   \end{enumerate}
   \item 実際の前進入量$b$,後進入量$a$の計算.
   
@@ -704,21 +755,28 @@
 \end{LTXexample}
 
 \begin{enumerate}
-\item \verb|\ltjruby|コマンド自体は,一旦次のnode listを値とするwhatsit~$W$を作って,
-現在の水平リストへと挿入する(必要ならば\verb|\leavevmode|も実行):
+\item \cs{ltjruby}命令自体は,一旦次のnode listを値とするwhatsit~$W$を作って,
+現在の水平リストへと挿入する(必要ならば\cs{leavevmode}も実行):
 \[
  \Node{whatsit $w$}{value: 2}\longrightarrow 
  \Node{hlist $s_1$}{「りゆう」}\longrightarrow
  \Node{hlist $p_1$}{「流」}\longrightarrow
  \Node{hlist $s_2$}{「ちよう」}\longrightarrow
- \Node{hlist $p_2$}{「暢」}
+ \Node{hlist $p_2$}{「暢」}\longrightarrow
+ \Node{kern $k_b$}{}\longrightarrow
+ \Node{kern $k_a$}{}
 \]
 ここで,最初の$w$の値2は,ルビが2つのパーツ「\ltjruby{流}{りゆう}」「\ltjruby{暢}{ちよう}」からなっていることを
 表している.この値を$\mathit{cmp}$とおこう.
 $s_i$達の中の文字は既にルビの大きさである.
+  
+また,$k_b$,~$k_a$は\texttt{always\_highlight\_protrusion}キーが偽の場合にのみ生成されるが,
+実際に使われるのは行分割後になってからである.\Pkg{lua-ul}対応のためには,和文処理グルーの挿入処理で
+「前・後のクラスタそれぞれとのattributeの共通部分」を保存する必要があり,この段階でノードとして$k_b$,~$k_a$を
+準備している.
 \item \LuaTeX-jaの和文処理グルー挿入処理において,
 このwhatsit~$W$はまとめて
-「先頭が『流』,最後が『暢』であるようなhboxを \verb|\unhbox| で展開したもの」と扱われる.
+「先頭が『流』,最後が『暢』であるようなhboxを\cs{unhbox}で展開したもの」と扱われる.
 言い換えれば,ルビ部分を無視した単なる「流暢」という和文文字の並びとして扱われる\footnote{「流」「暢」の間のグルーは既に入っている,と扱われる.}.
 次のサンプルを参照
 \begin{LTXexample}[preset=\Large]
@@ -729,7 +787,10 @@
 \end{LTXexample}
 \item 和文処理グルーの挿入が終わった後で,可動グループルビのためのノードの挿入に入る.
 \begin{enumerate}
-\item $W$の前後に$2\mathit{cmp}+1=5$個のノードが挿入され,$W$の周辺は次のようなノード列になる.
+\item $W$の前後に$2\mathit{cmp}+1=5$個のノードが挿入され,$W$の周辺は次のようなノード列になる
+  \footnote{%
+    $r_2$と$g_2$の間には,ルビと直後の文字の間にある禁則処理のためのペナルティなどが入っているかもしれない.
+  }.
 \begin{align*}
  (\text{other nodes})&\longrightarrow
  \Node{glue $g_0$}{}\longrightarrow \Node{whatsit~$W$}{元からある}\longrightarrow \Node{rule $r_1$}{}
@@ -743,7 +804,7 @@
 \begin{gather*}
  (\text{other nodes})\longrightarrow
  \Node{glue $g_0$}{}\longrightarrow \Node{whatsit~$W$}{元からある}\longrightarrow \Node{rule $r_1$}{}\\
-\noalign{\hrulefill 行の境目\hrulefill}
+\noalign{\leavevmode\hskip 2\zw\hrulefill 行の境目\hrulefill\kern 2\zw\null}
 \Node{rule $r_2$}{}\longrightarrow 
  \Node{glue $g_2$}{}\longrightarrow (\text{other nodes})
 \end{gather*}
@@ -750,7 +811,7 @@
 のようになったとしたら,「\ltjruby{流}{りゆう}」「\ltjruby{暢}{ちよう}」の間で行分割が起きた,ということがわかり,
 $g_i$,~$r_i$達のノードを適切に置き換えればよい(後で詳しく説明する).
 
-\begin{figure}\centering\small
+\begin{table}\centering\small
 \begin{tabular}{cllll}
 \toprule
 \multicolumn{1}{c}{\bf ノード}&\multicolumn{1}{c}{\bf 組み方}&\multicolumn{1}{c}{\bf サンプル}%
@@ -766,16 +827,16 @@
 \fbox{を}{\color{blue!50!black}\gt\ltjruby[pre=1,mode=1,stretch=110]{流|暢}{りゆう|ちよう}}\vrule
 &
 $g_0\rightarrow W\rightarrow r_1\rightarrow g_2 \rightarrow r_2$\\
-$n_3$&行頭1グループ&
+$n_3$&行頭2グループ&
 \Large
+\vrule{\color{blue!50!black}\gt\ltjruby[post=1,mode=1,stretch=011]{流|暢}{りゆう|ちよう}}\fbox{に}
+&
+$W\rightarrow r_1\rightarrow g_2 \rightarrow r_2\rightarrow g_2$\\
+$n_4$&行頭1グループ&
+\Large
 \vrule{\color{blue!50!black}\gt\ltjruby[post=1,mode=1,stretch=011]{暢}{ちよう}}\fbox{に}
 &
 $r_2\rightarrow g_2$\\
-$n_4$&行頭2グループ&
-\Large
-\vrule{\color{blue!50!black}\gt\ltjruby[post=1,mode=1,stretch=011]{流|暢}{りゆう|ちよう}}\fbox{に}
-&
-$W\rightarrow r_1\rightarrow g_2 \rightarrow r_2\rightarrow g_2$\\
 $n_5$&行中&
 \Large
 \fbox{を}{\color{blue!50!black}\gt\ltjruby[post=0.5,pre=0.5,mode=1]{流|暢}{りゆう|ちよう}}\fbox{に}
@@ -785,32 +846,31 @@
 \bottomrule
 \end{tabular}
 \caption{ルビの組み方と対応するノード並び}
-\label{fig:node}
-\end{figure}
+\label{tab:node}
+\end{table}
 
 \item なお,$r_i$達の高さ・深さは組み上がった後のそれである.
-$g_i$,~$r_i$達の幅は,図\nobreak\ref{fig:node}に示したような対応に沿って算出する.
-例えばこの場合,行中形$n_5$に対して
+$g_i$,~$r_i$達の幅は,\autoref{tab:node}に示したような対応に沿って算出する.
+例えば,行中形$n_5$に対して,記号は乱用気味であるが,
 \[
  g_0+r_1+g_2+r_2+g_2 = (3-0.25\times 2)\,\mathrm{zw}=2.5\,\mathrm{zw}
 \]
-という方程式が立つ(zwは親文字全角の幅,進入量込).
-$n_1$から$n_5$まで計5本の方程式が立つが,これらはGau\ss の消去法で解くことができて
-$g_i$,~$r_i$達の幅が求まる.
+という方程式が立つ(zwは親文字全角の幅,引き算は進入量の分).
+方程式と未知数($g_i$,~$r_i$達の幅)はどちらも$2\mathit{cmp}+1$であるので,
+Gau\ss の消去法により$g_i$,~$r_i$達の幅が求まる.
 \item また,ルビ処理を統括しているwhatsit~$W$の値も
-\[
- \Node{whatsit $w$}{value: 2}\longrightarrow 
- \Node{vlist $n_1$}{末1}\longrightarrow
- \Node{vlist $n_2$}{末2}\longrightarrow
- \Node{vlist $n_3$}{頭1}\longrightarrow
- \Node{vlist $n_4$}{頭2}\longrightarrow
- \Node{vlist $n_5$}{中}
-\]
+\begin{align*}
+ \Node{whatsit $w$}{value: 2}
+ &\longrightarrow\Node{vlist $n_1$}{末1}\longrightarrow\Node{vlist $n_2$}{末2}
+  \longrightarrow\Node{vlist $n_3$}{頭2}\longrightarrow\Node{vlist $n_4$}{頭1}
+  \longrightarrow\Node{vlist $n_5$}{中}\\
+ &\longrightarrow\Node{kern $k_b$}{}\longrightarrow\Node{kern $k_a$}{}
+\end{align*}
 に置き換えておく.
 
 \end{enumerate}
 
-\item \LuaTeX の行分割処理を普通に行う.
+\item \LuaTeX の行分割処理を通常通りに行う.
 \item 行分割の結果に従って,$g_i$,~$r_i$達を適切に置換する.
 
 例えば行分割の結果
@@ -818,7 +878,7 @@
  (\text{other nodes})\longrightarrow
  \Node{glue $g_0$}{}\longrightarrow \Node{whatsit~$W$}{元からある}\longrightarrow \Node{rule $r_1$}{}
   \tag{行A}\\
-\noalign{\hrulefill 行の境目\hrulefill}
+\noalign{\leavevmode\hskip 2\zw\hrulefill 行の境目\hrulefill\kern 2\zw\null}
 \Node{rule $r_2$}{}\longrightarrow 
  \Node{glue $g_2$}{}\longrightarrow (\text{other nodes})\tag{行B}
 \end{gather*}
@@ -833,25 +893,32 @@
 $g_0$,~($W$,)~$r_1$というノードの並びは,「行末1グループ」$n_1$に対応しているので,
 $g_0$,~$r_1$を行Aから除去・メモリ解放し,代わりに$n_1$を行Aの中身に追加する.
 
+\item 
+\texttt{always\_highlight\_protrusion}キーが偽であり,かつルビの前への突出量から\ActIntr{前文字進入量}を引いた値
+  $\mathit{prot\_b}$が0でない場合は,$n_1$の直前にkern~$k_b$(長さ$\mathit{prot\_b}$)と,それを打ち消すkern(長さ$-\mathit{prot\_b}$)を挿入する.
+
 \item 次に行Bの処理にうつる.行Aでルビの処理は完了していない(2グループのルビなのにまだ1グループしか使っていない)ので,
 「whatsit~$W$由来」のノードがいくつか行B内に残っているはずである.
 
-案の定,$r_2$,~$g_2$というノード列が見つかった.これは「行頭1グループ」$n_3$に対応しているので,
-$r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行Bの中身に挿入する.
-
+案の定,$r_2$,~$g_2$というノード列が見つかった.これは「行頭1グループ」$n_4$に対応しているので,
+$r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_4$を行Bの中身に挿入する.
+\texttt{always\_highlight\_protrusion}キーが偽であったときは,行Aのときと同様にkernを2つ挿入する.
+  
 \item これで2グループとも使い切ったことになるので,
 隔離しておいた$W$を,(使われなかった$n_2$,~$n_4$,~$n_5$などと共に)メモリ解放する.結果として
-次のようになった:
+次のようになる.
 \begin{gather*}
- (\text{other nodes})\longrightarrow
- \Node{vlist $n_1$}{末1}\tag{行A}\\
-\noalign{\hrulefill 行の境目\hrulefill}
-\Node{vlist $n_3$}{頭1}\longrightarrow (\text{other nodes})\tag{行B}
+ (\text{other nodes})\longrightarrow \Node{kern~$k_b$}{$\mathit{prot\_b}$}
+ \longrightarrow \Node*{kern}{$-\mathit{prot\_b}$}\longrightarrow \Node*{vlist $n_1$}{末1}\tag{行A}\\
+\noalign{\leavevmode\hskip 2\zw\hrulefill 行の境目\hrulefill\kern 2\zw\null}
+\Node*{vlist $n_4$}{頭1}\longrightarrow \Node*{kern}{$-\mathit{prot\_a}$}
+  \longrightarrow \Node{kern~$k_a$}{$\mathit{prot\_a}$}\longrightarrow (\text{other nodes})\tag{行B}
 \end{gather*}
+  ここで,色付きの4ノードは,\Pkg{lua-ul}パッケージの提供する「下線」命令が
+  \cs{ltjruby}のみを有効範囲として発行された場合の,「下線」がかかってくるノードたちである.
 \end{enumerate}
 \end{enumerate}
 
-\newpage
 \section{いくつかの例}
 \def\rubytest{\ruby{黄金橋}{ゴールデンゲートブリッジ}\relax}
 
@@ -949,7 +1016,6 @@
 \item[肩つき] {\ltjsetruby{kata}\sample}
 \end{description}
 
-\newpage
 \begin{LTXexample}[pos=t]
 {\ltjsetruby{stretch=101}% 親文字均等割り禁止
     \ruby{休|憩|中}{きゆう|けい|ちゆう}かつ\ruby{視|聴|中}{し|ちよう|ちゆう}%
@@ -961,7 +1027,6 @@
 \end{LTXexample}
 
 
-\typeout{AAAAAA}
 \setbox0=\vbox{\hsize20\zw
   \ltjsetparameter{rubypreintrusion={`◆,1}}
   \ltjsetparameter{rubypostintrusion={`◆,1}}
@@ -1005,6 +1070,18 @@
 }
 \fbox{\box0}
 
+\medskip
+\begin{LTXexample}[pos=t]
+% lua-ul
+たとえば\strikeThrough{\ruby{取|消|線}{とりけしの|いちじゆう|せん}を}引いてみる.
+\strikeThrough{\ruby{取|消|線}{とりけしの|いちじゆう|せん}}だとどうかな
+
+\ltjsetparameter{prebreakpenalty={`な,2893}}% デバッグ用.あっても正常動作を確認.
+\highLight{周囲が}\ruby{aaaaaaaaaaa}{全く}\highLight{ない}
+ああああああああああああああああああああああああああ
+周囲が\highLight{\ruby{あ|い|う|え}{おそらく|きっと|たぶん|maybe}}ないと思う
+\end{LTXexample}
+
 \newpage
 \section{『日本語組版処理の要件』20120403の例}
 
@@ -1053,7 +1130,6 @@
 \obeylines
 3.62 の\ruby{葯}{やく}に
 3.63 版面の\ruby{地}{ち}に\quad 版面の\ruby[kata]{地}{ち}に
-% 横組肩つきはしないが,現状では縦組未サポートだし,仕方ないね
 3.65 の\ruby{砦}{とりで}に
 {\ltjsetruby{kata}%
 3.66上 の\ruby{旬}{しゆん}に\quad 後\ruby{旬}{しゆん}に
@@ -1094,29 +1170,32 @@
      の\ruby{成|就}{じよう|じゆ}を\quad の\ruby{紋|章}{もん|しよう}を\quad%
      の\ruby{象|徴}{しよう|ちよう}を}
 % モノルビ配置.望ましくない
-3.76× の\ruby{流}{りゆう}\ruby{儀}{ぎ}を\quad の\ruby{無}{む}\ruby{常}{じよう}を\quad%
-
-3.77  {\ltjsetruby{stretchbol=121, stretcheol=121}% 行頭・行末揃えず
-     \hbox{\vrule\vbox{\hsize=10\zw\noindent\kern.75\zw
-       あああああああの\ruby{流|儀}{りゆう|ぎ}がある.}\vrule}\quad%
+3.76× の\ruby{流}{りゆう}\ruby{儀}{ぎ}を\quad の\ruby{無}{む}\ruby{常}{じよう}を
+3.77 {\ltjsetruby{stretchbol=121, stretcheol=121}% 行頭・行末揃えず
+     \hbox{\vrule\vbox{\hsize=5.25\zw ……等を\ruby{流|儀}{りゆう|ぎ}が}\vrule}\quad%
      \hbox{\vrule\vbox{\hsize=5\zw ……等の\ruby{無|常}{む|じよう}を}\vrule}}
 \end{LTXexample} 
 
 \paragraph{3.3.8節 ルビはみ出し}\ 
 \begin{LTXexample}[pos=t]
-\obeylines
+\obeylines\RULER{3.78}{4}
 3.78 \ruby{人}{ひと}は\ruby{死}{し}して\ruby{名}{な}を\ruby{残}{のこ}す
 3.79 漢字の部首には\ruby{偏}{へん}・\ruby{冠}{かんむり}・\ruby{脚}{きやく}・%
      \ruby{旁}{つくり}がある
+3.79 {\ltjsetparameter{rubypreintrusion={`\,,1}}%
+漢字の部首には\ruby{偏}{へん},\ruby{冠}{かんむり},\ruby{脚}{きやく},%
+\ruby{旁}{つくり}がある}
+% 上が『要件』にある例.標準(下)では句読点の直前にはルビがかからない.
 3.79 漢字の部首には\ruby{偏}{へん},\ruby{冠}{かんむり},\ruby{脚}{きやく},%
-     \ruby{旁}{つくり}がある
+\ruby{旁}{つくり}がある
 \end{LTXexample}
 \begin{LTXexample}[pos=t]
-\obeylines
+\obeylines\RULER{3.79}{9}
 3.79 この\ruby{\噂}{うわさ}の好きな人は\ruby{懐}{ふところ}ぐあいもよく、\ruby{檜}{ひのき}を
 3.80 漢字の部首には「\ruby{偏}{へん}」「\ruby{冠}{かんむり}」「\ruby{脚}{きやく}」%
 「\ruby{旁}{つくり}」がある
-3.80 この\ruby{\噂}{うわさ}好きな人は\ruby{懐}{ふところ}具合もよく、\ruby{檜}{ひのき}材を
+3.80 {\ltjsetparameter{rubypreintrusion={`\,,1}}%
+この\ruby{\噂}{うわさ}好きな人は\ruby{懐}{ふところ}具合もよく、\ruby{檜}{ひのき}材を}
 3.81× に\ruby{暁}{あかつき}の\kern-1\zw の\ruby{趣}{おもむき}を(良くない例)
 3.82 に\ruby{暁}{あかつき}の\ruby{趣}{おもむき}を
 

Modified: trunk/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx	2024-09-09 20:21:27 UTC (rev 72242)
@@ -44,7 +44,7 @@
 %<*driver>
 \ProvidesFile{ltjsclasses.dtx}
 %</driver>
-  [2022/09/12 ltjsclasses ]
+  [2023/07/26 ltjsclasses ]
 %<*driver>
 \IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{}
 \documentclass[disablejfam]{ltjsarticle}
@@ -5139,6 +5139,13 @@
 %
 % [2018-03-11] |\next|などいくつかの内部命令を |\jsc at ...| 付きの
 % ユニークな名前にしました。
+%
+% [2022-09-13] \LaTeXe~2021-11-15 (ltfloat.dtx 2021/10/14 v1.2g)で
+% |\@currentcounter|が追加されましたので,追随します。
+% なお,\LaTeXe~2021-06-01 (ltfloat.dtx 2021/02/10 v1.2e)で
+% parhook対応として\cs{par}が追加されていますが,
+% 実は同時に\cs{color at endgroup}も\cs{endgraf}するように変更
+% されていますので,不要だと思います。というわけで追加しません。
 %    \begin{macrocode}
 \long\def\@footnotetext{%
   \insert\footins\bgroup

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty	2024-09-09 20:21:27 UTC (rev 72242)
@@ -4,7 +4,7 @@
 
 % LaTeX only!
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{luatexja-ruby}[2023-10-08 v0.62]
+\ProvidesPackage{luatexja-ruby}[2024-09-09 v0.7]
 \RequirePackage{luatexja}
 
 %%------------------
@@ -18,9 +18,9 @@
 %% 引数:ルビ全角を単位とした実数
 %% この文字への pre-, post-intrusion の許容量
 \define at key[ltj]{japaram}{rubypreintrusion}{%
-  \ltj@@set at stack@real{RIPRE}{-0x7FFFFFFF}{0x7FFFFFFF}#1 }
+  \ltj@@set at stack@real{RIPRE}{-0x7FFFFFFF}{0x7FFFFFFF}#1\relax}
 \define at key[ltj]{japaram}{rubypostintrusion}{%
-  \ltj@@set at stack@real{RIPOST}{-0x7FFFFFFF}{0x7FFFFFFF}#1 }
+  \ltj@@set at stack@real{RIPOST}{-0x7FFFFFFF}{0x7FFFFFFF}#1\relax}
 \def\ltj@@set at stack@real#1#2#3{%
   \directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#1,
     #2, #3, token.scan_word)}}
@@ -29,7 +29,6 @@
 \def\ltj@@rkeydef#1{
   \define at key[ltj]{ruby}{#1}{\expandafter\def\csname ltj@@rubyip@#1\endcsname{##1}}
 }
-%% attr_ruby_mode
 %% bit 0: intrusion を有効にするか(1: 有効)
 %% bit 1: 前後の intrusion 許容量を小さい方に揃える (1: yes)
 %% bit 2--4: intrusion をどう使って親文字を配置するか
@@ -42,10 +41,10 @@
 %% ※ 01--100 で,intrusion で賄えきれなかった場合はいつものように伸長する.
 %% bit 5: 熟語ルビの際の処理方法(0: 常にグループ,1: 可能な限りブロックごとに)
 %%        ↑bit 5 は今は無効
+%% bit 6: 突出部分について lua-ul 有効範囲から除外する処理するか
 \ltj@@rkeydef{mode}
 %% intrusion 量強制固定(bit 0, bit 1 より優先,負数で「自動」)
 %% attr は sp 単位だが,ユーザーはルビ全角単位で指定する
-%% attr_ruby_maxprep, attr_ruby_maxpostp
 \ltj@@rkeydef{pre}
 \ltj@@rkeydef{post}
 %% 親文字伸長の際の比,{0}{1}{1} などと0--7 の数 3 つで指定
@@ -54,14 +53,11 @@
 \ltj@@rkeydef{stretcheol}  % 行末形
 \ltj@@rkeydef{stretch}     % 行中形
 %% ルビが伸長するときの比 {1}{2}{1} などと0--7 の数 3 つで指定
-%% attr_ruby_mode 上位部分
 \ltj@@rkeydef{stretchruby}
 %% ルビ<親のとき,ルビと親文字の端の最大値 
-%% attr_ruby_maxmargin
 %% attr は sp 単位だが,ユーザーは親文字全角単位で指定
 \ltj@@rkeydef{maxmargin}
 %% ルビと親文字の垂直方向の空き
-%% attr_ruby_intergap
 %% attr は sp 単位だが,ユーザーは親文字全角単位で指定
 \ltj@@rkeydef{intergap}
 
@@ -92,6 +88,7 @@
 \define at boolkey[ltj]{ruby}{intrude_xkanjiskip}[true]{}
 \define at boolkey[ltj]{ruby}{intrude_kanjiskip}[true]{}
 
+\define at boolkey[ltj]{ruby}{always_highlight_protrusion}[true]{}
 
 %%%%%%%% setkeys の別名
 \protected\def\ltjsetruby{\setkeys[ltj]{ruby}}
@@ -141,7 +138,8 @@
           [luatexja.icflag_table.XKANJI_SKIP]=true,
           [luatexja.icflag_table.XKANJI_SKIP_JFM]=true,
        \fi
-       \string}
+       \string},
+       quirk_protrusion =  \ifltj at ruby@always_highlight_protrusion false \else true \fi
     \string}
 }
 \egroup
@@ -264,7 +262,7 @@
   kenten=\textbullet, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5,
   yrubydepth=0.12, trubydepth=0.5,
   intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip,
-  epsilon=0.0001,
+  epsilon=0.0001, always_highlight_protrusion=false,
 }
 
 \endinput

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty	2024-09-09 20:21:27 UTC (rev 72242)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjext}[2024-05-16 v1.2k-ltj-15 Macros for vertical writing]
+\ProvidesPackage{lltjext}[2024-07-23 v1.2k-ltj-16 Macros for vertical writing]
 \RequirePackage{luatexja}
 \newcount\ltj at ext@dir
 \let\ltj at lltjext@orig at tabular=\tabular
@@ -27,7 +27,7 @@
 \def\p at stabular<#1>#2{%
    \setlength\dimen@{#2}%
    \edef\@halignto{to\the\dimen@}\p at tabular<#1>}
-\def\p at tabular<#1>{\leavevmode \hbox \bgroup 
+\def\p at tabular<#1>{\leavevmode\null \hbox \bgroup % fixed for unwanted xkanjiskip
    \ltj at ext@dir=\ltjgetparameter{direction}\relax
    $\let\@acol\@tabacol
    \let\@classz\@tabclassz
@@ -78,7 +78,7 @@
     \ifhmode \@preamerr\z@ \@@par\fi
 	\@preamble}
 \def\endarray{\crcr\egroup\egroup\@end at alignbox}
-\def\endtabular{\endarray$\egroup}
+\def\endtabular{\endarray$\egroup\null}
 \expandafter \let \csname endtabular*\endcsname = \endtabular
 % ↓中身\周囲→ yoko  tate  utod  dtou
 % yoko          A*    B*    B     B
@@ -669,6 +669,7 @@
 
 %% Compatibility with array package
 
+\ExplSyntaxOn
 \def\ltj at lltjext@patch at array{%
   \patchcmd{\@tabular}{\hbox\bgroup}{%
 	\hbox\bgroup\ltj at ext@dir=\ltjgetparameter{direction}\relax}{}{}
@@ -676,10 +677,6 @@
 	{\ltj at ext@dir=\ltjgetparameter{direction}\relax}{}{}
   \expandafter\let\csname tabular*\endcsname=\ltj at lltjext@orig at tabularS
   \patchcmd{\p at stabular}{\p at tabular}{\@tabular}{}{}
-  \@ifpackagelater{array}{2018/09/13}
-    {\expandafter\@firstoftwo}
-    {\expandafter\@secondoftwo}
-  {% = for 2018/09/13 v2.4i or newer
   \def\@startpbox##1{\bgroup
     \color at begingroup
     \box at dir\adjustbaseline%%% これを追加
@@ -688,16 +685,8 @@
          \vrule \@height \ltjgetht\@arstrutbox \@width \z@
          \everypar{}}%
       }%
-  }{ % = for 2018/04/30 v2.4h or older
-  \def\@startpbox##1{\bgroup
-    \box at dir\adjustbaseline%%% これを追加
-    \setlength\hsize{##1}\@arrayparboxrestore
-      \everypar{%
-         \vrule \@height \ltjgetht\@arstrutbox \@width \z@
-         \everypar{}}%
-      }%
-  }%
   \def\@tabarray{\@ifnextchar<\p at tabarray{\p at tabarray<Z>}}
+\ifcsname tbl_save_outer_table_cols:\endcsname %%%%%% >=2024-06-01
   \def\p at array<##1>[##2]##3{%
     \ifnum\ltj at ext@dir=0 \ltj at ext@dir=\ltjgetparameter{direction}\relax\fi
     \let\box at dir\relax
@@ -730,20 +719,98 @@
                \@depth \arraystretch \ltjgetdp \@tempcnta
                \@width \z@}%
     \fork at array@option<##1>[##2]%
+    \tbl_save_outer_table_cols:
     \begingroup
     \@mkpream{##3}%
-    \xdef\@preamble{\noexpand\ialign \noexpand \@halignto
-                    \bgroup \tabskip \z at skip \@arstrut \@preamble
-                            \tabskip \z@ \cr}%
+    \tbl_count_table_cols:
+    \xdef\@preamble{
+      \noexpand\ar at ialign
+      \@halignto
+          \bgroup \@arstrut
+        \UseTaggingSocket{tbl/row/begin}
+        \tbl_init_cell_data_for_row:
+        \@preamble
+        \tabskip \z@ \cr}%
     \endgroup
     \@arrayleft
-    \@begin at alignbox\bgroup\box at dir\adjustbaseline
-      \let\par\@empty
-      \let\@sharp####\let\protect\relax
-      \let\\\@arraycr\let\tabularnewline\\\let\par\@empty
-     \lineskip\z at skip\baselineskip\z at skip\@preamble}
-  \def\endarray{\crcr\egroup\egroup\@end at alignbox\@arrayright}
+    \@begin at alignbox
+    \bgroup
+    \box at dir\adjustbaseline
+    \let\@sharp####\let\protect\relax
+    \lineskip \z@
+    \baselineskip \z@
+    \mathsurround \z@
+    \let\\\@arraycr \let\tabularnewline\\\let\par\@empty
+    \UseTaggingSocket{tbl/init}
+    \@preamble
+  }
+  \def\endtabular{\endarray$\egroup
+    \UseTaggingSocket {tbl/hmode/end}\null}
+  \def\endarray{
+    \tbl_crcr:n{endarray} \egroup
+    \UseTaggingSocket{tbl/finalize}
+    \tbl_restore_outer_cell_data:
+    \egroup\@end at alignbox
+    \@arrayright \gdef\@preamble{}%
+  }
+\else %%%%%% <2024-06-01
+  \def\p at array<##1>[##2]##3{%
+    \ifnum\ltj at ext@dir=0 \ltj at ext@dir=\ltjgetparameter{direction}\relax\fi
+    \let\box at dir\relax
+    \if ##1z\relax
+      \ifnum\ltj at ext@dir=3\relax
+        \let\box at dir\utod\@tempcnta=\zstrutbox
+      \fi
+    \else
+      \if ##1y\relax
+        \let\box at dir\yoko\@tempcnta=\ystrutbox
+      \else\if ##1t\relax
+        \let\box at dir\tate\@tempcnta=\tstrutbox
+      \else\if ##1d\relax
+         \let\box at dir\dtou\@tempcnta=\dstrutbox
+      \else\if ##1u\relax
+         \let\box at dir\utod\@tempcnta=\zstrutbox
+      \fi\fi\fi\fi
+    \fi
+    \ifx\box at dir\relax
+      \ifcase\ltj at ext@dir
+         \or   \let\box at dir\dtou\@tempcnta=\dstrutbox% dtou
+         \or\or\let\box at dir\tate\@tempcnta=\tstrutbox% tate
+         \or   \let\box at dir\yoko\@tempcnta=\ystrutbox% yoko
+         \else \let\box at dir\utod\@tempcnta=\zstrutbox% utod
+      \fi
+    \fi
+    \setbox \@arstrutbox \hbox{\box at dir\vrule
+               \@height \arraystretch
+                 \dimexpr \ltjgetht\@tempcnta+\extrarowheight\relax
+               \@depth \arraystretch \ltjgetdp \@tempcnta
+               \@width \z@}%
+    \fork at array@option<##1>[##2]%
+    \begingroup
+    \@mkpream{##3}%
+    \xdef\@preamble{\noexpand\ialign \@halignto
+      \bgroup \@arstrut\@preamble \tabskip \z@ \cr}%
+    \endgroup
+    \@arrayleft
+    \@begin at alignbox
+    \bgroup
+    \box at dir\adjustbaseline
+    \let\@sharp####\let\protect\relax
+    \lineskip \z@
+    \baselineskip \z@
+    \m at th
+    \let\\\@arraycr \let\tabularnewline\\\let\par\@empty
+    \@preamble
+  }
+  \def\endtabular{\endarray\m at th$\egroup\null}
+  \def\endarray{
+    \crcr\egroup\egroup\@end at alignbox
+    \@arrayright \gdef\@preamble{}%
+  }
+\fi
+  \expandafter \let \csname endtabular*\endcsname = \endtabular
 }
+\ExplSyntaxOff
 \@ifpackageloaded{array}{%
   \let\tabular=\ltj at lltjext@orig at tabular
   \let\array=\ltj at lltjext@orig at array
@@ -754,9 +821,4 @@
   \ltj at ExecuteAfterPackage{array}{\ltj at lltjext@patch at array}
 }
 
-%%%%%%%%%%%%%%%% LuaTeX-ja original
-
-%%\define at key[ltj]{japaram}{autouprightnum}{%      %COUNT
-%%  \ltj@@set at stack{AURN}{0}{10000}\z@#1 }
-
 \endinput

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ivd_aj1.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ivd_aj1.lua	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ivd_aj1.lua	2024-09-09 20:21:27 UTC (rev 72242)
@@ -6,6 +6,9 @@
 -- #
 -- # History:
 -- #
+-- # 2022-09-13 Registration of additional sequences in the Adobe-Japan1
+-- #            collection.
+-- #
 -- # 2020-11-06 Registration of additional sequences in the MSARG
 -- #            collection.
 -- #
@@ -36,7 +39,7 @@
 -- # For more details on the IVD, see UTS #37:
 -- # https://www.unicode.org/reports/tr37/
 -- #
--- # Copyright 2006-2020 Unicode, Inc.
+-- # Copyright 2006-2022 Unicode, Inc.
 -- # For terms of use, see: https://www.unicode.org/copyright.html#8
 -- #
 -- # EOF
@@ -1952,7 +1955,7 @@
  0x209dbf,0x209db5,0x209db9,0x209dbd,0x209dc9,0x209dda,0x209de0,0x209de3,0x204d07,0x209e0a,
  0x209e02,0x209e0d,0x209e1c,0x209e7b,0x222218,0x209e80,0x209e85,0x209e9b,0x22a38c,0x209ebd,
  0x22a437,0x209edf,0x209eff,0x209f02,0x204d77,0x209f03,0x209f3a,0x209f3d,0x209f46,0x209f53,
- 0x209f55,0x209f58,0x22a5f1,0x209f5d,0x22a602,0x209f69,0x209f6d,0x209f70,0x22a6b2,0x20793a,
+ 0x209f55,0x209f58,0x22a5f1,0x209f5d,0x22a602,0x209f69,0x209f6d,0x209f70,0x22a6b2,0x231350,
  0x203614,0x2038ad,0x203dcc,0x203fdc,0x2045be,0x204610,0x204b7e,0x204c38,0x204ce1,0x204e0c,
  0x204e23,0x204e24,0x204e79,0x204ef3,0x204f0c,0x204f19,0x204f2b,0x204f2e,0x204f31,0x204f84,
  0x204f9e,0x204fb7,0x205004,0x20500c,0x20504c,0x20505f,0x205062,0x205077,0x20508e,0x20509e,

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua	2024-09-09 20:21:27 UTC (rev 72242)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfmglue',
-  date = '2022-08-29',
+  date = '2024-09-01',
   description = 'Insertion process of JFM glues, [x]kanjiskip and others',
 })
 luatexja.jfmglue = luatexja.jfmglue or {}
@@ -741,7 +741,7 @@
    local a = table_current_stack[luatexja.stack_table_index.JWP]
    if #widow_Bp == 0 then
       if a~=0 then
-         local p = node_new(id_penalty, widow_Np.nuc)
+         local p = node_new(id_penalty, nil, widow_Np.nuc)
          if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end
          setpenalty(p, a); head = insert_before(head, widow_Np.first, p)
          widow_Bp[1]=p; set_attr(p, attr_icflag, KINSOKU)
@@ -1059,7 +1059,7 @@
       real_insert(g)
    end
    if mode and Np.kcat%2~=1 then
-      widow_Np.first, widow_Bp, Bp = Np.first, Bp, widow_Bp
+      widow_Np.nuc, widow_Np.first, widow_Bp, Bp = Np.nuc, Np.first, Bp, widow_Bp
    end
 end
 

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua	2024-09-09 20:21:27 UTC (rev 72242)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfont',
-  date = '2023-04-06',
+  date = '2024-07-25',
   description = 'Loader for Japanese fonts',
 })
 
@@ -434,10 +434,11 @@
    end
    -- extract jfm_name, jfm_spec and jfm_var
    -- normalize position of 'jfm=' and 'jfmvar=' keys
+   local match, sub = string.match, string.sub
    local function extract_jfm_spec(name)
-      name = (name:match '^{(.*)}$') or (name:match '^"(.*)"$') or name
+      name = (match(name,'^{(.*)}$')) or (match(name,'^"(.*)"$')) or name
       jfm_spec, jfm_var = '', ''
-      local tmp, index = name:sub(1, 5), 1
+      local tmp, index = sub(name,1, 5), 1
       if tmp == 'file:' or tmp == 'name:' or tmp == 'psft:' then
          index = 6
       end
@@ -444,7 +445,7 @@
       name = lpegmatch(jf_remainder, name)
       if jfm_name~='' then
          if luatexja.jfont.jfm_feature then
-            local l, t2 = name:sub(-1), {}
+            local l, t2 = sub(name,-1), {}
             for i,v in pairs(luatexja.jfont.jfm_feature) do
                -- print(i,type(v),v)
                t2[#t2+1] = (v==true) and i
@@ -454,7 +455,7 @@
          else
             jfm_spec = jfm_name
          end
-         l = name:sub(-1)
+         l = sub(name,-1)
          name = name .. ((l==':' or l==';') and '' or ';') .. 'jfm=' .. jfm_spec
          if jfm_var~='' then
             name = name .. ';jfmvar=' .. jfm_var
@@ -806,9 +807,9 @@
 do
   local ceil = math.ceil
   -- output of function_uax50.lua
-  -- UAX#50 for Unicode  14.0.0
+  -- UAX#50 for Unicode  15.1.0
   -- t[0] = true
-  local t={ 0, 167, 168, 169, 170, 174, 175, 177, 178, 188, 191, 215, 216, 247, 248, 746, 748, 888, 890, 896, 900, 907, 908, 909, 910, 930, 931, 1328, 1329, 1367, 1369, 1419, 1421, 1424, 1425, 1480, 1488, 1515, 1519, 1525, 1536, 1806, 1807, 1867, 1869, 1970, 1984, 2043, 2045, 2094, 2096, 2111, 2112, 2140, 2142, 2143, 2144, 2155, 2160, 2191, 2192, 2194, 2200, 2436, 2437, 2445, 2447, 2449, 2451, 2473, 2474, 2481, 2482, 2483, 2486, 2490, 2492, 2501, 2503, 2505, 2507, 2511, 2519, 2520, 2524, 2526, 2527, 2532, 2534, 2559, 2561, 2564, 2565, 2571, 2575, 2577, 2579, 2601, 2602, 2609, 2610, 2612, 2613, 2615, 2616, 2618, 2620, 2621, 2622, 2627, 2631, 2633, 2635, 2638, 2641, 2642, 2649, 2653, 2654, 2655, 2662, 2679, 2689, 2692, 2693, 2702, 2703, 2706, 2707, 2729, 2730, 2737, 2738, 2740, 2741, 2746, 2748, 2758, 2759, 2762, 2763, 2766, 2768, 2769, 2784, 2788, 2790, 2802, 2809, 2816, 2817, 2820, 2821, 2829, 2831, 2833, 2835, 2857, 2858, 2865, 2866, 2868, 2869, 2874, 2876, 2885, 2887, 2889, 2891, 2894, 2901, 2904, 2908, 2910, 2911, 2916, 2918, 2936, 2946, 2948, 2949, 2955, 2958, 2961, 2962, 2966, 2969, 2971, 2972, 2973, 2974, 2976, 2979, 2981, 2984, 2987, 2990, 3002, 3006, 3011, 3014, 3017, 3018, 3022, 3024, 3025, 3031, 3032, 3046, 3067, 3072, 3085, 3086, 3089, 3090, 3113, 3114, 3130, 3132, 3141, 3142, 3145, 3146, 3150, 3157, 3159, 3160, 3163, 3165, 3166, 3168, 3172, 3174, 3184, 3191, 3213, 3214, 3217, 3218, 3241, 3242, 3252, 3253, 3258, 3260, 3269, 3270, 3273, 3274, 3278, 3285, 3287, 3293, 3295, 3296, 3300, 3302, 3312, 3313, 3315, 3328, 3341, 3342, 3345, 3346, 3397, 3398, 3401, 3402, 3408, 3412, 3428, 3430, 3456, 3457, 3460, 3461, 3479, 3482, 3506, 3507, 3516, 3517, 3518, 3520, 3527, 3530, 3531, 3535, 3541, 3542, 3543, 3544, 3552, 3558, 3568, 3570, 3573, 3585, 3643, 3647, 3676, 3713, 3715, 3716, 3717, 3718, 3723, 3724, 3748, 3749, 3750, 3751, 3774, 3776, 3781, 3782, 3783, 3784, 3790, 3792, 3802, 3804, 3808, 3840, 3912, 3913, 3949, 3953, 3992, 3993, 4029, 4030, 4045, 4046, 4059, 4096, 4294, 4295, 4296, 4301, 4302, 430!
 4, 4352, 4608, 4681, 4682, 4686, 4688, 4695, 4696, 4697, 4698, 4702, 4704, 4745, 4746, 4750, 4752, 4785, 4786, 4790, 4792, 4799, 4800, 4801, 4802, 4806, 4808, 4823, 4824, 4881, 4882, 4886, 4888, 4955, 4957, 4989, 4992, 5018, 5024, 5110, 5112, 5118, 5120, 5121, 5760, 5789, 5792, 5881, 5888, 5910, 5919, 5943, 5952, 5972, 5984, 5997, 5998, 6001, 6002, 6004, 6016, 6110, 6112, 6122, 6128, 6138, 6144, 6170, 6176, 6265, 6272, 6315, 6400, 6431, 6432, 6444, 6448, 6460, 6464, 6465, 6468, 6510, 6512, 6517, 6528, 6572, 6576, 6602, 6608, 6619, 6622, 6684, 6686, 6751, 6752, 6781, 6783, 6794, 6800, 6810, 6816, 6830, 6832, 6863, 6912, 6989, 6992, 7039, 7040, 7156, 7164, 7224, 7227, 7242, 7245, 7305, 7312, 7355, 7357, 7368, 7376, 7419, 7424, 7958, 7960, 7966, 7968, 8006, 8008, 8014, 8016, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8062, 8064, 8117, 8118, 8133, 8134, 8148, 8150, 8156, 8157, 8176, 8178, 8181, 8182, 8191, 8192, 8214, 8215, 8224, 8226, 8240, 8242, 8251, 8253, 8258, 8259, 8263, 8266, 8273, 8274, 8293, 8294, 8306, 8308, 8335, 8336, 8349, 8352, 8385, 8400, 8413, 8417, 8418, 8421, 8433, 8450, 8451, 8458, 8463, 8464, 8467, 8469, 8470, 8472, 8478, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8494, 8495, 8501, 8512, 8517, 8523, 8524, 8526, 8527, 8586, 8588, 8592, 8734, 8735, 8756, 8758, 8960, 8968, 8972, 8992, 8996, 9001, 9003, 9004, 9085, 9115, 9150, 9166, 9167, 9168, 9169, 9180, 9186, 9251, 9252, 9472, 9632, 9754, 9760, 10088, 10102, 10132, 11026, 11056, 11088, 11098, 11124, 11126, 11158, 11160, 11192, 11218, 11219, 11244, 11248, 11264, 11508, 11513, 11558, 11559, 11560, 11565, 11566, 11568, 11624, 11631, 11633, 11647, 11671, 11680, 11687, 11688, 11695, 11696, 11703, 11704, 11711, 11712, 11719, 11720, 11727, 11728, 11735, 11736, 11743, 11744, 11856, 11858, 11870, 12296, 12306, 12308, 12320, 12336, 12337, 12448, 12449, 12540, 12541, 42192, 42540, 42560, 42744, 42752, 42955, 42960, 42962, 42963, 42964, 42965, 42970, 42994, 43053, 43056, 43066, 43072, 43128, 43136, 43206, 43214, 43226, 43232, 43348, 43359, 43360, 43392, 4!
 3470, 43471, 43482, 43486, 43519, 43520, 43575, 43584, 43598, 43600, 43610, 43612, 43715, 43739, 43767, 43777, 43783, 43785, 43791, 43793, 43799, 43808, 43815, 43816, 43823, 43824, 43884, 43888, 44014, 44016, 44026, 55296, 57344, 64256, 64263, 64275, 64280, 64285, 64311, 64312, 64317, 64318, 64319, 64320, 64322, 64323, 64325, 64326, 64451, 64467, 64912, 64914, 64968, 64975, 64976, 65008, 65040, 65056, 65072, 65097, 65104, 65112, 65119, 65123, 65127, 65136, 65141, 65142, 65277, 65279, 65280, 65288, 65290, 65293, 65294, 65306, 65311, 65339, 65340, 65341, 65342, 65343, 65344, 65371, 65471, 65474, 65480, 65482, 65488, 65490, 65496, 65498, 65501, 65507, 65508, 65512, 65519, 65529, 65532, 65536, 65548, 65549, 65575, 65576, 65595, 65596, 65598, 65599, 65614, 65616, 65630, 65664, 65787, 65792, 65795, 65799, 65844, 65847, 65935, 65936, 65949, 65952, 65953, 66000, 66046, 66176, 66205, 66208, 66257, 66272, 66300, 66304, 66340, 66349, 66379, 66384, 66427, 66432, 66462, 66463, 66500, 66504, 66518, 66560, 66718, 66720, 66730, 66736, 66772, 66776, 66812, 66816, 66856, 66864, 66916, 66927, 66939, 66940, 66955, 66956, 66963, 66964, 66966, 66967, 66978, 66979, 66994, 66995, 67002, 67003, 67005, 67072, 67383, 67392, 67414, 67424, 67432, 67456, 67462, 67463, 67505, 67506, 67515, 67584, 67590, 67592, 67593, 67594, 67638, 67639, 67641, 67644, 67645, 67647, 67670, 67671, 67743, 67751, 67760, 67808, 67827, 67828, 67830, 67835, 67868, 67871, 67898, 67903, 67904, 68000, 68024, 68028, 68048, 68050, 68100, 68101, 68103, 68108, 68116, 68117, 68120, 68121, 68150, 68152, 68155, 68159, 68169, 68176, 68185, 68192, 68256, 68288, 68327, 68331, 68343, 68352, 68406, 68409, 68438, 68440, 68467, 68472, 68498, 68505, 68509, 68521, 68528, 68608, 68681, 68736, 68787, 68800, 68851, 68858, 68904, 68912, 68922, 69216, 69247, 69248, 69290, 69291, 69294, 69296, 69298, 69376, 69416, 69424, 69466, 69488, 69514, 69552, 69580, 69600, 69623, 69632, 69710, 69714, 69750, 69759, 69827, 69837, 69838, 69840, 69865, 69872, 69882, 69888, 69941, 69942, 69960, 69968, 7000!
 7, 70016, 70112, 70113, 70133, 70144, 70162, 70163, 70207, 70272, 70279, 70280, 70281, 70282, 70286, 70287, 70302, 70303, 70314, 70320, 70379, 70384, 70394, 70400, 70404, 70405, 70413, 70415, 70417, 70419, 70441, 70442, 70449, 70450, 70452, 70453, 70458, 70459, 70469, 70471, 70473, 70475, 70478, 70480, 70481, 70487, 70488, 70493, 70500, 70502, 70509, 70512, 70517, 70656, 70748, 70749, 70754, 70784, 70856, 70864, 70874, 71168, 71237, 71248, 71258, 71264, 71277, 71296, 71354, 71360, 71370, 71424, 71451, 71453, 71468, 71472, 71495, 71680, 71740, 71840, 71923, 71935, 71943, 71945, 71946, 71948, 71956, 71957, 71959, 71960, 71990, 71991, 71993, 71995, 72007, 72016, 72026, 72096, 72104, 72106, 72152, 72154, 72165, 72384, 72441, 72704, 72713, 72714, 72759, 72760, 72774, 72784, 72813, 72816, 72848, 72850, 72872, 72873, 72887, 72960, 72967, 72968, 72970, 72971, 73015, 73018, 73019, 73020, 73022, 73023, 73032, 73040, 73050, 73056, 73062, 73063, 73065, 73066, 73103, 73104, 73106, 73107, 73113, 73120, 73130, 73440, 73465, 73648, 73649, 73664, 73714, 73727, 74650, 74752, 74863, 74864, 74869, 74880, 75076, 77712, 77811, 92160, 92729, 92736, 92767, 92768, 92778, 92782, 92863, 92864, 92874, 92880, 92910, 92912, 92918, 92928, 92998, 93008, 93018, 93019, 93026, 93027, 93048, 93053, 93072, 93760, 93851, 93952, 94027, 94031, 94088, 94095, 94112, 113664, 113771, 113776, 113789, 113792, 113801, 113808, 113818, 113820, 113828, 119296, 119366, 119808, 119893, 119894, 119965, 119966, 119968, 119970, 119971, 119973, 119975, 119977, 119981, 119982, 119994, 119995, 119996, 119997, 120004, 120005, 120070, 120071, 120075, 120077, 120085, 120086, 120093, 120094, 120122, 120123, 120127, 120128, 120133, 120134, 120135, 120138, 120145, 120146, 120486, 120488, 120780, 120782, 120832, 122624, 122655, 122880, 122887, 122888, 122905, 122907, 122914, 122915, 122917, 122918, 122923, 123136, 123181, 123184, 123198, 123200, 123210, 123214, 123216, 123536, 123567, 123584, 123642, 123647, 123648, 124896, 124903, 124904, 124908, 124909, 124911, 124912, 1249!
 27, 124928, 125125, 125127, 125143, 125184, 125260, 125264, 125274, 125278, 125280, 126065, 126133, 126209, 126270, 126464, 126468, 126469, 126496, 126497, 126499, 126500, 126501, 126503, 126504, 126505, 126515, 126516, 126520, 126521, 126522, 126523, 126524, 126530, 126531, 126535, 126536, 126537, 126538, 126539, 126540, 126541, 126544, 126545, 126547, 126548, 126549, 126551, 126552, 126553, 126554, 126555, 126556, 126557, 126558, 126559, 126560, 126561, 126563, 126564, 126565, 126567, 126571, 126572, 126579, 126580, 126584, 126585, 126589, 126590, 126591, 126592, 126602, 126603, 126620, 126625, 126628, 126629, 126634, 126635, 126652, 126704, 126706, 129024, 129036, 129040, 129096, 129104, 129114, 129120, 129160, 129168, 129198, 129200, 129202, 129792, 129939, 129940, 129995, 130032, 130042, 917505, 917506, 917536, 917632, 917760, 918000 }
+  local t={ 0, 167, 168, 169, 170, 174, 175, 177, 178, 188, 191, 215, 216, 247, 248, 746, 748, 888, 890, 896, 900, 907, 908, 909, 910, 930, 931, 1328, 1329, 1367, 1369, 1419, 1421, 1424, 1425, 1480, 1488, 1515, 1519, 1525, 1536, 1806, 1807, 1867, 1869, 1970, 1984, 2043, 2045, 2094, 2096, 2111, 2112, 2140, 2142, 2143, 2144, 2155, 2160, 2191, 2192, 2194, 2200, 2436, 2437, 2445, 2447, 2449, 2451, 2473, 2474, 2481, 2482, 2483, 2486, 2490, 2492, 2501, 2503, 2505, 2507, 2511, 2519, 2520, 2524, 2526, 2527, 2532, 2534, 2559, 2561, 2564, 2565, 2571, 2575, 2577, 2579, 2601, 2602, 2609, 2610, 2612, 2613, 2615, 2616, 2618, 2620, 2621, 2622, 2627, 2631, 2633, 2635, 2638, 2641, 2642, 2649, 2653, 2654, 2655, 2662, 2679, 2689, 2692, 2693, 2702, 2703, 2706, 2707, 2729, 2730, 2737, 2738, 2740, 2741, 2746, 2748, 2758, 2759, 2762, 2763, 2766, 2768, 2769, 2784, 2788, 2790, 2802, 2809, 2816, 2817, 2820, 2821, 2829, 2831, 2833, 2835, 2857, 2858, 2865, 2866, 2868, 2869, 2874, 2876, 2885, 2887, 2889, 2891, 2894, 2901, 2904, 2908, 2910, 2911, 2916, 2918, 2936, 2946, 2948, 2949, 2955, 2958, 2961, 2962, 2966, 2969, 2971, 2972, 2973, 2974, 2976, 2979, 2981, 2984, 2987, 2990, 3002, 3006, 3011, 3014, 3017, 3018, 3022, 3024, 3025, 3031, 3032, 3046, 3067, 3072, 3085, 3086, 3089, 3090, 3113, 3114, 3130, 3132, 3141, 3142, 3145, 3146, 3150, 3157, 3159, 3160, 3163, 3165, 3166, 3168, 3172, 3174, 3184, 3191, 3213, 3214, 3217, 3218, 3241, 3242, 3252, 3253, 3258, 3260, 3269, 3270, 3273, 3274, 3278, 3285, 3287, 3293, 3295, 3296, 3300, 3302, 3312, 3313, 3316, 3328, 3341, 3342, 3345, 3346, 3397, 3398, 3401, 3402, 3408, 3412, 3428, 3430, 3456, 3457, 3460, 3461, 3479, 3482, 3506, 3507, 3516, 3517, 3518, 3520, 3527, 3530, 3531, 3535, 3541, 3542, 3543, 3544, 3552, 3558, 3568, 3570, 3573, 3585, 3643, 3647, 3676, 3713, 3715, 3716, 3717, 3718, 3723, 3724, 3748, 3749, 3750, 3751, 3774, 3776, 3781, 3782, 3783, 3784, 3791, 3792, 3802, 3804, 3808, 3840, 3912, 3913, 3949, 3953, 3992, 3993, 4029, 4030, 4045, 4046, 4059, 4096, 4294, 4295, 4296, 4301, 4302, 430!
 4, 4352, 4608, 4681, 4682, 4686, 4688, 4695, 4696, 4697, 4698, 4702, 4704, 4745, 4746, 4750, 4752, 4785, 4786, 4790, 4792, 4799, 4800, 4801, 4802, 4806, 4808, 4823, 4824, 4881, 4882, 4886, 4888, 4955, 4957, 4989, 4992, 5018, 5024, 5110, 5112, 5118, 5120, 5121, 5760, 5789, 5792, 5881, 5888, 5910, 5919, 5943, 5952, 5972, 5984, 5997, 5998, 6001, 6002, 6004, 6016, 6110, 6112, 6122, 6128, 6138, 6144, 6170, 6176, 6265, 6272, 6315, 6400, 6431, 6432, 6444, 6448, 6460, 6464, 6465, 6468, 6510, 6512, 6517, 6528, 6572, 6576, 6602, 6608, 6619, 6622, 6684, 6686, 6751, 6752, 6781, 6783, 6794, 6800, 6810, 6816, 6830, 6832, 6863, 6912, 6989, 6992, 7039, 7040, 7156, 7164, 7224, 7227, 7242, 7245, 7305, 7312, 7355, 7357, 7368, 7376, 7419, 7424, 7958, 7960, 7966, 7968, 8006, 8008, 8014, 8016, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8062, 8064, 8117, 8118, 8133, 8134, 8148, 8150, 8156, 8157, 8176, 8178, 8181, 8182, 8191, 8192, 8214, 8215, 8224, 8226, 8240, 8242, 8251, 8253, 8258, 8259, 8263, 8266, 8273, 8274, 8293, 8294, 8306, 8308, 8335, 8336, 8349, 8352, 8385, 8400, 8413, 8417, 8418, 8421, 8433, 8450, 8451, 8458, 8463, 8464, 8467, 8469, 8470, 8472, 8478, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8494, 8495, 8501, 8512, 8517, 8523, 8524, 8526, 8527, 8586, 8588, 8592, 8734, 8735, 8756, 8758, 8960, 8968, 8972, 8992, 8996, 9001, 9003, 9004, 9085, 9115, 9150, 9166, 9167, 9168, 9169, 9180, 9186, 9251, 9252, 9472, 9632, 9754, 9760, 10088, 10102, 10132, 11026, 11056, 11088, 11098, 11124, 11126, 11158, 11160, 11192, 11218, 11219, 11244, 11248, 11264, 11508, 11513, 11558, 11559, 11560, 11565, 11566, 11568, 11624, 11631, 11633, 11647, 11671, 11680, 11687, 11688, 11695, 11696, 11703, 11704, 11711, 11712, 11719, 11720, 11727, 11728, 11735, 11736, 11743, 11744, 11856, 11858, 11870, 12296, 12306, 12308, 12320, 12336, 12337, 12448, 12449, 12540, 12541, 42192, 42540, 42560, 42744, 42752, 42955, 42960, 42962, 42963, 42964, 42965, 42970, 42994, 43053, 43056, 43066, 43072, 43128, 43136, 43206, 43214, 43226, 43232, 43348, 43359, 43360, 43392, 4!
 3470, 43471, 43482, 43486, 43519, 43520, 43575, 43584, 43598, 43600, 43610, 43612, 43715, 43739, 43767, 43777, 43783, 43785, 43791, 43793, 43799, 43808, 43815, 43816, 43823, 43824, 43884, 43888, 44014, 44016, 44026, 55296, 57344, 64256, 64263, 64275, 64280, 64285, 64311, 64312, 64317, 64318, 64319, 64320, 64322, 64323, 64325, 64326, 64451, 64467, 64912, 64914, 64968, 64975, 64976, 65008, 65040, 65056, 65072, 65097, 65104, 65112, 65119, 65123, 65127, 65136, 65141, 65142, 65277, 65279, 65280, 65288, 65290, 65293, 65294, 65306, 65311, 65339, 65340, 65341, 65342, 65343, 65344, 65371, 65471, 65474, 65480, 65482, 65488, 65490, 65496, 65498, 65501, 65507, 65508, 65512, 65519, 65529, 65532, 65536, 65548, 65549, 65575, 65576, 65595, 65596, 65598, 65599, 65614, 65616, 65630, 65664, 65787, 65792, 65795, 65799, 65844, 65847, 65935, 65936, 65949, 65952, 65953, 66000, 66046, 66176, 66205, 66208, 66257, 66272, 66300, 66304, 66340, 66349, 66379, 66384, 66427, 66432, 66462, 66463, 66500, 66504, 66518, 66560, 66718, 66720, 66730, 66736, 66772, 66776, 66812, 66816, 66856, 66864, 66916, 66927, 66939, 66940, 66955, 66956, 66963, 66964, 66966, 66967, 66978, 66979, 66994, 66995, 67002, 67003, 67005, 67072, 67383, 67392, 67414, 67424, 67432, 67456, 67462, 67463, 67505, 67506, 67515, 67584, 67590, 67592, 67593, 67594, 67638, 67639, 67641, 67644, 67645, 67647, 67670, 67671, 67743, 67751, 67760, 67808, 67827, 67828, 67830, 67835, 67868, 67871, 67898, 67903, 67904, 68000, 68024, 68028, 68048, 68050, 68100, 68101, 68103, 68108, 68116, 68117, 68120, 68121, 68150, 68152, 68155, 68159, 68169, 68176, 68185, 68192, 68256, 68288, 68327, 68331, 68343, 68352, 68406, 68409, 68438, 68440, 68467, 68472, 68498, 68505, 68509, 68521, 68528, 68608, 68681, 68736, 68787, 68800, 68851, 68858, 68904, 68912, 68922, 69216, 69247, 69248, 69290, 69291, 69294, 69296, 69298, 69373, 69416, 69424, 69466, 69488, 69514, 69552, 69580, 69600, 69623, 69632, 69710, 69714, 69750, 69759, 69827, 69837, 69838, 69840, 69865, 69872, 69882, 69888, 69941, 69942, 69960, 69968, 7000!
 7, 70016, 70112, 70113, 70133, 70144, 70162, 70163, 70210, 70272, 70279, 70280, 70281, 70282, 70286, 70287, 70302, 70303, 70314, 70320, 70379, 70384, 70394, 70400, 70404, 70405, 70413, 70415, 70417, 70419, 70441, 70442, 70449, 70450, 70452, 70453, 70458, 70459, 70469, 70471, 70473, 70475, 70478, 70480, 70481, 70487, 70488, 70493, 70500, 70502, 70509, 70512, 70517, 70656, 70748, 70749, 70754, 70784, 70856, 70864, 70874, 71168, 71237, 71248, 71258, 71264, 71277, 71296, 71354, 71360, 71370, 71424, 71451, 71453, 71468, 71472, 71495, 71680, 71740, 71840, 71923, 71935, 71943, 71945, 71946, 71948, 71956, 71957, 71959, 71960, 71990, 71991, 71993, 71995, 72007, 72016, 72026, 72096, 72104, 72106, 72152, 72154, 72165, 72384, 72441, 72448, 72458, 72704, 72713, 72714, 72759, 72760, 72774, 72784, 72813, 72816, 72848, 72850, 72872, 72873, 72887, 72960, 72967, 72968, 72970, 72971, 73015, 73018, 73019, 73020, 73022, 73023, 73032, 73040, 73050, 73056, 73062, 73063, 73065, 73066, 73103, 73104, 73106, 73107, 73113, 73120, 73130, 73440, 73465, 73472, 73489, 73490, 73531, 73534, 73562, 73648, 73649, 73664, 73714, 73727, 74650, 74752, 74863, 74864, 74869, 74880, 75076, 77712, 77811, 92160, 92729, 92736, 92767, 92768, 92778, 92782, 92863, 92864, 92874, 92880, 92910, 92912, 92918, 92928, 92998, 93008, 93018, 93019, 93026, 93027, 93048, 93053, 93072, 93760, 93851, 93952, 94027, 94031, 94088, 94095, 94112, 113664, 113771, 113776, 113789, 113792, 113801, 113808, 113818, 113820, 113828, 119296, 119366, 119488, 119508, 119808, 119893, 119894, 119965, 119966, 119968, 119970, 119971, 119973, 119975, 119977, 119981, 119982, 119994, 119995, 119996, 119997, 120004, 120005, 120070, 120071, 120075, 120077, 120085, 120086, 120093, 120094, 120122, 120123, 120127, 120128, 120133, 120134, 120135, 120138, 120145, 120146, 120486, 120488, 120780, 120782, 120832, 122624, 122655, 122661, 122667, 122880, 122887, 122888, 122905, 122907, 122914, 122915, 122917, 122918, 122923, 122928, 122990, 123023, 123024, 123136, 123181, 123184, 123198, 123200, 123210, 1232!
 14, 123216, 123536, 123567, 123584, 123642, 123647, 123648, 124112, 124154, 124896, 124903, 124904, 124908, 124909, 124911, 124912, 124927, 124928, 125125, 125127, 125143, 125184, 125260, 125264, 125274, 125278, 125280, 126065, 126133, 126209, 126270, 126464, 126468, 126469, 126496, 126497, 126499, 126500, 126501, 126503, 126504, 126505, 126515, 126516, 126520, 126521, 126522, 126523, 126524, 126530, 126531, 126535, 126536, 126537, 126538, 126539, 126540, 126541, 126544, 126545, 126547, 126548, 126549, 126551, 126552, 126553, 126554, 126555, 126556, 126557, 126558, 126559, 126560, 126561, 126563, 126564, 126565, 126567, 126571, 126572, 126579, 126580, 126584, 126585, 126589, 126590, 126591, 126592, 126602, 126603, 126620, 126625, 126628, 126629, 126634, 126635, 126652, 126704, 126706, 129024, 129036, 129040, 129096, 129104, 129114, 129120, 129160, 129168, 129198, 129200, 129202, 129792, 129939, 129940, 129995, 130032, 130042, 917505, 917506, 917536, 917632, 917760, 918000 }
   local function rotate_in_uax50(i)
     local lo, hi = 1, #t
     while lo < hi do
@@ -902,9 +903,10 @@
        end
    end
 
+   local sub = string.sub
    local function prepare_extra_data_font(id, res, name)
       if type(res)=='table' and (res.psname or res.filename) then
-         if (res.embedding=='no') and (type(name)=='string') and (name:sub(1,5)=='psft:') then
+         if (res.embedding=='no') and (type(name)=='string') and (sub(name,1,5)=='psft:') then
             font_extra_info[id] = res.resources.ltj_extra
          else
             local bname = res.psname or nameonly(res.filename)

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua	2024-09-09 20:21:27 UTC (rev 72242)
@@ -16,6 +16,7 @@
 local cidfont_data = {}
 local cache_chars = {}
 local cache_ver = 14
+local sub = string.sub
 local identifiers = fonts.hashes.identifiers
 
 local cid_reg, cid_order, cid_supp, cid_name
@@ -300,7 +301,6 @@
    return cidfont_data[cid_name] or read_cid_font()
 end
 
-
 local definers = fonts.definers
 local function mk_rml(name, size, id)
    local specification = definers.analyze(name,size)
@@ -308,8 +308,8 @@
    specification.detail = specification.detail or ''
    do
       local n = specification.name
-      if n:sub(1,1)=="{" then n=n:sub(2) end
-      if n:sub(-1)=="}" then  n=n:sub(1,-2) end
+      if sub(n,1,1)=="{" then n=sub(n,2) end
+      if sub(n,-1)=="}" then  n=sub(n,1,-2) end
       specification.name=n
    end
    local fontdata = {}
@@ -382,11 +382,11 @@
 end
 
 local function font_callback(name, size, id, fallback)
-   if name:sub(1,1)=="{" and name:sub(-1)=="}" then name = name:sub(2,-2) end
+   if sub(name,1,1)=="{" and sub(name,-1)=="}" then name = sub(name,2,-2) end
    local p = name:find(":") or 0
-   if name:sub(1, p-1) == 'psft' then
+   if sub(name,1, p-1) == 'psft' then
       local s = "Adobe-Japan1-7"
-      local basename = name:sub(p+1)
+      local basename = sub(name,p+1)
       local p = basename:find(":")
       local q = basename:find("/[BI][BI]?")
       if q and p and q<=p then
@@ -394,12 +394,12 @@
          p = basename:find(":")
       end
       if p then
-         local xname = basename:sub(p+1)
+         local xname = sub(basename,p+1)
          p = 1
          while p do
             local q = xname:find(";", p+1) or xname:len()+1
-            if xname:sub(p, p+3)=='cid=' and q>p+4 then
-               s = xname:sub(p+4, q-1)
+            if sub(xname,p, p+3)=='cid=' and q>p+4 then
+               s = sub(xname,p+4, q-1)
             end
             if xname:len()+1==q then p = nil else p = q + 1 end
          end

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua	2024-09-09 20:21:27 UTC (rev 72242)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.ruby',
-  date = '2022-12-31',
+  date = '2024-09-06',
   description = 'Ruby annotation',
 })
 luatexja.ruby = {}
@@ -37,7 +37,7 @@
 local setlist = node.direct.setlist
 local setvalue = node.direct.setdata
 
-local node_new = node.direct.new
+local node_new = luatexja.dnode_new
 local node_remove = node.direct.remove
 local node_next =  node.direct.getnext
 local node_copy, node_tail = node.direct.copy, node.direct.tail
@@ -45,6 +45,7 @@
 local get_attr, set_attr = node.direct.get_attribute, node.direct.set_attribute
 local insert_before, insert_after = node.direct.insert_before, node.direct.insert_after
 local hpack = node.direct.hpack
+local node_inherit_attr = luatexja.node_inherit_attr
 
 local id_hlist  = node.id 'hlist'
 local id_vlist  = node.id 'vlist'
@@ -175,10 +176,10 @@
             set_attr(nh, attr_icflag,
               get_attr_icflag(nh) + PROCESSED_BEGIN_FLAG)
             setnext(node_tail(h), nh)
-            setlist(f, nil); node_free(f)
+            setlist(f, nil)
             setlist(b, nil); node_free(b)
             local g = luatexja.jfmglue.main(h,false)
-            return hpack(g)
+            g = node_inherit_attr(hpack(g),f); node_free(f); return g
          else
             return f
          end
@@ -207,6 +208,7 @@
 -- box の中身のノードは再利用される
 local enlarge
 do
+   local dimensions = node.direct.dimensions
    local FROM_JFM       = luatexja.icflag_table.FROM_JFM
    local PROCESSED      = luatexja.icflag_table.PROCESSED
    local KANJI_SKIP     = luatexja.icflag_table.KANJI_SKIP
@@ -239,18 +241,22 @@
          hx = node_next(hx)
       end
       -- 先頭の空白を挿入
-      local k = node_new(id_glue);
-      setglue(k, prenw, round(pre*65536), 0, 2, 0)
-      h = insert_before(h, h, k);
+      local k1 = node_new(id_glue);
+      setglue(k1, prenw, round(pre*65536), 0, 2, 0)
+      h = insert_before(h, h, k1);
       -- 末尾の空白を挿入
-      local k = node_new(id_glue);
-      setglue(k, postnw, round(post*65536), 0, 2, 0)
-      insert_after(h, node_tail(h), k);
+      local k2 = node_new(id_glue);
+      setglue(k2, postnw, round(post*65536), 0, 2, 0)
+      insert_after(h, node_tail(h), k2);
       -- hpack
-      setlist(box, nil); node_free(box)
-      box = hpack(h, new_width, 'exactly')
-      setheight(box, hh); setdepth(box, hd)
-      return box
+      setlist(box, nil);
+      local new_box = node_inherit_attr(hpack(h, new_width, 'exactly'), box)
+      setheight(new_box, hh); setdepth(new_box, hd)
+      node_free(box); 
+      local gset, gsign, go 
+        = getfield(new_box,'glue_set'), getfield(new_box,'glue_sign'), getfield(new_box,'glue_order')
+      return new_box, (dimensions(gset, gsign, go, k1, node_next(k1))), (dimensions(gset, gsign, go, k2))
+      -- return value: (enlarged box), (width of left glue), (width of right glue)
    end
 end
 
@@ -307,15 +313,18 @@
 end
 
 ----------------------------------------------------------------
--- pre_line_break
+-- pre_linebreak
 ----------------------------------------------------------------
 
 -- r, p の中身のノードは再利用される
 local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end)
    -- r: ルビ部分の格納された box,p: 同,親文字
+   -- no_begin: 行頭形ではないか
+   -- no_end: 行末形ではないか
    local rwidth = getwidth(r)
    local sumprot = rwidth - getwidth(p) -- >0
    local pre_intrusion, post_intrusion
+   local pre_protrusion, post_protrusion
    local ppre, pmid, ppost = tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost
    local mapre, mapost = tmp_tbl.mapre, tmp_tbl.mapost
    local intmode = (tmp_tbl.mode//4)%8
@@ -325,17 +334,17 @@
        mapre = min(mapre,mapost); mapost = mapre
    end
    if intmode == 0 then --  とりあえず組んでから決める
-      p = enlarge(p, rwidth, ppre, pmid, ppost, 0, 0)
+      p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, 0, 0)
       pre_intrusion  = min(mapre, round(ppre*getfield(p, 'glue_set')*65536))
       post_intrusion = min(mapost, round(ppost*getfield(p, 'glue_set')*65536))
    elseif intmode == 1 then
       pre_intrusion = min(mapre, sumprot);
       post_intrusion = min(mapost, max(sumprot-pre_intrusion, 0))
-      p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion)
+      p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion)
    elseif intmode == 2 then
       post_intrusion = min(mapost, sumprot);
       pre_intrusion = min(mapre, max(sumprot-post_intrusion, 0))
-      p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion)
+      p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion)
    elseif intmode==3 then
       local n = min(mapre, mapost)*2
       if n < sumprot then
@@ -343,7 +352,7 @@
       else
          pre_intrusion = sumprot//2; post_intrusion = sumprot - pre_intrusion
       end
-      p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion)
+      p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion)
       pre_intrusion = min(mapre, pre_intrusion + round(ppre*getfield(p, 'glue_set')*65536))
       post_intrusion = min(mapost, post_intrusion + round(ppost*getfield(p, 'glue_set')*65536))
    else  --  intmode == 4
@@ -354,7 +363,7 @@
       else
          pre_intrusion, post_intrusion = mapre, min(mapost, sumprot-mapre)
       end
-      p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion)
+      p, pre_protrusion, post_protrusion = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion)
    end
    setshift(r, -pre_intrusion)
    local rwidth = rwidth - pre_intrusion - post_intrusion
@@ -371,24 +380,29 @@
            post_jfmgk = (post_intrusion > 0)
        end
     end
-   return r, p, orig_post_intrusion, post_jfmgk
+    return r, p, orig_post_intrusion, post_jfmgk, 
+      pre_protrusion - pre_intrusion, post_protrusion - post_intrusion
 end
 
 -- ルビボックスの生成(単一グループ)
 -- returned value: <new box>, <ruby width>, <post_intrusion>
 local max_margin
-local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end)
+local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end, w)
+   -- no_begin: 行頭形ではないか
+   -- no_end: 行末形ではないか
    local post_intrusion, post_jfmgk = 0, false
    local imode
    local ppre, pmid, ppost = tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost
    local mapre, mapost = tmp_tbl.mapre, tmp_tbl.mapost
    local rpre, rmid, rpost, rsmash
+   local protrusion = {0, 0}; tmp_tbl[tmp_tbl.index] = protrusion
    imode = tmp_tbl.mode//0x100000; rsmash = (imode%2 ==1)
    imode = imode//2; rpost = imode%8;
    imode = (imode-rpost)/8;  rmid  = imode%8;
    imode = (imode-rmid)/8;   rpre  = imode%8
    if getwidth(r) > getwidth(p) then  -- change the width of p
-      r, p, post_intrusion, post_jfmgk = enlarge_parent(r, p, tmp_tbl, no_begin, no_end)
+      r, p, post_intrusion, post_jfmgk, protrusion[1], protrusion[2]
+        = enlarge_parent(r, p, tmp_tbl, no_begin, no_end)
    elseif getwidth(r) < getwidth(p) then -- change the width of r
       r = enlarge(r, getwidth(p), rpre, rmid, rpost, 0, 0)
       post_intrusion = 0
@@ -406,7 +420,7 @@
       end
       if need_repack then
          local rt = r
-         r = hpack(getlist(r), getwidth(r), 'exactly')
+         r = node_inherit_attr(hpack(getlist(r), getwidth(r), 'exactly'), r)
          setlist(rt, nil); node_free(rt);
       end
    end
@@ -416,7 +430,8 @@
    insert_after(r, k, p); setnext(p, nil)
    if tmp_tbl.rubydepth >= 0 then setdepth(r, tmp_tbl.rubydepth) end
    if tmp_tbl.baseheight >= 0 then setheight(p, tmp_tbl.baseheight) end
-   a = node.direct.vpack(r); setshift(a, 0)
+   a = node_inherit_attr(node.direct.vpack(r), p) 
+   setshift(a, 0)
    set_attr(a, attr_ruby, post_intrusion)
    set_attr(a, attr_ruby_post_jfmgk, post_jfmgk and 1 or 0)
    if rsmash or getheight(a)<getheight(p) then
@@ -437,7 +452,10 @@
 local flush_list = node.direct.flush_list
 -- 中付き熟語ルビ,cmp containers
 -- 「文字の構成を考えた」やつはどうしよう
-local function pre_low_cal_box(w, cmp)
+local pre_low_cal_box
+do
+   local node_prev = node.direct.getprev
+pre_low_cal_box = function (w, cmp)
    local rb = {}
    local pb = {}
    local kf = {}
@@ -450,18 +468,24 @@
    local coef = {} -- 連立一次方程式の拡大係数行列
    local rtb = expand_3bits(rst.stretch)
 
+   local kb, ka
+   if rst.quirk_protrusion then
+       kb = node_prev(node_tail(wv)); ka = node_next(kb)
+       node_remove(wv, kb); node_remove(wv, ka)
+   end
    -- node list 展開・行末形の計算
    local nt, nta, ntb = wv, nil, nil -- nt*: node temp
    rst.ppre, rst.pmid, rst.ppost = rtb[6], rtb[5], rtb[4]
    rst.mapre, rst.mapost = max_allow_pre, 0
-  for i = 1, cmp do
+   for i = 1, cmp do
       nt = node_next(nt); rb[i] = nt; nta = concat(nta, node_copy(nt))
       nt = node_next(nt); pb[i] = nt; ntb = concat(ntb, node_copy(nt))
       coef[i] = {}
       for j = 1, 2*i do coef[i][j] = 1 end
       for j = 2*i+1, 2*cmp+1 do coef[i][j] = 0 end
+      rst.index = i
       kf[i], coef[i][2*cmp+2]
-         = new_ruby_box(node_copy(nta), node_copy(ntb), rst, true, false)
+         = new_ruby_box(node_copy(nta), node_copy(ntb), rst, true, false, w)
    end
    node_free(nta); node_free(ntb)
 
@@ -474,8 +498,9 @@
       for j = 1, 2*i-1 do coef[cmp+i][j] = 0 end
       for j = 2*i, 2*cmp+1 do coef[cmp+i][j] = 1 end
       nta = concat(node_copy(rb[i]), nta); ntb = concat(node_copy(pb[i]), ntb)
+      rst.index = 2*cmp+1-i
       kf[cmp+i], coef[cmp+i][2*cmp+2]
-         = new_ruby_box(node_copy(nta), node_copy(ntb), rst, false, true)
+         = new_ruby_box(node_copy(nta), node_copy(ntb), rst, false, true, w)
    end
 
    -- ここで,nta, ntb には全 container を連結した box が入っているので
@@ -484,13 +509,17 @@
    for j = 1, 2*cmp+1 do coef[2*cmp+1][j] = 1 end
    rst.ppre, rst.pmid, rst.ppost = rtb[3], rtb[2], rtb[1]
    rst.mapre, rst.mapost = max_allow_pre, max_allow_post
+   rst.index = 2*cmp+1
    kf[2*cmp+1], coef[2*cmp+1][2*cmp+2], post_intrusion_backup, post_jfmgk_backup
-      = new_ruby_box(nta, ntb, rst, true, true)
+      = new_ruby_box(nta, ntb, rst, true, true, w)
 
    -- w.value の node list 更新.
    local nt = wv
    flush_list(node_next(wv))
    for i = 1, 2*cmp+1 do setnext(nt, kf[i]); nt = kf[i]  end
+   if rst.quirk_protrusion then
+       insert_after(wv, nt, kb); insert_after(wv, kb, ka);
+   end
 
    if cmp==1 then     solve_1(coef)
    elseif cmp==2 then solve_2(coef)
@@ -499,6 +528,7 @@
    end
    return coef
 end
+end
 
 local first_whatsit
 do
@@ -512,10 +542,14 @@
 end
 
 local next_cluster_array = {}
+local pre_high
 -- ノード追加
-local function pre_low_app_node(head, w, cmp, coef, ht, dp)
+do
+   local node_prev = node.direct.getprev
+   local KINSOKU = luatexja.icflag_table.KINSOKU
+   local function pre_low_app_node (head, w, cmp, coef, ht, dp)
    -- メインの node list 更新
-   local nt = node_new(id_glue)
+   local nt = node_new(id_glue, nil, w) -- INHERIT ATTRIBUTES OF w
    setglue(nt, coef[1][2*cmp+2], 0, 0, 0, 0)
    set_attr(nt, attr_ruby, 1); set_attr(w, attr_ruby, 2)
    head = insert_before(head, w, nt)
@@ -522,15 +556,26 @@
    nt = w
    for i = 1, cmp do
       -- rule
-      local nta = node_new(id_rule, 0);
+      local nta = node_new(id_rule, 0, w); -- INHERIT ATTRIBUTES OF w
       setwhd(nta, coef[i*2][2*cmp+2], ht, dp)
       insert_after(head, nt, nta)
       set_attr(nta, attr_ruby, 2*i+1)
       -- glue
       if i~=cmp or not next_cluster_array[w] then
-         nt = node_new(id_glue); insert_after(head, nta, nt)
+         nt = node_new(id_glue, nil, w);  -- INHERIT ATTRIBUTE OF w
+         insert_after(head, nta, nt)
       else
-         nt = next_cluster_array[w]
+         nt = next_cluster_array[w]; local f = node_next(nta)
+         while f and f~=nt do
+            if getid(f)==id_glue then
+               node_remove(head, nt); insert_before(head, f, nt); f = nil
+            else if getid(f)==id_penalty and get_attr_icflag(f)==KINSOKU then
+                 node_inherit_attr(f, w) -- INHERIT ATTRIBUTE OF w; for lua-ul
+                 set_attr(f, attr_icflag, KINSOKU)
+               end
+               f = node_next(f)
+            end
+         end
       end
       setglue(nt, coef[i*2+1][2*cmp+2], 0, 0, 0, 0)
       set_attr(nt, attr_ruby, 2*i+2)
@@ -540,14 +585,13 @@
    next_cluster_array[w]=nil
    return head, first_whatsit(node_next(nt))
 end
-
-local function pre_high(ahead)
+pre_high = function (ahead)
    if not ahead then return ahead end
    local head = to_direct(ahead)
    post_intrusion_backup, post_jfmgk_backup = 0, false
    local n = first_whatsit(head)
    while n do
-      if getsubtype(n) == sid_user and getfield(n, 'user_id') == RUBY_PRE then
+       if getsubtype(n) == sid_user and getfield(n, 'user_id') == RUBY_PRE then
          local nv = getvalue(n)
          local rst = getvalue(nv)
          max_allow_pre = rst.pre or 0
@@ -567,13 +611,13 @@
          if rst.exclude_pre_jfmgk_from_prev_ruby
             and atr>0 and ((old_break_info[atr]  or post_intrusion_backup) > 0) then
             -- 「直前のルビが文字に進入→現在のルビの和文処理グルーへの進入はなし」という状況
-            rst.before_jfmgk = 0
+            max_allow_pre = 0;rst.before_jfmgk = 0
          end
          post_intrusion_backup, post_jfmgk_backup = 0, false
          max_allow_post = rst.post or 0
          max_margin = rst.maxmargin or 0
          local coef = pre_low_cal_box(n, rst.count)
-         local s = node_tail(nv) --ルビ文字
+         local s = node_tail(nv); if rst.quirk_protrusion then s = node_prev(node_prev(s)) end --ルビ文字
          head, n = pre_low_app_node(
             head, n, rst.count, coef, getheight(s), getdepth(s)
          )
@@ -583,11 +627,11 @@
    end
    return to_node(head)
 end
+end
 luatexbase.add_to_callback('pre_linebreak_filter', pre_high, 'ltj.ruby.pre', 100)
-luatexbase.add_to_callback('hpack_filter', pre_high, 'ltj.ruby.pre', 100)
 
 ----------------------------------------------------------------
--- post_line_break
+-- post_linebreak
 ----------------------------------------------------------------
 local post_lown
 do
@@ -595,47 +639,110 @@
       local id = get_attr(wv, attr_ruby_id) or 0
       if id>0 and cache_handle then
          cache_handle:write(
-            'lrob[' .. tostring(id) .. ']=' .. num .. '\nlrob[' .. tostring(-id) .. ']=' .. tostring(bool) .. '\n')
+            'lrob[' .. tostring(id) .. ']=' .. tostring(num) .. '\nlrob[' .. tostring(-id) .. ']=' .. tostring(bool) .. '\n')
       end
    end
-
+   local node_prev = node.direct.getprev
+   local function new_kern(inherit, num)
+    local k = node_new(id_kern, 1, inherit); setkern(k, num); set_attr(kt, attr_icflag, PROCESSED);
+      return k;
+   end
    post_lown = function (rs, rw, cmp, ch)
       -- ch: the head of `current' hlist
       if #rs ==0 or not rw then return ch end
       local hn = get_attr(rs[1], attr_ruby)
       local fn = get_attr(rs[#rs], attr_ruby)
-      local wv = getvalue(rw)
+      local wv = getvalue(rw); local rst = getvalue(wv)
       if hn==1 then
          if fn==2*cmp+2 then
-            local hn = node_tail(wv)
-            node_remove(wv, hn)
-            insert_after(ch, rs[1], hn)
-            set_attr(hn, attr_icflag,  PROCESSED)
-            write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk))-- 行中形
+            -- 行中形  
+            local nn = node_tail(wv); 
+            if rst.quirk_protrusion then
+               local prot_b,prot_a = rst[fn-1][1], rst[fn-1][2]
+               local ka=nn; local kb = node_prev(nn); nn = node_prev(kb)
+               node_remove(wv, nn); node_remove(wv, kb); node_remove(wv, ka)
+               if prot_b~=0 then
+                   setkern(kb, prot_b); insert_after(ch, rs[1], kb);
+                   local kt = new_kern(rw, -prot_b); insert_after(ch, kb, kt); 
+                   insert_after(ch, kt, nn);
+               else 
+                   node_free(kb); insert_after(ch, rs[1], nn)
+               end
+               if prot_a~=0 then
+                  local kt = new_kern(rw, -prot_a); insert_after(ch, nn, kt);
+                  setkern(ka, prot_a); insert_after(ch, kt, ka);
+               else node_free(ka)
+               end   
+            else 
+               node_remove(wv, nn); insert_after(ch, rs[1], nn)
+            end
+            set_attr(nn, attr_icflag, PROCESSED)
+            write_aux(wv, get_attr(nn, attr_ruby), get_attr(nn, attr_ruby_post_jfmgk))
          else
-            local deg, hn = (fn-1)/2, wv
-            for i = 1, deg do hn = node_next(hn) end;
-            node_remove(wv, hn)
-            setnext(hn, nil)
-            insert_after(ch, rs[1], hn)
-            set_attr(hn, attr_icflag,  PROCESSED)
-            write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk))
+            -- 行末形
+            local deg, nn = (fn-1)/2, wv; for i = 1, deg do nn = node_next(nn) end
+            if rst.quirk_protrusion then
+               local prot_b = rst[deg][1]
+               local ka = node_tail(wv); local kb = node_prev(ka);
+               node_remove(wv, nn); setnext(nn, nil); node_remove(wv, kb);
+               if prot_b~=0 then
+                   setkern(kb, prot_b); insert_after(ch, rs[1], kb);
+                   local kt = new_kern(rw, -prot_b); insert_after(ch, kb, kt); 
+                   insert_after(ch, kt, nn);
+               else 
+                   node_free(kb); insert_after(ch, rs[1], nn)
+               end
+               if deg==cmp then
+                  local prot_a = rst[deg][2]; node_remove(wv,ka)
+                  if prot_a~=0 then
+                     local kt = new_kern(rw, -prot_a); insert_after(ch, nn, kt);
+                     setkern(ka, prot_a); insert_after(ch, kt, ka);
+                  else node_free(ka)
+                  end   
+               end   
+            else 
+               node_remove(wv, nn); setnext(nn, nil); insert_after(ch, rs[1], nn)
+            end
+
+            set_attr(nn, attr_icflag, PROCESSED)
+            write_aux(wv, get_attr(nn, attr_ruby), get_attr(nn, attr_ruby_post_jfmgk))
          end
       else
-         local deg, hn = max((hn-1)/2,2), wv
-         for i = 1, cmp+deg-1 do hn = node_next(hn) end
+         -- 行頭形
+         local nn = wv; for i = 1, cmp+max((hn-1)/2,2)-1 do nn = node_next(nn) end
          -- -1 is needed except the case hn = 3,
          --   because a ending-line form is removed already from the list
-         node_remove(wv, hn); setnext(hn, nil)
-         insert_after(ch, rs[1], hn)
-         set_attr(hn, attr_icflag,  PROCESSED)
+         if rst.quirk_protrusion then
+            local deg=(hn-1)/2; local prot_b = rst[2*cmp+1-deg][1]
+            local ka = node_tail(wv); node_remove(wv, nn); setnext(nn, nil);
+            if deg==1 then
+               local kb = node_prev(ka); node_remove(wv, kb);
+               if prot_b~=0 then
+                   setkern(kb, prot_b); insert_after(ch, rs[1], kb);
+                   local kt = new_kern(rw, -prot_b); insert_after(ch, kb, kt); 
+                   insert_after(ch, kt, nn);
+               else 
+                   node_free(kb); insert_after(ch, rs[1], nn)
+               end
+            else insert_after(ch, rs[1], nn)
+            end
+            local prot_a = rst[2*cmp+1-deg][2]; node_remove(wv,ka)
+            if prot_a~=0 then
+               local kt = new_kern(rw, -prot_a); insert_after(ch, nn, kt);
+               setkern(ka, prot_a); insert_after(ch, kt, ka);
+            else node_free(ka)
+            end
+         else
+            node_remove(wv, nn); setnext(nn, nil); insert_after(ch, rs[1], nn)
+         end
+
+         set_attr(nn, attr_icflag, PROCESSED)
          if fn == 2*cmp-1 then
-            write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk))
+            write_aux(wv, get_attr(nn, attr_ruby), get_attr(nn, attr_ruby_post_jfmgk))
          end
       end
       for i = 1,#rs do
-         local ri = rs[i]
-         ch = node_remove(ch, ri); node_free(ri);
+         local ri = rs[i]; ch = node_remove(ch, ri); node_free(ri)
       end
       -- cleanup
       if fn >= 2*cmp+1 then node_free(rw) end
@@ -644,73 +751,86 @@
 end
 
 local traverse_id = node.direct.traverse_id
-local function post_high_break(head)
-   local rs = {}   -- rs: sequence of ruby_nodes,
-   local rw = nil  -- rw: main whatsit
-   local cmp = -2  -- dummy
-   for h in traverse_id(id_hlist, to_direct(head)) do
-      for i = 1, #rs do rs[i] = nil end
-      local ha = getlist(h)
+local post_high_hbox, post_high_break
+do
+   local rs, rw = {}, nil -- rs: sequence of ruby_nodes, rw: main whatsit
+   local cmp
+   post_high_break =  function (head)
+      for h in traverse_id(id_hlist, to_direct(head)) do
+         for i = 1, #rs do rs[i] = nil end
+         local ha = getlist(h);
+         while ha do
+            local hai = getid(ha)
+            local i = ((hai == id_glue and getsubtype(ha)==0)
+                       or (hai == id_rule and getsubtype(ha)==0)
+                       or (hai == id_whatsit and getsubtype(ha)==sid_user
+                           and getfield(ha, 'user_id', RUBY_POST)))
+                  and get_attr(ha, attr_ruby) or 0
+            if i==0 then
+               ha = node_next(ha)
+            elseif i==1 then
+               setlist(h, post_lown(rs, rw, cmp, getlist(h)))
+               for i = 2, #rs do rs[i] = nil end -- rs[1] is set by the next statement
+               rs[1], rw = ha, nil; ha = node_next(ha)
+            elseif i==2 then
+               rw = ha
+               cmp = getvalue(getvalue(rw)).count
+               local hb, hc =  node_remove(getlist(h), rw)
+               setlist(h, hb); ha = hc
+            else -- i>=3
+               rs[#rs+1] = ha; ha = node_next(ha)
+            end
+         end
+         setlist(h, post_lown(rs, rw, cmp, getlist(h)))
+      end
+      return head
+   end
+   post_high_hbox = function (ahead)
+      for i = 1, #rs do rs[i] = nil end; rw = nil
+      local ha = to_direct(ahead); local head = ha
       while ha do
          local hai = getid(ha)
          local i = ((hai == id_glue and getsubtype(ha)==0)
-                       or (hai == id_rule and getsubtype(ha)==0)
-                       or (hai == id_whatsit and getsubtype(ha)==sid_user
-                              and getfield(ha, 'user_id', RUBY_POST)))
-            and get_attr(ha, attr_ruby) or 0
+                    or (hai == id_rule and getsubtype(ha)==0)
+                    or (hai == id_whatsit and getsubtype(ha)==sid_user
+                        and getfield(ha, 'user_id', RUBY_POST)))
+               and get_attr(ha, attr_ruby) or 0
          if i==0 then
             ha = node_next(ha)
          elseif i==1 then
-            setlist(h, post_lown(rs, rw, cmp, getlist(h)))
+            head = post_lown(rs, rw, cmp, head)
             for i = 2, #rs do rs[i] = nil end -- rs[1] is set by the next statement
             rs[1], rw = ha, nil; ha = node_next(ha)
          elseif i==2 then
             rw = ha
             cmp = getvalue(getvalue(rw)).count
-            local hb, hc =  node_remove(getlist(h), rw)
-            setlist(h, hb); ha = hc
-         else -- i>=3
+            head, ha = node_remove(head, rw)
+         else -- i >= 3
             rs[#rs+1] = ha; ha = node_next(ha)
          end
       end
-      setlist(h, post_lown(rs, rw, cmp, getlist(h)))
+      return to_node(post_lown(rs, rw, cmp, head))
    end
-   return head
 end
-
-local function post_high_hbox(ahead)
-   local ha = to_direct(ahead); local head = ha
-   local rs = {};  -- rs: sequence of ruby_nodes,
-   local rw = nil; -- rw: main whatsit
-   local cmp
-   while ha do
-      local hai = getid(ha)
-      local i = ((hai == id_glue and getsubtype(ha)==0)
-                    or (hai == id_rule and getsubtype(ha)==0)
-                    or (hai == id_whatsit and getsubtype(ha)==sid_user
-                           and getfield(ha, 'user_id', RUBY_POST)))
-         and get_attr(ha, attr_ruby) or 0
-      if i==0 then
-         ha = node_next(ha)
-      elseif i==1 then
-         head = post_lown(rs, rw, cmp, head)
-         for i = 2, #rs do rs[i] = nil end -- rs[1] is set by the next statement
-         rs[1], rw = ha, nil; ha = node_next(ha)
-      elseif i==2 then
-         rw = ha
-         cmp = getvalue(getvalue(rw)).count
-         head, ha = node_remove(head, rw)
-      else -- i >= 3
-         rs[#rs+1] = ha; ha = node_next(ha)
-      end
+do
+   -- pre_append_to_vlist_filter.lua: distributed with lua-ul
+   local found = kpse.find_file('pre_append_to_vlist_filter.lua', 'lua')
+   if not found then
+      luatexbase.add_to_callback('post_linebreak_filter', post_high_break, 'ltj.ruby.post_break')
+   else
+      require 'pre_append_to_vlist_filter'
+      luatexbase.add_to_callback('pre_append_to_vlist_filter', 
+         function(head, loc) 
+             return (loc~='post_linebreak') and head or post_high_break(head)
+         end,
+         'ltj.ruby.post_break',
+         (luatexbase.priority_in_callback('pre_append_to_vlist_filter', 'add underlines to list') or 1))
    end
-   return to_node(post_lown(rs, rw, cmp, head))
+   luatexbase.add_to_callback('hpack_filter', 
+     function(head) return post_high_hbox(pre_high(head)) end, 'ltj.ruby', 
+     luatexbase.priority_in_callback('hpack_filter', 'add underlines to list') or nil)
 end
 
-luatexbase.add_to_callback('post_linebreak_filter', post_high_break, 'ltj.ruby.post_break', 100)
-luatexbase.add_to_callback('hpack_filter', post_high_hbox, 'ltj.ruby.post_hbox', 101)
-
-
 ----------------------------------------------------------------
 -- for jfmglue callbacks
 ----------------------------------------------------------------
@@ -736,7 +856,7 @@
                      p = 0
                   end
                   rst.pre = -p; rst.exclude_pre_from_prev_ruby = (s<0);
-                   rst.exclude_pre_jfmgk_from_prev_ruby = (ltjs.table_current_stack[RIPOST +Nq.char] or 0)<0;
+                  rst.exclude_pre_jfmgk_from_prev_ruby = (ltjs.table_current_stack[RIPOST +Nq.char] or 0)<0;
                end
                if Nq.prev_ruby then
                   set_attr(lp, attr_ruby, Nq.prev_ruby)
@@ -758,6 +878,11 @@
          elseif rst.pre < 0 then -- auto
             rst.pre = 0
          end
+         if rst.quirk_protrusion then
+            local lk = node_new(id_kern, 1, Nq.nuc, lp); set_attr(lk, attr_icflag, PROCESSED)
+            insert_after(lpv, node_tail(lpv), lk)
+            insert_after(lpv, node_tail(lpv), node_new(id_kern, 1))
+         end
          return Np
       else
         return Np
@@ -780,10 +905,12 @@
    end
    local RIPOST = luatexja.stack_table_index.RIPOST
    local abs = math.abs
+   local ltjj_after_hlist=luatexja.jfmglue.after_hlist
+   local ltjj_check_box_high=luatexja.jfmglue.check_box_high
    local function whatsit_after_callback(s, Nq, Np, head)
       if not s and  getfield(Nq.nuc, 'user_id') == RUBY_PRE then
          if Np then
-            local last_glue = node_new(id_glue)
+            local last_glue = node_new(id_glue, nil, Nq.nuc) -- INHERIT ATTRIBUTE OF Nq.nuc
             set_attr(last_glue, attr_icflag, 0)
             insert_before(Nq.nuc, Np.first, last_glue)
             Np.first = last_glue
@@ -798,8 +925,8 @@
          end
          local x =  node_next(node_next(nqnv))
          for i = 2, rst.count do x = node_next(node_next(x)) end
-         Nq.last_char = luatexja.jfmglue.check_box_high(Nq, getlist(x), nil)
-         luatexja.jfmglue.after_hlist(Nq)
+         Nq.last_char = ltjj_check_box_high(Nq, getlist(x), nil)
+         ltjj_after_hlist(Nq)
          if Np and Np.id ~=id_pbox_w and type(Np.char)=='number' then
             -- Np is a JAchar
             if rst.post < 0 then -- auto
@@ -812,12 +939,15 @@
             Np.prev_ruby = get_attr(getvalue(Nq.nuc), attr_ruby_id)
             -- 前のクラスタがルビであったことのフラグ
          else -- 直前が文字以外
-            local nqnv = getvalue(Nq.nuc)
-            local rst = getvalue(nqnv)
             if rst.post < 0 then -- auto
                rst.post = 0
             end
          end
+         if rst.quirk_protrusion then
+            local lk = node_tail(nqnv);
+            node_inherit_attr(lk, Nq.nuc, Np and Np.nuc)
+            set_attr(lk, attr_icflag, PROCESSED)
+         end
          return head
       else
          return s

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls	2024-09-09 20:21:27 UTC (rev 72242)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjsarticle}
-  [2022/09/12 ltjsclasses ]
+  [2023/07/26 ltjsclasses ]
 \def\jsc at clsname{ltjsarticle}
 \def\Cjascale{0.924715}
 \RequirePackage{luatexja}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls	2024-09-09 20:21:27 UTC (rev 72242)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjsbook}
-  [2022/09/12 ltjsclasses ]
+  [2023/07/26 ltjsclasses ]
 \def\jsc at clsname{ltjsbook}
 \def\Cjascale{0.924715}
 \RequirePackage{luatexja}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls	2024-09-09 20:21:27 UTC (rev 72242)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjskiyou}
-  [2022/09/12 ltjsclasses ]
+  [2023/07/26 ltjsclasses ]
 \def\jsc at clsname{ltjskiyou}
 \def\Cjascale{0.924715}
 \RequirePackage{luatexja}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls	2024-09-09 20:21:27 UTC (rev 72242)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjspf}
-  [2022/09/12 ltjsclasses ]
+  [2023/07/26 ltjsclasses ]
 \def\jsc at clsname{ltjspf}
 \def\Cjascale{0.903375}
 \RequirePackage{luatexja}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls	2024-09-09 20:21:27 UTC (rev 72242)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjsreport}
-  [2022/09/12 ltjsclasses ]
+  [2023/07/26 ltjsclasses ]
 \def\jsc at clsname{ltjsreport}
 \def\Cjascale{0.924715}
 \RequirePackage{luatexja}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua	2024-09-09 20:21:27 UTC (rev 72242)
@@ -423,9 +423,10 @@
 local function debug_show_node_X(p,print_fn, limit, inner_depth)
    local k = prefix
    local s
-   local pt, pic = node_type(p.id), (get_attr(p, attr_icflag) or 0) % icflag_table.PROCESSED_BEGIN_FLAG
-   local base = prefix .. '[' .. string.format('%7d', node.direct.todirect(p)) .. '] ' ..
-     string.format('%X', pic) .. ' ' .. pt .. ' ' .. tostring(p.subtype) .. ' '
+   local pt, pic = node_type(p.id), (get_attr(p, attr_icflag) or 0) --% icflag_table.PROCESSED_BEGIN_FLAG
+   local base = prefix .. '[' .. string.format('%7d', node.direct.todirect(p)) 
+     .. ', ' .. tostring(get_attr(p, 27)) .. '] '
+     .. string.format('%X', pic) .. ' ' .. pt .. ' ' .. tostring(p.subtype) .. ' '
    if pt == 'glyph' then
       s = base .. ' '
           .. (p.char<0xF0000 and utfchar(p.char) or '')

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty	2024-09-09 20:21:27 UTC (rev 72242)
@@ -27,7 +27,7 @@
 \newif\ifltj at disablejfam
 
 %%%% VERSION
-\def\LuaTeXjaversion{20240714.0}
+\def\LuaTeXjaversion{20240909.0}
 
 %% Check if LaTeX is used.
 \begingroup\expandafter\expandafter\expandafter\endgroup

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty	2024-09-09 20:21:27 UTC (rev 72242)
@@ -219,10 +219,6 @@
   \@latex at error{Direction change inside float!?\MessageBreak
     Use \noexpand\layoutcaption provided in \string\usepackage{lltjext}}\@ehc}
 %%% Remove extra xkanjiskip
-\renewcommand\@makefnmark{%
-  \unless\ifnum\ltjgetparameter{direction}=3
-    \hbox{}\hbox{\@textsuperscript{\normalfont\@thefnmark}}\hbox{}%
-  \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi}
 \begingroup
 \@ifpackageloaded{hyperref}
   {\ifdefined\real at setref\def\ltj at setrefprefix{real}\else\def\ltj at setrefprefix{}\fi}
@@ -250,6 +246,11 @@
 \gdef\@stopfield{%
   \inhibitglue\@tempskipa\lastskip\unskip
   \hskip\@tempskipa\color at endgroup\egroup}
+%%%%%% footnote
+\renewcommand\@makefnmark{%
+  \unless\ifnum\ltjgetparameter{direction}=3
+    \hbox{}\hbox{\@textsuperscript{\normalfont\@thefnmark}}\hbox{}%
+  \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi}
 \pretocmd{\footnote}{\inhibitglue}{}{}
 \pretocmd{\footnotemark}{\inhibitglue}{}{}
 \def\@ltj at process@makefnmark#1{%

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-array.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-array.sty	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-array.sty	2024-09-09 20:21:27 UTC (rev 72242)
@@ -3,8 +3,10 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-array}[2024-06-10 Patch to array for LuaTeX-ja]
+\ProvidesPackage{lltjp-array}[2024-07-21 Patch to array for LuaTeX-ja]
 
+\@ifpackageloaded{array}{\def\lltjp at array@array at loaded{1}}{\let\lltjp at array@array at loaded\relax}
+
 \RequirePackage{etoolbox,array}
 
 \patchcmd\insert at column{%
@@ -22,12 +24,12 @@
 
 \@ifpackageloaded{lltjext}{}{%
 %% remove extra \xkanjiskip (pLaTeX2e 2016/04/17)
-\def\@tabular{%
-	    \leavevmode \null
-	    \hbox \bgroup $\col at sep\tabcolsep \let\d at llarbegin\begingroup
-	                                      \let\d at llarend\endgroup
-	    \@tabarray}
-\def\endtabular{\endarray $\egroup\null}
+\ifnum0<0\lltjp at array@array at loaded
+  \patchcmd{\@tabular}{\leavevmode}{\leavevmode\null}{}{}
+  \patchcmd{\@tabular}{\leavevmode\null\null}{\leavevmode\null}{}{}
+  \apptocmd{\endtabular}{\null}{}{}
+  \let\lltjp at array@array at loaded\undefined
+\fi
 \expandafter \let \csname endtabular*\endcsname = \endtabular
 }
 \endinput

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-footmisc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-footmisc.sty	2024-09-09 20:21:04 UTC (rev 72241)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-footmisc.sty	2024-09-09 20:21:27 UTC (rev 72242)
@@ -3,63 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-footmisc}[2022-02-19 Patch to footmisc for LuaTeX-ja]
+\ProvidesPackage{lltjp-footmisc}[2024-07-22 Patch to footmisc for LuaTeX-ja]
 
-\@ifpackagelater{footmisc}{2022-02-10}{%% v6.0a or later
-  \patchcmd{\@makenormalcolbox}{\vskip -\@outputbox at depth\@textbottom}%
-    {\pltx at adjust@wd at outputbox\vskip -\@outputbox at depth\@textbottom}{}{}%
-  \let\ltj at next\endinput
-}{\let\ltj at next\relax}
-\ltj at next
-
-% old (v5.5)
-\let  \if at tempswa  \ifFN at bottom
-\ifFN at para    \@tempswatrue \fi
-\if at tempswa
-  \ifFN at bottom
-    \toks@{\setbox\@outputbox \box\@cclv
-      \xdef\@freelist{\@freelist\@midlist}%
-      \global\let\@midlist\@empty
-      \@combinefloats
-      \ifvoid\footins
-      \else
-        \setbox\@outputbox \vbox\bgroup
-          \boxmaxdepth\@maxdepth
-          \unvbox\@outputbox
-          \vfill\relax
-    }
-    \the\FN at temptoken
-    \toks@\expandafter{\the\toks@\egroup\fi}
-  \else
-    \toks@{\ifvoid\footins
-        \setbox\@outputbox\box\@cclv
-      \else
-        \setbox\@outputbox \vbox\bgroup
-        \boxmaxdepth\@maxdepth
-        \unvbox\@cclv
-    }
-    \the\FN at temptoken
-    \toks@\expandafter{\the\toks@
-      \egroup
-      \fi
-      \xdef\@freelist{\@freelist\@midlist}%
-      \global\let\@midlist\@empty
-      \@combinefloats
-    }%
-  \fi
-  \toks@\expandafter{\the\toks@
-    \ifvbox\@kludgeins
-      \@makespecialcolbox
-    \else
-      \setbox\@outputbox \vbox to\@colht{%
-        \@texttop \dimen@\dp\@outputbox
-        \unvbox\@outputbox
-        \pltx at adjust@wd at outputbox
-        \vskip -\dimen@\@textbottom
-      }%
-    \fi
-    \global\maxdepth\@maxdepth
-  }
-  \edef\@makecol{\the\toks@}
-\fi
-\endinput
+\patchcmd{\@makenormalcolbox}{\vskip -\@outputbox at depth\@textbottom}%
+  {\pltx at adjust@wd at outputbox\vskip -\@outputbox at depth\@textbottom}{}{}%



More information about the tex-live-commits mailing list.