% ECHUN.TEX: Allow using Hungarian letters with the EC fonts%
% Send bug reports to Emil W. Kiss (ewkiss@cs.elte.hu)%
% Experimental version 0.9 --- 21 June 1997%
% Based on DCHUN32.TEX
%
% Works with Plain TeX and with AMSTeX.%
% This file assumes that the Hungarian hyphenation%
% patterns have already been loaded, and%
% \l@magyar has already been defined. See the details below.%
%
% You are not allowed to change this file without renaming it first.%
% For LaTeX2e, this file is not needed, use the T1 encoding.%
% Some of the ideas of nft1.def and nfot1.def from%
% the package NFSS2 by F. Mittelbach and R. Sch\"opf,%
% as well as of german3.sty by R. Sch\"opf have been used below.%
%
%------------------------------------------------------------------------%
%                         USER INTERFACE:%
%------------------------------------------------------------------------%
%
%   One should simply \input echun.tex at the beginning%
%   of the document. Please input echun before inputting amstex.%
%------------------------------------------------------------------------%
%
%1. Language (and hyhphenation) switching:%
%     \hun: change to Hungarian (in any place)%
%     \eng: change to English (in any place)%
%       \eng is attempted to be compatible with the cm (American)%
%       version of plain and AMSTeX as much as possible.%
%       THEREFORE WE USE cm FONTS IN \eng MODE (and in math mode),%
%       and EC fonts in \hun mode.%
%   WARNING:%
%     \hun must be issued AFTER inputting AMSTeX, and not before.%
%       Correct form:%
%	  \input echun% can be input after amsppt, too%
%         \input amstex%
%         \documentstyle{amsppt}%
%         \hun% could be later%
%         \magnification=\magstep1%
%         ...%
%       Incorrect form:%
%         \input echun%
%         \hun% but not this early!%
%         \input amstex%
%         \documentstyle{amsppt}%
%         \magnification=\magstep1%
%         ...%
%         %
%     THEREFORE THE DEFAULT IS \eng when echun.tex is input.
%     Similarly, one should issue a \hun command after executing%
%     any macros that redefine \rm, \it, \sl, \bf, \tt, or \smc.%
%     All this is not necessary, if you use only English.%
%     Finally, if you want to write Hungarian text in math mode%
%     you have to issue \hun again. An AMSTeX example:%
%
%     \hun is not sufficient here $x \text{\hun Hungarian text} y$.%
%
%------------------------------------------------------------------------%
%
%2. How to enter the Hungarian letters?%
%
%     The Hungarian letters must have the Cork encoding.%
%     The various encodings with decimal codes are given here:%
%                                                               %
%       Letter      MaTeX       CWI         Cork (decimal codes)%
%                   (+128)                            %
%       \'a         134         160=         225%
%       \'A         143         143=         193%
%       \'e         130         130=         233%
%       \'E         144         144=         201%
%       \'o         149         162=         243%
%       \'O         155         149=         211%
%       \"o         148         148=         246%
%       \"O         153         153=         214%
%       \H o        147         147=         174%
%       \H O        157         167=         142%
%       \"u         129         129=         252%
%       \"U         154         154=         220%
%       \'u         151         163=         250%
%       \'U         128         151=         218%
%       \H u        150         150=         182%
%       \H U        152         152=         150%
%       \'\i        161         161=         237%
%       \'I         139         141=         205%
%       \"a         -           132=         228%
%       \"A         -           142=         196%
%     You have to set up your editor to produce the Cork encoding.%
%
%     An alternative possibility is to use the ISO-Latin1 encoding.
%     This is supported by the screen fonts of the X Window system
%     (under UNIX, Linux). This encoding differs from the Cork
%     encoding only in four places:

