summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/ly1/texnansi.tex
blob: ae8ae6bfb167178d84154f6a6dd3c38a14f946b4 (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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
% Copyright 2010 TeX Users Group.
% Copyright (C) 1994--1997 Y&Y, Inc.

% Released under the LaTeX Project Public License, any version.

% ============================================================================
% Code to allow plain TeX and LaTeX to fully exploit `texnansi.vec' encoding
%		(TeX 'n ANSI)	VERSION 2.7 (1997 Jan 30)
% ============================================================================

% \input texnansi in TeX source when using fonts with `TeX n ANSI' encoding.

% Note that a lot of code that already exists in plain.tex is commented out
% --- it is included here merely for reference.

% `plain' TeX - and `lplain' TeX - have accents hard-wired to certain codes.
% When a font is encoded differently, compound characters and accents move.
% This file deals with this for TeX 'n ANSI encoding.

% NOTE:  Default is to use the 58 ready-made accented/composite characters
% that occur in text fonts directly, using the macros defined below.
% To instead build them by overprinting, use \buildcomposites.
% To instead link to them via pseudo ligatures, use \usecomposites.

% NOTE: texnansi.vec is designed to avoid char codes 0, 9, 10, 13, 32, 127
% since some brain-dead software has trouble with some of these...

% NOTE: definitions have embedded numbers that depend on the chosen encoding
% These will need to be changed if you use an encoding other than `TEXNANSI'

% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
% First, protect against style files that make quotedbl `active'

\chardef\dblcode=\catcode`\"	% save catcode of quotedbl
\catcode`\"=12			% make quotedbl `other'

\chardef\atcode=\catcode`\@	% save catcode of atsign
\catcode`\@=11			% make atsign `letter'
% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

% NOTE: plain TeX (and LaTeX) has the accent character positions hardwired to:

% 16 for `dotlessi',	   17 for `dotlessj',	18 for `grave',	
% 19 for `acute',	   20 for `caron',	21 for `breve',	
% 22 for `macron',	   23 for `ring',	24 for `cedilla',
% 25 for `germandbls',	   26 for `ae',		27 for `oe',
% 28 for `oslash',	   29 for `AE',		30 for 'OE',	
% 31 for `Oslash',	   94 for `circumflex',	95 for `dotaccent',
% 125 for `hungarumlaut',  126 for `tilde',	127 for `dieresis',
% The *real* troublesome ones are `dotaccent' and `hungarumlaut'
% --- and CM fonts do not have `ogonek' --- which we add here.
% (see page 356 of the TeX book for additional information)

% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

% \ae, \oe, \o, \AE, \OE, \O, \ss are in same place as in TeX text

% Following constructed from pieces in CM, but exist in Type 1 text fonts

\def\aa{^^e5} \def\AA{^^c5}		% aring (229), Aring (197)
% \def\cc{^^e7} \def\CC{^^c7}		% ccedilla (231), Ccedilla (199)

% NOTE: \cc may conflict with `carbon copy' in letter.sty ...

\def\l{^^90} \def\L{^^80}		% lslash (144), Lslash (128)

% TEXNANSI also has the Icelandic characters:

\def\th{^^fe} \def\TH{^^de}		% thorn (254), Thorn (222)
\def\dh{^^f0} \def\DH{^^d0}		% eth (240), Eth (208)

\def\pounds{^^a3}	\def\copyright{^^a9}	% 163 and 169
\def\registered{^^ae}	\def\trademark{^^99}	% 174 and 153
% \def\dag{^^86}	\def\ddag{^^87}	% dagger (134), daggerdbl (135)
\def\S{^^a7}		\def\P{^^b6}	% section (167), paragraph (182)

% Make it more convenient to use { } _ | \ glyphs direct from text font ?

% \chardef\{=`\{ \chardef\}=`\} \chardef\_=`\_
% \chardef\|=`\| \chardef\backslash=`\\

% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

% Following set up for the 58 accented characters/composites in text fonts:

% aacute, acircumflex, adieresis, agrave, aring, atilde, ccedilla,
% eacute, ecircumflex, edieresis, egrave, iacute, icircumflex,
% idieresis, igrave, ntilde, oacute, ocircumflex, odieresis, ograve, otilde,
% scaron, uacute, ucircumflex, udieresis, ugrave, yacute, ydieresis, zcaron,
% Aacute, Acircumflex, Adieresis, Agrave, Aring, Atilde, Ccedilla,
% Eacute, Ecircumflex, Edieresis, Egrave, Iacute, Icircumflex,
% Idieresis, Igrave, Ntilde, Oacute, Ocircumflex, Odieresis, Ograve, Otilde,
% Scaron, Uacute, Ucircumflex, Udieresis, Ugrave, Yacute, Ydieresis, Zcaron,

\def\`#1{% grave
\if#1a^^e0\else%	\char224 
\if#1e^^e8\else%	\char232 
\if#1i^^ec\else%	\char236 
\if#1o^^f2\else%	\char242 
\if#1u^^f9\else%	\char249 
\if#1A^^c0\else%	\char192 
\if#1E^^c8\else%	\char200 
\if#1I^^cc\else%	\char204 
\if#1O^^d2\else%	\char210 
\if#1U^^d9\else%	\char217 
% \if#1{\i}^^ec\else%	\char236 
\if#1\i^^ec\else%	\char236 
{\accent18 #1}%
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}

\def\'#1{% acute
\if#1a^^e1\else%	\char225 
\if#1e^^e9\else%	\char233
\if#1i^^ed\else%	\char237
\if#1o^^f3\else%	\char243 
\if#1u^^fa\else%	\char250 
\if#1y^^fd\else%	\char253 
\if#1A^^c1\else%	\char193 
\if#1E^^c9\else%	\char201 
\if#1I^^cd\else%	\char205 
\if#1O^^d3\else%	\char211 
\if#1U^^da\else%	\char218 
\if#1Y^^dd\else%	\char221 
% \if#1{\i}^^ed\else%	\char237 
\if#1\i^^ed\else%	\char237 
{\accent19 #1}%
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}

\def\^#1{% circumflex
\if#1a^^e2\else%	\char226 
\if#1e^^ea\else%	\char234 
\if#1i^^ee\else%	\char238 
\if#1o^^f4\else%	\char244 
\if#1u^^fb\else%	\char251 
\if#1A^^c2\else%	\char194 
\if#1E^^ca\else%	\char202 
\if#1I^^ce\else%	\char206 
\if#1O^^d4\else%	\char212 
\if#1U^^db\else%	\char219 
% \if#1{\i}^^ee\else%	\char238 
\if#1\i^^ee\else%	\char238 
{\accent94 #1}%
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}

\def\~#1{% tilde
\if#1a^^e3\else%	\char227 
\if#1n^^f1\else%	\char241 
\if#1o^^f5\else%	\char245 
\if#1A^^c3\else%	\char195 
\if#1N^^d1\else%	\char209 
\if#1O^^d5\else%	\char213 
{\accent126 #1}%
\fi\fi\fi\fi\fi\fi}

\def\"#1{% dieresis
\if#1a^^e4\else%	\char228 
\if#1e^^eb\else%	\char235 
\if#1i^^ef\else%	\char239 
\if#1o^^f6\else%	\char246 
\if#1u^^fc\else%	\char252 
\if#1y^^ff\else%	\char255 
\if#1A^^c4\else%	\char196 
\if#1E^^cb\else%	\char203 
\if#1I^^cf\else%	\char207 
\if#1O^^d6\else%	\char214 
\if#1U^^dc\else%	\char220 
\if#1Y^^9f\else%	\char159 
% \if#1{\i}^^ef\else%	\char239 
\if#1\i^^ef\else%	\char239 
% {\accent127 #1}%
{\accent168 #1}%
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}

\def\v #1{% caron
\if#1s^^9a\else%	\char154 
\if#1z^^9d\else%	\char157 
\if#1S^^8a\else%	\char138 
\if#1Z^^8d\else%	\char141 
{\accent20 #1}%
\fi\fi\fi\fi}

\def\r #1{% ring
\if#1a^^e5\else%	\char229 
\if#1A^^c5\else%	\char197 
{\accent23 #1}%
\fi\fi}

\def\c #1{% cedilla
\if#1c^^e7\else%	\char231 
\if#1C^^c7\else%	\char199 
{\setbox0\hbox{#1}\ifdim\ht0=1ex\accent24 #1
  \else{\ooalign{\hidewidth\char24\hidewidth\crcr\unhbox0}}\fi}%
\fi\fi}

\def\H#1{{\accent6 #1}}%	 hungarumlaut	% not in 125
\def\u#1{{\accent21 #1}}%	 breve

% dotaccent and macron have to be treated differently in AMS TeX

\ifx\amstexloaded@\relax%
\def\D#1{{\accent5 #1}}		% dotaccent	% not in 95
\def\B#1{{\accent22 #1}}	% macron
\let\graveaccent\`
\let\acuteaccent\'
\let\tildeaccent\~
\let\hataccent\^
\let\underscore\_
\else
\def\.#1{{\accent5 #1}}		% dotaccent	% not in 95
\def\=#1{{\accent22 #1}}\fi	% macron

% underline (using macron at 22)
\def\b#1{\oalign{#1\crcr\hidewidth
    \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}%

% ogonek (using ogonek at 7)
\def\k#1{\setbox0\hbox{#1}\ifdim\ht0=1ex\accent7 #1
  \else{\ooalign{\hidewidth\char7\hidewidth\crcr\unhbox0}}\fi}%

% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

% For backward compatability, provide for use of font with TeX's \accent:
% (It is however generally better to use ready-made accented characters, since
% \accent creates explicit kerning, which breaks the hyphenation machinery)
% NOTE: Use \buildcomposites only if you want to force accented/composite
% characters to be constructed by `overprinting' base and accent.

\def\buildcomposites{%
% following four lines are for TeX n ANSI encoding only
\def\.##1{{\accent5 ##1}}%	 dotaccent	% not in 95
\def\H##1{{\accent6 ##1}}%	 hungarumlaut	% not in 125
\def\k##1{{\accent7 ##1}}%	 ogonek		% not in CM fonts
\def\"##1{{\accent168 ##1}}%	 dieresis	% alternate to 127
% following are plain TeX defaults (needed only to undo \usecomposites)
\def\`##1{{\accent18 ##1}}%	 grave
\def\'##1{{\accent19 ##1}}%	 acute
\def\^##1{{\accent94 ##1}}%	 circumflex
\def\~##1{{\accent126 ##1}}%	 tilde
\def\=##1{{\accent22 ##1}}%	 macron
\def\v##1{{\accent20 ##1}}%	 caron
\def\u##1{{\accent21 ##1}}%	 breve
% \def\"##1{{\accent127 ##1}}%	 dieresis	% use 168 instead
% underline and cedilla accents (macron at 22, cedilla at 24)
\def\b##1{\oalign{##1\crcr\hidewidth
    \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}%
\def\c##1{\setbox0\hbox{##1}\ifdim\ht0=1ex\accent24 ##1
  \else{\ooalign{\hidewidth\char24\hidewidth\crcr\unhbox0}}\fi}%
}

% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

% USING READY-MADE ACCENTED CHARACTERS:
% We can also use pre-built accented character using pseudo ligatures ---
% provided the TFM files for the text fonts have them wired in.
% The following assumes that the TFM files have the required pseudo-ligatures.
% Use -vadj on the command line with AFMtoTFM to set up these pseudo-ligatures.
% This only works for the 58 ready-made accented/composite characters.

\def\usecomposites{%
\chardef\`=18	% grave
\chardef\'=19	% acute
\chardef\^=94	% circumflex
\chardef\~=126	% tilde
\chardef\"=127	% dieresis	% must match TFM, hence do *not* use 168 here
\chardef\c=24	% cedilla	% only for ccedilla, Ccedilla
\chardef\v=20	% caron		% only for scaron, zcaron, Scaron, Zcaron
\chardef\r=23	% ring		% non-standard, for Aring and aring
% and some extra goodies
\chardef\.=5	% dotaccent	% no standard accented chars use this
\chardef\H=6	% hungarumlaut	% no standard accented chars use this
\chardef\k=7	% ogonek	% no standard accented chars use this
\chardef\u=21	% breve		% no standard accented chars use this
\chardef\==22	% macron	% no standard accented chars use this
% \chardef\i=16	% dotlessi
}

% NOTE: To use the above scheme, use \'a, NOT \'{a}, and \c c, NOT \c{c}.

% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

% \buildcomposites	% build composites by overprinting base and accent
% \usecomposites	% use 58 ready-made composites via pseudo ligatures

% Default is to use 58 ready-made composites, and build others by overprinting.

% --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

% Changes required in math macros when roman font is reencoded to `texnansi'.
% (An alternative is to draw the accents from the math fonts)

% Most accents are in same place as in TeX text encoding (except dotaccent)

\def\usetextaccents{
% \def\grave{\mathaccent"7012 }	%  18 grave
% \def\acute{\mathaccent"7013 }	%  19 acute
% \def\hat{\mathaccent"705E }	%  94 circumflex
% \def\tilde{\mathaccent"707E }	% 126 tilde
% \def\ddot{\mathaccent"707F }	% 127 dieresis
\def\ddot{\mathaccent"70A8 }	% 168 dieresis
% \def\bar{\mathaccent"7016 }	%  22 macron
% \def\check{\mathaccent"7014 }	%  20 caron
% \def\breve{\mathaccent"7015 }	%  21 breve
\def\dot{\mathaccent"7005 }	%   5 dotaccent
}

% Do not redefine accents in math mode when using MathTime,
% since MathTime uses accents in the math fonts - not those in the text font

% In LaTeX 2e check whether mathtime package has been loaded,
% otherwise check whether \MTMI is defined

\ifx\@ifpackageloaded\undefined\ifx\MTMI\undefined\usetextaccents\fi
\else\@ifpackageloaded{mathtime}{}{\usetextaccents}\fi

% **************************************************************************

% If you want to use < for `guilsinglleft' and > for `guilsinglright'
% then uncomment the following lines:

% \catcode`\<=\active \chardef<=139
% \catcode`\>=\active \chardef>=155

% If you use < for `exclamdown', > for `questiondown', and | for `emdash'
% then uncomment the following lines:

% \catcode`\<=\active \chardef<=161
% \catcode`\>=\active \chardef>=191
% \catcode`\|=\active \chardef|=151

% \chardef\lq=96 \chardef\rq=39

% Note that \lq and \rq also provide access to ` and '

\catcode`\@=\atcode		% restore original catcode of atsign

\catcode`\"=\dblcode		% restore original catcode of quotedbl

% If you use " for quotedblright then uncomment the following:

% \catcode`\"=\active \chardef"=148

% For proper hyphenation of words with accented characters we need to let
% TeX know how to translate words with accented characters to lower case.
% Hence define \lccode so that one can use them in \hyphenation{...}
% Just for fun, we also define \uccode, and set the \catcode to letter...

% Mostly in ISO Latin 1, accented characters (and a few special characters)
% occur in upper case form in the range 192 - 222, which is offset
% by 32 from the corresponding lower case forms in the range 224 - 254.

\bgroup
\newcount\n\newcount\m\n=224\m=192
\loop\ifnum\n<255
\global\catcode\n=11\global\catcode\m=11
\global\lccode\n=\n\global\lccode\m=\n
\global\uccode\m=\m\global\uccode\n=\m
\advance\n by1\advance\m by1\repeat
\egroup

% Then there are just a few odd ones in TEXNANSI that don't fit this pattern

\catcode140=11\catcode156=11	% OE, oe
\lccode140=156\lccode156=156
\uccode140=140\uccode156=140
\catcode159=11\catcode255=11	% Ydieresis, ydieresis
\lccode159=255\lccode255=255
\uccode159=159\uccode255=159
\catcode138=11\catcode154=11	% Scaron, scaron
\lccode138=154\lccode154=154
\uccode138=138\uccode154=138
\catcode141=11\catcode157=11	% Zcaron, zcaron
\lccode141=157\lccode157=157
\uccode157=141\uccode141=141
\catcode128=11\catcode144=11	% Lslash, lslash
\lccode128=144\lccode144=144
\uccode144=128\uccode128=128

\endinput