b5b61fbd22fa660282242d29144b679b3f5e8f54
[chise/omega.git] / chise.sty
1 \NeedsTeXFormat{LaTeX2e}
2 \ProvidesPackage{chise}[2003/10/18 v.0.2 (Omega/CHISE Team)]
3 % based on mulambda and omega-japanese
4 \RequirePackage{omega}
5 \RequirePackage[UT1]{fontenc}
6
7 \DeclareOption{utf8mcs}{
8   \externalocp\OCPuniGB=Utf8mcsToUniGB {}
9   \ocplist\uniGB=
10     \addbeforeocplist 1 \OCPuniGB
11     \nullocplist
12   \externalocp\OCPuniCNS=Utf8mcsToUniCNS {}
13   \ocplist\uniCNS=
14     \addbeforeocplist 1 \OCPuniCNS
15     \nullocplist
16   \externalocp\OCPuniJIS=Utf8mcsToUniJIS {}
17   \ocplist\uniJIS=
18     \addbeforeocplist 1 \OCPuniJIS
19     \nullocplist
20   \externalocp\OCPuniKS=Utf8mcsToUniKS {}
21   \ocplist\uniKS=
22     \addbeforeocplist 1 \OCPuniKS
23     \nullocplist
24   \externalocp\OCPuniMulti=Utf8mcsToUniMulti {}
25   \ocplist\uniMulti=
26     \addbeforeocplist 1 \OCPuniMulti
27     \nullocplist
28 }
29 \DeclareOption{utf8gb}{
30   \externalocp\OCPuniGB=Utf8gbToUniGB {}
31   \ocplist\uniGB=
32     \addbeforeocplist 1 \OCPuniGB
33     \nullocplist
34   \externalocp\OCPuniCNS=Utf8gbToUniCNS {}
35   \ocplist\uniCNS=
36     \addbeforeocplist 1 \OCPuniCNS
37     \nullocplist
38   \externalocp\OCPuniJIS=Utf8gbToUniJIS {}
39   \ocplist\uniJIS=
40     \addbeforeocplist 1 \OCPuniJIS
41     \nullocplist
42   \externalocp\OCPuniKS=Utf8gbToUniKS {}
43   \ocplist\uniKS=
44     \addbeforeocplist 1 \OCPuniKS
45     \nullocplist
46   \externalocp\OCPuniMulti=Utf8mcsToUniMulti {}
47   \ocplist\uniMulti=
48     \addbeforeocplist 1 \OCPuniMulti
49     \nullocplist
50 }
51 \DeclareOption{utf8cns}{
52   \externalocp\OCPuniGB=Utf8cnsToUniGB {}
53   \ocplist\uniGB=
54     \addbeforeocplist 1 \OCPuniGB
55     \nullocplist
56   \externalocp\OCPuniCNS=Utf8cnsToUniCNS {}
57   \ocplist\uniCNS=
58     \addbeforeocplist 1 \OCPuniCNS
59     \nullocplist
60   \externalocp\OCPuniJIS=Utf8cnsToUniJIS {}
61   \ocplist\uniJIS=
62     \addbeforeocplist 1 \OCPuniJIS
63     \nullocplist
64   \externalocp\OCPuniKS=Utf8cnsToUniKS {}
65   \ocplist\uniKS=
66     \addbeforeocplist 1 \OCPuniKS
67     \nullocplist
68   \externalocp\OCPuniMulti=Utf8mcsToUniMulti {}
69   \ocplist\uniMulti=
70     \addbeforeocplist 1 \OCPuniMulti
71     \nullocplist
72 }
73 \DeclareOption{utf8jis}{
74   \externalocp\OCPuniGB=Utf8jisToUniGB {}
75   \ocplist\uniGB=
76     \addbeforeocplist 1 \OCPuniGB
77     \nullocplist
78   \externalocp\OCPuniCNS=Utf8jisToUniCNS {}
79   \ocplist\uniCNS=
80     \addbeforeocplist 1 \OCPuniCNS
81     \nullocplist
82   \externalocp\OCPuniJIS=Utf8jisToUniJIS {}
83   \ocplist\uniJIS=
84     \addbeforeocplist 1 \OCPuniJIS
85     \nullocplist
86   \externalocp\OCPuniKS=Utf8jisToUniKS {}
87   \ocplist\uniKS=
88     \addbeforeocplist 1 \OCPuniKS
89     \nullocplist
90   \externalocp\OCPuniMulti=Utf8mcsToUniMulti {}
91   \ocplist\uniMulti=
92     \addbeforeocplist 1 \OCPuniMulti
93     \nullocplist
94 }
95 \DeclareOption{utf8ks}{
96   \externalocp\OCPuniGB=Utf8ksToUniGB {}
97   \ocplist\uniGB=
98     \addbeforeocplist 1 \OCPuniGB
99     \nullocplist
100   \externalocp\OCPuniCNS=Utf8ksToUniCNS {}
101   \ocplist\uniCNS=
102     \addbeforeocplist 1 \OCPuniCNS
103     \nullocplist
104   \externalocp\OCPuniJIS=Utf8ksToUniJIS {}
105   \ocplist\uniJIS=
106     \addbeforeocplist 1 \OCPuniJIS
107     \nullocplist
108   \externalocp\OCPuniKS=Utf8ksToUniKS {}
109   \ocplist\uniKS=
110     \addbeforeocplist 1 \OCPuniKS
111     \nullocplist
112   \externalocp\OCPuniMulti=Utf8mcsToUniMulti {}
113   \ocplist\uniMulti=
114     \addbeforeocplist 1 \OCPuniMulti
115     \nullocplist
116 }
117
118 \DeclareOption{gbfont}{
119   \AtBeginDocument{
120     \GBfont
121   }
122 }
123 \DeclareOption{cnsfont}{
124   \AtBeginDocument{
125     \CNSfont
126   }
127 }
128 \DeclareOption{jisfont}{
129   \AtBeginDocument{
130     \JISfont
131   }
132 }
133 \DeclareOption{ksfont}{
134   \AtBeginDocument{
135     \KSfont
136   }
137 }
138 \DeclareOption{multifont}{
139   \AtBeginDocument{
140     \Multifont
141   }
142 }
143
144 \ocp\CJKbreak=cjkbreak
145 %% \ocplist\CJKadjust=
146 %%    \addbeforeocplist 1 \CJKbreak
147 %%    \nullocplist
148 \def\cjkglue{\hskip 0pt plus 1pt minus .5pt}
149
150 \ocp\OCPutf=inutf8
151 \ocplist\inutf
152   \addbeforeocplist 1 \OCPutf
153   \nullocplist
154 \AtBeginDocument{
155 %  \DefaultInputMode onebyte
156 %  \InputMode currentfile onebyte
157 %  \DefaultInputTranslation onebyte \OCPutf
158 %  \InputTranslation currentfile \OCPutf
159   \pushocplist\inutf
160 }
161
162 %%%%% to use KAGE server %%%%%
163 \externalocp\OCPmkfont=makefonts.pl {}
164 \ocplist\mkfontOCP=
165 \addbeforeocplist 1 \OCPmkfont
166 \nullocplist
167
168 \AtEndDocument{
169   \pushocplist\mkfontOCP
170 }
171
172 % Settings for CJK
173 \def\selectjisfont{\fontencoding{OT1}\fontfamily{omjis}\selectfont}
174 \def\selectgbsfont{\fontencoding{OT1}\fontfamily{omgbs}\selectfont}
175 \def\selectcnsfont{\fontencoding{OT1}\fontfamily{omcns}\selectfont}
176 \def\selectksxfont{\fontencoding{OT1}\fontfamily{omksx}\selectfont}
177 %\def\JIS{\pushocplist\CJKadjust\selectjisfont}
178 %\def\GB{\pushocplist\CJKadjust\selectgbsfont}
179 %\def\KS{\pushocplist\CJKadjust\selectksxfont}
180 %\def\CNS{\pushocplist\CJKadjust\selectcnsfont}
181
182 \newenvironment{JISfont}{\pushocplist\uniJIS\selectjisfont}{}
183 \newenvironment{GBfont}{\pushocplist\uniGB\selectgbsfont}{}
184 \newenvironment{KSfont}{\pushocplist\uniKS\selectksxfont}{}
185 \newenvironment{CNSfont}{\pushocplist\uniCNS\selectcnsfont}{}
186 \newenvironment{Multifont}{\pushocplist\uniMulti}{}
187 \newenvironment{ASCII}{\pushocplist\NilOCP\fontencoding{T1}\fontfamily{\rmdefault}\selectfont}{}
188
189 \newcommand{\jisfont}[1]{\begingroup%
190   \pushocplist\uniJIS\selectjisfont #1\endgroup}
191 \newcommand{\gbfont}[1]{\begingroup%
192   \pushocplist\uniGB\selectgbsfont #1\endgroup}
193 \newcommand{\ksfont}[1]{\begingroup%
194   \pushocplist\uniKS\selectksxfont #1\endgroup}
195 \newcommand{\cnsfont}[1]{\begingroup%
196   \pushocplist\uniCNS\selectcnsfont #1\endgroup}
197 \newcommand{\multifont}[1]{\begingroup%
198   \pushocplist\uniMulti #1\endgroup}
199 \newcommand{\noncjk}[1]{\begingroup%
200   \normalfont\pushocplist\inutf #1\endgroup}
201 \newcommand{\ascii}[1]{\begingroup%
202   \pushocplist\NilOCP\fontencoding{T1}\fontfamily{\rmdefault}\selectfont #1\endgroup}
203
204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
205 % IDC shorthand
206 % -------------
207 \def\idc@#1{{\selectgbsfont\clearocplists\char"#1}}
208 \def\idcltr{\idc@{2FF0}}
209 \def\idcatb{\idc@{2FF1}}
210 \def\idcltmr{\idc@{2FF2}}
211 \def\idcatmb{\idc@{2FF3}}
212 \def\idcfs{\idc@{2FF4}}
213 \def\idcsfa{\idc@{2FF5}}
214 \def\idcsfb{\idc@{2FF6}}
215 \def\idcsfl{\idc@{2FF7}}
216 \def\idcsful{\idc@{2FF8}}
217 \def\idcsfur{\idc@{2FF9}}
218 \def\idcsfll{\idc@{2FFA}}
219 \def\idcol{\idc@{2FFB}}
220 %
221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222 % Font Declaration
223 % ----------------
224 %% omgbs
225 \DeclareFontFamily{OT1}{omgbs}{}
226 \DeclareFontShape{OT1}{omgbs}{m}{n}{
227    <->omgbs
228 }{}
229 \DeclareFontShape{OT1}{omgbs}{m}{sc}{
230    <-> ssub * omgbs/m/n
231 }{}
232 \DeclareFontShape{OT1}{omgbs}{m}{it}{
233    <->omgb
234 }{}
235 \DeclareFontShape{OT1}{omgbs}{m}{sl}{
236    <-> ssub * omgbs/m/it
237 }{}
238 \DeclareFontShape{OT1}{omgbs}{m}{itsc}{
239    <-> ssub * omgbs/m/it
240 }{}
241 \DeclareFontShape{OT1}{omgbs}{m}{slsc}{
242    <-> ssub * omgbs/m/it
243 }{}
244 \DeclareFontShape{OT1}{omgbs}{bx}{n}{
245    <->omgbsgt
246 }{}
247 \DeclareFontShape{OT1}{omgbs}{bx}{sc}{
248    <-> ssub * omgbs/bx/n
249 }{}
250 \DeclareFontShape{OT1}{omgbs}{bx}{it}{
251    <->omgbsgt
252 }{}
253 \DeclareFontShape{OT1}{omgbs}{bx}{itsc}{
254    <-> ssub * omgbs/bx/it
255 }{}
256 \DeclareFontShape{OT1}{omgbs}{bx}{sl}{
257    <-> ssub * omgbs/bx/it
258 }{}
259 \DeclareFontShape{OT1}{omgbs}{bx}{slsc}{
260    <-> ssub * omgbs/bx/it
261 }{}
262
263 %% omcns
264 \DeclareFontFamily{OT1}{omcns}{}
265 \DeclareFontShape{OT1}{omcns}{m}{n}{
266    <->omcns
267 }{}
268 \DeclareFontShape{OT1}{omcns}{m}{sc}{
269    <-> ssub * omcns/m/n
270 }{}
271 \DeclareFontShape{OT1}{omcns}{m}{it}{
272    <->omcns
273 }{}
274 \DeclareFontShape{OT1}{omcns}{m}{sl}{
275    <-> ssub * omcns/m/it
276 }{}
277 \DeclareFontShape{OT1}{omcns}{m}{itsc}{
278    <-> ssub * omcns/m/it
279 }{}
280 \DeclareFontShape{OT1}{omcns}{m}{slsc}{
281    <-> ssub * omcns/m/it
282 }{}
283 \DeclareFontShape{OT1}{omcns}{bx}{n}{
284    <->omcnsgt
285 }{}
286 \DeclareFontShape{OT1}{omcns}{bx}{sc}{
287    <-> ssub * omcns/bx/n
288 }{}
289 \DeclareFontShape{OT1}{omcns}{bx}{it}{
290    <->omcnsgt
291 }{}
292 \DeclareFontShape{OT1}{omcns}{bx}{itsc}{
293    <-> ssub * omcns/bx/it
294 }{}
295 \DeclareFontShape{OT1}{omcns}{bx}{sl}{
296    <-> ssub * omcns/bx/it
297 }{}
298 \DeclareFontShape{OT1}{omcns}{bx}{slsc}{
299    <-> ssub * omcns/bx/it
300 }{}
301
302 %%
303 \DeclareFontFamily{OT1}{omjis}{}
304 \DeclareFontShape{OT1}{omjis}{m}{n}{
305    <->omjis
306 }{}
307 \DeclareFontShape{OT1}{omjis}{m}{sc}{
308    <-> ssub * omjis/m/n
309 }{}
310 \DeclareFontShape{OT1}{omjis}{m}{it}{
311    <->omjis
312 }{}
313 \DeclareFontShape{OT1}{omjis}{m}{sl}{
314    <-> ssub * omjis/m/it
315 }{}
316 \DeclareFontShape{OT1}{omjis}{m}{itsc}{
317    <-> ssub * omjis/m/it
318 }{}
319 \DeclareFontShape{OT1}{omjis}{m}{slsc}{
320    <-> ssub * omjis/m/it
321 }{}
322 \DeclareFontShape{OT1}{omjis}{bx}{n}{
323    <->omjisgt
324 }{}
325 \DeclareFontShape{OT1}{omjis}{bx}{sc}{
326    <-> ssub * omjis/bx/n
327 }{}
328 \DeclareFontShape{OT1}{omjis}{bx}{it}{
329    <->omjisgt
330 }{}
331 \DeclareFontShape{OT1}{omjis}{bx}{itsc}{
332    <-> ssub * omjis/bx/it
333 }{}
334 \DeclareFontShape{OT1}{omjis}{bx}{sl}{
335    <-> ssub * omjis/bx/it
336 }{}
337 \DeclareFontShape{OT1}{omjis}{bx}{slsc}{
338    <-> ssub * omjis/bx/it
339 }{}
340
341 %% omksx
342 \DeclareFontFamily{OT1}{omksx}{}
343 \DeclareFontShape{OT1}{omksx}{m}{n}{
344    <->omksx
345 }{}
346 \DeclareFontShape{OT1}{omksx}{m}{sc}{
347    <-> ssub * omksx/m/n
348 }{}
349 \DeclareFontShape{OT1}{omksx}{m}{it}{
350    <->omksx
351 }{}
352 \DeclareFontShape{OT1}{omksx}{m}{sl}{
353    <-> ssub * omksx/m/it
354 }{}
355 \DeclareFontShape{OT1}{omksx}{m}{itsc}{
356    <-> ssub * omksx/m/it
357 }{}
358 \DeclareFontShape{OT1}{omksx}{m}{slsc}{
359    <-> ssub * omksx/m/it
360 }{}
361 \DeclareFontShape{OT1}{omksx}{bx}{n}{
362    <->omksxgt
363 }{}
364 \DeclareFontShape{OT1}{omksx}{bx}{sc}{
365    <-> ssub * omksx/bx/n
366 }{}
367 \DeclareFontShape{OT1}{omksx}{bx}{it}{
368    <->omksxgt
369 }{}
370 \DeclareFontShape{OT1}{omksx}{bx}{itsc}{
371    <-> ssub * omksx/bx/it
372 }{}
373 \DeclareFontShape{OT1}{omksx}{bx}{sl}{
374    <-> ssub * omksx/bx/it
375 }{}
376 \DeclareFontShape{OT1}{omksx}{bx}{slsc}{
377    <-> ssub * omksx/bx/it
378 }{}
379
380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
381 \DeclareFontFamily{OT1}{chise000}{}
382 \DeclareFontShape{OT1}{chise000}{m}{n}{
383    <-> [.96] chise000min
384 }{}
385 \DeclareFontShape{OT1}{chise000}{m}{sc}{
386    <-> [.96] ssub * chise000min/m/n
387 }{}
388 \DeclareFontShape{OT1}{chise000}{m}{it}{
389    <-> [.96] chise000min
390 }{}
391 \DeclareFontShape{OT1}{chise000}{m}{sl}{
392    <-> [.96] ssub * chise000min/m/it
393 }{}
394 \DeclareFontShape{OT1}{chise000}{m}{itsc}{
395    <-> [.96] ssub * chise000min/m/it
396 }{}
397 \DeclareFontShape{OT1}{chise000}{m}{slsc}{
398    <-> [.96] ssub * chise000min/m/it
399 }{}
400 \DeclareFontShape{OT1}{chise000}{bx}{n}{
401    <-> [.96] chise000got
402 }{}
403 \DeclareFontShape{OT1}{chise000}{bx}{sc}{
404    <-> [.96] ssub * chise000got/bx/n
405 }{}
406 \DeclareFontShape{OT1}{chise000}{bx}{it}{
407    <-> [.96] chise000got
408 }{}
409 \DeclareFontShape{OT1}{chise000}{bx}{itsc}{
410    <-> [.96] ssub * chise000got/bx/it
411 }{}
412 \DeclareFontShape{OT1}{chise000}{bx}{sl}{
413    <-> [.96] ssub * chise000got/bx/it
414 }{}
415 \DeclareFontShape{OT1}{chise000}{bx}{slsc}{
416    <-> [.96] ssub * chise000got/bx/it
417 }{}
418 %%% GT
419 \DeclareFontFamily{OT1}{gt01}{}
420 \DeclareFontShape{OT1}{gt01}{m}{n}{
421    <-> gt01
422 }{}
423 \DeclareFontFamily{OT1}{gt02}{}
424 \DeclareFontShape{OT1}{gt02}{m}{n}{
425    <-> gt02
426 }{}
427 \DeclareFontFamily{OT1}{gt03}{}
428 \DeclareFontShape{OT1}{gt03}{m}{n}{
429    <-> gt03
430 }{}
431 \DeclareFontFamily{OT1}{gt04}{}
432 \DeclareFontShape{OT1}{gt04}{m}{n}{
433    <-> gt04
434 }{}
435 \DeclareFontFamily{OT1}{gt05}{}
436 \DeclareFontShape{OT1}{gt05}{m}{n}{
437    <-> gt05
438 }{}
439 \DeclareFontFamily{OT1}{gt06}{}
440 \DeclareFontShape{OT1}{gt06}{m}{n}{
441    <-> gt06
442 }{}
443 \DeclareFontFamily{OT1}{gt07}{}
444 \DeclareFontShape{OT1}{gt07}{m}{n}{
445    <-> gt07
446 }{}
447 \DeclareFontFamily{OT1}{gt08}{}
448 \DeclareFontShape{OT1}{gt08}{m}{n}{
449    <-> gt08
450 }{}
451 \DeclareFontFamily{OT1}{gt09}{}
452 \DeclareFontShape{OT1}{gt09}{m}{n}{
453    <-> gt09
454 }{}
455 \DeclareFontFamily{OT1}{gt10}{}
456 \DeclareFontShape{OT1}{gt10}{m}{n}{
457    <-> gt10
458 }{}
459 \DeclareFontFamily{OT1}{gt11}{}
460 \DeclareFontShape{OT1}{gt11}{m}{n}{
461    <-> gt11
462 }{}
463
464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
465 % line break, from omega-japanese.
466
467 \def\CJKunbreakablekernone{%
468   \nobreak
469   \hskip 0sp plus 2sp minus 2sp
470   \nobreak
471 }
472 \def\CJKunbreakablekerntwo{%
473   \penalty 500
474   \hskip 0sp plus 2sp minus 2sp
475   \penalty 500
476 }
477 \def\CJKunbreakablekernthree{%
478   \penalty 200
479   \hskip 0sp plus 2sp minus 2sp
480   \penalty 200
481 }
482 \def\CJKbreakablekern{\hskip 0sp plus 2pt minus 2sp}
483 % BUG: \rlap should preserve the current font
484 \def\CJKprotrude#1{%
485   \discretionary{\rlap{#1}}%
486                 {}%
487                 {#1}%
488 }
489 %% Hyphenation parameters
490   % If the badness does not exceed this, no hyphenation is
491   % attempted
492   \pretolerance=-1
493
494   % Maximal badness
495   \tolerance=200
496
497   % Penalty added for the first hyphenation
498   % in the current paragraph
499   \hyphenpenalty=0 % Was 50
500
501   % Penalty added for subsequent hyphenations
502   \exhyphenpenalty=0 % Was 50
503
504   % TeX tries to minimize the demerit of the lines:
505   % (\linepenalty^2 + badness^2) + penalty^2
506   \linepenalty=10
507
508   % If a tight line is followed by a loose one
509   % (or conversely), we add \adjdemerits 
510   % to the demerit
511   \adjdemerits=0 % Was 10000 % ???
512
513   % two hyphens on consecutive lines also add 
514   % to the demerit
515   \doublehyphendemerits=0 % Was 10000
516
517   % A hyphen on the last line also adds to
518   % the demerit.
519   \finalhyphendemerits=0 % Was 5000
520
521   % Minimum number of characters in the current word
522   % before or after a hyphenation point
523   \lefthyphenmin=2
524   \righthyphenmin=3
525
526 % line break definition ends.
527
528 \ProcessOptions
529 \endinput