% \iffalse meta-comment
%
% Copyright (C) 1993-2024
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% \iffalse
%%% From File: ltoutenc.dtx
%\NeedsTeXFormat{LaTeX2e}[2000/06/01]
%<OT1>\ProvidesFile{ot1enc.def}
%<T1>\ProvidesFile{t1enc.def}
%<OMS>\ProvidesFile{omsenc.def}
%<OML>\ProvidesFile{omlenc.def}
%<OT4>\ProvidesFile{ot4enc.def}
%<TS1>\ProvidesFile{ts1enc.def}[2001/06/05 v3.0e (jk/car/fm)
%<TU>\ProvidesFile{tuenc.def}
%<package>\ProvidesPackage{fontenc}
%<OT1|T1|OMS|OML|OT4|TU|package> [2021/04/29 v2.0v
%<OT1|T1|OMS|OML|OT4|TS1|TU>      Standard LaTeX file]
%<package>                        Standard LaTeX package]
%
%<*driver>
% \fi
\ProvidesFile{ltoutenc.dtx}
             [2024/02/08 v2.1a LaTeX Kernel (font encodings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltoutenc.dtx}
\title{\filename}
\date{\filedate}
\author{%
  Johannes Braams\and
  David Carlisle\and
  Alan Jeffrey\and
  Frank Mittelbach\and
  Chris Rowley\and
  Rainer Sch\"opf}
\usepackage{textcomp}
\begin{document}
 \MaintainedByLaTeXTeam{latex}
 \maketitle
 \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
%
%
% \changes{v1.99e}{2004/02/13}{Documentation fixes: typos}
% \changes{v1.9k}{1998/01/12}{Added \cs{ProvidesPackage}
%    for textcomp.sty}
% \changes{v1.9i}{1997/12/19}{Documentation corrections.}
% \changes{v1.9h}{1997/12/17}{Documentation changes and additions.}
% \changes{v1.9h}{1997/12/17}{Added textcomp.sty.}
% \changes{v1.9f}{1997/08/29}{Added OT4 encoding,
%    provided by Marcin Woli\'nski.}
% \changes{v1.7r}{1995/11/28}{doc fixes}
% \changes{v1.7h}{1995/04/21}{Added \cs{null} \cs{k}  latex/1274}
% \changes{v1.7f}{1994/12/14}{Added braces to \cs{copyright} so it
%    works unbraced in subscripts.}
% \changes{v1.7f}{1994/12/14}{Added check for math mode in
%    \cs{@changed@cmd}.}
% \changes{v1.7f}{1994/12/14}{Commented out \cs{textasciicircum},
%    \cs{textasciitilde}, \cs{textbackslash}, \cs{textbar},
%    \cs{textgreater}, \cs{texthyphenchar}, \cs{texthyphen} and
%    \cs{textless} to save memory.}
% \changes{v1.7e}{1994/12/10}{Added documentation for the OML encoding.}
% \changes{v1.7e}{1994/12/10}{Replaced width with \cs{@width} and
%    ditto height in vrules.}
% \changes{v1.7d}{1994/12/08}{Added \cs{null} and \cs{sh@ft} to \cs{b}
%    and \cs{d}.}
% \changes{v1.7c}{1994/12/05}{Added braces to \cs{textcircled}.}
% \changes{v1.7b}{1994/12/02}{Fixed a bug with \cs{a}.}
% \changes{v1.7a}{1994/11/30}{Added new code for encoding-specific
%    commands.  These now expand in the mouth, which means that
%    ligaturing and kerning can happen.}
% \changes{v1.6i}{1994/11/22}{Fixed empty accents.  Again.}
% \changes{v1.6i}{1994/11/22}{Corrected \cs{dots} so that there's no
%    kerning in monowidth fonts.}
% \changes{v1.6i}{1994/11/22}{Corrected typo with
%    \cs{mathunderscore}.}
% \changes{v1.6h}{1994/11/17}{(DPC) \cs{@tempa} to \cs{reserved@a}}
% \changes{v1.6d}{1994/11/02}{Wrapped lines longer than 70 characters.}
% \changes{v1.6d}{1994/10/30}{Added math commands.}
% \changes{v1.6d}{1994/10/30}{Added OML encoding.}
% \changes{v1.6d}{1994/10/30}{Added \cs{textcircled}.}
% \changes{v1.6d}{1994/10/30}{Added \cs{DeclareTextCompositeCommand}.}
% \changes{v1.6c}{1994/10/29}{Renamed \cs{P}, \cs{S}, \cs{dag} and
%    \cs{ddag} to \cs{textparagraph}, \cs{textsection},
%    \cs{textdagger} and \cs{textdaggerdbl}.}
% \changes{v1.6b}{1994/10/27}{Removed the enc.def files}
% \changes{v1.6a}{1994/10/25}{Added \cs{ProvideTextCommand},
%    \cs{UseTextSymbol},
%    \cs{UseTextAccent},
%    \cs{DeclareTextSymbolDefault},
%    \cs{DeclareTextAccentDefault},
%    \cs{DeclareTextCommandDefault}, and
%    \cs{ProvideTextCommandDefault}.}
% \changes{v1.5m}{1994/10/18}{Added new definitions of \cs{patterns}
%    and \cs{hyphenation}.}
% \changes{v1.5l}{1994/10/07}{Moved the ogonek accent.}
% \changes{v1.5k}{1994/05/18}{Removed braces from \cs{pounds} and
%    \cs{dollar}.}
% \changes{v1.5k}{1994/05/18}{Replaced \cs{defaultencoding} with
%    \cs{encodingdefault}.}
% \changes{v1.5k}{1994/05/18}{Made dotted-i produce `i'.}
% \changes{v1.5j}{1994/05/17}{Added braces to \cs{pounds} so it works
%    as a subscript.}
% \changes{v1.5i}{1994/05/16}{Fixed a bug with \cs{d}.}
% \changes{v1.5h}{1994/05/16}{Added \cs{NG}, \cs{ng}, \cs{TH},
%    \cs{th}, \cs{DH}, \cs{dh}, \cs{DJ} and \cs{dj}.}
% \changes{v1.5h}{1994/05/16}{Added \cs{r} (ring accent) and \cs{k}
%    (ogonek) accents.}
% \changes{v1.5h}{1994/05/16}{Removed \cs{P} from the OT1 definitions
%    file.}
% \changes{v1.5h}{1994/05/16}{Fixed a bug with \cs{pounds}.}
% \changes{v1.5g}{1994/05/16}{Made fontenc.sty use the new mixed-case
%    encoding files.}
% \changes{v1.5f}{1994/05/16}{Revert code so that the encoding
%                    given is used in \cs{DeclareTextCommand} (FMi)}
% \changes{v1.5f}{1994/05/16}{enc files now have uc encoding name
%                             parts (FMi)}
% \changes{v1.5e}{1994/05/14}{Replaced \cs{ENC@cmd} by \cs{ENC-cmd}.}
% \changes{v1.5d}{1994/05/14}{Rewrote \cs{DeclareTextCommand} to define
%    its argument to use the current encoding by default, rather than
%    the encoding provided to \cs{DeclareTextCommand}.}
% \changes{v1.5d}{1994/05/14}{Tidied up the documentation.}
% \changes{v1.5c}{1994/05/14}{Added the fontenc package.}
% \changes{v1.5c}{1994/05/14}{Fixed a bug which caused an infinite loop
%    if \cs{f@encoding} was incorrectly set.}
% \changes{v1.5c}{1994/05/14}{Moved fontsmpl to its own dtx file.}
% \changes{v1.5b}{1994/05/13}{Added \cmd\{, \cmd\} and \cmd\$.}
% \changes{v1.5b}{1994/05/13}
%    {Replaces \cs{space} by `~' in \cs{csname}.}
% \changes{v1.5b}{1994/05/13}{Renamed \cs{DeclareProtectedCommand} to
%    \cs{DeclareRobustCommand}.}
% \changes{v1.5a}{1994/05/11}{Renamed the commands again.  Made the
%    encoding part of the command syntax.  Added the
%    \cs{DeclareTextCommand} interface.  Used
%    \cs{DeclareProtectedCommand}.}
% \changes{v1.4a}{1994/05/01}{Renamed the commands, removed the
%    \cs{EncodingSpecific} command.  Turned all slots into decimal.
%    Added \cs{a}.}
% \changes{v1.4a}{1994/05/01}{Removed Rokicki's encoding.}
% \changes{v1.3d}{1993/12/18}{Some T1 stuff had drifted into the OT1
%    file.}
% \changes{v1.3c}{1993/12/18}{A new syntax, separating
%    accent-definitions from encoding-specific definitions, and
%    allowing encoding-specific \cs{chardef}, \cs{let}, etc.}
% \changes{v1.3c}{1993/12/18}{Rewrote for the new syntax of
%    \cs{EncodingSpecific}.}
% \changes{v1.3b}{1993/12/18}{Corrected typos.}
% \changes{v1.3b}{1993/12/18}{Replaced the missing last argument to
%    \cs{DeclareFontEncoding}.}
% \changes{v1.3a}{1993/12/18}{Replaced OT3 by XXX}
% \changes{v1.3}{1993/12/17}{Added \cs{EncodingSpecificAccent},
%   \cs{EncodingSpecificAccentedLetter} and
%   \cs{EncodingSpecificCommand}.}
% \changes{v1.3}{1993/12/17}{Made Rokicki's encoding a proper encoding
%    scheme rather than a variant of OT1.}
% \changes{v1.2b}{1993/12/13}{Corrected file name in driver code.}
% \changes{v1.2a}{1993/12/11}{Corrected for t1enc, math.}
% \changes{v1.2}{1993/12/10}{Added source code for t1enc.sty.}
% \changes{v1.1}{1993/12/07}{Made all character numbers decimal.}
% \changes{v1.1}{1993/12/07}{Removed a lot of equal signs and the
%   like.}
% \changes{v1.99m}{2015/02/21}
%         {Removed autoload code}
% \changes{v2.0p}{2020/04/22}
%         {corrected \=y unicode value in tuenc.def}
%
%
% \section{Font encodings}
%
%    This section of the kernel contains commands for declaring
%    encoding-specific
%    commands, such as accents.  It also contains the code for some of
%    the encoding files, including |omlenc.def|,
%    |omsenc.def|, |t1enc.def| and |ot1enc.def| files, which define
%    the |OML|,
%    |OMS|, |T1| and |OT1| encodings, and the |fontenc| package
%    for selecting encodings.
%
%    The |fontenc| package has options for encodings, of which the
%    last option is the default encoding.  For example, to use the
%    |OT2|, |OT3| and |T1| encodings, with |T1| as the default, you
%    say:
%\begin{verbatim}
%    \usepackage[OT2,OT3,T1]{fontenc}
%\end{verbatim}
%    The standard kernel set-up loads font encoding files and selects
%    an encoding as follows.
%\begin{verbatim}
%    \input {omlenc.def}
%    \input  {t1enc.def}
%    \input {ot1enc.def}
%    \input {omsenc.def}
%    \fontencoding{OT1}
%\end{verbatim}
%    Note that the files in the standard |inputenc| package depend on
%    this behaviour of the kernel.
%
%    The syntax for declaring encoding-specific commands is:
%    \begin{quote}
%      |\DeclareTextCommand{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}|\\\hspace*{\fill}|[|^^A
%         \meta{number}|][|^^A
%         \meta{default}|]{|^^A
%         \meta{commands}|}|
%    \end{quote}
%    This command is like |\newcommand|, except that it defines a
%    command which is specific to one encoding.  The resulting command
%    is always robust, even if its definition is fragile.  For example,
%    the definition of |\l| in the |OT1| encoding is:
%\begin{verbatim}
%    \DeclareTextCommand{\l}{OT1}{{\@xxxii l}}
%\end{verbatim}
%    |\DeclareTextCommand| takes the same optional arguments as
%    |\newcommand|.
%    \begin{quote}
%      |\ProvideTextCommand{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}|\\\hspace*{\fill}|[|^^A
%         \meta{number}|][|^^A
%         \meta{default}|]{|^^A
%         \meta{commands}|}|
%    \end{quote}
%    This acts like |\DeclareTextCommand|, but does nothing if the
%    command is already defined.
%    \begin{quote}
%      |\DeclareTextSymbol{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{slot}|}|
%    \end{quote}
%    This command defines a text symbol, with a particular slot in that
%    encoding.  The commands:
% \changes{v1.9h}{1997/12/17}{Example corrected, braces removed.}
%\begin{verbatim}
%    \DeclareTextSymbol{\ss}{OT1}{25}
%    \DeclareTextCommand{\ss}{OT1}{\char25 }
%\end{verbatim}
%    have the same effect, but the |\DeclareTextSymbol| is faster.
%    \begin{quote}
%      |\DeclareTextAccent{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{slot}|}|
%    \end{quote}
% \changes{v1.8e}{1996/11/23}{Corrected description}
% \changes{v1.9k}{1997/12/31}{Further correction}
%    This command declares a text accent.  The commands:
%\begin{verbatim}
%    \DeclareTextAccent{\"}{OT1}{127}
%    \DeclareTextCommand{\"}{OT1}{\add@accent {127}}
%\end{verbatim}
%    have the same effect.
% \changes{v1.8c}{1996/10/27}
%      {Corrected syntax descriptions}
%    \begin{quote}
%      |\DeclareTextComposite{|^^A
%          \meta{command}|}|\\\hspace*{\fill}|{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{argument}|}{|^^A
%             \meta{slot}|}|
%    \end{quote}
%    This command declares a composite letter, for example in the |T1|
%    encoding |\'{a}| is slot 225, which is declared by:
%\begin{verbatim}
%    \DeclareTextComposite{\'}{T1}{a}{225}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
%      {Corrected description}
%    The \emph{command} will normally have been declared with
%    |\DeclareTextAccent|, or as a one-argument |\DeclareTextCommand|.
%
%    |\DeclareTextComposite| is the most common example of using
%    the more general declaration
%    |\DeclareTextCompositeCommand|, which can define a composite
%    to be an arbitrary piece of text.
%    \begin{quote}
%      |\DeclareTextCompositeCommand{|^^A
%          \meta{command}|}|\\\hspace*{\fill}|{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{argument}|}{|^^A
%             \meta{text}|}|
%    \end{quote}
%    For example, in the OT1 encoding \r A has a hand-crafted
%    definition this is declared as follows
%\begin{verbatim}
%    \DeclareTextCompositeCommand{\r}{OT1}{A}
%     {\leavevmode\setbox\z@\hbox{!}\dimen@\ht\z@\advance\dimen@-1ex%
%      \rlap{\raise.67\dimen@\hbox{\char23}}A}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
%      {Corrected description}
%    The \emph{command} will normally have been declared with
%    |\DeclareTextAccent|, or as a one-argument |\DeclareTextCommand|.
%
%    The commands defined using the above declarations can be used in
%    two ways.
%    Normally they are used by just calling the command in the
%    appropriate encoding, for example |\ss|.  However, sometimes you
%    may wish to use a command in an encoding where it is not defined.
%    If the command has no arguments, then you can use it in another
%    encoding by calling |\UseTextSymbol|:
%    \begin{quote}
%      |\UseTextSymbol{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{command}|}|
%    \end{quote}
%
% \task{?}{Document the problems of these commands, see pr/3160}
% \changes{v1.9e}{1997/08/05}{Corrected order of arguments in
%          \cs{UseTextSymbol} example.}
%    For example, |\UseTextSymbol{OT1}{\ss}| has the same effect as:
%\begin{verbatim}
%    {\fontencoding{OT1}\selectfont\ss}
%\end{verbatim}
%    If the command has one argument then you can use it in another
%    encoding by calling
%    |\UseTextAccent|:
%    \begin{quote}
%      |\UseTextAccent{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{command}|}{|^^A
%         \meta{text}|}|
%    \end{quote}
%    For example, if the current encoding is |OT2| then
%    |\UseTextAccent{OT1}{\'}{a}| has the same effect as:
%\begin{verbatim}
%    {\fontencoding{OT1}\selectfont\'{\fontencoding{OT2}\selectfont a}}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
%      {Extended description}
%    You can also declare a default definition for a text command, which
%    will be used if the current encoding has no appropriate definition.
%    Such use will also set the definition for this command in the
%    current encoding to equal this default definition; this makes
%    subsequent uses of the command much faster.
%    \begin{quote}
%      |\DeclareTextCommandDefault{|^^A
%         \meta{command}|}{|^^A
%         \meta{definition}|}|
%    \end{quote}
%    For example, the default definition of the command
%    |\textonequarter| (which produces the fraction $\frac14$) could be
%    built using math mode:
%\begin{verbatim}
%    \DeclareTextCommandDefault{\textonequarter}{\ensuremath {\frac14}}
%\end{verbatim}
%    There is a matching |\Provide| command which will not override an
%    existing default definition:
%    \begin{quote}
%      |\ProvideTextCommandDefault{|^^A
%         \meta{command}|}{|^^A
%         \meta{definition}|}|
%    \end{quote}
%    The most common use for these commands is to use symbols from
%    other encodings, so there are some optimizations provided:
%    \begin{quote}
%      |\DeclareTextSymbolDefault{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}|\\
%      |\DeclareTextAccentDefault{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}|
%    \end{quote}
%    are short for:
%    \begin{quote}
%      |\DeclareTextCommandDefault{|^^A
%         \meta{command}|}|\\\hspace*{\fill}^^A
%         |{\UseTextSymbol{|^^A
%         \meta{encoding}|}{|\meta{command}|}}| \\
%      |\DeclareTextCommandDefault[1]{|^^A
%         \meta{command}|}|\\\hspace*{\fill}^^A
%         |{\UseTextAccent{|^^A
%         \meta{encoding}|}{|\meta{command}|}{#1}}|
%    \end{quote}
%    For example, to make |OT1| the default encoding for |\ss| and
%    |\'| you say:
%\begin{verbatim}
%    \DeclareTextSymbolDefault{\ss}{OT1}
%    \DeclareTextAccentDefault{\'}{OT1}
%\end{verbatim}
%    Note that you can use these commands on any zero- or one-argument
%    commands declared with |\DeclareText*| or |\ProvideText*|, not
%    just those defined using |\DeclareTextSymbol| or
%    |\DeclareTextAccent|.
%
% \subsection{Removing encoding-specific commands}
%    \label{sec:removeencspec}
%
% \changes{v1.9o}{1998/03/20}{Documentation added for pr/2783}
%
% In some cases encoding definitions are given to provide some limited
% support since nothing better is available, for example, the definition
% for |\textdollar| in \texttt{OT1} is a hack since \$ and \pounds{}
% actually share the same slot in this encoding. Thus if such a glyph
% becomes available in a different encoding (e.g., \texttt{TS1}) one
% would like to get rid of the flaky one and make the default
% definition point to the new encoding. In such a case defining
%\begin{verbatim}
%   \DeclareTextSymbol{\textdollar}{TS1}{36}
%   \DeclareTextSymbolDefault{\textdollar}{TS1}
%\end{verbatim}
% is not enough since if typesetting in \texttt{OT1} \LaTeX{} will
% still find the encoding specific-definition for \texttt{OT1} and
% therefore ignore the new default.
% Therefore to ensure that in this case the \texttt{TS1} version is
% used  we have to remove the \texttt{OT1} declaration:
%\begin{verbatim}
%   \UndeclareTextCommand{\textdollar}{OT1}
%\end{verbatim}
%
% Since the \$ sign is a proper glyph in the \texttt{T1} encoding there
% is no point removing its definition and forcing \LaTeX{} to pick up
% the \texttt{TS1} version if typesetting in this encoding.
% However, assume you want to use the variant dollar sign,
% i.e., \textdollaroldstyle{}
% for your dollars. In that case you have to get rid of the \texttt{T1}
% declaration as well, e.g., the following would do that for you:
%\begin{verbatim}
%   \UndeclareTextCommand{\textdollar}{OT1}
%   \UndeclareTextCommand{\textdollar} {T1}
%   \DeclareTextCommandDefault{\textdollar}
%                             {\UseTextSymbol{TS1}\textdollaroldstyle}
%\end{verbatim}
%
% \subsection{The order of declarations}\label{sec:orderofdecls}
%
% \changes{v1.9o}{1998/03/20}{Documentation added about order of decls}
%
% If an encoding-specific command is defined for more than one encoding,
% then it will execute fastest in the encoding in which it was defined
% last since its top-level definition will be set up to execute in that
% encoding without any overhead.
%
% For this reason the file \texttt{fonttext.ltx} currently first loads
% the definitions for the \texttt{T1} encoding and then those for the
% \texttt{OT1} encoding so that typesetting in \texttt{OT1} is optimized
% since that is (still) the default. However, when \texttt{T1} is
% explicitly requested (via |\usepackage[T1]{fontenc}|) the
% top-level definitions are automatically changed to favour
% \texttt{T1} since its declarations are reloaded in the process.
%
% For the same reason default declarations should never come last since
% they are implemented as a special encoding themselves (with the
% name |?|).
% Specifying them last would simply mean to make those encoding-specific
% commands equally inefficient in all encodings. Therefore the
% \texttt{textcomp} package, for example, first sets up all defaults
% to point to \texttt{TS1} and then declares the commands in the
% \texttt{TS1} encoding.
%
%
% \MaybeStop{}
%
% \subsection{Docstrip modules}
%
%    This |.dtx| file is be used to generate several related files
%    containing font encoding definitions. The mutually exclusive
%    docstrip options are listed here.
%    \begin{center}
%    \begin{tabular}{lp{10cm}}
%      |T1|       & generates |t1enc.def| for the Cork encoding. \\
%      |TS1|      & generates |ts1enc.def| for the Text Companion
%                   encoding. \\
%      |TS1sty|   & generates |textcomp.sty|, package that sets up use
%                   of the Text Companion encoding. \\
%      |OT1|      & generates |ot1enc.def| for Knuth's CM encoding. \\
%      |OMS|      & generates |omsenc.def| for Knuth's
%                   math symbol encoding. \\
%      |OML|      & generates |omlenc.def| for Knuth's
%                   math letters encoding. \\
%      |OT4|      & generates |ot4enc.def| for the Polish extension to
%                   the OT1 encoding, created by B.~Jackowski and
%                   M.~Ry\'cko for use with the Polish version of
%                   Computer Modern and Computer Concrete.\\
%      |TU|       & generates |tuenc.def| for Unicode font
%                   encoding. \\
%      |package|  & generates |fontenc.sty| for
%                   selecting encodings. \\
%      |2ekernel| & for the kernel commands.\\
%    \end{tabular}
%    \end{center}
% \changes{1.0d}{1993/07/17}{changed \cs{catcoding} @}
% \changes{1.0f}{1993/08/13}{Protected against active @ sign.}
% \changes{1.0g}{1993/08/16}{Needs space after \cs{string}}
% \changes{1.1}{1993/12/07}{Protected all special characters with
%                          \cs{string}.}
% \changes{1.3}{1993/12/17}{Removed the catcode hackery, since the file
%    is only read as a package in the preamble, and removed all the
%    messages on the screen, which just confuse users.  Replaced them
%    by the appropriate \cs{ProvidesPackage} commands. Added XXXenc.}
% \changes{1.3b}{1993/12/18}
%   {Fixed typos with \cs{ProvidesPackage} lines.
%    Added the \cs{NeedsTeXFormat} line.  Added the last argument to
%    \cs{DeclareEncoding}. Moved the use of the encodings to after their
%    declaration. }
% \changes{1.4a}{1994/04/29}{Removed Rokicki's OT1 variant encoding.
%    Moved the driver to the top.}
% \changes{1.5a}{1994/05/11}{Made T1 and OT1 generate packages rather
%    than def files.  Renamed the `package' module to `teststy'.}
% \changes{1.5d}{1994/05/14}{Moved the driver to the top.}
%
% \subsection{Definitions for the kernel}
%
% \subsubsection{Declaration commands}
%
% \changes{1.3}{1993/12/17}{Added this section}
% \changes{1.3c}{1993/12/18}{Split \cs{EncodingSpecificAccent} up into
%    \cs{EncodingSpecific} and \cs{DeclareAccent}.}
% \changes{1.4a}{1994/04/29}{Removed \cs{EncodingSpecific}.  Renamed
%    all the commands.  Added \cs{DeclareTextGlyph} and
%    \cs{UndeclareTextCommand}.}
% \changes{v1.5a}{1994/05/11}{Reimplemented \cs{DeclareTextCommand}
%    using \cs{@changed@cmd} and \cs{DeclareProtectedCommand}.}
% \changes{v1.5c}{1994/05/14}{Fixed a bug which caused an infinite loop
%    if \cs{f@encoding} was incorrectly set.}
% \changes{v1.5d}{1994/05/14}{Rewrote \cs{DeclareTextCommand} to define
%    its argument to use the current encoding by default, rather than
%    the encoding provided to \cs{DeclareTextCommand}.}
% \changes{v1.6a}{1994/10/25}{Added the \cs{Provide} commands,
%    and the default definitions.}
%
% This section contains definitions for commands such as accents which
% depend on the current encoding.  These commands will usually be kept
% in |.def| files, for example |ot1enc.def| contains the definitions
% for the |OT1| encoding.
%    \begin{macrocode}
%<*2ekernel>
\message{font encodings,}
%    \end{macrocode}
%
% \changes{v1.5d}{1994/10/27}{Rewrote \cs{DeclareTextSymbol} to define
%    its argument to use the current encoding by default, to fit with
%    \cs{DeclareTextCommand}.}
%
% \changes{v1.7a}{1994/11/30}{Redefined \cs{@changed@cmd} to expand in
%    the mouth.}
% \changes{v1.7a}{1994/11/30}{Removed \cs{@changed@x@mouth} since
%    \cs{@changed@x} now expands in the mouth.}
%
% \changes{v1.7r}{1995/11/28}{Renamed \cs{@changed@x@err} to
%    \cs{TextSymbolUnavailable}.}
% \changes{v1.7r}{1995/11/28}{Added math mode checks to text commands.}
% Far too many macros in one block here!
% \begin{macro}{\DeclareTextCommand}
% \begin{macro}{\ProvideTextCommand}
% \begin{macro}{\DeclareTextSymbol}
% \begin{macro}{\@dec@text@cmd}
% \begin{macro}{\chardef@text@cmd}
% \begin{macro}{\@changed@cmd}
% \begin{macro}{\@changed@x}
% \begin{macro}{\TextSymbolUnavailable}
% \begin{macro}{\@inmathwarn}
%    If you say:
%\begin{verbatim}
%    \DeclareTextCommand{\foo}{T1}...
%\end{verbatim}
%    then |\foo| is defined to be |\T1-cmd \foo \T1\foo|,
%    where |\T1\foo| is \emph{one} control sequence, not two!
%    We then call |\newcommand| to define |\T1\foo|.
%    \begin{macrocode}
\def\DeclareTextCommand{%
   \@dec@text@cmd\newcommand}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\ProvideTextCommand{%
   \@dec@text@cmd\providecommand}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@dec@text@cmd#1#2#3{%
   \expandafter\def\expandafter#2%
      \expandafter{%
         \csname#3-cmd\expandafter\endcsname
         \expandafter#2%
         \csname#3\string#2\endcsname
      }%
   \let\@ifdefinable\@rc@ifdefinable
   \expandafter#1\csname#3\string#2\endcsname}
%    \end{macrocode}
% \changes{v1.99d}{2004/02/06}{New command added to fix
%     severe bug: pr/3563}
%    This command was introduced to fix a major bug
%    in |\@dec@text@cmd| without changing that command itself.
%    This was thought to be necessary because it is defined
%    in more than one package. (Perhaps the more serious bug is to put
%    complex low-level commands like this in packages?)
%
%    The problem it solves is that whereas both |\newcommand| and
%    |\providecommand| (used just above) both handle the
%    resetting of |\@ifdefinable| (following its disabling in
%    |\@dec@text@cmd|), the primitive |\chardef| neither needs the
%    disabling, nor does the resetting.
%
%    \begin{macrocode}
\def\chardef@text@cmd{%
   \let\@ifdefinable\@@ifdefinable
   \chardef
  }
\def\DeclareTextSymbol#1#2#3{%
   \@dec@text@cmd\chardef@text@cmd#1{#2}#3\relax
  }
%    \end{macrocode}
%
%    The declarations are only available before |\begin{document}|.
% \changes{v1.7h}{1995/05/21}{Added several \cs{@onlypreamble}}
% \changes{v1.7k}{1995/06/05}{Removed \cs{protected@cmd} and replaced
%    with explicit \cs{noexpand}.}
%    \begin{macrocode}
\@onlypreamble\DeclareTextCommand
\@onlypreamble\DeclareTextSymbol
%    \end{macrocode}
%    The sneaky bit in all this is what |\T1-cmd \foo \T1\foo| does.
%    There are five possibilities, depending on the current values of
%    |\protect|, |\cf@encoding| and |\ifmmode|:
%    \begin{itemize}
%    \item If |\protect| is |\@typeset@protect| and |\cf@encoding| is
%       |T1|, then we execute |\T1\foo|.  This should be the normal
%       behaviour, and is optimized for speed.
%    \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
%       (say) |OT1|, and |\OT1\foo| is defined, then we execute
%       |\OT1\foo|.
%    \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
%       (say) |OT1|, we're in text mode,
%       and |\OT1\foo| is undefined, then we define
%       |\OT1\foo| to be the default value of |\foo|, and execute
%       |\OT1\foo|.
%    \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
%       (say) |OT1|, we're in math mode,
%       and |\OT1\foo| is undefined, then we execute the default value
%       of |\foo|.  (This is necessary so that things like
%       |$X_\copyright$| work properly.)
%    \item If |\protect| is not |\@typeset@protect| then we execute
%       |\noexpand\foo|.  For example, if we are writing to a file,
%       then this results in |\foo| being written.  If we are in a
%       |\mark|, then |\foo| will be put in the mark---since |\foo| is
%       robust, it will then survive all the things which may happen
%       to it whilst it's a |\mark|.
%    \end{itemize}
%    So after all that, we will either execute the appropriate
%    definition of |\foo| for the current encoding, or we will execute
%    |\noexpand\foo|.
%
%    The default value of |\foo| is |\?\foo| if it is defined, and an
%    error message otherwise.
%
%    When the encoding is changed from |T1| to |OT1|, |\T1-cmd| is
%    defined to be |\@changed@cmd| and |\OT1-cmd| is defined to be
%    |\@current@cmd|.  This means that the test for what the current
%    encoding is can be performed quickly.
%    \begin{macrocode}
\def\@current@cmd#1{%
   \ifx\protect\@typeset@protect
      \@inmathwarn#1%
   \else
      \noexpand#1\expandafter\@gobble
   \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@changed@cmd#1#2{%
   \ifx\protect\@typeset@protect
      \@inmathwarn#1%
      \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
         \expandafter\ifx\csname ?\string#1\endcsname\relax
            \expandafter\def\csname ?\string#1\endcsname{%
               \TextSymbolUnavailable#1%
            }%
         \fi
         \global\expandafter\let
               \csname\cf@encoding \string#1\expandafter\endcsname
               \csname ?\string#1\endcsname
      \fi
      \csname\cf@encoding\string#1%
         \expandafter\endcsname
   \else
      \noexpand#1%
   \fi}
%    \end{macrocode}
% \changes{v1.7m}{1995/10/09}{Autoload error}
% \changes{v1.7v}{1995/12/05}{Changed \cs{TextSymbolUnavailable} text}
%    \begin{macrocode}
\gdef\TextSymbolUnavailable#1{%
   \@latex@error{%
      Command \protect#1 unavailable in encoding \cf@encoding%
   }\@eha}
%    \end{macrocode}
%    The command |\@inmathwarn| produces a warning message if we are
%    currently in math mode.  Note that since this command is used
%    inside text commands, it can't call |\relax| before the
%    |\ifmmode|.  This means that it is possible for the warning to
%    fail to be issued at the beginning of a row of an halign whose
%    template enters math mode.  This is probably a bad feature, but
%    there's not much that can be done about it, since adding a |\relax|
%    would break ligatures and kerning between text symbols.
%
%    A more efficient solution would be to make |\@inmathwarn| and
%    |\@inmatherr| equal to |\@empty| and |\relax| by default, and
%    to have
%    |\everymath| reset them to their usual definitions.  This is left
%    for future investigation (for example it may break some third
%    party code).
%    \begin{macrocode}
\def\@inmathwarn#1{%
   \ifmmode
      \@latex@warning{Command \protect#1 invalid in math mode}%
   \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v1.7k}{1995/06/05}{Allowed \cs{ProvideTextCommandDefault}
%    after the preamble.}
%
% \begin{macro}{\DeclareTextCommandDefault}
% \begin{macro}{\ProvideTextCommandDefault}
%    These define commands with encoding |?|.
%
%    Note that |\DeclareTextCommandDefault| can only be used in the
%    preamble, but that the |\Provide| version is allowed in inputenc
%    |.def| files, so is allowed anywhere.
%    \begin{macrocode}
\def\DeclareTextCommandDefault#1{%
   \DeclareTextCommand#1?}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\ProvideTextCommandDefault#1{%
   \ProvideTextCommand#1?}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextCommandDefault
%\@onlypreamble\ProvideTextCommandDefault
%    \end{macrocode}
%    They require |\?-cmd| to be initialized as |\@changed@cmd|.
%    \begin{macrocode}
\expandafter\let\csname?-cmd\endcsname\@changed@cmd
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DeclareTextAccent}
% \changes{v1.5a}{1994/05/11}
%      {Reimplemented using \cs{DeclareTextCommand}.}
% \changes{v1.7z}{1996/05/23}
%      {Reimplemented using \cs{add@accent} to save space latex/2133}
%    This is just a disguise for defining a \TeX~|\accent| command.
%    \begin{macrocode}
\def\DeclareTextAccent#1#2#3{%
   \DeclareTextCommand#1{#2}{\add@accent{#3}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextAccent
%    \end{macrocode}
% \end{macro}
%
% \changes{v1.7a}{1994/11/30}{Rewrote \cs{@text@composite} so it
%    allows an empty argument, or an argument containing lots of
%    commands.}
%
%  \begin{macro}{\add@accent}
% \changes{v1.7z}{1996/05/23}{macro added. latex/2133}
% \changes{v1.91}{2000/08/30}{Rearranged but no change to final code,
%    CAR (pr/3160)}
% To save space this code is shared between all text accents that are
% set using the |\accent| primitive.
% The argument is pre-set in a box so that any
% font loading that is needed is already done within the box.
% This is needed because font-loading involves grouping and that would
% prevent the accent mechanism from working so that the accent would
% not be positioned over the argument.
% Declarations that change the font should be allowed (only low-level
% ones are at present) inside the argument of an accent command,
% but not size changes, as they involve |\setbox| operations which
% also inhibit the mechanism of the |\accent| primitive.
%
% Note that the whole process is within a group.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    For a detailed discussion of this reimplementation and its
%    deficiencies, see pr/3160.
% \task{?}{Improve this and document its problems, see pr/3160}
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
%    \begin{macrocode}
\def\add@accent#1#2{\hmode@bgroup
%    \end{macrocode}
%    Turn off the group in |\UseTextSymbol| in case this is used
%    inside the argument of |\add@accent|.
%    \begin{macrocode}
   \let\hmode@start@before@group\@firstofone
   \setbox\@tempboxa\hbox{#2%
%    \end{macrocode}
%    When presetting the argument in a box we record its |\spacefactor|
%    for later use after the accent got typeset. This way something like
%    |\`A| gets the spacefactor of |A| (i.e., 999) rather than the
%    default value of 1000.
% \changes{v1.9q}{1998/06/12}
%    {Explicitly set \cs{spacefactor} after \cs{accent} (pr/2877)}
%    \begin{macrocode}
      \global\mathchardef\accent@spacefactor\spacefactor}%
%    \end{macrocode}
%    The accent primitive doesn't allow things \cs{begingroup} to
%    interfere between accent and base character. Therefore we need to
%    avoid that (they are some hidden inside \cs{maybe@load@fontshape}).
%    As we don't have to load the fontshape in this case
%    (as that already happened in the box above, if necessary), we simply
%    disable that part of the code temporarily.
%    We also ignore \cs{ignorespaces} which has the same issue and may
%    show up as part of \cs{normalfont} if that is used.
% \changes{v2.0m}{2019/12/18}{Avoid code that breaks \cs{accent}}
% \changes{v2.0x}{2021/10/16}{Dont set \cs{spacefactor in math mode gh/643}}
%    \begin{macrocode}
   \let\maybe@load@fontshape\relax
   \let\ignorespaces\relax
   \accent#1 #2\egroup\ifmmode\else\spacefactor\accent@spacefactor\fi}
%    \end{macrocode}
%
%
%    Default definition for |\accent@spacefactor| prevents a horrible
%    death of the above macro inside an unprotected |\edef|.
% \changes{v1.9w}{1999/10/28}{Give \cs{accent@spacefactor} a default
%    definition (pr/3084)}
%    \begin{macrocode}
\let\accent@spacefactor\relax
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\hmode@bgroup}
% \changes{v1.9y}{2000/01/30}{Macro added}
%    \begin{macrocode}
\def\hmode@bgroup{\leavevmode\bgroup}
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\DeclareTextCompositeCommand}
% \changes{v1.7z}{1996/05/23}
%      {Modified to cope with new \cs{add@accent} command: required
%      removal of check for one argument-command}
% \changes{v2.0h}{2017/02/24}{%
%     add check whether the accent command is defined for this encoding}
% \changes{v2.0i}{2017/04/05}{%
%     Declare accent command if not already declared when declaring a composite.}
% \begin{macro}{\DeclareTextComposite}
% \changes{v1.7l}{1995/06/09}{Rewrote \cs{DeclareTextComposite} to
%    define the composite as a no-argument command rather than a
%    two-argument command.}
% \begin{macro}{\@text@composite}
% \begin{macro}{\@text@composite@x}
% \begin{macro}{\@strip@args}
% \changes{v1.8c}{1996/10/27}
%      {Removed macro}
%    Another amusing game to play with |\expandafter|, |\csname|, and
%    |\string|.  When you say
%    |\DeclareTextCompositeCommand{\foo}{T1}{a}{bar}|, we look to see
%    if the expansion of |\T1\foo| begins with |\@text@composite|, and
%    if it doesn't, we redefine |\T1\foo| to be:
%\begin{verbatim}
%    #1 -> \@text@composite \T1\foo #1\@empty \@text@composite {...}
%\end{verbatim}
%    where |...| is the
%    previous definition of |\T1\foo|.  Finally, we define |\\T1\foo-a|
%    to expand to |bar|.
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2017/04/15}{\DeclareTextCompositeCommand}
%<latexrelease>                             {test for undeclared accent}%
%<*2ekernel|latexrelease>
\def\DeclareTextCompositeCommand#1#2#3#4{%
  \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
  \ifx\reserved@a\relax
   \DeclareTextCommand#1{#2}{%
     \@latex@error{\string#1 undeclared in encoding #2}\@eha}%
   \@latex@info{Composite with undeclared \string#1 in encoding #2}%
   \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
  \fi
  \expandafter\expandafter\expandafter\ifx
  \expandafter\@car\reserved@a\relax\relax\@nil \@text@composite \else
      \edef\reserved@b##1{%
         \def\expandafter\noexpand
            \csname#2\string#1\endcsname####1{%
            \noexpand\@text@composite
               \expandafter\noexpand\csname#2\string#1\endcsname
               ####1\noexpand\@empty\noexpand\@text@composite
               {##1}}}%
      \expandafter\reserved@b\expandafter{\reserved@a{##1}}%
   \fi
   \expandafter\def\csname\expandafter\string\csname
      #2\endcsname\string#1-\string#3\@empty\endcsname{#4}%
  }
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}{\DeclareTextCompositeCommand}
%<latexrelease>                            {test for undeclared accent}%
%<latexrelease>\def\DeclareTextCompositeCommand#1#2#3#4{%
%<latexrelease>  \expandafter\let\expandafter\reserved@a
%<latexrelease>                      \csname#2\string#1\endcsname
%<latexrelease>  \expandafter\expandafter\expandafter\ifx
%<latexrelease>  \expandafter\@car\reserved@a\relax\relax\@nil
%<latexrelease>                               \@text@composite \else
%<latexrelease>      \edef\reserved@b##1{%
%<latexrelease>         \def\expandafter\noexpand
%<latexrelease>           \csname#2\string#1\endcsname####1{%
%<latexrelease>           \noexpand\@text@composite
%<latexrelease>             \expandafter\noexpand\csname#2\string#1\endcsname
%<latexrelease>             ####1\noexpand\@empty\noexpand\@text@composite
%<latexrelease>             {##1}}}%
%<latexrelease>      \expandafter\reserved@b\expandafter{\reserved@a{##1}}%
%<latexrelease>   \fi
%<latexrelease>   \expandafter\def\csname\expandafter\string\csname
%<latexrelease>      #2\endcsname\string#1-\string#3\@empty\endcsname{#4}}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextCompositeCommand
%    \end{macrocode}
%    This all works because:
%\begin{verbatim}
%    \@text@composite \T1\foo A\@empty \@text@composite {...}
%\end{verbatim}
%    expands to
%    |\\T1\foo-A| if |\\T1\foo-A| has been defined, and |{...}|
%    otherwise.
%
%    Note that |\@text@composite| grabs the first token of the
%    argument and puts just that in the
%    csname.  This is so that |\'{\textit{e}}| will work---it checks
%    whether |\\T1\'-\textit| is defined (which presumably it isn't)
%    and so expands to |{\accent 1 \textit{e}}|.
%
%    This trick won't always work, for example |\'{{\itshape e}}| will
%    expand to (with spaces added for clarity):
%\begin{verbatim}
%    \csname \string \T1\' - \string {\itshape e} \@empty \endcsname
%\end{verbatim}
%    which will die pretty horribly.  Unfortunately there's not much
%    can be done about this if we're going to use |\csname| lookups as a
%    fast way of accessing composites.
%
%    This has an unfortunate `misfeature' though, which is that in
%    the T1 encoding, |\'{aa}| produces \'a.  This is not the expected
%    behaviour, and should perhaps be fixed if the fix doesn't affect
%    performance too badly.
%
%    Finally, it's worth noting that the |\@empty| is used in
%    |\@text@composite| so that accents will work even when the
%    argument is empty.  If you say |\'{}| then this looks up
%    |\\T1\'-\@empty|, which ought to be |\relax|, and so all is well.
%    If we didn't include the |\@empty|, then |\'{}| would expand to:
%\begin{verbatim}
%    \csname \string \T1\' - \string \endcsname
%\end{verbatim}
%    so the |\endcsname| would be |\string|'ed and the whole of the
%    rest of the document would be put inside the |\csname|.  This
%    would not be good.
%    \begin{macrocode}
\def\@text@composite#1#2#3\@text@composite{%
   \expandafter\@text@composite@x
      \csname\string#1-\string#2\endcsname}
%    \end{macrocode}
%
% \changes{v1.7z}{1996/05/23}
%      {\cs{expandafter} added to match other changes for latex/2133}
% \changes{v1.9r}{1999/01/06}{New impl for latex/2930}
% \changes{v1.9s}{1999/01/13}{Simplified solution for latex/2930}
%    Originally the |\@text@composite@x| macro had two arguments and if
%    |#1| was not |\relax| it was executed, otherwise |#2| was executed.
%    All this happened within the |\ifx| code so that neither |#1|
%    nor |#2| could have picked up any additional arguments form
%    the input stream.
%    This has now being changed using the typical |\@firstoftwo| /
%    |\@secondoftwo| coding. This way the
%    final expansion will happen without any |\else| or |\fi|
%    intervening in the case that we need to get a further token
%    from the input stream.
%    \begin{macrocode}
\def\@text@composite@x#1{%
   \ifx#1\relax
      \expandafter\@secondoftwo
   \else
      \expandafter\@firstoftwo
   \fi
   #1}
%    \end{macrocode}
%    The command |\DeclareTextComposite| uses
%    |\DeclareTextCompositeCommand| to declare a command which
%    expands out to a single glyph.
% \changes{v1.8a}{1996/07/19}
%      {Use char 0 not @ as carrier for \cs{lowercase} /2197}
%    \begin{macrocode}
\catcode\z@=11\relax
%    \end{macrocode}
%
%    \begin{macrocode}
\def\DeclareTextComposite#1#2#3#4{%
   \def\reserved@a{\DeclareTextCompositeCommand#1{#2}{#3}}%
   \bgroup
      \lccode\z@#4%
      \lowercase{%
   \egroup
      \reserved@a ^^@}}
%    \end{macrocode}
%
%    \begin{macrocode}
\catcode\z@=15\relax
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextComposite
%    \end{macrocode}
%
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
%
%
%
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease>                 {\UseTextAccent}{Make commands robust}%
%    \end{macrocode}
%
% \begin{macro}{\UseTextAccent}
% \begin{macro}{\UseTextSymbol}
% \changes{v1.7p}{1995/11/17}{Support \cs{@wrong@font@char} latex/1676}
% \changes{v1.7q}{1995/11/18}{Modify message slightly}
% \begin{macro}{\@use@text@encoding}
% \changes{v1.91}{2000/08/30}{Rearranged but no change to final code,
%    CAR (pr/3160)}
%    These fragile commands access glyphs from different encodings.
%    They use grotty low-level calls to the font selection scheme for
%    speed, and in order to make sure that |\UseTextSymbol| doesn't
%    do anything which you're not allowed to do between an |\accent|
%    and its glyph.
%
%    For a detailed discussion of this reimplementation and its
%    deficiencies, see pr/3160.
% \task{?}{Improve this and document its problems, see pr/3160}
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
% \changes{v2.0r}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
%    \begin{macrocode}
\DeclareRobustCommand*\UseTextAccent[3]{%
  \hmode@start@before@group
   {%
%    \end{macrocode}
%    Turn off the group in |\UseTextSymbol| in case this is used
%    inside the arguments of |\UseTextAccent|.
%    \begin{macrocode}
    \let\hmode@start@before@group\@firstofone
    \let\@curr@enc\cf@encoding
    \@use@text@encoding{#1}%
    #2{\@use@text@encoding\@curr@enc#3}%
   }}
%    \end{macrocode}
%
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
% \changes{v2.0r}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
%    \begin{macrocode}
\DeclareRobustCommand*\UseTextSymbol[2]{%
       \hmode@start@before@group
       {%
          \def\@wrong@font@char{\MessageBreak
             for \noexpand\symbol`\string#2'}%
          \@use@text@encoding{#1}%
          #2%
       }%
    }
%    \end{macrocode}
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\UseTextAccent}{Make commands robust}%
%<latexrelease>
%<latexrelease>\kernel@make@fragile\UseTextAccent
%<latexrelease>\kernel@make@fragile\UseTextSymbol
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%    Switch to a different text encoding without any grouping for use in
%    \cs{UseTextAccent} or \cs{UseTextSymbol} (and for \cs{oldstylenums}).
%    \begin{macrocode}
\def\@use@text@encoding#1{%
   \edef\f@encoding{#1}%
   \xdef\font@name{%
      \csname\curr@fontshape/\f@size\endcsname}%
   \pickup@font
   \font@name
   \@@enc@update}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\hmode@start@before@group}
%    The |\hmode@start@before@group| starts hmode and should be
%    immediately followed by an explicit |{...}|. Its purpose is to
%    ensure that hmode is started before this group  is opened. Inside
%    |\add@accent| and |\UseTextAccent| it is redefined to remove this
%    group so that it doesn't conflict with the |\accent| primitive.
%
%    For a detailed discussion see pr/3160.
% \changes{v1.9z}{2000/01/30}{Macro added (pr/3160)}
%    \begin{macrocode}
\let\hmode@start@before@group\leavevmode
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DeclareTextSymbolDefault}
% \begin{macro}{\DeclareTextAccentDefault}
%    Some syntactic sugar.  Again, these should probably be optimized
%    for speed.
%    \begin{macrocode}
\def\DeclareTextSymbolDefault#1#2{%
   \DeclareTextCommandDefault#1{\UseTextSymbol{#2}#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\DeclareTextAccentDefault#1#2{%
   \DeclareTextCommandDefault#1{\UseTextAccent{#2}#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextSymbolDefault
\@onlypreamble\DeclareTextAccentDefault
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\UndeclareTextCommand}
%    This command safely removes an encoding specific declaration
%    for a given encoding. It is helpful if one intends to use the
%    default definition always and therefore wants to get rid of
%    a declaration for some specific encoding.
% \changes{v1.9o}{1998/03/20}{Macro added for pr/2783}
%    \begin{macrocode}
\def\UndeclareTextCommand#1#2{%
%    \end{macrocode}
%    If there is no declaration for the current encoding do nothing.
%    (This makes a hash table entry but without e\TeX{} we can't do
%    anything about that).
%    \begin{macrocode}
  \expandafter\ifx\csname#2\string#1\endcsname\relax
  \else
%    \end{macrocode}
%    Else: throw away that declaration.
%    \begin{macrocode}
     \global\expandafter\let\csname#2\string#1\endcsname
            \@undefined
%    \end{macrocode}
%    But this is unfortunately not enough, we have to take a look
%    at the top-level definition of the encoding specific command
%    which for a command |\foo| would look similar to
%    |\T1-cmd \foo \T1\foo| (three tokens).
%
%    Of course, instead of |T1| one could see a different encoding name;
%    which one depends the encoding for which |\foo| was declared
%    last.
%
%    Now assume we have just removed the declaration for |\foo| in |T1|
%    and the top-level of |\foo| expands to the above. Then we better
%    change that pretty fast otherwise we do get an ``undefined csname
%    error'' when we try to typeset |\foo| within |T1| instead of
%    getting the default definition for |\foo|.
%    And what is the best way to change that top-level definition? Well,
%    the only ``encoding'' we know for sure will still be around is
%    the default encoding denoted by |?|.
%
%    Thus in case the last token of the top-level expansion
%    is now undefined we change the declaration to look like
%    |\?-cmd \foo \?\foo| which is done by the following
%    (readable?) code:
%    \begin{macrocode}
     \expandafter\expandafter\expandafter
     \ifx\expandafter\@thirdofthree#1\@undefined
       \expandafter\gdef\expandafter#1\expandafter
          {\csname ?-cmd\expandafter\endcsname\expandafter
           #1\csname?\string#1\endcsname}%
     \fi
 \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\UndeclareTextCommand
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Hyphenation}
%
% \changes{v1.5l}{1994/10/18}{Added new definitions of \cs{patterns}
%    and \cs{hyphenation}.}
% \changes{v1.6g}{1994/11/05}{Added setting of \cs{@typeset@protect}
%    to \cs{patterns} and \cs{hyphenation}.}
% \changes{v1.6g}{1994/11/30}{Removed new definitions of \cs{patterns}
%    and \cs{hyphenation}, since encoding-specific commands now expand
%    in the mouth.}
%
% \begin{macro}{\patterns}
% \begin{macro}{\@@patterns}
% \begin{macro}{\hyphenation}
% \begin{macro}{\@@hyphenation}
%    We redefine |\patterns| and |\hyphenation| to allow the use of
%    commands declared with |\DeclareText*| to be used inside them.
%    \begin{macrocode}
%\let\@@patterns\patterns
%\let\@@hyphenation\hyphenation
%\def\patterns{%
%   \bgroup
%      \let\protect\@empty
%      \let\@typeset@protect\@empty
%      \let\@changed@x\@changed@x@mouth
%   \afterassignment\egroup
%   \@@patterns
%}
%\def\hyphenation{%
%   \bgroup
%      \let\protect\@empty
%      \let\@typeset@protect\@empty
%      \let\@changed@x\@changed@x@mouth
%   \afterassignment\egroup
%   \@@hyphenation
%}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{Miscellania}
%
% \changes{1.4a}{1994/05/01}{Added the \cs{a} command.}
% \changes{1.7a}{1994/11/30}{Redefined \cs{a} for the new scheme.}
% \changes{1.7b}{1994/12/02}{Redefined \cs{a} properly.}
% \changes{1.7g}{1995/03/03}{Corrected an error in documentation
%               referring to the tabular rather than the tabbing
%               environment.}
% \changes{v1.7n}{1995/11/02}{Changed internal name \cs{a} to
% \cs{@tabacckludge} to protect against redefinition by malicious
% users.}
%
% \begin{macro}{\a}
%    The |\a| command is used to access the accent commands even when
%    they have been redefined (for example by the |tabbing|
%    environment). Its internal name is |\@tabacckludge|.
%
%    The |\string| within the |\csname| guards against something
%    like |'| being active at the point of use.
% \changes{v1.9r}{1998/09/19}{Added \cs{string} (pr/2878)}
%    \begin{macrocode}
\def\@tabacckludge#1{\expandafter\@changed@cmd
                                 \csname\string#1\endcsname\relax}
\let\a=\@tabacckludge
%    \end{macrocode}
% \end{macro}
%
% \changes{v1.6a}{1994/10/25}{Added the files OT1enc.def, T1enc.def and
%    OMSenc.def.}
% \changes{v1.6b}{1994/10/27}{Removed the files OT1enc.def, T1enc.def
%    and OMSenc.def.}
%
% \subsubsection{Default encodings}
%
% We define the default encodings for most commands to be either OT1,
% OML or OMS.  These defaults are in the kernel and therefore
% fonts with these encodings must be available unless these
% defaults are redefined elsewhere.  Recall that the standard kernel
% loads the encoding files for these encodings, and also that for
% the T1 encoding.
%
% The naming conventions in the kernel are not what we would use if we
% were starting from scratch\dots\
% Those defined by DEK (like |\ae| and |\ss|) or by the \TeX{} Users
% Group Technical Working Group on multi-lingual typesetting (like
% |\th| and |\ng|) have short names.  Those which were added to the
% kernel in 1993 and early 1994 are named after their Adobe glyph
% names (like |\guillemotleft| and |\quotedblbase|).  Unfortunately,
% this naming scheme won't work for all glyphs, since some names (like
% |\space|) are already used, and some (like |\endash|) are very
% likely to be defined by users.  So we're now using the naming scheme
% of |\text| followed by the Adobe name, (like |\textendash| and
% |\textsterling|).  Except that some glyphs don't have Adobe names,
% so we're using the names used by fontinst for those (like
% |\textcompwordmark|).  Sigh.
%
% \changes{v1.6a}{1994/10/25}{Added the defaults.}
% \changes{v1.6b}{1994/10/27}{Added more defaults for OT1.}
% \changes{v1.6c}{1994/10/29}{Added commands like \cs{dots} for use in
%    text and math.}
%
% Some accents from OT1:
%    \begin{macrocode}
\DeclareTextAccentDefault{\"}{OT1}
\DeclareTextAccentDefault{\'}{OT1}
\DeclareTextAccentDefault{\.}{OT1}
\DeclareTextAccentDefault{\=}{OT1}
\DeclareTextAccentDefault{\H}{OT1}
\DeclareTextAccentDefault{\^}{OT1}
\DeclareTextAccentDefault{\`}{OT1}
\DeclareTextAccentDefault{\b}{OT1}
\DeclareTextAccentDefault{\c}{OT1}
\DeclareTextAccentDefault{\d}{OT1}
\DeclareTextAccentDefault{\r}{OT1}
\DeclareTextAccentDefault{\u}{OT1}
\DeclareTextAccentDefault{\v}{OT1}
\DeclareTextAccentDefault{\~}{OT1}
%    \end{macrocode}
% Some symbols from OT1:
% \changes{v1.8c}{1996/10/27}
%      {Removed \cs{aa} and \cs{AA}}
%    \begin{macrocode}
%\DeclareTextSymbolDefault{\AA}{OT1}
\DeclareTextSymbolDefault{\AE}{OT1}
\DeclareTextSymbolDefault{\L}{OT1}
\DeclareTextSymbolDefault{\OE}{OT1}
\DeclareTextSymbolDefault{\O}{OT1}
%\DeclareTextSymbolDefault{\aa}{OT1}
\DeclareTextSymbolDefault{\ae}{OT1}
\DeclareTextSymbolDefault{\i}{OT1}
\DeclareTextSymbolDefault{\j}{OT1}
%    \end{macrocode}
% \changes{v1.99h}{2005/11/08}
%      {Added \cs{ij} and \cs{IJ} from babel. (pr/3771)}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\ij}{OT1}
\DeclareTextSymbolDefault{\IJ}{OT1}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\l}{OT1}
\DeclareTextSymbolDefault{\oe}{OT1}
\DeclareTextSymbolDefault{\o}{OT1}
\DeclareTextSymbolDefault{\ss}{OT1}
\DeclareTextSymbolDefault{\textdollar}{OT1}
\DeclareTextSymbolDefault{\textemdash}{OT1}
\DeclareTextSymbolDefault{\textendash}{OT1}
\DeclareTextSymbolDefault{\textexclamdown}{OT1}
%\DeclareTextSymbolDefault{\texthyphenchar}{OT1}
%\DeclareTextSymbolDefault{\texthyphen}{OT1}
\DeclareTextSymbolDefault{\textquestiondown}{OT1}
\DeclareTextSymbolDefault{\textquotedblleft}{OT1}
\DeclareTextSymbolDefault{\textquotedblright}{OT1}
\DeclareTextSymbolDefault{\textquoteleft}{OT1}
\DeclareTextSymbolDefault{\textquoteright}{OT1}
\DeclareTextSymbolDefault{\textsterling}{OT1}
%    \end{macrocode}
% Some symbols from OMS:
% \changes{v1.7t}{1995/11/29}{Added \cs{textbackslash} and
%    \cs{textbar}.}
% \changes{v1.8c}{1996/10/27}
%      {Added \cs{textasteriskcentered}}
% \changes{v1.95}{2002/06/16}{Added default for \cs{textbardbl} (pr/3400)}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textasteriskcentered}{OMS}
\DeclareTextSymbolDefault{\textbackslash}{OMS}
\DeclareTextSymbolDefault{\textbar}{OMS}
\DeclareTextSymbolDefault{\textbardbl}{OMS}
\DeclareTextSymbolDefault{\textbraceleft}{OMS}
\DeclareTextSymbolDefault{\textbraceright}{OMS}
\DeclareTextSymbolDefault{\textbullet}{OMS}
\DeclareTextSymbolDefault{\textdaggerdbl}{OMS}
\DeclareTextSymbolDefault{\textdagger}{OMS}
\DeclareTextSymbolDefault{\textparagraph}{OMS}
\DeclareTextSymbolDefault{\textperiodcentered}{OMS}
\DeclareTextSymbolDefault{\textsection}{OMS}
\DeclareTextAccentDefault{\textcircled}{OMS}
%    \end{macrocode}
%
% \changes{v1.6d}{1994/10/30}{Added OML encoding.}
% \changes{v1.6d}{1994/10/30}{Made \cs{textless} and \cs{textgreater}
%    come from OML.}
% \changes{v1.6d}{1994/10/30}{Added \cs{t}.}
% \changes{v1.7k}{1995/06/05}{Commented out \cs{textless} and
%    \cs{textgreater}.}
%
% Some symbols from OML:
% \changes{v1.7t}{1995/11/29}{Added \cs{textless} and
%    \cs{textgreater}.}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textless}{OML}
\DeclareTextSymbolDefault{\textgreater}{OML}
\DeclareTextAccentDefault{\t}{OML}
%    \end{macrocode}
%
% \changes{v1.6d}{1994/10/30}{Added \cs{textcircled}.}
% \changes{v1.6d}{1994/10/30}{Rewrote \cs{copyright} to use
%    \cs{textcircled}.}
% \changes{v1.6d}{1994/10/30}{Removed \cs{textregistered}.}
% \changes{v1.7k}{1995/06/05}{Save some tokens in
%    \cs{textvisiblespace} and \cs{textunderscore}.}
% \changes{v1.7t}{1995/11/29}{Added \cs{textasciicircum},
%    \cs{textasciitilde}, \cs{textregistered} and \cs{texttrademark}.}
% \changes{v1.7u}{1995/12/01}{Made \cs{SS} a Default, rather than
%    having the default point to the OT1 definition.}
% \changes{v1.7w}{1995/12/11}{Modified \cs{copyright}}
% \changes{v1.9a}{1997/04/30}{Introduced \cs{textcopyright} and modified
%                             \cs{copyright}}
%
% Some defaults we can fake.
%
% The interface for defining |\copyright| changed, it used to
% use |\expandafter| to add braces at the appropriate points.
% \begin{macrocode}
\DeclareTextCommandDefault{\textcopyright}{\textcircled{c}}
% \expandafter\def\expandafter
%                 \copyright\expandafter{\expandafter{\copyright}}
%    \end{macrocode}
%
% \changes{v1.9a}{1997/04/30}{Modified \cs{textunderscore}, removing
%                                    \cs{mathunderscore}}
% \changes{v1.9b}{1997/04/30}{Added \cs{leavevmode} to
%                                   \cs{textunderscore}}
% \changes{v1.9d}{1997/05/07}{Added \cs{leavevmode} to
%                                   \cs{textcompwordmark}}
%    \begin{macrocode}
\DeclareTextCommandDefault{\textasciicircum}{\^{}}
\DeclareTextCommandDefault{\textasciitilde}{\~{}}
\DeclareTextCommandDefault{\textunderscore}{%
  \leavevmode \kern.06em\vbox{\hrule\@width.3em}}
%    \end{macrocode}
%
%    There is no good reason anymore to fake \cs{textcompwordmark}.
% \changes{v2.0m}{2019/12/18}{Don't fake \cs{textcompwordmark}; take
%    default from T1 instead}
%    \begin{macrocode}
%\DeclareTextCommandDefault{\textcompwordmark}{\leavevmode\kern\z@}
\DeclareTextSymbolDefault{\textcompwordmark}{T1}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextCommandDefault{\textvisiblespace}{%
   \mbox{\kern.06em\vrule \@height.3ex}%
   \vbox{\hrule \@width.3em}%
   \hbox{\vrule \@height.3ex}}
%    \end{macrocode}
%
%    Using |\fontdimen3| in the next definition is some sort of a
%    kludge (since it is the interword stretch) but it makes the
%    ellipsis come out right in mono-spaced fonts too (since there it
%    is zero).
%    \begin{macrocode}
\DeclareTextCommandDefault{\textellipsis}{%
   .\kern\fontdimen3\font
   .\kern\fontdimen3\font
   .\kern\fontdimen3\font}
%    \end{macrocode}
%
% \changes{v1.9a}{1997/04/30}{Changed \cs{textsc} to \cs{scshape}}
% \changes{v1.95}{2002/06/18}{Changed def for \cs{textregistered} to
%    avoid small caps (pr/3420)}
%    \begin{macrocode}
%\DeclareTextCommandDefault{\textregistered}{\textcircled{\scshape r}}
\DeclareTextCommandDefault{\textregistered}{\textcircled{%
     \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
\DeclareTextCommandDefault{\texttrademark}{\textsuperscript{TM}}
\DeclareTextCommandDefault{\SS}{SS}
%    \end{macrocode}
%
% \changes{v1.9n}{1998/03/05}{Added masc/fem ords as in pr/2579}
%    \begin{macrocode}
\DeclareTextCommandDefault{\textordfeminine}{\textsuperscript{a}}
\DeclareTextCommandDefault{\textordmasculine}{\textsuperscript{o}}
%    \end{macrocode}
%
% \subsubsection{Math material}
%
%    Some commands can be used in both text and math mode:
%    \begin{macrocode}
\DeclareRobustCommand{\$}{\ifmmode\mathdollar\else\textdollar\fi}
%    \end{macrocode}
%    We use \cs{protected} not \cs{DeclareRobustCommand} so that
%    \verb=\bigl\{= etc.\ works inside \cs{protected@edef}.
% \changes{v2.0n}{2020/01/20}{fix for gh/251}
%    \begin{macrocode}
\protected\def\{{\ifmmode\lbrace\else\textbraceleft\fi}
\protected\def\}{\ifmmode\rbrace\else\textbraceright\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareRobustCommand{\P}{\ifmmode\mathparagraph\else\textparagraph\fi}
\DeclareRobustCommand{\S}{\ifmmode\mathsection\else\textsection\fi}
\DeclareRobustCommand{\dag}{\ifmmode{\dagger}\else\textdagger\fi}
\DeclareRobustCommand{\ddag}{\ifmmode{\ddagger}\else\textdaggerdbl\fi}
%    \end{macrocode}
%
% For historical reasons |\copyright|
% needs |{}| around the definition in maths.
%
% \changes{v1.6f}{1994/11/04}{Added \cmd\_.}
%
% \changes{v1.9a}{1997/04/30}{Modified \cs{underscore}, removing
%                                    \cs{mathunderscore}}
% \changes{v1.9a}{1997/04/30}{Introduced \cs{textcopyright} and modify
%                             \cs{copyright}}
%    \begin{macrocode}
\DeclareRobustCommand{\_}{%
   \ifmmode\nfss@text{\textunderscore}\else\textunderscore\fi}
\DeclareRobustCommand{\copyright}{%
   \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
\DeclareRobustCommand{\pounds}{%
   \ifmmode\mathsterling\else\textsterling\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareRobustCommand{\dots}{%
   \ifmmode\mathellipsis\else\textellipsis\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\ldots\dots
%    \end{macrocode}
% \changes{v1.99m}{2015/02/16}{Added \cs{textcommabelow} latex/4414}
% Default definition of the commabelow accent.
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/10/01}{\textcommabelow}{comma accent}%
%<*2ekernel|latexrelease>
\DeclareTextCommandDefault\textcommabelow[1]
  {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex
   \hbox{\check@mathfonts\fontsize\ssf@size\z@
   \math@fontsfalse\selectfont,}\hidewidth}\egroup}
%<latexrelease>\EndIncludeInRelease
%</2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{0000/00/00}{\textcommabelow}{comma accent}%
%<latexrelease>\let\textcommabelow\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-G\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-K\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-k\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-L\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-l\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-N\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-n\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-R\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-r\endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
% \changes{v1.99n}{2015/02/16}{Added \cs{textcommaabove}}
% Default definition of the commaabove accent(E.G.).
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{2016/02/01}{\textcommaabove}{comma above}%
%<*2ekernel|latexrelease>
\DeclareTextCommandDefault\textcommaabove[1]{%
  \hmode@bgroup
  \ooalign{%
    \hidewidth
    \raise.7ex\hbox{%
      \check@mathfonts\fontsize\ssf@size\z@\math@fontsfalse\selectfont`%
    }%
   \hidewidth\crcr
   \null#1\crcr
  }%
  \egroup
}
%<latexrelease>\EndIncludeInRelease
%</2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{0000/00/00}{\textcommaabove}{comma above}%
%<latexrelease>\let\textcommaabove\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\OT1\string\c-g\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-g\endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
% \changes{v1.6d}{1994/10/30}{Moved math commands here from ltmath.}
% \changes{v1.6f}{1994/11/04}{Added \cs{mathunderscore}.}
% \changes{v1.7k}{1995/06/05}{Moved math commands to fontdef.dtx.}
%
%
% \changes{1.4a}{1994/05/01}{Added the \cs{SaveAtCatcode} and
%    \cs{RestoreAtCatcode} commands.}
%
% \changes{1.5a}{1994/05/12}{Removed the \cs{SaveAtCatcode} and
%    \cs{RestoreAtCatcode} commands.}
%
%
% \subsection{Definitions for the OT1 encoding}
%
% \changes{1.3}{1993/12/17}{Removed all the hackery for use in
%    \cs{DeclareFontEncoding}, and redid everything using
%    \cs{DeclareTextFoo}.}
% \changes{1.3b}{1993/12/18}{Replaced the missing last argument to
%    \cs{DeclareFontEncoding}.}
% \changes{1.3c}{1993/12/18}{Rewrote for the new syntax of
%    \cs{EncodingSpecific}.}
% \changes{1.4a}{1994/05/01}{Rewrote for the new syntax.}
% \changes{1.5a}{1994/05/12}{Rewrote for the new syntax.}
% \changes{1.5h}{1994/05/16}{\cs{pounds} was still using u rather than
%    ui shape.}
% \changes{1.6b}{1994/10/27}{Added:
%   \cs{textemdash}
%   \cs{textendash}
%   \cs{textexclamdown}
%   \cs{texthyphenchar}
%   \cs{texthyphen}
%   \cs{textquestiondown}
%   \cs{textquotedblleft}
%   \cs{textquotedblright}
%   \cs{textquoteleft}
%   \cs{textquoteright}
% }
%
% The definitions for the `\TeX{} text' (OT1) encoding.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*OT1>
\DeclareFontEncoding{OT1}{}{}
%    \end{macrocode}
%    Declare the accents.
%    \begin{macrocode}
\DeclareTextAccent{\"}{OT1}{127}
\DeclareTextAccent{\'}{OT1}{19}
\DeclareTextAccent{\.}{OT1}{95}
\DeclareTextAccent{\=}{OT1}{22}
\DeclareTextAccent{\^}{OT1}{94}
\DeclareTextAccent{\`}{OT1}{18}
\DeclareTextAccent{\~}{OT1}{126}
\DeclareTextAccent{\H}{OT1}{125}
\DeclareTextAccent{\u}{OT1}{21}
\DeclareTextAccent{\v}{OT1}{20}
\DeclareTextAccent{\r}{OT1}{23}
%    \end{macrocode}
%    Some accents have to be built by hand:
%    Note that |\ooalign| and |\o@lign| must be inside a group.
% \changes{v1.7j}{1995/05/21}{Updated some plain macros}
% \changes{v1.7o}{1995/11/07}{Added \cs{leavevmode} at start of
% \cs{c}, otherwise the output routine might be invoked within the
% macro.}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
% \changes{v1.99g}{2005/09/27}{Replace \cs{sh@ft} by \cs{ltx@sh@ft}}
%  In these definitions we no longer use the helper function |\sh@ft|
%  from plain.tex since that now has two incompatible definitions.
%    \begin{macrocode}
\DeclareTextCommand{\b}{OT1}[1]
   {\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
     \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}\egroup}
\DeclareTextCommand{\c}{OT1}[1]
   {\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
    \else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi}
\DeclareTextCommand{\d}{OT1}[1]
   {\hmode@bgroup
    \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
%    \end{macrocode}
%
%    Declare the text symbols.
%    \begin{macrocode}
\DeclareTextSymbol{\AE}{OT1}{29}
\DeclareTextSymbol{\OE}{OT1}{30}
\DeclareTextSymbol{\O}{OT1}{31}
\DeclareTextSymbol{\ae}{OT1}{26}
\DeclareTextSymbol{\i}{OT1}{16}
\DeclareTextSymbol{\j}{OT1}{17}
\DeclareTextSymbol{\oe}{OT1}{27}
\DeclareTextSymbol{\o}{OT1}{28}
\DeclareTextSymbol{\ss}{OT1}{25}
\DeclareTextSymbol{\textemdash}{OT1}{124}
\DeclareTextSymbol{\textendash}{OT1}{123}
%    \end{macrocode}
%    
%    The \verb=\nobreak\hskip\z@= is there to prevent a break after
%    the hyphen but allow later breaks in the remainder of the word. 
% \changes{v2.0u}{2021/02/19}{Add \cs{textnonbreakinghyphen}, \cs{textfiguredash}
%      and \cs{texthorizontalbar} (gh/404)}
%    \begin{macrocode}
\DeclareTextCommand{\textnonbreakinghyphen}{OT1}{\mbox{-}\nobreak\hskip\z@}
\DeclareTextCommand{\textfiguredash}       {OT1}{\textendash}
\DeclareTextCommand{\texthorizontalbar}    {OT1}{\textemdash}
%    \end{macrocode}
%
%    Using the ligatures helps with OT1 fonts that have
%    |\textexclamdown| and |\textquestiondown| in unusual positions.
% \changes{v1.95}{2002/06/17}{Definition of \cs{textexclamdown} changed (pr/3368)}
% \changes{v1.95}{2002/06/17}{Definition of \cs{textquestiondown} changed (pr/3368)}
%    \begin{macrocode}
%\DeclareTextSymbol{\textexclamdown}{OT1}{60}
%\DeclareTextSymbol{\textquestiondown}{OT1}{62}
\DeclareTextCommand{\textexclamdown}{OT1}{!`}
\DeclareTextCommand{\textquestiondown}{OT1}{?`}
%\DeclareTextSymbol{\texthyphenchar}{OT1}{`\-}
%\DeclareTextSymbol{\texthyphen}{OT1}{`\-}
\DeclareTextSymbol{\textquotedblleft}{OT1}{92}
\DeclareTextSymbol{\textquotedblright}{OT1}{`\"}
\DeclareTextSymbol{\textquoteleft}{OT1}{`\`}
\DeclareTextSymbol{\textquoteright}{OT1}{`\'}
%    \end{macrocode}
%    Some symbols which are faked from others:
% \changes{v1.7o}{1995/11/07}{Changed \cs{char}32 to \cs{@xxxii} (two
% tokens less).}
% \changes{v1.7o}{1995/11/07}{Replaced octal number 27 by decimal
% number 23 to protect against the quote character being active.}
% \changes{v1.7o}{1995/11/07}{Replaced some 0's by \cs{z@} (faster).}
% \changes{v1.8c}{1996/10/27}
%      {Removed \cs{aa} and \cs{AA}}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
% \DeclareTextCommand{\aa}{OT1}
%    {{\accent23a}}
\DeclareTextCommand{\L}{OT1}
   {\leavevmode\setbox\z@\hbox{L}\hb@xt@\wd\z@{\hss\@xxxii L}}
\DeclareTextCommand{\l}{OT1}
   {\hmode@bgroup\@xxxii l\egroup}
% \DeclareTextCommand{\AA}{OT1}
%    {\leavevmode\setbox\z@\hbox{h}\dimen@\ht\z@\advance\dimen@-1ex%
%     \rlap{\raise.67\dimen@\hbox{\char23}}A}
%    \end{macrocode}
%    In the OT1 encoding \r A has a hand-crafted definition, so we
%    have here the first recorded explicit use of
%    |\DeclareTextCompositeCommand|.
% \changes{v1.8c}{1996/10/27}
%      {Added \cs{r} A}
% \changes{v1.96}{2002/10/28}{%
%   coding change, to follow bug fix by DEK in plain.tex (pr/3469)}
% \changes{v2.0f}{2017/02/19}{%
%     add \cs{@empty} to guard against 3rd argument being empty}
%    \begin{macrocode}
\DeclareTextCompositeCommand{\r}{OT1}{A}
   {\leavevmode\setbox\z@\hbox{!}\dimen@\ht\z@\advance\dimen@-1ex%
    \rlap{\raise.67\dimen@\hbox{\char23}}A}
%    \end{macrocode}
% \changes{v1.99h}{2005/11/08}
%      {Added \cs{ij} and \cs{IJ} from babel. (pr/3771)}
%    The dutch language uses the letter `ij'. It is available in
%    \texttt{T1} encoded fonts, but not in the \texttt{OT1} encoded
%    fonts. Therefore we fake it for the \texttt{OT1} encoding.
% \changes{v2.0w}{2021/09/12}{Move zero skip between
%        i and j for hyphenation (gh/658)}
%    \begin{macrocode}
\DeclareTextCommand{\ij}{OT1}{%
  \nobreak\hskip\z@skip i\kern-0.02em\nobreak\hskip\z@skip j}
\DeclareTextCommand{\IJ}{OT1}{%
  \nobreak\hskip\z@skip I\kern-0.02em\nobreak\hskip\z@skip J}
%    \end{macrocode}
%    In the OT1 encoding, \pounds~and \$ share a slot.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextCommand{\textdollar}{OT1}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \slshape
   \else
      \upshape
   \fi
   \char`\$\egroup}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextCommand{\textsterling}{OT1}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \itshape
   \else
      \fontshape{ui}\selectfont
   \fi
   \char`\$\egroup}
%    \end{macrocode}
%
%    Here we are adding some more composite commands to the |OT1|
%    encoding.  This makes the use of certain accents with |i|
%    compatible with their use with the |T1| encoding; this
%    enables them to become true \LaTeX{} internal representations.
%    However, it will make these accents work a little less fast since
%    a check will always be made for the existence of a composite.
%
% \changes{v1.93}{2001/05/28}{Added composites for compatibility with
%                             T1, pr/3295}
% \changes{v1.94}{2001/06/05}{Text composite Commands need kludges for
%                               `,' -- see tlb1903.lvt}
%    \begin{macrocode}
\DeclareTextComposite{\.}{OT1}{i}{`\i}
\DeclareTextComposite{\.}{OT1}{\i}{`\i}
\DeclareTextCompositeCommand{\`}{OT1}{i}{\@tabacckludge`\i}
\DeclareTextCompositeCommand{\'}{OT1}{i}{\@tabacckludge'\i}
\DeclareTextCompositeCommand{\^}{OT1}{i}{\^\i}
\DeclareTextCompositeCommand{\"}{OT1}{i}{\"\i}
%    \end{macrocode}
%
% T1 encoding is given more extensive set of overloads for \verb|\c|
% But here we just adjust \verb|\c{g}|.
% \changes{v1.99n}{2015/02/16}{Added composites for \cs{c}}
% \changes{v1.99m}{2016/06/19}{OT1 definition (was duplicate T1 definition)}
%    \begin{macrocode}
\ifx\textcommaabove\@undefined\else
\DeclareTextCompositeCommand{\c}{OT1}{g}{\textcommaabove{g}}
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
%</OT1>
%    \end{macrocode}
%
% \subsection{Definitions for the T1 encoding}
%
% \changes{1.3}{1993/12/17}{Removed all the hackery for use in
%    \cs{DeclareFontEncoding}, and redid everything using
%    \cs{DeclareTextFoo}.}
% \changes{1.3b}{1993/12/18}{Replaced the missing last argument to
%    \cs{DeclareFontEncoding}.}
% \changes{1.3c}{1993/12/18}{Rewrote for the new syntax of
%    \cs{EncodingSpecific}.}
% \changes{1.4a}{1994/05/01}{Rewrote for the new syntax.}
% \changes{1.5a}{1994/05/12}{Rewrote for the new syntax.}
% \changes{1.6a}{1994/10/25}{Added \cs{textdollar},
%    \cs{textlbrace}, \cs{textrbrace}, \cs{textsterling},
%    \cs{textunderline}.}
% \changes{1.6a}{1994/10/25}{Removed
%    \cs{textlbrace}, \cs{textrbrace}, \cs{textunderline} to give them
%    their proper names.}
% \changes{1.6b}{1994/10/27}{Added
%   \cs{textasciicircum}
%   \cs{textasciitilde}
%   \cs{textbackslash}
%   \cs{textbar}
%   \cs{textbraceleft}
%   \cs{textbraceright}
%   \cs{textcompwordmark}
%   \cs{textemdash}
%   \cs{textendash}
%   \cs{textexclamdown}
%   \cs{textgreater}
%   \cs{texthyphenchar}
%   \cs{texthyphen}
%   \cs{textless}
%   \cs{textquestiondown}
%   \cs{textquotedblleft}
%   \cs{textquotedblright}
%   \cs{textquotedbl}
%   \cs{textquoteleft}
%   \cs{textquoteright}
%   \cs{textunderscore}
%   \cs{textvisiblespace}
% }
% \changes{v1.9h}{1997/12/17}
%    {Added \cs{textperthousand} and \cs{textpertenthousand}}
%
% The definitions for the `Extended \TeX{} text' (T1) encoding.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*T1>
\DeclareFontEncoding{T1}{}{}
%    \end{macrocode}
%    Declare the accents.
%    \begin{macrocode}
\DeclareTextAccent{\`}{T1}{0}
\DeclareTextAccent{\'}{T1}{1}
\DeclareTextAccent{\^}{T1}{2}
\DeclareTextAccent{\~}{T1}{3}
\DeclareTextAccent{\"}{T1}{4}
\DeclareTextAccent{\H}{T1}{5}
\DeclareTextAccent{\r}{T1}{6}
\DeclareTextAccent{\v}{T1}{7}
\DeclareTextAccent{\u}{T1}{8}
\DeclareTextAccent{\=}{T1}{9}
\DeclareTextAccent{\.}{T1}{10}
%    \end{macrocode}
%    Some accents have to be built by hand.
%    Note that |\ooalign| and |\o@lign| must be inside a group.
% \changes{v1.9h}{1997/12/17}{As in OT1, Added \cs{leavevmode} at
% start of \cs{c}, otherwise the output routine might be invoked
% within the macro.}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
% \changes{v1.95}{2002/06/17}{Corrected \cs{c} for T1 (pr/3442)}
% \changes{v1.99b}{2004/01/03}{Use \cs{ooalign} for \cs{k} (pr/3532)}
% \changes{v1.99b}{2004/01/03}{Added \cs{textogonekcentered} (pr/3532)}
% \changes{v1.99c}{2004/01/04}{More adjustments for ogonek (pr/3532)}
% \changes{v1.99g}{2005/09/27}{Replace \cs{sh@ft} by \cs{ltx@sh@ft}}
%  In these definitions we no longer use the helper function |\sh@ft|
%  from plain.tex since that now has two incompatible definitions.
%    \begin{macrocode}
\DeclareTextCommand{\b}{T1}[1]
   {\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
     \vbox to.2ex{\hbox{\char9}\vss}\hidewidth}\egroup}
\DeclareTextCommand{\c}{T1}[1]
   {\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent11 #1%
     \else{\ooalign{\unhbox\z@\crcr
        \hidewidth\char11\hidewidth}}\fi}
\DeclareTextCommand{\d}{T1}[1]
   {\hmode@bgroup
    \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
\DeclareTextCommand{\k}{T1}[1]
   {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\char12}\egroup}
\DeclareTextCommand{\textogonekcentered}{T1}[1]
   {\hmode@bgroup\ooalign{%
                \null#1\crcr\hidewidth\char12\hidewidth}\egroup}
%    \end{macrocode}
%
%    Some symbols are constructed.
%
% \changes{v1.9h}{1997/12/17}
%    {Added \cs{textperthousand} and \cs{textpertenthousand}}
%    Slot 24 contains a small circle intended for construction of
%    these two glyphs.
%
%    \begin{macrocode}
\DeclareTextCommand{\textperthousand}{T1}
   {\%\char 24 }          % space or `relax as delimiter?
\DeclareTextCommand{\textpertenthousand}{T1}
   {\%\char 24\char 24 }  % space or `relax as delimiter?
%    \end{macrocode}
%
%    For Maltese, \cs{Hwithstroke} and \cs{hwithstroke} are needed.
%
% \changes{v2.0k}{2018/11/19}
%    {Added \cs{Hwithstroke} and \cs{hwithstroke}}
%
%    \begin{macrocode}
\DeclareTextCommand{\Hwithstroke}{T1}
   {%
    \hmode@bgroup
    \vphantom{H}%
    \sbox\z@{H}%
    \ooalign{%
      H\cr
      \hidewidth
      \vrule
        height \dimexpr 0.7\ht\z@+0.1ex\relax
        depth  -0.7\ht\z@
        width  0.8\wd\z@
      \hidewidth\cr
    }%
    \egroup
   }
\DeclareTextCommand{\hwithstroke}{T1}
   {%
    \hmode@bgroup
    \vphantom{h}%
    \sbox\z@{h}%
    \ooalign{%
      h\cr
      \kern0.075\wd\z@
      \vrule
        height \dimexpr 0.7\ht\z@+0.1ex\relax
        depth  -0.7\ht\z@
        width  0.4\wd\z@
      \hidewidth\cr
    }%
    \egroup
   }
%    \end{macrocode}
%
%    Declare the text symbols.
% \changes{v1.7t}{1995/11/29}{Added \cs{textasciicircum},
%    \cs{textasciitilde}, \cs{textbackslash}, \cs{textbar},
%    \cs{textgreater} and \cs{textless}.}
% \changes{v1.8c}{1996/10/27}
%      {Removed \cs{aa} and \cs{AA}}
% \changes{v1.99h}{2005/11/08}
%      {Added \cs{ij} and \cs{IJ} from babel. (pr/3771)}
%
%    \begin{macrocode}
%\DeclareTextSymbol{\AA}{T1}{197}
\DeclareTextSymbol{\AE}{T1}{198}
\DeclareTextSymbol{\DH}{T1}{208}
\DeclareTextSymbol{\DJ}{T1}{208}
\DeclareTextSymbol{\L}{T1}{138}
\DeclareTextSymbol{\NG}{T1}{141}
\DeclareTextSymbol{\OE}{T1}{215}
\DeclareTextSymbol{\O}{T1}{216}
\DeclareTextSymbol{\SS}{T1}{223}
\DeclareTextSymbol{\TH}{T1}{222}
%\DeclareTextSymbol{\aa}{T1}{229}
\DeclareTextSymbol{\ae}{T1}{230}
\DeclareTextSymbol{\dh}{T1}{240}
\DeclareTextSymbol{\dj}{T1}{158}
%    \end{macrocode}
%  \changes{v2.0j}{2018/08/11}{Provide \cs{guillemetleft} and \cs{guillemetright}}
%    \begin{macrocode}
\DeclareTextSymbol{\guillemetleft}{T1}{19}
\DeclareTextSymbol{\guillemetright}{T1}{20}
% old Adobe names
\DeclareTextSymbol{\guillemotleft}{T1}{19}
\DeclareTextSymbol{\guillemotright}{T1}{20}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbol{\guilsinglleft}{T1}{14}
\DeclareTextSymbol{\guilsinglright}{T1}{15}
\DeclareTextSymbol{\i}{T1}{25}
\DeclareTextSymbol{\j}{T1}{26}
\DeclareTextSymbol{\ij}{T1}{188}
\DeclareTextSymbol{\IJ}{T1}{156}
\DeclareTextSymbol{\l}{T1}{170}
\DeclareTextSymbol{\ng}{T1}{173}
\DeclareTextSymbol{\oe}{T1}{247}
\DeclareTextSymbol{\o}{T1}{248}
\DeclareTextSymbol{\quotedblbase}{T1}{18}
\DeclareTextSymbol{\quotesinglbase}{T1}{13}
\DeclareTextSymbol{\ss}{T1}{255}
\DeclareTextSymbol{\textasciicircum}{T1}{`\^}
\DeclareTextSymbol{\textasciitilde}{T1}{`\~}
\DeclareTextSymbol{\textbackslash}{T1}{`\\}
\DeclareTextSymbol{\textbar}{T1}{`\|}
\DeclareTextSymbol{\textbraceleft}{T1}{`\{}
\DeclareTextSymbol{\textbraceright}{T1}{`\}}
\DeclareTextSymbol{\textcompwordmark}{T1}{23}
\DeclareTextSymbol{\textdollar}{T1}{`\$}
\DeclareTextSymbol{\textemdash}{T1}{22}
\DeclareTextSymbol{\textendash}{T1}{21}
%    \end{macrocode}
%
%    The \verb=\nobreak\hskip\z@= is there to prevent a break after
%    the hyphen but allow later breaks in the remainder of the word. 
% \changes{v2.0u}{2021/02/19}{Add \cs{textnonbreakinghyphen}, \cs{textfiguredash}
%      and \cs{texthorizontalbar} (gh/404)}
%    \begin{macrocode}
\DeclareTextCommand{\textnonbreakinghyphen}{T1}{\mbox{-}\nobreak\hskip\z@}
\DeclareTextCommand{\textfiguredash}       {T1}{\textendash}
\DeclareTextCommand{\texthorizontalbar}    {T1}{\textemdash}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbol{\textexclamdown}{T1}{189}
\DeclareTextSymbol{\textgreater}{T1}{`\>}
%\DeclareTextSymbol{\texthyphenchar}{T1}{127}
%\DeclareTextSymbol{\texthyphen}{T1}{`\-}
\DeclareTextSymbol{\textless}{T1}{`\<}
\DeclareTextSymbol{\textquestiondown}{T1}{190}
\DeclareTextSymbol{\textquotedblleft}{T1}{16}
\DeclareTextSymbol{\textquotedblright}{T1}{17}
\DeclareTextSymbol{\textquotedbl}{T1}{`\"}
\DeclareTextSymbol{\textquoteleft}{T1}{`\`}
\DeclareTextSymbol{\textquoteright}{T1}{`\'}
\DeclareTextSymbol{\textsection}{T1}{159}
\DeclareTextSymbol{\textsterling}{T1}{191}
\DeclareTextSymbol{\textunderscore}{T1}{95}
\DeclareTextSymbol{\textvisiblespace}{T1}{32}
\DeclareTextSymbol{\th}{T1}{254}
%    \end{macrocode}
%    Declare the composites.
% \changes{v1.93}{2001/05/28}{Changed the effect of
%                             \cs{.}\cs{i}, pr/3295}
%    \begin{macrocode}
\DeclareTextComposite{\.}{T1}{i}{`\i}
\DeclareTextComposite{\.}{T1}{\i}{`\i}
%    \end{macrocode}
% \changes{v1.9c}{1997/05/04}{Added `hex index tabs'}
%    "80 = 128
%    \begin{macrocode}
\DeclareTextComposite{\u}{T1}{A}{128}
\DeclareTextComposite{\k}{T1}{A}{129}
\DeclareTextComposite{\'}{T1}{C}{130}
\DeclareTextComposite{\v}{T1}{C}{131}
\DeclareTextComposite{\v}{T1}{D}{132}
\DeclareTextComposite{\v}{T1}{E}{133}
\DeclareTextComposite{\k}{T1}{E}{134}
\DeclareTextComposite{\u}{T1}{G}{135}
%    \end{macrocode}
%    "88 = 136
%    \begin{macrocode}
\DeclareTextComposite{\'}{T1}{L}{136}
\DeclareTextComposite{\v}{T1}{L}{137}
\DeclareTextComposite{\'}{T1}{N}{139}
\DeclareTextComposite{\v}{T1}{N}{140}
\DeclareTextComposite{\H}{T1}{O}{142}
\DeclareTextComposite{\'}{T1}{R}{143}
%    \end{macrocode}
%    "90 = 144
%    \begin{macrocode}
\DeclareTextComposite{\v}{T1}{R}{144}
\DeclareTextComposite{\'}{T1}{S}{145}
\DeclareTextComposite{\v}{T1}{S}{146}
\DeclareTextComposite{\c}{T1}{S}{147}
\DeclareTextComposite{\v}{T1}{T}{148}
\DeclareTextComposite{\c}{T1}{T}{149}
\DeclareTextComposite{\H}{T1}{U}{150}
\DeclareTextComposite{\r}{T1}{U}{151}
%    \end{macrocode}
%    "98 = 152
%    \begin{macrocode}
\DeclareTextComposite{\"}{T1}{Y}{152}
\DeclareTextComposite{\'}{T1}{Z}{153}
\DeclareTextComposite{\v}{T1}{Z}{154}
\DeclareTextComposite{\.}{T1}{Z}{155}
\DeclareTextComposite{\.}{T1}{I}{157}
%    \end{macrocode}
%    "A0 = 160
%    \begin{macrocode}
\DeclareTextComposite{\u}{T1}{a}{160}
\DeclareTextComposite{\k}{T1}{a}{161}
\DeclareTextComposite{\'}{T1}{c}{162}
\DeclareTextComposite{\v}{T1}{c}{163}
\DeclareTextComposite{\v}{T1}{d}{164}
\DeclareTextComposite{\v}{T1}{e}{165}
\DeclareTextComposite{\k}{T1}{e}{166}
\DeclareTextComposite{\u}{T1}{g}{167}
%    \end{macrocode}
%    "A8 = 168
%    \begin{macrocode}
\DeclareTextComposite{\'}{T1}{l}{168}
\DeclareTextComposite{\v}{T1}{l}{169}
\DeclareTextComposite{\'}{T1}{n}{171}
\DeclareTextComposite{\v}{T1}{n}{172}
\DeclareTextComposite{\H}{T1}{o}{174}
\DeclareTextComposite{\'}{T1}{r}{175}
%    \end{macrocode}
%    "B0 = 176
%    \begin{macrocode}
\DeclareTextComposite{\v}{T1}{r}{176}
\DeclareTextComposite{\'}{T1}{s}{177}
\DeclareTextComposite{\v}{T1}{s}{178}
\DeclareTextComposite{\c}{T1}{s}{179}
\DeclareTextComposite{\v}{T1}{t}{180}
\DeclareTextComposite{\c}{T1}{t}{181}
\DeclareTextComposite{\H}{T1}{u}{182}
\DeclareTextComposite{\r}{T1}{u}{183}
%    \end{macrocode}
%    "B8 = 184
%    \begin{macrocode}
\DeclareTextComposite{\"}{T1}{y}{184}
\DeclareTextComposite{\'}{T1}{z}{185}
\DeclareTextComposite{\v}{T1}{z}{186}
\DeclareTextComposite{\.}{T1}{z}{187}
%    \end{macrocode}
%    "C0 = 192
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{A}{192}
\DeclareTextComposite{\'}{T1}{A}{193}
\DeclareTextComposite{\^}{T1}{A}{194}
\DeclareTextComposite{\~}{T1}{A}{195}
\DeclareTextComposite{\"}{T1}{A}{196}
\DeclareTextComposite{\r}{T1}{A}{197}
\DeclareTextComposite{\c}{T1}{C}{199}
%    \end{macrocode}
%    "C8 = 200
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{E}{200}
\DeclareTextComposite{\'}{T1}{E}{201}
\DeclareTextComposite{\^}{T1}{E}{202}
\DeclareTextComposite{\"}{T1}{E}{203}
\DeclareTextComposite{\`}{T1}{I}{204}
\DeclareTextComposite{\'}{T1}{I}{205}
\DeclareTextComposite{\^}{T1}{I}{206}
\DeclareTextComposite{\"}{T1}{I}{207}
%    \end{macrocode}
%    "D0 = 208
%    \begin{macrocode}
\DeclareTextComposite{\~}{T1}{N}{209}
\DeclareTextComposite{\`}{T1}{O}{210}
\DeclareTextComposite{\'}{T1}{O}{211}
\DeclareTextComposite{\^}{T1}{O}{212}
\DeclareTextComposite{\~}{T1}{O}{213}
\DeclareTextComposite{\"}{T1}{O}{214}
%    \end{macrocode}
%    "D8 = 216
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{U}{217}
\DeclareTextComposite{\'}{T1}{U}{218}
\DeclareTextComposite{\^}{T1}{U}{219}
\DeclareTextComposite{\"}{T1}{U}{220}
\DeclareTextComposite{\'}{T1}{Y}{221}
%    \end{macrocode}
%    "E0 = 224
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{a}{224}
\DeclareTextComposite{\'}{T1}{a}{225}
\DeclareTextComposite{\^}{T1}{a}{226}
\DeclareTextComposite{\~}{T1}{a}{227}
\DeclareTextComposite{\"}{T1}{a}{228}
\DeclareTextComposite{\r}{T1}{a}{229}
\DeclareTextComposite{\c}{T1}{c}{231}
%    \end{macrocode}
%    "E8 = 232
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{e}{232}
\DeclareTextComposite{\'}{T1}{e}{233}
\DeclareTextComposite{\^}{T1}{e}{234}
\DeclareTextComposite{\"}{T1}{e}{235}
\DeclareTextComposite{\`}{T1}{i}{236}
\DeclareTextComposite{\`}{T1}{\i}{236}
\DeclareTextComposite{\'}{T1}{i}{237}
\DeclareTextComposite{\'}{T1}{\i}{237}
\DeclareTextComposite{\^}{T1}{i}{238}
\DeclareTextComposite{\^}{T1}{\i}{238}
\DeclareTextComposite{\"}{T1}{i}{239}
\DeclareTextComposite{\"}{T1}{\i}{239}
%    \end{macrocode}
%    "F0 = 240
%    \begin{macrocode}
\DeclareTextComposite{\~}{T1}{n}{241}
\DeclareTextComposite{\`}{T1}{o}{242}
\DeclareTextComposite{\'}{T1}{o}{243}
\DeclareTextComposite{\^}{T1}{o}{244}
\DeclareTextComposite{\~}{T1}{o}{245}
\DeclareTextComposite{\"}{T1}{o}{246}
%    \end{macrocode}
%    "F8 = 248
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{u}{249}
\DeclareTextComposite{\'}{T1}{u}{250}
\DeclareTextComposite{\^}{T1}{u}{251}
\DeclareTextComposite{\"}{T1}{u}{252}
\DeclareTextComposite{\'}{T1}{y}{253}
%    \end{macrocode}
% \changes{v1.99b}{2004/01/03}{Added composites for \cs{k} (pr/3532)}
%    \begin{macrocode}
\DeclareTextCompositeCommand{\k}{T1}{o}{\textogonekcentered{o}}
\DeclareTextCompositeCommand{\k}{T1}{O}{\textogonekcentered{O}}
%    \end{macrocode}
% \changes{v1.99n}{2015/02/16}{Added composites for \c{c}}
%    \begin{macrocode}
\ifx\textcommaabove\@undefined\else
\DeclareTextCompositeCommand{\c}{T1}{g}{\textcommaabove{g}}
\fi
\ifx\textcommabelow\@undefined\else
\DeclareTextCompositeCommand{\c}{T1}{G}{\textcommabelow{G}}
\DeclareTextCompositeCommand{\c}{T1}{K}{\textcommabelow{K}}
\DeclareTextCompositeCommand{\c}{T1}{k}{\textcommabelow{k}}
\DeclareTextCompositeCommand{\c}{T1}{L}{\textcommabelow{L}}
\DeclareTextCompositeCommand{\c}{T1}{l}{\textcommabelow{l}}
\DeclareTextCompositeCommand{\c}{T1}{N}{\textcommabelow{N}}
\DeclareTextCompositeCommand{\c}{T1}{n}{\textcommabelow{n}}
\DeclareTextCompositeCommand{\c}{T1}{R}{\textcommabelow{R}}
\DeclareTextCompositeCommand{\c}{T1}{r}{\textcommabelow{r}}
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
%</T1>
%    \end{macrocode}
%
% \changes{1.4a}{1994/05/01}{Removed the uc/lc table settings, since
%    the T1 uc/lc table is now the default.}
%
% \subsection{Definitions for the OMS encoding}
%
% \changes{v1.6a}{1994/10/25}{Added the OMS encoding.}
% \changes{v1.6b}{1994/10/27}{Renamed \cs{textlbrace} to
%    \cs{textbraceleft} and \cs{textrbrace} to \cs{textbraceright}.}
% \changes{v1.6b}{1994/10/27}{Added \cs{textbackslash}.}
% \changes{v1.6d}{1994/10/30}{Added \cs{textcircled}.}
%
% The definitions for the `\TeX{} math symbol' (OMS) encoding.  Even
% though this is meant to be a math font, it includes some of the
% standard \LaTeX{} text symbols.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*OMS>
\DeclareFontEncoding{OMS}{}{}
%    \end{macrocode}
%    Declare the symbols.
% \changes{v1.7t}{1995/11/29}{Added \cs{textbackslash} and
%    \cs{textbar}.}
% \changes{v1.8c}{1996/10/27}
%      {Added \cs{textasteriskcentered}}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
% \changes{v1.95}{2002/06/16}{Added \cs{textbardbl} (pr/3400)}
% \changes{v1.99}{2004/02/02}{Added \cs{textbigcircle}}
%    Note that slot 13 has in places been named |\Orb|: please root
%    out and destroy this impolity wherever you find it!
%    \begin{macrocode}
\DeclareTextSymbol{\textasteriskcentered}{OMS}{3}   % "03
\DeclareTextSymbol{\textbackslash}{OMS}{110}        % "6E
\DeclareTextSymbol{\textbar}{OMS}{106}              % "6A
\DeclareTextSymbol{\textbardbl}{OMS}{107}           % "6B
\DeclareTextSymbol{\textbraceleft}{OMS}{102}        % "66
\DeclareTextSymbol{\textbraceright}{OMS}{103}       % "67
\DeclareTextSymbol{\textbullet}{OMS}{15}            % "0F
\DeclareTextSymbol{\textdaggerdbl}{OMS}{122}        % "7A
\DeclareTextSymbol{\textdagger}{OMS}{121}           % "79
\DeclareTextSymbol{\textparagraph}{OMS}{123}        % "7B
\DeclareTextSymbol{\textperiodcentered}{OMS}{1}     % "01
\DeclareTextSymbol{\textsection}{OMS}{120}          % "78
\DeclareTextSymbol{\textbigcircle}{OMS}{13}         % "0D
\DeclareTextCommand{\textcircled}{OMS}[1]{\hmode@bgroup
   \ooalign{%
      \hfil \raise .07ex\hbox {\upshape#1}\hfil \crcr
      \char 13 % "0D
   }%
 \egroup}
%</OMS>
%    \end{macrocode}
%
% \subsection{Definitions for the OML encoding}
%
% \changes{v1.6d}{1994/10/30}{Added the OML encoding.}
%
% The definitions for the `\TeX{} math italic' (OML) encoding.  Even
% though this is meant to be a math font, it includes some of the
% standard \LaTeX{} text symbols.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*OML>
\DeclareFontEncoding{OML}{}{}
%    \end{macrocode}
%    Declare the symbols.
% \changes{v1.7t}{1995/11/29}{Added \cs{textless} and
%    \cs{textgreater}.}
% \changes{v1.9h}{1997/12/17}{Changed to decimal codes.}
% \changes{v1.9m}{1998/01/16}{fixed decimal codes. latex/2734}
%    \begin{macrocode}
\DeclareTextSymbol{\textless}{OML}{`\<}
\DeclareTextSymbol{\textgreater}{OML}{`\>}
\DeclareTextAccent{\t}{OML}{127}  % "7F
%</OML>
%    \end{macrocode}
%
% \subsection{Definitions for the OT4 encoding}
%
% These definitions are for the Polish extension to the
% `\TeX\ text' (OT1) encoding.
% This encoding was created by B.~Jackowski and M.~Ry\'cko
% for use with the Polish version of Computer Modern and Computer
% Concrete.  In positions 0--127 it is identical to OT1 but it
% contains some additional characters in the upper half.  The \LaTeX{}
% support was developed by Mariusz Olko.
%
% The PL fonts that use it are available as follows:\\
% Metafont sources
% \texttt{ftp://ftp.gust.org.pl/TeX/language/polish/pl-mf.zip};
%
% Font files
% \texttt{ftp://ftp.gust.org.pl/TeX/language/polish/pl-tfm.zip}.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*OT4>
\DeclareFontEncoding{OT4}{}{}
\DeclareFontSubstitution{OT4}{cmr}{m}{n}
%    \end{macrocode}
%    Declare the accents.
%    \begin{macrocode}
\DeclareTextAccent{\"}{OT4}{127}
\DeclareTextAccent{\'}{OT4}{19}
\DeclareTextAccent{\.}{OT4}{95}
\DeclareTextAccent{\=}{OT4}{22}
\DeclareTextAccent{\^}{OT4}{94}
\DeclareTextAccent{\`}{OT4}{18}
\DeclareTextAccent{\~}{OT4}{126}
\DeclareTextAccent{\H}{OT4}{125}
\DeclareTextAccent{\u}{OT4}{21}
\DeclareTextAccent{\v}{OT4}{20}
\DeclareTextAccent{\r}{OT4}{23}
%    \end{macrocode}
%    The ogonek accent is available only under a e A \& E.  But we
%    have to provide some definition for \cs{k}. Some other accents
%    have to be built by hand as in OT1:
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextCommand{\k}{OT4}[1]{%
    \TextSymbolUnavailable{\k{#1}}#1}
%    \end{macrocode}
%  In these definitions we no longer use the helper function |\sh@ft|
%  from plain.tex since that now has two incompatible definitions.
% \changes{v1.99g}{2005/09/27}{Replace \cs{sh@ft} by \cs{ltx@sh@ft}}
%    \begin{macrocode}
\DeclareTextCommand{\b}{OT4}[1]
   {\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
     \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}\egroup}
\DeclareTextCommand{\c}{OT4}[1]
   {\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
    \else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi}
\DeclareTextCommand{\d}{OT4}[1]
   {\hmode@bgroup
    \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
%    \end{macrocode}
%    Declare the text symbols.
%    \begin{macrocode}
\DeclareTextSymbol{\AE}{OT4}{29}
\DeclareTextSymbol{\OE}{OT4}{30}
\DeclareTextSymbol{\O}{OT4}{31}
\DeclareTextSymbol{\L}{OT4}{138}
\DeclareTextSymbol{\ae}{OT4}{26}
%    \end{macrocode}
%  \changes{v2.0j}{2018/08/11}{Provide \cs{guillemetleft} and \cs{guillemetright}}
%    \begin{macrocode}
\DeclareTextSymbol{\guillemetleft}{OT4}{174}
\DeclareTextSymbol{\guillemetright}{OT4}{175}
% old Adobe names
\DeclareTextSymbol{\guillemotleft}{OT4}{174}
\DeclareTextSymbol{\guillemotright}{OT4}{175}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbol{\i}{OT4}{16}
\DeclareTextSymbol{\j}{OT4}{17}
\DeclareTextSymbol{\l}{OT4}{170}
\DeclareTextSymbol{\o}{OT4}{28}
\DeclareTextSymbol{\oe}{OT4}{27}
\DeclareTextSymbol{\quotedblbase}{OT4}{255}
\DeclareTextSymbol{\ss}{OT4}{25}
\DeclareTextSymbol{\textemdash}{OT4}{124}
\DeclareTextSymbol{\textendash}{OT4}{123}
\DeclareTextSymbol{\textexclamdown}{OT4}{60}
%\DeclareTextSymbol{\texthyphenchar}{OT4}{`\-}
%\DeclareTextSymbol{\texthyphen}{OT4}{`\-}
\DeclareTextSymbol{\textquestiondown}{OT4}{62}
\DeclareTextSymbol{\textquotedblleft}{OT4}{92}
\DeclareTextSymbol{\textquotedblright}{OT4}{`\"}
\DeclareTextSymbol{\textquoteleft}{OT4}{`\`}
\DeclareTextSymbol{\textquoteright}{OT4}{`\'}
%    \end{macrocode}
%    Definition for \r A as in OT1:
% \changes{v1.96}{2002/10/28}{%
%   coding change, to follow bug fix by DEK in plain.tex (pr/3469)}
%    \begin{macrocode}
\DeclareTextCompositeCommand{\r}{OT4}{A}
   {\leavevmode\setbox\z@\hbox{!}\dimen@\ht\z@\advance\dimen@-1ex%
    \rlap{\raise.67\dimen@\hbox{\char23}}A}
%    \end{macrocode}
%    In the OT4 encoding, \pounds~and \$ share a slot.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextCommand{\textdollar}{OT4}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \slshape
   \else
      \upshape
   \fi
   \char`\$\egroup}
\DeclareTextCommand{\textsterling}{OT4}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \itshape
   \else
      \fontshape{ui}\selectfont
   \fi
   \char`\$\egroup}
%    \end{macrocode}
%    Declare the composites.
%    \begin{macrocode}
\DeclareTextComposite{\k}{OT4}{A}{129}
\DeclareTextComposite{\'}{OT4}{C}{130}
\DeclareTextComposite{\k}{OT4}{E}{134}
\DeclareTextComposite{\'}{OT4}{N}{139}
\DeclareTextComposite{\'}{OT4}{S}{145}
\DeclareTextComposite{\'}{OT4}{Z}{153}
\DeclareTextComposite{\.}{OT4}{Z}{155}
\DeclareTextComposite{\k}{OT4}{a}{161}
\DeclareTextComposite{\'}{OT4}{c}{162}
\DeclareTextComposite{\k}{OT4}{e}{166}
\DeclareTextComposite{\'}{OT4}{n}{171}
\DeclareTextComposite{\'}{OT4}{s}{177}
\DeclareTextComposite{\'}{OT4}{z}{185}
\DeclareTextComposite{\.}{OT4}{z}{187}
\DeclareTextComposite{\'}{OT4}{O}{211}
\DeclareTextComposite{\'}{OT4}{o}{243}
%</OT4>
%    \end{macrocode}
%
%
% \subsection{Definitions for the TS1 encoding}
%
% \changes{v1.9c}{1997/05/04}{Added TS1 encoding v2.2.beta}
% \changes{v1.9g}{1997/11/23}
%    {Use \cs{textperthousand}, \cs{textpertenthousand} and
%          \cs{textfractionsolidus} not
%         \cs{textpermill}, \cs{textpertenmill} and \cs{textfraction}.
%         /2673 }
% \changes{v1.9h}{1997/12/17}
%     {Removed default settings, see next section.}
%
%    \begin{macrocode}
%<*TS1>
\DeclareFontEncoding{TS1}{}{}
\DeclareFontSubstitution{TS1}{cmr}{m}{n}
%    \end{macrocode}
%    Some accents have to be built by hand.
%    Note that |\ooalign| and |\o@lign| must be inside a group.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextCommand{\capitalcedilla}{TS1}[1]
   {\hmode@bgroup
    \ooalign{\null#1\crcr\hidewidth\char11\hidewidth}\egroup}
\DeclareTextCommand{\capitalogonek}{TS1}[1]
   {\hmode@bgroup
    \ooalign{\null#1\crcr\hidewidth\char12\hidewidth}\egroup}
%    \end{macrocode}
%
% Accents for capital letters.
%
% These commands can be used by the end user either directly or through
% definitions of the type
% \begin{verbatim}
% \DeclareTextCompositeCommand{\'}{T1}{X}{\capitalacute X}
% \end{verbatim}
% None of the latter definitions are provided by default, since they
% are probably rarely used.
%
%    "00 = 0
%    \begin{macrocode}
\DeclareTextAccent{\capitalgrave}{TS1}{0}
\DeclareTextAccent{\capitalacute}{TS1}{1}
\DeclareTextAccent{\capitalcircumflex}{TS1}{2}
\DeclareTextAccent{\capitaltilde}{TS1}{3}
\DeclareTextAccent{\capitaldieresis}{TS1}{4}
\DeclareTextAccent{\capitalhungarumlaut}{TS1}{5}
\DeclareTextAccent{\capitalring}{TS1}{6}
\DeclareTextAccent{\capitalcaron}{TS1}{7}
%    \end{macrocode}
%    "08 = 8
%    \begin{macrocode}
\DeclareTextAccent{\capitalbreve}{TS1}{8}
\DeclareTextAccent{\capitalmacron}{TS1}{9}
\DeclareTextAccent{\capitaldotaccent}{TS1}{10}
%    \end{macrocode}
% Tie accents.
%
% The tie accent was borrowed from the |cmmi| font. The tc fonts
% now provide four tie accents, the first two are done in the
% classical way with asymmetric glyphs hanging out of their boxes;
% the new ties are centered in their boxes like all other accents.
% They need a name: please tell us if you know what to call them.
%
%    " =
%    \begin{macrocode}
\DeclareTextAccent{\t}{TS1}{26}
\DeclareTextAccent{\capitaltie}{TS1}{27}
\DeclareTextAccent{\newtie}{TS1}{28}
\DeclareTextAccent{\capitalnewtie}{TS1}{29}
%    \end{macrocode}
%
% Compound word marks.
%
% The text companion fonts contain two compound word marks of
% different heights, one has |cap_height|, the other |asc_height|.
%
%    \begin{macrocode}
\DeclareTextSymbol{\textcapitalcompwordmark}{TS1}{23}
\DeclareTextSymbol{\textascendercompwordmark}{TS1}{31}
%    \end{macrocode}
%
% The text companion symbols.
%
%    \begin{macrocode}
\DeclareTextSymbol{\textquotestraightbase}{TS1}{13}
%    \end{macrocode}
%    "10 = 16
%    \begin{macrocode}
\DeclareTextSymbol{\textquotestraightdblbase}{TS1}{18}
\DeclareTextSymbol{\texttwelveudash}{TS1}{21}
\DeclareTextSymbol{\textthreequartersemdash}{TS1}{22}
%    \end{macrocode}
%    "18 = 24
%    \begin{macrocode}
\DeclareTextSymbol{\textleftarrow}{TS1}{24}
\DeclareTextSymbol{\textrightarrow}{TS1}{25}
%    \end{macrocode}
%    "20 = 32
%    \begin{macrocode}
\DeclareTextSymbol{\textblank}{TS1}{32}
\DeclareTextSymbol{\textdollar}{TS1}{36}
\DeclareTextSymbol{\textquotesingle}{TS1}{39}
%    \end{macrocode}
%    "28 = 40
%
%    The symbol \cs{textasteriskcentered} ``\textasteriskcentered'' is
%    supposed to be always available in \texttt{TS1} and that is
%    important as it is used in footnote symbols. However, in a few
%    fonts it is missing even though they are otherwise fairly
%    complete. We therefore use a rather elaborate method and check if
%    the slot has a glyph and if not produce a poor man's version by
%    using a normal ``*'' slightly enlarged and somewhat lowered.
%    The main application for this symbol is in footnote symbols and
%    there it should produce a comparable size and show a similar placement.
% \changes{v2.0t}{2021/02/17}{Special definition for
%        \cs{textasteriskcentered} when missing in TS1 (gh/502)}
%    \begin{macrocode}
%\DeclareTextSymbol{\textasteriskcentered}{TS1}{42} % that's wanted
\DeclareTextCommand \textasteriskcentered{TS1}{%    % and that's needed
  \iffontchar\font 42 \char42 \else 
   \begingroup\fontencoding{T1}%
       \fontsize
       {\the\dimexpr1.3\dimexpr\f@size pt\relax}%
       {\f@baselineskip}%
      \selectfont
      \raisebox{-0.7ex}[\dimexpr\height-0.7ex][0pt]{*}%
    \endgroup
    \fi
}
%    \end{macrocode}
% Note that '054 is a comma and '056 is a full stop: these make
% numbers using oldstyle digits easier to input.
%    \begin{macrocode}
\DeclareTextSymbol{\textdblhyphen}{TS1}{45}
\DeclareTextSymbol{\textfractionsolidus}{TS1}{47}
%    \end{macrocode}
%
% Oldstyle digits.
%
%    "30 = 48
%    \begin{macrocode}
\DeclareTextSymbol{\textzerooldstyle}{TS1}{48}
\DeclareTextSymbol{\textoneoldstyle}{TS1}{49}
\DeclareTextSymbol{\texttwooldstyle}{TS1}{50}
\DeclareTextSymbol{\textthreeoldstyle}{TS1}{51}
\DeclareTextSymbol{\textfouroldstyle}{TS1}{52}
\DeclareTextSymbol{\textfiveoldstyle}{TS1}{53}
\DeclareTextSymbol{\textsixoldstyle}{TS1}{54}
\DeclareTextSymbol{\textsevenoldstyle}{TS1}{55}
%    \end{macrocode}
%    "38 = 56
%    \begin{macrocode}
\DeclareTextSymbol{\texteightoldstyle}{TS1}{56}
\DeclareTextSymbol{\textnineoldstyle}{TS1}{57}
%    \end{macrocode}
%
% More text companion symbols.
%
%    \begin{macrocode}
\DeclareTextSymbol{\textlangle}{TS1}{60}
\DeclareTextSymbol{\textminus}{TS1}{61}
\DeclareTextSymbol{\textrangle}{TS1}{62}
%    \end{macrocode}
%    "48 = 72
%    \begin{macrocode}
\DeclareTextSymbol{\textmho}{TS1}{77}
%    \end{macrocode}
%
% \changes{v1.9r}{1999/01/06}{Minor documentation fix.}
% The big circle is here to define the command \cs{textcircled}.
% Formerly it was taken from the |cmsy| font.
% \changes{v1.9h}{1997/12/17}{Changed to decimal codes in \cs{ooalign}.}
% \changes{v1.9k}{1998/01/12}{Adding missing braces and \cs{ushape}.}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextSymbol{\textbigcircle}{TS1}{79}
\DeclareTextCommand{\textcircled}{TS1}[1]{\hmode@bgroup
   \ooalign{%
      \hfil \raise .07ex\hbox {\upshape#1}\hfil \crcr
      \char 79   % '117 = "4F
   }%
 \egroup}
%    \end{macrocode}
%
% More text companion symbols.
%
%    "50 = 80
%    \begin{macrocode}
\DeclareTextSymbol{\textohm}{TS1}{87}
%    \end{macrocode}
%    "58 = 88
%    \begin{macrocode}
\DeclareTextSymbol{\textlbrackdbl}{TS1}{91}
\DeclareTextSymbol{\textrbrackdbl}{TS1}{93}
\DeclareTextSymbol{\textuparrow}{TS1}{94}
\DeclareTextSymbol{\textdownarrow}{TS1}{95}
%    \end{macrocode}
%    "60 = 96
%    \begin{macrocode}
\DeclareTextSymbol{\textasciigrave}{TS1}{96}
\DeclareTextSymbol{\textborn}{TS1}{98}
\DeclareTextSymbol{\textdivorced}{TS1}{99}
\DeclareTextSymbol{\textdied}{TS1}{100}
%    \end{macrocode}
%    "68 = 104
%    \begin{macrocode}
\DeclareTextSymbol{\textleaf}{TS1}{108}
\DeclareTextSymbol{\textmarried}{TS1}{109}
\DeclareTextSymbol{\textmusicalnote}{TS1}{110}
%    \end{macrocode}
%    "78 = 120
%    \begin{macrocode}
\DeclareTextSymbol{\texttildelow}{TS1}{126}
%    \end{macrocode}
%
% This glyph, |\textdblhyphenchar| is hanging, like the hyphenchar of
% the ec fonts.
%
%    \begin{macrocode}
\DeclareTextSymbol{\textdblhyphenchar}{TS1}{127}
%    \end{macrocode}
%    "80 = 128
%    \begin{macrocode}
\DeclareTextSymbol{\textasciibreve}{TS1}{128}
\DeclareTextSymbol{\textasciicaron}{TS1}{129}
%    \end{macrocode}
%
% This next glyph is \emph{not} the same as |\textquotedbl|.
%
% \changes{v1.9p}{1998/06/12}{Corrected 130 and 131, see pr/2834}
%    \begin{macrocode}
\DeclareTextSymbol{\textacutedbl}{TS1}{130}
\DeclareTextSymbol{\textgravedbl}{TS1}{131}
\DeclareTextSymbol{\textdagger}{TS1}{132}
\DeclareTextSymbol{\textdaggerdbl}{TS1}{133}
\DeclareTextSymbol{\textbardbl}{TS1}{134}
\DeclareTextSymbol{\textperthousand}{TS1}{135}
%    \end{macrocode}
%    "88 = 136
%    \begin{macrocode}
\DeclareTextSymbol{\textbullet}{TS1}{136}
\DeclareTextSymbol{\textcelsius}{TS1}{137}
\DeclareTextSymbol{\textdollaroldstyle}{TS1}{138}
\DeclareTextSymbol{\textcentoldstyle}{TS1}{139}
\DeclareTextSymbol{\textflorin}{TS1}{140}
\DeclareTextSymbol{\textcolonmonetary}{TS1}{141}
\DeclareTextSymbol{\textwon}{TS1}{142}
\DeclareTextSymbol{\textnaira}{TS1}{143}
%    \end{macrocode}
%    "90 = 144
%    \begin{macrocode}
\DeclareTextSymbol{\textguarani}{TS1}{144}
\DeclareTextSymbol{\textpeso}{TS1}{145}
\DeclareTextSymbol{\textlira}{TS1}{146}
\DeclareTextSymbol{\textrecipe}{TS1}{147}
\DeclareTextSymbol{\textinterrobang}{TS1}{148}
\DeclareTextSymbol{\textinterrobangdown}{TS1}{149}
\DeclareTextSymbol{\textdong}{TS1}{150}
\DeclareTextSymbol{\texttrademark}{TS1}{151}
%    \end{macrocode}
%    "98 = 152
%    \begin{macrocode}
\DeclareTextSymbol{\textpertenthousand}{TS1}{152}
\DeclareTextSymbol{\textpilcrow}{TS1}{153}
\DeclareTextSymbol{\textbaht}{TS1}{154}
\DeclareTextSymbol{\textnumero}{TS1}{155}
%    \end{macrocode}
% This next name may change.
% For the following sign we know only a german name, which is
% abz\"uglich. The meaning is something like ``commercial minus''.
% An ASCII ersatz is ./. (dot slash dot).
% The temporary English name is |\textdiscount|.
%    \begin{macrocode}
\DeclareTextSymbol{\textdiscount}{TS1}{156}
\DeclareTextSymbol{\textestimated}{TS1}{157}
\DeclareTextSymbol{\textopenbullet}{TS1}{158}
\DeclareTextSymbol{\textservicemark}{TS1}{159}
%    \end{macrocode}
%    "A0 = 160
%    \begin{macrocode}
\DeclareTextSymbol{\textlquill}{TS1}{160}
\DeclareTextSymbol{\textrquill}{TS1}{161}
\DeclareTextSymbol{\textcent}{TS1}{162}
\DeclareTextSymbol{\textsterling}{TS1}{163}
\DeclareTextSymbol{\textcurrency}{TS1}{164}
\DeclareTextSymbol{\textyen}{TS1}{165}
\DeclareTextSymbol{\textbrokenbar}{TS1}{166}
\DeclareTextSymbol{\textsection}{TS1}{167}
%    \end{macrocode}
%    "A8 = 168
%    \begin{macrocode}
\DeclareTextSymbol{\textasciidieresis}{TS1}{168}
\DeclareTextSymbol{\textcopyright}{TS1}{169}
\DeclareTextSymbol{\textordfeminine}{TS1}{170}
\DeclareTextSymbol{\textcopyleft}{TS1}{171}
\DeclareTextSymbol{\textlnot}{TS1}{172}
%    \end{macrocode}
%
% The meaning of the circled-P is ``sound recording copyright''.
%
% \changes{v1.9p}{1998/06/12}{Renamed \cs{textmacron} pr/2840}
%    \begin{macrocode}
\DeclareTextSymbol{\textcircledP}{TS1}{173}
\DeclareTextSymbol{\textregistered}{TS1}{174}
\DeclareTextSymbol{\textasciimacron}{TS1}{175}
%    \end{macrocode}
%    "B0 = 176
%    \begin{macrocode}
\DeclareTextSymbol{\textdegree}{TS1}{176}
\DeclareTextSymbol{\textpm}{TS1}{177}
\DeclareTextSymbol{\texttwosuperior}{TS1}{178}
\DeclareTextSymbol{\textthreesuperior}{TS1}{179}
\DeclareTextSymbol{\textasciiacute}{TS1}{180}
\DeclareTextSymbol{\textmu}{TS1}{181} % micro sign
\DeclareTextSymbol{\textparagraph}{TS1}{182}
\DeclareTextSymbol{\textperiodcentered}{TS1}{183}
%    \end{macrocode}
%    "B8 = 184
%    \begin{macrocode}
\DeclareTextSymbol{\textreferencemark}{TS1}{184}
\DeclareTextSymbol{\textonesuperior}{TS1}{185}
\DeclareTextSymbol{\textordmasculine}{TS1}{186}
\DeclareTextSymbol{\textsurd}{TS1}{187}
\DeclareTextSymbol{\textonequarter}{TS1}{188}
\DeclareTextSymbol{\textonehalf}{TS1}{189}
\DeclareTextSymbol{\textthreequarters}{TS1}{190}
\DeclareTextSymbol{\texteuro}{TS1}{191}
%    \end{macrocode}
%    "E0 = 208
%    \begin{macrocode}
\DeclareTextSymbol{\texttimes}{TS1}{214}
%    \end{macrocode}
%    "F0 = 240
%    \begin{macrocode}
\DeclareTextSymbol{\textdiv}{TS1}{246}
%</TS1>
%    \end{macrocode}
%
% \subsection{Definitions for the TU encoding}
%
% \changes{v2.0a}{2016/12/04}{Added TU encoding}
% \changes{v2.0b}{2017/01/23}{Added TU specific commands in ASCII range pr/4500}
% \changes{v2.0c}{2017/01/24}{TeX ligature syntax for xetex and luatex reversed}
% \changes{v2.0c}{2017/01/24}{Make \cs{textasteriskcentered} U+2217 not U+204E}
% \changes{v2.0c}{2017/01/24}{Declare TU composites for i and j}
% \changes{v2.0d}{2017/01/24}{Declare macron composites for YyGg}
% \changes{v2.0e}{2017/02/12}{Declare fallback code for \cs{textasteriskcentered}}
% \changes{v2.0f}{2017/02/19}{%
%     declare composites with empty base for hat and tilde,
%     use same slots for \cs{textasciicircum} ans \cs{textasciitilde}}
% \changes{v2.0f}{2017/02/19}{%
%     declare straight quotes using new \cs{remove@tlig} command}
% \changes{v2.0g}{2017/02/22}{Fix typo introduced at 2.0f}
% \changes{v2.0h}{2017/02/24}{introduce \cs{DeclareUnicodeAccent}}%
% The TU encoding was originally introduced in the contributed
% package \texttt{fontspec} as a Unicode encoding for XeTeX and
% LuaTeX.
%
% Normally for these engines, the input consists of Unicode characters
% encoded in UTF-8. There is therefore little need to use the
% traditional (ASCII) encoding-specific commands
%
% However, sometimes (e.g. for backwards compatibility) it can be
% useful to access these Unicode characters via such ASCII-based
% markup. The commands provided here
% Cover the characters in the T1 and TS1 encodings, but specified in
% Unicode position. Almost all the command names have been
% mechanically extracted form the \texttt{inputenc} UTF-8 support,
% which is essentially doing a reverse mapping from UTF-8 data to
% \LaTeX\ LICR commands.
%
% A few additional names for character which were supported in the
% original \texttt{fontspec} version of this file have also been
% added, even though they are not currently in the default
% \texttt{inputenc} UTF-8 declarations.
%
%    \begin{macrocode}
%<*TU>
%    \end{macrocode}
% In the base interface the Unicode encoding is always known as TU
% But we parameterize the encoding name to allow for modelling
% differences in Unicode support by different fonts.
%    \begin{macrocode}
\providecommand\UnicodeEncodingName{TU}
%    \end{macrocode}
% As the Unicode encoding, TU, is only currently available with XeTeX
% or LuaTeX, we detect these engines first, and make adjustments for the
% differing font loading syntax. For other engines, we issue a warning
% then abort this file, switching back to T1 encoding.
%    \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXrevision\endcsname\relax
%    \end{macrocode}
%
%    \begin{macrocode}
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname directlua\endcsname\relax
%    \end{macrocode}
%
% Not LuaTeX or XeTeX, abort with a warning.
%    \begin{macrocode}
    \PackageWarningNoLine{fontenc}
      {\UnicodeEncodingName\space
       encoding is only available with XeTeX and LuaTeX.\MessageBreak
       Defaulting to T1 encoding}
      \def\encodingdefault{T1}
    \expandafter\expandafter\expandafter\endinput
%    \end{macrocode}
%
%    \begin{macrocode}
  \else
%    \end{macrocode}
%
% LuaTeX.
% For Lua\TeX~1.10+, define a Lua function to disable any handing by the font code.
% Otherwise we reload the font without TeX ligatures.
% \changes{v2.0q}{2020/07/04}{%
%      Implement \cs{remove@tlig} in Lua\TeX without font reloading}
%    \begin{macrocode}
    \def\UnicodeFontTeXLigatures{+tlig;}
    \ifnum\luatexversion<110
%    \end{macrocode}
%
%    \begin{macrocode}
      \def\reserved@a#1{%
        \def\@remove@tlig##1{\@remove@tlig@##1\@nil#1\@nil\relax}
        \def\@remove@tlig@##1#1{\@remove@tlig@@##1}}
      \edef\reserved@b{\detokenize{+tlig;}}
      \expandafter\reserved@a\expandafter{\reserved@b}
      \def\@remove@tlig@@#1\@nil#2\relax{#1}
%    \end{macrocode}
%
%    \begin{macrocode}
      \def\remove@tlig#1{%
        \begingroup
        \font\remove@tlig
        \expandafter\@remove@tlig\expandafter{\fontname\font}%
        \remove@tlig
        \char#1\relax
        \endgroup
      }
    \else
      \newprotectedluacmd\@remove@tlig@@@
%    \end{macrocode}
% Now we can define the function. Mostly we just have to insert a protected glyph
% node, which is a glyph node with subtype 256. But we have to keep track of the
% current mode to avoid inserting the glyph into a vlist.
%    \begin{macrocode}
      \now@and@everyjob{\directlua{
        local rawchar_func = token.create'@remove@tlig@@@'.index
        local forcehmode = tex.forcehmode
        local put_next = token.put_next
        local glyph_id = node.id'glyph'
        local rawchar_token = token.new(rawchar_func, token.command_id'lua_call')
        lua.get_functions_table()[rawchar_func] = function()
          local mode = tex.nest.top.mode
          if mode == 1 or mode == -1 then
            put_next(rawchar_token)
            return forcehmode(true)
          end
          local n = node.new(glyph_id, 256)
          n.font = font.current()
          n.char = token.scan_int()
          return node.write(n)
        end
      }}
%    \end{macrocode}
% Now \verb+\remove@tlig+ can be implemented almost as in XeTeX.
%    \begin{macrocode}
      \def\remove@tlig#1{\@remove@tlig@@@#1\relax}
    \fi
%    \end{macrocode}
%
%    \begin{macrocode}
  \fi
\else
%    \end{macrocode}
%
% XeTeX
%    \begin{macrocode}
  \def\UnicodeFontTeXLigatures{mapping=tex-text;}
%    \end{macrocode}
%
%    \begin{macrocode}
  \def\remove@tlig#1{\XeTeXglyph\numexpr\XeTeXcharglyph#1\relax}
%    \end{macrocode}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
\def\UnicodeFontFile#1#2{"[#1]:#2"}
\def\UnicodeFontName#1#2{"#1:#2"}
%    \end{macrocode}
%
% Declare the encoding
%    \begin{macrocode}
\DeclareFontEncoding\UnicodeEncodingName{}{}
%    \end{macrocode}
%
% Declare accent command to use a postpended combining character
% rather than the TeX |\accent| primitive
%    \begin{macrocode}
\def\add@unicode@accent#1#2{%
  \if\relax\detokenize{#2}\relax^^a0\else#2\fi
  \char#1\relax}
%    \end{macrocode}
%
%    In its original implementation \cs{DeclareUnicodeAccent} was
%    given 3 arguments (with second the ``Unicode encoding'' a.k.a.,
%    \cs{UnicodeEncodingName}) while in other places, e.g.,
%    \cs{DeclareUnicodeComposite}, we always made encoding implicit. So
%    we now change it here to implicit too so that the interfaces
%    become a bit more consistent. To avoid making that a
%    breaking change (even though it only affects two packages on
%    CTAN) we test for \verb=#2= being \cs{UnicodeEncodingName}. This
%    would not catch if somebody used
%    \verb|\DeclareUnicodeAccent{\=}{TU-sub}{"0304}|
%    but that fortunately hasn't happened. With the implicit argument
%    you would need to change \cs{UnicodeEncodingName} instead, as you
%    have to do anyway for the other interface commands.
% \changes{v2.0y}{2021/12/12}{\cs{DeclareUnicodeAccent} now makes the
%                             encoding argument implicit (gh/253)}
%    \begin{macrocode}
\def\DeclareUnicodeAccent#1#2{%
  \edef\reserved@a{#2}%
  \edef\reserved@b{\UnicodeEncodingName}%
  \ifx\reserved@a\reserved@b
    \def\reserved@a{\DeclareUnicodeAccent@{#1}}%
  \else
    \def\reserved@a{\DeclareUnicodeAccent@{#1}\UnicodeEncodingName}%
  \fi
  \reserved@a{#2}%
}  
\def\DeclareUnicodeAccent@#1#2#3{%
  \DeclareTextCommand{#1}{#2}{\add@unicode@accent{#3}}%
}
%    \end{macrocode}
%
% Wrapper around |\DeclareTextCompositeCommand| that uses the declared
% composite if it exists in the current font or falls back to the default
% definition for the TU accent if not.
%    \begin{macrocode}
{
\catcode\z@=11\relax
\gdef\DeclareUnicodeComposite#1#2#3{%
   \def\reserved@a##1##2{%
     \DeclareTextCompositeCommand#1\UnicodeEncodingName{#2}{%
   \iffontchar\font#3 ##2%
      \else ##1\fi}}%
    \expandafter\expandafter\expandafter\extract@default@composite
    \csname\UnicodeEncodingName\string#1\endcsname{#2}\@nil
   \bgroup
      \lccode\z@#3 %
      \lowercase{\egroup
      \expandafter\reserved@a\expandafter{\reserved@b}{^^@}}}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\extract@default@composite#1{%
 \ifx\@text@composite#1%
   \expandafter\extract@default@composite@a
 \else
   \expandafter\extract@default@composite@b\expandafter#1%
 \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\extract@default@composite@a#1\@text@composite#2\@nil{%
  \def\reserved@b{#2}}
\def\extract@default@composite@b#1#2\@nil{%
  \def\reserved@b{#1#2}}
%    \end{macrocode}
%
%    Next two commands are simply syntactic sugar to go with the other
%    \cs{DeclareUnicode...} declarations.
% \changes{v2.0y}{2021/12/12}{Added \cs{DeclareUnicodeCommand} and
%    \cs{DeclareUnicodeSymbol} (gh/253)}
%    \begin{macrocode}
\def\DeclareUnicodeSymbol#1{\DeclareTextSymbol{#1}{\UnicodeEncodingName}}
\def\DeclareUnicodeCommand#1{\DeclareTextCommand{#1}{\UnicodeEncodingName}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareUnicodeCommand\textquotesingle {\remove@tlig{"0027}}
\DeclareUnicodeCommand\textasciigrave  {\remove@tlig{"0060}}
\DeclareUnicodeCommand\textquotedbl    {\remove@tlig{"0022}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareUnicodeSymbol{\textdollar}          {"0024}
\DeclareUnicodeSymbol{\textless}            {"003C}
\DeclareUnicodeSymbol{\textgreater}         {"003E}
\DeclareUnicodeSymbol{\textbackslash}       {"005C}
\DeclareUnicodeSymbol{\textasciicircum}     {"005E}
\DeclareUnicodeSymbol{\textunderscore}      {"005F}
\DeclareUnicodeSymbol{\textbraceleft}       {"007B}
\DeclareUnicodeSymbol{\textbar}             {"007C}
\DeclareUnicodeSymbol{\textbraceright}      {"007D}
\DeclareUnicodeSymbol{\textasciitilde}      {"007E}
\DeclareUnicodeSymbol{\textexclamdown}      {"00A1}
\DeclareUnicodeSymbol{\textcent}            {"00A2}
\DeclareUnicodeSymbol{\textsterling}        {"00A3}
\DeclareUnicodeSymbol{\textcurrency}        {"00A4}
\DeclareUnicodeSymbol{\textyen}             {"00A5}
\DeclareUnicodeSymbol{\textbrokenbar}       {"00A6}
\DeclareUnicodeSymbol{\textsection}         {"00A7}
\DeclareUnicodeSymbol{\textasciidieresis}   {"00A8}
\DeclareUnicodeSymbol{\textcopyright}       {"00A9}
\DeclareUnicodeSymbol{\textordfeminine}     {"00AA}
%    \end{macrocode}
%  \changes{v2.0j}{2018/08/11}{Provide \cs{guillemetleft} and \cs{guillemetright}}
%    \begin{macrocode}
\DeclareUnicodeSymbol{\guillemetleft}       {"00AB}
% old Adobe name
\DeclareUnicodeSymbol{\guillemotleft}       {"00AB}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareUnicodeSymbol{\textlnot}            {"00AC}
\DeclareUnicodeSymbol{\textregistered}      {"00AE}
\DeclareUnicodeSymbol{\textasciimacron}     {"00AF}
\DeclareUnicodeSymbol{\textdegree}          {"00B0}
\DeclareUnicodeSymbol{\textpm}              {"00B1}
\DeclareUnicodeSymbol{\texttwosuperior}     {"00B2}
\DeclareUnicodeSymbol{\textthreesuperior}   {"00B3}
\DeclareUnicodeSymbol{\textasciiacute}      {"00B4}
\DeclareUnicodeSymbol{\textmu}              {"00B5}
\DeclareUnicodeSymbol{\textparagraph}       {"00B6}
\DeclareUnicodeSymbol{\textperiodcentered}  {"00B7}
\DeclareUnicodeSymbol{\textonesuperior}     {"00B9}
\DeclareUnicodeSymbol{\textordmasculine}    {"00BA}
%    \end{macrocode}
%  \changes{v2.0j}{2018/08/11}{Provide \cs{guillemetleft} and \cs{guillemetright}}
%    \begin{macrocode}
\DeclareUnicodeSymbol{\guillemetright}      {"00BB}
% old Adobe name
\DeclareUnicodeSymbol{\guillemotright}      {"00BB}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareUnicodeSymbol{\textonequarter}      {"00BC}
\DeclareUnicodeSymbol{\textonehalf}         {"00BD}
\DeclareUnicodeSymbol{\textthreequarters}   {"00BE}
\DeclareUnicodeSymbol{\textquestiondown}    {"00BF}
\DeclareUnicodeSymbol{\AE}                  {"00C6}
\DeclareUnicodeSymbol{\DH}                  {"00D0}
\DeclareUnicodeSymbol{\texttimes}           {"00D7}
\DeclareUnicodeSymbol{\O}                   {"00D8}
\DeclareUnicodeSymbol{\TH}                  {"00DE}
\DeclareUnicodeSymbol{\ss}                  {"00DF}
\DeclareUnicodeSymbol{\ae}                  {"00E6}
\DeclareUnicodeSymbol{\dh}                  {"00F0}
\DeclareUnicodeSymbol{\textdiv}             {"00F7}
\DeclareUnicodeSymbol{\o}                   {"00F8}
\DeclareUnicodeSymbol{\th}                  {"00FE}
\DeclareUnicodeSymbol{\DJ}                  {"0110}
\DeclareUnicodeSymbol{\dj}                  {"0111}
\DeclareUnicodeSymbol{\i}                   {"0131}
\DeclareUnicodeSymbol{\IJ}                  {"0132}
\DeclareUnicodeSymbol{\ij}                  {"0133}
\DeclareUnicodeSymbol{\L}                   {"0141}
\DeclareUnicodeSymbol{\l}                   {"0142}
\DeclareUnicodeSymbol{\NG}                  {"014A}
\DeclareUnicodeSymbol{\ng}                  {"014B}
\DeclareUnicodeSymbol{\OE}                  {"0152}
\DeclareUnicodeSymbol{\oe}                  {"0153}
\DeclareUnicodeSymbol{\textflorin}          {"0192}
\DeclareUnicodeSymbol{\j}                   {"0237}
\DeclareUnicodeSymbol{\textasciicaron}      {"02C7}
\DeclareUnicodeSymbol{\textasciibreve}      {"02D8}
\DeclareUnicodeSymbol{\textacutedbl}        {"02DD}
\DeclareUnicodeSymbol{\textgravedbl}        {"02F5}
\DeclareUnicodeSymbol{\texttildelow}        {"02F7}
\DeclareUnicodeSymbol{\textbaht}            {"0E3F}
\DeclareUnicodeSymbol{\SS}                  {"1E9E}
\DeclareUnicodeSymbol{\textcompwordmark}    {"200C}
%    \end{macrocode}
%    
% \changes{v2.0u}{2021/02/19}{Add \cs{textnonbreakinghyphen}, \cs{textfiguredash}
%      and \cs{texthorizontalbar} (gh/404)}
%    \begin{macrocode}
%\DeclareUnicodeSymbol{\textnonbreakinghyphen} {"2011}
%\DeclareUnicodeSymbol{\textfiguredash}        {"2012}
\DeclareUnicodeSymbol{\textendash}          {"2013}
\DeclareUnicodeSymbol{\textemdash}          {"2014}
%\DeclareUnicodeSymbol{\texthorizontalbar}   {"2015}
%    \end{macrocode}
%    Unfortunately some fonts do not implement \texttt{"2011}, \texttt{"2012} and/or
%    \texttt{"2015} (including the \LaTeX{} default fonts for Unicode
%    engines) so we provide some approximations if the glyph is
%    missing, like we do for \texttt{OT1} and \texttt{T1}.
%
%    The \verb=\nobreak\hskip\z@= is there to prevent a break after
%    the hyphen but allow later breaks in the remainder of the word. 
%    \begin{macrocode}
\DeclareUnicodeCommand{\textnonbreakinghyphen} 
     {\iffontchar\font "2011 \char "2011 \else \mbox{-}\nobreak\hskip\z@ \fi}
\DeclareUnicodeCommand{\textfiguredash}     
     {\iffontchar\font "2012 \char "2012 \else \char "2013 \fi}
\DeclareUnicodeCommand{\texthorizontalbar}     
     {\iffontchar\font "2015 \char "2015 \else \char "2014 \fi}
%    \end{macrocode}
%    
%    \begin{macrocode}
\DeclareUnicodeSymbol{\textbardbl}          {"2016}
\DeclareUnicodeSymbol{\textquoteleft}       {"2018}
\DeclareUnicodeSymbol{\textquoteright}      {"2019}
\DeclareUnicodeSymbol{\quotesinglbase}      {"201A}
\DeclareUnicodeSymbol{\textquotedblleft}    {"201C}
\DeclareUnicodeSymbol{\textquotedblright}   {"201D}
\DeclareUnicodeSymbol{\quotedblbase}        {"201E}
\DeclareUnicodeSymbol{\textdagger}          {"2020}
\DeclareUnicodeSymbol{\textdaggerdbl}       {"2021}
\DeclareUnicodeSymbol{\textbullet}          {"2022}
\DeclareUnicodeSymbol{\textellipsis}        {"2026}
\DeclareUnicodeSymbol{\textperthousand}     {"2030}
\DeclareUnicodeSymbol{\textpertenthousand}  {"2031}
\DeclareUnicodeSymbol{\guilsinglleft}       {"2039}
\DeclareUnicodeSymbol{\guilsinglright}      {"203A}
\DeclareUnicodeSymbol{\textreferencemark}   {"203B}
\DeclareUnicodeSymbol{\textinterrobang}     {"203D}
\DeclareUnicodeSymbol{\textfractionsolidus} {"2044}
\DeclareUnicodeSymbol{\textlquill}          {"2045}
\DeclareUnicodeSymbol{\textrquill}          {"2046}
\DeclareUnicodeSymbol{\textdiscount}        {"2052}
\DeclareUnicodeSymbol{\textcolonmonetary}   {"20A1}
\DeclareUnicodeSymbol{\textlira}            {"20A4}
\DeclareUnicodeSymbol{\textnaira}           {"20A6}
\DeclareUnicodeSymbol{\textwon}             {"20A9}
\DeclareUnicodeSymbol{\textdong}            {"20AB}
\DeclareUnicodeSymbol{\texteuro}            {"20AC}
\DeclareUnicodeSymbol{\textpeso}            {"20B1}
\DeclareUnicodeSymbol{\textcelsius}         {"2103}
\DeclareUnicodeSymbol{\textnumero}          {"2116}
\DeclareUnicodeSymbol{\textcircledP}        {"2117}
\DeclareUnicodeSymbol{\textrecipe}          {"211E}
\DeclareUnicodeSymbol{\textservicemark}     {"2120}
\DeclareUnicodeSymbol{\texttrademark}       {"2122}
\DeclareUnicodeSymbol{\textohm}             {"2126}
\DeclareUnicodeSymbol{\textmho}             {"2127}
\DeclareUnicodeSymbol{\textestimated}       {"212E}
\DeclareUnicodeSymbol{\textleftarrow}       {"2190}
\DeclareUnicodeSymbol{\textuparrow}         {"2191}
\DeclareUnicodeSymbol{\textrightarrow}      {"2192}
\DeclareUnicodeSymbol{\textdownarrow}       {"2193}
\DeclareUnicodeSymbol{\textminus}           {"2212}

%    \end{macrocode}
%  \changes{v2.0k}{2018/11/18}{Provide \cs{Hwithstroke} and \cs{hwithstroke}}
%    \begin{macrocode}
\DeclareUnicodeSymbol{\Hwithstroke}         {"0126}
\DeclareUnicodeSymbol{\hwithstroke}         {"0127}
%    \end{macrocode}
%
% Not all fonts have U+2217 but using U+002A requires some adjustment.
% \changes{v2.0t}{2021/02/17}{Adjust values for
%        \cs{textasteriskcentered} To match TS1 definition (gh/502)}
%    \begin{macrocode}
\DeclareUnicodeCommand{\textasteriskcentered}{%
  \iffontchar\font"2217 \char"2217 \else
    \begingroup
      \fontsize
       {\the\dimexpr1.3\dimexpr\f@size pt\relax}%
       {\f@baselineskip}%
      \selectfont
      \raisebox{-0.7ex}[\dimexpr\height-0.7ex][0pt]{*}%
    \endgroup
  \fi
}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareUnicodeSymbol{\textsurd}            {"221A}
\DeclareUnicodeSymbol{\textlangle}          {"2329}
\DeclareUnicodeSymbol{\textrangle}          {"232A}
\DeclareUnicodeSymbol{\textblank}           {"2422}
\DeclareUnicodeSymbol{\textvisiblespace}    {"2423}
\DeclareUnicodeSymbol{\textopenbullet}      {"25E6}
\DeclareUnicodeSymbol{\textbigcircle}       {"25EF}
\DeclareUnicodeSymbol{\textmusicalnote}     {"266A}
\DeclareUnicodeSymbol{\textmarried}         {"26AD}
\DeclareUnicodeSymbol{\textdivorced}        {"26AE}
\DeclareUnicodeSymbol{\textinterrobangdown} {"2E18}
%    \end{macrocode}
% Accents must be declared before the composites that use them.
%    \begin{macrocode}
\DeclareUnicodeAccent{\`}{"0300}
\DeclareUnicodeAccent{\'}{"0301}
\DeclareUnicodeAccent{\^}{"0302}
\DeclareUnicodeAccent{\~}{"0303}
\DeclareUnicodeAccent{\=}{"0304}
\DeclareUnicodeAccent{\u}{"0306}
\DeclareUnicodeAccent{\.}{"0307}
\DeclareUnicodeAccent{\"}{"0308}
\DeclareUnicodeAccent{\r}{"030A}
\DeclareUnicodeAccent{\H}{"030B}
\DeclareUnicodeAccent{\v}{"030C}
\DeclareUnicodeAccent{\b}{"0332}
\DeclareUnicodeAccent{\d}{"0323}
\DeclareUnicodeAccent{\c}{"0327}
\DeclareUnicodeAccent{\k}{"0328}
%    \end{macrocode}
%    The odd one out:
%    \begin{macrocode}
\DeclareUnicodeCommand\textcommabelow[1]
  {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex
   \hbox{\check@mathfonts\fontsize\ssf@size\z@
   \math@fontsfalse\selectfont,}\hidewidth}\egroup}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareUnicodeComposite{\^}              {}{"005E}
\DeclareUnicodeComposite{\~}              {}{"007E}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareUnicodeComposite{\`}             {A}{"00C0}
\DeclareUnicodeComposite{\'}             {A}{"00C1}
\DeclareUnicodeComposite{\^}             {A}{"00C2}
\DeclareUnicodeComposite{\~}             {A}{"00C3}
\DeclareUnicodeComposite{\"}             {A}{"00C4}
\DeclareUnicodeComposite{\r}             {A}{"00C5}
\DeclareUnicodeComposite{\c}             {C}{"00C7}
\DeclareUnicodeComposite{\`}             {E}{"00C8}
\DeclareUnicodeComposite{\'}             {E}{"00C9}
\DeclareUnicodeComposite{\^}             {E}{"00CA}
\DeclareUnicodeComposite{\"}             {E}{"00CB}
\DeclareUnicodeComposite{\`}             {I}{"00CC}
\DeclareUnicodeComposite{\'}             {I}{"00CD}
\DeclareUnicodeComposite{\^}             {I}{"00CE}
\DeclareUnicodeComposite{\"}             {I}{"00CF}
\DeclareUnicodeComposite{\~}             {N}{"00D1}
\DeclareUnicodeComposite{\`}             {O}{"00D2}
\DeclareUnicodeComposite{\'}             {O}{"00D3}
\DeclareUnicodeComposite{\^}             {O}{"00D4}
\DeclareUnicodeComposite{\~}             {O}{"00D5}
\DeclareUnicodeComposite{\"}             {O}{"00D6}
\DeclareUnicodeComposite{\`}             {U}{"00D9}
\DeclareUnicodeComposite{\'}             {U}{"00DA}
\DeclareUnicodeComposite{\^}             {U}{"00DB}
\DeclareUnicodeComposite{\"}             {U}{"00DC}
\DeclareUnicodeComposite{\'}             {Y}{"00DD}
\DeclareUnicodeComposite{\`}             {a}{"00E0}
\DeclareUnicodeComposite{\'}             {a}{"00E1}
\DeclareUnicodeComposite{\^}             {a}{"00E2}
\DeclareUnicodeComposite{\~}             {a}{"00E3}
\DeclareUnicodeComposite{\"}             {a}{"00E4}
\DeclareUnicodeComposite{\r}             {a}{"00E5}
\DeclareUnicodeComposite{\c}             {c}{"00E7}
\DeclareUnicodeComposite{\`}             {e}{"00E8}
\DeclareUnicodeComposite{\'}             {e}{"00E9}
\DeclareUnicodeComposite{\^}             {e}{"00EA}
\DeclareUnicodeComposite{\"}             {e}{"00EB}
\DeclareUnicodeComposite{\`}             \i {"00EC}
\DeclareUnicodeComposite{\`}             {i}{"00EC}
\DeclareUnicodeComposite{\'}             \i {"00ED}
\DeclareUnicodeComposite{\'}             {i}{"00ED}
\DeclareUnicodeComposite{\^}             \i {"00EE}
\DeclareUnicodeComposite{\^}             {i}{"00EE}
\DeclareUnicodeComposite{\"}             \i {"00EF}
\DeclareUnicodeComposite{\"}             {i}{"00EF}
\DeclareUnicodeComposite{\~}             {n}{"00F1}
\DeclareUnicodeComposite{\`}             {o}{"00F2}
\DeclareUnicodeComposite{\'}             {o}{"00F3}
\DeclareUnicodeComposite{\^}             {o}{"00F4}
\DeclareUnicodeComposite{\~}             {o}{"00F5}
\DeclareUnicodeComposite{\"}             {o}{"00F6}
\DeclareUnicodeComposite{\`}             {u}{"00F9}
\DeclareUnicodeComposite{\'}             {u}{"00FA}
\DeclareUnicodeComposite{\^}             {u}{"00FB}
\DeclareUnicodeComposite{\"}             {u}{"00FC}
\DeclareUnicodeComposite{\'}             {y}{"00FD}
\DeclareUnicodeComposite{\"}             {y}{"00FF}
\DeclareUnicodeComposite{\=}             {A}{"0100}
\DeclareUnicodeComposite{\=}             {a}{"0101}
\DeclareUnicodeComposite{\u}             {A}{"0102}
\DeclareUnicodeComposite{\u}             {a}{"0103}
\DeclareUnicodeComposite{\k}             {A}{"0104}
\DeclareUnicodeComposite{\k}             {a}{"0105}
\DeclareUnicodeComposite{\'}             {C}{"0106}
\DeclareUnicodeComposite{\'}             {c}{"0107}
\DeclareUnicodeComposite{\^}             {C}{"0108}
\DeclareUnicodeComposite{\^}             {c}{"0109}
\DeclareUnicodeComposite{\.}             {C}{"010A}
\DeclareUnicodeComposite{\.}             {c}{"010B}
\DeclareUnicodeComposite{\v}             {C}{"010C}
\DeclareUnicodeComposite{\v}             {c}{"010D}
\DeclareUnicodeComposite{\v}             {D}{"010E}
\DeclareUnicodeComposite{\v}             {d}{"010F}
\DeclareUnicodeComposite{\=}             {E}{"0112}
\DeclareUnicodeComposite{\=}             {e}{"0113}
\DeclareUnicodeComposite{\u}             {E}{"0114}
\DeclareUnicodeComposite{\u}             {e}{"0115}
\DeclareUnicodeComposite{\.}             {E}{"0116}
\DeclareUnicodeComposite{\.}             {e}{"0117}
\DeclareUnicodeComposite{\k}             {E}{"0118}
\DeclareUnicodeComposite{\k}             {e}{"0119}
\DeclareUnicodeComposite{\v}             {E}{"011A}
\DeclareUnicodeComposite{\v}             {e}{"011B}
\DeclareUnicodeComposite{\^}             {G}{"011C}
\DeclareUnicodeComposite{\^}             {g}{"011D}
\DeclareUnicodeComposite{\u}             {G}{"011E}
\DeclareUnicodeComposite{\u}             {g}{"011F}
\DeclareUnicodeComposite{\.}             {G}{"0120}
\DeclareUnicodeComposite{\.}             {g}{"0121}
\DeclareUnicodeComposite{\c}             {G}{"0122}
\DeclareUnicodeComposite{\c}             {g}{"0123}
\DeclareUnicodeComposite{\^}             {H}{"0124}
\DeclareUnicodeComposite{\^}             {h}{"0125}
\DeclareUnicodeComposite{\~}             {I}{"0128}
\DeclareUnicodeComposite{\~}             \i {"0129}
\DeclareUnicodeComposite{\~}             {i}{"0129}
\DeclareUnicodeComposite{\=}             {I}{"012A}
\DeclareUnicodeComposite{\=}             \i {"012B}
\DeclareUnicodeComposite{\=}             {i}{"012B}
\DeclareUnicodeComposite{\u}             {I}{"012C}
\DeclareUnicodeComposite{\u}             \i {"012D}
\DeclareUnicodeComposite{\u}             {i}{"012D}
\DeclareUnicodeComposite{\k}             {I}{"012E}
\DeclareUnicodeComposite{\k}             \i {"012F}
\DeclareUnicodeComposite{\k}             {i}{"012F}
\DeclareUnicodeComposite{\.}             {I}{"0130}
\DeclareUnicodeComposite{\^}             {J}{"0134}
\DeclareUnicodeComposite{\^}             \j {"0135}
\DeclareUnicodeComposite{\^}             {j}{"0135}
\DeclareUnicodeComposite{\c}             {K}{"0136}
\DeclareUnicodeComposite{\c}             {k}{"0137}
\DeclareUnicodeComposite{\'}             {L}{"0139}
\DeclareUnicodeComposite{\'}             {l}{"013A}
\DeclareUnicodeComposite{\c}             {L}{"013B}
\DeclareUnicodeComposite{\c}             {l}{"013C}
\DeclareUnicodeComposite{\v}             {L}{"013D}
\DeclareUnicodeComposite{\v}             {l}{"013E}
\DeclareUnicodeComposite{\'}             {N}{"0143}
\DeclareUnicodeComposite{\'}             {n}{"0144}
\DeclareUnicodeComposite{\c}             {N}{"0145}
\DeclareUnicodeComposite{\c}             {n}{"0146}
\DeclareUnicodeComposite{\v}             {N}{"0147}
\DeclareUnicodeComposite{\v}             {n}{"0148}
\DeclareUnicodeComposite{\=}             {O}{"014C}
\DeclareUnicodeComposite{\=}             {o}{"014D}
\DeclareUnicodeComposite{\u}             {O}{"014E}
\DeclareUnicodeComposite{\u}             {o}{"014F}
\DeclareUnicodeComposite{\H}             {O}{"0150}
\DeclareUnicodeComposite{\H}             {o}{"0151}
\DeclareUnicodeComposite{\'}             {R}{"0154}
\DeclareUnicodeComposite{\'}             {r}{"0155}
\DeclareUnicodeComposite{\c}             {R}{"0156}
\DeclareUnicodeComposite{\c}             {r}{"0157}
\DeclareUnicodeComposite{\v}             {R}{"0158}
\DeclareUnicodeComposite{\v}             {r}{"0159}
\DeclareUnicodeComposite{\'}             {S}{"015A}
\DeclareUnicodeComposite{\'}             {s}{"015B}
\DeclareUnicodeComposite{\^}             {S}{"015C}
\DeclareUnicodeComposite{\^}             {s}{"015D}
\DeclareUnicodeComposite{\c}             {S}{"015E}
\DeclareUnicodeComposite{\c}             {s}{"015F}
\DeclareUnicodeComposite{\v}             {S}{"0160}
\DeclareUnicodeComposite{\v}             {s}{"0161}
\DeclareUnicodeComposite{\c}             {T}{"0162}
\DeclareUnicodeComposite{\c}             {t}{"0163}
\DeclareUnicodeComposite{\v}             {T}{"0164}
\DeclareUnicodeComposite{\v}             {t}{"0165}
\DeclareUnicodeComposite{\~}             {U}{"0168}
\DeclareUnicodeComposite{\~}             {u}{"0169}
\DeclareUnicodeComposite{\=}             {U}{"016A}
\DeclareUnicodeComposite{\=}             {u}{"016B}
\DeclareUnicodeComposite{\u}             {U}{"016C}
\DeclareUnicodeComposite{\u}             {u}{"016D}
\DeclareUnicodeComposite{\r}             {U}{"016E}
\DeclareUnicodeComposite{\r}             {u}{"016F}
\DeclareUnicodeComposite{\H}             {U}{"0170}
\DeclareUnicodeComposite{\H}             {u}{"0171}
\DeclareUnicodeComposite{\k}             {U}{"0172}
\DeclareUnicodeComposite{\k}             {u}{"0173}
\DeclareUnicodeComposite{\^}             {W}{"0174}
\DeclareUnicodeComposite{\^}             {w}{"0175}
\DeclareUnicodeComposite{\^}             {Y}{"0176}
\DeclareUnicodeComposite{\^}             {y}{"0177}
\DeclareUnicodeComposite{\"}             {Y}{"0178}
\DeclareUnicodeComposite{\'}             {Z}{"0179}
\DeclareUnicodeComposite{\'}             {z}{"017A}
\DeclareUnicodeComposite{\.}             {Z}{"017B}
\DeclareUnicodeComposite{\.}             {z}{"017C}
\DeclareUnicodeComposite{\v}             {Z}{"017D}
\DeclareUnicodeComposite{\v}             {z}{"017E}
\DeclareUnicodeComposite{\v}             {A}{"01CD}
\DeclareUnicodeComposite{\v}             {a}{"01CE}
\DeclareUnicodeComposite{\v}             {I}{"01CF}
\DeclareUnicodeComposite{\v}             \i {"01D0}
\DeclareUnicodeComposite{\v}             {i}{"01D0}
\DeclareUnicodeComposite{\v}             {O}{"01D1}
\DeclareUnicodeComposite{\v}             {o}{"01D2}
\DeclareUnicodeComposite{\v}             {U}{"01D3}
\DeclareUnicodeComposite{\v}             {u}{"01D4}
%    \end{macrocode}
%
% \changes{v2.0v}{2021/04/29}{Add composites for
%      \texttt{\protect\string\ae/\protect\string\AE/\ae/\AE} (gh/552)}
%    \begin{macrocode}
\DeclareUnicodeComposite{\'}             \AE{"01FC}
\DeclareUnicodeComposite{\'}             {Æ}{"01FC}
\DeclareUnicodeComposite{\'}             \ae{"01FD}
\DeclareUnicodeComposite{\'}             {æ}{"01FD}
\DeclareUnicodeComposite{\=}             \AE{"01E2}
\DeclareUnicodeComposite{\=}             {Æ}{"01E2}
\DeclareUnicodeComposite{\=}             \ae{"01E3}
\DeclareUnicodeComposite{\=}             {æ}{"01E3}
\DeclareUnicodeComposite{\v}             {G}{"01E6}
\DeclareUnicodeComposite{\v}             {g}{"01E7}
\DeclareUnicodeComposite{\v}             {K}{"01E8}
\DeclareUnicodeComposite{\v}             {k}{"01E9}
\DeclareUnicodeComposite{\k}             {O}{"01EA}
\DeclareUnicodeComposite{\k}             {o}{"01EB}
\DeclareUnicodeComposite{\v}             \j {"01F0}
\DeclareUnicodeComposite{\v}             {j}{"01F0}
\DeclareUnicodeComposite{\'}             {G}{"01F4}
\DeclareUnicodeComposite{\'}             {g}{"01F5}
\DeclareUnicodeComposite{\textcommabelow}{S}{"0218}
\DeclareUnicodeComposite{\textcommabelow}{s}{"0219}
\DeclareUnicodeComposite{\textcommabelow}{T}{"021A}
\DeclareUnicodeComposite{\textcommabelow}{t}{"021B}
\DeclareUnicodeComposite{\=}             {Y}{"0232}
\DeclareUnicodeComposite{\=}             {y}{"0233}
\DeclareUnicodeComposite{\.}             {B}{"1E02}
\DeclareUnicodeComposite{\.}             {b}{"1E03}
\DeclareUnicodeComposite{\d}             {B}{"1E04}
\DeclareUnicodeComposite{\d}             {b}{"1E05}
\DeclareUnicodeComposite{\d}             {D}{"1E0C}
\DeclareUnicodeComposite{\d}             {d}{"1E0D}
\DeclareUnicodeComposite{\=}             {G}{"1E20}
\DeclareUnicodeComposite{\=}             {g}{"1E21}
\DeclareUnicodeComposite{\d}             {H}{"1E24}
\DeclareUnicodeComposite{\d}             {h}{"1E25}
\DeclareUnicodeComposite{\d}             {K}{"1E32}
\DeclareUnicodeComposite{\d}             {k}{"1E33}
\DeclareUnicodeComposite{\d}             {L}{"1E36}
\DeclareUnicodeComposite{\d}             {l}{"1E37}
\DeclareUnicodeComposite{\d}             {M}{"1E42}
\DeclareUnicodeComposite{\d}             {m}{"1E43}
\DeclareUnicodeComposite{\d}             {N}{"1E46}
\DeclareUnicodeComposite{\d}             {n}{"1E47}
\DeclareUnicodeComposite{\d}             {R}{"1E5A}
\DeclareUnicodeComposite{\d}             {r}{"1E5B}
\DeclareUnicodeComposite{\d}             {S}{"1E62}
\DeclareUnicodeComposite{\d}             {s}{"1E63}
\DeclareUnicodeComposite{\d}             {T}{"1E6C}
\DeclareUnicodeComposite{\d}             {t}{"1E6D}
\DeclareUnicodeComposite{\d}             {V}{"1E7E}
\DeclareUnicodeComposite{\d}             {v}{"1E7F}
\DeclareUnicodeComposite{\d}             {W}{"1E88}
\DeclareUnicodeComposite{\d}             {w}{"1E89}
\DeclareUnicodeComposite{\d}             {Z}{"1E92}
\DeclareUnicodeComposite{\d}             {z}{"1E93}
\DeclareUnicodeComposite{\d}             {A}{"1EA0}
\DeclareUnicodeComposite{\d}             {a}{"1EA1}
\DeclareUnicodeComposite{\d}             {E}{"1EB8}
\DeclareUnicodeComposite{\d}             {e}{"1EB9}
\DeclareUnicodeComposite{\d}             {I}{"1ECA}
\DeclareUnicodeComposite{\d}             {i}{"1ECB}
\DeclareUnicodeComposite{\d}             {O}{"1ECC}
\DeclareUnicodeComposite{\d}             {o}{"1ECD}
\DeclareUnicodeComposite{\d}             {U}{"1EE4}
\DeclareUnicodeComposite{\d}             {u}{"1EE5}
\DeclareUnicodeComposite{\d}             {Y}{"1EF4}
\DeclareUnicodeComposite{\d}             {y}{"1EF5}
%    \end{macrocode}
%
%    \begin{macrocode}
%</TU>
%    \end{macrocode}
%
% \section{Package files}
%
% \changes{v1.9h}{1997/12/17}{Added section.}
% \changes{v1.9h}{1997/12/17}{Added code for textcomp.sty.}
%    This file now also contains some packages that provide access to
%    the more specialised encodings.
%
% \subsection{The fontenc package}
%
% \changes{v1.5c}{1994/05/14}{Added the fontenc package}
% \changes{v1.5g}{1994/05/16}{Removed the lowercasing of the filename.}
% \changes{v1.7a}{1994/11/30}{Always load the enc.def file, so that
%    the default encoding for the commands will change.}
% \changes{v1.7x}{1996/05/18}{Produce error if encoding not found.
%                             pr/2054}
% \changes{v1.7y}{1996/05/21}{Corrected error message (CAR)}
% \changes{v1.8d}{1996/11/18}
%     {(DPC) lowercase external file names. internal/1044}%
% This package allows authors to specify which encodings they will use.
% For each encoding |FOO|, the package looks to see if the encoding
% |FOO| has already been declared.  If it has not, the file |fooenc.def|
% is loaded.  The default encoding is set to be |FOO|.
%
% In addition the package at the moment contains extra code to extend
% the |\@uclclist| (list of upper/lower case pairs) for encodings that
% involve cyrillic characters. THIS IS A TEMPORARY SOLUTION and will not
% stay this way forever (or so we hope) but right now we are missing a
% proper interface for this and didn't wanted to rush it.
% \changes{v1.9r}{1999/01/07}{Hackery to temp support cyrillic uc/lc}
% \changes{v1.9t}{1999/02/24}{Corrected hackery cyrillic uc/lc list}
% \changes{v1.9x}{1999/12/08}{Changed \cs{CYRRHOOK} and  \cs{cyrrhook}
%    to\cs{CYRRHK} and  \cs{cyrrhk} as name changed in the cyrillic
%    bundle for naming consistency with other ``hook'' glyphs.}
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% Here we define a macro that extends the |\@uclclist| if needed and
% afterwards turns itself in a noop.
%    \begin{macrocode}
\def\update@uclc@with@cyrillic{%
 \expandafter\def\expandafter\@uclclist\expandafter
  {\@uclclist
  \cyra\CYRA\cyrabhch\CYRABHCH\cyrabhchdsc\CYRABHCHDSC\cyrabhdze
  \CYRABHDZE\cyrabhha\CYRABHHA\cyrae\CYRAE\cyrb\CYRB\cyrbyus
  \CYRBYUS\cyrc\CYRC\cyrch\CYRCH\cyrchldsc\CYRCHLDSC\cyrchrdsc
  \CYRCHRDSC\cyrchvcrs\CYRCHVCRS\cyrd\CYRD\cyrdelta\CYRDELTA
  \cyrdje\CYRDJE\cyrdze\CYRDZE\cyrdzhe\CYRDZHE\cyre\CYRE\cyreps
  \CYREPS\cyrerev\CYREREV\cyrery\CYRERY\cyrf\CYRF\cyrfita
  \CYRFITA\cyrg\CYRG\cyrgdsc\CYRGDSC\cyrgdschcrs\CYRGDSCHCRS
  \cyrghcrs\CYRGHCRS\cyrghk\CYRGHK\cyrgup\CYRGUP\cyrh\CYRH
  \cyrhdsc\CYRHDSC\cyrhhcrs\CYRHHCRS\cyrhhk\CYRHHK\cyrhrdsn
  \CYRHRDSN\cyri\CYRI\cyrie\CYRIE\cyrii\CYRII\cyrishrt\CYRISHRT
  \cyrishrtdsc\CYRISHRTDSC\cyrizh\CYRIZH\cyrje\CYRJE\cyrk\CYRK
  \cyrkbeak\CYRKBEAK\cyrkdsc\CYRKDSC\cyrkhcrs\CYRKHCRS\cyrkhk
  \CYRKHK\cyrkvcrs\CYRKVCRS\cyrl\CYRL\cyrldsc\CYRLDSC\cyrlhk
  \CYRLHK\cyrlje\CYRLJE\cyrm\CYRM\cyrmdsc\CYRMDSC\cyrmhk\CYRMHK
  \cyrn\CYRN\cyrndsc\CYRNDSC\cyrng\CYRNG\cyrnhk\CYRNHK\cyrnje
  \CYRNJE\cyrnlhk\CYRNLHK\cyro\CYRO\cyrotld\CYROTLD\cyrp\CYRP
  \cyrphk\CYRPHK\cyrq\CYRQ\cyrr\CYRR\cyrrdsc\CYRRDSC\cyrrhk
  \CYRRHK\cyrrtick\CYRRTICK\cyrs\CYRS\cyrsacrs\CYRSACRS
  \cyrschwa\CYRSCHWA\cyrsdsc\CYRSDSC\cyrsemisftsn\CYRSEMISFTSN
  \cyrsftsn\CYRSFTSN\cyrsh\CYRSH\cyrshch\CYRSHCH\cyrshha\CYRSHHA
  \cyrt\CYRT\cyrtdsc\CYRTDSC\cyrtetse\CYRTETSE\cyrtshe\CYRTSHE
  \cyru\CYRU\cyrushrt\CYRUSHRT\cyrv\CYRV\cyrw\CYRW\cyry\CYRY
  \cyrya\CYRYA\cyryat\CYRYAT\cyryhcrs\CYRYHCRS\cyryi\CYRYI\cyryo
  \CYRYO\cyryu\CYRYU\cyrz\CYRZ\cyrzdsc\CYRZDSC\cyrzh\CYRZH
  \cyrzhdsc\CYRZHDSC}%
 \let\update@uclc@with@cyrillic\relax
}
%    \end{macrocode}
%
% Here we process each option:
%    \begin{macrocode}
\DeclareOption*{%
   \let\encodingdefault\CurrentOption
%    \end{macrocode}
%    From 2020/02/02 release onward we only load the encoding files if
%    they haven't be loaded already. To check this we look at whether
%    \verb=\T@=\textit{encoding} is already defined. If not, we load it later
%    (indicated by setting the switch
%    \texttt{@tempswa} to true) and we always load if we are using an older
%   format (or rather in a rollback situation).
% \changes{v2.0m}{2020/01/25}{Load each encoding file only once (gh/255)}
%    \begin{macrocode}
   \@tempswafalse
   \@ifl@t@r\fmtversion{2020/02/02}%
       {\expandafter\ifx\csname T@\CurrentOption\endcsname\relax
         \@tempswatrue\fi}%
       {\@tempswatrue}%
%    \end{macrocode}
%    Load if necessary:
%    \begin{macrocode}
   \if@tempswa
%    \end{macrocode}
%
% \changes{v2.1a}{2023/11/07}{Add more explanation to error message (gh/1102)}
%    \begin{macrocode}
     \edef\reserved@f{%
       \lowercase{\def\noexpand\reserved@f{\CurrentOption enc.def}}}%
     \reserved@f
     \InputIfFileExists\reserved@f
          {}{\PackageError{fontenc}%
           {Encoding file `\reserved@f' not found.%
            \MessageBreak
            You might have misspelled the name of the encoding
            \MessageBreak
            or a required support package (e.g., cyrillic) is
            \MessageBreak
            missing in your installation}%
           {Necessary code for this encoding was not
            loaded.\MessageBreak
            Thus calling the encoding later on will
            produce further error messages.}}%
    \let\reserved@f\relax
%    \end{macrocode}
%
% In case the current encoding is one of a list of known
% cyrillic ones we extend the |\@uclclist|:
%    \begin{macrocode}
    \expandafter\in@\expandafter{\CurrentOption}%
                                {T2A,T2B,T2C,X2,LCY,OT2}%
    \ifin@
%    \end{macrocode}
%
% But only if it hasn't already been extended. This might happen if
% there are several calls to fontenc loading one of the above
% encodings. If we don't do this check the |\@uclclist| gets
% unnecessarily big, slowing down the processing at runtime.
% \changes{v1.9v}{1999/06/12}{Extend \cs{@uclclist} only once}
%    \begin{macrocode}
       \expandafter\in@\expandafter\cyra\expandafter
                                {\@uclclist}%
       \ifin@
       \else
         \update@uclc@with@cyrillic
       \fi
    \fi
  \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\ProcessOptions*
%    \end{macrocode}
%
%    We select the new font encoding default (i.e., the last encoding
%    specified in the option list). But this encoding may not work with
%    the current |\f@shape|: e.g., \texttt{LY1} is not defined for
%    \texttt{cmr} and therefore packages switching to \texttt{LY1}
%    usually also change \cs{rmdefault}. But that only applies at
%    |\begin{document}| so we get a spurious warning if we use what
%    \LaTeX{} previously used:
% \changes{v2.0l}{2019/11/22}{Avoid spurious if fontenc selects LY1 as
%    default encoding (gh/199)}
%    \begin{macrocode}
%\fontencoding\encodingdefault\selectfont
%    \end{macrocode}
%    So instead we do this here:
%    \begin{macrocode}
\usefont\encodingdefault\familydefault\seriesdefault\shapedefault
%    \end{macrocode}
%
% To save some space we get rid of the macro extending the
% |\@uclclist| (might have happened already).
%    \begin{macrocode}
\let\update@uclc@with@cyrillic\relax
%    \end{macrocode}
%
% Finally we pretend that the fontenc package wasn't read in. This
% allows for using it several times, e.g., in a class file and in the
% preamble (at the cost of not getting any version info).
% That kind of hackery shows that using a general purpose
% package just for loading an encoding is not the right kind
% of interface for setting up encodings --- it will get replaced at
% some point in the future.
% \changes{v1.9r}{1999/01/07}{Hackery to allow using fontenc several
%    times}
% \changes{v1.9u}{1999/06/10}{Ensure that we also forget old options
%                             (pr/2888)}
% \changes{v2.0o}{2020/02/11}{Update \cs{@fontenc@load@list}
%        with option list (gh/273)}
%    \begin{macrocode}
\let\@elt\relax
\xdef\@fontenc@load@list{\@fontenc@load@list
  \@elt{\csname opt@fontenc.sty\endcsname}}
%    \end{macrocode}
%
% \changes{v2.0z}{2022/05/27}{Save the version string (gh/825)}
%    \begin{macrocode}
\global\expandafter\let\csname ver@@fontenc.sty\expandafter\endcsname
                       \csname ver@fontenc.sty\endcsname
\global\expandafter\let\csname ver@fontenc.sty\endcsname\relax
\global\expandafter\let\csname opt@fontenc.sty\endcsname\relax
\global\let\@ifl@ter@@\@ifl@ter
\def\@ifl@ter#1#2#3#4#5{\global\let\@ifl@ter\@ifl@ter@@}
%</package>
%    \end{macrocode}
%
%
%
% \Finale
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput

^^A  Needed for emacs
^^A
^^A  Local Variables: 
^^A  mode: latex
^^A  coding: utf-8-unix
^^A  End: 
