summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-xunicode.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-xunicode.sty')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-xunicode.sty89
1 files changed, 89 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-xunicode.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-xunicode.sty
new file mode 100644
index 00000000000..bef3b2dcf5a
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-xunicode.sty
@@ -0,0 +1,89 @@
+%
+% lltjp-xunicode.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lltjp-xunicode}[2012/4/18 Patch to xunicode for LuaLaTeX-ja]
+
+\def\UTFencname{EU2}\def\XeTeXpicfile{}
+\RequirePackage{xunicode,luatexja}
+{\catcode`\"=12
+\gdef\check@hexcom@digits@#1#2#3#4#5@!@#6#7#8{%
+ \ifx @#4\relax
+ \UTFacc@warning@{insufficient hex digits #7 for #6-\string#8}%
+ \else
+ \ifcat \active\noexpand#8%
+ \ifx\add@flag\@ne %
+ \expandafter\def\csname\UTFencname\string#8\endcsname{\ltjalchar"#1#2#3#4\relax}%
+ \ifx\unDeFiNed@#8%
+ \ifx\cf@encoding\UTFencname
+ \DeclareTextCommand{#8}{OT1}{\undefined}%
+ \else
+ \DeclareTextCommand{#8}{\cf@encoding}{\undefined}%
+ \fi
+ \else {% macro #8 exists already ...
+ \let\protect\noexpand
+ \edef\UTF@testi{#8}\def\UTF@testii{#8}%
+ \ifx\UTF@testi\UTF@testii\aftergroup\UTF@ignore
+ \else\aftergroup\UTF@doit\fi
+ }%
+ \iffalse
+ % ... but when it isn't robust, make it so
+ \expandafter\let\csname?-\string#8\endcsname#8\relax
+ \edef\next@UTF@{{\cf@encoding}%
+ {\expandafter\noexpand\csname?-\string#8\endcsname}}%
+ \expandafter\DeclareTextCommand\expandafter
+ {\expandafter#8\expandafter}\next@UTF@
+ \fi
+ \fi %
+ \else % \add@flag \z@
+ \expandafter\global\expandafter
+ \let\csname\UTFencname\string#8\endcsname\relax
+ \fi % end of \add@flag switch
+ \else % not active catcode --- shouldn't happen
+ % \typeout{*** did you really mean #8 ? ***}%
+ \ifx\add@flag\@ne %
+ \edef\tmp@name{\expandafter\string\csname\UTFencname\endcsname
+ \expandafter\string\csname#8\endcsname}%
+ \expandafter\def\csname\tmp@name\endcsname{\ltjalchar"#1#2#3#4\relax}%
+ \ifx\cf@encoding\UTFencname
+ \expandafter\DeclareTextCommand\expandafter
+ {\csname#8\endcsname}{OT1}{\undefined}%
+ \else
+ \expandafter\DeclareTextCommand\expandafter
+ {\csname#8\endcsname}{\cf@encoding}{\undefined}%
+ \fi
+ \else % \add@flag \z@
+ \expandafter\global\expandafter\let\csname#8\endcsname\relax
+ \fi % end of \add@flag switch
+ \fi % end of \ifcat
+ \fi}
+\gdef\check@hex@digits@#1#2#3#4#5@!@#6#7#8#9{%
+ \ifx @#4\relax
+ \UTFacc@warning@{insufficient hex digits #7 for #6-\string#8#9}%
+ \else
+ \def\UTFchar{\ltjalchar"#1#2#3#4\relax}%
+ \expandafter\expandafter\expandafter\declare@utf@composite
+ \expandafter\expandafter\expandafter
+ {\expandafter\csname#6\endcsname}{\UTFchar}{#8}{#9}\relax
+ \fi}
+\gdef\add@UTF@accent#1#2#3{\ifx\relax#2\relax\ltjalchar"#3\else
+ \ifx\ #2\relax\ltjalchar"#3\else
+ \expandafter\ifx\UTF@space#2\relax\ltjalchar"#3\else
+ \ifx~#2\ltjalchar"#3\else#2\ltjalchar"#1\fi\fi\fi\fi\relax}
+\gdef\add@UTF@accents#1#2#3{#2\ltjalchar"#1\ltjalchar"#3\relax}
+}
+% If unicode-math is already loaded, the following error occurs:
+% ! Undefined control sequence.
+% \hbar ->\hslash
+% Therefore temporarily set \hbar=\relax.
+\let\ltj@tmpa\hbar
+\let\hbar\relax
+\let\ltj@tmpb\iftipaonetoken
+\let\iftipaonetoken\relax
+\ReloadXunicode{EU2}
+\makeatletter
+\let\hbar\ltj@tmpa
+\let\iftipaonetoken\ltj@tmpb
+\let\ltj@tmpb\relax % no more an if-token
+\endinput