summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/codepage/codepage.sty
blob: 43466681a9ae2ac674dfe5308e4eba462491e736 (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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
%% 
%% This is file `codepage.sty', generated 
%% on <1995/1/2> with the docstrip utility (2.0r).
%% 
%% The original source files were:
%% 
%% codepage.dtx  (with options: `codepage')
%% This package provides some commands to handle different code pages in the same 
%% document. It works with TeX and LaTeX, but his documentation should be produced 
%% with the docstrip package. 
%% 
%% Disclaimer: 
%% This package is provided 'as is' without any warranty. 
%% 
%% Author: 
%% Alain Aubord 
%% Geneva 
%% Switzerland 
%% 
%% E-mail: aubord@uni2a.unige.ch 
\def\fileversion{1.2}%
\def\filedate{2 January 1995}%
\def\docdate{2 January 1995}%
\def\CheckSum{4615}%
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
\newif\if@FirstCodePageCall
\@FirstCodePageCalltrue
\newif\ifTeX
\newif\ifTR        % True if we do the translation of character
\TRtrue
\expandafter\ifx\csname @currsize\endcsname\relax\TeXtrue\else\TeXfalse\fi
\ifTeX
   \message{codepage.sty used in TeX context}%
\else
   \typeout{codepage.sty used in LaTeX context}%
\fi
\def\@BadHyphenCarMsg#1{%
\ifTeX
    \message{Warning: the character \string #1 is not a character
             to form a word}%
    \message{Hyphenation can't be done with it}%
\else
    \typeout{Warning: the character \string #1 is not a character
             to form a word}%
    \typeout{Hyphenation can't be done with it}%
\fi
}%@BadHyphenCarMsg
\def\@ConflictHyphenCarMsg#1#2{%
\ifTeX
    \message{Warning the character #1 could be in conflict}%
    \message{with character #2 for hyphenation algorithm !}%
\else
    \typeout{Warning the character #1 could be in conflict}%
    \typeout{with character #2 for hyphenation algorithm !}%
\fi
}%\@ConflictHyphenCarMsg
\chardef\CM=0%                The target font is CM encoding
\chardef\DC=1%                The target font is DC encoding
\chardef\FourThreeSeven=0%    Code page 437
\chardef\EightFiveZero=1%     Code page 850
\chardef\IsoOne=2%            Iso latin set 1
\chardef\Mac=3%               Apple Mac Intosh characters
\def\codepage#1#2{%
\chardef\CurrentEncoding=#2%
\if@FirstCodePageCall
  \let\Grave=\`%
  \let\Circumflex=\^%
  \let\Tilda=\~%
  \let\OverBar=\=%
  \let\UnderBar=\b%
  \let\Join=\t%
  \let\HungarUmlaut=\H%
  \let\Acute=\'%
  \let\Diaresis=\"%
  \let\Breve=\u%
  \let\OverDot=\.%
  \let\UnderDot=\d%
  \let\Tcheche=\v%
  \let\Cedille=\c%
  \@FirstCodePageCallfalse
\fi
\AllActive
\ifcase#1%
   \input code437 %
\or
   \input code850 %
\or
   \input codeiso1 %
\or
   \input codemac %
\fi
\let\@Grave=\`%
\let\@Aigu=\'%
\let\@OverBar=\=%
\ignorespaces
}%\codepage
\def\AllActive{%
\catcode`\^^80=\active \catcode`\^^81=\active \catcode`\^^82=\active
\catcode`\^^83=\active \catcode`\^^84=\active \catcode`\^^85=\active
\catcode`\^^86=\active \catcode`\^^87=\active \catcode`\^^88=\active
\catcode`\^^89=\active \catcode`\^^8a=\active \catcode`\^^8b=\active
\catcode`\^^8c=\active \catcode`\^^8d=\active \catcode`\^^8e=\active
\catcode`\^^8f=\active \catcode`\^^90=\active \catcode`\^^91=\active
\catcode`\^^92=\active \catcode`\^^93=\active \catcode`\^^94=\active
\catcode`\^^95=\active \catcode`\^^96=\active \catcode`\^^97=\active
\catcode`\^^98=\active \catcode`\^^99=\active \catcode`\^^9a=\active
\catcode`\^^9b=\active \catcode`\^^9c=\active \catcode`\^^9d=\active
\catcode`\^^9e=\active \catcode`\^^9f=\active \catcode`\^^a0=\active
\catcode`\^^a1=\active \catcode`\^^a2=\active \catcode`\^^a3=\active
\catcode`\^^a4=\active \catcode`\^^a5=\active \catcode`\^^a6=\active
\catcode`\^^a7=\active \catcode`\^^a8=\active \catcode`\^^a9=\active
\catcode`\^^aa=\active \catcode`\^^ab=\active \catcode`\^^ac=\active
\catcode`\^^ad=\active \catcode`\^^ae=\active \catcode`\^^af=\active
\catcode`\^^b0=\active \catcode`\^^b1=\active \catcode`\^^b2=\active
\catcode`\^^b3=\active \catcode`\^^b4=\active \catcode`\^^b5=\active
\catcode`\^^b6=\active \catcode`\^^b7=\active \catcode`\^^b8=\active
\catcode`\^^b9=\active \catcode`\^^ba=\active \catcode`\^^bb=\active
\catcode`\^^bc=\active \catcode`\^^bd=\active \catcode`\^^be=\active
\catcode`\^^bf=\active \catcode`\^^c0=\active \catcode`\^^c1=\active
\catcode`\^^c2=\active \catcode`\^^c3=\active \catcode`\^^c4=\active
\catcode`\^^c5=\active \catcode`\^^c6=\active \catcode`\^^c7=\active
\catcode`\^^c8=\active \catcode`\^^c9=\active \catcode`\^^ca=\active
\catcode`\^^cb=\active \catcode`\^^cc=\active \catcode`\^^cd=\active
\catcode`\^^ce=\active \catcode`\^^cf=\active \catcode`\^^d0=\active
\catcode`\^^d1=\active \catcode`\^^d2=\active \catcode`\^^d3=\active
\catcode`\^^d4=\active \catcode`\^^d5=\active \catcode`\^^d6=\active
\catcode`\^^d7=\active \catcode`\^^d8=\active \catcode`\^^d9=\active
\catcode`\^^da=\active \catcode`\^^db=\active \catcode`\^^dc=\active
\catcode`\^^dd=\active \catcode`\^^de=\active \catcode`\^^df=\active
\catcode`\^^e0=\active \catcode`\^^e1=\active \catcode`\^^e2=\active
\catcode`\^^e3=\active \catcode`\^^e4=\active \catcode`\^^e5=\active
\catcode`\^^e6=\active \catcode`\^^e7=\active \catcode`\^^e8=\active
\catcode`\^^e9=\active \catcode`\^^ea=\active \catcode`\^^eb=\active
\catcode`\^^ec=\active \catcode`\^^ed=\active \catcode`\^^ee=\active
\catcode`\^^ef=\active \catcode`\^^f0=\active \catcode`\^^f1=\active
\catcode`\^^f2=\active \catcode`\^^f3=\active \catcode`\^^f4=\active
\catcode`\^^f5=\active \catcode`\^^f6=\active \catcode`\^^f7=\active
\catcode`\^^f8=\active \catcode`\^^f9=\active \catcode`\^^fa=\active
\catcode`\^^fb=\active \catcode`\^^fc=\active \catcode`\^^fd=\active
\catcode`\^^fe=\active \catcode`\^^ff=\active
}% \AllActive
\def\AllOther{%
\chardef\other=12\relax
\catcode`\^^80=\other \catcode`\^^81=\other \catcode`\^^82=\other
\catcode`\^^83=\other \catcode`\^^84=\other \catcode`\^^85=\other
\catcode`\^^86=\other \catcode`\^^87=\other \catcode`\^^88=\other
\catcode`\^^89=\other \catcode`\^^8a=\other \catcode`\^^8b=\other
\catcode`\^^8c=\other \catcode`\^^8d=\other \catcode`\^^8e=\other
\catcode`\^^8f=\other \catcode`\^^90=\other \catcode`\^^91=\other
\catcode`\^^92=\other \catcode`\^^93=\other \catcode`\^^94=\other
\catcode`\^^95=\other \catcode`\^^96=\other \catcode`\^^97=\other
\catcode`\^^98=\other \catcode`\^^99=\other \catcode`\^^9a=\other
\catcode`\^^9b=\other \catcode`\^^9c=\other \catcode`\^^9d=\other
\catcode`\^^9e=\other \catcode`\^^9f=\other \catcode`\^^a0=\other
\catcode`\^^a1=\other \catcode`\^^a2=\other \catcode`\^^a3=\other
\catcode`\^^a4=\other \catcode`\^^a5=\other \catcode`\^^a6=\other
\catcode`\^^a7=\other \catcode`\^^a8=\other \catcode`\^^a9=\other
\catcode`\^^aa=\other \catcode`\^^ab=\other \catcode`\^^ac=\other
\catcode`\^^ad=\other \catcode`\^^ae=\other \catcode`\^^af=\other
\catcode`\^^b0=\other \catcode`\^^b1=\other \catcode`\^^b2=\other
\catcode`\^^b3=\other \catcode`\^^b4=\other \catcode`\^^b5=\other
\catcode`\^^b6=\other \catcode`\^^b7=\other \catcode`\^^b8=\other
\catcode`\^^b9=\other \catcode`\^^ba=\other \catcode`\^^bb=\other
\catcode`\^^bc=\other \catcode`\^^bd=\other \catcode`\^^be=\other
\catcode`\^^bf=\other \catcode`\^^c0=\other \catcode`\^^c1=\other
\catcode`\^^c2=\other \catcode`\^^c3=\other \catcode`\^^c4=\other
\catcode`\^^c5=\other \catcode`\^^c6=\other \catcode`\^^c7=\other
\catcode`\^^c8=\other \catcode`\^^c9=\other \catcode`\^^ca=\other
\catcode`\^^cb=\other \catcode`\^^cc=\other \catcode`\^^cd=\other
\catcode`\^^ce=\other \catcode`\^^cf=\other \catcode`\^^d0=\other
\catcode`\^^d1=\other \catcode`\^^d2=\other \catcode`\^^d3=\other
\catcode`\^^d4=\other \catcode`\^^d5=\other \catcode`\^^d6=\other
\catcode`\^^d7=\other \catcode`\^^d8=\other \catcode`\^^d9=\other
\catcode`\^^da=\other \catcode`\^^db=\other \catcode`\^^dc=\other
\catcode`\^^dd=\other \catcode`\^^de=\other \catcode`\^^df=\other
\catcode`\^^e0=\other \catcode`\^^e1=\other \catcode`\^^e2=\other
\catcode`\^^e3=\other \catcode`\^^e4=\other \catcode`\^^e5=\other
\catcode`\^^e6=\other \catcode`\^^e7=\other \catcode`\^^e8=\other
\catcode`\^^e9=\other \catcode`\^^ea=\other \catcode`\^^eb=\other
\catcode`\^^ec=\other \catcode`\^^ed=\other \catcode`\^^ee=\other
\catcode`\^^ef=\other \catcode`\^^f0=\other \catcode`\^^f1=\other
\catcode`\^^f2=\other \catcode`\^^f3=\other \catcode`\^^f4=\other
\catcode`\^^f5=\other \catcode`\^^f6=\other \catcode`\^^f7=\other
\catcode`\^^f8=\other \catcode`\^^f9=\other \catcode`\^^fa=\other
\catcode`\^^fb=\other \catcode`\^^fc=\other \catcode`\^^fd=\other
\catcode`\^^fe=\other \catcode`\^^ff=\other
}% \AllOther
\def\MakeHyphenationLetter#1#2{%
   \ifcase#1%
      \@MakeHyphenationFourThreeSeven{#2}%
   \or
      \@MakeHyphenationEightFiveZero{#2}%
   \or
      \@MakeHyphenationLatinOne{#2}%
   \or
      \@MakeHyphenationMac{#2}%
   \fi
}% MakeHyphenationLetter
\def\@CarSmaller{\ifTeX
                 %Do nothing
                 \else
                 %We are in LaTeX
                   \ifx\@currsize\normalsize\relax
                        \footnotesize
                   \else
                     \ifx\@currsize\small\relax
                        \scriptsize
                     \else
                        \ifx\@currsize\footnotesize\relax
                            \tiny
                        \else
                           \ifx\@currsize\scriptsize\relax
                               \tiny % we cannot have less
                           \fi
                        \fi
                     \fi
                   \fi
                   \ifx\@currsize\large\relax
                      \small
                   \else
                    \ifx\@currsize\Large\relax
                         \normalsize
                      \else
                         \ifx\@currsize\LARGE\relax
                             \large
                         \else
                            \ifx\@currsize\huge\relax
                               \Large
                            \else
                               \ifx\@currsize\Huge\relax
                                  \LARGE
                               \fi
                            \fi
                         \fi
                      \fi
                   \fi
                 \fi
                }% \@CarSmaller
\def\@Sup#1{%
    \ifmmode
      ^{\hbox{\@CarSmaller #1}}%
    \else
      $^{\hbox{\@CarSmaller #1}}$%
    \fi
}%\@Sup
\def\@Fraction#1#2{%
     \ifmmode
       \ifTeX
         #1\over#2%
       \else
         \frac{#1}{#2}%
       \fi
     \else
       \ifTeX
         $#1\over#2$%
       \else
         $\frac{#1}{#2}$%
       \fi
     \fi
}%\@Fraction
\def\@MathSymbol#1#2{%
       %Do the global definitions
       \gdef#1{\ifTR
                 \ifmmode
                 % Already in math ==> no $
                   \csname#2\endcsname
                 \else
                   $\csname#2\endcsname$%
                 \fi
               \else
               %No translation to do
                 \string#1%
               \fi
              }%
    }%\@MathSymbol
\def\@InMath#1{%
                 \ifmmode
                 % Already in math ==> no $
                   \csname#1\endcsname
                 \else
                   $\csname#1\endcsname$%
                 \fi
     }%\@InMath
\def\@UC#1#2#3{%
   \global\uccode`#1=#2\global\lccode`#1=#3%
}%
\def\@DefaultValue#1{%
\ifTeX
   \message{The character No #1 doesn't exist in target
           font (ignored) !}%
\else
   \typeout{The character No #1 doesn't exist in target
           font (ignored) !}%
\fi
}%
\catcode`\@=\atcatcode \let\atcatcode\relax

\endinput
%% 
%% End of file `codepage.sty'.