diff options
author | Karl Berry <karl@freefriends.org> | 2013-01-13 23:06:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-01-13 23:06:54 +0000 |
commit | 8b4c4dba6b23ddbfe20886ac64828e1a19fefa43 (patch) | |
tree | 9f37fbdc2c85b946690c7f9449b902cd10243071 /Master/texmf-dist/tex/latex/bxbase | |
parent | f242908d5fddb009640260a320bb9e406a88b448 (diff) |
bxbase (13jan13)
git-svn-id: svn://tug.org/texlive/trunk@28825 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bxbase')
-rw-r--r-- | Master/texmf-dist/tex/latex/bxbase/bxbase.def | 791 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bxbase/bxbase.sty | 70 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bxbase/bxucs.sty | 109 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bxbase/bxutf8.def | 168 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bxbase/bxutf8x.def | 80 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bxbase/zxbase.sty | 151 |
6 files changed, 1369 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/bxbase/bxbase.def b/Master/texmf-dist/tex/latex/bxbase/bxbase.def new file mode 100644 index 00000000000..1488f6fa1c4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/bxbase/bxbase.def @@ -0,0 +1,791 @@ +% +% bxbase.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{bxbase} %% read this file again +\expandafter\endinput\fi + +%%--------------- folloing stuffs are read by \bxTnext + +%%%% file declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{bxbase.def}[2010/06/15 v0.5 BX/PX base library] +\bxCheckCPart{pxbase} +%* 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/latex/bxbase/bxbase.sty b/Master/texmf-dist/tex/latex/bxbase/bxbase.sty new file mode 100644 index 00000000000..d506fc37a62 --- /dev/null +++ b/Master/texmf-dist/tex/latex/bxbase/bxbase.sty @@ -0,0 +1,70 @@ +% +% bxbase.sty +% + +%%%% package declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bxbase}[2010/06/15 v0.5 BX base library] + +%%%% include 'bxbase.def' +\input{bxbase.def} +\bxBDHookBabel +\bxBDHookUnicode +\bxBDHookSafeCaret + +%%%% error messages +\def\bx@pkgname{bxbase} +\def\bx@error{\PackageError\bx@pkgname} +\def\bx@alert{\PackageWarningNoLine\bx@pkgname} +\def\bx@warn{\PackageInfo\bx@pkgname} +\def\bx@warn@aecs#1{\px@warn{Command \string#1 already exists}} + +%%------ + +%%<*> \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 + +%%%% withnohyph environment +\expandafter\ifx\csname l@nohyphenation\endcsname\relax + \newlanguage\l@nohyphenation \fi +\def\withnohyph{\language\l@nohyphenation} +\let\endwithnohyph\relax + +%%------ all done +\endinput +%% EOF +% +% * bxbase provides: +% - bx@Uxh@fb (terminal) +% - bxUx (passed to bx@Ux) +% - bxUI (passed to bx@UI) +% - bxUHex (passed to bx@Uxh) +% * bxutf8 provides: +% - conversion from UTF8 string to bxUHex +% * bxucs provides: +% - bx@Ux@ucs (fallback to bx@UI) +% - bx@Uxh@ucs (fallback to bx@UIh) +% * utf/otf provides: +% - bx@UIh@p (terminal) +% +% [default] +% bx@Ux bx@Uxh +% v v +% bx@UI > bx@UIh = bx@UIh@fb or bx@UIh@p +% +% [with bxucs] +% bx@Ux = bx@Ux@ucs bx@Uxh = bx@Uxh@ucs +% v v +% bx@UI > bx@UIh = bx@Uxh@fb or bx@UIh@p +% diff --git a/Master/texmf-dist/tex/latex/bxbase/bxucs.sty b/Master/texmf-dist/tex/latex/bxbase/bxucs.sty new file mode 100644 index 00000000000..39d42824f0e --- /dev/null +++ b/Master/texmf-dist/tex/latex/bxbase/bxucs.sty @@ -0,0 +1,109 @@ +% +% bxucs.sty +% + +%%%% package declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bxucs}[2008/03/28 v0.2 BX Unicode output] + +%%%% preparation +\RequirePackage{bxbase} + +%%%% error messages +\def\bxus@pkgname{bxucs} +\def\bxus@error{\PackageError\bxus@pkgname} +\def\bxus@err@inf#1{\bxus@error + {extra characters after number}% + {I ignore such characters}} +\def\bxus@err@nousf{\bxus@error + {Unicode subfont encoding not declared\MessageBreak + for family '\f@family'}\@ehc} + +%%%% declare encoding 'USF' +% There must be at least one valid font shape in USF encoding and is set +% in \DeclareFontSubstitution properly; otherwise an error will occur at +% the beginning of document. Here we use the value of 'error font' as +% dummy default font of USF encoding. +\DeclareFontEncoding{USF}{}{} +\bgroup \escapechar\m@ne \error@fontshape + \DeclareFontFamily{USF}{\f@family}{} + \global\expandafter\let + \csname USF/\f@family/\f@series/\f@shape\expandafter\endcsname + \csname \f@encoding/\f@family/\f@series/\f@shape\endcsname + \xdef\bx@nxt{\noexpand\DeclareFontSubstitution + {USF}{\f@family}{\f@series}{\f@shape}} +\egroup \bx@nxt + +%%%% \USFDeclareFontShape{<family>}{<list>} +% <list> is a range list of available Unicode-row-numbers. +\def\USFDeclareFontShape#1#2{% + \edef\bx@nxt{\uppercase{\def\noexpand\bxus@dfs@range{#2}}}% + \edef\bxus@dfs@fam{#1}\bx@nxt + \ifx\bxus@dfs@range\@empty \def\bxus@dfs@range{00-FF}\fi + \afterassignment\bxus@decl@fontshape\def\bxus@dfs@body##1} +\def\bxus@decl@fontshape{% + \DeclareFontFamily{USF}{\bxus@dfs@fam}{\relax}% make last arg non-empty + {\let\bxus@do\bxus@dfs@do\bxus@hexrange\bxus@dfs@range}} +\def\bxus@dfs@do{% + \bxToHexTwo\@tempcnta \bxToLower\bxHex\edef\guz{\bxRes}% + \global\expandafter\let + \csname bxus@U/\bxus@dfs@fam/\bxRes\endcsname=t% + \DeclareFontFamily{USF}{\bxus@dfs@fam=U\bxRes}{}% + \bxDebug{font family \bxus@dfs@fam=U\bxRes\space loaded}% + \edef\USFShape{% + \noexpand\DeclareFontShape{USF}{\bxus@dfs@fam=U\bxRes}}% + \bxus@dfs@body\bxRes} + +%%%% \bx@Ux@ucs +\def\bx@Ux@ucs{% code value is given in \bxUcv + \bxus@loadfontdef + \ifnum\bxUcv<\p@% \p@ equals 65536 + \bxToHexFour\bxUcv \expandafter\bxus@uxh@a\bxHex\@nil + \else \expandafter\bx@UI \fi} + +%%%% \bx@Uxh@ucs +\def\bx@Uxh@ucs#1{% + \bxus@loadfontdef\edef\bxHex{#1}% + \expandafter\bxus@uxh@a\bxHex\@nil} +\def\bxus@uxh@a#1#2#3#4\@nil{% + \bxDebug{char "\bxHex}% + \lowercase{\bxus@uxh@b{#1#2}}{#3#4}} +\def\bxus@uxh@b#1#2{% + \bgroup + \expandafter\ifx\csname bxus@U/\f@family/#1\endcsname\relax\else + \fontencoding{USF}\fontfamily{\f@family=U#1}\selectfont + \@tempcnta="#2\relax\bxus@chkchr + \ifbxOk \char\@tempcnta \aftergroup\@gobble \fi + \fi + \egroup \bxus@uxh@x} % this \bxus@uxh@x may be gobbled +\def\bxus@uxh@x{% + \bxDebug{fallback}\bx@UIh\bxHex} + +%%%% \bxus@chkchr +\def\bxus@chkchr{% + \iffontchar\font\@tempcnta \bxOktrue \else \bxOkfalse \fi} +\ifnum\bxEngineTypeY=\z@ +\def\bxus@chkchr{\bxOktrue} +\fi + +%%%% \bxus@loadfontdef +\def\bxus@loadfontdef{% + \expandafter\ifx\csname USF+\f@family\endcsname\relax + \begingroup \let\typeout\@font@info \escapechar\m@ne + \def\f@encoding{USF}\try@load@fontshape + \endgroup\fi + \expandafter\ifx\csname USF+\f@family\endcsname\@empty + \bxus@err@nousf \expandafter\bxus@skiptonil\fi} +\def\bxus@skiptonil#1\@nil{} + +%%%% \bxus@hexrange{<range-list>} +\def\bxus@hexrange#1{% + \@for\bxus@u:=#1\do{\expandafter\bxus@hexrange@a\bxus@u--\@nil}} +\def\bxus@hexrange@a#1-#2-#3\@nil{% + \if-#2-\@tempcnta"#1\relax\bxus@do + \else\@tempcnta"#1\@tempcntb"#2\relax\expandafter\bxus@hexrange@b\fi} +\def\bxus@hexrange@b{% + \@whilenum\@tempcnta<\@tempcntb\do{\bxus@do\advance\@tempcnta\@ne}% + \bxus@do} + +%% EOF diff --git a/Master/texmf-dist/tex/latex/bxbase/bxutf8.def b/Master/texmf-dist/tex/latex/bxbase/bxutf8.def new file mode 100644 index 00000000000..1422552e095 --- /dev/null +++ b/Master/texmf-dist/tex/latex/bxbase/bxutf8.def @@ -0,0 +1,168 @@ +% +% bxutf8.def +% +%%%% package declarations +\ProvidesFile{bxutf8.def}[2010/05/05 v0.5 BX UTF-8 input encoding] +% +% Note: All definitions in this file should be local. +% +%%%% preparation +% Here spaces are set back to valid. So great care must be taken +% so spaces should not be spilt out (in horizontal mode). +\catcode32=10\relax +\expandafter\edef\csname bx@b@resetcatcodes\endcsname{% " . : @ + \catcode34=\the\catcode34\catcode46=\the\catcode46% + \catcode58=\the\catcode39\catcode64=\the\catcode64\relax}% +\catcode34=12 \catcode46=12 \catcode58=12 \catcode64=11 % +% abort when this is first loaded after \begin{document} +\def\bxus@i@error{\PackageError{inputenc}}% +\ifx\@nodocument\relax + \ifx\bxus@bxutf@loaded\@undefined + \bxus@i@error{cannot load `bxutf8' after \string\begin{document}}% + \@eha \bx@b@resetcatcodes\endinput\fi\fi +% +%%%% load 'utf8' encoding +\InputIfFileExists{utf8.def}{}% + {\bxus@i@error{input encoding `utf8' unavailable}% + \@eha \bx@b@resetcatcodes\endinput}% +\makeatletter +%\@inpenc@test % This is done in utf8.def +% +%%%% attach the hook +\def\UTFviii@two@octets#1#2{\expandafter\bxus@choice + \csname u8:#1\string#2\endcsname#1#2.@}% +\def\UTFviii@three@octets#1#2#3{\expandafter\bxus@choice + \csname u8:#1\string#2\string#3\endcsname#1#2#3@}% +\def\UTFviii@four@octets#1#2#3#4{\expandafter\bxus@choice@four + \csname u8:#1\string#2\string#3\string#4\endcsname#1#2#3#4@}% +% +%%%% attach the hook (old version) +% * This hook was found to fail in pTeX. +% Here #1 is a control word of form \u8:<UTF-8_bytes>. If it is +% defined in standard way of utf8.def, then it is dispatched; +% otherwise it is passed to \bxus@preproc. +%\def\UTFviii@defined#1{% +% \ifx#1\relax \bxus@preproc#1% +% \else\expandafter#1\fi}% +%%%% \bxus@preproc\CS +%\def\bxus@preproc#1{% +% \expandafter\bxus@preproc@a\string#1..\@nil}% +%\def\bxus@preproc@a#1:#2#3#4#5#6\@nil{% +% \if.#5\bxus@proc#2#3#4\else\bxus@err@uknbc\fi}% +% +% When this file is reloaded, the 'static' part will be skipped. +\ifx\bxus@bxutf@loaded\@undefined\else + \bx@b@resetcatcodes\endinput \fi +\let\bxus@bxutf@loaded=t% +% +%%---------- Beginning of static part +% +%%%% error messages +\def\bxus@err@uknbc{\bxus@i@error{Unknown non-BMP character found}% + {bxutf8 cannot handle non-BMP characters.}}% +\def\bxus@err@nodrv{\bxus@i@error{Unicode driver not found}\@ehb}% +% +%%%% make tables +\def\bxus@fornbl{% + \bxus@fornbl@a00001102203310411512613720821922A23B30C31D32E33FXXX}% +\def\bxus@fornbl@a#1#2#3{% + \if X#1\else + \@namedef{bxus@*#1#2}{#3}% + \bxus@defchr{F#3}{0#1#2}\bxus@defchr{E#3}{#1#2}% + \bxus@defchr{C#3}{000#1#2}\bxus@defchr{D#3}{001#1#2}% + \bxus@defchr{8#3}{0#1#2}\bxus@defchr{9#3}{1#1#2}% + \bxus@defchr{A#3}{2#1#2}\bxus@defchr{B#3}{3#1#2}% + \expandafter\bxus@fornbl@a\fi}% +\def\bxus@defchr#1#2{% + {\lccode`\!="#1% + \lowercase{\expandafter\gdef\csname bxus@@!\endcsname{#2}}}}% +\bxus@fornbl \@namedef{bxus@@.}{}% +% +%%%% \bxcs@choice +%% Called in the form +%% \bxus@choice[\u8:??]??.@ (2-byte) or +%% \bxus@choice[\u8:???]???@ (3-byte) +%% where ?? is a (TF-8 byte string and [\u8:...] denotes a single +%% control word. This macro expands to the control word if it is +%% defined; otherwise expands to \bxus@proc. +\def\bxus@choice#1#2@{% + \ifx#1\relax \bxus@proc#2% + \else\expandafter#1\fi}% +% +%%%% \bxus@choice@four +\def\bxus@choice@four#1#2@{% + \ifx#1\relax \bxus@prociv#2% + \else\expandafter#1\fi}% +% +%%%% \bxus@proc +%% When ??? is the UTF-8 string of U+XXXX (padded to length 3 with +%% a dot), then \bxus@proc@a??? fully expands to \bxUHex{XXXX}. +%% (\bxUHex should be robust.) +\def\bxus@proc#1#2#3{% + \expandafter\bxus@proc@b\csname bxus@@\string#1\expandafter\endcsname + \csname bxus@@\string#2\expandafter\endcsname + \csname bxus@@\string#3\endcsname}% +\def\bxus@proc@b#1#2#3{% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\bxus@proc@c + \expandafter\expandafter\expandafter#1% + \expandafter#2#3}% +\def\bxus@proc@c#1#2#3#4#5#6#7#8{% + \expandafter\bxus@proc@d\csname bxus@*#1#2\expandafter\endcsname + \csname bxus@*#3#4\expandafter\endcsname + \csname bxus@*#5#6\expandafter\endcsname + \csname bxus@*#7#8\endcsname}% +\def\bxus@proc@d#1#2{% + \expandafter\expandafter\expandafter\bxus@proc@e + \expandafter#1#2\@nil}% +\def\bxus@proc@e#1\@nil#2#3{% + \bxus@proc@f#2#3#1\@nil}% +\def\bxus@proc@f#1#2{% + \expandafter\expandafter\expandafter\bxus@proc@g + \expandafter#1#2\@nil}% +\def\bxus@proc@g#1\@nil#2\@nil{% + \bxUHex{#2#1}}% +% +\def\bxus@prociv#1#2#3#4{% + \expandafter\bxus@prociv@a\csname bxus@@\string#1\expandafter\endcsname + \csname bxus@@\string#2\expandafter\endcsname + \csname bxus@@\string#3\expandafter\endcsname + \csname bxus@@\string#4\endcsname}% +\def\bxus@prociv@a#1#2#3#4{% + \expandafter\expandafter\expandafter\bxus@prociv@b + \expandafter#3#4@#1#2} +\def\bxus@prociv@b#1@#2#3{% + \expandafter\expandafter\expandafter\bxus@prociv@c + \expandafter#2#3#1@@} +\def\bxus@prociv@c#1#2#3#4{% + \expandafter\bxus@prociv@d\csname bxus@*#1#2\expandafter\endcsname + \csname bxus@*#3#4\endcsname} +\def\bxus@prociv@d#1#2{% + \expandafter\expandafter\expandafter\bxus@prociv@e + \expandafter#1#2} +\def\bxus@prociv@e#1#2#3@#4@{\bxus@prociv@f#3@#4#1#2@} +\def\bxus@prociv@f#1#2#3#4{% + \expandafter\bxus@prociv@g\csname bxus@*#1#2\expandafter\endcsname + \csname bxus@*#3#4\endcsname} +\def\bxus@prociv@g#1#2{% + \expandafter\expandafter\expandafter\bxus@prociv@h + \expandafter#1#2} +\def\bxus@prociv@h#1#2#3@#4@{\bxus@prociv@i#3@#4#1#2@} +\def\bxus@prociv@i#1#2#3#4{% + \expandafter\bxus@prociv@j\csname bxus@*#1#2\expandafter\endcsname + \csname bxus@*#3#4\endcsname} +\def\bxus@prociv@j#1#2{% + \expandafter\expandafter\expandafter\bxus@prociv@k + \expandafter#1#2} +\def\bxus@prociv@k#1#2@#3@{\bxUHex{#3#1#2}} + + + + +%%%% default (useless) Unicode driver +\providecommand*\bxUHex[1]{?\protect\bxus@err@nodrv}% +% +%%%% all done +\bx@b@resetcatcodes +\endinput +%% EOF diff --git a/Master/texmf-dist/tex/latex/bxbase/bxutf8x.def b/Master/texmf-dist/tex/latex/bxbase/bxutf8x.def new file mode 100644 index 00000000000..a703d5bfe94 --- /dev/null +++ b/Master/texmf-dist/tex/latex/bxbase/bxutf8x.def @@ -0,0 +1,80 @@ +% +% bxutf8x.def +% +%%%% package declarations +\ProvidesFile{bxutf8x.def}[2008/04/06 v0.3 + BX UTF-8 input encoding (ucs ver.)] +% +% Note: All definitions in this file should be local. +% +%%%% preparation +\catcode32=10\relax +\expandafter\edef\csname bx@b@resetcatcodes\endcsname{% " . : @ + \catcode34=\the\catcode34\catcode46=\the\catcode46% + \catcode58=\the\catcode39\catcode64=\the\catcode64\relax}% +\catcode34=12 \catcode46=12 \catcode58=12 \catcode64=11 % +\def\bxus@i@error{\PackageError{inputenc}}% +\ifx\@nodocument\relax + \ifx\bxus@bxutfx@loaded\@undefined + \bxus@i@error{cannot load `bxutf8x' after \string\begin{document}}% + \@eha \bx@b@resetcatcodes\endinput\fi\fi +% +%%%% load 'utf8x' encoding +\InputIfFileExists{utf8x.def}{}% + {\PackageError{inputenc}{input encoding `utf8x' unavailable}% + {You must install `unicode' package to use it.}% + \bx@b@resetcatcodes\endinput}% +%\@inpenc@test % This is done in utf8.def +% +% When this file is reloaded, the 'static' part will be skipped. +\ifx\bxus@bxutfx@loaded\@undefined\else + \bx@b@resetcatcodes \endinput \fi +\let\bxus@bxutfx@loaded=t% +% +%%---------- Beginning of static part +% +%%%% error messages +\def\bxus@err@nodrv{\bxus@i@error{Unicode driver not found}\@ehb}% +% +%%%% \bxus@uc@char@notloaded +% Hooked version of \uc@char@notloaded +\def\bxus@uc@char@notloaded#1{% + \count@=#1\divide\count@256% + \edef\uc@temp@a{uni-\number\count@.def}% + \expandafter\ifx\csname\uc@temp@a\endcsname\relax\else + \uc@secondtry#1\relax\fi + \ifnum\uc@secondtry=#1\relax % all trial of utf8x failed + \bxUInt{#1}% + \else + \begingroup + \ifUnicodeOptionsavemem\else + \global\expandafter\let\csname\uc@temp@a\endcsname\@ne \fi + \def\uc@got{#1}\uni@resetcatcodes + \expandafter\InputIfFileExists\expandafter{\uc@temp@a}{% + \global\let\uni@dataloaded1}{}% + \endgroup + \uc@secondtry#1\relax\uni@char{#1}% + \fi}% +\def\bxus@uc@notloaderr#1#2#3{% + \bxUInt{#1}}% \bxUInt should be robust +% +%%%% attach the hook +% Note that ucs.sty could be loaded after utf8x.def. +\AtBeginDocument{% + \let\uc@notloaderr\bxus@uc@notloaderr + \let\uc@char@notloaded\bxus@uc@char@notloaded}% +% +%%%% force ucs 'fasterrors' option switched on +% Heavy 'uninames' decoding process is of no use in presence of the hook, +% and it causes unexpected result in use of pTeX. +\AtBeginDocument{% + \let\UnicodeOptionfasterrorsfalse\UnicodeOptionfasterrorstrue + \UnicodeOptionfasterrorstrue}% +% +%%%% default (useless) Unicode driver +\providecommand*\bxUInt[1]{?\protect\bxus@err@nodrv}% +% +%%%% all done +\bx@b@resetcatcodes +\endinput +%% EOF diff --git a/Master/texmf-dist/tex/latex/bxbase/zxbase.sty b/Master/texmf-dist/tex/latex/bxbase/zxbase.sty new file mode 100644 index 00000000000..be7e5189fcf --- /dev/null +++ b/Master/texmf-dist/tex/latex/bxbase/zxbase.sty @@ -0,0 +1,151 @@ +% +% zxbase.sty +% +%%%% package declaration +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{zxbase}[2009/11/16] +\RequirePackage{ifxetex} +\RequireXeTeX + +%%%% preparations +\RequirePackage{bxbase} +\def\zx@pkgname{zxbase} +\def\zx@error{\PackageError\zx@pkgname} +\def\zx@warn{\PackageWarningNoLine\zx@pkgname} + +%%------ generic family detection + +%%%% constants \zxSpecFamily, \zxRMFamily, etc. +% These values can be considered as fixed, so you can say i.e. +% "\ifnum\zxGFFlag<\zxSFFamily <non-sans> \else <sans> \fi" +\chardef\zxSpecFamily=0 +\chardef\zxRMFamily=1 +\chardef\zxSFFamily=2 +\chardef\zxTTFamily=3 + +%%%% \zx@set@genfamflag +% A patch to be inserted to \selectfont. This makes \selectfont +% set a right \zx..Family constant to \zxGFFlag. +\def\zx@set@genfamflag{% + \zx@set@gff@get\zx@curfam\f@family + \let\zxGFFlag\zxSpecFamily + \zx@set@gff@match\ttdefault\zxTTFamily + \zx@set@gff@match\sfdefault\zxSFFamily + \zx@set@gff@match\rmdefault\zxRMFamily} +\def\zx@set@gff@get#1#2{% + \expandafter\let\expandafter#1\csname + zf@family@fontname#2\endcsname + \ifx#1\relax \edef#1{#2}\fi} +\def\zx@set@gff@match#1#2{% + \zx@set@gff@get\zx@genfam#1% + \ifx\zx@genfam\zx@curfam \let\zxGFFlag#2\fi} + +%%%% \zxBDHookGenFamFlag +\def\zxBDHookGenFamFlag{\zx@bdhook@genfamflag@do} +\@onlypreamble\zx@bdhook@genfamflag@do +\def\zx@bdhook@genfamflag@do{% + \expandafter\zx@bdhook@genfamflag@a\csname selectfont \endcsname + \let\zx@bdhook@genfamflag@do\relax} +\@onlypreamble\zx@bdhook@genfamflag@a +\def\zx@bdhook@genfamflag@a#1{% + \expandafter\def\expandafter#1\expandafter{% + \expandafter\zx@set@genfamflag#1}} + +%%------ Forging pTeX direction primitives + +\def\zxBDHookForgepTeXDir{\zx@bdhook@forgeptexdir@do} +\@onlypreamble\zx@bdhook@forgeptexdir@do +\def\zx@bdhook@forgeptexdir@do{% + \zx@letconstif{ydir}{true}\zx@letconstif{tdir}{false}% + \ifx\yoko\@undefined \let\yoko\relax \fi + \ifx\tate\@undefined \let\tate\relax \fi +} +\def\zx@letconstif#1#2{% + \ifcsname if#1\endcsname\else + \expandafter\let\csname if#1\expandafter\endcsname + \csname if#2\endcsname \fi} + +%%------ Forcing to read pLaTeX packages + +\newif\ifzxPPInUTFEight +\newif\ifzx@jisenc +\def\zx@err@ukenc#1{\zx@error{File '#1' is in unknown encoding}% +{The file must be encoded in ISO-2022-JP or UTF-8.}} + +%%%% \zxRequirepLaTeXPackage +\@onlypreamble\zxRequirepLaTeXPackage +\def\zxRequirepLaTeXPackage#1{% + \ifzxPPInUTFEight \zx@jisencfalse + \else \zx@checkjisorutfeight{#1.\@pkgextension}% + \ifcase\zx@joru \zx@err@ukenc{#1.\@pkgextension}\or + \zx@jisenctrue \else \zx@jisencfalse \fi + \fi + \let\NeedsTeXFormat\zx@mute@NeedsTeXFormat + \ifzx@jisenc \XeTeXdefaultencoding ISO-2022-JP\relax \fi + \RequirePackage{#1}% + \ifzx@jisenc \XeTeXdefaultencoding auto\relax \fi + \let\NeedsTeXFormat\zx@org@NeedsTeXFormat +} + +%%%% \zx@mute@NeedsTeXFormat +\def\zx@mute@NeedsTeXFormat#1{\@ifnextchar[{\zx@mute@ntf@a}{\relax}} +\def\zx@mute@ntf@a[#1]{\relax} +\let\zx@org@NeedsTeXFormat\NeedsTeXFormat + +%%%% \zx@checkjisorutfeight{<file>} +% Decides whether <file> is encoded in JIS or UTF-8 and sets to \zx@joru. +% 0:binary; 1:JIS; 2:UTF-8; 3:US-ASCII +\def\zx@checkjisorutfeight#1{% + \begingroup + \XeTeXdefaultencoding bytes\relax + \let\zx@c@ctl=f\def\zx@found@ctl{\let\zx@c@ctl=t}% + \let\zx@c@esc=f\def\zx@found@esc{\let\zx@c@esc=t}% + \let\zx@c@high=f\def\zx@found@high{\let\zx@c@high=t}% + \zx@make@activelet{0}{32}\zx@found@ctl + \zx@make@ignorable{32}{127}% + \zx@make@activelet{127}{128}\zx@found@ctl + \zx@make@activelet{128}{256}\zx@found@high + \zx@make@activelet{27}{28}\zx@found@esc + \catcode13=5 \catcode32=10 \catcode9=10 \catcode`\~=9 + \@@input"#1"\relax + \if t\zx@c@ctl \global\chardef\zx@g@joru0 + \else\if t\zx@c@esc \global\chardef\zx@g@joru1 + \else\if t\zx@c@high \global\chardef\zx@g@joru2 + \else \global\chardef\zx@g@joru3 \fi\fi\fi + \XeTeXdefaultencoding auto\relax + \endgroup + \let\zx@joru\zx@g@joru} +\def\zx@make@activelet#1#2#3{% + \catcode`\~=\active \let\zx@tmpx=#3\relax + \@tempcnta#1\relax\loop + \catcode\@tempcnta\active \lccode`\~=\@tempcnta + \lowercase{\let~\zx@tmpx}% + \advance\@tempcnta\@ne \ifnum\@tempcnta<#2 \repeat} +\def\zx@make@ignorable#1#2{% + \@tempcnta#1\relax\loop \catcode\@tempcnta9 + \advance\@tempcnta\@ne \ifnum\@tempcnta<#2 \repeat} + +%%<*> \platexpackagesinunicode +\@onlypreamble\platexpackagesinunicode +\let\platexpackagesinunicode\zxPPInUTFEight + +%%------ trashed stuff + +%\def\zxRemoveFSSuffix#1{% +% \edef\zx@tmpx{#1}\bxOkfalse +% \let\bxRes\@empty \let\zx@chunk\@gobble +% \expandafter\zx@rem@fssfx@a\zx@tmpx(@\@nil} +%\def\zx@rem@fssfx@a#1(#2#3\@nil{% +% \ifx @#2\edef\bxRes{\bxRes\zx@chunk\@empty}% +% \def\zx@nxt{\zx@rem@fssfx@b#1@)@\@nil}% +% \else \edef\bxRes{\bxRes\zx@chunk(}\def\zx@chunk{#1}% +% \def\zx@nxt{\zx@rem@fssfx@a#2#3\@nil}% +% \fi \zx@nxt} +%\def\zx@rem@fssfx@b#1)@#2\@nil{% +% \ifx\bxRes\@empty\else +% \ifx @#2@\else \bxAssign\@tempcnta0#1\relax \fi \fi +% \ifbxOk\else \let\bxRes\zx@tmpx \fi} + +%%------ all done +\endinput +%% EOF |