texlive[43733] Master/texmf-dist: pxrubrica (10apr17)

commits+karl at tug.org commits+karl at tug.org
Mon Apr 10 23:39:51 CEST 2017


Revision: 43733
          http://tug.org/svn/texlive?view=revision&revision=43733
Author:   karl
Date:     2017-04-10 23:39:50 +0200 (Mon, 10 Apr 2017)
Log Message:
-----------
pxrubrica (10apr17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/platex/pxrubrica/LICENSE
    trunk/Master/texmf-dist/doc/platex/pxrubrica/pxrubrica-en.pdf
    trunk/Master/texmf-dist/doc/platex/pxrubrica/pxrubrica-en.tex
    trunk/Master/texmf-dist/doc/platex/pxrubrica/pxrubrica.pdf
    trunk/Master/texmf-dist/source/platex/pxrubrica/pxrubrica.dtx
    trunk/Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja.md
    trunk/Master/texmf-dist/doc/platex/pxrubrica/README.md

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/platex/pxrubrica/README
    trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja

Modified: trunk/Master/texmf-dist/doc/platex/pxrubrica/LICENSE
===================================================================
--- trunk/Master/texmf-dist/doc/platex/pxrubrica/LICENSE	2017-04-10 13:51:08 UTC (rev 43732)
+++ trunk/Master/texmf-dist/doc/platex/pxrubrica/LICENSE	2017-04-10 21:39:50 UTC (rev 43733)
@@ -1,9 +1,6 @@
-本ソフトウェアは MIT ライセンスの下で配布されます。著作権は作者である
-「八登崇之(別名 ZR)」に属します。また本ソフトウェアは無保証です。
-
 The MIT License
 
-Copyright (c) 2009-2011 Takayuki YATO (a.k.a. "ZR")
+Copyright (c) 2017 Takayuki YATO (aka. "ZR")
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

Deleted: trunk/Master/texmf-dist/doc/platex/pxrubrica/README
===================================================================
--- trunk/Master/texmf-dist/doc/platex/pxrubrica/README	2017-04-10 13:51:08 UTC (rev 43732)
+++ trunk/Master/texmf-dist/doc/platex/pxrubrica/README	2017-04-10 21:39:50 UTC (rev 43733)
@@ -1,53 +0,0 @@
-PXrubrica Package
-=================
-
-LaTeX: Ruby annotations according to JIS X 4051
-
-This package provides function to add ruby annotation (furigana) that
-follows the style conventional in Japanese typography, as described in
-the W3C technical note “Requirements for Japanese Text Layout” ([JLREQ])
-and the JIS specification JIS X 4051.
-
-[JLREQ]: <http://www.w3.org/TR/jlreq/>
-
-### SYSTEM REQUIREMENTS
-
-  * TeX format: LaTeX.
-  * TeX engine: pTeX and its derivatives.
-  * DVI driver: Anything that supports pTeX DVI.
-
-### CONTENT
-
-  * `pxrubrica.pdf`: the manual in Japanese
-  * `pxrubrica.dtx`: DocStrip source file
-  * `pxrubrica.ins`: DocStrip installer file
-  * `pxrubrica-en.pdf`: the brief manual in English
-  * `pxrubrica-en.tex`: the brief manual in English (source)
-  * `sample/*.tex`: sample documents
-
-### INSTALLATION
-
-If the archive does not contain the packge file (`*.sty`), then you
-must run the command to create it:
-
-    ptex -kanji=jis pxrubrica.ins
-
-Then move the files as follows (in a system compliant to TDS 1.1):
-
-  - `*.sty`         → $TEXMF/tex/platex/pxrubrica/
-  - `*.dtx`/`*.ins` → $TEXMF/source/platex/pxrubrica/
-  - `*.pdf`/`*.tex` → $TEXMF/doc/platex/pxrubrica/
-
-And rehash your TEXMF trees if necessary.
-
-Revision History
-----------------
-
-  * Version 1.0a <2014/12/23>
-      - Bug hix.
-  * Version 1.0  <2012/04/30>
-      - First public release.
-
---------------------
-Takayuki YATO (aka. "ZR")  
-http://zrbabbler.sp.land.to/

Deleted: trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja
===================================================================
--- trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja	2017-04-10 13:51:08 UTC (rev 43732)
+++ trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja	2017-04-10 21:39:50 UTC (rev 43733)
@@ -1,51 +0,0 @@
-PXrubrica パッケージ
-====================
-
-LaTeX: 日本の慣習に従ったルビ(振り仮名)出力
-
-JIS 規格「JIS X 4051」および W3C 技術ノート「[日本語組版処理の要件]」
-で述べられているような、日本において一般的な様式に従ってルビを付ける
-機能を提供する。
-
-[日本語組版処理の要件]: <http://www.w3.org/TR/jlreq/ja/>
-
-### 前提環境
-
-  * フォーマット: LaTeX
-  * エンジン: pTeX (派生エンジン含む)
-  * DVI ウェア: pTeX 対応のもの
-
-### 構成物
-
-  * `pxrubrica.pdf`: 説明書
-  * `pxrubrica.dtx`: DocStrip ソースファイル
-  * `pxrubrica.ins`: DocStrip インストーラファイル
-  * `pxrubrica-en.pdf`: 英語版の説明書
-  * `pxrubrica-en.tex`: 英語版の説明書(ソース)
-  * `sample/*.tex`: サンプル文書
-
-### インストール
-
-アーカイブにパッケージファイル(`*.sty`)が含まれていない場合は、
-以下のコマンドを実行して生成する。
-
-    ptex -kanji=jis pxrubrica.ins
-
-その後、各ファイルを次の場所に移動する。
-(TDS 1.1 に従ったシステムの場合。)
-
-  - `*.sty`         → $TEXMF/tex/platex/pxrubrica/
-  - `*.dtx`/`*.ins` → $TEXMF/source/platex/pxrubrica/
-  - `*.pdf`/`*.tex` → $TEXMF/doc/platex/pxrubrica/
-
-更新履歴
---------
-
-  * Version 1.0a <2014/12/23>
-      - バグ修正
-  * Version 1.0  <2012/04/30>
-      - 最初の公開版
-
---------------------
-Takayuki YATO (aka. "ZR")  
-http://zrbabbler.sp.land.to/

Added: trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja.md
===================================================================
--- trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja.md	2017-04-10 21:39:50 UTC (rev 43733)
@@ -0,0 +1,59 @@
+PXrubrica パッケージ
+====================
+
+LaTeX: 日本の慣習に従ったルビ(振り仮名)出力
+
+JIS 規格「JIS X 4051」および W3C 技術ノート「[日本語組版処理の要件]」
+で述べられているような、日本において一般的な様式に従ってルビを付ける
+機能を提供する。
+
+[日本語組版処理の要件]: <http://www.w3.org/TR/jlreq/ja/>
+
+### 前提環境
+
+  * フォーマット: LaTeX
+  * エンジン: pTeX/upTeX/LuaTeX/XeTeX
+  * DVI ウェア: pTeX 対応のもの
+
+### 構成物
+
+  * `pxrubrica.pdf`: 説明書
+  * `pxrubrica.dtx`: DocStrip ソースファイル
+  * `pxrubrica.ins`: DocStrip インストーラファイル
+  * `pxrubrica-en.pdf`: 英語版の説明書
+  * `pxrubrica-en.tex`: 英語版の説明書(ソース)
+  * `sample/*.tex`: サンプル文書
+
+### インストール
+
+アーカイブにパッケージファイル(`*.sty`)が含まれていない場合は、
+以下のコマンドを実行して生成する。
+
+    ptex -kanji=jis pxrubrica.ins
+
+その後、各ファイルを次の場所に移動する。
+(TDS 1.1 に従ったシステムの場合。)
+
+  - `*.sty`         → $TEXMF/tex/platex/pxrubrica/
+  - `*.dtx`/`*.ins` → $TEXMF/source/platex/pxrubrica/
+  - `*.pdf`/`*.tex` → $TEXMF/doc/platex/pxrubrica/
+
+### ライセンス
+
+MITライセンスの下で配布される。
+
+更新履歴
+--------
+
+  * Version 1.1  〈2017/04/10〉
+      - XeTeX/LuaTeX のサポート。
+      - 両側ルビの処理を改良。
+      - バグ修正
+  * Version 1.0a 〈2014/12/23〉
+      - バグ修正
+  * Version 1.0  〈2012/04/30〉
+      - 最初の公開版
+
+--------------------
+Takayuki YATO (aka. "ZR")  
+http://zrbabbler.sp.land.to/


Property changes on: trunk/Master/texmf-dist/doc/platex/pxrubrica/README-ja.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/platex/pxrubrica/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/platex/pxrubrica/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/platex/pxrubrica/README.md	2017-04-10 21:39:50 UTC (rev 43733)
@@ -0,0 +1,61 @@
+PXrubrica Package
+=================
+
+LaTeX: Ruby annotations according to JIS X 4051
+
+This package provides function to add ruby annotation (furigana) that
+follows the style conventional in Japanese typography, as described in
+the W3C technical note “Requirements for Japanese Text Layout” ([JLREQ])
+and the JIS specification JIS X 4051.
+
+[JLREQ]: <http://www.w3.org/TR/jlreq/>
+
+### SYSTEM REQUIREMENTS
+
+  * TeX format: LaTeX.
+  * TeX engine: pTeX and its derivatives.
+  * DVI driver: Anything that supports pTeX DVI.
+
+### CONTENT
+
+  * `pxrubrica.pdf`: the manual in Japanese
+  * `pxrubrica.dtx`: DocStrip source file
+  * `pxrubrica.ins`: DocStrip installer file
+  * `pxrubrica-en.pdf`: the brief manual in English
+  * `pxrubrica-en.tex`: the brief manual in English (source)
+  * `sample/*.tex`: sample documents
+
+### INSTALLATION
+
+If the archive does not contain the packge file (`*.sty`), then you
+must run the command to create it:
+
+    ptex -kanji=jis pxrubrica.ins
+
+Then move the files as follows (in a system compliant to TDS 1.1):
+
+  - `*.sty`         → $TEXMF/tex/platex/pxrubrica/
+  - `*.dtx`/`*.ins` → $TEXMF/source/platex/pxrubrica/
+  - `*.pdf`/`*.tex` → $TEXMF/doc/platex/pxrubrica/
+
+And rehash your TEXMF trees if necessary.
+
+### LICENSE
+
+This package is distributed under the MIT License.
+
+Revision History
+----------------
+
+  * Version 1.1  〈2017/04/10〉
+      - Support for XeTeX/LuaTeX.
+      - Improve the process of two-side ruby.
+      - Bug fix.
+  * Version 1.0a <2014/12/23>
+      - Bug hix.
+  * Version 1.0  <2012/04/30>
+      - First public release.
+
+--------------------
+Takayuki YATO (aka. "ZR")  
+http://zrbabbler.sp.land.to/


Property changes on: trunk/Master/texmf-dist/doc/platex/pxrubrica/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/platex/pxrubrica/pxrubrica-en.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/platex/pxrubrica/pxrubrica-en.tex
===================================================================
--- trunk/Master/texmf-dist/doc/platex/pxrubrica/pxrubrica-en.tex	2017-04-10 13:51:08 UTC (rev 43732)
+++ trunk/Master/texmf-dist/doc/platex/pxrubrica/pxrubrica-en.tex	2017-04-10 21:39:50 UTC (rev 43733)
@@ -8,14 +8,14 @@
 \newcommand*{\Eg}{E.\,g.\mbox{}}
 \newcommand*{\eg}{e.\,g.\mbox{}}
 \newcommand*{\ie}{i.\,e.\mbox{}}
-\newcommand*{\myfileversion}{1.0}
-\newcommand*{\myfiledate}{2011/09/04}
+\newcommand*{\myfileversion}{1.1}
+\newcommand*{\myfiledate}{2017/04/10}
 \newsavebox{\myexample}
 \begin{document}
 
 \title{The \PKN{pxrubrica} package}
 \author{Takayuki YATO\quad (aka ``ZR'')}
-\date{\myfileversion \quad[\myfiledate]}
+\date{v\myfileversion \quad[\myfiledate]}
 \maketitle
 
 \setstretch{1.5}

Modified: trunk/Master/texmf-dist/doc/platex/pxrubrica/pxrubrica.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/platex/pxrubrica/pxrubrica.dtx
===================================================================
--- trunk/Master/texmf-dist/source/platex/pxrubrica/pxrubrica.dtx	2017-04-10 13:51:08 UTC (rev 43732)
+++ trunk/Master/texmf-dist/source/platex/pxrubrica/pxrubrica.dtx	2017-04-10 21:39:50 UTC (rev 43733)
@@ -1,23 +1,16 @@
 % ^^A -*- japanese-latex -*-
 % \iffalse meta-comment
 %
+% This is file 'pxrubrica.dtx'.
+% 
+% Copyright (c) 2017 Takayuki YATO (aka. "ZR")
+%   GitHub:   https://github.com/zr-tex8r
+%   Twitter:  @zr_tex8r
+%
+% This package is distributed under the MIT License.
+%
 % \fi
 % \CheckSum{0}
-%% \CharacterTable
-%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-%%   Digits        \0\1\2\3\4\5\6\7\8\9
-%%   Exclamation   \!     Double quote  \"     Hash (number) \#
-%%   Dollar        \$     Percent       \%     Ampersand     \&
-%%   Acute accent  \'     Left paren    \(     Right paren   \)
-%%   Asterisk      \*     Plus          \+     Comma         \,
-%%   Minus         \-     Point         \.     Solidus       \/
-%%   Colon         \:     Semicolon     \;     Less than     \<
-%%   Equals        \=     Greater than  \>     Question mark \?
-%%   Commercial at \@     Left bracket  \[     Backslash     \\
-%%   Right bracket \]     Circumflex    \^     Underscore    \_
-%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
-%%   Right brace   \}     Tilde         \~}
 %
 % \iffalse
 %
