OSDN Git Service

lltjcore: \[h,v]fill -> \[h,v]ss for small page size
[luatex-ja/luatexja.git] / src / luatexja-compat.sty
1 %
2 % luatexja-compat.sty
3 %
4
5 %! 外から読まれるので仰々しくなってます
6 %% Avoid multiple loading.
7 \csname\if11luatexjacompatLoaded\fi\endcsname
8 \edef\x{%
9 \catcode32=\the\catcode32%
10 \catcode33=\the\catcode33%
11 \catcode35=\the\catcode35%
12 \catcode40=\the\catcode40%
13 \catcode41=\the\catcode41%
14 \catcode42=\the\catcode42%
15 \catcode43=\the\catcode43%
16 \catcode44=\the\catcode44%
17 \catcode45=\the\catcode45%
18 \catcode46=\the\catcode46%
19 \catcode58=\the\catcode58%
20 \catcode59=\the\catcode59%
21 \catcode60=\the\catcode60%
22 \catcode61=\the\catcode61%
23 \catcode62=\the\catcode62%
24 \catcode64=\the\catcode64%
25 \catcode91=\the\catcode91%
26 \catcode93=\the\catcode93%
27 \catcode94=\the\catcode94%
28 \catcode95=\the\catcode95%
29 \catcode126=\the\catcode126%
30 \endlinechar=\the\endlinechar
31 \relax}
32 \catcode32=10 %< >
33 \catcode33=12 %<">
34 \catcode35=6  %<#>
35 \catcode40=12 %<(>
36 \catcode41=12 %<)>
37 \catcode42=12 %<*>
38 \catcode43=12 %<+>
39 \catcode44=12 %<,>
40 \catcode45=12 %<->
41 \catcode46=12 %<.>
42 \catcode58=12 %<:>
43 \catcode59=12 %<;>
44 \catcode60=12 %<<>
45 \catcode61=12 %<=>
46 \catcode62=12 %<>>
47 \catcode64=11 %<@>
48 \catcode91=12 %<[>
49 \catcode93=12 %<]>
50 \catcode94=7  %<^>
51 \catcode95=8  %<_>
52 \catcode126=13 %<~>
53 \endlinechar=-1 %
54 %! なお, 上のcatcode設定はcoreとcompatで同一にしておく.
55 \edef\ltj@compat@AtEnd{\x
56   \noexpand\let\noexpand\ltj@compat@AtEnd\relax}
57 \def\luatexjacompatLoaded{\endinput}
58
59 %% Check if LaTeX is used.
60 \begingroup\expandafter\expandafter\expandafter\endgroup
61 \expandafter\ifx\csname RequirePackage\endcsname\relax %<*!LaTeX>
62   \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
63     \csname iffalse\endcsname
64 \else                           %<*LaTeX>
65   \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
66     \csname iftrue\endcsname
67   \NeedsTeXFormat{LaTeX2e}
68   \ProvidesPackage{luatexja-compat}[2020-08-08 Compatibility with pTeX]
69 \fi                             %</LaTeX>
70
71 % Load core module if not yet.
72 \ifx\luatexjacoreLoaded\@undefined
73   \ifltj@in@latex                 %<*LaTeX>
74     \RequirePackage{luatexja-core}
75   \else                           %<*!LaTeX>
76     \input luatexja-core.sty %
77   \fi                             %</LaTeX>
78 \fi
79
80 %% When environment check fails, exit now.
81 \ifx\LuaTeXjaAvailable\@undefined
82   \ltj@compat@AtEnd
83 \expandafter\endinput\fi\relax
84
85 %% Load Lua modules.
86 %\RequireLuaModule{luatexja.infomute}
87 % not yet implemented.
88
89 %% Silence info messages of luatexbase-mcb
90 %\directlua{ luatexja.infomute.add_mute("luatexbase-mcb") }
91 % not yet implemented.
92
93 %%------------------
94 \RequireLuaTeXjaSubmodule{compat}
95
96 \def\euc{\ltj@code@conv{euc}}
97 \def\kuten{\ltj@code@conv{kuten}}
98 \def\jis{\ltj@code@conv{jis}}
99 \def\sjis{\ltj@code@conv{sjis}}
100 \def\ucs{\ltj@code@conv{ucs}}
101
102 \def\ltj@code@conv#1{\directlua{luatexja.compat.from_#1(token.scan_int())}}
103 \def\kansuji{\directlua{luatexja.compat.to_kansuji(token.scan_int())}}
104
105 \define@key[ltj]{japaram}{kansujichar}{\ltj@@set@stack{KSJ}{0}{0x7FFFFFFF}#1 }
106 \ltj@@decl@array@param{kansujichar}
107
108 \ifltj@in@latex
109 % \pltx@next@inhibitglue (pLaTeX 2018-03-09)
110 \protected\def\pltx@next@inhibitglue{%
111   \ifhmode\inhibitglue\else
112   \edef\@tempa{\everypar{%
113     \everypar{\unexpanded\expandafter{\the\everypar}}%
114     \unexpanded\expandafter{\the\everypar}\inhibitglue}}%
115 \@tempa\fi}
116   \newcommand\printglossary{\@input@{\jobname.gls}}
117 \csname newcount\endcsname\hour
118 \csname newcount\endcsname\minute
119 \fi
120
121 %%------------------ all done
122 \ltj@compat@AtEnd
123 \endinput
124 %% EOF