blob: a522d6e29a8b173074840008b62793ea71febb39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
%%
%% This is file 'bxtoolbox-ja.def'.
%%
%% file declaration
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bxtoolbox-ja.def}[2017/05/29 v1.1]
%% check intergrity
\edef\bxtb@tmpa{\@currname.\@currext}\def\bxtb@tmpb{bxtoolbox-ja.def}
\ifx\bxtb@tmpa\bxtb@tmpb\else
\PackageError\bxtb@pkgname{Illegal load sequence}\@eha
\expandafter\endinput\fi\relax
%% load submodule
\providecommand*\bxRequireDefinition[1]{%
\def\bx@@def{def}\@onefilewithoptions{#1}[][]\bx@@def}
\bxRequireDefinition{bxtoolbox-ext}
%% code guards
\edef\bxtb@j@restore@codes{%
\catcode34=\the\catcode34%
\catcode45=\the\catcode45%
\catcode46=\the\catcode46%
\catcode47=\the\catcode47%
\catcode58=\the\catcode58%
\catcode59=\the\catcode59%
\catcode63=\the\catcode63%
\catcode96=\the\catcode96%
\relax}
\catcode34=12 % <">
\catcode45=12 % <->
\catcode46=12 % <.>
\catcode47=12 % </>
\catcode58=12 % <:>
\catcode59=12 % <;>
\catcode63=12 % <?>
\catcode96=12 % <`>
\AtEndOfPackage{%
\bxtb@j@restore@codes
\undef\bxtb@j@restore@codes}
%--------------------------------------- pTeX something
%% switch 'bxtb@pxbase@ok'
\newbool{bxtb@pxbase@ok}
\ifbxinpTeX
\IfFileExists{pxbase.sty}{%
\bxtb@pxbase@oktrue
}{}
\fi
%%<+> \bxToYokoDir
% Switches to horizontal(yoko) writing direction
% when using pTeX.
\ifbxinpTeX %----<*pTeX>
\newcommand*\bxToYokoDir{%
\bxIfydir{}{\yoko}}
\else %----<*!pTeX>
\newcommand*\bxToYokoDir{}
\fi %----</pTeX>
%%<+> \bxAtBeginDviX
% \AtBeginDvi that is safe to use in pTeX.
\newcommand\bxAtBeginDviX[1]{%
\global\setbox\@begindvibox\vbox{%
\bxToYokoDir\unvbox\@begindvibox#1}}
%--------------------------------------- Japanese something
%%<+> \bxGetZenkakuWidth
% Assigns 1zw to \bxResDim
\ifbxinpTeX
\bxNewrobustcmd*\bxGetZenkakuWidth{%
\bxResDim=1zw\relax}
\else\ifbxHasAlUcsChar
\bxToUcsChar{"4E00}\let\bx@jan@onekanji\bxRes
\bxNewrobustcmd*\bxGetZenkakuWidth{%
\begingroup \setbox\z@\hbox{\bx@jan@onekanji}%
\xdef\bx@jan@g@next{\bxResDim=\the\wd\z@\relax}%
\endgroup \bx@jan@g@next}
\AtBeginDocument{%
\ifdef\jsZw{%
\bxRenewrobustcmd*\bxGetZenkakuWidth{%
\bxResDim=1\jsZw}}{}%
\ifdef\zw{%
\bxRenewrobustcmd*\bxGetZenkakuWidth{%
\bxResDim=1\zw}}{}%
}
\fi\fi
%%<+> \bxIfCharToken{<token>}{<yes>}{<no>}
% Tests if the token is a character token with catcode 11 or 12.
\newcommand*\bxIfCharToken[1]{%
\bxIfcat{\relax\noexpand#1}{\@secondoftwo}%
{\expandafter\bxtb@ifchartok@a\meaning#1\bxtb@end}}
\def\bxtb@ifchartok@a#1{%
\bxIfcsundefX{bxtb@ICTF/#1}{\bxtb@ifchartok@false}%
{\bxtb@ifchartok@b#1}}
\def\bxtb@ifchartok@b#1#2#3#4#5#6{%
\bxIfcsundefX{bxtb@ICT/#1#2#3#4#5#6}{\bxtb@ifchartok@false}%
{\bxtb@ifchartok@true}}
\def\bxtb@ifchartok@true#1\bxtb@end#2#3{#2}
\def\bxtb@ifchartok@false#1\bxtb@end#2#3{#3}
\def\do#1#2:{\cslet{bxtb@ICTF/#1}{t}\cslet{bxtb@ICT/#1#2}{t}}
\do thelet:% 11
\do thecha:% 12
\do kanjic:% 16-19(upTeX)
%--------------------------------------- kanji-encoding something
%%<+> \bxInternalJaEncoding
\let\bxInternalJaEncoding=?
\ifbxHasAlUcsChar
\let\bxInternalJaEncoding=u
\else\ifbxinpdfTeX
\let\bxInternalJaEncoding=b
\else\ifbxinpTeX
\ifnum\jis"2121="8140 \let\bxInternalJaEncoding=s\else
\ifnum\jis"2121="A1A1 \let\bxInternalJaEncoding=e\else
\ifnum\jis"2121="3000 \let\bxInternalJaEncoding=u\fi\fi\fi
\fi\fi\fi
%%<+> \bxInputJaEncoding
\let\bxInputJaEncoding=?
\ifbxHasAlUcsChar
\let\bxInputJaEncoding=u
\else\ifbxinpdfTeX
\let\bxInputJaEncoding=b
\else\ifbxtb@pxbase@ok
\@@input pxbsjc.def\relax
\def\bxtb@tmpb#1#2\@nil{%
\ifnum `#1=\jis"723F \let\bxInputJaEncoding=s\else
\ifnum `#1=\jis"693D \let\bxInputJaEncoding=e\else
\ifnum `#1=\jis"7379 \let\bxInputJaEncoding=u\fi\fi\fi}
\expandafter\bxtb@tmpb\bxtb@tmpa\@nil
\ifx e\bxInputJaEncoding
\@@input pxbsjc1.def\relax
\def\bxtb@tmpb#1#2\@nil{%
\ifnum `#1=\jis"723F \let\bxInputJaEncoding=a\fi}
\expandafter\bxtb@tmpb\bxtb@tmpa\@nil
\fi
\fi\fi\fi
%%<+> \bxOutputJaEncoding
\let\bxOutputJaEncoding=?
% if input is 'auto', output should not be equal to it,
% but I don't know what to do then.
\let\bxOutputJaEncoding=\bxInputJaEncoding
%% \bxtb@jaencname
\def\bxtb@jaencname#1#2{%
\ifx u#1#2\else
\ifx s#1sjis\else
\ifx e#1euc\else
\ifx a#1auto\else
\ifx b#1byte\else
(unknown)\fi\fi\fi\fi\fi}
%%<*> \internaljaencodingname
\newcommand*\internaljaencodingname{}
\edef\internaljaencodingname{%
\bxtb@jaencname\bxInternalJaEncoding{unicode}}
%%<*> \inputjaencodingname
\newcommand*\inputjaencodingname{}
\edef\inputjaencodingname{%
\bxtb@jaencname\bxInputJaEncoding{utf8}}
%%<*> \outputjaencodingname
\newcommand*\outputjaencodingname{}
\edef\outputjaencodingname{%
\bxtb@jaencname\bxOutputJaEncoding{utf8}}
%%<*> \infojenc
\newcommand*\infojenc{%
\typeout{%
Kanji encoding:
input=\inputjaencodingname;
output=\outputjaencodingname;
internal=\internaljaencodingname}%
}
%--------------------------------------- all done
\endinput
%% EOF
|