%% %% This is file 'pxbasenc.def'. %% %% file declaration \NeedsTeXFormat{pLaTeX2e} \ProvidesFile{pxbasenc.def}[2021/05/31 v1.3 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 \newif\ifpxec@ok \newif\ifpxec@sw \newif\ifpxec@star %% 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' \begingroup \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 \endgroup %% \pxec@starinvoke\SOMECS \def\pxec@starinvoke#1{% \@ifstar{\pxec@startrue#1}{\pxec@starfalse#1}} %%<+> \pxDeclareCJKEncoding[*]{}{} % *-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{}{} \@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[*]{}{}{}{}{} % 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[*]{}{}{}{} \@onlypreamble\pxDeclareExtraCJKFamily \def\pxDeclareExtraCJKFamily{% \pxec@starinvoke\pxec@DeclareExtraCJKFamily} \@onlypreamble\pxec@DeclareBasicCJKFamily \def\pxec@DeclareExtraCJKFamily#1#2#3#4{% \pxDeclareKanjiFamily{#1}{#2}% \pxec@DeclareBasicCJKShape{#1}{#2}{m}{#3}% \pxec@DeclareBasicCJKShape{#1}{#2}{bx}{#4}} %% \pxec@DeclareBasicShapeSet[*]{}{}{}{} % (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{}{}{} \def\pxDeclareBasicCJKFallback#1#2#3{% \@for\pxec@x:={it,sl,sc}\do{% \pxDeclareFontShape{#1}{#2}{#3}{\pxec@x}{<->ssub*#2/#3/n}}} %%<+> \pxDeclareBasicCJKShape[*]{}{}{}{} % 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{}{}{}{}{} % Declares a single font shape. Here 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{}{} % Defines a 'fontsubst' with name . After its call, % \pxFontSubst{*} will expand to . % N.B. A fontsubst must be fully-expandable. %%<+> \pxFontSubst{} % Resolves a 'fontsubst' and expands to the resulted text. That is, % - of form ! expands to s*[], where % is the standard scale factor defined in \pxUpScale. % - of fotm * expands to the definition of 'fontsubst' % with name . % - 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{}{}{}{}{} % An alias of \pxDeclareCJKShape for compatibility. \@onlypreamble\pxDeclareSimpleShape \let\pxDeclareSimpleShape\pxDeclareCJKShape %%<+> \pxDeclareExtraCJKShapeBF{}{} %% {}{}{}{} \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 %%<+> \pxDeclareKanjiFamily{}{} \def\pxDeclareKanjiFamily#1#2{% \expandafter\ifx\csname#1+#2\endcsname\relax \DeclareKanjiFamily{#1}{#2}{}% \else\if e\pxForceFontDeclaration \pxec@error{Font family #1/#2 already defined}\@ehc \fi\fi} %%<+> \pxDeclareFontShape{}{}{}{}{} \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{}{}{}{} \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{}{} \@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{,...} \@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{} \def\pxIsEncodingDispatched#1{% 1\expandafter\ifx\csname pxec@EA/#1\endcsname\relax \expandafter0\else\expandafter1\fi} %%<+> \pxBothEncodingsFromName\CSyoko\CState{} %%<+> \pxEncodingFromName{} %%<+> \pxTateEncodingFromName{} \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{}{}{} \@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{}{} % Define \SOMECS to be if is non-empty, % otherwise . \def\pxec@supdef#1#2#3{% \def#1{#2}\ifx#1\@empty \def#1{#3}\fi} %%<+> \pxDeclareCJKEncodingNE[*]{} \@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[*] %% {}{}{}{}{}{} \@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}% \pxDeclareKanjiFamily{\pxec@y}{#2}% \pxec@DeclareBasicCJKShape{\pxec@y}{#2}{m}{#3}% \pxec@DeclareBasicCJKShape{\pxec@y}{#2}{bx}{#4}% \pxDeclareKanjiFamily{\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[*] %% {}{}{}{}{} % 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 %% {}{}{}{}{}{} \@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{}{}{,...} \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{}{}[,...]{} %%<+> \AppendToJSFFamily{}{}[,...]{} \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[*]{}{} \def\pxec@JSFBasicShapeSet{\pxec@DeclareBasicShapeSet} %%<+> \JSFFallback{} \def\pxec@JSFFallback{\pxDeclareBasicCJKFallback} %%<+> \JSFBasicShape[*]{}{} \def\pxec@JSFBasicShape{\pxDeclareBasicCJKShape} %%<+> \JSFShape[*]{}{}{} \def\pxec@JSFShape{% \ifpxec@star \expandafter\pxDeclareFontShape \else \expandafter\pxDeclareCJKShape \fi} %%<+> \JSFShapeRaw{}{}{} \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{} \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{} % 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 % %% J20, J30 : 2000jis \pxSetEncodingName{2000jis}{J20}{J30} \pxDeclareEncodingDispatcher{2000jis}{\pxDeclareCJKEncodingNE{2000jis}} %% J24, J34 : 2004jis \pxSetEncodingName{2004jis}{J24}{J34} \pxDeclareEncodingDispatcher{2004jis}{\pxDeclareCJKEncodingNE{2004jis}} \else % %% 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 % %--------------------------------------- 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@restore@codes \endinput %% EOF