% ITFCHARS.TeX - special characters for ITF based on IBM PC extended characters
%   Copyright 1990 by the Summer Institute of Linguistics, Inc.
%
%   See ``Formatting Interlinear Text'' by Jonathan Kew and Stephen McConnel
%   for instructions on how to use the macros defined in this file.
%
\immediate
\write16{ITF extended character handling, Version 1.0.1 (27 October 1990)}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	ACCESS TO ACTIVE AND SPECIAL CHARACTERS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	Characters from ASCII 128 to 255 are translated to \.ddd. by ITFPREP
%	and AMPITF, where ddd is a decimal number.  This definition for \.
%	handles these codes, but does not attempt to print the graphic drawing
%	characters.  The user is free to re-define \. for other uses of these
%	characters, but this obviously requires a good knowledge of the fonts
%	available.  To use different characters, a separate TeX file should be
%	written which re-defines the \. macro, and that file should be \input
%	instead of this one.  (Making a copy of this file would be one way to
%	retain the other definitions in this file.)
%
%	All of the places where math mode ($...$) is used would be better done
%	with direct access to the fonts via a setup involving the ITF macro
%	\extrafont, and then using \selectextrafont in doing the font switch.
%	However, this requires more of a setup than the default operation of
%	ITFprep or AMPITF provides.
%
%	It might be worth mentioning that the numeric argument is by no means
%	limited to what can be represented in 8 bits.  On the other hand, the
%	more alternatives in the \ifcase, the slower it runs...
%
%			********************************
%
%	The new 8-bit character handling by TeX 3.0 will largely obsolete this
%	particular macro.  Some of the other macros defined below may still be
%	useful however.
%
\newcount\CharCode
\def\.#1.{%
    \CharCode=#1 \advance\CharCode by-128
    \ifcase\CharCode%
        \c{C}%	128	C cedilla
    \or \"u%	129	u umlaut
    \or \'e%	130	e acute
    \or \C{a}%	131	a circumflex
    \or \"a%	132	a umlaut
    \or \`a%	133	a grave
    \or \aa%	134	a circle
    \or \c{c}%	135	c cedilla
    \or \C{e}%	136	e circumflex
    \or \"e%	137	e umlaut
    \or \`e%	138	e grave
    \or \"\i%	139	i umlaut
    \or \C\i%	140	i circumflex
    \or \`\i%	141	i grave
    \or \"A%	142	A umlaut
    \or \AA%	143	A circle
    \or \'E%	144	E acute
    \or \ae%	145	ae ligature
    \or \AE%	146	AE ligature
    \or \C{o}%	147	o circumflex
    \or \"o%	148	o umlaut
    \or \`o%	149	o grave
    \or \C{u}%	150	u circumflex
    \or \`u%	151	u grave
    \or \"y%	152	y umlaut
%	i\kern-0.07em j% alternative for character 152 (ij ligature)
    \or \"O%	153	O umlaut
    \or \"U%	154	U umlaut
    \or \rlap/c% 155	cents currency sign (see The TeXbook)
    \or {\it\$}% 156	pound currency sign
    \or \rlap=Y% 157	yen currency sign (not that inspiring...)
    \or P\kern-0.14em t% 158	Pt ??
    \or {\it f}\/% 159	franc ?
    \or \'a%	160	a acute
    \or \'\i%	161	i acute
    \or \'o%	162	o acute
    \or \'u%	163	u acute
    \or \T{n}%	164	n tilde
    \or \T{N}%	165	N tilde
    \or ${}^{\rm\b{a}}$\relax% 166	a underbar
    \or ${}^{\rm\b{o}}$\relax% 167	o underbar
    \or {?`}%	168	Spanish open question mark
    \or \etagen% 169	??
    \or $\neg$\relax% 170	mathematical negation
    \or \frac1/2% 171	fraction one-half
    \or \frac1/4% 172	fraction one-fourth
    \or {!`}%	173	Spanish open exclamation mark
    \or $\rm\ll$\relax% 174	open French quote
    \or $\rm\gg$\relax% 175	close French quote
    \or \missingchar% 176	graphic character
    \or \missingchar% 177	  "	   "
    \or \missingchar% 178	  .
    \or \missingchar% 179	  .
    \or \missingchar% 180	  .
    \or \missingchar% 181
    \or \missingchar% 182
    \or \missingchar% 183
    \or \missingchar% 184
    \or \missingchar% 185
    \or \missingchar% 186
    \or \missingchar% 187
    \or \missingchar% 188
    \or \missingchar% 189
    \or \missingchar% 190
    \or \missingchar% 191
    \or \missingchar% 192
    \or \missingchar% 193
    \or \missingchar% 194
    \or \missingchar% 195
    \or \missingchar% 196
    \or \missingchar% 197
    \or \missingchar% 198
    \or \missingchar% 199
    \or \missingchar% 200
    \or \missingchar% 201
    \or \missingchar% 202
    \or \missingchar% 203
    \or \missingchar% 204
    \or \missingchar% 205
    \or \missingchar% 206
    \or \missingchar% 207
    \or \missingchar% 208
    \or \missingchar% 209
    \or \missingchar% 210
    \or \missingchar% 211
    \or \missingchar% 212
    \or \missingchar% 213
    \or \missingchar% 214
    \or \missingchar% 215
    \or \missingchar% 216
    \or \missingchar% 217
    \or \missingchar% 218
    \or \missingchar% 219	   .
    \or \missingchar% 220	   .
    \or \missingchar% 221	   .
    \or \missingchar% 222	   "	    "
    \or \missingchar% 223	graphic character
    \or $\propto$\relax% 224	proportional to
    \or $\beta$\relax% 225	beta
    \or \char0%       226	GAMMA (assumes CM font)
    \or $\pi$\relax%  227	pi
    \or \char6%       228	SIGMA (assumes CM font)
    \or $\sigma$\relax% 229	sigma
    \or $\mu$\relax%  230	mu
    \or $\tau$\relax% 231	tau
    \or \char8%       232	PHI
    \or \char2%       233	THETA (assumes CM font)
    \or \char10%      234	OMEGA (assumes CM font)
    \or $\delta$\relax% 235	delta
    \or $\infty$\relax% 236	infinity
    \or $\phi$\relax% 237	phi
    \or $\in$\relax%  238	member of
    \or $\cap$\relax% 239	intersection
    \or $\equiv$\relax% 240	equivalent
    \or $\pm$\relax%  241	plus/minus
    \or $\geq$\relax% 242	greater than or equal
    \or $\leq$\relax% 243	less than or equal
    \or $\int$\relax% 244	[top of] integral
    \or \missingchar% 245	bottom of integral
    \or $\div$\relax% 246	divide
    \or $\approx$\relax% 247	approximates
    \or \char23%      248	degree
    \or $\bullet$\relax% 249	bullet
    \or $\cdot$\relax% 250	center dot
    \or $\sqrt{\phantom{2}}$\relax% 251	square root
    \or $^n$\relax%   252	superscript n
    \or $^2$\relax%   253	superscript 2
    \or \vrule height1.2ex width0.3em depth0pt% 254	black box
    \or \missingchar% 255
    \else \missingchar\fi% in case something <128 or >255 snuck in
}
\def\frac#1/#2{%		see The TeXbook, exercise 11.6
    \leavevmode\kern.1em
    \raise.5ex\hbox{\the\scriptfont0 #1}\kern-.1em
    /\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}
}
\def\etagen{%
    \kern0.1em\vrule width0.05ex height1.0ex depth-0.5ex%
    \vrule width0.4em height1.0ex depth-0.95ex\kern0.1em
}
\def\missingchar{%		print a small square box
    \kern0.1em\vrule width0.4pt height5.8pt depth0pt%
    \vrule width5pt height0.4pt depth0pt%
    \vrule width0.4pt height5.8pt depth0pt\kern-5.4pt%
    \vrule width5.4pt height5.8pt depth-5.4pt\kern0.1em
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	The following macro allows accents to be stacked, unlike the standard
%	\accent command.
%
\def\Acc#1#2{%
    \setbox0\hbox{\char #1}%
    \setbox1\hbox{#2}%
    \dimen0\ht1\advance\dimen0-1ex
    \leavevmode
    \hbox to\wd1{\kern.5\wd1\hss\raise\dimen0\box0\hss\kern-.5\wd1\box1}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	The following standard ASCII characters are regarded as ``special''
%	by TeX or ITF.  ITFPREP and AMPITF thus may preface them with a single
%	backslash:
%			\#$%^&_~{}
%
%	The commented out definitions are already in Plain TeX.
%
\chardef\\=`\\
% \chardef\#=`\#
% \chardef\$=`\$
% \chardef\%=`\%
\chardef\^=`\^		% we'll need another way to access the ^ accent
% \chardef\&=`\&
% \def\_{\leavevmode\kern.06em\vbox{\hrule width.3em}}
\chardef\~=`\~		% we'll also need another way to access the ~ accent
\def\{{$\{$}
\def\}{$\}$}
%
%	The preceding definitions mean that \., \^ and \~ cannot be used in
%	their plain TeX sense to access accents in an ITF input file.  We
%	provide \D, \C and \T to take their place; however, it is intended
%	that all ``special characters'' will normally be handled by the \.ddd.
%	mechanism (or by the 8-bit capability and virtual fonts of TeX 3.0),
%	not by building up accents explicitly in the text.
%
\def\D{\Acc{"5F}}
\def\C{\Acc{"5E}}
\def\T{\Acc{"7E}}
