summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/platex/pxbase/pxbase.sty
blob: e27f2579c7a79050456e8b01e9778d6924eafbf5 (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
%
% pxbase.sty
%

%%%% package declaration
\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{pxbase}[2017/05/04 v0.5i PX base library]

%%%% include prerequisite packages
\input{pxbase.def}
\bxBDHookBabel
\bxBDHookUnicode
\bxBDHookJisInput
\bxBDHookSafeCaret
\RequirePackage{ifuptex}[2008/03/14]

%%%% error messages
\def\px@pkgname{pxbase}
\def\px@b@pkgname{PXbase}
\def\px@error{\PackageError\px@pkgname}
\def\px@alert{\PackageWarningNoLine\px@pkgname}
\def\px@warn{\PackageInfo\px@pkgname}
\def\px@warn@aecs#1{\px@warn{Command \string#1 already exists}}

%%------ Input through code values

%%<*> \Ux, \UI, \AJ
\ifx\Ux\@undefined \def\Ux{\bxUx}%
\else \px@warn@aecs\Ux \fi
\ifx\UI\@undefined \def\UI{\bxUI}%
\else \px@warn@aecs\UI \fi
\ifx\AJ\@undefined \def\AJ{\bxAJ}%
\else \px@warn@aecs\AJ \fi

%%<*> \JI, \KI
\ifx\JI\@undefined \def\JI{\bxJI}%
\else \px@warn@aecs\JI \fi
\ifx\KI\@undefined \def\KI{\bxKI}%
\else \px@warn@aecs\KI \fi

%%------ kanji-code detection

%%<+> \pxInternalJEnc
\ifnum\jis"2121="8140\let\pxInternalJEnc=s\else
\ifnum\jis"2121="A1A1\let\pxInternalJEnc=e\else
\ifnum\jis"2121="3000\let\pxInternalJEnc=u\else
  \let\pxInternalJEnc=?\fi\fi\fi

%%<+> \pxSourceJEnc
\@@input pxbsjc.def\relax
\def\px@tmpb#1#2\@nil{%
  \ifnum `#1=\jis"723F\let\pxSourceJEnc=s\else
  \ifnum `#1=\jis"693D\let\pxSourceJEnc=e\else
  \ifnum `#1=\jis"7379\let\pxSourceJEnc=u\else
   \let\pxSourceJEnc=?\fi\fi\fi}
\expandafter\px@tmpb\px@tmpa\@nil

%%<*> \infojenc
\def\px@tmpa{%
  Kanji encoding: source=%
  \if s\pxSourceJEnc sjis\else\if e\pxSourceJEnc euc%
  \else\if u\pxSourceJEnc utf8\else?\fi\fi\fi
  ; internal=%
  \if s\pxInternalJEnc sjis\else\if e\pxInternalJEnc euc%
  \else\if u\pxInternalJEnc unicode\else?\fi\fi\fi}
\edef\infojenc{\noexpand\typeout{\px@tmpa}}

%%------ force ucs 'fasterrors' option to be in effect

%%%% begindocument hook
\AtBeginDocument{%
  \@ifpackageloaded{ucs}{%
    \let\UnicodeOptionfasterrorsfalse\UnicodeOptionfasterrorstrue
    \UnicodeOptionfasterrorstrue}{}}

%%------ commands about DVI-specials

%%<*> \usejapanesepdfstring
\if s\pxInternalJEnc
  \def\usejapanesepdfstring{%  why use CP932??
    \bxDocumentSpecialUrgent{pdf:tounicode 90ms-RKSJ-UCS2}%
    \bxNullify\usejapanesepdfstring}
\else\if e\pxInternalJEnc
  \def\usejapanesepdfstring{%
    \bxDocumentSpecialUrgent{pdf:tounicode EUC-UCS2}%
    \bxNullify\usejapanesepdfstring}
\else\if u\pxInternalJEnc
  \def\usejapanesepdfstring{%
    \px@alert{Japanese PDF strings in upTeX.\MessageBreak
      You must use upTeX-aware dvipdfmx}%
    \bxNullify\usejapanesepdfstring}
\else
  \def\usejapanesepdfstring{%
    \px@alert{\string\usejapanesepdfstring\space ignored,\MessageBreak
      since internal encoding is unknown}%
    \bxNullify\usejapanesepdfstring}
\fi\fi\fi
\@onlypreamble\usejapanesepdfstring

%%------ CJK font scaling

%%<+> \pxDocClassType
% 1 = pLaTeX standard class
% 2 = New standard classes by Okumura
% 0 = otherwise
\bxUcv=\z@
\@ifclassloaded{jarticle}{\bxUcv=\@ne}{}
\@ifclassloaded{jreport}{\bxUcv=\@ne}{}
\@ifclassloaded{jbook}{\bxUcv=\@ne}{}
\@ifclassloaded{tarticle}{\bxUcv=\@ne}{}
\@ifclassloaded{treport}{\bxUcv=\@ne}{}
\@ifclassloaded{tbook}{\bxUcv=\@ne}{}
\@ifclassloaded{ujarticle}{\bxUcv=\@ne}{}
\@ifclassloaded{ujreport}{\bxUcv=\@ne}{}
\@ifclassloaded{ujbook}{\bxUcv=\@ne}{}
\@ifclassloaded{utarticle}{\bxUcv=\@ne}{}
\@ifclassloaded{utreport}{\bxUcv=\@ne}{}
\@ifclassloaded{utbook}{\bxUcv=\@ne}{}
\@ifclassloaded{jsarticle}{\bxUcv=\tw@}{}
\@ifclassloaded{jsbook}{\bxUcv=\tw@}{}
\chardef\pxDocClassType=\bxUcv

%%<+> \pxUpScale
\edef\pxUpScale{%
  \ifcase\pxDocClassType 1\or 0.962216\or 0.924690\else 1\fi}

%%------ all done
\endinput
% EOF