@@ -27,7 +20,7 @@
 %<*driver>
 \ProvidesFile{pxrubrica.dtx}
 %</driver>
-  [2014/12/23 v1.0a PX Japanese-style ruby]
+  [2017/04/10 v1.1 PX Japanese-style ruby]
 %<*driver>
 \documentclass{jsarticle}
 \usepackage{doc}
@@ -51,6 +44,10 @@
 \newcommand*{\pad}{\hspace{0pt plus 10pt}\linebreak[0]}
 \newcommand*{\Means}{$B!'(B\ }
 \newcommand*{\Note}{\par\noindent $B"((B\ }
+\providecommand*{\pTeX}{p\TeX}
+\providecommand*{\upTeX}{u\pTeX}
+\providecommand*{\XeTeX}{XeTeX}
+\providecommand*{\LuaTeX}{Lua\TeX}
 \inhibitxspcode`$B!?(B=0
 \begin{document}
   \DocInput{pxrubrica.dtx}
@@ -716,6 +713,19 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\pxrr at warn@load at order}
+% Unicode {\TeX}$BMQ$NF|K\8lAHHG%Q%C%1!<%8!J(BLua{\TeX}-ja$BEy!K$O(B
+% $B$3$N%Q%C%1!<%8$h$jA0$KFI$_9~$`$Y$-$@$,!"8e$GFI$_9~$^$l$F$$$k(B
+% $B$3$H$,H=L@$7$?>l9g!#(B
+%    \begin{macrocode}
+\def\pxrr at warn@load at order#1{%
+  \pxrr at warn{%
+    This package should be loaded after '#1'%
+  }%
+}
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\pxrr at interror}
 % $BFbIt%(%i!<!#(B
 % $B$3$l$,=P$F$O$$$1$J$$!#(B{\small\texttt{:-)}}
@@ -882,10 +892,19 @@
 % $B!J(B|\ruby[no]breakjukugo|$B!K!#(B
 % $B%9%$%C%A!#(B
 %    \begin{macrocode}
-\newif\ifpxrr at break@jukugo \pxrr at edge@adjustfalse
+\newif\ifpxrr at break@jukugo \pxrr at break@jukugofalse
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\ifpxrr at safe@mode}
+% $B0BA4%b!<%I$G$"$k$+!#(B
+% $B!J(B|\ruby[no]safemode|$B!K!#(B
+% $B%9%$%C%A!#(B
+%    \begin{macrocode}
+\newif\ifpxrr at safe@mode \pxrr at safe@modefalse
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\ifpxrr at d@bprotr}
 % \begin{macro}{\ifpxrr at d@aprotr}
 % $BFM=P$r5v$9$+H]$+!#(B
