summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/platex
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-12-11 02:05:11 +0000
committerNorbert Preining <preining@logic.at>2012-12-11 02:05:11 +0000
commit427f60468268e043c941e28ab3196807ef1f9724 (patch)
treef2c4757ba743d75614cf962af4e195aefb577c76 /Master/texmf-dist/tex/platex
parent49b2ae38209e586fb12ce3664f92b24ce29d7162 (diff)
new platex package pxbase (11Dec)
git-svn-id: svn://tug.org/texlive/trunk@28493 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/platex')
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/ifuptex.sty47
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/pxbabel.sty186
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/pxbase.def791
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/pxbase.sty129
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/pxbasenc.def483
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/pxbsjc.def6
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/pxcjkcat.sty482
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def195
-rw-r--r--Master/texmf-dist/tex/platex/pxbase/upkcat.sty50
9 files changed, 2369 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/platex/pxbase/ifuptex.sty b/Master/texmf-dist/tex/platex/pxbase/ifuptex.sty
new file mode 100644
index 00000000000..ff1ca4d2ac3
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/ifuptex.sty
@@ -0,0 +1,47 @@
+%
+% ifuptex.sty (for both LaTeX2e & plain TeX)
+%
+
+%%%% Avoid multiple loading and check if LaTeX2e is used.
+\ifx\iuMode\undefined\else \expandafter\endinput \fi
+\ifx\RequirePackage\undefined % not LaTeX2e
+ \edef\iuRestoreAt{\catcode64=\the\catcode64}
+ \catcode64=11 \let\iuMode=p
+\else % LaTeX2e
+ \let\iuRestoreAt\relax \let\iuMode=l
+ \NeedsTeXFormat{LaTeX2e}
+ \ProvidesPackage{ifuptex}[2008/03/14 v0.2 upTeX checker]
+\fi
+
+%%%% \ifupTeX, \ifnativeupTeX
+\def\iu@true#1{\expandafter\let\csname#1\endcsname\iftrue}
+\def\iu@false#1{\expandafter\let\csname#1\endcsname\iffalse}
+\edef\reserved@a{\string\kchar}\edef\reserved@b{\meaning\kchar}
+\ifx\reserved@a\reserved@b \iu@true{ifupTeX}
+ \ifnum\ucs"3000="3000 \iu@true{ifnativeupTeX}
+ \else \iu@false{ifnativeupTeX} \fi
+\else \iu@false{ifupTeX}\iu@false{ifnativeupTeX}
+\fi
+
+%%%% \iu@noupTeX
+\if l\iuMode % LaTeX2e
+ \def\iu@noupTeX#1{\PackageError{\@currname}%
+ {This \@cls@pkg\space requires #1}%
+ {I stop loading here.}\expandafter\endinput}
+\else % not LaTeX2e
+ \def\iu@noupTeX#1{\errorcontextlines=-1
+ \errhelp{You should quit right now.}%
+ \errmessage{This document requires #1!}}
+\fi
+
+%% \RequireupTeX, \RequireNativeupTeX
+\def\RequireupTeX{%
+ \ifupTeX\else \iu@noupTeX{upTeX}\fi}
+\def\RequirenativeupTeX{%
+ \ifnativeupTeX\else \iu@noupTeX{native upTeX}\fi}
+
+%%%% all done
+\let\iu@true\relax\let\iu@false\relax
+\iuRestoreAt\let\iuRestoreAt\relax
+\endinput
+%% EOF
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty b/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty
new file mode 100644
index 00000000000..26d007133f3
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty
@@ -0,0 +1,186 @@
+%
+% pxbabel.sty
+%
+%%%% package declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{pxbabel}[2010/06/15 v0.5 PX Babel interface for CJK]
+\RequirePackage{pxbase}
+\safecaret
+\RequirePackage{keyval}
+
+%%%% error message
+\def\pxbb@pkgname{pxbabel}
+\def\pxbb@error{\PackageError\pxbb@pkgname}
+\def\pxbb@warn{\PackageWarningNoLine\pxbb@pkgname}
+\def\pxbb@eha{\MessageBreak I aborted loading it.}
+\def\pxbb@err@nobbl{\pxbb@error
+ {babel is not yet loaded, load aborted}%
+ {This package must be loaded after babel package.}}
+\@onlypreamble\pxbb@err@nobbl
+\def\pxbb@warn@nocjk{\pxbb@warn
+ {No multi-CJK support found, font switch disabled\MessageBreak
+ (I need upTeX-extension or otf package with `multi')}}
+\@onlypreamble\pxbb@warn@nocjk
+
+%%%% \pxbb@foreach@lang\CS
+\def\pxbb@foreach@lang#1{%
+ #1{japanese}#1{korean}#1{schinese}#1{tchinese}}
+
+%%%% keyval settings
+\def\pxbb@setkey{%
+ \edef\pxbb@nxt{\noexpand\setkeys{pxbabel}{\CurrentOption}}%
+ \pxbb@nxt}
+\def\pxbb@do#1{%
+ \define@key{pxbabel}{#1}{\@namedef{pxbb@LN/#1}{##1}}%
+ \@namedef{pxbb@LN/#1}{#1}}
+\pxbb@foreach@lang\pxbb@do
+\define@key{pxbabel}{main}{\def\pxbb@main{#1}}
+\let\pxbb@main\relax
+
+%%%% option handler
+\newif\ifpxbb@switchcaption \pxbb@switchcaptionfalse
+\DeclareOption{switchcaption}{\pxbb@switchcaptiontrue}
+\DeclareOption{noswitchcaption}{\pxbb@switchcaptionfalse}
+\newif\ifpxbb@switchfont \pxbb@switchfonttrue
+\DeclareOption{switchfont}{\pxbb@switchfonttrue}
+\DeclareOption{noswitchfont}{\pxbb@switchfontfalse}
+\newif\ifpxbb@prefermmixjis
+\DeclareOption{prefer2004jis}{\pxbb@prefermmixjistrue}
+\DeclareOption{noprefer2004jis}{\pxbb@prefermmixjisfalse}
+\DeclareOption*{\pxbb@setkey}
+\ProcessOptions*
+
+%%%% \ifpxbb@otfmulti, \ifpxbb@uptex
+%%%% \ifpxbb@pxotf
+\newif\ifpxbb@otfmulti \newif\ifpxbb@pxotf
+\@ifpackageloaded{mlutf}{\pxbb@otfmultitrue}{\pxbb@otfmultifalse}
+\@ifpackageloaded{pxotf}{\pxbb@otfmultitrue\pxbb@pxotftrue}{}
+\newif\ifpxbb@uptex
+\let\ifpxbb@uptex\ifupTeX
+
+%%%% environment check
+\@ifpackageloaded{babel}{}{\pxbb@err@nobbl\endinput}
+\ifpxbb@switchfont \ifpxbb@otfmulti\else \ifpxbb@uptex\else
+ \pxbb@warn@nocjk \fi\fi\fi
+
+%%%% set caption language to 'default'
+\ifpxbb@switchcaption\else
+ \ifx\bx@bbl@captlang\@undefined
+ \bxcaptionlanguage{default}
+\fi\fi
+
+%%------ language declarations
+
+%%%% \pxlanguagename{<langcode>}
+\def\pxlanguagename#1{\@nameuse{pxbb@LN/#1}}
+
+%%%% declare languages
+\def\pxbb@decl@triv@lang#1{%
+ \edef\pxbb@arg{{\@nameuse{pxbb@LN/#1}}}%
+ \expandafter\pxbb@decl@triv@lang@a\pxbb@arg}
+\def\pxbb@decl@triv@lang@a#1{%
+ \expandafter\ifx\csname date#1\endcsname\relax
+ \bxTrivLangDef{#1}\fi}
+\pxbb@foreach@lang\pxbb@decl@triv@lang
+\pxbb@decl@triv@lang@a{cjkmulti}
+\ifx\pxbb@main\relax\else
+ \bxmainlanguage{\pxbb@main}\fi
+\@onlypreamble\pxb@decl@triv@lang
+\@onlypreamble\pxb@decl@triv@lang@a
+
+\ifpxbb@otfmulti %====================== for OTF
+%%------ \UTF switch
+
+%%%% add \UTF switch to Babel \extras
+\ifpxbb@switchfont
+\def\pxbb@addtoextras@otf#1{%
+ \edef\pxbb@arg{{\@nameuse{pxbb@LN/#1}}}%
+ \expandafter\pxbb@addtoextras@otf@a\pxbb@arg}
+\def\pxbb@addtoextras@otf@a#1#2{%
+ \expandafter\addto\csname extras#1\endcsname{%
+ \babel@save\UTF \let\UTF#2}}
+\pxbb@addtoextras@otf{korean}{\UTFK}
+\pxbb@addtoextras@otf{schinese}{\UTFC}
+\pxbb@addtoextras@otf{tchinese}{\UTFT}
+\pxbb@addtoextras@otf@a{cjkmulti}{\UTFM}
+\@onlypreamble\pxbb@addtoextras@otf
+\@onlypreamble\pxbb@addtoextras@otf@a
+\fi % pxbb@switchfont
+
+\fi %=================================== end
+
+\ifupTeX %============================== for upTeX
+%%------ encoding switch according to NFSS
+\bxInputDefFile{pxbasenc}
+\pxBDHookEncSwitchOTF
+
+%%%% declarations for upTeX standatd CJK fonts
+\ifpxbb@pxotf\else
+\pxDeclareBasicCJKEncoding{J20}{J30}% UniJIS
+\pxDeclareBasicCJKFamily{J20}{!upjpnrm-h}{!upjpngt-h}{*gt}{*gt}
+\pxDeclareBasicCJKFamily{J30}{!upjpnrm-v}{!upjpngt-v}{*gt}{*gt}
+\pxDeclareBasicCJKEncoding{J21}{J31}% UniKS
+\pxDeclareBasicCJKFamily{J21}{!upkorrm-h}{!upkorgt-h}{*gt}{*gt}
+\pxDeclareBasicCJKFamily{J31}{!upkorrm-v}{!upkorgt-v}{*gt}{*gt}
+\pxDeclareBasicCJKEncoding{J22}{J32}% UniGB
+\pxDeclareBasicCJKFamily{J22}{!upschrm-h}{!upschgt-h}{*gt}{*gt}
+\pxDeclareBasicCJKFamily{J32}{!upschrm-v}{!upschgt-v}{*gt}{*gt}
+\pxDeclareBasicCJKEncoding{J23}{J33}% UniCNS
+\pxDeclareBasicCJKFamily{J23}{!uptchrm-h}{!uptchgt-h}{*gt}{*gt}
+\pxDeclareBasicCJKFamily{J33}{!uptchrm-v}{!uptchgt-v}{*gt}{*gt}
+\fi
+
+%%%% add font switch to Babel \extras
+\ifpxbb@switchfont
+\def\pxbb@addtoextras#1#2#3{%
+ \edef\pxbb@arg{{\@nameuse{pxbb@LN/#1}}%
+ \if t#2{\noexpand\pxbb@full@ja@enc}{\noexpand\@undefined}%
+ \else{#3}{t}\fi}%
+ \expandafter\pxbb@addtoextras@a\pxbb@arg}
+\def\pxbb@addtoextras@a#1#2#3{%
+ \expandafter\addto\csname extras#1\endcsname{%
+ \pxbb@set@full@ja@enc \let\pxInNonJaLanguage=#3%
+ \let\pxbb@org@encoding\cy@encoding
+ \kanjiencoding{#2}\selectfont}%
+ \expandafter\addto\csname noextras#1\endcsname{%
+ \let\pxInNonJaLanguage\@undefined
+ \kanjiencoding{\pxbb@org@encoding}\selectfont}}
+\pxbb@addtoextras{japanese}{t}{}
+\pxbb@addtoextras{korean}{f}{J21}
+\pxbb@addtoextras{schinese}{f}{J22}
+\pxbb@addtoextras{tchinese}{f}{J23}
+\@onlypreamble\pxbb@addtoextras
+\@onlypreamble\pxbb@addtoextras@a
+%% \pxbb@set@full@ja@enc
+\edef\pxbb@dflt@ja@enc{\ifpxbb@prefermmixjis J24\else J20\fi}
+\@namedef{pxbb@SFJE/J20}{\def\pxbb@full@ja@enc{J20}}
+\@namedef{pxbb@SFJE/J24}{\def\pxbb@full@ja@enc{J24}}
+\def\pxbb@set@full@ja@enc{%
+ \let\pxbb@full@ja@enc\pxbb@dflt@ja@enc
+ \csname pxbb@SFJE/\cy@encoding\endcsname}
+\fi % pxbb@switchfont
+
+\fi %=================================== end
+
+%%------ all done
+\endinput
+%% EOF
+
+%
+% Roman, H Gothic, H Roman, V Gothic, H : metric encod.
+% ------------ ------------ ------------ ------------ : ------ --------
+% umin10 ugoth10 utmin10 utgoth10 : min10 JIS-old
+% ujis ujisg ujis-v ujisg-v : jis JIS-old
+% ujisn ujisng ujisn-v ujisng-v : jisn JIS-old
+% * urml ugbm urmlv ugbmv : RAW JIS-old
+% upjisr-h upjisg-h upjisr-v upjisg-v : upjpn JIS-bmp
+% upjisr-hq upjisg-hq : upjpn JIS-old
+% upjpnrm-h upjpngt-h upjpnrm-v upjpngt-v : upjpn JIS-full
+% * uprml upgbm uprmlv upgmbv : RAW JIS-bmp
+% * uprmlq upgbmq : RAW JIS-old
+% upkorrm-h upkorgt-h upkorrm-v upkorgt-v : upkor KS
+% * uphysmjm-h uphygt-h uphysmjm-v uphygt-v : RAW KS
+% upschrm-h upschgt-h upschrm-v upschgt-v : upsch GB
+% * upstsl-h upstht-h upstsl-v upstht-v : RAW GB
+% uptchrm-h uptchgt-h uptchrm-v uptchgt-v : uptch CNS
+% * upmsl-h upmhm-h upmsl-v upmhm-v : RAW CNS
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbase.def b/Master/texmf-dist/tex/platex/pxbase/pxbase.def
new file mode 100644
index 00000000000..926ee1bc6c5
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/pxbase.def
@@ -0,0 +1,791 @@
+%
+% pxbase.def
+%
+
+% Note: bxbase.def and pxbase.def provide same set of functionality.
+% To avoid version clash, when a version of one of them is loaded,
+% load of an older version of the other is aborted.
+
+%%%% stuffs read when \input'ed
+\ifx\bxbaseOk\undefined
+\bgroup
+\catcode`\@=11
+\gdef\bx@defextension{def}
+\gdef\bx@ver@#1{\expandafter\expandafter\expandafter\@parse@version
+ \csname ver@#1.\@currext\endcsname//00\@nil}
+ %% \bxInputDefFile{<def_name>}
+\gdef\bxInputDefFile#1{\@onefilewithoptions{#1}[][]\bx@defextension}
+ %% \bxCheckCPart{<def_name>}
+\gdef\bxCheckCPart#1{%
+ \@ifl@aded\@currext{#1}{%
+ \ifnum\bx@ver@{#1}>\bx@ver@\@currname \expandafter\endinput\fi}{}}
+\egroup
+\let\bxbaseOk=t
+\bxInputDefFile{pxbase} %% read this file again
+\expandafter\endinput\fi
+
+%%--------------- folloing stuffs are read by \bxTnext
+
+%%%% file declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{pxbase.def}[2010/06/15 v0.5 BX/PX base library]
+\bxCheckCPart{bxbase}
+%* v0.5.r13
+
+%%%% error messages
+\def\bx@b@pkgname{BX/PXbase} % bundle name
+\def\bx@b@error{\PackageError\bx@b@pkgname}
+\def\bx@err@nobbl{\bx@b@error{babel not yet loaded}\@eha}
+\def\bx@err@oorng{\bx@b@error{Number out of range}\@eha}
+\def\bx@err@nanbc{\bx@b@error{Non-BMP characters not supported}\@eha}
+\def\bx@err@ilnfm{\bx@b@error{Illegal number format}\@eha}
+\def\bx@err@uddrv#1{\bx@b@error{\string#1 is undefined}\@eha}
+
+%%%% common stuffs
+\ifx\bxUcv\@undefined
+\newcount\bxUcv % argument of \bx@Ux
+\fi
+\newif\ifbxOk % all-purpsoe switch
+\let\bxHex\relax % result of \bxToHex...
+\let\bxRes\relax % result of \bxToLower
+\edef\bx@b@resetcatcodes{% < ! " ' + ^ >
+ \catcode33=\the\catcode33\catcode34=\the\catcode34%
+ \catcode39=\the\catcode39\catcode43=\the\catcode43%
+ \catcode94=\the\catcode94\relax}
+\catcode33=12 \catcode34=12 \catcode39=12 \catcode43=12
+\catcode94=6
+
+%%------ Programming tools
+
+%%%% \bxNullify\CS
+% Make \CS void and unoverridable by \providecommand.
+\def\bxNullify#1{\global\let#1\bx@nullified}
+\def\bx@nullified{\@gobble\bx@@nullified}
+
+%%%% \bxDebug{<text>}
+% If \bxUseDebug is defined when bxbase is loaded, this command
+% prints debug messages; otherwise it is ignored.
+%\let\bx@typeout\typeout
+%\ifx\bxUseDebug\@undefined \let\bxDebug\@gobble
+%\else \def\bxDebug#1{\bx@typeout{BX debug: #1}}\fi
+\providecommand*\bxDebug{\@gobble}
+
+%%%% \bxCheckMA\CS <text> \bxEndCheckMA
+% If this construct appears in moving arguments, it expands to
+% an error message command.
+\def\bxCheckMA{\let\bx@chkma@a\bx@chkma@a\noexpand}
+\let\bxEndCheckMA\@empty \let\bx@chkma@z\relax
+\def\bx@chkma@a#1{\bx@chkma@z\relax\bx@chkma@b}
+\def\bx@chkma@b#1#2#3\bxEncCheckMA{\noexpand\bx@err@ivfrg#1#2}
+\def\bx@err@ivfrg#1{\bx@b@error{Cannot use \string#1 here}\@eha}
+
+%%------ TeX engine distinction
+
+%%%% \bxIfPrimitive\CS{<yes>}{<no>}
+% Checks if \CS is a primitive.
+\def\bxIfPrimitive#1{%
+ \edef\bx@tmpa{\string#1}\edef\bx@tmpb{\meaning#1}%
+ \ifx\bx@tmpa\bx@tmpb \expandafter\@firstoftwo
+ \else \expandafter\@secondoftwo \fi}
+
+%%%% \bxEngineTypeX / \bxEngineTypeY
+% Numbers that signify what I am.
+ % \bxEngineTypeX values
+\chardef\bxETTeX=0 % none of those
+\chardef\bxETpTeX=1 % pTeX-extended
+\chardef\bxETXeTeX=2 % XeTeX-extended
+\chardef\bxETOmega=3 % Omega-extended
+ % \bxEngineTypeY values (plus \bxETTeX)
+\chardef\bxETeTeX=1 % e-TeX-extended
+\chardef\bxETpdfTeX=3 % pdfTeX-extended
+ % (here old pdfTeX without e-TeX is ignored)
+ %
+\bxIfPrimitive\kansuji{\let\bxEngineTypeX\bxETpTeX}{%
+\bxIfPrimitive\XeTeXversion{\let\bxEngineTypeX\bxETXeTeX}{%
+\bxIfPrimitive\Omegaversion{\let\bxEngineTypeX\bxETOmega}{%
+ \let\bxEngineTypeX\bxETTeX}}}
+\bxIfPrimitive\eTeXversion{\let\bxEngineTypeY\bxETeTeX}{%
+\bxIfPrimitive\pdftexversion{\let\bxEngineTypeY\bxETpdfTeX}{%
+ \let\bxEngineTypeY\bxETTeX}}
+
+%%%% \bx@b@uptex
+\bxIfPrimitive\kchar{\chardef\bx@b@uptex\@ne}{\chardef\bx@b@uptex\z@}
+
+%%------ Babel something
+
+%%<+> \bxBDHookBabel
+% A begindocument-hook about Babel.
+\newif\ifbx@bbl@inuse
+\def\bx@bbl@bdhook{}
+\providecommand\bxBDHookBabel{\bx@bdhook@babel@do}
+\def\bx@bdhook@babel@do{%
+ \AtBeginDocument{%
+ \@ifpackageloaded{babel}{%
+ \bx@bbl@inusetrue
+ \ifx\bx@bbl@captlang\@undefined\else \bx@bbl@do@captlang \fi
+ \bx@bbl@bdhook
+ }{}}%
+ \bxNullify\bxBDHookBabel}
+\@onlypreamble\bxBDHookBabel
+\@onlypreamble\bx@bdhook@babel@do
+
+%%<+> \bxAtBeginDocumentBabel{<text>}
+% Register a begin-document hook that willl be invoked only when babel
+% is loaded.
+\def\bxAtBeginDocumentBabel{%
+ \g@addto@macro\bx@bbl@bdhook}
+\@onlypreamble\bxAtBeginDocumentBabel
+\@onlypreamble\bx@bbl@bdhook
+
+%%%% \bx@bbl@patch@sel@lang
+% A patch to \select@language that disables automatic switching of
+% caption language.
+\def\bx@bbl@patch@sel@lang{% this wlll be never invoked twice
+ \global\let\bx@bbl@org@select@language\select@language
+ \gdef\select@language##1{%
+ \bx@bbl@copy{**C}{##1}\bx@bbl@copy{##1}{**Z}%
+ \bx@bbl@org@select@language{##1}\bx@bbl@copy{##1}{**C}}}
+\@onlypreamble\bx@bbl@patch@sel@lang
+
+%%%% \bx@bbl@do@captlang
+\def\bx@bbl@@main{main}
+\def\bx@bbl@@default{default}
+\def\bx@bbl@do@captlang{%
+ % set captions
+ \ifx\bx@bbl@captlang\bx@bbl@@main
+ \let\bx@bbl@captlang\bbl@main@language \fi
+ \ifx\bx@bbl@captlang\bx@bbl@@default
+ \else\expandafter\ifx\csname l@\bx@bbl@captlang\endcsname\relax
+ \@nolanerr\bx@bbl@captlang
+ \else \csname date\bx@bbl@captlang\endcsname
+ \csname captions\bx@bbl@captlang\endcsname
+ \fi\fi}
+\@onlypreamble\bx@bbl@do@captlang
+
+%%%% \bx@bbl@copy{<lang1>}{<lang2>}
+% Copies \captions... and \date... for save.
+\def\bx@bbl@copy#1#2{%
+ \bx@bbl@copy@a{#1}{#2}{captions}%
+ \bx@bbl@copy@a{#1}{#2}{date}}
+\def\bx@bbl@copy@a#1#2#3{%
+ \edef\bx@tmpa{\let\expandafter\noexpand\csname#3#1\endcsname
+ \expandafter\noexpand\csname#3#2\endcsname}\bx@tmpa}
+\@namedef{captions**Z}{\@empty}
+\@namedef{date**Z}{\@empty}
+
+%%<*> \bxcaptionlanguage{<lang>}
+% Change the caption language manually, with disabling automatic
+% switching on it.
+\def\bxcaptionlanguage#1{%
+ \@ifpackageloaded{babel}%
+ {\ifx\bx@bbl@captlang\@undefined \bx@bbl@patch@sel@lang \fi
+ \xdef\bx@bbl@captlang{#1}}%
+ {\bx@err@nobbl}}
+\@onlypreamble\bxcaptionlanguage
+
+%%<*> \bxmainlanguage{<lang>}
+% Changes the 'main' language (one that is effective at beginning).
+\def\bxmainlanguage#1{%
+ \expandafter\ifx\csname date#1\endcsname\relax
+ \@nolanerr{#1}\fi
+ \xdef\bbl@main@language{#1}}
+\@onlypreamble\bxmainlanguage
+
+%%<+> \bxTrivLangDef{<lang>}
+% Makes a fake language option.
+\def\bxTrivLangDef#1{%
+ \@ifundefined{date#1}{%
+ \@ifundefined{l@#1}%
+ {\expandafter\chardef\csname l@#1\endcsname\z@}{}%
+ \@namedef{date#1}{\relax}%
+ \@namedef{captions#1}{\relax}%
+ \@namedef{extras#1}{\relax}%
+ \@namedef{noextras#1}{\relax}%
+ \@namedef{date#1}{\relax}%
+ }{}}
+\@onlypreamble\bxTrivLangDef
+
+%%------ 'Number-to-hex-string' functions
+% All public commands put their result in \bxHex.
+
+%%%% preparation
+\newif\ifbx@hx@bigchar
+\ifnum\bxEngineTypeX>\@ne \bx@hx@bigchartrue \fi
+\ifnum\bx@b@uptex>\z@ \bx@hx@bigchartrue \fi
+
+%%<+> \bxToHexTiny
+% For one-to-two-digit hex strings.
+\def\bxToHexTiny#1{%
+ \chardef\bxHex=#1\relax
+ \expandafter\bx@hx@tohextiny@a\meaning\bxHex\@nil}
+\def\bx@hx@tohextiny@a#1"#2\@nil{\def\bxHex{#2}}
+
+%%<+> \bxToHexSmall
+% For one-to-three-digit hex strings.
+\def\bxToHexSmall#1{%
+ \mathchardef\bxHex=#1\relax
+ \expandafter\bx@hx@tohexsmall@a\meaning\bxHex\@nil}
+\def\bx@hx@tohexsmall@a#1"#2\@nil{\def\bxHex{#2}}
+
+%%<+> \bxToHexTwo
+% For zero-padded two-digit hex strings.
+\def\bxToHexTwo#1{%
+ \chardef\bxHex=#1\relax
+ \expandafter\bx@hx@tohextwo@a\meaning\bxHex"0\@nil}
+\def\bx@hx@tohextwo@a#1"#2#3#4#5\@nil{\bx@hx@tohextwo@b#2#3#4\@nil}
+\def\bx@hx@tohextwo@b#1"#2\@nil{\def\bxHex{#2#1}}
+
+%%<+> \bxToHexThree
+% For zero-padded three-digit hex strings.
+\def\bxToHexThree#1{%
+ \mathchardef\bxHex=#1\relax
+ \expandafter\bx@hx@tohexthree@a\meaning\bxHex"00\@nil}
+\def\bx@hx@tohexthree@a#1"#2#3#4#5#6\@nil{\bx@hx@tohexthree@b#2#3#4#5\@nil}
+\def\bx@hx@tohexthree@b#1"#2\@nil{\def\bxHex{#2#1}}
+
+%%<+> \bxToHexFour
+% For zero-padded four-digit hex strings.
+\ifbx@hx@bigchar %----<*bigchar>
+\def\bxToHexFour#1{%
+ \chardef\bxHex=#1\relax
+ \expandafter\bx@hx@tohexfour@a\meaning\bxHex"000\@nil}
+\def\bx@hx@tohexfour@a#1"#2#3#4#5#6#7\@nil{\bx@hx@tohexfour@b#2#3#4#5#6\@nil}
+\def\bx@hx@tohexfour@b#1"#2\@nil{\def\bxHex{#2#1}}
+\else %----<*!bigchar>
+\mathchardef\bx@hx@fzzz="4000
+\def\bxToHexFour#1{\bgroup
+ \@tempcnta=#1\relax\@tempcntb\@tempcnta\divide\@tempcntb\bx@hx@fzzz
+ \ifcase\@tempcntb \advance\@tempcnta\bx@hx@fzzz \or \or
+ \advance\@tempcnta-\bx@hx@fzzz \or \advance\@tempcnta-"8000 \or
+ \@tempcnta\z@ \fi
+ \mathchardef\bx@hx@tmp\@tempcnta
+ \expandafter\bx@hx@tohexfour@a\meaning\bx@hx@tmp\@nil
+ \egroup \let\bxHex\bx@hx@gtmp}
+\def\bx@hx@tohexfour@a#1"#2#3\@nil{%
+ \expandafter\let\expandafter\bx@hx@tmp
+ \csname bxhx@X/\the\@tempcntb#2\endcsname
+ \ifx\bx@hx@tmp\relax \bx@err@oorng \global\let\bx@hx@gtmp\@empty
+ \else \xdef\bx@hx@gtmp{\bx@hx@tmp#3}\fi}
+\def\bx@hx@nxt#1#2#3{\bgroup\catcode`#3=12
+ \global\expandafter\def\csname bxhx@X/#1#2\endcsname{#3}\egroup}
+\@for\bx@hx@tmp:={040,051,062,073,144,155,166,177,248,259,26A,27B,%
+ 34C,35D,36E,37F}\do{\expandafter\bx@hx@nxt\bx@hx@tmp}
+\fi %----</bigchar>
+
+%%<+> \bxToHexFive
+%%<+> \bxToHexFiveX
+% For zero-padded five-digit hex strings.
+\def\bxToHexFive{\bx@tohexfive@aa\relax}
+\def\bxToHexFiveX{\bx@tohexfive@aa
+ {\ifnum\@tempcnta>\bx@hx@vdmax \@tempcnta=\bx@hx@vdmax\fi}}
+\ifbx@hx@bigchar %----<*bigchar>
+\chardef\bx@hx@vdmax="FFFFF
+\def\bx@tohexfive@aa#1#2{%
+ {\@tempcnta=#2\relax#1\global\chardef\bx@hx@gtmp=\@tempcnta}%
+ \expandafter\bx@hx@tohexfivex@a\meaning\bx@hx@gtmp"0000\@nil}
+\def\bx@hx@tohexfivex@a#1"#2#3#4#5#6#7#8\@nil{%
+ \bx@hx@tohexfivex@b#2#3#4#5#6#7\@nil}
+\def\bx@hx@tohexfivex@b#1"#2\@nil{\edef\bxHex{#2#1}}
+\else %----<*!bigchar>
+\edef\bx@hx@vdmax{"FFFFF\space}
+\def\bx@tohexfive@aa#1#2{%
+ \bgroup \@tempcnta=#2\relax#1%
+ \@tempcntb=\@tempcnta \divide\@tempcnta\bx@hx@m\relax
+ \bxToHexTwo\@tempcnta \let\bx@hx@tmp\bxHex
+ \multiply\@tempcnta-\bx@hx@m\advance\@tempcnta\@tempcntb\relax
+ \bxToHexThree\@tempcnta \xdef\bx@hx@gtmp{\bx@hx@tmp\bxHex}%
+ \egroup \let\bxHex\bx@hx@gtmp}
+\fi %----</bigchar>
+
+%%<+> \bxToHexEight
+% For zero-padded eight-digit hex strings.
+\def\bxToHexEight#1{%
+ \bgroup \@tempcnta=#1\relax
+ \@tempcntb=\@tempcnta\divide\@tempcnta\p@\relax
+ \bxToHexFour\@tempcnta \let\bx@hx@tmp\bxHex
+ \multiply\@tempcnta-\p@\advance\@tempcnta\@tempcntb\relax
+ \bxToHexFour\@tempcnta \xdef\bx@hx@gtmp{\bx@hx@tmp\bxHex}%
+ \egroup \let\bxHex\bx@hx@gtmp}
+
+%%<+> \bxToHexUC
+% For zero-padded four-to-six-digit hex strings.
+\ifbx@hx@bigchar %----<*bigchar>
+\def\bxToHexUC#1{%
+ \chardef\bxHex=#1\relax
+ \expandafter\bx@hx@tohexuc@a\meaning\bxHex"\@empty\@empty000\@nil}
+\def\bx@hx@tohexuc@a#1"#2#3#4#5#6#7#8#9\@nil{%
+ \bx@hx@tohexuc@b#2#3#4#5#6#7#8\@nil}
+\def\bx@hx@tohexuc@b#1"#2\@nil{\edef\bxHex{#2#1}}
+\else %----<*!bigchar>
+\mathchardef\bx@hx@m="1000
+\def\bxToHexUC#1{%
+ \bgroup \@tempcnta=#1\relax
+ \@tempcntb=\@tempcnta \divide\@tempcnta\bx@hx@m\relax
+ \bxToHexSmall\@tempcnta \let\bx@hx@tmp\bxHex
+ \multiply\@tempcnta-\bx@hx@m\advance\@tempcnta\@tempcntb\relax
+ \bxToHexThree\@tempcnta \xdef\bx@hx@gtmp{\bx@hx@tmp\bxHex}%
+ \egroup \let\bxHex\bx@hx@gtmp}
+\fi %----</bigchar>
+
+%%<+> \bxToDecFour
+\def\bxToDecFour#1{%
+ \expandafter\bx@hx@todecfour@a\number#1"000\@nil}
+\def\bx@hx@todecfour@a#1#2#3#4#5#6\@nil{\bx@hx@todecfour@b#1#2#3#4#5\@nil}
+\def\bx@hx@todecfour@b#1"#2\@nil{\def\bxHex{#2#1}}
+
+%%<+> \bxToDecFive
+\def\bxToDecFive#1{%
+ \expandafter\bx@hx@todecfive@a\number#1"0000\@nil}
+\def\bx@hx@todecfive@a#1#2#3#4#5#6#7\@nil{\bx@hx@todecfive@b#1#2#3#4#5#6\@nil}
+\def\bx@hx@todecfive@b#1"#2\@nil{\def\bxHex{#2#1}}
+
+%%------ Input through code values
+
+%%<+> \bxBDHookUnicode
+% A begindocument-hook about Unicode (& CID) input.
+\providecommand\bxBDHookUnicode{\bx@bdhook@unicode@do}
+\def\bx@bdhook@unicode@do{%
+ \AtBeginDocument{\bx@assign@Ux}%
+ \bxNullify\bxBDHookUnicode}
+\@onlypreamble\bxBDHookUnicode
+\@onlypreamble\bx@bdhook@unicode@do
+
+%%<+> \bxBDHookJisInput
+% A begindocument-hook about JIS-code input.
+\providecommand\bxBDHookJisInput{\bx@bdhook@jisinput@do}
+\def\bx@bdhook@jisinput@do{%
+ \AtBeginDocument{\bx@assign@JI}%
+ \bxNullify\bxBDHookJisInput}
+\@onlypreamble\bxBDHookJisInput
+\@onlypreamble\bx@bdhook@jisinput@do
+
+%%<+> \bxFallbackSym
+\def\bxFallbackSym#1{\leavevmode\bx@fbs@fnt{\dimen@=\bx@junit\relax
+ \hb@xt@\dimen@{\hss\vrule\@width\z@\@height.88\dimen@\@depth.12\dimen@
+ \frame{\lower.04\dimen@\hb@xt@.84\dimen@{\hss\vbox to.84\dimen@{\vss
+ \hsize=.84\dimen@\baselineskip\z@\lineskip.01\dimen@\parskip\z@skip
+ \leftskip\@flushglue\rightskip\@flushglue\parfillskip\z@skip
+ \parindent\z@\let\\\bx@fbs@c\leavevmode\let\sml=\bx@fbs@fs\bx@fbs@f
+ #1\unskip\par\vss}\hss}}\hss}}}
+\edef\bx@junit{\ifnum\bxEngineTypeX=\@ne 1zw\else 1em\fi}
+\def\bx@fbs@c{\unskip\par\ignorespaces}
+\def\bx@fbs@fnt{\global\let\bx@fbs@fnt\relax
+ \global\font\bx@fbs@fs=phvr at 2.4pt
+ \global\font\bx@fbs@f=phvr at 3.6pt}
+
+%%<+> \bxCodeValueSeq\CS{<text>}
+% Dispatcher for code value sequences.
+\def\bxCodeValueSeq{%
+ \let\bx@cvseq@branch\bx@cvseq@branch@hex
+ \bx@cvseq@a}
+\def\bx@cvseq@a#1#2{%
+ {\catcode33=12%
+ \xdef\bx@gtmpa{\uppercase{\def\noexpand\bx@tmpa{#2}}}}%
+ \let\bx@cvseq@do=#1\bx@gtmpa\relax
+ \expandafter\bx@cvseq@b\bx@tmpa,!\@nil}
+\def\bx@cvseq@b{\futurelet\bx@toka\bx@cvseq@branch}
+\def\bx@cvseq@branch@hex{%
+ \if !\bx@toka \let\bx@nxt\bx@cvseq@fin
+ \else\if "\bx@toka \let\bx@nxt\bx@cvseq@pfx
+ \else\if '\bx@toka \let\bx@nxt\bx@cvseq@pfx
+ \else\if +\bx@toka \let\bx@nxt\bx@cvseq@pfx
+ \else \let\bx@nxt\bx@cvseq@hex \fi\fi\fi\fi
+ \bx@nxt}
+\def\bx@cvseq@pfx{%
+ \afterassignment\bx@cvseq@post \bxUcv=}
+\def\bx@cvseq@hex{%
+ \afterassignment\bx@cvseq@post \bxUcv="0}
+\def\bx@cvseq@post#1{%
+ \if ,#1\expandafter\bx@cvseq@post@a
+ \else \bx@err@ilnfm \expandafter\bx@cvseq@fin \fi}
+\def\bx@cvseq@post@a{%
+ \bx@cvseq@do \bx@cvseq@b}
+\def\bx@cvseq@fin#1\@nil{}
+
+%%<+> \bxCodeValueSeqD\CS{<text>}
+% Same as \bxCodeValueSeq, except that it defaults to decimal.
+\def\bxCodeValueSeqD{%
+ \let\bx@cvseq@branch\bx@cvseq@branch@dec \bx@cvseq@a}
+\def\bx@cvseq@branch@dec{%
+ \if !\bx@toka \let\bx@nxt\bx@cvseq@fin
+ \else \let\bx@nxt\bx@cvseq@pfx \fi
+ \bx@nxt}
+
+%%<+> \bxUx, \bxUI, \bxAJ, \bxJI, \bxKI
+% The prefixed names for \Ux, etc. They are (more likely to be)
+% collision-safe.
+\let\bxUx\relax
+\DeclareRobustCommand*\bxUx{\bxCodeValueSeq\bx@Ux}
+\let\bxUI\relax
+\DeclareRobustCommand*\bxUI{\bxCodeValueSeq\bx@UI}
+\let\bxAJ\relax
+\DeclareRobustCommand*\bxAJ{\bxCodeValueSeqD\bx@AJ}
+\let\bxJI\relax
+\DeclareRobustCommand*\bxJI{\bxCodeValueSeq\bx@JI}
+\let\bxKI\relax
+\DeclareRobustCommand*\bxKI{\bxCodeValueSeqD\bx@KI}
+
+%%<+> \bxUHex{<value>}, \bxUInt{<value>}
+% Alternative entry points for \Ux. The code value is specified in
+% hexadecimal (\bxUHex) / decimal (\bxUInt) numerals.
+\def\bxUHex{\protect\bx@Uxh}
+\def\bxUqInt{\protect\bx@UInt}
+\def\bx@UInt#1{\bxUcv=#1\relax\bx@Ux}
+
+%% \bx@UIh@fb, \bx@AJ@fb
+\def\bx@UIh@fb#1{\bxUcv="#1\relax\bxToHexFive\bxUcv
+ \expandafter\bx@b@fb@five\bxHex[Ux]}
+\def\bx@AJ@fb{\bxToDecFive\bxUcv
+ \expandafter\bx@b@fb@five\bxHex[AJ]}
+\def\bx@JI@fb{\bxToHexFour\bxUcv
+ \expandafter\bx@b@fb@four\bxHex[JI]}
+\def\bx@KI@fb{\bxToDecFive\bxUcv
+ \expandafter\bx@b@fb@five\bxHex[KI]}
+\def\bx@b@fb@five#1#2#3#4#5#6[#7]{%
+ \bxFallbackSym{{\sml#7}\\\bx@hx@supzero#1#2#3\\#4#5}}
+\def\bx@b@fb@four#1#2#3#4#5[#6]{%
+ \bxFallbackSym{{\sml#6}\\#1#2\\#3#4}}
+\def\bx@hx@supzero#1{\ifx0#1\else\expandafter#1\fi}
+
+%%%% \bx@assign@Ux
+% Picks up appropriate drivers \bx@Ux etc. according to current
+% load-states of packages.
+% [driver] [purpose] [argument] [default]
+% \bx@Ux Unicode \bxUcv go to \bx@UI
+% \bx@Uxh Unicode #1(hex) go to \bx@UIh
+% \bx@UI Unicode-ideo. \bxUcv go to \bx@UIh
+% \bx@UIh Unicode-ideo. #1(hex) fallback
+% \bx@AJ Adobe-Japan1 \bxUcv fallback
+% From the default value it can be said:
+% - Implemetations for \bx@Ux(h) must fallback on \bx@UI(h) when
+% they cannot be handle the given character, unless such fallback
+% is known to be useless.
+% - When you implement one of \bx@Ux or \bx@Uxh, then you must also
+% implement the other.
+% - When you implement \bx@UI, then you must also implement \bx@UIh.
+% (But you can implement only \bx@UIh.)
+ % Initial values
+\def\bx@Ux{\bx@UI} % pass to \bx@UI
+\def\bx@Uxh{\bx@UIh} % pass to \bx@UIh
+\def\bx@UI{\bxToHexUC\bxUcv\bx@UIh\bxHex} % pass to \bx@UIh
+\let\bx@UIh\bx@UIh@fb % 'fallback' driver
+\let\bx@AJ\bx@AJ@fb % 'fallback' driver
+ % some helpers
+ % one more step put so that \UTF could be redefined
+\def\bx@UIh@otf{\UTF}
+ % \UMS with the argument expanded
+\def\bx@UIh@ums#1{\expandafter\UMS\expandafter{#1}}
+ % \CID with \bxUcv
+\def\bx@AJ@otf{\CID\bxUcv}
+\def\bx@assign@Ux{%
+ % If I have bxucs, then set \bx@Ux to \bx@Ux@ucs
+ % (which fallbacks on \bx@UI in failure).
+ \@ifpackageloaded{bxucs}{%
+ \let\bx@Ux\bx@Ux@ucs\let\bx@Uxh\bx@Uxh@ucs}{}%
+ % If I have ums or bxsuika then I use \UMS as \bx@UIh driver.
+ \@ifpackageloaded{ums}{\bxOktrue}{\bxOkfalse}
+ \@ifpackageloaded{bxsuika}{\bxOktrue}{}
+ \ifbxOk \let\bx@UIh\bx@UIh@UMS \fi
+ % If I have utf or otf then I use \UTF as \bx@UIh driver.
+ \@ifpackageloaded{utf}{\bxOktrue}{\bxOkfalse}
+ \@ifpackageloaded{otf}{\bxOktrue}{}
+ \ifbxOk \let\bx@UIh\bx@UIh@otf \let\bx@AJ\bx@AJ@otf \fi
+ % pxotf is same as otf, except that it also provides a direct
+ % way to \bx@UI and \bx@AJ.
+ \@ifpackageloaded{pxotf}{%
+ \let\bx@UIh\bxUIh@otf \let\bx@UI\pxUcvUTF \let\bx@AJ\pxUcvCID}{}%
+ % If I am upTeX I use \kchar.
+ \ifnum\bx@b@uptex>\z@
+ \def\bx@UI{\kchar\bxUcv}\def\bx@UIh##1{\kchar"##1\relax}%
+ % If I am a Unicode-aware engine, then...
+ \else\ifnum\bxEngineTypeX>\@ne %
+ \def\bx@UI{\char\bxUcv}\def\bx@UIh##1{\char"##1\relax}%
+ \let\bx@Ux\bx@UI \let\bx@Uxh\bx@UIh
+ % zxjatype provides better handling of \UI & \Ux.
+ \@ifpackageloaded{zxjatype}{%
+ \let\bx@UI\zxjt@UI \let\bx@UIh\zxjt@UIh
+ \let\bx@Ux\zxjt@Ux \let\bx@Uxh\zxjt@Uxh}{}%
+ % zxotf provides \CID comamnd.
+ \@ifpackageloaded{zxotf}{%
+ \def\bx@AJ{\CID\bxUcv}}{}%
+ \fi\fi
+ % If \bx@UIh@usr is known I use it.
+ \ifx\bx@UIh@usr\@undefined\else \let\bx@UIh\bx@UIh@usr \fi
+ \let\bx@setuidriver@a\bx@setuidriver@b
+ \ifx\bx@AJ@usr\@undefined\else \let\bx@AJ\bx@AJ@usr \fi
+ \let\bx@setajdriver@a\bx@setajdriver@b
+}
+\@onlypreamble\bx@assign@Ux
+
+%%%% \setUIdriver\CS
+\def\setUIdriver#1{%
+ \ifx#1\@undefined \bx@err@uddrv#1%
+ \else \bx@setuidriver@a#1\fi}
+\def\bx@setuidriver@a#1{\let\bx@UIh@usr#1}
+\def\bx@setuidriver@b#1{\let\bx@UIh#1}
+
+%%%% \setAJdriver\CS
+\def\setAJdriver#1{%
+ \ifx#1\@undefined \bx@err@uddrv#1%
+ \else \bx@setajdriver@a#1\fi}
+\def\bx@setajdriver@a#1{\let\bx@AJ@usr#1}
+\def\bx@setajdriver@b#1{\let\bx@AJ#1}
+
+%%%% \bx@assign@JI
+% Picks up appropriate drivers \bx@JI etc.
+% [driver] [purpose] [argument] [default]
+% \bx@JI JIS-code \bxUcv fallback
+% \bx@KI Kuten-code \bxUcv fallback
+\def\bx@JI{\bx@JI@fb}
+\def\bx@KI{\bx@KI@fb}
+\def\bx@assign@JI{%
+ % \JI & \KI are available only in (u)pTeX
+ \ifnum\bxEngineTypeX=\@ne
+ \def\bx@JI{\char\jis\bxUcv\relax}\let\bx@KI\bx@KI@pTeX
+ \fi
+}
+\ifnum\bxEngineTypeX=\@ne %----<*pTeX>
+%% \bx@KI@pTeX
+ % \KI{2????} (0213 plane 2) works only when kanji-internal=sjis
+\mathchardef\bx@ki@max=\ifnum\jis"2121="8140 30000\else 20000\fi\relax
+\mathchardef\bx@ki@myr=10000
+\mathchardef\bx@ki@bas="2020
+\let\bx@ki@char=\char
+\ifx\kchar\@undefined\else \let\bx@ki@char=\kchar \fi
+\def\bx@KI@pTeX{%
+ \ifnum\bxUcv<\bx@ki@max\else \bxUcv=\z@ \fi
+ \ifnum\bxUcv<\bx@ki@myr \advance\bxUcv\bx@ki@myr \fi
+ \expandafter\bx@ki@ptex@a\the\bxUcv\@nil
+ \bx@ki@char\jis\bxUcv\relax}
+\bgroup \@tempcnta=94
+ \@for\bx@tmpa:=01,08,03,04,05,12,13,14,15\do{\advance\@tempcnta\@ne
+ \expandafter\xdef\csname bx@JSH/\bx@tmpa\endcsname{\the\@tempcnta}}
+ \@tempcntb=77 \loop
+ \advance\@tempcnta\@ne \advance\@tempcntb\@ne
+ \expandafter\xdef\csname bx@JSH/\the\@tempcntb\endcsname
+ {\the\@tempcnta}%
+ \ifnum\@tempcntb<94 \repeat
+\egroup
+\def\bx@ki@ptex@a#1#2#3#4#5#6\@nil{%
+ \ifnum#1=\@ne \bxUcv=#2#3\relax
+ \else \bxUcv=0\csname bx@JSH/#2#3\endcsname\relax \fi
+ \multiply\bxUcv\@cclvi \advance\bxUcv#4#5\relax
+ \advance\bxUcv\bx@ki@bas}
+\fi %----</pTeX>
+\@onlypreamble\bx@assign@JI
+
+%%------ Assignment check
+
+%%%% \bxAssign <assignment>\relax
+\def\bxAssign{%
+ \bxOkfalse\afterassignment\bx@b@assign@a}
+\def\bx@b@assign@a#1\relax{%
+ \def\bx@tmpa{#1}\ifx\bx@tmpa\@empty\bxOktrue\fi}
+
+%%------ Case conversion
+
+%%%% \bxToLower{<string>}
+% Sets to \bxRes <string> converted to lowercase.
+\def\bxToLower#1{%
+ \edef\bxRes{\lowercase{\def\noexpand\bxRes{#1}}}\bxRes}
+
+%%%% \bxToUpper{<string>}
+\def\bxToUpper#1{%
+ \edef\bxRes{\uppercase{\def\noexpand\bxRes{#1}}}\bxRes}
+
+%%------ Document-level specials
+% Such specials must come before any typeset commands in DVI.
+
+%%%% \bxDocumentSpecial{<text>}
+% Appends \special{<text>} to the list of 'document-level specials'.
+% A simple use of \AtBeginDvi will do in this case.
+\def\bxDocumentSpecial#1{%
+ \AtBeginDvi{\special{#1}}}
+\@onlypreamble\bxDocumentSpecial
+
+%%%% \bxDocumentSpecialUrgent{<text>}
+% Similar to the above, but it demands that the given special be
+% placed as early as possible.
+\def\bxDocumentSpecialUrgent#1{%
+ \bx@docspec@urgent@init
+ \bx@prepend@box\bx@dsu@box{\special{#1}}}
+\def\bx@prepend@box#1#2{%
+ \global\setbox#1\vbox{#2\unvbox#1}}
+\providecommand\bx@docspec@urgent@init{\bx@docspec@urgent@init@do}
+\def\bx@docspec@urgent@init@do{%
+ \newbox\bx@dsu@box
+ \AtBeginDocument{%
+ \ifx\AtBeginShipoutFirst\@undefined
+ \bx@prepend@box\@begindvibox{\unvbox\bx@dsu@box}%
+ \else % 'atbegshi' package is in use
+ {\toks@{\unvbox\bx@dsu@box}%
+ \toks\tw@\expandafter{\AtBegShi@HookFirst}%
+ \xdef\AtBegShi@HookFirst{\the\toks@\the\toks\tw@}}
+ \fi}%
+ \bxNullify\bx@docspec@urgent@init}
+\@onlypreamble\bxDocumentSpecialUrgent
+\@onlypreamble\bx@docspec@urgent@init
+\@onlypreamble\bx@docspec@urgent@init@do
+
+%%%% \recordpapersize
+\def\recordpapersize{%
+ \bxDocumentSpecial{papersize=\the\paperwidth,\the\paperheight}%
+ \bxNullify\recordpapersize}
+\@onlypreamble\recordpapersize
+
+%%<*> \dvipdfmxmapline{<text>}
+%%<*> \dvipdfmxmapfile{<text>}
+\def\dvipdfmxmapline#1{\bxDocumentSpecial{pdf:mapline #1}}
+\@onlypreamble\dvipdfmxmapline
+\def\dvipdfmxmapfile#1{\bxDocumentSpecial{pdf:mapfile #1}}
+\@onlypreamble\dvipdfmxmapfile
+
+%%----- "safe-caret" module
+\newif\ifbx@acr@ok
+\newif\ifbx@acr@needed \bx@acr@neededfalse
+\newif\ifbx@safecaret \bx@safecaretfalse
+\catcode`\^=13
+
+%%%%<*> \safecaret
+\def\safecaret{%
+ \bx@safecarettrue}
+\@onlypreamble\safecaret
+
+%%%% \bxEnableSafeCaret
+\def\bxEnableSafeCaret{%
+ \bx@acr@neededtrue}
+\@onlypreamble\bxEnableSafeCaret
+
+%%%% \bx@acr@defbytes
+\def\bx@acr@defbytes{%
+ \bgroup\@tempcnta128\lccode`\Z=`\B\catcode`\^\active
+ \@whilenum\@tempcnta<256 \do{%
+ \lccode`\^\@tempcnta \chardef\bx@acr@tok\@tempcnta
+ \expandafter\bx@acr@defbytes@do@a\meaning\bx@acr@tok\@nil
+ \advance\@tempcnta\@ne}\egroup}
+\def\bx@acr@defbytes@do@a#1"#2\@nil{% name is bx@acr@B/ab etc.
+ \lowercase{\expandafter\gdef\csname bx@acr@Z/#2\endcsname{^}}}
+\@onlypreamble\bx@acr@defbytes
+\@onlypreamble\bx@acr@defbytes@do@a
+
+%%%% \bx@acr@caret
+%% This command should be \let'd to active <^>.
+\def\bx@acr@caret{%
+ \let\bx@acr@out\@empty \bx@acr@caret@a}
+\def\bx@acr@caret@a{%
+ \bx@acr@nextcaret{\bx@acr@caret@b}{\bx@acr@finish{\bx@acr@nxc}}}
+\def\bx@acr@caret@b#1{%
+ \let\bx@acr@hex\@empty
+ \bx@acr@nexthexdgt{\bx@acr@caret@c}{\bx@acr@finish{\bx@acr@nxdc}}}
+\def\bx@acr@caret@c#1{%
+ \edef\bx@acr@hex{#1}%
+ \bx@acr@nexthexdgt{\bx@acr@caret@d}{\bx@acr@finish{\bx@acr@nxdc\bx@acr@hex}}}
+\def\bx@acr@caret@d#1{%
+ \edef\bx@acr@hex{\bx@acr@hex#1}%
+ \expandafter\bx@acr@caret@e\csname bx@acr@B/\bx@acr@hex\endcsname
+ \bx@acr@ifok{\bx@acr@nextcaret{\bx@acr@caret@g}{\bx@acr@finish{}}}%
+ {\bx@acr@finish{\bx@acr@nxdc\bx@acr@hex}}}
+\def\bx@acr@caret@e#1{%
+ \ifx#1\relax \bx@acr@okfalse
+ \else \bx@acr@oktrue \expandafter\bx@acr@caret@f#1\fi}
+\def\bx@acr@caret@f#1{%
+ \expandafter\def\expandafter\bx@acr@out\expandafter{\bx@acr@out#1}}
+\def\bx@acr@caret@g#1{\bx@acr@caret@a}
+\def\bx@acr@nxc{\noexpand^}
+\def\bx@acr@nxdc{\noexpand^\noexpand^}
+\def\bx@acr@nextcaret#1#2{%
+ \def\bx@acr@tmpa{#1}\def\bx@acr@tmpb{#2}%
+ \futurelet\bx@acr@tok\bx@acr@nextcaret@a}
+\def\bx@acr@nextcaret@a{%
+ \let\bx@acr@nxt\bx@acr@tmpb
+ \ifx^\bx@acr@tok \let\bx@acr@nxt\bx@acr@tmpa
+ \fi \bx@acr@nxt}
+\def\bx@acr@nexthexdgt#1#2{%
+ \def\bx@acr@tmpa{#1}\def\bx@acr@tmpb{#2}%
+ \futurelet\bx@acr@tok\bx@acr@nexthexdgt@a}
+\def\bx@acr@nexthexdgt@a{%
+ \let\bx@acr@nxt\bx@acr@tmpb
+ \ifcat @\noexpand\bx@acr@tok \let\bx@acr@nxt\bx@acr@tmpa \fi
+ \ifcat "\noexpand\bx@acr@tok \let\bx@acr@nxt\bx@acr@tmpa \fi
+ \bx@acr@nxt}
+\def\bx@acr@ifok{%
+ \ifbx@acr@ok \expandafter\@firstoftwo \else \expandafter \@secondoftwo \fi}
+\def\bx@acr@finish#1{%
+ \edef\bx@acr@nxt{#1}%
+ \ifx\bx@acr@out\@empty \bx@acr@oktrue \else \bx@acr@okfalse \fi
+ \bx@acr@ifok{\expandafter\bx@acr@finish@a\bx@acr@nxt\@nil}%
+ {\expandafter\bx@acr@out\bx@acr@nxt}}
+\def\bx@acr@finish@a#1#2\@nil{%
+ % replace first ^ with normal one to avoid loop
+ \bx@acr@normcaret #2}
+\let\bx@acr@normcaret\sp % this does not mean much
+
+%%%% \bx@acr@initialize
+\def\bx@acr@initialize{%
+ \bx@acr@defbytes}
+\@onlypreamble\bx@acr@initialize
+
+%%%% \bx@acr@annihilate
+\def\bx@acr@annihilate{%
+ \let\bx@acr@caret\relax\let\bx@acr@caret@a\relax
+ \let\bx@acr@caret@b\relax\let\bx@acr@caret@c\relax
+ \let\bx@acr@caret@d\relax\let\bx@acr@caret@e\relax
+ \let\bx@acr@caret@f\relax\let\bx@acr@caret@g\relax
+ \let\bx@acr@nextcaret\relax\let\bx@acr@nextcaret@a\relax
+ \let\bx@acr@nexthexdgt\relax\let\bx@acr@nexthexdgt@a\relax
+ \let\bx@acr@finish\relax\let\bx@acr@finish@a\relax}
+\@onlypreamble\bx@acr@annihilate
+
+%%%% \bx@acr@babel@hookcaret
+\def\bx@acr@babel@hookcaret{%
+ \expandafter\ifx\csname active@char\string^\endcsname\relax\else
+ \declare@shorthand\system@group{^}{\bx@acr@caret}%
+ \let\bx@acr@normcaret\bx@acr@babel@normcaret
+ \bxEnableSafeCaret \fi}
+\@onlypreamble\bx@acr@babel@hookcaret
+\edef\bx@acr@babel@normcaret{%
+ \expandafter\noexpand\csname normal@char\string^\endcsname}
+
+%%%% \bx@acr@verbatim@hookcaret
+\def\bx@acr@verbatim@hookcaret{%
+ \g@addto@macro\@noligs{\catcode`\^\active\let^\bx@acr@caret
+ \let\bx@acr@normcaret\bx@acr@verb@normcaret}%
+ \bxEnableSafeCaret}
+\begingroup \catcode`\^=12
+\global\let\bx@acr@verb@normcaret=^\endgroup
+\@onlypreamble\bx@acr@verbatim@hookcaret
+
+%%%% begin-document hook
+\providecommand*\bxBDHookSafeCaret{\bx@bdhook@safecaret@do}
+\def\bx@bdhook@safecaret@do{%
+ \AtBeginDocument{%
+ %% function activated by '\safecaret'
+ \ifbx@safecaret
+ \@ifpackageloaded{babel}{\bx@acr@babel@hookcaret}{}%
+ \bx@acr@verbatim@hookcaret
+ \fi
+ %% initialize or annihilate...
+ \ifbx@acr@needed \bx@acr@initialize
+ \else \bx@acr@annihilate \fi
+ \let\bxEnableSafeCaret\@undefined}%
+ \bxNullify\bxBDHookSafeCaret}
+\@onlypreamble\bx@bdhook@safecaret@do
+
+\catcode`\^=6
+%%------ "shadow map" module
+
+%%%% \bxUseShadowMap\CS{<map_tfm>}
+\def\bxUseShadowMap#1#2{%
+ \global\font#1=#2\relax}
+
+%%%% \bxMap\CS
+\mathchardef\bx@m@cc=256
+\def\bxMap#1{\begingroup\count@\bxUcv\divide\count@\bx@m@cc
+ \chardef\bx@m@hb\count@ \multiply\count@\bx@m@cc
+ \advance\bxUcv-\count@ \setbox\z@\hbox{#1\bx@m@hb\char\bxUcv}%
+ \global\bxUcv\wd\z@ \endgroup}
+
+%%------ all done
+\bx@b@resetcatcodes \let\bx@nxt\relax
+\endinput
+%% EOF
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbase.sty b/Master/texmf-dist/tex/platex/pxbase/pxbase.sty
new file mode 100644
index 00000000000..48ec79b113c
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/pxbase.sty
@@ -0,0 +1,129 @@
+%
+% pxbase.sty
+%
+
+%%%% package declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{pxbase}[2010/06/15 v0.5 PX base library]
+
+%%%% include prerequisite packages
+\input{pxbase.def}
+\bxBDHookBabel
+\bxBDHookUnicode
+\bxBDHookJisInput
+\bxBDHookSafeCaret
+\RequirePackage{ifuptex}[2008/03/14]
+
+%%%% error messages
+\def\px@pkgname{pxbase}
+\def\px@b@pkgname{PXbase}
+\def\px@error{\PackageError\px@pkgname}
+\def\px@alert{\PackageWarningNoLine\px@pkgname}
+\def\px@warn{\PackageInfo\px@pkgname}
+\def\px@warn@aecs#1{\px@warn{Command \string#1 already exists}}
+
+%%------ Input through code values
+
+%%<*> \Ux, \UI, \AJ
+\ifx\Ux\@undefined \def\Ux{\bxUx}%
+\else \px@warn@aecs\Ux \fi
+\ifx\UI\@undefined \def\UI{\bxUI}%
+\else \px@warn@aecs\UI \fi
+\ifx\AJ\@undefined \def\AJ{\bxAJ}%
+\else \px@warn@aecs\AJ \fi
+
+%%<*> \JI, \KI
+\ifx\JI\@undefined \def\JI{\bxJI}%
+\else \px@warn@aecs\JI \fi
+\ifx\KI\@undefined \def\KI{\bxKI}%
+\else \px@warn@aecs\KI \fi
+
+%%------ kanji-code detection
+
+%%<+> \pxInternalJEnc
+\ifnum\jis"2121="8140\let\pxInternalJEnc=s\else
+\ifnum\jis"2121="A1A1\let\pxInternalJEnc=e\else
+\ifnum\jis"2121="3000\let\pxInternalJEnc=u\else
+ \let\pxInternalJEnc=?\fi\fi\fi
+
+%%<+> \pxSourceJEnc
+\@@input pxbsjc.def\relax
+\def\px@tmpb#1#2\@nil{%
+ \ifnum `#1=\jis"723F\let\pxSourceJEnc=s\else
+ \ifnum `#1=\jis"693D\let\pxSourceJEnc=e\else
+ \ifnum `#1=\jis"7379\let\pxSourceJEnc=u\else
+ \let\pxSourceJEnc=?\fi\fi\fi}
+\expandafter\px@tmpb\px@tmpa\@nil
+
+%%<*> \infojenc
+\def\px@tmpa{%
+ Kanji encoding: source=%
+ \if s\pxSourceJEnc sjis\else\if e\pxSourceJEnc euc%
+ \else\if u\pxSourceJEnc utf8\else?\fi\fi\fi
+ ; internal=%
+ \if s\pxInternalJEnc sjis\else\if e\pxInternalJEnc euc%
+ \else\if u\pxInternalJEnc unicode\else?\fi\fi\fi}
+\edef\infojenc{\noexpand\typeout{\px@tmpa}}
+
+%%------ force ucs 'fasterrors' option to be in effect
+
+%%%% begindocument hook
+\AtBeginDocument{%
+ \@ifpackageloaded{ucs}{%
+ \let\UnicodeOptionfasterrorsfalse\UnicodeOptionfasterrorstrue
+ \UnicodeOptionfasterrorstrue}{}}
+
+%%------ commands about DVI-specials
+
+%%<*> \usejapanesepdfstring
+\if s\pxInternalJEnc
+ \def\usejapanesepdfstring{% why use CP932??
+ \bxDocumentSpecialUrgent{pdf:tounicode 90ms-RKSJ-UCS2}%
+ \bxNullify\usejapanesepdfstring}
+\else\if e\pxInternalJEnc
+ \def\usejapanesepdfstring{%
+ \bxDocumentSpecialUrgent{pdf:tounicode EUC-UCS2}%
+ \bxNullify\usejapanesepdfstring}
+\else\if u\pxInternalJEnc
+ \def\usejapanesepdfstring{%
+ \px@alert{Japanese PDF strings in upTeX.\MessageBreak
+ You must use upTeX-aware dvipdfmx}%
+ \bxNullify\usejapanesepdfstring}
+\else
+ \def\usejapanesepdfstring{%
+ \px@alert{\string\usejapanesepdfstring\space ignored,\MessageBreak
+ since internal encoding is unknown}%
+ \bxNullify\usejapanesepdfstring}
+\fi\fi\fi
+\@onlypreamble\usejapanesepdfstring
+
+%%------ CJK font scaling
+
+%%<+> \pxDocClassType
+% 1 = pLaTeX standard class
+% 2 = New standard classes by Okumura
+% 0 = otherwise
+\bxUcv=\z@
+\@ifclassloaded{jarticle}{\bxUcv=\@ne}{}
+\@ifclassloaded{jreport}{\bxUcv=\@ne}{}
+\@ifclassloaded{jbook}{\bxUcv=\@ne}{}
+\@ifclassloaded{tarticle}{\bxUcv=\@ne}{}
+\@ifclassloaded{treport}{\bxUcv=\@ne}{}
+\@ifclassloaded{tbook}{\bxUcv=\@ne}{}
+\@ifclassloaded{ujarticle}{\bxUcv=\@ne}{}
+\@ifclassloaded{ujreport}{\bxUcv=\@ne}{}
+\@ifclassloaded{ujbook}{\bxUcv=\@ne}{}
+\@ifclassloaded{utarticle}{\bxUcv=\@ne}{}
+\@ifclassloaded{utreport}{\bxUcv=\@ne}{}
+\@ifclassloaded{utbook}{\bxUcv=\@ne}{}
+\@ifclassloaded{jsarticle}{\bxUcv=\tw@}{}
+\@ifclassloaded{jsbook}{\bxUcv=\tw@}{}
+\chardef\pxDocClassType=\bxUcv
+
+%%<+> \pxUpScale
+\edef\pxUpScale{%
+ \ifcase\pxDocClassType 1\or 0.962216\or 0.924690\else 1\fi}
+
+%%------ all done
+\endinput
+% EOF
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbasenc.def b/Master/texmf-dist/tex/platex/pxbase/pxbasenc.def
new file mode 100644
index 00000000000..8e2dc7a7cb2
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/pxbasenc.def
@@ -0,0 +1,483 @@
+%
+% pxbasenc.def
+%
+%%%% file declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesFile{pxbasenc.def}[2010/05/05 v0.5 PX encoding library]
+
+%%%% preparation
+\RequirePackage{ifuptex}
+%\def\pxec@b@pkgname{PXbase}
+\def\pxec@error{\PackageError\px@b@pkgname}
+\def\pxec@err@irfam#1{\pxec@error
+ {Encodings '\pxec@tmpa' redefined inconsistently}\@ehc}
+\def\pxec@err@ukjsf{\pxec@error
+ {'\k@encoding' is not valid as JSF encoding}\@ehc}
+\edef\pxec@resetcatcode{} % nothing for the present
+\ifx\bxUcv\@undefined
+\newcount\bxUcv
+\fi
+\newif\ifpxec@ok
+\newif\ifpxec@sw
+\newif\ifpxec@star
+
+%%------------------ CJK font declarations
+
+%%%% obtain error kanji font setting
+% for use as 'safe font setting'
+\bgroup \escapechar\m@ne \error@kfontshape
+ \expandafter\let\expandafter\pxec@tenc
+ \csname t@enc@\f@encoding\endcsname
+ \xdef\pxec@safe@jfontspec
+ {{\f@encoding}{\pxec@tenc}{\f@family}{\f@series}{\f@shape}}%
+ \global\expandafter\let\expandafter\pxec@safe@y@decl
+ \csname \f@encoding/\f@family/\f@series/\f@shape\endcsname
+ \global\expandafter\let\expandafter\pxec@safe@t@decl
+ \csname \pxec@tenc/\f@family/\f@series/\f@shape\endcsname
+\egroup
+
+%% \pxec@starinvoke\SOMECS
+\def\pxec@starinvoke#1{%
+ \@ifstar{\pxec@startrue#1}{\pxec@starfalse#1}}
+
+%%<+> \pxDeclareCJKEncoding[*]{<h-enc>}{<v-enc>}
+% *-form uses 'safety fonts' as subtitution.
+\@onlypreamble\pxDeclareCJKEncoding
+\def\pxDeclareCJKEncoding{%
+ \pxec@starinvoke\pxec@DeclareCJKEncoding}
+\@onlypreamble\pxDeclareBasicCJKEncoding
+\let\pxDeclareBasicCJKEncoding\pxDeclareCJKEncoding
+\def\pxec@DeclareCJKEncoding#1#2{%
+ \pxec@check@prior@decl{#1}{#2}%
+ \ifbxOk
+ \edef\pxec@args{{#1}{#2}}%
+ \expandafter\pxec@decl@cjkenc@a\pxec@args
+ \fi}
+\@onlypreamble\pxec@decl@cjkenc@a
+\def\pxec@decl@cjkenc@a#1#2{%
+ \DeclareYokoKanjiEncoding{#1}{}{}%
+ \DeclareTateKanjiEncoding{#2}{}{}%
+ \KanjiEncodingPair{#1}{#2}%
+ \ifpxec@star
+ \expandafter\pxec@decl@cjkenc@b\pxec@safe@jfontspec{#1}{#2}%
+ \else
+ \DeclareKanjiSubstitution{#1}{mc}{m}{n}%
+ \DeclareKanjiSubstitution{#2}{mc}{m}{n}%
+ \fi}
+\@onlypreamble\pxec@decl@cjkenc@b
+\def\pxec@decl@cjkenc@b#1#2#3#4#5#6#7{%
+ \DeclareKanjiFamily{#6}{ferr}{}%
+ \DeclareKanjiSubstitution{#6}{ferr}{#4}{#5}%
+ \expandafter\let\csname#6/ferr/#4/#5\endcsname\pxec@safe@y@decl
+ \DeclareKanjiFamily{#7}{ferr}{}%
+ \DeclareKanjiSubstitution{#7}{ferr}{#4}{#5}%
+ \expandafter\let\csname#7/ferr/#4/#5\endcsname\pxec@safe@t@decl}
+
+%% \pxec@check@prior@decl{<h-enc>}{<v-enc>}
+\@onlypreamble\pxec@check@prior@decl
+\def\pxec@check@prior@decl#1#2{%
+ \bxOktrue \def\pxec@tmpa{#1/#2}%
+ {% check if encodings '#1' and '#2' are declared
+ \count@=0\expandafter\ifx\csname T@#1\endcsname\relax\else1\fi
+ \expandafter\ifx\csname T@#2\endcsname\relax\else1\fi\relax
+ \ifnum\count@=\z@ \relax % neither declared, OK
+ \else\ifnum\count@=\@ne % exactly one declared, NG
+ \aftergroup\pxec@error@prior@decl
+ \else % both declared
+ \edef\pxec@y{#1}\edef\pxec@ty{\@nameuse{y@enc@#2}}%
+ \edef\pxec@t{#2}\edef\pxec@yt{\@nameuse{t@enc@#1}}%
+ \ifx\pxec@y\pxec@ty \ifx\pxec@t\pxec@yt \count@\z@ \fi\fi
+ \ifnum\count@=\z@ \aftergroup\bxOkfalse
+ \else \aftergroup\pxec@error@prior@decl \fi
+ \fi\fi}% after this \pxec@error@prior@decl may be called
+}
+\def\pxec@error@prior@decl{\pxec@err@irfam\pxec@tmpa\bxOkfalse}
+
+%%<+> \pxDeclareBasicCJKFamily[*]{<enc>}{<mc-m>}{<gt-m>}{<mc-bx>}{<gt-bx>}
+% Declares the two most basic CJK family, mc (mincho) and gt (gothic),
+% along with the most basic shapes m/n and bx/n for each of them.
+% *-form means the same as \bxDeclareBasicCJKShape.
+\@onlypreamble\pxDeclareBasicCJKFamily
+\def\pxDeclareBasicCJKFamily{%
+ \pxec@starinvoke\pxec@DeclareBasicCJKFamily}
+\@onlypreamble\pxec@DeclareBasicCJKFamily
+\def\pxec@DeclareBasicCJKFamily#1#2#3#4#5{%
+ \pxec@DeclareExtraCJKFamily{#1}{mc}{#2}{#4}%
+ \pxec@DeclareExtraCJKFamily{#1}{gt}{#3}{#5}}
+
+%%<+> \pxDeclareExtraCJKFamily[*]{<enc>}{<fam>}{<font-m>}{<font-bx>}
+\@onlypreamble\pxDeclareExtraCJKFamily
+\def\pxDeclareExtraCJKFamily{%
+ \pxec@starinvoke\pxec@DeclareExtraCJKFamily}
+\@onlypreamble\pxec@DeclareBasicCJKFamily
+\def\pxec@DeclareExtraCJKFamily#1#2#3#4{%
+ \DeclareKanjiFamily{#1}{#2}{}%
+ \pxec@DeclareBasicCJKShape{#1}{#2}{m}{#3}%
+ \pxec@DeclareBasicCJKShape{#1}{#2}{bx}{#4}}
+
+%% \pxec@DeclareBasicShapeSet[*]{<enc>}{<fam>}{<font-m>}{<font-bx>}
+% (private command used for JSF fonts)
+\@onlypreamble\pxec@DeclareBasicShapeSet
+\def\pxec@DeclareBasicShapeSet{%
+ \pxec@starinvoke\pxec@@DeclareBasicShapeSet}
+\@onlypreamble\pxec@@DeclareBasicShapeSet
+\def\pxec@@DeclareBasicShapeSet#1#2#3#4{%
+ \pxec@DeclareBasicCJKShape{#1}{#2}{m}{#3}%
+ \pxec@DeclareBasicCJKShape{#1}{#2}{bx}{#4}}
+
+%%<+> \pxDeclareBasicCJKFallback{<enc>}{<fam>}{<ser>}
+\def\pxDeclareBasicCJKFallback#1#2#3{%
+ \@for\pxec@x:={it,sl,sc}\do{%
+ \pxDeclareFontShape{#1}{#2}{#3}{\pxec@x}{<->ssub*#2/#3/n}}}
+
+%%<+> \pxDeclareBasicCJKShape[*]{<enc>}{<fam>}{<ser>}{<font>}
+% Declares the font for 'n'-shape. *-form does not set
+% substitution for shapes 'it', 'sl', 'sc'.
+\@onlypreamble\pxDeclareBasicCJKShape
+\def\pxDeclareBasicCJKShape{%
+ \pxec@starinvoke\pxec@DeclareBasicCJKShape}
+\@onlypreamble\pxec@DeclareBasicCJKShape
+\def\pxec@DeclareBasicCJKShape#1#2#3#4{%
+ \edef\pxec@args{{#1}{#2}{#3}{#4}}%
+ \expandafter\pxec@decl@bas@cjkshape@a\pxec@args}
+\@onlypreamble\pxec@decl@bas@cjkshape@a
+\def\pxec@decl@bas@cjkshape@a#1#2#3#4{%
+ \pxDeclareCJKShape{#1}{#2}{#3}{n}{#4}%
+ \ifpxec@star\else \pxDeclareBasicCJKFallback{#1}{#2}{#3}\fi}
+
+%%<+> \pxDeclareCJKShape{<enc>}{<fam>}{<ser>}{<shape>}{<font>}
+% Declares a single font shape. Here <font> is a font spec
+% or a fontsubst form.
+\@onlypreamble\pxDeclareCJKShape
+\def\pxDeclareCJKShape#1#2#3#4#5{%
+ \edef\pxec@args{{#1}{#2}{#3}{#4}{\pxFontSubst{#5}}}%
+ \expandafter\pxec@decl@cjkshape@a\pxec@args}
+\@onlypreamble\pxec@decl@cjkshape@a
+\def\pxec@decl@cjkshape@a#1#2#3#4#5{%
+ \pxDeclareFontShape{#1}{#2}{#3}{#4}{<->#5}}
+
+%%<+> \pxDefineFontSubst{<sym>}{<text>}
+% Defines a 'fontsubst' with name <sym>. After its call,
+% \pxFontSubst{*<sym>} will expand to <text>.
+% N.B. A fontsubst must be fully-expandable.
+%%<+> \pxFontSubst{<spec>}
+% Resolves a 'fontsubst' and expands to the resulted text. That is,
+% - <spec> of form !<text> expands to s*[<value>]<text>, where
+% <value> is the standard scale factor defined in \pxUpScale.
+% - <spec> of fotm *<text> expands to the definition of 'fontsubst'
+% with name <text>.
+% - <spec> of other form is left unchanged.
+\@onlypreamble\pxDefineFontSubst
+\def\pxDefineFontSubst#1{\@namedef{pxec@font*#1}}
+\@onlypreamble\pxFontSubst
+\def\pxFontSubst#1{\pxec@fontsubst@a#1\@nil}
+\@onlypreamble\pxec@fontsubst@a
+\def\pxec@fontsubst@a#1#2\@nil{%
+ \if!#1s*[\pxUpScale]#2%
+ \else\if*#1\@nameuse{pxec@font*#2}\else#1#2\fi\fi}
+% define some fontsubsts
+\pxDefineFontSubst{mc}{ssub*mc/m/n}
+\pxDefineFontSubst{gt}{ssub*gt/m/n}
+
+%%<+> \pxDeclareSimpleShape{<enc>}{<fam>}{<ser>}{<shape>}{<font>}
+% An alias of \pxDeclareCJKShape for compatibility.
+\@onlypreamble\pxDeclareSimpleShape
+\let\pxDeclareSimpleShape\pxDeclareCJKShape
+
+%%<+> \pxDeclareExtraCJKShapeBF{<enc>}{<shape>}
+%% {<mc-m>}{<gt-m>}{<mc-bx>}{<gt-bx>}
+\def\pxDeclareExtraCJKShapeBF#1#2#3#4#5#6{%
+ \pxDeclareCJKShape{#1}{mc}{m}{#2}{#3}%
+ \pxDeclareCJKShape{#1}{gt}{m}{#2}{#4}%
+ \pxDeclareCJKShape{#1}{mc}{bx}{#2}{#5}%
+ \pxDeclareCJKShape{#1}{gt}{bx}{#2}{#6}}
+
+
+%%------------------ passive \DeclareFontShape
+
+%%<+> \pxForceFontDeclaration
+% Takes either of the following values and decides what to do
+% when the font shape is already declared.
+% t : Overwrites declaration.
+% f : Skips declaration.
+% e : Displays an error.
+% It should be t except when other values are needed.
+\let\pxForceFontDeclaration=t
+
+%%<+> \pxDeclareFontShape{<enc>}{<fam>}{<ser>}{<shape>}{<spec>}
+\def\pxDeclareFontShape#1#2#3#4#5{%
+ \expandafter\ifx\csname #1/#2/#3/#4\endcsname\relax
+ \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{}%
+ \else\if e\pxForceFontDeclaration
+ \pxec@error{Font shape #1/#2/#3/#4 already defined}\@ehc
+ \else\if f\pxForceFontDeclaration\else
+ \pxUndeclareFontShape{#1}{#2}{#3}{#4}%
+ \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{}%
+ \fi\fi\fi}
+
+%%<+> \pxUndeclareFontShape{<enc>}{<fam>}{<ser>}{<shape>}
+\def\pxUndeclareFontShape#1#2#3#4{%
+ \expandafter\let\csname #1/#2/#3/#4\endcsname\@undefined
+ \@tfor\pxec@y:=\@vpt\@vipt\@viipt\@viiipt\@ixpt\@xpt
+ \@xipt\@xiipt\@xivpt\@xviipt\@xxpt\@xxvpt\do
+ {\expandafter\let\csname #1/#2/#3/#4/\pxec@y\endcsname\@undefined}}
+
+%%------------------- CJK named encodings
+
+%%<+> \pxDeclareEncodingDispatcher{<enc_name>}{<text>}
+\@onlypreamble\pxDeclareEncodingDispatcher
+\def\pxDeclareEncodingDispatcher#1{%
+ \expandafter\pxec@decl@enc@dispat@a\csname pxec@ED/#1\endcsname}
+\def\pxec@decl@enc@dispat@a#1{\@onlypreamble#1\def#1}
+
+%%<+> \pxDispatchEncodings{<enc_name>,...}
+\@onlypreamble\pxDispatchEncodings
+\def\pxDispatchEncodings#1{%
+ \@for\pxec@x:={#1}\do{%
+ \ifx\pxec@x\@empty\else
+ \expandafter\pxec@dispat@enc@a\csname pxec@ED/\pxec@x\endcsname
+ \expandafter\let\csname pxec@EA/\pxec@x\endcsname=t\relax
+ \fi}}
+\def\pxec@dispat@enc@a#1{#1\let#1\relax}
+
+%%<+> \pxIsEncodingDispatched{<enc_name>}
+\def\pxIsEncodingDispatched#1{%
+ 1\expandafter\ifx\csname pxec@EA/#1\endcsname\relax
+ \expandafter0\else\expandafter1\fi}
+
+%%<+> \pxBothEncodingsFromName\CSyoko\CState{<enc_name>}
+%%<+> \pxEncodingFromName{<enc_name>}
+%%<+> \pxTateEncodingFromName{<enc_name>}
+\def\pxBothEncodingsFromName#1#2#3{%
+ \expandafter\let\expandafter#1\csname pxec@EY/#3\endcsname
+ \expandafter\let\expandafter#2\csname pxec@ET/#3\endcsname}
+\def\pxEncodingFromName#1{\csname pxec@EY/#1\endcsname}
+\def\pxTateEncodingFromName#1{\csname pxec@ET/#1\endcsname}
+
+%%<+> \pxSetEncodingName{<enc_name>}{<h_enc>}{<v_enc>}
+\@onlypreamble\pxSetEncodingName
+\def\pxSetEncodingName#1#2#3{%
+ \@namedef{pxec@EY/#1}{#2}\@namedef{pxec@ET/#1}{#3}}
+
+%%------ font declarations using named encodings
+
+%%<+> \pxec@supdef\SOMECS{<text1>}{<text2>}
+% Define \SOMECS to be <text1> if <text1> is non-empty,
+% otherwise <text2>.
+\def\pxec@supdef#1#2#3{%
+ \def#1{#2}\ifx#1\@empty \def#1{#3}\fi}
+
+%%<+> \pxDeclareCJKEncodingNE[*]{<enc_name>}
+\@onlypreamble\pxDeclareCJKEncodingNE
+\def\pxDeclareCJKEncodingNE{%
+ \pxec@starinvoke\pxec@DeclareCJKEncodingNE}
+\def\pxec@DeclareCJKEncodingNE#1{%
+ \pxBothEncodingsFromName\pxec@y\pxec@t{#1}%
+ \pxec@DeclareCJKEncoding\pxec@y\pxec@t}
+
+%%<+> \pxDeclareExtraCJKFamilyNE[*]
+%% {<enc-name>}{<fam>}{<h-m>}{<h-bx>}{<v-m>}{<v-bx>}
+\@onlypreamble\pxDeclareExtraCJKFamilyNE
+\def\pxDeclareExtraCJKFamilyNE{%
+ \pxec@starinvoke\pxec@DeclareExtraCJKFamilyNE}
+\@onlypreamble\pxec@DeclareBasicCJKFamilyNE
+\def\pxec@DeclareExtraCJKFamilyNE#1#2#3#4#5#6{%
+ \pxBothEncodingsFromName\pxec@y\pxec@t{#1}%
+ \DeclareKanjiFamily{\pxec@y}{#2}{}%
+ \pxec@DeclareBasicCJKShape{\pxec@y}{#2}{m}{#3}%
+ \pxec@DeclareBasicCJKShape{\pxec@y}{#2}{bx}{#4}%
+ \DeclareKanjiFamily{\pxec@t}{#2}{}%
+ \pxec@supdef\pxec@vm{#5}{#3}\pxec@supdef\pxec@vb{#6}{#4}%
+ \pxec@DeclareBasicCJKShape{\pxec@t}{#2}{m}{\pxec@vm}%
+ \pxec@DeclareBasicCJKShape{\pxec@t}{#2}{bx}{\pxec@vb}}
+
+%%<+> \pxDeclareBasicCJKShapeNE[*]
+%% {<enc-name>}{<fam>}{<ser>}{<h-font>}{<v-font>}
+% Declares the font shape for 'n'-shape. *-form does not set
+% substitution for shapes 'it', 'sl', 'sc'.
+\@onlypreamble\pxDeclareBasicCJKShapeNE
+\def\pxDeclareBasicCJKShapeNE{%
+ \pxec@starinvoke\pxec@DeclareBasicCJKShapeNE}
+\@onlypreamble\pxec@DeclareBasicCJKShapeNE
+\def\pxec@DeclareBasicCJKShapeNE#1#2#3#4#5{%
+ \pxBothEncodingsFromName\pxec@y\pxec@t{#1}%
+ \pxec@supdef\pxec@z{#5}{#4}%
+ \pxec@DeclareBasicCJKShape\pxec@y{#2}{#3}{#4}%
+ \pxec@DeclareBasicCJKShape\pxec@t{#2}{#3}{\pxec@z}}
+
+%%<+> \pxDeclareCJKShapeNE
+%% {<enc_name>}{<fam>}{<ser>}{<shape>}{<h_font>}{<v_font>}
+\@onlypreamble\pxDeclareCJKShapeNE
+\def\pxDeclareCJKShapeNE#1#2#3#4#5#6{%
+ \pxBothEncodingsFromName\pxec@y\pxec@t{#1}%
+ \pxec@supdef\pxec@z{#6}{#5}%
+ \pxDeclareCJKShape\pxec@y{#2}{#3}{#4}{#5}%
+ \pxDeclareCJKShape\pxec@t{#2}{#3}{#4}{\pxec@z}}
+
+%%------------------- JSF encodings
+
+%%<+> \pxDeclareJSFEncoding{<h-enc>}{<v-enc>}{<sfid>,...}
+\def\pxDeclareJSFEncoding#1#2#3{%
+ \pxDeclareBasicCJKEncoding*{#1}{#2}%
+ \expandafter\edef\csname pxec@ZL/#1\endcsname{#3}%
+ \expandafter\let\csname pxec@ZL/#2\expandafter\endcsname
+ \csname pxec@ZL/#1\endcsname}
+
+%%<+> \DeclareJSFFamily{<enc>}{<fam>}[<sfid>,...]{<body>}
+%%<+> \AppendToJSFFamily{<enc>}{<fam>}[<sfid>,...]{<body>}
+\def\DeclareJSFFamily{\pxec@starfalse\pxec@DeclareJSFFamily}
+\def\AppendToJSFFamily{\pxec@startrue\pxec@DeclareJSFFamily}
+\def\pxec@DeclareJSFFamily#1#2{%
+ \edef\pxec@djf@enc{#1}\edef\pxec@djf@fam{#2}%
+ \expandafter\let\expandafter\pxec@sfidlst\csname pxec@ZL/#1\endcsname
+ \@ifnextchar[%
+ \pxec@decl@jsf@fam@a{\pxec@decl@jsf@fam@b\relax}}
+\def\pxec@decl@jsf@fam@a[#1]{%
+ \pxec@decl@jsf@fam@b{\edef\pxec@sfidlst{#1}}}
+\def\pxec@decl@jsf@fam@b#1{%
+ \ifx\pxec@sfidlst\relax \pxec@err@ukjsf
+ \else #1\expandafter\pxec@decl@jsf@fam@c \fi}
+\def\pxec@decl@jsf@fam@c{%
+ \afterassignment\pxec@decl@jsf@fam@d\def\pxec@djf@body##1##2}
+\def\pxec@decl@jsf@fam@d{%
+ \ifpxec@star\else
+ \DeclareKanjiFamily{\pxec@djf@enc}{\pxec@djf@fam=Z}{\relax}\fi
+ \edef\pxec@nxt{\noexpand\@for\noexpand\pxec@djf@x:=\pxec@sfidlst}%
+ {\pxec@nxt\do{\pxec@decl@jsf@fam@do}}}
+\def\pxec@decl@jsf@fam@do{%
+ \global\expandafter\let\csname
+ pxec@Z/\pxec@djf@enc/\pxec@djf@fam/\pxec@djf@x\endcsname=t%
+ \edef\pxec@famx{\pxec@djf@fam=Z\pxec@djf@x}%
+ \DeclareKanjiFamily{\pxec@djf@enc}{\pxec@famx}{}%
+ \bxDebug{font family \pxec@famx\space loaded}%
+ \edef\JSFBasicShapeSet{\pxec@djf@starinvoke\pxec@JSFBasicShapeSet}%
+ \edef\JSFFallback{\pxec@djf@invoke\pxec@JSFFallback}%
+ \edef\JSFBasicShape{\pxec@djf@starinvoke\pxec@JSFBasicShape}%
+ \edef\JSFShape{\pxec@djf@starinvoke\pxec@JSFShape}%
+ \pxec@djf@body\pxec@djf@x\pxec@djf@fam}
+\def\pxec@djf@invoke#1{\noexpand#1{\pxec@djf@enc}{\pxec@famx}}
+\def\pxec@djf@starinvoke#1{\noexpand\pxec@starinvoke\pxec@djf@invoke#1}
+
+%%%% commands used inside \DeclareJSFFamily
+
+%%<+> \JSFBasicShapeSet[*]{<font-m-n>}{<font-bx-n>}
+\def\pxec@JSFBasicShapeSet{\pxec@DeclareBasicShapeSet}
+
+%%<+> \JSFFallback{<ser>}
+\def\pxec@JSFFallback{\pxDeclareBasicCJKFallback}
+
+%%<+> \JSFBasicShape[*]{<ser>}{<font-n>}
+\def\pxec@JSFBasicShape{\pxDeclareBasicCJKShape}
+
+%%<+> \JSFShape[*]{<ser>}{<shape>}{<font>}
+\def\pxec@JSFShape{%
+ \ifpxec@star \expandafter\pxDeclareFontShape
+ \else \expandafter\pxDeclareCJKShape \fi}
+
+%%<+> \JSFShapeRaw{<ser>}{<shape>}{<spec>}
+\def\pxec@JSFShapeRaw{\pxDeclareFontShape}
+
+%%------------------ basic encodings
+
+%%%% the standard Japanese encodings
+\ifnativeupTeX
+\def\pxStdYEnc{JY2}\def\pxStdTEnc{JT2}
+\else
+\def\pxStdYEnc{JY1}\def\pxStdTEnc{JT1}
+\fi
+
+%%%% encoding name 'standard' for standard encodings
+\edef\pxec@args{{standard}{\pxStdYEnc}{\pxStdTEnc}}
+\expandafter\pxSetEncodingName\pxec@args
+
+%%%% user interfaces
+
+%%<*> \selectjaencoding{<enc_name>}
+\DeclareRobustCommand*\selectjaencoding[1]{%
+ \edef\pxec@tmpa{\pxEncodingFromName{#1}}%
+ \pxec@selectjaencoding\pxec@tmpa \ignorespaces}
+
+%%<*> \normaljaencoding
+\DeclareRobustCommand*\normaljaencoding{%
+ \pxec@selectjaencoding\kanjiencodingdefault}
+
+%%<*> \standardjaencoding
+\DeclareRobustCommand*\standardjaencoding{%
+ \pxec@selectjaencoding\pxStdYEnc}
+
+%% \pxec@selectjaencoding{<enc>}
+% Adjustment for pxbabel.
+\def\pxec@selectjaencoding#1{%
+ \ifx\pxInNonJaLanguage\@undefined \kanjiencoding{#1}\selectfont\fi
+ \ifx\pxbb@org@encoding\@undefined\else \edef\pxbb@org@encoding{#1}\fi}
+
+%%%% declarations for basic Japanese encodings
+
+\ifnativeupTeX %<upTeX>
+
+%% J20, J30 : 2000jis
+\pxSetEncodingName{2000jis}{J20}{J30}
+\pxDeclareEncodingDispatcher{2000jis}{\pxDeclareCJKEncodingNE{2000jis}}
+
+%% J24, J34 : 2004jis
+\pxSetEncodingName{2004jis}{J24}{J34}
+\pxDeclareEncodingDispatcher{2004jis}{\pxDeclareCJKEncodingNE{2004jis}}
+
+\else %<pTeX>
+
+%% J00, J10 : 78jis
+\pxSetEncodingName{78jis}{J00}{J10}
+\pxDeclareEncodingDispatcher{78jis}{\pxDeclareCJKEncodingNE{78jis}}
+
+% It is assumed that the standard encodings (JY1/JT1) have 83JIS form.
+% Thus the encoding '83jis' will not be used.
+%% J01, J11 : 83jis
+%\pxSetEncodingName{83jis}{J01}{J11}
+%\pxDeclareEncodingDispatcher{83jis}{\pxDeclareCJKEncodingNE{83jis}}
+
+% The name "J02/J12' is intended to mean 90JIS (= 97JIS), but Adobe does
+% not distinguish 90JIS from 83JIS. So I will make no distinction between
+% then either.
+
+% The fonts for standard families (mc & gt) in '2000jis' encoding are not
+% provided together with PXfontspec bundle, so this encoding is not ready
+% for use unless the appropriate fonts (jfms) are prepared.
+%% J03, J13 : 2000jis
+\pxSetEncodingName{2000jis}{J03}{J13}
+\pxDeclareEncodingDispatcher{2000jis}{\pxDeclareCJKEncodingNE{2000jis}}
+
+%% J04, J14 : 2004jis
+\pxSetEncodingName{2004jis}{J04}{J14}
+\pxDeclareEncodingDispatcher{2004jis}{\pxDeclareCJKEncodingNE{2004jis}}
+
+%% J08, J18 : winj (CP932)
+\pxSetEncodingName{winj}{J08}{J18}
+\pxDeclareEncodingDispatcher{winj}{\pxDeclareCJKEncodingNE{winj}}
+
+\fi %</upTeX>
+
+%%------------------ patches to OTF/UTF packages
+
+%%%% make \CID work in nonstandard CJK encodings
+% \UTF & \CID require the current encoding to be the standard one, thus
+% they won't work well along with packages that change Japanese encoding
+% (pxfontenc, pxbabel, etc.). This patch resolves this problem.
+\providecommand*\pxBDHookEncSwitchOTF{\pxec@bdhook@encswotf@do}
+\@onlypreamble\pxec@bdhook@encswotf@do
+\def\pxec@bdhook@encswotf@do{%
+ \AtBeginDocument{%
+ \@ifpackageloaded{otf}{\let\pxec@JYn\otf@JYn}{}%
+ \@ifpackageloaded{utf}{\let\pxec@JYn\utf@JYn}{}%
+ \ifx\pxec@JYn\@undefined\else
+ % hook at the \set@character invocation, so that encoding will
+ % be forced to be the standard one
+ \long\def\set@character{% \long, as the original is
+ \afterassignment\pxec@put@character\@tempcnta}%
+ \def\pxec@put@character{\kanjiencoding{\pxec@JYn}\put@character}%
+ \fi}%
+ \let\pxBDHookEncSwitchOTF\@empty}% nullify
+
+%%------------------ all done
+\pxec@resetcatcode
+\endinput
+%% EOF
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbsjc.def b/Master/texmf-dist/tex/platex/pxbase/pxbsjc.def
new file mode 100644
index 00000000000..26852f21cca
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/pxbsjc.def
@@ -0,0 +1,6 @@
+%
+% pxbsjc.def
+% Warning: Do not change encoding of this file!
+\def\px@tmpa{齷齷}% E9 BD B7 E9 BD B7
+\endinput
+% EOF
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxcjkcat.sty b/Master/texmf-dist/tex/platex/pxbase/pxcjkcat.sty
new file mode 100644
index 00000000000..45b1db0d212
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/pxcjkcat.sty
@@ -0,0 +1,482 @@
+%
+% pxcjkcat.sty
+%
+%%%% package declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{pxcjkcat}[2010/02/07 v0.4a PX cjk-category mode]
+\RequirePackage{ifuptex}[2008/03/14]\RequirenativeupTeX
+
+%%%% error messages
+\def\pxkc@pkgname{pxcjkcat}
+\def\pxkc@error{\PackageError\pxkc@pkgname}
+\def\pxkc@err@ivcsy#1{\pxkc@error
+ {Invalid name (#1) for cjk-category}%
+ {It was replaced by 18(cjk).}}
+\def\pxkc@err@ivbsy#1{\pxkc@error
+ {Invalid name (#1) for Unicode block}\@eha}
+\def\pxkc@err@ivmsy#1{\pxkc@error
+ {Invalid name (#1) for cjk-category mode}\@eha}
+\ifx\bxUseDebug\@undefined
+\let\pxkc@debug\@gobble
+\else
+\def\pxkc@debug#1{\typeout{**[\pxkc@pkgname] #1}}
+\fi
+
+%%%% prepraration
+\newif\ifpxkc@ok
+
+%%%% option handler
+\chardef\pxkc@mccv=1
+\DeclareOption{ccv1}{\chardef\pxkc@mccv=1 }
+\DeclareOption{ccv2}{\chardef\pxkc@mccv=2 }
+\chardef\pxkc@rccv=0
+%% ** These options are for debugging!
+\DeclareOption{@ccv1}{\chardef\pxkc@rccv=1 }
+\DeclareOption{@ccv2}{\chardef\pxkc@rccv=2 }
+\let\pxkc@ccmode\relax
+\DeclareOption*{\edef\pxkc@ccmode{\CurrentOption}}
+\ProcessOptions\relax
+
+%%-------- classification version check
+
+%% \pxkc@issameblock
+\def\pxkc@issameblock#1#2{%
+ \pxkc@okfalse{\kcatcode#1=16\kcatcode#2=17\relax
+ \ifnum\kcatcode#1=17 \aftergroup\pxkc@oktrue\fi}}
+\pxkc@issameblock{"FF01}{"FF11}
+\ifpxkc@ok
+\chardef\pxkc@ccv=1 % v0.11+
+\else
+\chardef\pxkc@ccv=2 % v0.29+
+\fi
+\ifnum\pxkc@rccv>\z@ \let\pxkc@ccv\pxkc@rccv \fi
+\pxkc@debug{CJK category version \number\pxkc@ccv}
+%
+\ifnum\pxkc@mccv>\pxkc@ccv
+ \pxkc@error{Invalid mode-CCV option (ccv\number\pxkc@mccv)}%
+ {The mode-CCV value given (\number\pxkc@mccv) is
+ larger than the real CCV (\number\pxkc@ccv).\MessageBreak
+ I assume the mode-CCV equals the real CCV.}
+ \let\pxkc@mccv\pxkc@ccv
+\fi
+
+%%------ \setcjkcategory, etc.
+
+%% \pxkc@kcatcode
+\ifx\bxUseDebug\@undefined
+\def\pxkc@kcatcode#1#2{\kcatcode#1=#2\relax}
+\else
+\def\pxkc@kcatcode#1#2{\kcatcode#1=#2\relax
+ \chardef\pxkc@xa=#1\chardef\pxkc@xb=#2\relax
+ \expandafter\pxkc@kcatcode@a\meaning\pxkc@xa\@nil}
+\def\pxkc@kcatcode@a#1"#2\@nil{%
+ \pxkc@debug{\string\kcatcode"#2 set to \number\pxkc@xb}}
+\fi
+
+
+%%%% table
+\def\pxkc@bval#1#2{%
+ \edef\pxkc@bslst{\pxkc@bslst\pxkc@sep#1}%
+ \@namedef{pxkc@B@@#1}{#2}\def\pxkc@sep{,}}
+\def\pxkc@bslst{}\def\pxkc@sep{}
+\def\pxkc@cval#1#2{\@namedef{pxkc@C@@#1}{#2}}
+\def\pxkc@gval#1#2{\@namedef{pxkc@G@@#1}{#2}}
+ %
+\pxkc@bval{latn}{"0} % Basic Latin
+\pxkc@bval{latn1}{"80} % Latin-1 Supplement
+\pxkc@bval{latnA}{"100} % Latin Extended-A
+\pxkc@bval{latnB}{"180} % Latin Extended-B
+\pxkc@bval{latn2}{"250} % IPA Extensions
+\pxkc@bval{sym01}{"2B0} % Spacing Modifier Letters
+\pxkc@bval{sym02}{"300} % Combining Diacritical Marks
+\pxkc@bval{grek}{"370} % Greek and Coptic
+\pxkc@bval{cyrl}{"400} % Cyrillic
+\pxkc@bval{cyrl1}{"500} % Cyrillic Supplement
+\pxkc@bval{armn}{"530} % Armenian
+\pxkc@bval{hebr}{"590} % Hebrew
+\pxkc@bval{arab}{"600} % Arabic
+\pxkc@bval{syrc}{"700} % Syriac
+\pxkc@bval{arab1}{"750} % Arabic Supplement
+\pxkc@bval{thaa}{"780} % Thaana
+\pxkc@bval{nkoo}{"7C0} % NKo
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{samr}{"800} % Samaritan
+\fi
+\pxkc@bval{deva}{"900} % Devanagari
+\pxkc@bval{beng}{"980} % Bengali
+\pxkc@bval{guru}{"A00} % Gurmukhi
+\pxkc@bval{gujr}{"A80} % Gujarati
+\pxkc@bval{orya}{"B00} % Oriya
+\pxkc@bval{taml}{"B80} % Tamil
+\pxkc@bval{telu}{"C00} % Telugu
+\pxkc@bval{knda}{"C80} % Kannada
+\pxkc@bval{mlym}{"D00} % Malayalam
+\pxkc@bval{sinh}{"D80} % Sinhala
+\pxkc@bval{thai}{"E00} % Thai
+\pxkc@bval{laoo}{"E80} % Lao
+\pxkc@bval{tibt}{"F00} % Tibetan
+\pxkc@bval{mymr}{"1000} % Myanmar
+\pxkc@bval{geor}{"10A0} % Georgian
+\pxkc@bval{hang1}{"1100} % Hangul Jamo
+\pxkc@bval{ethi}{"1200} % Ethiopic
+\pxkc@bval{ethi1}{"1380} % Ethiopic Supplement
+\pxkc@bval{cher}{"13A0} % Cherokee
+\pxkc@bval{cans}{"1400} % Unified Canadian Aboriginal Syllabics
+\pxkc@bval{ogam}{"1680} % Ogham
+\pxkc@bval{runr}{"16A0} % Runic
+\pxkc@bval{tglg}{"1700} % Tagalog
+\pxkc@bval{hano}{"1720} % Hanunoo
+\pxkc@bval{buhd}{"1740} % Buhid
+\pxkc@bval{tagb}{"1760} % Tagbanwa
+\pxkc@bval{khmr}{"1780} % Khmer
+\pxkc@bval{mong}{"1800} % Mongolian
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{cans1}{"1880} % Unified Canadian Aboriginal Syll. Ext.
+\fi
+\pxkc@bval{limb}{"1900} % Limbu
+\pxkc@bval{tale}{"1950} % Tai Le
+\pxkc@bval{talu}{"1980} % New Tai Lue
+\pxkc@bval{khmr1}{"19E0} % Khmer Symbols
+\pxkc@bval{bugi}{"1A00} % Buginese
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{lana}{"1A20} % Tai Tham
+\fi
+\pxkc@bval{bali}{"1B00} % Balinese
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{sund}{"1B80} % Sundanese
+\pxkc@bval{lepc}{"1C00} % Lepcha
+\pxkc@bval{olck}{"1C50} % Ol Chiki
+\pxkc@bval{sym38}{"1CD0} % Vedic Extensions
+\fi
+\pxkc@bval{latn4}{"1D00} % Phonetic Extensions
+\pxkc@bval{latn5}{"1D80} % Phonetic Extensions Supplement
+\pxkc@bval{sym03}{"1DC0} % Combining Diacritical Marks Supplement
+\pxkc@bval{latn3}{"1E00} % Latin Extended Additional
+\pxkc@bval{grek1}{"1F00} % Greek Extended
+\pxkc@bval{sym04}{"2000} % General Punctuation
+\pxkc@bval{sym05}{"2070} % Superscripts and Subscripts
+\pxkc@bval{sym06}{"20A0} % Currency Symbols
+\pxkc@bval{sym07}{"20D0} % Combining Diacritical Marks for Symbols
+\pxkc@bval{sym08}{"2100} % Letterlike Symbols
+\pxkc@bval{sym09}{"2150} % Number Forms
+\pxkc@bval{sym10}{"2190} % Arrows
+\pxkc@bval{sym11}{"2200} % Mathematical Operators
+\pxkc@bval{sym12}{"2300} % Miscellaneous Technical
+\pxkc@bval{sym13}{"2400} % Control Pictures
+\pxkc@bval{sym14}{"2440} % Optical Character Recognition
+\pxkc@bval{sym15}{"2460} % Enclosed Alphanumerics
+\pxkc@bval{sym16}{"2500} % Box Drawing
+\pxkc@bval{sym17}{"2580} % Block Elements
+\pxkc@bval{sym18}{"25A0} % Geometric Shapes
+\pxkc@bval{sym19}{"2600} % Miscellaneous Symbols
+\pxkc@bval{sym20}{"2700} % Dingbats
+\pxkc@bval{sym21}{"27C0} % Miscellaneous Mathematical Symbols-A
+\pxkc@bval{sym22}{"27F0} % Supplemental Arrows-A
+\pxkc@bval{brai}{"2800} % Braille Patterns
+\pxkc@bval{sym23}{"2900} % Supplemental Arrows-B
+\pxkc@bval{sym24}{"2980} % Miscellaneous Mathematical Symbols-B
+\pxkc@bval{sym25}{"2A00} % Supplemental Mathematical Operators
+\pxkc@bval{sym26}{"2B00} % Miscellaneous Symbols and Arrows
+\pxkc@bval{glag}{"2C00} % Glagolitic
+\pxkc@bval{latnC}{"2C60} % Latin Extended-C
+\pxkc@bval{copt}{"2C80} % Coptic
+\pxkc@bval{geor1}{"2D00} % Georgian Supplement
+\pxkc@bval{tfng}{"2D30} % Tifinagh
+\pxkc@bval{ethi2}{"2D80} % Ethiopic Extended
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{cyrlA}{"2DE0} % Cyrillic Extended-A
+\fi
+\pxkc@bval{sym27}{"2E00} % Supplemental Punctuation
+\pxkc@bval{cjk01}{"2E80} % CJK Radicals Supplement
+\pxkc@bval{cjk02}{"2F00} % Kangxi Radicals
+\pxkc@bval{cjk03}{"2FF0} % Ideographic Description Characters
+\pxkc@bval{cjk04}{"3000} % CJK Symbols and Punctuation
+\pxkc@bval{hira}{"3040} % Hiragana
+\pxkc@bval{kana}{"30A0} % Katakana
+\pxkc@bval{bopo}{"3100} % Bopomofo
+\pxkc@bval{hang2}{"3130} % Hangul Compatibility Jamo
+\pxkc@bval{cjk05}{"3190} % Kanbun
+\pxkc@bval{bopo1}{"31A0} % Bopomofo Extended
+\pxkc@bval{cjk06}{"31C0} % CJK Strokes
+\pxkc@bval{kana1}{"31F0} % Katakana Phonetic Extensions
+\pxkc@bval{cjk07}{"3200} % Enclosed CJK Letters and Months
+\pxkc@bval{cjk08}{"3300} % CJK Compatibility
+\pxkc@bval{haniA}{"3400} % CJK Unified Ideographs Extension A
+\pxkc@bval{sym28}{"4DC0} % Yijing Hexagram Symbols
+\pxkc@bval{hani}{"4E00} % CJK Unified Ideographs
+\pxkc@bval{yiii}{"A000} % Yi Syllables
+\pxkc@bval{yiii1}{"A490} % Yi Radicals
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{lisu}{"A4D0} % Lisu
+\pxkc@bval{vaii}{"A500} % Vai
+\pxkc@bval{cyrlB}{"A640} % Cyrillic Extended-B
+\pxkc@bval{bamu}{"A6A0} % Bamum
+\fi
+\pxkc@bval{sym29}{"A700} % Modifier Tone Letters
+\pxkc@bval{latnD}{"A720} % Latin Extended-D
+\pxkc@bval{sylo}{"A800} % Syloti Nagri
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{sym39}{"A830} % Common Indic Number Forms
+\fi
+\pxkc@bval{phag}{"A840} % Phags-pa
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{saur}{"A830} % Saurashtra
+\pxkc@bval{deva1}{"A8E0} % Devanagari Extended
+\pxkc@bval{kali}{"A900} % Kayah Li
+\pxkc@bval{rjng}{"A930} % Rejang
+\pxkc@bval{hangA}{"A960} % Hangul Jamo Extended-A
+\pxkc@bval{java}{"A980} % Javanese
+\pxkc@bval{cham}{"AA00} % Cham
+\pxkc@bval{mymrA}{"AA60} % Myanmar Extended-A
+\pxkc@bval{tavt}{"AA80} % Tai Viet
+\pxkc@bval{mtei}{"ABC0} % Meetei Mayek
+\fi
+\pxkc@bval{hang}{"AC00} % Hangul Syllables
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{hangB}{"D7B0} % Hangul Jamo Extended-B
+\fi
+\pxkc@bval{spc01}{"D800} % High Surrogates
+\pxkc@bval{spc02}{"DB80} % High Private Use Surrogates
+\pxkc@bval{spc03}{"DC00} % Low Surrogates
+\pxkc@bval{spc04}{"E000} % Private Use Area
+\pxkc@bval{hani1}{"F900} % CJK Compatibility Ideographs
+\pxkc@bval{latn6}{"FB00} % Alphabetic Presentation Forms
+\pxkc@bval{arab2}{"FB50} % Arabic Presentation Forms-A
+\pxkc@bval{spc05}{"FE00} % Variation Selectors
+\pxkc@bval{cjk09}{"FE10} % Vertical Forms
+\pxkc@bval{sym30}{"FE20} % Combining Half Marks
+\pxkc@bval{cjk10}{"FE30} % CJK Compatibility Forms
+\pxkc@bval{cjk11}{"FE50} % Small Form Variants
+\pxkc@bval{arab3}{"FE70} % Arabic Presentation Forms-B
+\ifnum\pxkc@ccv<2
+\pxkc@bval{cjk12}{"FF00} % Halfwidth and Fullwidth Forms
+\else
+\pxkc@gval{cjk12}{cjk1a,cjk1b,cjk1c} % Halfwidth and Fullwidth Forms
+\pxkc@bval{cjk1a}{"FF01} % cjk12 subblock A
+\pxkc@bval{cjk1b}{"FF10} % cjk12 subblock B
+\pxkc@bval{cjk1c}{"FF66} % cjk12 subblock C
+\fi
+\pxkc@bval{spc06}{"FFF0} % Specials
+\pxkc@bval{linb}{"10000} % Linear B Syllabary
+\pxkc@bval{linb1}{"10080} % Linear B Ideograms
+\pxkc@bval{sym31}{"10100} % Aegean Numbers
+\pxkc@bval{grek2}{"10140} % Ancient Greek Numbers
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{sym40}{"10190} % Ancient Greek Numbers
+\pxkc@bval{sym41}{"101D0} % Ancient Greek Numbers
+\pxkc@bval{lyci}{"10280} % Ancient Greek Numbers
+\pxkc@bval{cari}{"102A0} % Ancient Greek Numbers
+\fi
+\pxkc@bval{ital}{"10300} % Old Italic
+\pxkc@bval{goth}{"10330} % Gothic
+\pxkc@bval{ugar}{"10380} % Ugaritic
+\pxkc@bval{xpeo}{"103A0} % Old Persian
+\pxkc@bval{dsrt}{"10400} % Deseret
+\pxkc@bval{shaw}{"10450} % Shavian
+\pxkc@bval{osma}{"10480} % Osmanya
+\pxkc@bval{cprt}{"10800} % Cypriot Syllabary
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{armi}{"10840} % Imperial Aramaic
+\fi
+\pxkc@bval{phnx}{"10900} % Phoenician
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{lydi}{"10920} % Lydian
+\fi
+\pxkc@bval{khar}{"10A00} % Kharoshthi
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{sarb}{"10A60} % Old South Arabian
+\pxkc@bval{avst}{"10B00} % Avestan
+\pxkc@bval{prti}{"10B40} % Inscriptional Parthian
+\pxkc@bval{phli}{"10B60} % Inscriptional Pahlavi
+\pxkc@bval{orkh}{"10C00} % Old Turkic
+\pxkc@bval{sym42}{"10E60} % Rumi Numeral Symbols
+\pxkc@bval{kthi}{"11080} % Kaithi
+\fi
+\pxkc@bval{xsux}{"12000} % Cuneiform
+\pxkc@bval{xsux1}{"12400} % Cuneiform Numbers and Punctuation
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{egyp}{"13000} % Egyptian Hieroglyphs
+\fi
+\pxkc@bval{sym32}{"1D000} % Byzantine Musical Symbols
+\pxkc@bval{sym33}{"1D100} % Musical Symbols
+\pxkc@bval{sym34}{"1D200} % Ancient Greek Musical Notation
+\pxkc@bval{sym35}{"1D300} % Tai Xuan Jing Symbols
+\pxkc@bval{sym36}{"1D360} % Counting Rod Numerals
+\pxkc@bval{sym37}{"1D400} % Mathematical Alphanumeric Symbols
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{sym43}{"1F000} % Mahjong Tiles
+\pxkc@bval{sym44}{"1F030} % Domino Tiles
+\pxkc@bval{sym45}{"1F100} % Enclosed Alphanumeric Supplement
+\pxkc@bval{cjk13}{"1F200} % Enclosed Ideographic Supplement
+\fi
+\pxkc@bval{haniB}{"20000} % CJK Unified Ideographs Extension B
+\ifnum\pxkc@ccv<2\else
+\pxkc@bval{haniC}{"2A700} % CJK Unified Ideographs Extension C
+\fi
+\pxkc@bval{hani2}{"2F800} % CJK Compatibility Ideographs Supplement
+\pxkc@bval{spc07}{"E0000} % Tags
+\pxkc@bval{spc08}{"E0100} % Variation Selectors Supplement
+\pxkc@bval{spc09}{"F0000} % Supplementary Private Use Area-A
+\pxkc@bval{spc10}{"100000} % Supplementary Private Use Area-B
+\pxkc@bval{spc11}{"200000} % illegal
+ %
+\pxkc@cval{noncjk}{15}
+\pxkc@cval{kanji}{16}
+\pxkc@cval{han}{16}
+\pxkc@cval{kana}{17}
+\pxkc@cval{cjk}{18}
+\pxkc@cval{hangul}{19}
+ %
+\edef\pxkc@foreachblk{\noexpand\@for\noexpand\x:={\pxkc@bslst}}
+\let\pxkc@bval\relax\let\pxkc@cval\relax\let\pxkc@bslst\relax
+
+%%<*> \cjkcategory{<block>}{<category>}
+% Sets the kcatcode of block <block> to <category>.
+% Here <block> is given as a block name or a single character in the
+% block to be specified; <category> is given as a category name or
+% a number ranged in 15--19.
+\def\cjkcategory{%
+ \bgroup\forcecjktoken\pxkc@cjkcategory@oa}
+\def\pxkc@cjkcategory@oa#1{%
+ \gdef\pxkc@nxt{\pxkc@cjkcategory@ob{#1}}%
+ \egroup\pxkc@nxt}
+\def\pxkc@cjkcategory@ob#1#2{%
+ \ifnum2<1#2 \edef\pxkc@arg{#2}%
+ \else\@ifundefined{pxkc@C@@#2}%
+ {\pxkc@err@ivcsy{#2}\def\pxkc@arg{18}}%
+ {\edef\pxkc@arg{\@nameuse{pxkc@C@@#2}}}\fi
+ \pxkc@cjkcategory@a{#1}}
+\chardef\pxkc@la="7F
+\def\pxkc@cjkcategory@a#1{%
+ \@for\pxkc@x:={#1}\do{%
+ \expandafter\pxkc@cjkcategory@b\expandafter{\pxkc@x}}}
+\def\pxkc@cjkcategory@b#1{%
+ \pxkc@chkchr{#1}\ifnum\pxkc@cc>\pxkc@la
+ \pxkc@kcatcode{\pxkc@cc}{\pxkc@arg}%
+ \else\expandafter\ifx\csname pxkc@G@@#1\endcsname\relax
+ \expandafter\ifx\csname pxkc@B@@#1\endcsname\relax
+ \pxkc@err@ivbsy{#1}%
+ \else \pxkc@kcatcode{\@nameuse{pxkc@B@@#1}}{\pxkc@arg}\fi
+ \else \edef\pxkc@nxt{\noexpand\pxkc@cjkcategory@a
+ {\@nameuse{pxkc@G@@#1}}}\pxkc@nxt
+ \fi\fi}
+\def\pxkc@chkchr#1{%
+ \afterassignment\pxkc@chkchr@a\chardef\pxkc@cc=`#1?\relax}
+\def\pxkc@chkchr@a#1\relax{}
+
+%%<*> \cjkcategorymode{<mode>}
+% Invokes the cjk-category mode <mode>.
+\def\cjkcategorymode#1{%
+ \@ifundefined{pxkc@M@@#1}{\pxkc@err@ivmsy}
+ {\@nameuse{pxkc@M@@#1}}}
+
+%%%% cjkcategory modes
+\def\pxkc@resetcjkcat{%
+ \pxkc@foreachblk\do{\pxkc@kcatcode{\@nameuse{pxkc@B@@\x}}{18}}}
+\def\pxkc@M@@forcecjk{\pxkc@resetcjkcat
+ \cjkcategory{latn}{noncjk}%
+ \cjkcategory{bopo,bopo1,cjk01,cjk02,cjk03,cjk05,cjk06,hani,hani1}{kanji}%
+ \cjkcategory{hani2,haniA,haniB}{kanji}%
+ \cjkcategory{hira,kana,kana1}{kana}%
+ \cjkcategory{hang,hang1,hang2}{hangul}%
+ \ifnum\pxkc@mccv<2\else
+ \cjkcategory{cjk1b,cjk1c}{kana}%
+ \fi
+ \ifnum\pxkc@ccv<2\else
+ \cjkcategory{haniC}{kanji}%
+ \cjkcategory{hangA,hangB}{hangul}%
+ \fi
+}
+\def\pxkc@M@@prefercjk{\pxkc@M@@forcecjk
+ \@for\x:={%
+ cyrl1,armn,hebr,arab,syrc,arab1,thaa,nkoo,deva,beng,%
+ guru,gujr,orya,taml,telu,knda,mlym,sinh,thai,laoo,%
+ tibt,mymr,geor,ethi,ethi1,cher,cans,ogam,runr,tglg,%
+ hano,buhd,tagb,khmr,mong,limb,tale,talu,khmr1,bugi,%
+ bali,latn4,latn5,sym03,sym14,sym21,sym22,brai,sym25,glag,%
+ latnC,copt,geor1,tfng,ethi2,sym27,sym28,sym29,latnD,sylo,%
+ phag,spc01,spc02,spc03,arab2,spc05,sym30,arab3,spc06,linb,%
+ linb1,sym31,grek2,ital,goth,ugar,xpeo,dsrt,shaw,osma,%
+ cprt,phnx,khar,xsux,xsux1,sym32,sym33,sym34,sym35,sym36,%
+ sym37,spc07,spc08,spc09,spc10%
+ }\do{\pxkc@kcatcode{\@nameuse{pxkc@B@@\x}}{15}}%
+ \ifnum\pxkc@ccv<2\else
+ \cjkcategory{samr,cans1,lana,sund,lepc,olck,sym38,cyrlA}{noncjk}%
+ \cjkcategory{lisu,vaii,cyrlB,bamu,sym39,saur,deva1,kali}{noncjk}%
+ \cjkcategory{rjng,java,cham,mymrA,tavt,mtei,sym40,sym41}{noncjk}%
+ \cjkcategory{lyci,cari,armi,lydi,sarb,avst,prti,phli}{noncjk}%
+ \cjkcategory{orkh,sym42,kthi,egyp,sym43,sym44,sym45}{noncjk}%
+ \fi
+}
+\@namedef{pxkc@M@@prefercjkvar}{\pxkc@M@@prefercjk
+ \cjkcategory{cyrl,grek,grek1}{noncjk}%
+}
+\def\pxkc@M@@prefernoncjk{\pxkc@M@@prefercjkvar
+ \cjkcategory{latn1,latn2,latn3,latn6,latnA,latnB,spc04,sym01}{noncjk}%
+ \cjkcategory{sym02,sym04,sym05,sym06,sym07,sym08,sym09,sym10}{noncjk}%
+ \cjkcategory{sym11,sym12,sym13,sym16,sym17,sym18,sym19,sym20}{noncjk}%
+ \cjkcategory{sym23,sym24,sym26}{noncjk}%
+}
+\def\pxkc@M@@prefernoncjkvar{\pxkc@M@@prefernoncjk
+ \cjkcategory{sym04,sym10,sym18}{other}%
+}
+
+%%%% \showcjkcategory
+\def\showcjkcategory{%
+ \pxkc@foreachblk\do{%
+ \typeout{\x\space= \the\kcatcode\@nameuse{pxkc@B@@\x}}}}
+
+%%-------- \withcjktokendisabled, etc.
+
+%% \pxkc@genprobe
+\def\pxkc@genprobe{%
+ \edef\pxkc@tmpa{\expandafter\string\csname
+ pxkc@@\string ^^e3\string ^^81\string ^^82%
+ \string ^^e3\string ^^82\string ^^a2\endcsname}}
+\bgroup \kcatcode"3040=15\kcatcode"30A0=18
+ \disablecjktoken\pxkc@genprobe \global\let\pxkc@prb@d\pxkc@tmpa
+ \enablecjktoken\pxkc@genprobe \global\let\pxkc@prb@e\pxkc@tmpa
+ \forcecjktoken\pxkc@genprobe \global\let\pxkc@prb@f\pxkc@tmpa
+\egroup
+
+%% \pxkc@getcjktokmod\CS
+\def\pxkc@getcjktokmod#1{%
+ \bgroup \kcatcode"3040=15\kcatcode"30A0=18\pxkc@genprobe
+ \ifx\pxkc@tmpa\pxkc@prb@d \global\chardef\pxkc@gtmpa\z@
+ \else\ifx\pxkc@tmpa\pxkc@prb@e \global\chardef\pxkc@gtmpa\@ne
+ \else\ifx\pxkc@tmpa\pxkc@prb@f \global\chardef\pxkc@gtmpa\tw@
+ \else \global\let\pxkc@gtmpa\m@ne \fi\fi\fi
+ \egroup \let#1\pxkc@gtmpa}
+
+%%<+> \getcjktokenmode
+% Returns the value showing current mode to \thecjktokenmode
+% 0: \disablecjktoken
+% 1: \enablecjktoken
+% 2: \forcecjktoken
+\def\getcjktokenmode{\pxkc@getcjktokmod\thecjktokenmode}
+
+%%<*> \setcjktokenmode{<val>}
+\def\pxkc@setcjktokmod#1{%
+ \ifcase#1\disablecjktoken\or\enablecjktoken\or\forcecjktoken\fi}
+
+%%<*> \withcjktokendisabled, etc.
+\def\withcjktokendisabled{\pxkc@withcjktokmod\disablecjktoken\@iden}
+\def\withcjktokenenabled{\pxkc@withcjktokmod\enablecjktoken\@iden}
+\def\withcjktokenforced{\pxkc@withcjktokmod\forcecjktoken\@iden}
+\def\withcjktokendisabledex{\pxkc@withcjktokmod\disablecjktoken}
+\def\withcjktokenenabledex{\pxkc@withcjktokmod\enablecjktoken}
+\def\withcjktokenforcedex{\pxkc@withcjktokmod\forcecjktoken}
+\def\pxkc@withcjktokmod#1{%
+ \pxkc@getcjktokmod\pxkc@tokmod #1\pxkc@withcjktokmod@a}
+\def\pxkc@withcjktokmod@a#1#2{%
+ #1{#2}\pxkc@setcjktokmod\pxkc@tokmod}
+
+%%------ initial setup
+
+\ifx\pxkc@ccmode\relax\else
+\cjkcategorymode{\pxkc@ccmode}
+\fi
+
+%%------ all done
+\endinput
+%% EOF
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def b/Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def
new file mode 100644
index 00000000000..0a61158d4d7
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def
@@ -0,0 +1,195 @@
+%
+% pxjsfenc.def
+%
+%%%% file declaration
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesFile{pxjsfenc.def}[2010/05/05 v0.5 PX JSF encoding]
+
+%%%% preparation
+\RequirePackage{pxbase}
+\bxInputDefFile{pxbasenc}
+% common with pxbasenc
+%\def\pxec@b@pkgname{PXbase}
+%\def\pxec@error{\PackageError\px@b@pkgname}
+%
+\edef\pxec@jsf@resetcatcode{\catcode34=\the\catcode34\relax}
+\catcode34=12 %<">
+\newif\ifpxec@hyperref % true if hyperref patch is invoked
+
+%%------ main module
+
+%% \pxec@declare@jsf@gen{<name>}{<enc>}{<ext>}
+\def\pxec@declare@jsf@ucs{\pxec@swtrue\pxec@declare@jsf@a}
+\def\pxec@declare@jsf@cid{\pxec@swfalse\pxec@declare@jsf@a}
+\def\pxec@declare@jsf@a#1{% {<name>} | {<enc>}{<ext>}
+ \expandafter\pxec@declare@jsf@b\csname#1\expandafter\endcsname
+ \csname pxUcv#1\expandafter\endcsname
+ \csname pxec@E@#1\expandafter\endcsname
+ \csname pxec@ext@#1\endcsname{#1}}
+\def\pxec@declare@jsf@b#1#2#3#4#5#6#7{%
+ % \[<name>]\[pxUcv<name>]\[pxec@E@<name>]\[pxec@ext@<name>]
+ % {<name>}{<enc>}{<ext>}
+ \ifpxec@sw \DeclareRobustCommand{#1}[1]{%
+ \uppercase{\bxUcv="##1}\pxec@out@jsf#3#4}%
+ \else \DeclareRobustCommand{#1}[1]{%
+ \uppercase{\bxUcv=##1}\pxec@out@jsf#3#4}%
+ \fi
+ \def#2{\pxec@out@jsf#3#4}\def#3{#6}%
+ \ifpxec@sw \pxec@addto@hyref@patch{#5}\fi
+ \ifx @#7@\else\bxUseShadowMap#4{#7}\fi}
+%% hyperref patch
+\def\pxec@hyref@patch{\pxec@hyperreftrue}
+\AtBeginDocument{\@ifpackageloaded{hyperref}{\pxec@hyref@patch}{}}
+\def\pxec@addto@hyref@patch#1{% {<name>}
+ \expandafter\pxec@addto@hyref@patch@a\csname#1\expandafter\endcsname
+ \csname pxec@hy@#1\expandafter\endcsname\csname#1 \endcsname}
+\def\pxec@addto@hyref@patch@a#1#2#3{%
+ % \[<name>]\[pxec@hy@<name>]\[<name> ]
+ \g@addto@macro\pxec@hyref@patch{\def#1{\protect#2}%
+ \def#2##1{\ifHy@pdfstring\0x##1\else#3{##1}\fi}}}
+
+%% define \UTF command
+% \pxec@E@UTF (second argument) will be \let'd to be either
+% \pxec@E@UTF@a or \pxec@E@UTF@b.
+% Note that pxbabel package \let's \UTF be \UTFK, etc. when
+% a CJK language is in effect.
+\pxec@declare@jsf@ucs{UTF}{J20}{sm-pxot-ja}
+
+%% \pxSwitchUTFCommand
+\def\pxSwitchUTFCommand#1{\csname pxec@SWU/#1\endcsname}
+\@namedef{pxec@SWU/2000jis}{\let\pxec@E@UTF\pxec@E@UTF@a}
+\@namedef{pxec@SWU/2004jis}{\let\pxec@E@UTF\pxec@E@UTF@b}
+
+%% define standard sets
+\pxec@declare@jsf@ucs{UTF@a}{J20}{sm-pxot-ja}
+\pxec@declare@jsf@ucs{UTFK}{J21}{sm-pxot-ko}
+\pxec@declare@jsf@ucs{UTFC}{J22}{sm-pxot-sc}
+\pxec@declare@jsf@ucs{UTFT}{J23}{sm-pxot-tc}
+\pxec@declare@jsf@ucs{UTF@b}{J24}{sm-pxot-ja}
+\pxec@declare@jsf@ucs{UTFM}{J25}{}
+\pxec@declare@jsf@cid{CID}{J40}{}
+\pxec@declare@jsf@cid{CIDK}{J41}{}
+\pxec@declare@jsf@cid{CIDC}{J42}{}
+\pxec@declare@jsf@cid{CIDT}{J43}{}
+
+%%------------------ processing in upTeX
+\ifnativeupTeX
+
+\pxDeclareCJKEncoding*{J20}{J30}
+\pxDeclareCJKEncoding*{J21}{J31}
+\pxDeclareCJKEncoding*{J22}{J32}
+\pxDeclareCJKEncoding*{J23}{J33}
+\pxDeclareCJKEncoding*{J24}{J34}
+\pxDeclareCJKEncoding*{J40}{J50}
+\pxDeclareCJKEncoding*{J41}{J51}
+\pxDeclareCJKEncoding*{J42}{J52}
+\pxDeclareCJKEncoding*{J43}{J53}
+
+%<+> \pxSwitchUTFDirect
+%<+> \pxSwitchUTFIndirect
+\def\pxec@nxt#1{% here #1 is \[UTF ]
+ \let\pxec@UTF@ind#1\let\pxec@UcvUTF@ind\pxUcvUTF
+ \def\pxec@UTF@dir##1{\uppercase{\char"##1 }}%
+ \def\pxec@UcvUTF@dir{\char\bxUcv}%
+ \def\pxSwitchUTFDirect{%
+ \let#1\pxec@UTF@dir \let\pxUcvUTF\pxec@UcvUTF@dir}%
+ \def\pxSwitchUTFIndirect{%
+ \let#1\pxec@UTF@ind \let\pxUcvUTF\pxec@UcvUTF@ind}}
+\expandafter\pxec@nxt\csname UTF \endcsname
+
+%% \pxec@out@jsf{<enc>}\[<ext>]
+\def\pxec@out@jsf#1#2{% {<enc>}\[<ext>]
+ {\kanjiencoding{#1}\selectfont \kchar\bxUcv}}
+
+\pxec@jsf@resetcatcode
+\expandafter\endinput \fi\relax % stop here
+%%------------------ processing in pTeX
+
+%% JSF encodings
+\pxDeclareJSFEncoding{J20}{J30}{0,2,3,4,5,6,7,8,9,d,f}
+\pxDeclareJSFEncoding{J21}{J31}{0,1,2,3,4,5,6,7,8,9,a,b,c,d,f}
+\pxDeclareJSFEncoding{J22}{J32}{0,1,2,3,4,5,6,7,8,9,d,f}
+\pxDeclareJSFEncoding{J23}{J33}{0,2,3,4,5,6,7,8,9,d,f}
+\pxDeclareJSFEncoding{J24}{J34}{0,2,3,4,5,6,7,8,9,d,f}
+\pxDeclareJSFEncoding{J40}{J50}{0,1,2,3,4,5}
+\pxDeclareJSFEncoding{J41}{J51}{0,1,2,3,4}
+\pxDeclareJSFEncoding{J42}{J52}{0,1,2,3,4,5,6,7}
+\pxDeclareJSFEncoding{J43}{J53}{0,1,2,3,4}
+
+%% \pxec@out@jsf{<enc>}\[<ext>]
+% The code value specified has been assigned to \bxUcv here.
+\def\pxec@out@jsf#1#2{% {<enc>}\[<ext>]
+ \pxec@loadfontdef{#1}%
+ \bgroup\pxec@pretranscode#2\pxec@transcode
+ \expandafter\let\expandafter\pxec@tmpa
+ \csname #1/\k@family=Z\pxec@sfid/\k@series/\k@shape\endcsname
+ \ifx\pxec@tmpa\relax \pxec@setinvalid \fi
+ \kanjiencoding{#1}\kanjifamily{\k@family=Z\pxec@sfid}%
+ \selectfont\char\jis\bxUcv
+ \egroup\pxec@end}
+
+%% \pxec@transcode
+\mathchardef\pxec@c@jsfa="3030
+\mathchardef\pxec@c@jsfb="1000
+\chardef\pxec@c@jsfx="40
+\chardef\pxec@c@jsfy="C0
+\chardef\pxec@c@jsfz=10
+\def\do#1{\uppercase{\@tempcnta="#1}\relax
+ \expandafter\def\csname pxec@TX/\the\@tempcnta\endcsname{#1}}
+\do a\do b\do c\do d\do e\do f
+\def\pxec@transcode{%
+ \@tempcnta\bxUcv \divide\@tempcnta\pxec@c@jsfb
+ \edef\pxec@sfid{\ifnum\@tempcnta<\pxec@c@jsfz \the\@tempcnta
+ \else \csname pxec@TX/\the\@tempcnta\endcsname \fi}%
+ \multiply\@tempcnta\pxec@c@jsfb \advance\bxUcv-\@tempcnta
+ \@tempcnta\bxUcv \divide\@tempcnta\pxec@c@jsfx
+ \multiply\@tempcnta\pxec@c@jsfy \advance\bxUcv\@tempcnta
+ \advance\bxUcv\pxec@c@jsfa}
+\def\pxec@setinvalid{%
+ % set translated values for source codepoint 0
+ \def\pxec@sfid{0}\bxUcv\pxec@c@jsfa}
+
+%% \pxec@pretranscode\fontSM
+% Here \fontSM is a shadow-map font spec.
+\def\pxec@pretranscode#1{%
+ \ifnum\bxUcv<\p@\else% \p@ = "10000
+ \@tempcnta=\bxUcv \divide\@tempcnta\p@
+ \ifcase\@tempcnta\or \bxUcv\z@ \or
+ \ifx#1\@undefined \bxUcv\z@
+ \else \advance\bxUcv-"20000 \bxMap#1\fi
+ \else\bxUcv\z@\fi
+ \fi}
+
+%% \pxec@loadfontdef{<h-enc>}
+% Tries to load the font definition for current family and encoding
+% <h-enc> on demand from .fd files.
+\def\pxec@loadfontdef#1{%
+ \expandafter\let\expandafter\pxec@tmpa
+ \csname #1+\k@family=Z\endcsname
+ \ifx\pxec@tmpa\@empty \pxec@okfalse % already tried in failure
+ \else\ifx\pxec@tmpa\relax % not yet tried
+ \edef\pxec@nxt{%
+ \noexpand\pxec@loadfontdef@a{#1}%
+ \noexpand\pxec@loadfontdef@a{\csname t@enc#1\endcsname}}%
+ \pxec@oktrue \pxec@nxt
+ \ifpxec@ok\else
+ \expnadafter\let\csname#1+\k@family=Z\endcsname\@empty \fi
+ \else \pxec@oktrue \fi\fi
+ \ifpxec@ok\else \expandafter\pxec@skiptoend \fi}
+\def\pxec@loadfontdef@a#1{%
+ \expandafter\ifx\csname #1+\k@family=Z\endcsname\relax
+ \begingroup \let\typeout\@font@info \escapechar\m@ne
+ \def\f@encoding{#1}\def\f@family{\k@family=Z}%
+ \try@load@fontshape
+ \endgroup\fi
+ \expandafter\ifx\csname #1+\k@family=Z\endcsname\@empty
+ \pxec@err@nojsf{#1}\pxec@okfalse \fi}
+
+%%%% \pxec@skiptoend
+\def\pxec@skiptoend#1\pxec@end{}
+\let\pxec@end\@empty
+
+%%------------------ all done
+\pxec@jsf@resetcatcode
+\endinput
+%% EOF
diff --git a/Master/texmf-dist/tex/platex/pxbase/upkcat.sty b/Master/texmf-dist/tex/platex/pxbase/upkcat.sty
new file mode 100644
index 00000000000..4f97b510c44
--- /dev/null
+++ b/Master/texmf-dist/tex/platex/pxbase/upkcat.sty
@@ -0,0 +1,50 @@
+%
+% upkcat.sty (for both upLaTeX2e & plain upTeX)
+%
+
+%%%% avoid multiple loading and check if LaTeX2e is used.
+\ifx\pxkqOk\undefined\else \expandafter\endinput \fi
+\edef\pxkqRestoreAt{\catcode64=\the\catcode64\relax}\catcode64=11
+\ifx\RequirePackage\@undefined % LaTeX2e
+ \NeedsTeXFormat{pLaTeX2e}
+ \ProvidesPackage{upkcat}[2008/03/14 v0.2 safe kcatcode access]
+ \RequirePackage{ifuptex}[2008/03/14]\RequireupTeX
+\fi \let\pxkqOk=t
+
+%%%% \getkcatcode, \setkcatcode
+\edef\skrestoreat{\catcode64=\the\catcode64}\catcode64=11
+\newcount\pxkq@cp \newif\ifpxkq@ok
+\def\getkcatcode#1{\pxkq@getcp{#1}%
+ \edef\thekcatcode{\the\kcatcode\pxkq@cp}}
+\def\setkcatcode#1#2{\pxkq@getcp{#1}\kcatcode\pxkq@cp#2}
+\def\pxkq@getcp#1{\pxkq@getcp@a#1\relax\relax}
+\def\pxkq@nxt#1#2#3#4#5{\pxkq@cp#1\loop
+ {\lccode`\?\pxkq@cp \advance\pxkq@cp-#3%
+ \lowercase{\expandafter\xdef\csname pxkq@#4?\endcsname}{#5}}%
+ \advance\pxkq@cp\@ne \ifnum\pxkq@cp<#2\repeat}
+\pxkq@nxt{240}{248}{240}l{\pxkq@cp\the\pxkq@cp\noexpand\pxkq@da}
+\pxkq@nxt{224}{240}{224}l{\pxkq@cp\the\pxkq@cp\noexpand\pxkq@ca}
+\pxkq@nxt{194}{224}{192}l{\pxkq@cp\the\pxkq@cp\noexpand\pxkq@ba}
+\pxkq@nxt{128}{192}{128}t{\advance\pxkq@cp\the\pxkq@cp\noexpand\pxkq@oktrue}
+\def\pxkq@getcp@a#1{\pxkq@cp`#1\relax\pxkq@chkk#1%
+ \ifpxkq@ok \let\pxkq@nxt\pxkq@end \else
+ \expandafter\let\expandafter\pxkq@nxt\csname pxkq@l\string#1\endcsname
+ \ifx\pxkq@nxt\relax \let\pxkq@nxt\pxkq@err \fi
+ \fi \pxkq@nxt}
+\def\pxkq@stp#1#2{\multiply\pxkq@cp64\pxkq@okfalse
+ \csname pxkq@t\string#2\endcsname
+ \ifpxkq@ok \expandafter#1\else \expandafter\pxkq@err \fi}
+\def\pxkq@end#1\relax{}
+\def\pxkq@ba{\pxkq@stp\pxkq@end}\def\pxkq@ca{\pxkq@stp\pxkq@cb}
+\def\pxkq@cb{\pxkq@stp\pxkq@end}\def\pxkq@da{\pxkq@stp\pxkq@db}
+\def\pxkq@db{\pxkq@stp\pxkq@dc}\def\pxkq@dc{\pxkq@stp\pxkq@end}
+\begingroup\lccode`8=`k\lccode`9=`a \lowercase{\endgroup
+ \def\pxkq@chkk#1{\pxkq@okfalse\expandafter\pxkq@chkk@a\meaning#189\@nil}
+ \def\pxkq@chkk@a#189#2\@nil{\ifcat @#1@\pxkq@oktrue\fi}}
+\def\pxkq@err#1\relax{\errhelp{I regard it as U+FFFF}%
+ \errmessage{Corrupted UTF-8 bytes}\pxkq@cp65535\relax}
+%\def\pxkq@end#1\relax{\showthe\pxkq@cp}
+
+%%%% all done
+\pxkqRestoreAt \endinput
+%% EOF