diff options
author | Karl Berry <karl@freefriends.org> | 2017-06-05 23:15:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-06-05 23:15:32 +0000 |
commit | c684ba451bf548bdb24c40ed54caa9f11ac21422 (patch) | |
tree | 9e2d943480a32ad77b221c277aa97f6ebe251d01 /Master/texmf-dist/tex/platex/pxbase | |
parent | caef61ed4952aee5804397dbdc93deb54f043a98 (diff) |
pxbase (30may17)
git-svn-id: svn://tug.org/texlive/trunk@44482 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/platex/pxbase')
-rw-r--r-- | Master/texmf-dist/tex/platex/pxbase/pxbabel.sty | 435 | ||||
-rw-r--r-- | Master/texmf-dist/tex/platex/pxbase/pxbase.def | 796 | ||||
-rw-r--r-- | Master/texmf-dist/tex/platex/pxbase/pxbase.sty | 140 | ||||
-rw-r--r-- | Master/texmf-dist/tex/platex/pxbase/pxbasenc.def | 81 | ||||
-rw-r--r-- | Master/texmf-dist/tex/platex/pxbase/pxbsjc.def | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/platex/pxbase/pxbsjc1.def | 7 | ||||
-rw-r--r-- | Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def | 57 | ||||
-rw-r--r-- | Master/texmf-dist/tex/platex/pxbase/upkcat.sty | 59 |
8 files changed, 479 insertions, 1098 deletions
diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty b/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty index aaa9feff101..97b5e4ad568 100644 --- a/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty +++ b/Master/texmf-dist/tex/platex/pxbase/pxbabel.sty @@ -1,120 +1,309 @@ -% -% pxbabel.sty -% -%%%% package declaration +%% +%% This is file 'pxbabel.sty'. +%% +%% Copyright (c) 2017 Takayuki YATO (aka. "ZR") +%% GitHub: https://github.com/zr-tex8r +%% Twitter: @zr_tex8r +%% +%% This package is distributed under the MIT License. +%% + +%% package declaration \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxbabel}[2017/05/04 v0.5i PX Babel interface for CJK] +\ProvidesPackage{pxbabel}[2017/05/29 v1.1 PX Babel interface for CJK] +\def\pxbb@pkgname{pxbabel} + +%--------------------------------------- general + +%% packages \RequirePackage{pxbase} +\RequirePackage{ifptex} \safecaret -\RequirePackage{keyval} +\bxPrepareSetKeysSafe -%%%% error message -\def\pxbb@pkgname{pxbabel} -\def\pxbb@error{\PackageError\pxbb@pkgname} -\def\pxbb@warn{\PackageWarningNoLine\pxbb@pkgname} +%% error messages +\bxSetModuleName\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 +\bxPreamble\def\pxbb@err@nobbl{% + \PackageError\pxbb@pkgname + {babel is not yet loaded, load aborted}% + {This package must be loaded after babel package.}} +\bxPreamble\def\pxbb@warn@nocjk{% + \PackageWarningNoLine\pxbb@pkgname + {No multi-CJK support found, font switch disabled\MessageBreak + (I need upTeX-extension or otf package with `multi')}} +\bxPreamble\def\pxbb@err@noldf#1{% + \PackageError\pxbb@pkgname + {Language definition file #1.ldf not found}% + {Maybe you misspelled the language option?}} + +%--------------------------------------- Processing package options + +%% \pxbb@cjk@langid@list +% The list of all CJK language ids. +\bxPreamble\def\pxbb@cjk@langid@list{% + japanese,korean,schinese,tchinese% +} + +%% \pxbb@lang@load@list +% The list of language options to be loaded. +\bxPreamble\let\pxbb@lang@load@list\@empty + +%% \pxbb@set@lang@spec{<lang_id>}{[+]<lang_name>} +\bxPreamble\def\pxbb@set@lang@spec#1#2{% + \edef\pxbb@args{#2}% + \expandafter\pxbb@set@lang@spec@a\pxbb@args\@nil{#1}} +\bxPreamble\def\pxbb@set@lang@spec@a#1#2\@nil#3{% + \bxIf{+#1}% + {\csdef{pxbb@langname/#3}{#2}% + \appto\pxbb@lang@load@list{,#2}}% + {\csdef{pxbb@langname/#3}{#1#2}}} + +%% keyval settings +% (<lang_id>=[+]<lang_name>) +\bxForEachIn\pxbb@cjk@langid@list\do{% + \define@key{pxbabel}{#1}{\pxbb@set@lang@spec{#1}{##1}}% + \pxbb@set@lang@spec{#1}{#1}} +% (main=<lang_name>) +\bxPreamble\let\pxbb@main@lang\relax +\define@key{pxbabel}{main}{\def\pxbb@main@lang{#1}} +% (caption=<lang_name>) +\bxPreamble\def\pxbb@caption@lang{default} +\define@key{pxbabel}{caption}{\def\pxbb@caption@lang{#1}} + +%% option handling +\DeclareOption{switchcaption}{% + \def\pxbb@caption@lang{switch}} +\DeclareOption{noswitchcaption}{% + \def\pxbb@caption@lang{default}} +\newbool{pxbb@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} +\newbool{pxbb@prefermmivjis} +\DeclareOption{prefer2004jis}{\pxbb@prefermmivjistrue} +\DeclareOption{noprefer2004jis}{\pxbb@prefermmivjisfalse} +% (<lang_id>, +<lang_id>) +\bxForEachIn\pxbb@cjk@langid@list\do{% + \DeclareOption{#1}{% + \pxbb@set@lang@spec{#1}{#1}% + \def\pxbb@last@lang{#1}}% + \DeclareOption{+#1}{% + \pxbb@set@lang@spec{#1}{+#1}% + \def\pxbb@last@lang{#1}}} +% (options processed by keyval) +\DeclareOption*{% + \bxWithArgExpd{\CurrentOption}\do{% + \bxSetKeysSafe{pxbabel}{#1}% + \bxIfx{\bxRestKeys\@empty}{}% + {\appto\pxbb@lang@load@list{,#1}% + \def\pxbb@last@lang{#1}}}} \ProcessOptions* +\bxChompComma\pxbb@lang@load@list + +%% 'triv' language check table +\bxForEachIn\pxbb@cjk@langid@list\do{% + \cslet{pxbb@triv/\@nameuse{pxbb@langname/#1}}{t}} +\bxForEachIn\pxbb@lang@load@list\do{% + \csundef{pxbb@triv/#1}} -%%%% \ifpxbb@otfmulti, \ifpxbb@uptex -%%%% \ifpxbb@pxotf -\newif\ifpxbb@otfmulti \newif\ifpxbb@pxotf -\@ifpackageloaded{mlutf}{\pxbb@otfmultitrue}{\pxbb@otfmultifalse} +%--------------------------------------- Resolving settings + +%% \ifpxbb@otfmulti +%% \ifpxbb@pxotf +\newbool{pxbb@otfmulti} +\newbool{pxbb@pxotf} +\@ifpackageloaded{mlutf}{\pxbb@otfmultitrue}{} \@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@babel +\newbool{pxbb@babel} +\@ifpackageloaded{babel}{\pxbb@babeltrue}{} + +%% environment check +% The feature 'switchfont' requires multi-CJK support. +\ifpxbb@switchfont + \ifpxbb@otfmulti\else + \ifupTeX\else + \pxbb@warn@nocjk +\fi\fi\fi + +%% resolve the expected main language +\ifundef\pxbb@main@lang{%then + % if 'main' is not specified + \ifbool{pxbb@babel}% + % in separate loading, main is unchanged + {\let\pxbb@main@lang\bbl@main@language}% + % in lumped loading, main is the one specified last + {\let\pxbb@main@lang\pxbb@last@lang}% +}{} + +%% resolve the caption language setting +\bxIfExpToEqual{\pxbb@caption@lang}{auto}{%then + % if 'caption=auto' is given + \bxIfcsundef{pxbb@triv/\pxbb@main@lang} + % if main is not triv then caption=switch + {\def\pxbb@caption@lang{switch}}% + % if main is triv then caption=default + {\def\pxbb@caption@lang{default}}% +}{} + +\ifx t\bxUseDebug +\def\pxbb@bool#1{\ifbool{#1}{yes}{no}} +\bxForEachIn\pxbb@cjk@langid@list\do{% +\bxDebug{#1 = \@nameuse{pxbb@langname/#1}}} +\bxDebug{main = \pxbb@main@lang} +\bxDebug{caption = \pxbb@caption@lang} +\bxDebug{switchfont = \pxbb@bool{pxbb@switchfont}} +\bxDebug{load-list = \pxbb@lang@load@list} +\bxDebug{last = \pxbb@last@lang} +\bxDebug{babel = \pxbb@bool{pxbb@babel}} +\bxDebug{otfmulti = \pxbb@bool{pxbb@otfmulti}} +\fi + +%--------------------------------------- lumped loading +\ifpxbb@babel\else + +%% load Babel +\let\pxbb@tmpa\pxbb@lang@load@list +\ifx\pxbb@tmpa\@empty \def\pxbb@tmpa{english}\fi +\edef\pxbb@tmpa{% + \noexpand\RequirePackage[\pxbb@tmpa]{babel}% +}\pxbb@tmpa + +\fi +%--------------------------------------- separate loading +\ifpxbb@babel + +%% \pxbb@g@add@lang@proc +\bxPreamble\let\pxbb@g@add@lang@proc\@empty +\begingroup + +%% remove languages that are already loaded +\let\pxbb@tmpa\@empty +\bxForEachIn\pxbb@lang@load@list\do{% + \bxIfcsundef{date#1}{\appto\pxbb@tmpa{,#1}}{}} +\bxChompComma\pxbb@tmpa +\let\pxbb@lang@load@list\pxbb@tmpa +\bxDebug{\pxbb@lang@load@list} + +%% if some language should be added... +\ifx\pxbb@lang@load@list\@empty\else + \ifdef\bbl@load@language{% + \PackageWarning\pxbb@pkgname + {Some languages need to be added. Note that the\MessageBreak + process of addition is unreliable}% + }{%else + \PackageError\pxbb@pkgname + {Some languages need to be added, but the addition\MessageBreak + is not supported because Babel in use is too old}% + {The languages to be added will be ignored.\MessageBreak + \@ehc}} +\fi + +%% build \pxbb@g@add@lang@proc +\bxForEachIn\pxbb@lang@load@list\do{% + \csdef{pxbb@use/#1}{t}} +\def\pxbb@babel@alias#1#2{% + \bxIfcsundef{pxbb@use/#1}{}{%else + % if the real name is available, then ok + \IfFileExists{#1.ldf}{}{%else + \csdef{pxbb@bbl@opt/#1}{\bbl@load@language{#2}}}}} +\def\pxbb@babel@load@proc#1{% + \bxIfcsundef{pxbb@use/#1}{\@gobble}{%else + \csdef{pxbb@bbl@opt/#1}}} +% the alias list +\pxbb@babel@alias{acadian}{frenchb} +\pxbb@babel@alias{afrikaans}{dutch} +\pxbb@babel@alias{american}{english} +\pxbb@babel@alias{australian}{english} +\pxbb@babel@alias{austrian}{germanb} +\pxbb@babel@alias{bahasa}{bahasai} +\pxbb@babel@alias{bahasai}{bahasai} +\pxbb@babel@alias{bahasam}{bahasam} +\pxbb@babel@alias{brazil}{portuges} +\pxbb@babel@alias{brazilian}{portuges} +\pxbb@babel@alias{british}{english} +\pxbb@babel@alias{canadian}{english} +\pxbb@babel@alias{canadien}{frenchb} +\pxbb@babel@alias{francais}{frenchb} +\pxbb@babel@alias{french}{frenchb} +\pxbb@babel@alias{german}{germanb} +\pxbb@babel@alias{hungarian}{magyar} +\pxbb@babel@alias{indon}{bahasai} +\pxbb@babel@alias{indonesian}{bahasai} +\pxbb@babel@alias{lowersorbian}{lsorbian} +\pxbb@babel@alias{malay}{bahasam} +\pxbb@babel@alias{melayu}{bahasam} +\pxbb@babel@alias{meyalu}{bahasam} +\pxbb@babel@alias{naustrian}{ngermanb} +\pxbb@babel@alias{newzealand}{english} +\pxbb@babel@alias{ngerman}{ngermanb} +\pxbb@babel@alias{nynorsk}{norsk} +\pxbb@babel@alias{portuguese}{portuges} +\pxbb@babel@alias{russian}{russianb} +\pxbb@babel@alias{UKenglish}{english} +\pxbb@babel@alias{ukrainian}{ukraineb} +\pxbb@babel@alias{uppersorbian}{usorbian} +\pxbb@babel@alias{USenglish}{english} +\pxbb@babel@load@proc{hebrew}{% + \input{rlbabel.def}\bbl@load@language{hebrew}} +\pxbb@babel@load@proc{polutonikogreek}{% + \bbl@load@language{greek}\languageattribute{greek}{polutoniko}} + +%% load addtional languages +\bxForEachIn\pxbb@lang@load@list\do{% + \gappto\pxbb@g@add@lang@proc{\def\CurrentOption{#1}}% + \bxIfcsundef{pxbb@bbl@opt/#1}% + {\gappto\pxbb@g@add@lang@proc{\bbl@load@language{#1}}}% + {\letcs\pxbb@tmpa{pxbb@bbl@opt/#1}% + \xappto\pxbb@g@add@lang@proc{\expandonce{\pxbb@tmpa}}}} +\gappto\pxbb@g@add@lang@proc{\let\CurrentOption\@empty} + +\endgroup +% dispatch +\pxbb@g@add@lang@proc + +\fi +%--------------------------------------- post-load process + +%% declare 'triv' languages +\bxForEachIn\pxbb@cjk@langid@list\do{% + \bxWithArgFullExpd{\@nameuse{pxbb@langname/#1}}\do{% + \bxIfcsundefX{date##1}{\bxTrivLangDef{##1}}{}}} +\ifundef\datecjkmulti{\bxTrivLangDef{cjkmulti}}{} + +%% set main language +\setmainlanguage{\pxbb@main@lang} + +%% set caption language +\bxIfExpToEqual{\pxbb@caption@lang}{switch}{}%else + {\bxProvideCaptionLanguage{\pxbb@caption@lang}} + +%--------------------------------------- Adding font switch to 'extra's + +\ifpxbb@otfmulti %----<*otfmulti> + +%% 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}} +\bxPreamble\def\pxbb@addtoextras@otf#1{% + \pxbb@addtoextras@otf@a{\bxCsuseX{pxbb@langname/#1}}} +\bxPreamble\def\pxbb@addtoextras@otf@a#1#2{% + \csappto{extras#1}{\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 +\fi %----</otfmulti> -\ifupTeX %============================== for upTeX -%%------ encoding switch according to NFSS -\bxInputDefFile{pxbasenc} +\ifupTeX %----<*upTeX> + +%% preparations +\bxRequireDefinition{pxbasenc} \pxBDHookEncSwitchOTF -%%%% declarations for upTeX standatd CJK fonts +%% declarations for upTeX standatd CJK fonts \ifpxbb@pxotf\else \pxDeclareBasicCJKEncoding{J20}{J30}% UniJIS \pxDeclareBasicCJKFamily{J20}{!upjpnrm-h}{!upjpngt-h}{*gt}{*gt} @@ -130,42 +319,53 @@ \pxDeclareBasicCJKFamily{J33}{!uptchrm-v}{!uptchgt-v}{*gt}{*gt} \fi -%%%% add font switch to Babel \extras +%--------------------------------------- add font switch to Babel \extras \ifpxbb@switchfont -\def\pxbb@addtoextras#1#2#3{% - \edef\pxbb@arg{{\@nameuse{pxbb@LN/#1}}% + +%% \pxbb@set@full@ja@enc +% Sets to \pxbb@ful@ja@enc the destination encoding. +\bxForEachIn{J20,J24}\do{% all full japanese encodings + \csdef{pxbb@is@fje/#1}{t}} +\edef\pxbb@dflt@ja@enc{% default full japanese encoding + \ifbool{pxbb@prefermmivjis}{J24}{J20}} +\def\pxbb@set@full@ja@enc{% + \edef\pxbb@full@ja@enc{% + \bxIfcsundefX{pxbb@is@fje/\cy@encoding}% + {\pxbb@dflt@ja@enc}{\cy@encoding}}} + +%% \pxbb@addtoextras +\bxPreamble\def\pxbb@addtoextras#1#2#3{% + \edef\pxbb@arg{{\@nameuse{pxbb@langname/#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% +\bxPreamble\def\pxbb@addtoextras@a#1#2#3{% + \csappto{extras#1}{% + \pxbb@set@full@ja@enc + \let\pxInNonJaLanguage=#3% \let\pxbb@org@encoding\cy@encoding \kanjiencoding{#2}\selectfont}% - \expandafter\addto\csname noextras#1\endcsname{% + \csappto{noextras#1}{% \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 +\fi %----</upTeX> -%%------ all done -\endinput -%% EOF +%--------------------------------------- Other user commands +%%<*> \cjklanguagename{<lang_id>} +% Expands to the babel language name for <lang_id>. +\newcommand*\cjklanguagename[1]{% + \@nameuse{pxbb@langname/#1}} + +%--------------------------------------- all done +\endinput % % Roman, H Gothic, H Roman, V Gothic, H : metric encod. % ------------ ------------ ------------ ------------ : ------ -------- @@ -184,3 +384,4 @@ % * 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 +%% EOF diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbase.def b/Master/texmf-dist/tex/platex/pxbase/pxbase.def index 926ee1bc6c5..214e278e543 100644 --- a/Master/texmf-dist/tex/platex/pxbase/pxbase.def +++ b/Master/texmf-dist/tex/platex/pxbase/pxbase.def @@ -1,791 +1,7 @@ -% -% 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 +%% +%% This is file 'pxbase.def'. +%% +\PackageError{pxbase}% + {pxbase.def should no longer be read}% + {The current BX/PXbase package does not need the file.} %% EOF diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbase.sty b/Master/texmf-dist/tex/platex/pxbase/pxbase.sty index e27f2579c7a..d8632d6140f 100644 --- a/Master/texmf-dist/tex/platex/pxbase/pxbase.sty +++ b/Master/texmf-dist/tex/platex/pxbase/pxbase.sty @@ -1,129 +1,15 @@ -% -% pxbase.sty -% - -%%%% package declaration +%% +%% This is file 'pxbase.sty'. +%% +%% Copyright (c) 2017 Takayuki YATO (aka. "ZR") +%% GitHub: https://github.com/zr-tex8r +%% Twitter: @zr_tex8r +%% +%% This package is distributed under the MIT License. +%% \NeedsTeXFormat{pLaTeX2e} -\ProvidesPackage{pxbase}[2017/05/04 v0.5i 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 +\ProvidesPackage{pxbase}[2017/05/29 v1.1 PX base library] +% The pxbase package now does the same thing as the bxbase package. +\RequirePackageWithOptions{bxbase}[2017/05/29] \endinput -% EOF +%% EOF diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbasenc.def b/Master/texmf-dist/tex/platex/pxbase/pxbasenc.def index 8e2dc7a7cb2..adb0b56277a 100644 --- a/Master/texmf-dist/tex/platex/pxbase/pxbasenc.def +++ b/Master/texmf-dist/tex/platex/pxbase/pxbasenc.def @@ -1,19 +1,38 @@ -% -% pxbasenc.def -% -%%%% file declaration -\NeedsTeXFormat{pLaTeX2e} -\ProvidesFile{pxbasenc.def}[2010/05/05 v0.5 PX encoding library] +%% +%% This is file 'pxbasenc.def'. +%% -%%%% 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 +%% file declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesFile{pxbasenc.def}[2017/05/29 v1.1 PX encoding library] +\def\pxec@pkgname{PXbase} % bundle name + +%% code guards +\edef\pxec@restore@codes{% + \catcode33=\the\catcode33% + \catcode39=\the\catcode39% + \catcode45=\the\catcode45% + \catcode46=\the\catcode46% + \catcode47=\the\catcode47% + \catcode58=\the\catcode58% + \catcode60=\the\catcode60% + \catcode62=\the\catcode62% +\relax} +\catcode33=12 % <!> +\catcode39=12 % <'> +\catcode45=12 % <-> +\catcode46=12 % <.> +\catcode47=12 % </> +\catcode58=12 % <:> +\catcode60=12 % <<> +\catcode62=12 % <>> + +%--------------------------------------- general + +%% packages +\RequirePackage{ifuptex}[2008/03/14] + +%% variables \ifx\bxUcv\@undefined \newcount\bxUcv \fi @@ -21,11 +40,17 @@ \newif\ifpxec@sw \newif\ifpxec@star -%%------------------ CJK font declarations +%% errors +\def\pxec@error{\PackageError\pxec@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} + +%--------------------------------------- CJK font declarations -%%%% obtain error kanji font setting -% for use as 'safe font setting' -\bgroup \escapechar\m@ne \error@kfontshape +%% obtain error kanji font setting for use as 'safe font setting' +\begingroup \escapechar\m@ne \error@kfontshape \expandafter\let\expandafter\pxec@tenc \csname t@enc@\f@encoding\endcsname \xdef\pxec@safe@jfontspec @@ -34,7 +59,7 @@ \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 +\endgroup %% \pxec@starinvoke\SOMECS \def\pxec@starinvoke#1{% @@ -193,7 +218,7 @@ \pxDeclareCJKShape{#1}{gt}{bx}{#2}{#6}} -%%------------------ passive \DeclareFontShape +%--------------------------------------- passive \DeclareFontShape %%<+> \pxForceFontDeclaration % Takes either of the following values and decides what to do @@ -222,7 +247,7 @@ \@xipt\@xiipt\@xivpt\@xviipt\@xxpt\@xxvpt\do {\expandafter\let\csname #1/#2/#3/#4/\pxec@y\endcsname\@undefined}} -%%------------------- CJK named encodings +%--------------------------------------- CJK named encodings %%<+> \pxDeclareEncodingDispatcher{<enc_name>}{<text>} \@onlypreamble\pxDeclareEncodingDispatcher @@ -259,7 +284,7 @@ \def\pxSetEncodingName#1#2#3{% \@namedef{pxec@EY/#1}{#2}\@namedef{pxec@ET/#1}{#3}} -%%------ font declarations using named encodings +%------------------------------- font declarations using named encodings %%<+> \pxec@supdef\SOMECS{<text1>}{<text2>} % Define \SOMECS to be <text1> if <text1> is non-empty, @@ -314,7 +339,7 @@ \pxDeclareCJKShape\pxec@y{#2}{#3}{#4}{#5}% \pxDeclareCJKShape\pxec@t{#2}{#3}{#4}{\pxec@z}} -%%------------------- JSF encodings +%--------------------------------------- JSF encodings %%<+> \pxDeclareJSFEncoding{<h-enc>}{<v-enc>}{<sfid>,...} \def\pxDeclareJSFEncoding#1#2#3{% @@ -377,7 +402,7 @@ %%<+> \JSFShapeRaw{<ser>}{<shape>}{<spec>} \def\pxec@JSFShapeRaw{\pxDeclareFontShape} -%%------------------ basic encodings +%--------------------------------------- basic encodings %%%% the standard Japanese encodings \ifnativeupTeX @@ -456,7 +481,7 @@ \fi %</upTeX> -%%------------------ patches to OTF/UTF packages +%--------------------------------------- patches to OTF/UTF packages %%%% make \CID work in nonstandard CJK encodings % \UTF & \CID require the current encoding to be the standard one, thus @@ -477,7 +502,7 @@ \fi}% \let\pxBDHookEncSwitchOTF\@empty}% nullify -%%------------------ all done -\pxec@resetcatcode +%--------------------------------------- all done +\pxec@restore@codes \endinput %% EOF diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbsjc.def b/Master/texmf-dist/tex/platex/pxbase/pxbsjc.def index 26852f21cca..d8b27ec658e 100644 --- a/Master/texmf-dist/tex/platex/pxbase/pxbsjc.def +++ b/Master/texmf-dist/tex/platex/pxbase/pxbsjc.def @@ -1,6 +1,6 @@ % % pxbsjc.def % Warning: Do not change encoding of this file! -\def\px@tmpa{é½·é½·}% E9 BD B7 E9 BD B7 +\def\bxtb@tmpa{é½·é½·}% E9 BD B7 E9 BD B7 \endinput % EOF diff --git a/Master/texmf-dist/tex/platex/pxbase/pxbsjc1.def b/Master/texmf-dist/tex/platex/pxbase/pxbsjc1.def new file mode 100644 index 00000000000..2d045938286 --- /dev/null +++ b/Master/texmf-dist/tex/platex/pxbase/pxbsjc1.def @@ -0,0 +1,7 @@ +% +% pxbsjc.def +% Warning: Do not change encoding of this file! +\def\bxtb@tmpa{é½·é½·}% E9 BD B7 E9 BD B7 +% ‚O! % 82 4F 21 +\endinput +% EOF diff --git a/Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def b/Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def index 0a61158d4d7..53a55dae44b 100644 --- a/Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def +++ b/Master/texmf-dist/tex/platex/pxbase/pxjsfenc.def @@ -1,22 +1,39 @@ -% -% pxjsfenc.def -% -%%%% file declaration -\NeedsTeXFormat{pLaTeX2e} -\ProvidesFile{pxjsfenc.def}[2010/05/05 v0.5 PX JSF encoding] +%% +%% This is file 'pxjsfenc.def'. +%% -%%%% preparation +%% file declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesFile{pxjsfenc.def}[2017/05/29 v1.1 PX JSF encoding] + +%% code guards +\edef\pxec@jsf@restore@codes{% + \catcode34=\the\catcode34% + \catcode43=\the\catcode43% + \catcode45=\the\catcode45% + \catcode46=\the\catcode46% + \catcode47=\the\catcode47% + \catcode60=\the\catcode60% +\relax} +\catcode34=12 % <"> +\catcode43=12 % <+> +\catcode45=12 % <-> +\catcode46=12 % <.> +\catcode47=12 % </> +\catcode60=12 % <<> +\g@addto@macro\pxec@jsf@restore@codes{% + \let\pxec@jsf@restore@codes\@undefined} + +%--------------------------------------- general + +%% packages \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 %<"> +\bxRequireDefinition{pxbasenc} + +%% variables \newif\ifpxec@hyperref % true if hyperref patch is invoked -%%------ main module +%--------------------------------------- main %% \pxec@declare@jsf@gen{<name>}{<enc>}{<ext>} \def\pxec@declare@jsf@ucs{\pxec@swtrue\pxec@declare@jsf@a} @@ -72,7 +89,7 @@ \pxec@declare@jsf@cid{CIDC}{J42}{} \pxec@declare@jsf@cid{CIDT}{J43}{} -%%------------------ processing in upTeX +%--------------------------------------- processing in upTeX \ifnativeupTeX \pxDeclareCJKEncoding*{J20}{J30} @@ -101,9 +118,9 @@ \def\pxec@out@jsf#1#2{% {<enc>}\[<ext>] {\kanjiencoding{#1}\selectfont \kchar\bxUcv}} -\pxec@jsf@resetcatcode +\pxec@jsf@restore@codes \expandafter\endinput \fi\relax % stop here -%%------------------ processing in pTeX +%--------------------------------------- processing in pTeX %% JSF encodings \pxDeclareJSFEncoding{J20}{J30}{0,2,3,4,5,6,7,8,9,d,f} @@ -189,7 +206,7 @@ \def\pxec@skiptoend#1\pxec@end{} \let\pxec@end\@empty -%%------------------ all done -\pxec@jsf@resetcatcode +%--------------------------------------- all done +\pxec@jsf@restore@codes \endinput %% EOF diff --git a/Master/texmf-dist/tex/platex/pxbase/upkcat.sty b/Master/texmf-dist/tex/platex/pxbase/upkcat.sty index 4f97b510c44..0f7529b1357 100644 --- a/Master/texmf-dist/tex/platex/pxbase/upkcat.sty +++ b/Master/texmf-dist/tex/platex/pxbase/upkcat.sty @@ -1,22 +1,50 @@ -% -% upkcat.sty (for both upLaTeX2e & plain upTeX) -% +%% +%% This is file 'upkcat.sty'. +%% +%% Copyright (c) 2017 Takayuki YATO (aka. "ZR") +%% GitHub: https://github.com/zr-tex8r +%% Twitter: @zr_tex8r +%% +%% This package is distributed under the MIT License. +%% -%%%% 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] +% Note: This package supports both upLaTeX and plain upTeX. + +%% avoid multiple loading +\csname\if11upkcatstyLoaded\fi\endcsname +%% code guards +\edef\x{\catcode32=\the\catcode32% +\catcode43=\the\catcode43\catcode45=\the\catcode45% +\catcode46=\the\catcode46\catcode47=\the\catcode47% +\catcode60=\the\catcode60\catcode63=\the\catcode63% +\catcode64=\the\catcode64\catcode96=\the\catcode96% +\endlinechar=\the\endlinechar\relax} +\catcode32=10\relax\endlinechar=13\relax +\catcode43=12 \catcode45=12 % <+><-> +\catcode46=12 \catcode47=12 % <.></> +\catcode60=12 \catcode63=12 % <<><?> +\catcode64=11 \catcode96=12 % <@><`> +\edef\pxkq@restore@codes{\x\let\noexpand\pxkq@restore@codes\relax} +%% check for LaTeX +\ifx\RequirePackage\@undefined %<*!LaTeX> + \long\def\x#1\ProvidesPackage#2[#3]{\immediate\write-1{Package: #2 #3}} + \expandafter\x +\else %<*LaTeX> \RequirePackage{ifuptex}[2008/03/14]\RequireupTeX -\fi \let\pxkqOk=t +\fi %</LaTeX> -%%%% \getkcatcode, \setkcatcode -\edef\skrestoreat{\catcode64=\the\catcode64}\catcode64=11 -\newcount\pxkq@cp \newif\ifpxkq@ok +%% package declaration +\NeedsTeXFormat{pLaTeX2e} +\ProvidesPackage{upkcat}[2017/05/29 v1.1 safe kcatcode access] + +%--------------------------------------- main + +%%<*> \getkcatcode{<jachar>} \def\getkcatcode#1{\pxkq@getcp{#1}% \edef\thekcatcode{\the\kcatcode\pxkq@cp}} +%%<*> \setkcatcode{<jachar>}{<value>} \def\setkcatcode#1#2{\pxkq@getcp{#1}\kcatcode\pxkq@cp#2} +\newcount\pxkq@cp \newif\ifpxkq@ok \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% @@ -45,6 +73,7 @@ \errmessage{Corrupted UTF-8 bytes}\pxkq@cp65535\relax} %\def\pxkq@end#1\relax{\showthe\pxkq@cp} -%%%% all done -\pxkqRestoreAt \endinput +%--------------------------------------- all done +\pxkq@restore@codes +\endinput %% EOF |