summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/platex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-04-10 21:39:50 +0000
committerKarl Berry <karl@freefriends.org>2017-04-10 21:39:50 +0000
commit274530355cd8be6472559c87f6e1a2b34e54970e (patch)
tree10789d4a03679db47d70901d2e2d31ef77faddc3 /Master/texmf-dist/tex/platex
parent553fc76e143dd5a37bfc90a2035b9f5412143169 (diff)
pxrubrica (10apr17)
git-svn-id: svn://tug.org/texlive/trunk@43733 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/platex')
-rw-r--r--Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty301
1 files changed, 232 insertions, 69 deletions
diff --git a/Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty b/Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty
index 5c6bd7beb7c..7e3b4156551 100644
--- a/Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty
+++ b/Master/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty
@@ -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@pkgname{pxrubrica}
\def\pxrr@error{%
@@ -104,6 +89,11 @@
Feature of movable group ruby is disabled%
}\pxrr@eh@fatal
}
+\def\pxrr@warn@load@order#1{%
+ \pxrr@warn{%
+ This package should be loaded after '#1'%
+ }%
+}
\def\pxrr@interror#1{%
\pxrr@fatal@error{INTERNAL ERROR (#1)}%
\pxrr@eh@fatal
@@ -129,7 +119,8 @@
\newif\ifpxrr@aghost \pxrr@aghostfalse
\def\pxrr@inter@gap{0}
\newif\ifpxrr@edge@adjust \pxrr@edge@adjustfalse
-\newif\ifpxrr@break@jukugo \pxrr@edge@adjustfalse
+\newif\ifpxrr@break@jukugo \pxrr@break@jukugofalse
+\newif\ifpxrr@safe@mode \pxrr@safe@modefalse
\newif\ifpxrr@d@bprotr \pxrr@d@bprotrtrue
\newif\ifpxrr@d@aprotr \pxrr@d@aprotrtrue
\def\pxrr@d@bintr{}
@@ -150,10 +141,14 @@
\newif\ifpxrr@bfintr \pxrr@bfintrfalse
\newif\ifpxrr@afintr \pxrr@afintrfalse
\chardef\pxrr@athead=0
+\newif\ifpxrr@athead@given \pxrr@athead@givenfalse
\let\pxrr@mode=\@undefined
+\newif\ifpxrr@mode@given \pxrr@mode@givenfalse
+\newif\ifpxrr@afintr \pxrr@afintrfalse
\newif\ifpxrr@abody
\chardef\pxrr@side=0
\chardef\pxrr@evensp=1
+\chardef\pxrr@revensp=1
\chardef\pxrr@fullsize=1
\newif\ifpxrr@ok
\newcount\pxrr@cnta
@@ -435,13 +430,54 @@
}{%
\pxrr@csletcs{ifpxrr@in@xetex}{iffalse}%
}
+\@ifpackageloaded{xeCJK}{%
+ \pxrr@csletcs{ifpxrr@in@xecjk}{iftrue}%
+}{%
+ \pxrr@csletcs{ifpxrr@in@xecjk}{iffalse}%
+ \AtBeginDocument{%
+ \@ifpackageloaded{xeCJK}{%
+ \pxrr@warn@load@order{xeCJK}%
+ }{}%
+ }%
+}
+\pxrr@ifprimitive\luatexrevision{%
+ \pxrr@csletcs{ifpxrr@in@luatex}{iftrue}%
+}{%
+ \pxrr@csletcs{ifpxrr@in@luatex}{iffalse}%
+}
+\@ifpackageloaded{luatexja-core}{%
+ \pxrr@csletcs{ifpxrr@in@luatexja}{iftrue}%
+}{%
+ \pxrr@csletcs{ifpxrr@in@luatexja}{iffalse}%
+ \AtBeginDocument{%
+ \@ifpackageloaded{luatexja-core}{%
+ \pxrr@warn@load@order{LuaTeX-ja}%
+ }{}%
+ }%
+}
+\ifpxrr@in@xetex
+\else\ifpxrr@in@luatex
+\else\ifpxrr@in@ptex
+\else
+ \pxrr@ifprimitive\pdftexrevision{%
+ \pxrr@warn{%
+ The engine in use seems to be pdfTeX,\MessageBreak
+ so safe mode is turned on%
+ }%
+ \AtEndOfPackage{%
+ \rubysafemode
+ }%
+ }
+\fi\fi\fi
\ifpxrr@in@xetex
\pxrr@csletcs{ifpxrr@in@unicode}{iftrue}%
+\else\ifpxrr@in@luatex
+ \pxrr@csletcs{ifpxrr@in@unicode}{iftrue}%
\else\ifpxrr@in@uptex
\pxrr@csletcs{ifpxrr@in@unicode}{iftrue}%
\else
\pxrr@csletcs{ifpxrr@in@unicode}{iffalse}%
-\fi\fi
+\fi\fi\fi
\def\pxrr@jc#1{%
\pxrr@jc@a#1\pxrr@nil
}
@@ -468,20 +504,27 @@
\else
\pxrr@csletcs{ifpxrr@in@tate}{iffalse}
\fi
-\def\pxrr@get@jchar@token#1#2{%
- \begingroup
- \kansujichar\@ne=#2\relax
- \xdef\pxrr@x@gtempa{\kansuji\@ne}%
- \endgroup
- \let#1\pxrr@x@gtempa
-}
-\ifpxrr@in@unicode\else
- \ifpxrr@in@ptex\else
- \def\pxrr@get@jchar@token#1#2{%
- \def#1{?}%
- }
- \fi
-\fi
+\ifpxrr@in@ptex
+ \def\pxrr@get@jchar@token#1#2{%
+ \begingroup
+ \kansujichar\@ne=#2\relax
+ \xdef\pxrr@x@gtempa{\kansuji\@ne}%
+ \endgroup
+ \let#1\pxrr@x@gtempa
+ }
+\else\ifpxrr@in@unicode
+ \def\pxrr@get@jchar@token#1#2{%
+ \begingroup
+ \lccode`\?=#2\relax
+ \lowercase{\xdef\pxrr@x@gtempa{?}}%
+ \endgroup
+ \let#1\pxrr@x@gtempa
+ }
+\else
+ \def\pxrr@get@jchar@token#1#2{%
+ \def#1{?}%
+ }
+\fi\fi
\pxrr@jchardef\pxrr@x@K=\pxrr@jc{306C:4E00}
\ifpxrr@in@ptex
\def\pxrr@get@iiskip#1{%
@@ -501,11 +544,20 @@
\fi
}%
}
+\else\ifpxrr@in@luatexja
+ \def\pxrr@get@iiskip#1{%
+ \edef#1{%
+ \ifnum\ltjgetparameter{autospacing}=\@ne
+ \ltjgetparameter{kanjiskip}%
+ \else \pxrr@zeropt
+ \fi
+ }%
+ }
\else
\def\pxrr@get@iiskip#1{%
\let#1\pxrr@zeropt
}
-\fi
+\fi\fi
\ifpxrr@in@ptex
\def\pxrr@get@iaiskip#1{%
\pxrr@x@swafalse
@@ -524,22 +576,68 @@
\fi
}%
}
-\else
+\else\ifpxrr@in@luatexja
\def\pxrr@get@iaiskip#1{%
- \let#1\pxrr@zeropt
+ \edef#1{%
+ \ifnum\ltjgetparameter{autoxspacing}=\@ne
+ \ltjgetparameter{xkanjiskip}%
+ \else \pxrr@zeropt
+ \fi
+ }%
}
-\fi
+\else
+ \def\pxrr@get@iaiskip#1{%
+ \begingroup
+ \setbox\z@\hbox{M\pxrr@x@K}%
+ \setbox\tw@\hbox{M\vrule\@width\z@\relax\pxrr@x@K}%
+ \@tempdima\wd\z@ \advance\@tempdima-\wd\tw@
+ \@tempdimb\@tempdima \divide\@tempdimb\thr@@
+ \xdef\pxrr@x@gtempa{\the\@tempdima\space minus \the\@tempdimb}%
+ \endgroup
+ \let#1=\pxrr@x@gtempa
+ }%
+\fi\fi
\ifpxrr@in@ptex
\def\pxrr@get@zwidth#1{%
\@tempdima=1zw\relax
\edef#1{\the\@tempdima}%
}
+\else\if\ifx\zw\@undefined T\else F\fi F% if defined
+ \def\pxrr@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@get@zwidth#1{%
+ \@tempdima=1\jsZw\relax
+ \edef#1{\the\@tempdima}%
+ }
+\else\ifnum\pxrr@x@K>\@cclv
+ \def\pxrr@get@zwidth#1{%
+ \setbox\tw@\hbox{\pxrr@x@K}%
+ \@tempdima\wd\tw@
+ \ifdim\@tempdima>\z@\else \@tempdima\f@size\p@ \fi
+ \edef#1{\the\@tempdima}%
+ }
\else
\def\pxrr@get@zwidth#1{%
- \@tempdima=1em\relax
+ \@tempdima\f@size\p@\relax
\edef#1{\the\@tempdima}%
}
-\fi
+\fi\fi\fi\fi
+\ifpxrr@in@ptex
+ \def\pxrr@get@prebreakpenalty#1#2{%
+ #1=\prebreakpenalty`#2\relax
+ }
+\else\ifpxrr@in@luatexja
+ \def\pxrr@get@prebreakpenalty#1#2{%
+ #1=\ltjgetparameter{prebreakpenalty}{`#2}\relax
+ }
+\else
+ \def\pxrr@get@prebreakpenalty#1#2{%
+ #1=\z@
+ }
+\fi\fi
\newif\ifpxrr@in@setup \pxrr@in@setupfalse
\newcommand*\rubysetup[1]{%
\pxrr@in@setuptrue
@@ -585,6 +683,7 @@
}
\newcommand*\rubyuseaghost{%
\pxrr@aghosttrue
+ \pxrr@setup@aghost
}
\newcommand*\rubynouseaghost{%
\pxrr@aghostfalse
@@ -601,6 +700,12 @@
\newcommand*\rubynobreakjukugo{%
\pxrr@break@jukugofalse
}
+\newcommand*\rubysafemode{%
+ \pxrr@safe@modetrue
+}
+\newcommand*\rubynosafemode{%
+ \pxrr@safe@modefalse
+}
\newcommand*\rubystretchprop[3]{%
\edef\pxrr@sprop@x{#1}%
\edef\pxrr@sprop@y{#2}%
@@ -645,6 +750,8 @@
\pxrr@anobrfalse
\pxrr@bfintrfalse
\pxrr@afintrfalse
+ \pxrr@mode@givenfalse
+ \pxrr@athead@givenfalse
\def\pxrr@po@FS{bi}%
\expandafter\pxrr@parse@option@loop\pxrr@tempa @\pxrr@end
}
@@ -793,21 +900,27 @@
}
\def\pxrr@po@PR@c{%
\chardef\pxrr@athead\z@
+ \pxrr@athead@giventrue
}
\def\pxrr@po@PR@h{%
\chardef\pxrr@athead\@ne
+ \pxrr@athead@giventrue
}
\def\pxrr@po@PR@H{%
\chardef\pxrr@athead\tw@
+ \pxrr@athead@giventrue
}
\def\pxrr@po@PR@m{%
\let\pxrr@mode=m%
+ \pxrr@mode@giventrue
}
\def\pxrr@po@PR@g{%
\let\pxrr@mode=g%
+ \pxrr@mode@giventrue
}
\def\pxrr@po@PR@j{%
\let\pxrr@mode=j%
+ \pxrr@mode@giventrue
}
\def\pxrr@po@PR@P{%
\chardef\pxrr@side\z@
@@ -880,25 +993,28 @@
\if g\pxrr@mode\else
\ifpxrr@abody
\let\pxrr@mode=g\relax
+ \ifpxrr@mode@given
+ \pxrr@warn@must@group
+ \fi
\fi
+ \fi
+ \if g\pxrr@mode\else
\ifnum\pxrr@side=\tw@
\let\pxrr@mode=g\relax
- \fi
- \if g\pxrr@mode
- \if g\pxrr@d@mode
+ \ifpxrr@mode@given
\pxrr@warn@must@group
\fi
\fi
\fi
\ifnum\pxrr@athead>\z@
\ifpxrr@in@tate\else
- \pxrr@athead\z@
+ \chardef\pxrr@athead\z@
\fi
\if g\pxrr@mode
- \pxrr@athead\z@
+ \chardef\pxrr@athead\z@
\fi
\ifnum\pxrr@athead=\z@
- \ifnum\pxrr@d@athead>\z@
+ \ifpxrr@athead@given
\pxrr@warn@bad@athead
\fi
\fi
@@ -1135,11 +1251,11 @@
\newif\ifpxrr@protr
\newif\ifpxrr@any@protr
\def\pxrr@epsilon{0.01pt}
-\def\pxrr@compose@block{%
+\def\pxrr@compose@block#1#2#3{%
\let\pxrr@compose@block@do\pxrr@compose@oneside@block@do
- \pxrr@compose@block@pre
+ \pxrr@compose@block@pre{#1}{#2}{#3}{}%
}
-\def\pxrr@compose@oneside@block@do#1#2#3{%
+\def\pxrr@compose@oneside@block@do#1#2#3#4{%
\setbox\pxrr@boxa\pxrr@hbox{#2}%
\setbox\pxrr@boxr\pxrr@hbox{%
\pxrr@use@ruby@font
@@ -1257,27 +1373,43 @@
\pxrr@ifnum{\pxrr@fullsize>\z@}{%
\pxrr@compose@block@pre@a
}{%
- \pxrr@compose@block@pre@c
+ \pxrr@compose@block@pre@d
}%
}
-\def\pxrr@compose@block@pre@a#1#2#3{%
- \def\pxrr@compose@block@tempa{#3}%
+\def\pxrr@compose@block@pre@a#1#2#3#4{%
+ \def\pxrr@compose@block@tempa{#4}%
\pxrr@transform@kana\pxrr@compose@block@tempa
\expandafter\pxrr@compose@block@pre@b
- \expandafter{\pxrr@compose@block@tempa}{#1}{#2}%
+ \expandafter{\pxrr@compose@block@tempa}{#1}{#2}{#3}%
}
-\def\pxrr@compose@block@pre@b#1#2#3{%
- \pxrr@compose@block@pre@c{#2}{#3}{#1}%
+\def\pxrr@compose@block@pre@b#1#2#3#4{%
+ \def\pxrr@compose@block@tempa{#4}%
+ \pxrr@transform@kana\pxrr@compose@block@tempa
+ \expandafter\pxrr@compose@block@pre@c
+ \expandafter{\pxrr@compose@block@tempa}{#1}{#2}{#3}%
}
-\def\pxrr@compose@block@pre@c{%
+\def\pxrr@compose@block@pre@c#1#2#3#4{%
+ \pxrr@compose@block@pre@d{#3}{#4}{#1}{#2}%
+}
+\def\pxrr@compose@block@pre@d{%
\pxrr@ifnum{\pxrr@evensp=\z@}{%
- \pxrr@compose@block@pre@d
+ \pxrr@compose@block@pre@e
+ }{%
+ \pxrr@compose@block@pre@f
+ }%
+}
+\def\pxrr@compose@block@pre@e#1#2{%
+ \pxrr@compose@block@pre@f{#1}{{#2}}%
+}
+\def\pxrr@compose@block@pre@f{%
+ \pxrr@ifnum{\pxrr@revensp=\z@}{%
+ \pxrr@compose@block@pre@g
}{%
\pxrr@compose@block@do
}%
}
-\def\pxrr@compose@block@pre@d#1#2{%
- \pxrr@compose@block@do{#1}{{#2}}%
+\def\pxrr@compose@block@pre@g#1#2#3#4{%
+ \pxrr@compose@block@do{#1}{#2}{{#3}}{{#4}}%
}
\def\pxrr@add@protect#1{%
\expandafter\pxrr@add@protect@a
@@ -1345,7 +1477,7 @@
\pxrr@check@kinsoku@c#1#1%
}
\def\pxrr@check@kinsoku@c#1{%
- \pxrr@cntr\prebreakpenalty`#1\relax
+ \pxrr@get@prebreakpenalty\pxrr@cntr{#1}%
\pxrr@tempb
}
\def\pxrr@tempa#1#2\pxrr@nil{%
@@ -1416,12 +1548,25 @@
\hskip-\pxrr@intr@amount\relax
\fi
\else
- \penalty\pxrr@auto@penalty\relax
\hskip-\pxrr@intr@amount\relax
\hskip\pxrr@auto@icspace\relax
\fi
\fi
}
+\def\pxrr@put@head@penalty{%
+ \ifpxrr@ghost\else \ifpxrr@par@head\else
+ \ifpxrr@abody
+ \pxrr@intrude@setauto@a
+ \else
+ \pxrr@intrude@setauto@j
+ \fi
+ \ifnum\pxrr@auto@penalty=\z@\else
+ \pxrr@cnta\lastpenalty \unpenalty
+ \advance\pxrr@cnta\pxrr@auto@penalty\relax
+ \penalty\pxrr@cnta
+ \fi
+ \fi\fi
+}
\def\pxrr@intrude@end{%
\ifpxrr@ghost\else
\let\pxrr@intr@amount\pxrr@aspace
@@ -1530,6 +1675,9 @@
\ifpxrrDebug
\pxrr@debug@show@input
\fi
+ \ifpxrr@safe@mode
+ \pxrr@setup@safe@mode
+ \fi
\pxrr@if@alive{%
\if g\pxrr@mode
\pxrr@ruby@check@g
@@ -1555,12 +1703,21 @@
\ifpxrrDebug
\pxrr@debug@show@input
\fi
+ \ifpxrr@safe@mode
+ \pxrr@setup@safe@mode
+ \fi
\pxrr@if@alive{%
\pxrr@ruby@check@tg
\pxrr@if@alive{\pxrr@ruby@main@tg}%
}%
\pxrr@ruby@exit
}
+\def\pxrr@setup@safe@mode{%
+ \let\pxrr@mode=g%
+ \chardef\pxrr@evensp\z@
+ \chardef\pxrr@revensp\z@
+ \chardef\pxrr@fullsize\z@
+}
\def\pxrr@ruby@check@g{%
\ifnum\pxrr@body@count=\pxrr@ruby@count\relax
\ifnum\pxrr@body@count=\@ne\else
@@ -1624,6 +1781,7 @@
\pxrr@zip@list\pxrr@body@list\pxrr@ruby@list
\let\pxrr@whole@list\pxrr@res
\pxrr@check@par@head
+ \pxrr@put@head@penalty
\pxrr@any@protrfalse
\ifpxrrDebug
\pxrr@debug@show@recomp
@@ -1705,6 +1863,7 @@
\pxrr@zip@list\pxrr@body@list\pxrr@ruby@list
\let\pxrr@whole@list\pxrr@res
\pxrr@check@par@head
+ \pxrr@put@head@penalty
\ifpxrrDebug
\pxrr@debug@show@recomp
\fi
@@ -1727,6 +1886,7 @@
}
\def\pxrr@ruby@main@tg{%
\pxrr@check@par@head
+ \pxrr@put@head@penalty
\let\pxrr@locate@sing@\pxrr@locate@inner
\ifpxrr@aprotr\else
\let\pxrr@locate@sing@\pxrr@locate@end
@@ -1754,23 +1914,24 @@
\kern-\wd\pxrr@boxa
\fi
}
-\ifpxrr@aghost
+\def\pxrr@setup@aghost{%
+ \global\let\pxrr@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@letcs\pxrr@aghostfont{T1/lmr/m/n/2.5}%
- \chardef\pxrr@aghostchar=23 % compwordmark
- \def\pxrr@aghost{{\pxrr@aghostfont\pxrr@aghostchar}}%
- \xspcode\pxrr@aghostchar=3 %
+ \global\pxrr@letcs\pxrr@aghostfont{T1/lmr/m/n/2.5}%
+ \global\chardef\pxrr@aghostchar=23 % compwordmark
+ \gdef\pxrr@aghost{{\pxrr@aghostfont\pxrr@aghostchar}}%
+ \global\xspcode\pxrr@aghostchar=3 %
}{%else
- \oxrr@warn{Ghost embedding for \string\aruby\space
+ \pxrr@warn{Ghost embedding for \string\aruby\space
is disabled,\MessageBreak
since package lmodern is missing}%
- \pxrr@aghostfalse
- \let\pxrr@aghosttrue\relax
+ \global\pxrr@aghostfalse
+ \global\let\pxrr@aghosttrue\relax
}%
-\fi
+}
\def\pxrr@aprologue{%
\ifpxrr@aghost
\pxrr@aghost
@@ -1832,6 +1993,8 @@
pxrr@aintr = \pxrr@aintr^^J%
pxrr@athead = \the\pxrr@athead^^J%
pxrr@mode = \meaning\pxrr@mode^^J%
+ ifpxrr@athead@given = \meaning\ifpxrr@athead@given^^J%
+ ifpxrr@mode@given = \meaning\ifpxrr@mode@given^^J%
pxrr@body@list = \meaning\pxrr@body@list^^J%
pxrr@body@count = \@nameuse{pxrr@body@count}^^J%
pxrr@ruby@list = \meaning\pxrr@ruby@list^^J%