@@ -910,7 +929,7 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\ifpxrr at d@athead}
+% \begin{macro}{\pxrr at d@athead}
 % $B8*IU$-!?CfIU$-$N at _Dj!#(B
 % |\rubysetup| $B$N(B |c|$B!?(B|h|$B!?(B|H| $B$N at _Dj!#(B
 % 0 = $BCfIU$-!J(B|c|$B!K!((B
@@ -1036,6 +1055,14 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\ifpxrr at athead@iven}
+% $B8*IU$-!?CfIU$-$N at _Dj$,L@<(E*$G$"$k$+!#(B
+% $B%9%$%C%A!#(B
+%    \begin{macrocode}
+\newif\ifpxrr at athead@given \pxrr at athead@givenfalse
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\pxrr at mode}
 % $B%b%N%k%S!J(B|m|$B!K!&%0%k!<%W%k%S!J(B|g|$B!K!&=O8l%k%S!J(B|j|$B!K$N$$$:$l$+!#(B
 % |\ruby| $B$N%*%W%7%g%s$N at _DjCM!#(B
@@ -1045,6 +1072,15 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\ifpxrr at mode@given}
+% $B4pK\%b!<%I$N at _Dj$,L@<(E*$G$"$k$+!#(B
+% $B%9%$%C%A!#(B
+%    \begin{macrocode}
+\newif\ifpxrr at mode@given \pxrr at mode@givenfalse
+\newif\ifpxrr at afintr \pxrr at afintrfalse
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\ifpxrr at abody}
 % $B%k%S$,(B |\aruby|$B!J2$J8?FJ8;zMQ!K$G$"$k$+!#(B
 % $B%9%$%C%A!#(B
@@ -1074,6 +1110,16 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\pxrr at revensp}
+% $B%k%SJ8;zNs6QEy3d$j$N at _Dj!#(B
+% 0 = $BL58z!((B1 = $BM-8z!#(B
+% $B at 0?tDj?t!#(B
+% \Note $BDL>o$OM-8z$@$,!"0BA4%b!<%I$G$OL58z$K$J$k!#(B
+%    \begin{macrocode}
+\chardef\pxrr at revensp=1
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\pxrr at fullsize}
 % $B>.=q$-J8;zJQ49$N at _Dj!#(B
 % 0 = $BL58z!((B1 = $BM-8z!#(B
@@ -1638,7 +1684,7 @@
 % \end{macro}
 %
 % \begin{macro}{\ifpxrr at in@ptex}
-% $B%(%s%8%s$,(B {p\TeX} $B7O!J(B{up\TeX} $B7O$r4^$`!K$G$"$k$+!#(B
+% $B%(%s%8%s$,(B{\pTeX}$B7O!J(B{\upTeX}$B7O$r4^$`!K$G$"$k$+!#(B
 % |\kansuji| $B$N%W%j%_%F%#%V%F%9%H$GH=Dj$9$k!#(B
 %    \begin{macrocode}
 \pxrr at ifprimitive\kansuji{%
@@ -1650,7 +1696,7 @@
 % \end{macro}
 %
 % \begin{macro}{\ifpxrr at in@uptex}
-% $B%(%s%8%s$,(B {up\TeX} $B7O$G$"$k$+!#(B
+% $B%(%s%8%s$,(B{\upTeX}$B7O$G$"$k$+!#(B
 % |\enablecjktoken| $B$N%W%j%_%F%#%V%F%9%H$GH=Dj$9$k!#(B
 %    \begin{macrocode}
 \pxrr at ifprimitive\enablecjktoken{%
@@ -1662,7 +1708,7 @@
 % \end{macro}
 %
 % \begin{macro}{\ifpxrr at in@xetex}
-% $B%(%s%8%s$,(B {XeTeX} $B7O$G$"$k$+!#(B
+% $B%(%s%8%s$,(B{\XeTeX}$B7O$G$"$k$+!#(B
 % |\XeTeXrevision| $B$N%W%j%_%F%#%V%F%9%H$GH=Dj$9$k!#(B
 %    \begin{macrocode}
 \pxrr at ifprimitive\XeTeXrevision{%
@@ -1673,16 +1719,82 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\ifpxrr at in@xecjk}
+% \PKN{xeCJK}$B%Q%C%1!<%8$,;HMQ$5$l$F$$$k$+!#(B
+%    \begin{macrocode}
+\@ifpackageloaded{xeCJK}{%
+  \pxrr at csletcs{ifpxrr at in@xecjk}{iftrue}%
+}{%
+  \pxrr at csletcs{ifpxrr at in@xecjk}{iffalse}%
+%    \end{macrocode}
+% $B$3$3$GL$FI9~$G$+$D%W%j%"%s%V%kKvHx$GFI$_9~$^$l$F$$$k>l9g$O7Y9p$9$k!#(B
+%    \begin{macrocode}
+  \AtBeginDocument{%
+    \@ifpackageloaded{xeCJK}{%
+      \pxrr at warn@load at order{xeCJK}%
+    }{}%
+  }%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifpxrr at in@luatex}
+% $B%(%s%8%s$,(B{\LuaTeX}$B7O$G$"$k$+!#(B
+% |\luatexrevision| $B$N%W%j%_%F%#%V%F%9%H$GH=Dj$9$k!#(B
+%    \begin{macrocode}
+\pxrr at ifprimitive\luatexrevision{%
+  \pxrr at csletcs{ifpxrr at in@luatex}{iftrue}%
+}{%
+  \pxrr at csletcs{ifpxrr at in@luatex}{iffalse}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifpxrr at in@luatexja}
+% \PKN{LuaTeX-ja}$B%Q%C%1!<%8$,;HMQ$5$l$F$$$k$+!#(B
+%    \begin{macrocode}
+\@ifpackageloaded{luatexja-core}{%
+  \pxrr at csletcs{ifpxrr at in@luatexja}{iftrue}%
+}{%
+  \pxrr at csletcs{ifpxrr at in@luatexja}{iffalse}%
+  \AtBeginDocument{%
+    \@ifpackageloaded{luatexja-core}{%
+      \pxrr at warn@load at order{LuaTeX-ja}%
+    }{}%
+  }%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+\ifpxrr at in@xetex
+\else\ifpxrr at in@luatex
+\else\ifpxrr at in@ptex
+\else
+  \pxrr at ifprimitive\pdftexrevision{%
+    \pxrr at warn{%
+      The engine in use seems to be pdfTeX,\MessageBreak
+      so safe mode is turned on%
+    }%
+    \AtEndOfPackage{%
+      \rubysafemode
+    }%
+  }
+\fi\fi\fi
+%    \end{macrocode}
+%
 % \begin{macro}{\ifpxrr at in@unicode}
 % $B!VOBJ8!WFbIt%3!<%I$,(BUnicode$B$G$"$k$+!#(B
 %    \begin{macrocode}
 \ifpxrr at in@xetex
   \pxrr at csletcs{ifpxrr at in@unicode}{iftrue}%
+\else\ifpxrr at in@luatex
+  \pxrr at csletcs{ifpxrr at in@unicode}{iftrue}%
 \else\ifpxrr at in@uptex
   \pxrr at csletcs{ifpxrr at in@unicode}{iftrue}%
 \else
   \pxrr at csletcs{ifpxrr at in@unicode}{iffalse}%
-\fi\fi
+\fi\fi\fi
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1737,22 +1849,37 @@
 % \begin{macro}{\pxrr at get@jchar at token}
 % |\pxrr at get@jchar at token\CS{|\jmeta{$B at 0?t(B}|}|\Means
 % $BFbItJ8;z%3!<%I$,(B\jmeta{$B at 0?t(B}$B$G$"$kOBJ8J8;z$N%H!<%/%s$rF@$k!#(B
+%
+% {\pTeX}$B7O$N>l9g!#(B|\kansuji| $B%H%j%C%/$rMxMQ$9$k!#(B
 %    \begin{macrocode}
-\def\pxrr at get@jchar at token#1#2{%
-  \begingroup
-    \kansujichar\@ne=#2\relax
-    \xdef\pxrr at x@gtempa{\kansuji\@ne}%
-  \endgroup
-  \let#1\pxrr at x@gtempa
-}
-\ifpxrr at in@unicode\else
-  \ifpxrr at in@ptex\else
-    \def\pxrr at get@jchar at token#1#2{%
-      \def#1{?}%
-    }
-  \fi
-\fi
+\ifpxrr at in@ptex
+  \def\pxrr at get@jchar at token#1#2{%
+    \begingroup
+      \kansujichar\@ne=#2\relax
+      \xdef\pxrr at x@gtempa{\kansuji\@ne}%
+    \endgroup
+    \let#1\pxrr at x@gtempa
+  }
 %    \end{macrocode}
+% Unicode$BBP1~(B{\TeX}$B$N>l9g!#(B|\lowercase| $B%H%j%C%/$rMxMQ$9$k!#(B
+%    \begin{macrocode}
+\else\ifpxrr at in@unicode
+  \def\pxrr at get@jchar at token#1#2{%
+    \begingroup
+      \lccode`\?=#2\relax
+      \lowercase{\xdef\pxrr at x@gtempa{?}}%
+    \endgroup
+    \let#1\pxrr at x@gtempa
+  }
+%    \end{macrocode}
+% $B$=$l0J30$G$O%@%_!<Dj5A!#(B
+%    \begin{macrocode}
+\else
+  \def\pxrr at get@jchar at token#1#2{%
+    \def#1{?}%
+  }
+\fi\fi
+%    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\pxrr at x@K}
@@ -1765,6 +1892,8 @@
 % \begin{macro}{\pxrr at get@iiskip}
 % |\pxrr at get@iiskip\CS|\Means
 % $B8=:_$N<B8z$NOBJ84V6uGr$NNL$r<hF@$9$k!#(B
+%
+% {\pTeX}$B7O$N>l9g!#(B
 %    \begin{macrocode}
 \ifpxrr at in@ptex
   \def\pxrr at get@iiskip#1{%
@@ -1791,11 +1920,28 @@
       \fi
     }%
   }
+%    \end{macrocode}
+%
+% \PKN{LuaTeX-ja}$B;HMQ$N>l9g!#(B
+%    \begin{macrocode}
+\else\ifpxrr at in@luatexja
+  \def\pxrr at get@iiskip#1{%
+    \edef#1{%
+      \ifnum\ltjgetparameter{autospacing}=\@ne
+        \ltjgetparameter{kanjiskip}%
+      \else \pxrr at zeropt
+      \fi
+    }%
+  }
+%    \end{macrocode}
+%
+% $B$=$l0J30$N>l9g$O%<%m$H$9$k!#(B
+%    \begin{macrocode}
 \else
   \def\pxrr at get@iiskip#1{%
     \let#1\pxrr at zeropt
   }
-\fi
+\fi\fi
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1802,6 +1948,8 @@
 % \begin{macro}{\pxrr at get@iaiskip}
 % |\pxrr at get@iaiskip\CS|\Means
 % $B8=:_$N<B8z$NOB2$J84V6uGr$NNL$r<hF@$9$k!#(B
+%
+% {\pTeX}$B7O$N>l9g!#(B
 %    \begin{macrocode}
 \ifpxrr at in@ptex
   \def\pxrr at get@iaiskip#1{%
@@ -1821,17 +1969,43 @@
       \fi
     }%
   }
-\else
+%    \end{macrocode}
+%
+% \PKN{LuaTeX-ja}$B;HMQ$N>l9g!#(B
+%    \begin{macrocode}
+\else\ifpxrr at in@luatexja
   \def\pxrr at get@iaiskip#1{%
-    \let#1\pxrr at zeropt
+    \edef#1{%
+      \ifnum\ltjgetparameter{autoxspacing}=\@ne
+        \ltjgetparameter{xkanjiskip}%
+      \else \pxrr at zeropt
+      \fi
+    }%
   }
-\fi
 %    \end{macrocode}
+%
+% $B$=$l0J30$N>l9g$O<B:]$NAHHG7k2L$+$iH=CG$9$k!#(B
+%    \begin{macrocode}
+\else
+  \def\pxrr at get@iaiskip#1{%
+    \begingroup
+      \setbox\z@\hbox{M\pxrr at x@K}%
+      \setbox\tw@\hbox{M\vrule\@width\z@\relax\pxrr at x@K}%
+      \@tempdima\wd\z@ \advance\@tempdima-\wd\tw@
+      \@tempdimb\@tempdima \divide\@tempdimb\thr@@
+      \xdef\pxrr at x@gtempa{\the\@tempdima\space minus \the\@tempdimb}%
+    \endgroup
+    \let#1=\pxrr at x@gtempa
+  }%
+\fi\fi
+%    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\pxrr at get@zwidth}
 % |\pxrr at get@zwidth\CS|\Means
 % $B8=:_$NOBJ8%U%)%s%H$NA43QI}$r<hF@$9$k!#(B
+%
+% {\pTeX}$B$N>l9g!"(B|1zw| $B$G$h$$!#(B
 %    \begin{macrocode}
 \ifpxrr at in@ptex
   \def\pxrr at get@zwidth#1{%
@@ -1838,15 +2012,78 @@
     \@tempdima=1zw\relax
     \edef#1{\the\@tempdima}%
   }
+%    \end{macrocode}
+%
+% |\zw| $B$,Dj5A$5$l$F$$$k>l9g$O(B |1\zw| $B$H$9$k!#(B
+%    \begin{macrocode}
+\else\if\ifx\zw\@undefined T\else F\fi F% if defined
+  \def\pxrr at get@zwidth#1{%
+    \@tempdima=1\zw\relax
+    \edef#1{\the\@tempdima}%
+  }
+%    \end{macrocode}
+%
+% |\jsZw| $B$,Dj5A$5$l$F$$$k>l9g$O(B |1\jsZw| $B$H$9$k!#(B
+%    \begin{macrocode}
+\else\if\ifx\jsZw\@undefined T\else F\fi F% if defined
+  \def\pxrr at get@zwidth#1{%
+    \@tempdima=1\jsZw\relax
+    \edef#1{\the\@tempdima}%
+  }
+%    \end{macrocode}
+%
+% $B$=$l0J30$G!"(B|\pxrr at x@K| $B$,M-8z$J>l9g$O<B:]$NAHHG7k2L$+$iH=CG$9$k!#(B
+%    \begin{macrocode}
+\else\ifnum\pxrr at x@K>\@cclv
+  \def\pxrr at get@zwidth#1{%
+    \setbox\tw@\hbox{\pxrr at x@K}%
+    \@tempdima\wd\tw@
+    \ifdim\@tempdima>\z@\else \@tempdima\f at size\p@ \fi
+    \edef#1{\the\@tempdima}%
+  }
+%    \end{macrocode}
+%
+% $B$=$l0J30$N>l9g$OMW5a%5%$%:$HEy$7$$$H$9$k!#(B
+%    \begin{macrocode}
 \else
   \def\pxrr at get@zwidth#1{%
-    \@tempdima=1em\relax
+    \@tempdima\f at size\p@\relax
     \edef#1{\the\@tempdima}%
   }
-\fi
+\fi\fi\fi\fi
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\pxrr at get@prebreakpenalty}
+% |\pxrr at get@prebreakpenalty\CS{|\jmeta{$BJ8;z(B}|}|\Means
+% $BJ8;z$NA06XB'%Z%J%k%F%#CM$r at 0?t%l%8%9%?$KBeF~$9$k!#(B
+%
+% {\pTeX}$B$N>l9g!"(B|\prebreakpenalty| $B$r;H$&!#(B
+%    \begin{macrocode}
+\ifpxrr at in@ptex
+  \def\pxrr at get@prebreakpenalty#1#2{%
+    #1=\prebreakpenalty`#2\relax
+  }
+%    \end{macrocode}
+%
+% \PKN{LuaTeX-ja}$B;HMQ;~$O!"(Bprebreakpenalty $B%W%m%Q%F%#$rFI$_=P$9!#(B
+%    \begin{macrocode}
+\else\ifpxrr at in@luatexja
+  \def\pxrr at get@prebreakpenalty#1#2{%
+    #1=\ltjgetparameter{prebreakpenalty}{`#2}\relax
+  }
+%    \end{macrocode}
+%
+% $B$=$l0J30$N>l9g$O%<%m$H$7$F07$&!#(B
+%    \begin{macrocode}
+\else
+  \def\pxrr at get@prebreakpenalty#1#2{%
+    #1=\z@
+  }
+\fi\fi
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{$B%Q%i%a%?@_Dj8x3+L?Na(B}
 %
 % \begin{macro}{\ifpxrr at in@setup}
@@ -1944,6 +2181,7 @@
 %    \begin{macrocode}
 \newcommand*\rubyuseaghost{%
   \pxrr at aghosttrue
+  \pxrr at setup@aghost
 }
 \newcommand*\rubynouseaghost{%
   \pxrr at aghostfalse
@@ -1980,6 +2218,20 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\rubysafemode}
+% \begin{macro}{\rubynosafemode}
+% $BBP1~$9$k%9%$%C%A$r at _Dj$9$k!#(B
+%    \begin{macrocode}
+\newcommand*\rubysafemode{%
+  \pxrr at safe@modetrue
+}
+\newcommand*\rubynosafemode{%
+  \pxrr at safe@modefalse
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}{\rubystretchprop}
 % \begin{macro}{\rubystretchprophead}
 % \begin{macro}{\rubystretchpropend}
@@ -2074,6 +2326,11 @@
   \pxrr at bfintrfalse
   \pxrr at afintrfalse
 %    \end{macrocode}
+% $BL@<(%U%i%0$r56$K$9$k!#(B
+%    \begin{macrocode}
+  \pxrr at mode@givenfalse
+  \pxrr at athead@givenfalse
+%    \end{macrocode}
 % $BM-8B>uBV5!3#$r3+;O$5$;$k!#(B
 % $BF~NO$NKvHx$K(B |@| $B$r2C$($F$$$k!#(B
 % |\pxrr at end| $B$O%(%i!<;~$NC&=P$KMQ$$$k!#(B
@@ -2263,21 +2520,27 @@
 }
 \def\pxrr at po@PR at c{%
   \chardef\pxrr at athead\z@
+  \pxrr at athead@giventrue
 }
 \def\pxrr at po@PR at h{%
   \chardef\pxrr at athead\@ne
+  \pxrr at athead@giventrue
 }
 \def\pxrr at po@PR at H{%
   \chardef\pxrr at athead\tw@
+  \pxrr at athead@giventrue
 }
 \def\pxrr at po@PR at m{%
   \let\pxrr at mode=m%
+  \pxrr at mode@giventrue
 }
 \def\pxrr at po@PR at g{%
   \let\pxrr at mode=g%
+  \pxrr at mode@giventrue
 }
 \def\pxrr at po@PR at j{%
   \let\pxrr at mode=j%
+  \pxrr at mode@giventrue
 }
 \def\pxrr at po@PR at P{%
   \chardef\pxrr at side\z@
@@ -2368,26 +2631,27 @@
     \pxrr at fatal@bad at intr
   \fi
 %    \end{macrocode}
-% $B%b%N%k%S!J(B|m|$B!K!&=O8l%k%S!J(B|j|$B!K$K4X$9$k8!::!#(B
+% $B2$J8%k%S$G$O%b%N%k%S!J(B|m|$B!K!&=O8l%k%S!J(B|j|$B!K$O;XDjIT2D$J$N$G!"(B
+% $B%0%k!<%W%k%S$KJQ99$9$k!#(B
+% $B$3$N;~$KL@<(;XDj$G$"$k>l9g$O7Y9p$r=P$9!#(B
 %    \begin{macrocode}
   \if g\pxrr at mode\else
-%    \end{macrocode}
-% $B2$J8%k%S$G$OIT2D$J$N$G%0%k!<%W%k%S$KJQ99$9$k!#(B
-%    \begin{macrocode}
     \ifpxrr at abody
       \let\pxrr at mode=g\relax
+      \ifpxrr at mode@given
+        \pxrr at warn@must at group
+      \fi
     \fi
+  \fi
 %    \end{macrocode}
-% $BN>B&%k%S$G$OIT2D$J$N$G%0%k!<%W%k%S$KJQ99$9$k!#(B
+% $BN>B&%k%S$G$O%b%N%k%S!J(B|m|$B!K!&=O8l%k%S!J(B|j|$B!K$O;XDjIT2D$J$N$G!"(B
+% $B%0%k!<%W%k%S$KJQ99$9$k!#(B
+% $B$3$N;~$KL@<(;XDj$G$"$k>l9g$O7Y9p$r=P$9!#(B
 %    \begin{macrocode}
+  \if g\pxrr at mode\else
     \ifnum\pxrr at side=\tw@
       \let\pxrr at mode=g\relax
-    \fi
-%    \end{macrocode}
-% $B0J>e$N(B2$B$D$N>l9g$K$D$$$F!"L@<(;XDj$G$"$l$P7Y9p$r=P$9!#(B
-%    \begin{macrocode}
-    \if g\pxrr at mode
-      \if g\pxrr at d@mode
+      \ifpxrr at mode@given
         \pxrr at warn@must at group
       \fi
     \fi
@@ -2400,19 +2664,19 @@
 % $B2#AH$_$G$OIT2D$J$N$GCfIU$-$KJQ99$9$k!#(B
 %    \begin{macrocode}
     \ifpxrr at in@tate\else
-      \pxrr at athead\z@
+      \chardef\pxrr at athead\z@
     \fi
 %    \end{macrocode}
 % $B%0%k!<%W%k%S$G$OIT2D$J$N$GCfIU$-$KJQ99$9$k!#(B
 %    \begin{macrocode}
     \if g\pxrr at mode
-      \pxrr at athead\z@
+      \chardef\pxrr at athead\z@
     \fi
 %    \end{macrocode}
 % $B0J>e$N(B2$B$D$N>l9g$K$D$$$F!"L@<(;XDj$G$"$l$P7Y9p$r=P$9!#(B
 %    \begin{macrocode}
     \ifnum\pxrr at athead=\z@
-      \ifnum\pxrr at d@athead>\z@
+      \ifpxrr at athead@given
         \pxrr at warn@bad at athead
       \fi
     \fi
@@ -2875,24 +3139,26 @@
 %
 % \begin{macro}{\pxrr at compose@block}
 % |\pxrr at compose@block{|\jmeta{$B%Q%?!<%s(B}|}{|^^A
-%r \jmeta{$B?FJ8;z%V%m%C%/(B}|}{|\jmeta{$B%k%SJ8;z%V%m%C%/(B}|}|\Means
+% \jmeta{$B?FJ8;z%V%m%C%/(B}|}{|\jmeta{$B%k%SJ8;z%V%m%C%/(B}|}|\Means
 % 1$B$D$N%V%m%C%/$NAHHG=hM}!#(B
 % \jmeta{$B%Q%?!<%s(B}$B$O(B |\pxrr at evenspace| $B$HF1$80UL#!#(B
 % $BFM=P$,$"$k$+$r(B |\ifpxrr at protr| $B$KJV$7!"A0$H8e$NFM=P$NNL$r(B
 % $B$=$l$>$l(B |\pxrr at bspace| $B$H(B |\pxrr at aspace| $B$KJV$9!#(B
 %    \begin{macrocode}
-\def\pxrr at compose@block{%
+\def\pxrr at compose@block#1#2#3{%
 %    \end{macrocode}
 % $BK\BN$NA0$K2C9)=hM}$r2pF~$5$;$k!#(B
+% \Note |\pxrr at compose@block at pre| $B$O(B2$B$D$N%k%S0z?t$r<h$k!#(B
 % |\pxrr at compose@block at do| $B$KK\BN%^%/%m$r(B |\let| $B$9$k!#(B
 %    \begin{macrocode}
   \let\pxrr at compose@block at do\pxrr at compose@oneside at block@do
-  \pxrr at compose@block at pre
+  \pxrr at compose@block at pre{#1}{#2}{#3}{}%
 }
 %    \end{macrocode}
 % $B$3$A$i$,K\BN!#(B
 %    \begin{macrocode}
-\def\pxrr at compose@oneside at block@do#1#2#3{%
+% #4$B$O6u(B
+\def\pxrr at compose@oneside at block@do#1#2#3#4{%
   \setbox\pxrr at boxa\pxrr at hbox{#2}%
   \setbox\pxrr at boxr\pxrr at hbox{%
     \pxrr at use@ruby at font
@@ -3055,7 +3321,10 @@
 % \end{macro}
 %
 % \begin{macro}{\pxrr at compose@block at pre}
-% $B?FJ8;zNs$N2C9)$r9T$&!#(B
+% |\pxrr at compose@block at pre{|\jmeta{$B%Q%?!<%s(B}|}{|^^A
+%r \jmeta{$B?FJ8;z(B}|}{|\jmeta{$B%k%S(B1}|}{|\jmeta{$B%k%S(B2}|}|\Means
+% $B?FJ8;zNs!&%k%SJ8;zNs$N2C9)$r9T$&!#(B
+% \Note $BN>B&%k%SBP1~$N$?$a!"%k%SMQ0z?t$,(B2$B$D$"$k!#(B
 %    \begin{macrocode}
 \def\pxrr at compose@block at pre{%
 %    \end{macrocode}
@@ -3064,27 +3333,48 @@
   \pxrr at ifnum{\pxrr at fullsize>\z@}{%
     \pxrr at compose@block at pre@a
   }{%
-    \pxrr at compose@block at pre@c
+    \pxrr at compose@block at pre@d
   }%
 }
-\def\pxrr at compose@block at pre@a#1#2#3{%
-  \def\pxrr at compose@block at tempa{#3}%
+% {$B%Q%?!<%s(B}{$B?FJ8;z(B}{$B%k%S(B1}{$B%k%S(B2}
+\def\pxrr at compose@block at pre@a#1#2#3#4{%
+  \def\pxrr at compose@block at tempa{#4}%
   \pxrr at transform@kana\pxrr at compose@block at tempa
   \expandafter\pxrr at compose@block at pre@b
-   \expandafter{\pxrr at compose@block at tempa}{#1}{#2}%
+   \expandafter{\pxrr at compose@block at tempa}{#1}{#2}{#3}%
 }
-\def\pxrr at compose@block at pre@b#1#2#3{%
-  \pxrr at compose@block at pre@c{#2}{#3}{#1}%
+% {$B%k%S(B2}{$B%Q%?!<%s(B}{$B?FJ8;z(B}{$B%k%S(B1}
+\def\pxrr at compose@block at pre@b#1#2#3#4{%
+  \def\pxrr at compose@block at tempa{#4}%
+  \pxrr at transform@kana\pxrr at compose@block at tempa
+  \expandafter\pxrr at compose@block at pre@c
+   \expandafter{\pxrr at compose@block at tempa}{#1}{#2}{#3}%
 }
-\def\pxrr at compose@block at pre@c{%
+% {$B%k%S(B1}{$B%k%S(B2}{$B%Q%?!<%s(B}{$B?FJ8;z(B}
+\def\pxrr at compose@block at pre@c#1#2#3#4{%
+  \pxrr at compose@block at pre@d{#3}{#4}{#1}{#2}%
+}
+\def\pxrr at compose@block at pre@d{%
   \pxrr at ifnum{\pxrr at evensp=\z@}{%
-    \pxrr at compose@block at pre@d
+    \pxrr at compose@block at pre@e
   }{%
+    \pxrr at compose@block at pre@f
+  }%
+}
+% {$B%Q%?!<%s(B}{$B?FJ8;z(B}
+\def\pxrr at compose@block at pre@e#1#2{%
+  \pxrr at compose@block at pre@f{#1}{{#2}}%
+}
+\def\pxrr at compose@block at pre@f{%
+  \pxrr at ifnum{\pxrr at revensp=\z@}{%
+    \pxrr at compose@block at pre@g
+  }{%
     \pxrr at compose@block at do
   }%
 }
-\def\pxrr at compose@block at pre@d#1#2{%
-  \pxrr at compose@block at do{#1}{{#2}}%
+% {$B%Q%?!<%s(B}{$B?FJ8;z(B}{$B%k%S(B1}{$B%k%S(B2}
+\def\pxrr at compose@block at pre@g#1#2#3#4{%
+  \pxrr at compose@block at do{#1}{#2}{{#3}}{{#4}}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3261,7 +3551,7 @@
   \pxrr at check@kinsoku at c#1#1%
 }
 \def\pxrr at check@kinsoku at c#1{%
-  \pxrr at cntr\prebreakpenalty`#1\relax
+  \pxrr at get@prebreakpenalty\pxrr at cntr{#1}%
   \pxrr at tempb
 }
 %    \end{macrocode}
@@ -3435,11 +3725,12 @@
         \hskip-\pxrr at intr@amount\relax
       \fi
 %    \end{macrocode}
-% $BCJMnKAF,$G$J$$>l9g!"%Z%J%k%F%#!";z4V6u$-$N%0%k!=!"?JF~MQ$N%0%k!=$r(B
+% $BCJMnKAF,$G$J$$>l9g!";z4V6u$-$N%0%k!=!"?JF~MQ$N%0%k!=$r(B
 % $B=gHV$KF~$l$k!#(B
+% \Note $B%Z%J%k%F%#$O(B |\pxrr at put@head at penalty| $B$G4{$KF~$l$F$$$k!#(B
 %    \begin{macrocode}
     \else
-      \penalty\pxrr at auto@penalty\relax
+%     \penalty\pxrr at auto@penalty\relax
       \hskip-\pxrr at intr@amount\relax
       \hskip\pxrr at auto@icspace\relax
     \fi
@@ -3448,6 +3739,27 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\pxrr at put@head at penalty}
+% $BA0B&$KJd=u;XDj$GDj$a$i$l$?CM$N%Z%J%k%F%#$rCV$/!#(B
+% $B8=:_0LCV$K4{$K%Z%J%k%F%#$,$"$k>l9g$O9g;;$9$k!#(B
+%    \begin{macrocode}
+\def\pxrr at put@head at penalty{%
+  \ifpxrr at ghost\else \ifpxrr at par@head\else
+    \ifpxrr at abody
+      \pxrr at intrude@setauto at a
+    \else
+      \pxrr at intrude@setauto at j
+    \fi
+    \ifnum\pxrr at auto@penalty=\z@\else
+      \pxrr at cnta\lastpenalty \unpenalty
+      \advance\pxrr at cnta\pxrr at auto@penalty\relax
+      \penalty\pxrr at cnta
+    \fi
+  \fi\fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsubsection{$B8eB&?JF~=hM}(B}
 %
 % \begin{macro}{\pxrr at intrude@end}
@@ -3673,6 +3985,9 @@
 \ifpxrrDebug
   \pxrr at debug@show at input
 \fi
+  \ifpxrr at safe@mode
+    \pxrr at setup@safe at mode
+  \fi
 %    \end{macrocode}
 % $BF~NO8!::$r9T$$!"%Q%9$7$?>l9g$OAHHG=hM}$K?J$`!#(B
 %    \begin{macrocode}
@@ -3722,6 +4037,9 @@
 \ifpxrrDebug
   \pxrr at debug@show at input
 \fi
+  \ifpxrr at safe@mode
+    \pxrr at setup@safe at mode
+  \fi
 %    \end{macrocode}
 % $BF~NO8!::$r9T$$!"%Q%9$7$?>l9g$OAHHG=hM}$K?J$`!#(B
 %    \begin{macrocode}
@@ -3737,6 +4055,18 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\pxrr at setup@safe at mode}
+% $B0BA4%b!<%IMQ$N at _Dj!#(B
+%    \begin{macrocode}
+\def\pxrr at setup@safe at mode{%
+  \let\pxrr at mode=g%
+  \chardef\pxrr at evensp\z@
+  \chardef\pxrr at revensp\z@
+  \chardef\pxrr at fullsize\z@
+}
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsubsection{$BF~NO8!::(B}
 %
 % $B%0%k!<%W!&J8;z$N8D?t$N8!::$r9T$&<jB3!#(B
@@ -3884,6 +4214,7 @@
   \pxrr at zip@list\pxrr at body@list\pxrr at ruby@list
   \let\pxrr at whole@list\pxrr at res
   \pxrr at check@par at head
+  \pxrr at put@head at penalty
   \pxrr at any@protrfalse
 \ifpxrrDebug
 \pxrr at debug@show at recomp
@@ -4001,6 +4332,7 @@
   \pxrr at zip@list\pxrr at body@list\pxrr at ruby@list
   \let\pxrr at whole@list\pxrr at res
   \pxrr at check@par at head
+  \pxrr at put@head at penalty
 \ifpxrrDebug
 \pxrr at debug@show at recomp
 \fi
@@ -4032,6 +4364,7 @@
 %    \begin{macrocode}
 \def\pxrr at ruby@main at tg{%
   \pxrr at check@par at head
+  \pxrr at put@head at penalty
   \let\pxrr at locate@sing@\pxrr at locate@inner
   \ifpxrr at aprotr\else
     \let\pxrr at locate@sing@\pxrr at locate@end
@@ -4107,23 +4440,24 @@
 % $B!J%0%k!<%WFb$G(B |\usefont{T1}{lmr}{m}{n}| $B$r8F$s$G$*$/$H!"(B
 % $BBg0hE*$K(B |\T1/lmr/m/n/2.5| $B$,Dj5A$5$l$k!#!K(B
 %    \begin{macrocode}
-\ifpxrr at aghost
+\def\pxrr at setup@aghost{%
+  \global\let\pxrr at setup@aghost\relax
   \IfFileExists{t1lmr.fd}{%
     \begingroup
-      \fontsize{2.5}{0}\usefont{T1}{lmr}{m}{n}
+      \fontsize{2.5}{0}\usefont{T1}{lmr}{m}{n}%
     \endgroup
-    \pxrr at letcs\pxrr at aghostfont{T1/lmr/m/n/2.5}%
-    \chardef\pxrr at aghostchar=23 % compwordmark
-    \def\pxrr at aghost{{\pxrr at aghostfont\pxrr at aghostchar}}%
-    \xspcode\pxrr at aghostchar=3 %
+    \global\pxrr at letcs\pxrr at aghostfont{T1/lmr/m/n/2.5}%
+    \global\chardef\pxrr at aghostchar=23 % compwordmark
+    \gdef\pxrr at aghost{{\pxrr at aghostfont\pxrr at aghostchar}}%
+    \global\xspcode\pxrr at aghostchar=3 %
   }{%else
-    \oxrr at warn{Ghost embedding for \string\aruby\space
+    \pxrr at warn{Ghost embedding for \string\aruby\space
       is disabled,\MessageBreak
       since package lmodern is missing}%
-    \pxrr at aghostfalse
-    \let\pxrr at aghosttrue\relax
+    \global\pxrr at aghostfalse
+    \global\let\pxrr at aghosttrue\relax
   }%
-\fi
+}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -4226,6 +4560,8 @@
     pxrr at aintr = \pxrr at aintr^^J%
     pxrr at athead = \the\pxrr at athead^^J%
     pxrr at mode = \meaning\pxrr at mode^^J%
+    ifpxrr at athead@given = \meaning\ifpxrr at athead@given^^J%
+    ifpxrr at mode@given = \meaning\ifpxrr at mode@given^^J%
     pxrr at body@list = \meaning\pxrr at body@list^^J%
     pxrr at body@count = \@nameuse{pxrr at body@count}^^J%
     pxrr at ruby@list = \meaning\pxrr at ruby@list^^J%

Modified: trunk/Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty
===================================================================
--- trunk/Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty	2017-04-10 13:51:08 UTC (rev 43732)
+++ trunk/Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty	2017-04-10 21:39:50 UTC (rev 43733)
@@ -20,24 +20,9 @@
 %% original source files, as listed above, are part of the
 %% same distribution. (The sources need not necessarily be
 %% in the same archive or directory.)
-%% \CharacterTable
-%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-%%   Digits        \0\1\2\3\4\5\6\7\8\9
-%%   Exclamation   \!     Double quote  \"     Hash (number) \#
-%%   Dollar        \$     Percent       \%     Ampersand     \&
-%%   Acute accent  \'     Left paren    \(     Right paren   \)
-%%   Asterisk      \*     Plus          \+     Comma         \,
-%%   Minus         \-     Point         \.     Solidus       \/
-%%   Colon         \:     Semicolon     \;     Less than     \<
-%%   Equals        \=     Greater than  \>     Question mark \?
-%%   Commercial at \@     Left bracket  \[     Backslash     \\
-%%   Right bracket \]     Circumflex    \^     Underscore    \_
-%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
-%%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{pxrubrica}
-  [2014/12/23 v1.0a PX Japanese-style ruby]
+  [2017/04/10 v1.1 PX Japanese-style ruby]
 \RequirePackage{keyval}
 \def\pxrr at pkgname{pxrubrica}
 \def\pxrr at error{%
@@ -104,6 +89,11 @@
     Feature of movable group ruby is disabled%
   }\pxrr at eh@fatal
 }
+\def\pxrr at warn@load at order#1{%
+  \pxrr at warn{%
+    This package should be loaded after '#1'%
+  }%
+}
 \def\pxrr at interror#1{%
   \pxrr at fatal@error{INTERNAL ERROR (#1)}%
   \pxrr at eh@fatal
@@ -129,7 +119,8 @@
 \newif\ifpxrr at aghost \pxrr at aghostfalse
 \def\pxrr at inter@gap{0}
 \newif\ifpxrr at edge@adjust \pxrr at edge@adjustfalse
-\newif\ifpxrr at break@jukugo \pxrr at edge@adjustfalse
+\newif\ifpxrr at break@jukugo \pxrr at break@jukugofalse
+\newif\ifpxrr at safe@mode \pxrr at safe@modefalse
 \newif\ifpxrr at d@bprotr \pxrr at d@bprotrtrue
 \newif\ifpxrr at d@aprotr \pxrr at d@aprotrtrue
 \def\pxrr at d@bintr{}
@@ -150,10 +141,14 @@
 \newif\ifpxrr at bfintr \pxrr at bfintrfalse
 \newif\ifpxrr at afintr \pxrr at afintrfalse
 \chardef\pxrr at athead=0
+\newif\ifpxrr at athead@given \pxrr at athead@givenfalse
 \let\pxrr at mode=\@undefined
+\newif\ifpxrr at mode@given \pxrr at mode@givenfalse
+\newif\ifpxrr at afintr \pxrr at afintrfalse
 \newif\ifpxrr at abody
 \chardef\pxrr at side=0
 \chardef\pxrr at evensp=1
+\chardef\pxrr at revensp=1
 \chardef\pxrr at fullsize=1
 \newif\ifpxrr at ok
 \newcount\pxrr at cnta
@@ -435,13 +430,54 @@
 }{%
   \pxrr at csletcs{ifpxrr at in@xetex}{iffalse}%
 }
+\@ifpackageloaded{xeCJK}{%
+  \pxrr at csletcs{ifpxrr at in@xecjk}{iftrue}%
+}{%
+  \pxrr at csletcs{ifpxrr at in@xecjk}{iffalse}%
+  \AtBeginDocument{%
+    \@ifpackageloaded{xeCJK}{%
+      \pxrr at warn@load at order{xeCJK}%
+    }{}%
+  }%
+}
+\pxrr at ifprimitive\luatexrevision{%
+  \pxrr at csletcs{ifpxrr at in@luatex}{iftrue}%
+}{%
+  \pxrr at csletcs{ifpxrr at in@luatex}{iffalse}%
+}
+\@ifpackageloaded{luatexja-core}{%
+  \pxrr at csletcs{ifpxrr at in@luatexja}{iftrue}%
+}{%
+  \pxrr at csletcs{ifpxrr at in@luatexja}{iffalse}%
+  \AtBeginDocument{%
+    \@ifpackageloaded{luatexja-core}{%
+      \pxrr at warn@load at order{LuaTeX-ja}%
+    }{}%
+  }%
+}
 \ifpxrr at in@xetex
+\else\ifpxrr at in@luatex
+\else\ifpxrr at in@ptex
+\else
+  \pxrr at ifprimitive\pdftexrevision{%
+    \pxrr at warn{%
+      The engine in use seems to be pdfTeX,\MessageBreak
+      so safe mode is turned on%
+    }%
+    \AtEndOfPackage{%
+      \rubysafemode
+    }%
+  }
+\fi\fi\fi
+\ifpxrr at in@xetex
   \pxrr at csletcs{ifpxrr at in@unicode}{iftrue}%
+\else\ifpxrr at in@luatex
+  \pxrr at csletcs{ifpxrr at in@unicode}{iftrue}%
 \else\ifpxrr at in@uptex
   \pxrr at csletcs{ifpxrr at in@unicode}{iftrue}%
 \else
   \pxrr at csletcs{ifpxrr at in@unicode}{iffalse}%
-\fi\fi
+\fi\fi\fi
 \def\pxrr at jc#1{%
   \pxrr at jc@a#1\pxrr at nil
 }
@@ -468,20 +504,27 @@
 \else
   \pxrr at csletcs{ifpxrr at in@tate}{iffalse}
 \fi
-\def\pxrr at get@jchar at token#1#2{%
-  \begingroup
-    \kansujichar\@ne=#2\relax
-    \xdef\pxrr at x@gtempa{\kansuji\@ne}%
-  \endgroup
-  \let#1\pxrr at x@gtempa
-}
-\ifpxrr at in@unicode\else
-  \ifpxrr at in@ptex\else
-    \def\pxrr at get@jchar at token#1#2{%
-      \def#1{?}%
-    }
-  \fi
-\fi
+\ifpxrr at in@ptex
+  \def\pxrr at get@jchar at token#1#2{%
+    \begingroup
+      \kansujichar\@ne=#2\relax
+      \xdef\pxrr at x@gtempa{\kansuji\@ne}%
+    \endgroup
+    \let#1\pxrr at x@gtempa
+  }
+\else\ifpxrr at in@unicode
+  \def\pxrr at get@jchar at token#1#2{%
+    \begingroup
+      \lccode`\?=#2\relax
+      \lowercase{\xdef\pxrr at x@gtempa{?}}%
+    \endgroup
+    \let#1\pxrr at x@gtempa
+  }
+\else
+  \def\pxrr at get@jchar at token#1#2{%
+    \def#1{?}%
+  }
+\fi\fi
 \pxrr at jchardef\pxrr at x@K=\pxrr at jc{306C:4E00}
 \ifpxrr at in@ptex
   \def\pxrr at get@iiskip#1{%
@@ -501,11 +544,20 @@
       \fi
     }%
   }
+\else\ifpxrr at in@luatexja
+  \def\pxrr at get@iiskip#1{%
+    \edef#1{%
+      \ifnum\ltjgetparameter{autospacing}=\@ne
+        \ltjgetparameter{kanjiskip}%
+      \else \pxrr at zeropt
+      \fi
+    }%
+  }
 \else
   \def\pxrr at get@iiskip#1{%
     \let#1\pxrr at zeropt
   }
-\fi
+\fi\fi
 \ifpxrr at in@ptex
   \def\pxrr at get@iaiskip#1{%
     \pxrr at x@swafalse
@@ -524,22 +576,68 @@
       \fi
     }%
   }
+\else\ifpxrr at in@luatexja
+  \def\pxrr at get@iaiskip#1{%
+    \edef#1{%
+      \ifnum\ltjgetparameter{autoxspacing}=\@ne
+        \ltjgetparameter{xkanjiskip}%
+      \else \pxrr at zeropt
+      \fi
+    }%
+  }
 \else
   \def\pxrr at get@iaiskip#1{%
-    \let#1\pxrr at zeropt
-  }
-\fi
+    \begingroup
+      \setbox\z@\hbox{M\pxrr at x@K}%
+      \setbox\tw@\hbox{M\vrule\@width\z@\relax\pxrr at x@K}%
+      \@tempdima\wd\z@ \advance\@tempdima-\wd\tw@
+      \@tempdimb\@tempdima \divide\@tempdimb\thr@@
+      \xdef\pxrr at x@gtempa{\the\@tempdima\space minus \the\@tempdimb}%
+    \endgroup
+    \let#1=\pxrr at x@gtempa
+  }%
+\fi\fi
 \ifpxrr at in@ptex
   \def\pxrr at get@zwidth#1{%
     \@tempdima=1zw\relax
     \edef#1{\the\@tempdima}%
   }
+\else\if\ifx\zw\@undefined T\else F\fi F% if defined
+  \def\pxrr at get@zwidth#1{%
+    \@tempdima=1\zw\relax
+    \edef#1{\the\@tempdima}%
+  }
+\else\if\ifx\jsZw\@undefined T\else F\fi F% if defined
+  \def\pxrr at get@zwidth#1{%
+    \@tempdima=1\jsZw\relax
+    \edef#1{\the\@tempdima}%
+  }
+\else\ifnum\pxrr at x@K>\@cclv
+  \def\pxrr at get@zwidth#1{%
+    \setbox\tw@\hbox{\pxrr at x@K}%
+    \@tempdima\wd\tw@
+    \ifdim\@tempdima>\z@\else \@tempdima\f at size\p@ \fi
+    \edef#1{\the\@tempdima}%
+  }
 \else
   \def\pxrr at get@zwidth#1{%
-    \@tempdima=1em\relax
+    \@tempdima\f at size\p@\relax
     \edef#1{\the\@tempdima}%
   }
-\fi
+\fi\fi\fi\fi
+\ifpxrr at in@ptex
+  \def\pxrr at get@prebreakpenalty#1#2{%
+    #1=\prebreakpenalty`#2\relax
+  }
+\else\ifpxrr at in@luatexja
+  \def\pxrr at get@prebreakpenalty#1#2{%
+    #1=\ltjgetparameter{prebreakpenalty}{`#2}\relax
+  }
+\else
+  \def\pxrr at get@prebreakpenalty#1#2{%
+    #1=\z@
+  }
+\fi\fi
 \newif\ifpxrr at in@setup \pxrr at in@setupfalse
 \newcommand*\rubysetup[1]{%
   \pxrr at in@setuptrue
@@ -585,6 +683,7 @@
 }
 \newcommand*\rubyuseaghost{%
   \pxrr at aghosttrue
+  \pxrr at setup@aghost
 }
 \newcommand*\rubynouseaghost{%
   \pxrr at aghostfalse
@@ -601,6 +700,12 @@
 \newcommand*\rubynobreakjukugo{%
   \pxrr at break@jukugofalse
 }
+\newcommand*\rubysafemode{%
+  \pxrr at safe@modetrue
+}
+\newcommand*\rubynosafemode{%
+  \pxrr at safe@modefalse
+}
 \newcommand*\rubystretchprop[3]{%
   \edef\pxrr at sprop@x{#1}%
   \edef\pxrr at sprop@y{#2}%
@@ -645,6 +750,8 @@
   \pxrr at anobrfalse
   \pxrr at bfintrfalse
   \pxrr at afintrfalse
+  \pxrr at mode@givenfalse
+  \pxrr at athead@givenfalse
   \def\pxrr at po@FS{bi}%
   \expandafter\pxrr at parse@option at loop\pxrr at tempa @\pxrr at end
 }
@@ -793,21 +900,27 @@
 }
 \def\pxrr at po@PR at c{%
   \chardef\pxrr at athead\z@
+  \pxrr at athead@giventrue
 }
 \def\pxrr at po@PR at h{%
   \chardef\pxrr at athead\@ne
+  \pxrr at athead@giventrue
 }
 \def\pxrr at po@PR at H{%
   \chardef\pxrr at athead\tw@
+  \pxrr at athead@giventrue
 }
 \def\pxrr at po@PR at m{%
   \let\pxrr at mode=m%
+  \pxrr at mode@giventrue
 }
 \def\pxrr at po@PR at g{%
   \let\pxrr at mode=g%
+  \pxrr at mode@giventrue
 }
 \def\pxrr at po@PR at j{%
   \let\pxrr at mode=j%
+  \pxrr at mode@giventrue
 }
 \def\pxrr at po@PR at P{%
   \chardef\pxrr at side\z@
@@ -880,12 +993,15 @@
   \if g\pxrr at mode\else
     \ifpxrr at abody
       \let\pxrr at mode=g\relax
+      \ifpxrr at mode@given
+        \pxrr at warn@must at group
+      \fi
     \fi
+  \fi
+  \if g\pxrr at mode\else
     \ifnum\pxrr at side=\tw@
       \let\pxrr at mode=g\relax
-    \fi
-    \if g\pxrr at mode
-      \if g\pxrr at d@mode
+      \ifpxrr at mode@given
         \pxrr at warn@must at group
       \fi
     \fi
@@ -892,13 +1008,13 @@
   \fi
   \ifnum\pxrr at athead>\z@
     \ifpxrr at in@tate\else
-      \pxrr at athead\z@
+      \chardef\pxrr at athead\z@
     \fi
     \if g\pxrr at mode
-      \pxrr at athead\z@
+      \chardef\pxrr at athead\z@
     \fi
     \ifnum\pxrr at athead=\z@
-      \ifnum\pxrr at d@athead>\z@
+      \ifpxrr at athead@given
         \pxrr at warn@bad at athead
       \fi
     \fi
@@ -1135,11 +1251,11 @@
 \newif\ifpxrr at protr
 \newif\ifpxrr at any@protr
 \def\pxrr at epsilon{0.01pt}
-\def\pxrr at compose@block{%
+\def\pxrr at compose@block#1#2#3{%
   \let\pxrr at compose@block at do\pxrr at compose@oneside at block@do
-  \pxrr at compose@block at pre
+  \pxrr at compose@block at pre{#1}{#2}{#3}{}%
 }
-\def\pxrr at compose@oneside at block@do#1#2#3{%
+\def\pxrr at compose@oneside at block@do#1#2#3#4{%
   \setbox\pxrr at boxa\pxrr at hbox{#2}%
   \setbox\pxrr at boxr\pxrr at hbox{%
     \pxrr at use@ruby at font
@@ -1257,27 +1373,43 @@
   \pxrr at ifnum{\pxrr at fullsize>\z@}{%
     \pxrr at compose@block at pre@a
   }{%
-    \pxrr at compose@block at pre@c
+    \pxrr at compose@block at pre@d
   }%
 }
-\def\pxrr at compose@block at pre@a#1#2#3{%
-  \def\pxrr at compose@block at tempa{#3}%
+\def\pxrr at compose@block at pre@a#1#2#3#4{%
+  \def\pxrr at compose@block at tempa{#4}%
   \pxrr at transform@kana\pxrr at compose@block at tempa
   \expandafter\pxrr at compose@block at pre@b
-   \expandafter{\pxrr at compose@block at tempa}{#1}{#2}%
+   \expandafter{\pxrr at compose@block at tempa}{#1}{#2}{#3}%
 }
-\def\pxrr at compose@block at pre@b#1#2#3{%
-  \pxrr at compose@block at pre@c{#2}{#3}{#1}%
+\def\pxrr at compose@block at pre@b#1#2#3#4{%
+  \def\pxrr at compose@block at tempa{#4}%
+  \pxrr at transform@kana\pxrr at compose@block at tempa
+  \expandafter\pxrr at compose@block at pre@c
+   \expandafter{\pxrr at compose@block at tempa}{#1}{#2}{#3}%
 }
-\def\pxrr at compose@block at pre@c{%
+\def\pxrr at compose@block at pre@c#1#2#3#4{%
+  \pxrr at compose@block at pre@d{#3}{#4}{#1}{#2}%
+}
+\def\pxrr at compose@block at pre@d{%
   \pxrr at ifnum{\pxrr at evensp=\z@}{%
-    \pxrr at compose@block at pre@d
+    \pxrr at compose@block at pre@e
   }{%
+    \pxrr at compose@block at pre@f
+  }%
+}
+\def\pxrr at compose@block at pre@e#1#2{%
+  \pxrr at compose@block at pre@f{#1}{{#2}}%
+}
+\def\pxrr at compose@block at pre@f{%
+  \pxrr at ifnum{\pxrr at revensp=\z@}{%
+    \pxrr at compose@block at pre@g
+  }{%
     \pxrr at compose@block at do
   }%
 }
-\def\pxrr at compose@block at pre@d#1#2{%
-  \pxrr at compose@block at do{#1}{{#2}}%
+\def\pxrr at compose@block at pre@g#1#2#3#4{%
+  \pxrr at compose@block at do{#1}{#2}{{#3}}{{#4}}%
 }
 \def\pxrr at add@protect#1{%
   \expandafter\pxrr at add@protect at a
@@ -1345,7 +1477,7 @@
   \pxrr at check@kinsoku at c#1#1%
 }
 \def\pxrr at check@kinsoku at c#1{%
-  \pxrr at cntr\prebreakpenalty`#1\relax
+  \pxrr at get@prebreakpenalty\pxrr at cntr{#1}%
   \pxrr at tempb
 }
 \def\pxrr at tempa#1#2\pxrr at nil{%
@@ -1416,12 +1548,25 @@
         \hskip-\pxrr at intr@amount\relax
       \fi
     \else
-      \penalty\pxrr at auto@penalty\relax
       \hskip-\pxrr at intr@amount\relax
       \hskip\pxrr at auto@icspace\relax
     \fi
   \fi
 }
+\def\pxrr at put@head at penalty{%
+  \ifpxrr at ghost\else \ifpxrr at par@head\else
+    \ifpxrr at abody
+      \pxrr at intrude@setauto at a
+    \else
+      \pxrr at intrude@setauto at j
+    \fi
+    \ifnum\pxrr at auto@penalty=\z@\else
+      \pxrr at cnta\lastpenalty \unpenalty
+      \advance\pxrr at cnta\pxrr at auto@penalty\relax
+      \penalty\pxrr at cnta
+    \fi
+  \fi\fi
+}
 \def\pxrr at intrude@end{%
   \ifpxrr at ghost\else
     \let\pxrr at intr@amount\pxrr at aspace
@@ -1530,6 +1675,9 @@
 \ifpxrrDebug
   \pxrr at debug@show at input
 \fi
+  \ifpxrr at safe@mode
+    \pxrr at setup@safe at mode
+  \fi
   \pxrr at if@alive{%
     \if g\pxrr at mode
       \pxrr at ruby@check at g
@@ -1555,6 +1703,9 @@
 \ifpxrrDebug
   \pxrr at debug@show at input
 \fi
+  \ifpxrr at safe@mode
+    \pxrr at setup@safe at mode
+  \fi
   \pxrr at if@alive{%
     \pxrr at ruby@check at tg
     \pxrr at if@alive{\pxrr at ruby@main at tg}%
@@ -1561,6 +1712,12 @@
   }%
   \pxrr at ruby@exit
 }
+\def\pxrr at setup@safe at mode{%
+  \let\pxrr at mode=g%
+  \chardef\pxrr at evensp\z@
+  \chardef\pxrr at revensp\z@
+  \chardef\pxrr at fullsize\z@
+}
 \def\pxrr at ruby@check at g{%
   \ifnum\pxrr at body@count=\pxrr at ruby@count\relax
     \ifnum\pxrr at body@count=\@ne\else
@@ -1624,6 +1781,7 @@
   \pxrr at zip@list\pxrr at body@list\pxrr at ruby@list
   \let\pxrr at whole@list\pxrr at res
   \pxrr at check@par at head
+  \pxrr at put@head at penalty
   \pxrr at any@protrfalse
 \ifpxrrDebug
 \pxrr at debug@show at recomp
@@ -1705,6 +1863,7 @@
   \pxrr at zip@list\pxrr at body@list\pxrr at ruby@list
   \let\pxrr at whole@list\pxrr at res
   \pxrr at check@par at head
+  \pxrr at put@head at penalty
 \ifpxrrDebug
 \pxrr at debug@show at recomp
 \fi
@@ -1727,6 +1886,7 @@
 }
 \def\pxrr at ruby@main at tg{%
   \pxrr at check@par at head
+  \pxrr at put@head at penalty
   \let\pxrr at locate@sing@\pxrr at locate@inner
   \ifpxrr at aprotr\else
     \let\pxrr at locate@sing@\pxrr at locate@end
@@ -1754,23 +1914,24 @@
       \kern-\wd\pxrr at boxa
     \fi
 }
-\ifpxrr at aghost
+\def\pxrr at setup@aghost{%
+  \global\let\pxrr at setup@aghost\relax
   \IfFileExists{t1lmr.fd}{%
     \begingroup
-      \fontsize{2.5}{0}\usefont{T1}{lmr}{m}{n}
+      \fontsize{2.5}{0}\usefont{T1}{lmr}{m}{n}%
     \endgroup
-    \pxrr at letcs\pxrr at aghostfont{T1/lmr/m/n/2.5}%
-    \chardef\pxrr at aghostchar=23 % compwordmark
-    \def\pxrr at aghost{{\pxrr at aghostfont\pxrr at aghostchar}}%
-    \xspcode\pxrr at aghostchar=3 %
+    \global\pxrr at letcs\pxrr at aghostfont{T1/lmr/m/n/2.5}%
+    \global\chardef\pxrr at aghostchar=23 % compwordmark
+    \gdef\pxrr at aghost{{\pxrr at aghostfont\pxrr at aghostchar}}%
+    \global\xspcode\pxrr at aghostchar=3 %
   }{%else
-    \oxrr at warn{Ghost embedding for \string\aruby\space
+    \pxrr at warn{Ghost embedding for \string\aruby\space
       is disabled,\MessageBreak
       since package lmodern is missing}%
-    \pxrr at aghostfalse
-    \let\pxrr at aghosttrue\relax
+    \global\pxrr at aghostfalse
+    \global\let\pxrr at aghosttrue\relax
   }%
-\fi
+}
 \def\pxrr at aprologue{%
   \ifpxrr at aghost
     \pxrr at aghost
@@ -1832,6 +1993,8 @@
     pxrr at aintr = \pxrr at aintr^^J%
     pxrr at athead = \the\pxrr at athead^^J%
     pxrr at mode = \meaning\pxrr at mode^^J%
+    ifpxrr at athead@given = \meaning\ifpxrr at athead@given^^J%
+    ifpxrr at mode@given = \meaning\ifpxrr at mode@given^^J%
     pxrr at body@list = \meaning\pxrr at body@list^^J%
     pxrr at body@count = \@nameuse{pxrr at body@count}^^J%
     pxrr at ruby@list = \meaning\pxrr at ruby@list^^J%



More information about the tex-live-commits mailing list