diff options
author | Norbert Preining <preining@logic.at> | 2012-04-24 00:13:14 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2012-04-24 00:13:14 +0000 |
commit | 8f29bdce0bdd08ec81df555e98692d1f288c3289 (patch) | |
tree | c4f9a6b00a587f635e55fc4068c1961780c90591 /Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty | |
parent | 74e624196144ae218a63a4c35672fc7a0e7b18dc (diff) |
new package luatexja (24apr)
adapt ctan2tds to deal with it
git-svn-id: svn://tug.org/texlive/trunk@26115 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty new file mode 100644 index 00000000000..79687d7555c --- /dev/null +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty @@ -0,0 +1,158 @@ +% +% luatexja-compat.sty +% + +%! 外から読まれるので仰々しくなってます +%% Avoid multiple loading. +\csname\if11luatexjacompatLoaded\fi\endcsname +\edef\x{% +\catcode32=\the\catcode32% +\catcode33=\the\catcode33% +\catcode35=\the\catcode35% +\catcode40=\the\catcode40% +\catcode41=\the\catcode41% +\catcode42=\the\catcode42% +\catcode43=\the\catcode43% +\catcode44=\the\catcode44% +\catcode45=\the\catcode45% +\catcode46=\the\catcode46% +\catcode58=\the\catcode58% +\catcode59=\the\catcode59% +\catcode60=\the\catcode60% +\catcode61=\the\catcode61% +\catcode62=\the\catcode62% +\catcode64=\the\catcode64% +\catcode91=\the\catcode91% +\catcode93=\the\catcode93% +\catcode94=\the\catcode94% +\catcode95=\the\catcode95% +\catcode126=\the\catcode126% +\endlinechar=\the\endlinechar +\relax} +\catcode32=10 %< > +\catcode33=12 %<"> +\catcode35=6 %<#> +\catcode40=12 %<(> +\catcode41=12 %<)> +\catcode42=12 %<*> +\catcode43=12 %<+> +\catcode44=12 %<,> +\catcode45=12 %<-> +\catcode46=12 %<.> +\catcode58=12 %<:> +\catcode59=12 %<;> +\catcode60=12 %<<> +\catcode61=12 %<=> +\catcode62=12 %<>> +\catcode64=11 %<@> +\catcode91=12 %<[> +\catcode93=12 %<]> +\catcode94=7 %<^> +\catcode95=8 %<_> +\catcode126=13 %<~> +\endlinechar=-1 % +%! なお, 上のcatcode設定はcoreとcompatで同一にしておく. +\edef\ltj@compat@AtEnd{\x + \noexpand\let\noexpand\ltj@compat@AtEnd\relax} +\def\luatexjacompatLoaded{\endinput} + +%% Check if LaTeX is used. +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname RequirePackage\endcsname\relax %<*!LaTeX> + \expandafter\let\csname ifltj@in@latex\expandafter\endcsname + \csname iffalse\endcsname +\else %<*LaTeX> + \expandafter\let\csname ifltj@in@latex\expandafter\endcsname + \csname iftrue\endcsname + \NeedsTeXFormat{LaTeX2e} + \ProvidesPackage{luatexja-compat}[2011/04/01 v0.1] +\fi %</LaTeX> + +%% If the engine is pTeX, then load the module for it and exit. +\edef\ltj@@tempa{\string\kansuji} +\edef\ltj@@tempb{\meaning\kansuji} +\ifx\ltj@@tempa\ltj@@tempb %<*pTeX> + \let\ltj@@compat@pTeX=t + \ifltj@in@latex %<*LaTeX> + \RequirePackage{ltj-compat-ptex}[2012/04/21] + \else %<*!LaTeX> + \input ltj-compat-ptex.sty % + \fi %</LaTeX> + \ltj@compat@AtEnd +\expandafter\endinput\fi\relax %</pTeX> + +% Load core module if not yet. +\ifx\luatexjacoreLoaded\@undefined + \ifltj@in@latex %<*LaTeX> + \RequirePackage{luatexja-core}[2012/04/20] + \else %<*!LaTeX> + \input luatexja-core.sty % + \fi %</LaTeX> +\fi + +%% When environment check fails, exit now. +\ifx\LuaTeXjaAvailable\@undefined + \ltj@compat@AtEnd +\expandafter\endinput\fi\relax + +%% Load Lua modules. +%\RequireLuaModule{luatexja.infomute} +% not yet implemented. + +%% Silence info messages of luatexbase-mcb +%\directlua{ luatexja.infomute.add_mute("luatexbase-mcb") } +% not yet implemented. + +%%------------------ +\RequireLuaTeXjaSubmodule{jisx0208} +\RequireLuaTeXjaSubmodule{compat} + +\def\euc{\ltj@code@conv{euc}} +\def\kuten{\ltj@code@conv{kuten}} +\def\jis{\ltj@code@conv{jis}} +\def\sjis{\ltj@code@conv{sjis}} +\def\ucs{\ltj@code@conv{ucs}} + +\def\ltj@code@conv#1{% + \directlua{luatexja._cc_next = luatexja.compat.from_#1 }% + \ltj@code@convA +} +\def\ltj@code@convA{% + \expandafter\expandafter\expandafter + \ltj@code@convB\ltj@grab@num +} +\def\ltj@code@convB#1{% + \directlua{luatexja._cc_next(\ltj@safe@num{#1}) }% +} + +\def\kansuji{% + \expandafter\expandafter\expandafter + \ltj@kansujiA\ltj@grab@num +} +\def\ltj@kansujiA#1{% + \directlua{luatexja.compat.to_kansuji(\ltj@safe@num{#1}) }% +} +\define@key[ltj]{japaram}{kansujichar}{% + \expandafter\ltj@@set@stack#1:{ksj}{0}{0x7FFFFFFF}} + +\ltjsetparameter{kansujichar={0,`〇}} +\ltjsetparameter{kansujichar={1,`一}} +\ltjsetparameter{kansujichar={2,`二}} +\ltjsetparameter{kansujichar={3,`三}} +\ltjsetparameter{kansujichar={4,`四}} +\ltjsetparameter{kansujichar={5,`五}} +\ltjsetparameter{kansujichar={6,`六}} +\ltjsetparameter{kansujichar={7,`七}} +\ltjsetparameter{kansujichar={8,`八}} +\ltjsetparameter{kansujichar={9,`九}} + +\ifltj@in@latex + \newcommand\printglossary{\@input@{\jobname.gls}} +\fi +\newcount\hour +\newcount\minute + +%%------------------ all done +\ltj@compat@AtEnd +\endinput +%% EOF |