%       Letter      ISO-Latin1    Cork (decimal codes)%
%       \H o        245           174%
%       \H O        213           142%
%       \H u        251           182%
%       \H U        219           150%
%
%     By default, echun.tex makes TeX perform the%
%     ISO-Latin1 => Cork conversion automatically.%
%     To turn this feature off, use the command%
%     \ISOtranslateoff (and \ISOtranslateon turns it%
%     back on, even in the middle of a document).%
%     When this translation is turned on, one can still%
%     access the four characters 245, 213, 251, 219 of%
%     the EC fonts by typing \~o, \~O, \^u, \^U, respectively%
%     (see also the information on accents below).%
%
%     emTeX (written by Eberhard Mattes) for MSDOS and OS2%
%     is available via anonymous ftp.%
%     Using code pages in emTeX on can automatically%
%     convert between various encodings.%
%     High ASCII output on the screen and in the log file%
%     can also be achieved with this technique.%
%------------------------------------------------------------------------%
%
%3. Special control sequences and symbols%
%
%  (from german3.sty and nft1.def of NFSS2)%
%
%   \glqq or \quotedblbase     german left double quotes    (similar to ,,)%
%   \glq  or \quotesinglbase   german left single quotes    (similar to , )%
%   \flqq or \guillemotleft    french left guillemots       (similar to <<)%
%   \frqq or \guillemotright   french right guillemots      (similar to >>)%
%   \flq  or \guilsinglleft    single version of \flqq      (similar to <)%
%   \frq  or \guilsinglright   single version of \frqq      (similar to >)%
%   \dq                        the original (upright) quotes character (")%
%   \pounds                    Symbol for the British currency%
%
%  These symbols are undefined in \eng mode.%
%
%  Unimplemented features of german3.sty:%
%
% "|                 to separate ligatures.%
% "-                 like \-, but allowing hyphenation in the rest of%
%                    the word (i.e., in the parts before and after the%
%                    hyphenation point added by "-)%
% ""                 like "-, but producing no hyphen sign (for x-""y).%
% "~                 for an unbreakable hyphen (for `bergauf und "~ab').%
% 
% In fact, " is NOT active, even in \hun mode.%
% (This was different in dchun.tex).%
% The Hungarian lower quotation mark is typed as ,,%
% (which is a ligature in the EC fonts).%
%------------------------------------------------------------------------%
%
%4. Accents%
%   Since \'a is substantially different from the letter a'%
%   in the EC fonts, one must not use both of them%
%   in the same document. Therefore in \hun mode the accents, like \'%
%   have been redefined so that \'a yields the letter a', and%
%   the accents are used only for those letters, whose accented%
%   form is not included in the EC fonts.%
%   Therefore SWITCH TO \hun EACH TIME,
%   WHEN AN ACCENTED LETTER IS TO BE USED%
%   for the uniformity of your document.%
%
%   Example:%
%   The French mathematician {\hun Vi\`ete} ...%
%
%   There is no need to do this if you write only in English,%
%   in that case you will get the accents from the cm fonts.%
%   Try this example without \hun to see the difference in appearance.%
%
%   This feature has the very pleasant consequence that in \hun%
%   mode ANY TEXT WRITTEN BY EXPLICIT ACCENTS INSTEAD OF HIGH%
%   ASCII CHARACTERS WILL BE HYPHENATED CORRECTLY.%
%
%------------------------------------------------------------------------%
%                         INSTALLATION:%
%------------------------------------------------------------------------%
%
%   Copy echun.tex to some directory holding TeX input files.%
%   (In TeTeX, don't forget to issue the texhash command.)%
%
%   The Hungarian hyphenation patterns must be loaded%
%   into initex for echun to work. If TeTeX is used,%
%   then one can simply do this by uncommenting the line%
%   containing huhyph.tex in the file language.dat%
%   (found in a place like ...../texmf/tex/generic/config),%
%   and then recreating the plain format.%
%
%   For a general version of TeX, one has to run initex%
%   on a file that%
%   - inputs plain.tex;%
%   - defines two different integers \l@english and \l@magyar;%
%   - sets \language=\l@english,%
%      and inputs the english hyphenation patterns;%
%   - sets \language=\l@magyar,%
%      and inputs huhyph.tex (which is freely available,%
%      and defines the necessary catcode changes, too);%
%   and then \dump to plain.fmt.
%
%   Obviously, one also has to install the EC fonts.
%
%------------------------------------------------------------------------%
%                         HISTORY:%
%------------------------------------------------------------------------%
%
%Changes in version 0.2  from 0.1%
%
%-- The \catcode changes in \eng were \global, so {\eng xxx} was not local.%
%   Now the changes are local, and \begingroup\endgroup has been removed.%
%-- The `literal argument feature' in AMSTeX (like \item"{a}") causes%
%   problems, because " in \hun mode is not recognised.%
%   The only solution is: change to \eng when using it.%
%   !!!!!!!This remark is OBSOLETE in echun.tex!!!!!!!%
%   Therefore \hun and \eng are not any more \outer, to allow%
%   Hungarian mode inside labels.%
%------------------------------------------------------------------------%
%
%Changes in version 0.3  from 0.2%
%
%   Bug fixed: \rm \'a did not work OK in \eng mode%
%      Reason: \rm ... should change to EC only if \Corkenc@dingtrue%
%      Change: in the line marked by V32, \ifCorkenc@ding added.%
%
%------------------------------------------------------------------------%
%
%Changes in version 0.9  from 0.3%
%
% This is a major rewrite. We switched from dc to ec fonts.%
% We aim at linux, X and TeTeX now, so \ISOtranslateon/off%
% is included, and the hyphenation patterns are not input%
% (as TeTeX has a mechanism to handle these).%
% Thus echun.tex is now a simple include file.%
% The character " is not anymore active (one can use ,,)%
% and so the trick mentioned above (concerning \item"{a}")%
% is no longer necessary.%
% Some bugs have been corrected, like \i^^xx => \i ^^xx.%
%
%------------------------------------------------------------------------%
%                         TODO:%
%------------------------------------------------------------------------%
%
% An idea of Zoltan Hidvegi is to change the meaning of%
% high ASCII characters in \eng mode. Currently they%
% are invalid for better error checking. Zoli proposes%
% to print a prominent warning at the first occurrence%
% of a high ASCII character in \eng mode, and translate%
% these characters so that the corresponding accented%
% character is printed using the accents in the current font.%
% This behaviour could be turned on/off by the user.%
%
% It has also been disputed whether \eng mode should use%
% cm or ec fonts. Therefore one could define macros besides%
% \eng and \hun that change only the language (hyphenation)%
% or only the encoding. This is done in LaTeX2e.%
%
% These ideas have not been implemented. These differences%
% probably do not really matter for the ordinary user.%
%
%
\chardef\atcode=\catcode`\@% save current category code of `@'%
\catcode`\@=11% \makeatletter%
%
{\catcode`\|=0 \catcode`\\=12%
% mini-verbatim to print \ with\everyjob%
|gdef|echunm@ssage{%
|immediate|write16{EXPERIMENTAL Ver. 0.9, %
send bug reports to Emil W. Kiss (ewkiss@cs.elte.hu)}%
|immediate|write16{Type \hun (\eng) %
to write in Hungarian (English).}%
|immediate|write16{Use the Cork or ISO-Latin1 encoding %
of the Hungarian letters,}%
|immediate|write16{and ,, for the Hungarian (lower) left quote.}%
|immediate|write16{In a mixed language file, %
use accents ONLY in \hun mode!}%
|immediate|write16{See the file ECHUN.TEX for a more detailed %
interface description.}}}%
%
\echunm@ssage%
\everyjob{\echunm@ssage}%
%
% Font loading%
% It is important here that the definitions of the EC fonts%
% are of the form \ecxxx, where \xxx selects the corresponding cm font.%
% The cm font definitions MUST NOT start with ec.%
% See \f@ntdefchange below%
%
\font\ectenrm=ecrm1000%
\font\ecninerm=ecrm0900%
\font\eceightrm=ecrm0800%
\font\ecsevenrm=ecrm0700%
\font\ecsixrm=ecrm0600%
\font\ecfiverm=ecrm0500%
%
\font\ectenbf=ecbx1000%
\font\ecninebf=ecbx0900%
\font\eceightbf=ecbx0800%
\font\ecsevenbf=ecbx0700%
\font\ecsixbf=ecbx0600%
\font\ecfivebf=ecbx0500%
%
\font\ectenit=ecti1000%
\font\ecnineit=ecti0900%
\font\eceightit=ecti0800%
\font\ecsevenit=ecti0700%
\font\ecsixit=ecti0600%
\font\ecfiveit=ecti0500%
%
\font\ectensl=ecsl1000%
\font\ecninesl=ecsl0900%
\font\eceightsl=ecsl0800%
%
\font\ectentt=ectt1000%
%
\font\ectensmc=eccc1000%
\font\eceightsmc=eccc0800%
%
% Define the font definition changing macros%
%
% The idea is that we save the original meaning of, say, \rm to \rm@,%
% and redefine \rm so that when the Cork encoding is active,%
% and we are not in math mode, then it will first call the original \rm,%
% and if, say, that switched to \eightrm, then we switch to \eceightrm%
%
\newif\ifCorkenc@ding%
\def\ifund@fined#1#2#3{\expandafter\ifx\csname #1\endcsname\relax%
 #2\else#3\fi}%
%         see The TeXbook, p. 308%
%         \ifund@fined yields #2 if \#1 is undefined, #3 otherwise%
\def\g@bbleaddec#1#2#3{\if#2e\if#3c#2#3\else ec#2#3\fi\else ec#2#3\fi}%
% add ec if ... does not start with ec, no change otherwise%
\def\ecpr@p#1{\csname\expandafter\g@bbleaddec\string#1\endcsname}%
% put in ec: ecpr@p{\xyz} = \ecxyz%
\def\g@bbleremec#1#2#3{\if#2e\if#3c\else#2#3\fi\else#2#3\fi}%
% remove ec if ... starts with ec, no change otherwise%
\def\cmpr@p#1{\csname\expandafter\g@bbleremec\string#1\endcsname}%
% the converse of \ecpr@p%
\newif\iff@ntdefchanged% to check if \rm ... has been redefined%
%                        by the user%
\newif\iff@ntdeftmp%
%
\def\switcht@ec#1#2{% switch the current font to the corresponding ec font%
%                   if it is defined, otherwise to #1,%
%                   if #1 is also undefined, then to #2,%
%                   and if #2 is undefined, then do nothing.%
%                   #1 and #2 should be explicit control sequences%
\ifmmode\else%
\edef\ec@{\expandafter\ecpr@p\the\font}%
\expandafter\ifx\ec@\relax% so \ec@ is invalid%
\ifx#1\undefined\ifx#2\undefined\else#2\fi\else#1\fi% switch to #1 or #2%
\else\ec@% switch to \ec@%
\fi\fi}%
%
\def\switcht@cm#1{% switch the current font to the corresponding cm font%
%                   if it is defined, otherwise to #1,%
%                   and if #1 is undefined, then do nothing.%
%                   #1 should be an explicit control sequence%
\ifmmode\else%
\edef\cm@{\expandafter\cmpr@p\the\font}%
\expandafter\ifx\cm@\relax% so \cm@ is invalid%
\ifx#1\undefined\else#1\fi% switch to #1%
\else\cm@% switch to \cm@%
\fi\fi}%
%
\def\f@ntdefappend#1#2#3#4{% change the \def of \rm, etc. if necessary%
%                      #1=\rm, ..., #2=\rm@ (name of save register)%
%                      #3=default font if error (e. g. \ectenrm)%
%                      #4=default font if #3 is invalid%
\ifx#1\undefined\else%
\f@ntdeftmpfalse\relax{\f@ntdefchangedfalse\relax#1\iff@ntdefchanged%
\global\f@ntdeftmptrue\relax\else\fi}% test LOCALLY if #1 has been redefined%
\iff@ntdeftmp\else% so #1 has been redefined%
\let#2#1% save new definition%
\def#1{#2\ifCorkenc@ding\switcht@ec{#3}{#4}\fi\f@ntdefchangedtrue\relax}%V32%
\fi\fi}%
%
\def\f@ntdefchange@{% Change the meaning of \rm, etc.%
\f@ntdefappend{\rm}{\rm@}{\ectenrm}{\ectenrm}%
\f@ntdefappend{\it}{\it@}{\ectenit}{\ectenrm}%
\f@ntdefappend{\sl}{\sl@}{\ectensl}{\ectenrm}%
\f@ntdefappend{\bf}{\bf@}{\ectenbf}{\ectenrm}%
\f@ntdefappend{\tt}{\tt@}{\ectentt}{\ectenrm}%
\f@ntdefappend{\smc}{\smc@}{\ectensmc}{\ectenrm}%
}%
\newif\ifAMSch@nged%
\AMSch@ngedfalse\relax%
\def\f@ntdefchange{%
% In plain, we have to do it now:%
\f@ntdefchange@%
% In AMSTeX, we have to add it to the size changing commands%
\def\next{AMSPPT}%
\ifx\styname\next% AMSPPT is loaded%
\ifAMSch@nged\else% not changed yet%
\addto\tenpoint{\f@ntdefchange@\rm}%
\addto\eightpoint{\f@ntdefchange@\rm}%
\AMSch@ngedtrue\relax% do not change next time%
\fi\fi}% end of \f@ntdefchange%
%
\newcount\h@ghupper% count registers to change \catcode, ...%
\newcount\h@ghlower%   values of the high ASCII characters%
%
% Change the accents to AMS standards, it AMSTeX is loaded%
% (has to be done with every change of encoding)%
%
\def\save@ms{%
\ifx\amstexloaded@\relax%
\let\ori@msperiod\.%
\let\ori@msequal\=%
\fi}%
%
\def\ec@msaccents{%
\ifx\amstexloaded@\relax%
\let\graveaccent\`%
\let\acuteaccent\'%
\let\tildeaccent\~%
\let\hataccent\^%
\let\underscore\_%
\let\B\=%
\let\=\ori@msequal%
\let\D\.%
\let\.\ori@msperiod%
\fi}%
%
\newif\ifdo@ccent% variable used in the \def of accents below%
%
% Translating ISO-Latin1 characters.
\def\makeIS@active{%
\catcode`^^f5=\active%\H o
\catcode`^^d5=\active%\H O
\catcode`^^fb=\active%\H u
\catcode`^^db=\active%\H U
}%
\def\makeIS@letter{%
\catcode`^^f5=11%\H o%
\catcode`^^d5=11%\H O%
\catcode`^^fb=11%\H u%
\catcode`^^db=11%\H U%
}%
\newif\ifIS@translate
\def\ISOtranslateon{\IS@translatetrue
\ifCorkenc@ding\makeIS@active\fi}
\def\ISOtranslateoff{\IS@translatefalse
\ifCorkenc@ding\makeIS@letter\fi}
%
{\makeIS@active
\gdef^^f5{^^ae}%do the actual translation
\gdef^^d5{^^8e}
\gdef^^fb{^^b6}
\gdef^^db{^^96}}
%
% Define the encodings%
\def\Corkenc@ding{%
\Corkenc@dingtrue\relax%
\save@ms%
\chardef\ss="0FF%
\chardef\ae="0E6%
\chardef\oe="0F7%
\chardef\o="0F8%
\chardef\AE="0C6%
\chardef\OE="0D7%
\chardef\O="0D8%
\chardef\i="19 \chardef\j="1A% dotless letters%
\chardef\aa="0E5%
\chardef\l="0AA%
\chardef\L="8A%
\chardef\_=`\_%
\chardef\AA="0C5%
\chardef\S='237%
\chardef\SS="0DF%
\chardef\pounds='277%
\chardef\guillemotleft='023  \let\flqq\guillemotleft%
\chardef\guillemotright='024 \let\frqq\guillemotright%
\chardef\guilsinglleft='016  \let\flq\guilsinglleft%
\chardef\guilsinglright='017 \let\frq\guilsinglright%
\chardef\quotedblbase='022   \let\glqq\quotedblbase%
\chardef\quotesinglbase='015 \let\glq\quotesinglbase%
\chardef\dq='042%
%
% In the following, accent changing macros the argument passed to%
% \d@acc... is the first character (token) of ##1,%
% the rest of ##1 is simply copied.%
% Otherwise, \if below would compare the first two tokens of the%
% argument of \' (for example, \'{aabc} would work improperly).%
%
\def\`##1{% grave%
\ifmmode\else\ifCorkenc@ding\d@accgrave##1\relax\fi\fi}%
\def\d@accgrave##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1a^^e0\do@ccentfalse\relax\fi%
\if##1e^^e8\do@ccentfalse\relax\fi%
\if##1\i ^^ec\do@ccentfalse\relax\fi%
\if##1i^^ec\do@ccentfalse\relax\fi%
\if##1o^^f2\do@ccentfalse\relax\fi%
\if##1u^^f9\do@ccentfalse\relax\fi%
\if##1A^^c0\do@ccentfalse\relax\fi%
\if##1E^^c8\do@ccentfalse\relax\fi%
\if##1I^^cc\do@ccentfalse\relax\fi%
\if##1O^^d2\do@ccentfalse\relax\fi%
\if##1U^^d9\do@ccentfalse\relax\fi%
\ifdo@ccent{\accent0 ##1}\fi}%
%
\def\'##1{% acute%
\ifmmode\else\ifCorkenc@ding\d@accacute##1\relax\fi\fi}%
\def\d@accacute##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1n^^ab\do@ccentfalse\relax\fi%
\if##1l^^a8\do@ccentfalse\relax\fi%
\if##1r^^af\do@ccentfalse\relax\fi%
\if##1s^^b1\do@ccentfalse\relax\fi%
\if##1z^^b9\do@ccentfalse\relax\fi%
\if##1a^^e1\do@ccentfalse\relax\fi%
\if##1e^^e9\do@ccentfalse\relax\fi%
\if##1\i ^^ed\do@ccentfalse\relax\fi%
\if##1i^^ed\do@ccentfalse\relax\fi%
\if##1o^^f3\do@ccentfalse\relax\fi%
\if##1u^^fa\do@ccentfalse\relax\fi%
\if##1y^^fd\do@ccentfalse\relax\fi%
\if##1N^^8b\do@ccentfalse\relax\fi%
\if##1L^^88\do@ccentfalse\relax\fi%
\if##1R^^8f\do@ccentfalse\relax\fi%
\if##1S^^91\do@ccentfalse\relax\fi%
\if##1Z^^99\do@ccentfalse\relax\fi%
\if##1A^^c1\do@ccentfalse\relax\fi%
\if##1E^^c9\do@ccentfalse\relax\fi%
\if##1I^^cd\do@ccentfalse\relax\fi%
\if##1O^^d3\do@ccentfalse\relax\fi%
\if##1U^^da\do@ccentfalse\relax\fi%
\if##1Y^^dd\do@ccentfalse\relax\fi%
\if##1c^^a2\do@ccentfalse\relax\fi%
\if##1C^^82\do@ccentfalse\relax\fi%
\ifdo@ccent{\accent1 ##1}\fi}%
%
\def\v##1{% check%
\ifmmode\else\ifCorkenc@ding\d@acccheck##1\relax\fi\fi}%
\def\d@acccheck##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1c^^a3\do@ccentfalse\relax\fi%
\if##1e^^a5\do@ccentfalse\relax\fi%
\if##1n^^ac\do@ccentfalse\relax\fi%
\if##1r^^b0\do@ccentfalse\relax\fi%
\if##1s^^b2\do@ccentfalse\relax\fi%
\if##1z^^ba\do@ccentfalse\relax\fi%
\if##1C^^83\do@ccentfalse\relax\fi%
\if##1D^^84\do@ccentfalse\relax\fi%
\if##1E^^85\do@ccentfalse\relax\fi%
\if##1N^^8c\do@ccentfalse\relax\fi%
\if##1R^^90\do@ccentfalse\relax\fi%
\if##1S^^92\do@ccentfalse\relax\fi%
\if##1T^^94\do@ccentfalse\relax\fi%
\if##1Z^^9a\do@ccentfalse\relax\fi%
\ifdo@ccent{\accent7 ##1}\fi}%
%
\def\u##1{% breve%
\ifmmode\else\ifCorkenc@ding\d@accbreve##1\relax\fi\fi}%
\def\d@accbreve##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1a^^a0\do@ccentfalse\relax\fi%
\if##1g^^a7\do@ccentfalse\relax\fi%
\if##1A^^80\do@ccentfalse\relax\fi%
\if##1G^^87\do@ccentfalse\relax\fi%
\ifdo@ccent{\accent8 ##1}\fi}%
%
\def\^##1{% circflx%
\ifmmode\else\ifCorkenc@ding\d@acccircflx##1\relax\fi\fi}%
\def\d@acccircflx##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1a^^e2\do@ccentfalse\relax\fi%
\if##1e^^ea\do@ccentfalse\relax\fi%
\if##1\i ^^ee\do@ccentfalse\relax\fi%
\if##1i^^ee\do@ccentfalse\relax\fi%
\if##1o^^f4\do@ccentfalse\relax\fi%
\if##1u{\catcode`^^fb=11 ^^fb}\do@ccentfalse\relax\fi%FOR \ISOtranslate%
\if##1A^^c2\do@ccentfalse\relax\fi%
\if##1E^^ca\do@ccentfalse\relax\fi%
\if##1I^^ce\do@ccentfalse\relax\fi%
\if##1O^^d4\do@ccentfalse\relax\fi%
\if##1U{\catcode`^^db=11 ^^db}\do@ccentfalse\relax\fi%%FOR \ISOtranslate%
\ifdo@ccent{\accent2 ##1}\fi}%
%
\def\.##1{% dot%
\ifmmode\else\ifCorkenc@ding\d@accdot##1\relax\fi\fi}%
\def\d@accdot##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1z^^bb\do@ccentfalse\relax\fi%
\if##1Z^^9b\do@ccentfalse\relax\fi%
\if##1I^^9d\do@ccentfalse\relax\fi%
\if##1ii\do@ccentfalse\relax\fi%
\ifdo@ccent{\accent10 ##1}\fi}%
%
\def\H##1{% Hung%
\ifmmode\else\ifCorkenc@ding\d@accHung##1\relax\fi\fi}%
\def\d@accHung##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1o^^ae\do@ccentfalse\relax\fi%
\if##1u^^b6\do@ccentfalse\relax\fi%
\if##1O^^8e\do@ccentfalse\relax\fi%
\if##1U^^96\do@ccentfalse\relax\fi%
\ifdo@ccent{\accent5 ##1}\fi}%
%
\def\~##1{% tilde%
\ifmmode\else\ifCorkenc@ding\d@acctilde##1\relax\fi\fi}%
\def\d@acctilde##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1a^^e3\do@ccentfalse\relax\fi%
\if##1n^^f1\do@ccentfalse\relax\fi%
\if##1o{\catcode`^^f5=11 ^^f5}\do@ccentfalse\relax\fi%%FOR \ISOtranslate%
\if##1A^^c3\do@ccentfalse\relax\fi%
\if##1N^^d1\do@ccentfalse\relax\fi%
\if##1O{\catcode`^^d5=11 ^^d5}\do@ccentfalse\relax\fi%%FOR \ISOtranslate%
\ifdo@ccent{\accent3 ##1}\fi}%
%
% The four lines above marked by FOR \ISOtranslate%
% are needed to make the four translated characters%
% available via \~o, \~O, \^u, \^U, respectively.%
% Without the \catcode change, these would be
% translated, too.
%
\def\"##1{% Umlaut%
\ifmmode\else\ifCorkenc@ding\d@accUmlaut##1\relax\fi\fi}%
\def\d@accUmlaut##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1a^^e4\do@ccentfalse\relax\fi%
\if##1e^^eb\do@ccentfalse\relax\fi%
\if##1\i ^^ef\do@ccentfalse\relax\fi%
\if##1i^^ef\do@ccentfalse\relax\fi%
\if##1o^^f6\do@ccentfalse\relax\fi%
\if##1u^^fc\do@ccentfalse\relax\fi%
\if##1A^^c4\do@ccentfalse\relax\fi%
\if##1E^^cb\do@ccentfalse\relax\fi%
\if##1I^^cf\do@ccentfalse\relax\fi%
\if##1O^^d6\do@ccentfalse\relax\fi%
\if##1U^^dc\do@ccentfalse\relax\fi%
\ifdo@ccent{\accent4 ##1}\fi}%
%
\def\c##1{% cedilla%
\ifmmode\else\ifCorkenc@ding\d@acccedilla##1\relax\fi\fi}%
\def\d@acccedilla##1{\do@ccenttrue\relax% \relax helps if ##1 is empty%
\if##1s^^b3\do@ccentfalse\relax\fi%
\if##1t^^b5\do@ccentfalse\relax\fi%
\if##1c^^e7\do@ccentfalse\relax\fi%
\if##1S^^93\do@ccentfalse\relax\fi%
\if##1T^^95\do@ccentfalse\relax\fi%
\if##1C^^c7\do@ccentfalse\relax\fi%
\ifdo@ccent%
\setbox\z@\hbox{##1}\ifdim\ht\z@=1ex\accent11 ##1%
\else{\ooalign{\hidewidth\char11\hidewidth\crcr\unhbox\z@}}\fi%
\fi}%
%
\def\=##1{{\accent9 ##1}}%
\def\b##1{\oalign{##1\crcr\hidewidth%
    \vbox to.2ex{\hbox{\char9}\vss}\hidewidth}}%
%\def\hbar{{\mathchar'11\mkern-9muh}}%
\ec@msaccents%
%
% Define the character codes of the high ASCII characters%
%
  \h@ghupper=128%
  \loop%
    \h@ghlower=\h@ghupper%
    \advance\h@ghlower by 32%
    \catcode\h@ghupper=11%
    \catcode\h@ghlower=11%
    \lccode\h@ghupper=\h@ghlower%
    \uccode\h@ghupper=\h@ghupper%
    \uccode\h@ghlower=\h@ghupper%
    \lccode\h@ghlower=\h@ghlower%
    \sfcode\h@ghlower=1000%
    \sfcode\h@ghupper=999% it was an error in nfot1.def%
   \ifnum \h@ghupper <156%
    \advance \h@ghupper 1%
  \repeat%
  \catcode157=11 \catcode189=12%
  \lccode157=105 \uccode157=157% 157 is I with a dot accent%
  \catcode158=11 \catcode190=12%
  \uccode158=208 \lccode158=158 \sfcode158=999%
  \catcode159=12 \catcode191=12%
  \h@ghupper=192%
  \loop%
    \h@ghlower=\h@ghupper%
    \advance\h@ghlower by 32%
    \catcode\h@ghupper=11%
    \catcode\h@ghlower=11%
    \lccode\h@ghupper=\h@ghlower%
    \uccode\h@ghupper=\h@ghupper%
    \uccode\h@ghlower=\h@ghupper%
    \lccode\h@ghlower=\h@ghlower%
    \sfcode\h@ghlower=1000%
    \sfcode\h@ghupper=999%
   \ifnum \h@ghupper <223%
    \advance \h@ghupper 1%
  \repeat%
%
\ifIS@translate\makeIS@active\fi
%
% Define the Hungarian letters ONLY%
% Uncomment the following code for test purposes%
%
%\catcode225=11 \uccode225=193 \lccode225=225 \sfcode225=1000% \'a %
%\catcode193=11 \uccode193=193 \lccode193=225 \sfcode193=999%  \'A %
%\catcode233=11 \uccode233=201 \lccode233=233 \sfcode233=1000% \'e %
%\catcode201=11 \uccode201=201 \lccode201=233 \sfcode201=999%  \'E %
%\catcode243=11 \uccode243=211 \lccode243=243 \sfcode243=1000% \'o %
%\catcode211=11 \uccode211=211 \lccode211=243 \sfcode211=999%  \'O %
%\catcode246=11 \uccode246=214 \lccode246=246 \sfcode246=1000% \"o %
%\catcode214=11 \uccode214=214 \lccode214=246 \sfcode214=999%  \"O %
%\catcode174=11 \uccode174=142 \lccode174=174 \sfcode174=1000% \H o%
%\catcode142=11 \uccode142=142 \lccode142=174 \sfcode142=999%  \H O%
%\catcode252=11 \uccode252=220 \lccode252=252 \sfcode252=1000% \"u %
%\catcode220=11 \uccode220=220 \lccode220=252 \sfcode220=999%  \"U %
%\catcode250=11 \uccode250=218 \lccode250=250 \sfcode250=1000% \'u %
%\catcode218=11 \uccode218=218 \lccode218=250 \sfcode218=999%  \'U %
%\catcode182=11 \uccode182=150 \lccode182=182 \sfcode182=1000% \H u%
%\catcode150=11 \uccode150=150 \lccode150=182 \sfcode150=999%  \H U%
%\catcode237=11 \uccode237=205 \lccode237=237 \sfcode237=1000% \'\i%
%\catcode205=11 \uccode205=205 \lccode205=237 \sfcode205=999%  \'I %
}% end of \Corkenc@ding%
%
\def\CMenc@ding{%
\Corkenc@dingfalse\relax%
\save@ms%
\chardef\ss="19%
\chardef\ae="1A%
\chardef\oe="1B%
\chardef\o="1C%
\chardef\AE="1D%
\chardef\OE="1E%
\chardef\O="1F%
\chardef\i="10 \chardef\j="11% dotless letters%
\def\aa{\accent23a}%
\def\l{\char32l}%
\def\L{\leavevmode\setbox0\hbox{L}\hbox to\wd0{\hss\char32L}}%
\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}}%
\def\AA{\leavevmode\setbox0\hbox{h}\dimen@\ht0\advance\dimen@-1ex%
  \rlap{\raise.67\dimen@\hbox{\char'27}}A}%
\def\S{\mathhexbox278}%
\let\SS\undefined%
\let\pounds\undefined%
\let\guillemotleft\undefined%  \let\flqq\undefined%
\let\guillemotright\undefined% \let\frqq\undefined%
\let\guilsinglleft\undefined%  \let\flq\undefined%
\let\guilsinglright\undefined% \let\frq\undefined%
\let\quotedblbase\undefined%   \let\glqq\undefined%
\let\quotesinglbase\undefined% \let\glq\undefined%
\let\dq=\undefined%
%
\def\`##1{{\accent18 ##1}}%
\def\'##1{{\accent19 ##1}}%
\def\v##1{{\accent20 ##1}}%
\def\u##1{{\accent21 ##1}}%
\def\=##1{{\accent22 ##1}}%
\def\^##1{{\accent94 ##1}}%
\def\.##1{{\accent95 ##1}}%
\def\H##1{{\accent"7D ##1}}%
\def\~##1{{\accent"7E ##1}}%
\def\"##1{{\accent"7F ##1}}%
\def\b##1{\oalign{##1\crcr\hidewidth%
    \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}%
\def\c##1{\setbox\z@\hbox{##1}\ifdim\ht\z@=1ex\accent24 ##1%
  \else{\ooalign{\hidewidth\char24\hidewidth\crcr\unhbox\z@}}\fi}%
%\def\hbar{{\mathchar'26\mkern-9muh}}%
\ec@msaccents%
%
% Make all high ASCII characters invalid for better error checking%
  \h@ghupper=128%
  \loop%
    \catcode\h@ghupper=15%
    \lccode\h@ghupper=0%
    \uccode\h@ghupper=0%
    \sfcode\h@ghupper=0%
   \ifnum \h@ghupper <255%
    \advance \h@ghupper 1%
  \repeat%
%
% make the Hungarian letters invalid%
% Uncomment the following code for test purposes%
%\catcode225=15 \uccode225=0 \lccode225=0% \'a %
%\catcode193=15 \uccode193=0 \lccode193=0% \'A %
%\catcode233=15 \uccode233=0 \lccode233=0% \'e %
%\catcode201=15 \uccode201=0 \lccode201=0% \'E %
%\catcode243=15 \uccode243=0 \lccode243=0% \'o %
%\catcode211=15 \uccode211=0 \lccode211=0% \'O %
%\catcode246=15 \uccode246=0 \lccode246=0% \"o %
%\catcode214=15 \uccode214=0 \lccode214=0% \"O %
%\catcode174=15 \uccode174=0 \lccode174=0% \H o%
%\catcode142=15 \uccode142=0 \lccode142=0% \H O%
%\catcode252=15 \uccode252=0 \lccode252=0% \"u %
%\catcode220=15 \uccode220=0 \lccode220=0% \"U %
%\catcode250=15 \uccode250=0 \lccode250=0% \'u %
%\catcode218=15 \uccode218=0 \lccode218=0% \'U %
%\catcode182=15 \uccode182=0 \lccode182=0% \H u%
%\catcode150=15 \uccode150=0 \lccode150=0% \H U%
%\catcode237=15 \uccode237=0 \lccode237=0% \'\i%
%\catcode205=15 \uccode205=0 \lccode205=0% \'I %
}% end of \CMenc@ding%
%
% Language switching%
%
\def\hun{% change to Hungarian mode%
\language=\l@magyar%
\Corkenc@ding%
\f@ntdefchange\switcht@ec{\ectenrm}{\ectenrm}}%
%
\def\eng{% change to English mode%
\language=\l@english%
\CMenc@ding\switcht@cm{\tenrm}}%
%
%
\catcode`\@=\atcode% restore \catcode of @%
\ISOtranslateon
\eng% default starting language is English%
% end of ECHUN.TEX%

