% \iffalse meta-comment
%
% Copyright (C) 1989-1994 by Johannes Braams
% All rights reserved.
% For additional copyright information see further down in this file.
% 
% This file is part of the Babel system, release 3.4 patchlevel 2.
% ----------------------------------------------------------------
% 
% This file is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% 
% 
% IMPORTANT NOTICE:
% 
% For error reports in case of UNCHANGED versions see readme file.
% 
% Please do not request updates from me directly.  Distribution is
% done through Mail-Servers and TeX organizations.
% 
% You are not allowed to change this file.
% 
% You are allowed to distribute this file under the condition that
% it is distributed together with all files mentioned in manifest.txt.
% 
% If you receive only some of these files from someone, complain!
% 
% You are NOT ALLOWED to distribute this file alone.  You are NOT
% ALLOWED to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
% \fi
% \CheckSum{340}
%%% \iffalse ============================================================
%%%  @LaTeX-style-file{
%%%     author          = "Johannes L. Braams.",
%%%     version         = "1.4d",
%%%     date            = "26 June 1994",
%%%     time            = "00:24:15 MET",
%%%     filename        = "esperant.dtx",
%%%     address         = "PTT Research
%%%                        St. Paulusstraat 4
%%%                        2264 XZ Leidschendam
%%%                        The Netherlands",
%%%     telephone       = "(70) 3325051",
%%%     FAX             = "(70) 3326477",
%%%     checksum        = "01262 385 1778 14938",
%%%     email           = "J.L.Braams@research.ptt.nl (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "",
%%%     supported       = "yes",
%%%     abstract        = "",
%%%     docstring       = "This file contains the esperanto language
%%%                        specific definitions for the babel system.",
%%%  }
%%%
%%%  ====================================================================
%%% \fi
% \def\filename{esperant.dtx}
% \def\fileversion{v1.d4}
% \def\filedate{1994/06/26}
%
% \iffalse
% Babel DOCUMENT-STYLE option for LaTeX version 2e
% Copyright (C) 1989 - 1994
%           by Johannes Braams, PTT Research Neher Laboratories
%
% Please report errors to: J.L. Braams
%                          J.L.Braams@research.ptt.nl
%
%    This file is part of the babel system, it provides the source code for
%    the Esperanto language-specific file.
%    A contribution was made by Ruiz-Altaba Marti (ruizaltb@cernvm.cern.ch)
%    Code from esperant.sty version 1.1 by Joerg Knappen
%    ({\tt knappen@vkpmzd.kph.uni-mainz.de}) was included in version 1.2.
%<*filedriver>
\documentclass{ltxdoc}
\newcommand\TeXhax{\TeX hax}
\newcommand\babel{{\sf babel}}
\newcommand\ttbs{\char'134}
\newcommand\langvar{$\langle \it lang \rangle$}
\newcommand\note[1]{}
\newcommand\bsl{\protect\bslash}
\newcommand\Lopt[1]{{\sf #1}}
\newcommand\file[1]{{\tt #1}}
\begin{document}
 \DocInput{esperant.dtx}
\end{document}
%</filedriver>
%\fi
% \changes{esperanto-1.0a}{15 july 91}{Renamed babel.sty in babel.com}
% \changes{esperanto-1.1}{15 feb 92}{Brought up-to-date with babel 3.2a}
% \changes{esperanto-1.2}{18 feb 92}{Included code from {\tt esperant.sty}}
% \changes{esperanto-1.4a}{04 feb 94}{Updated for LaTeX2e}
% \changes{esperanto-1.4d}{1994/06/25}{Removed the use of
%    \cs{filedate}, moved Identification after loading of babel.def}
%
%  \section{The Esperanto language}
%
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate. A contribution was made by Ruiz-Altaba Marti ({\tt
%    ruizaltb@cernvm.cern.ch}). Code from the file {\tt esperant.sty}
%    by J\"org Knappen ({\tt knappen@vkpmzd.kph.uni-mainz.de}) was
%    included.} defines all the language-specific macros for the
%    Esperanto language.
%
%    For this language the character |^| is made active.
%    In table~\ref{tab:esp-act} an overview is given of its purpose.
% \begin{table}[htb]
%    \centering
%     \begin{tabular}{lp{8cm}}
%      |^u| & gives \u u, with hyphenation in the rest of the word
%                   allowed\\
%      |^U| & gives \u U, with hyphenation in the rest of the word
%                   allowed\\
%      |^h| & prevents \^h from becoming too tall\\
%      |^j| & gives \^\j\\
%      \verb=^|= & inserts a |\discretionary{-}{}{}|\\
%      |^a| & gives \^a with hyphenation in the rest of the word
%                   allowed, this works for all other letters as
%                   well.\\
%      \end{tabular}
%      \caption{The funtions of the active character for Esperanto.}
%    \label{tab:esp-act}
% \end{table}
%
%  \StopEventually{}
%
%    As this file needs to be read only once, we check whether it was
%    read before. If it was, the command |\captionsesperanto| is already
%    defined, so we can stop processing.
%
% \changes{esperanto-1.0a}{15 july 91}{Added reset of catcode of @ before
%                                  {\tt\bsl endinput}.}
% \changes{esperanto-1.0b}{29 okt 91}{Removed use of {\tt\bsl @ifundefined}}
%    \begin{macrocode}
\ifx\undefined\captionsesperanto
\else
  \selectlanguage{esperanto}
  \expandafter\endinput
\fi
%    \end{macrocode}
%
% \begin{macro}{\atcatcode}
%    This file, {\tt esperanto.sty}, may have been read while \TeX\ is
%    in the middle of processing a document, so we have to make sure
%    the category code of {\tt @} is `letter' while this file is being
%    read. We save the category code of the @-sign in |\atcatcode| and
%    make it `letter'. Later the category code can be restored to
%    whatever it was before.
%
% \changes{esperanto-1.0a}{15 july 91}{Modified handling of catcode of
%    @ again.}
% \changes{esperanto-1.0b}{29 okt 91}{Removed use of `makeatletter and
%    hence the need to load \file{latexhax.com}}
%    \begin{macrocode}
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
%    \end{macrocode}
% \end{macro}
%
%    Now we determine whether the the common macros from the file
%    \file{babel.def} need to be read. We can be in one of two
%    situations: either another language option has been read earlier
%    on, in which case that other option has already read
%    \file{babel.def}, or {\tt esperanto} is the first language option
%    to be processed. In that case we need to read \file{babel.def}
%    right here before we continue.
%
% \changes{esperanto-1.1}{15 feb 92}{Added {\tt\bsl relax} after the
%    argument of {\tt\bsl input}}
%    \begin{macrocode}
\ifx\undefined\babel@core@loaded\input babel.def\relax\fi
%    \end{macrocode}
%
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%    \begin{macrocode}
\ProvidesFile{esperant.sty}[1994/06/26 v1.4d
         Esperanto support from the babel system]
%    \end{macrocode}
%
%    Another check that has to be made, is if another language
%    specific file has been read already. In that case its definitions
%    have been activated. This might interfere with definitions this
%    file tries to make. Therefore we make sure that we cancel any
%    special definitions. This can be done by checking the existence
%    of the macro |\originalTeX|. If it exists we simply execute it,
%    otherwise it is |\let| to |\empty|.
% \changes{esperanto-1.0a}{15 july 91}{Added {\tt\bsl let\bsl
%    originalTeX\bsl relax} to test for existence}
% \changes{esperanto-1.1}{15 feb 92}%
%        {{\tt\bsl originalTeX} should be expandable, {\tt\bsl let} it
%         to {\tt\bsl empty}}
%    \begin{macrocode}
\ifx\undefined\originalTeX \let\originalTeX\empty \else\originalTeX\fi
%    \end{macrocode}
%
%    When this file is read as an option, i.e. by the |\usepackage|
%    command, {\tt esperanto} will be an `unknown' language in which
%    case we have to make it known. So we check for the existence of
%    |\l@esperanto| to see whether we have to do something here.
%
% \changes{esperanto-1.0b}{29 okt 91}{Removed use of {\tt\bsl
%    makeatletter}}
% \changes{esperanto-1.1}{15 feb 92}{Added a warning when no
%    hyphenation patterns were loaded.}
% \changes{esperanto-1.4d}{1994/06/25}{Use \cs{@nopatterns} for the
%    warning}
%    \begin{macrocode}
\ifx\undefined\l@esperanto
  \@nopatterns{Esperanto}
  \adddialect\l@esperanto0\fi
%    \end{macrocode}
%
%    The next step consists of defining commands to switch to the
%    Esperanto language. The reason for this is that a user might want
%    to switch back and forth between languages.
%
% \begin{macro}{\captionsesperanto}
%    The macro |\captionsesperanto| defines all strings used
%    in the four standard documentclasses provided with \LaTeX.
% \changes{esperanto-1.1}{15 feb 92}{Added `seename, `alsoname and
%    `prefacename}
% \changes{esperanto-1.3}{10 jul 93}{Repaired a number of mistakes,
%    indicated by D. Ederveen}
% \changes{esperanto-1.3}{15 jul 93}{`headpagename should be
%    `pagename}
% \changes{esperanto-1.4a}{04 feb 94}{added missing closing brace}
%    \begin{macrocode}
\addto\captionsesperanto{%
  \def\prefacename{Anta\u{u}parolo}%
  \def\refname{Cita\^\j{}oj}%
  \def\abstractname{Resumo}%
  \def\bibname{Bibliografio}%
  \def\chaptername{{\^C}apitro}%
  \def\appendixname{Apendico}%
  \def\contentsname{Enhavo}%
  \def\listfigurename{Listo de figuroj}%
  \def\listtablename{Listo de tabeloj}%
  \def\indexname{Indekso}%
  \def\figurename{Figuro}%
  \def\tablename{Tabelo}%
  \def\partname{Parto}%
  \def\enclname{Aldono(j)}%
  \def\ccname{Kopie al}%
  \def\headtoname{Al}%
  \def\pagename{Pa\^go}%
  \def\subjectname{Temo}%
  \def\seename{vidu}%   a^u: vd.
  \def\alsoname{vidu anka\u{u}}}% a^u vd. anka\u{u}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dateesperanto}
%    The macro |\dateesperanto| redefines the command |\today| to
%    produce Esperanto dates.
% \changes{esperanto-1.}{10 jul 93}{Removed the capitals from `today}
%    \begin{macrocode}
\def\dateesperanto{%
\def\today{\number\day{--a}~de~\ifcase\month\or
  januaro\or februaro\or marto\or aprilo\or majo\or junio\or
  julio\or a\u{u}gusto\or septembro\or oktobro\or novembro\or
  decembro\fi,\space \number\year}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\extrasesperanto}
% \begin{macro}{\noextrasesperanto}
%    The macro |\extrasesperanto| performs all the extra definitions
%    needed for the Esperanto language. The macro |\noextrasesperanto|
%    is used to cancel the actions of |\extrasesperanto|. The
%    character |^| is used as an active character for Esperanto.
%    Therefore the character has to included in the macros
%    |\dospecials| and |\@sanitize|.
%
%    \begin{macrocode}
\addto\extrasesperanto{\babel@add@special\^}
\addto\noextrasesperanto{\babel@remove@special\^}
%    \end{macrocode}
%
%    Before we can make the |^| an active character we have to store
%    its category code in order to restore it when |\originalTeX| is
%    called. Additionally we define |\active@hat| (cf. |\active@dq| in
%    {\tt germanb.sty}) after we have saved the original meaning.
%    \begin{macrocode}
\addto\extrasesperanto{%
  \babel@savevariable{\catcode`\^}%
  \babel@save\active@hat
  \catcode`\^\active \let\active@hat\esp@active@hat}
%    \end{macrocode}
%
%    Now we can add the code to make the |^| active.
% \changes{v1.4c}{1994/06/09}{A spurious bar found its way into the
%    code. Removed}
%    \begin{macrocode}
\begingroup \catcode`\^\active
\def\x{\endgroup
  \addto\extrasesperanto{\babel@save^\let^\active@hat}}
\x
%    \end{macrocode}
%    This should make sure that when the |^| ends up in a moving
%    argument it expands to |\active@hat|.
% \end{macro}
% \end{macro}
%
% \begin{macro}{\active@hat}
% \changes{esperanto-1.4a}{05 feb 94}{Removed `hat; it is superluous,
%    use `sp instead}
%
%    We make sure that when an active circumflex gets ``lost'' in
%    another language it expands to a |^| with the right category
%    code.
%    \begin{macrocode}
\begingroup \catcode`\^\active
  \def\x{\endgroup
    \let^\sp
    \let\active@hat\sp}
\x
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\esp@active@hat}
%    The active |^| finally expands to the macro |\esp@active@hat|.
%    This macro implements the functions that are indicated in
%    table~\ref{tab:esp-act}.
%    \begin{macrocode}
\def\esp@active@hat#1{%
    \ifmmode\sp{#1}%
    \else\ifx#1u\u u\allowhyphens
    \else\ifx#1U\u U\allowhyphens
    \else\ifx#1h{h\llap{\^{}}}\allowhyphens
    \else\ifx#1j\^\j\allowhyphens
    \else\ifx#1|\discretionary{-}{}{}\allowhyphens
    \else\^{#1}\allowhyphens
    \fi\fi\fi\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Esper}
% \begin{macro}{\esper}
%    In \file{esperant.sty} J\"org Knappen provides the macros
%    |\esper| and |\Esper| that can be used instead of |\alph| and
%    |\Alph|. These macros are available in this file as well.
%
%    Their definition takes place in three steps. First the toplevel.
%    \begin{macrocode}
\def\esper#1{\@esper{\@nameuse{c@#1}}}
\def\Esper#1{\@Esper{\@nameuse{c@#1}}}
%    \end{macrocode}
%    Then the first five occasions that are probably used the most.
%    \begin{macrocode}
\def\@esper#1{\ifcase#1\or a\or b\or c\or \^c\or d\else\@iesper{#1}\fi}
\def\@Esper#1{\ifcase#1\or A\or B\or C\or \^C\or D\else\@Iesper{#1}\fi}
%    \end{macrocode}
%    And the 33 other cases.
%    \begin{macrocode}
\def\@iesper#1{\ifcase#1\or \or \or \or \or \or e\or f\or g\or \^g\or
    h\or h\llap{\^{}}\or i\or j\or \^\j\or k\orl\or m\or n\or o\or
    p\or s\or \^s\or t\or u\or \u{u}\or v\or z\else\@ctrerr\fi}
%    \end{macrocode}
%    \begin{macrocode}
\def\@Iesper#1{\ifcase#1\or \or \or \or \or \or E\or F\or G\or \^G\or
    H\or \^H\or I\or J\or \^\J\or K\or L\or M\or N\or O\or
    P\or S\or \^S\or T\or U\or \u{U}\or V\or Z\else\@ctrerr\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\hodiau}
% \begin{macro}{\hodiaun}
%    In \file{esperant.sty} J\"org Knappen provides two alternative
%    macros for |\today|, |\hodiau| and |\hodiaun|. The second macro
%    produces an accusative version of the date in Esperanto.
%    \begin{macrocode}
\addto\dateesperanto{\def\hodiau{la \today}}
\def\hodiaun{la \number\day --an~de~\ifcase\month\or
  januaro\or februaro\or marto\or aprilo\or majo\or junio\or
  julio\or a\u{u}gusto\or septembro\or oktobro\or novembro\or
  decembro\fi, \space \number\year}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    Our last action is to activate the commands we have just defined,
%    by calling the macro |\selectlanguage|.
%    \begin{macrocode}
\selectlanguage{esperanto}
%    \end{macrocode}
%    Finally, the category code of {\tt @} is reset to its original
%    value. The macrospace used by |\atcatcode| is freed.
% \changes{esperanto-1.0a}{15 july 91}{Modified handling of catcode of
%    the @-sign.}
%    \begin{macrocode}
\catcode`\@=\atcatcode \let\atcatcode\relax
%    \end{macrocode}
%
% \Finale
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\endinput
