% \iffalse meta-comment
%
% Copyright 1989-2003 Johannes L. Braams and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% This file is part of the Babel system release 3.7.
% --------------------------------------------------
% 
% It may be distributed under the terms of the LaTeX Project Public
% License, as described in lppl.txt in the base LaTeX distribution.
% Either version 1.2 or, at your option, any later version.
% \fi
% \CheckSum{193}
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*dtx>
\ProvidesFile{basque.dtx}
%</dtx>
%<code>\ProvidesLanguage{basque}
%\fi
%\ProvidesFile{basque.dtx}
        [2003/05/22 v1.0f Basque support from the babel system]
%\iffalse
%% File `Basque.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 - 2003
%%           by Johannes Braams, TeXniek
%
%% Basque Language Definition File
%% Copyright (C) 1997,2002
%%           by Juan M. Aguirregabiria
%              The University of the Basque Country
%              Dept. of Theoretical Physics
%              Apdo. 644
%              E-48080 Bilbao
%              Spain
%              tel: +34 946 012 593
%              fax: +34 944 648 500
%              e-mail: wtpagagj@lg.ehu.es
%              WWW:    http://tp.lc.ehu.es/jma.html
% based on the
% Spanish Language Definition File
% Copyright (C) 1991 - 1998
%           by Julio Sanchez
%              GMV, SA
%              c/ Isaac Newton 11
%              PTM - Tres Cantos
%              E-28760 Madrid
%              Spain
%              tel: +34 1 807 21 85
%              fax +34 1 807 21 99
%              jsanchez@gmv.es
%
% Acknowledgements: I am indebted to Zunbeltz Izaola,
%                   who suggested the use of \discretionary in "-
%
%% Please report errors to: Juan M. Aguirregabiria <wtpagagj@lg.ehu.es>
%%                          (or J.L. Braams <babel@braams.cistron.nl>)
%
%    This file is part of the babel system, it provides the source
%    code for the basque language definition file.
%<*filedriver>
\documentclass{ltxdoc}
\newcommand*\TeXhax{\TeX hax}
\newcommand*\babel{\textsf{babel}}
\newcommand*\langvar{$\langle \it lang \rangle$}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\begin{document}
 \DocInput{basque.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{basque.dtx}
%
%  \section{The Basque language}
%
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate. The original author is Juan M. Aguirregabiria,
%    (\texttt{wtpagagj@lg.ehu.es}) and is based on the Spanish file
%    by Julio S\'anchez,
%    (\texttt{jsanchez@gmv.es}).} defines all the language definition
%    macro's for the Basque language.
%
%    For this language the characters |~| and |"| are made
%    active. In table~\ref{tab:basque-quote} an overview is given of
%    their purpose.
%    \begin{table}[htb]
%     \centering
%     \begin{tabular}{lp{8cm}}
%      \verb="|= & disable ligature at this position.\\
%      |"-| & an explicit hyphen sign, allowing hyphenation
%             in the rest of the word.\\
%      |\-| & like the old |\-|, but allowing hyphenation
%             in the rest of the word. \\
%      |"<| & for French left double quotes (similar to $<<$).\\
%      |">| & for French right double quotes (similar to $>>$).\\
%      |~n| & a n with tilde. Works for uppercase too.
%     \end{tabular}
%     \caption{The extra definitions made by \file{basque.ldf}}
%     \label{tab:basque-quote}
%    \end{table}
%    These active accent characters behave according to their original
%    definitions if not followed by one of the characters indicated in
%    that table.
%
% \changes{basque-1.0f}{2002/01/07}{Changed url's for the patterns
%    file}
%    This option includes support for working with extended, 8-bit
%    fonts, if available. Support is based on
%    providing an appropriate definition for the accent macros on
%    entry to the Basque language. This is automatically done by
%    \LaTeXe\ or NFSS2. If T1 encoding is chosen, and provided that
%    adequate hyphenation patterns\footnote{One source for such
%    patterns is the archive at \texttt{tp.lc.ehu.es} that can be
%    accessed by anonymous FTP or in
%    \texttt{http://tp.lc.ehu.es/jma/basque.html}} are available. 
%    The easiest way to use the new encoding with \LaTeXe{} is
%    to load the package \texttt{t1enc} with |\usepackage|. This must
%    be done before loading \babel.
%
% \StopEventually{}
%
%    The macro |\LdfInit| takes care of preventing that this file is
%    loaded more than once, checking the category code of the
%    \texttt{@} sign, etc.
%    \begin{macrocode}
%<*code>
\LdfInit{basque}\captionsbasque
%    \end{macrocode}
%
%    When this file is read as an option, i.e. by the |\usepackage|
%    command, \texttt{basque} could be an `unknown' language in which
%    case we have to make it known.  So we check for the existence of
%    |\l@basque| to see whether we have to do something here.
%
%    \begin{macrocode}
\ifx\l@basque\@undefined
  \@nopatterns{Basque}
  \adddialect\l@basque0
\fi
%    \end{macrocode}
%
%    The next step consists of defining commands to switch to (and
%    from) the Basque language.
%
% \begin{macro}{\captionsbasque}
%    The macro |\captionsbasque| defines all strings used in 
%    the four standard documentclasses provided with \LaTeX.
% \changes{basque-1.0e}{2000/09/19}{Added \cs{glossaryname}}
% \changes{basque-1.0f}{2002/01/07}{Added translation for Glossary}
%    \begin{macrocode}
\addto\captionsbasque{%
  \def\prefacename{Hitzaurrea}%
  \def\refname{Erreferentziak}%
  \def\abstractname{Laburpena}%
  \def\bibname{Bibliografia}%
  \def\chaptername{Kapitulua}%
  \def\appendixname{Eranskina}%
  \def\contentsname{Gaien Aurkibidea}%
  \def\listfigurename{Irudien Zerrenda}%
  \def\listtablename{Taulen Zerrenda}%
  \def\indexname{Kontzeptuen Aurkibidea}%
  \def\figurename{Irudia}%
  \def\tablename{Taula}%
  \def\partname{Atala}%
  \def\enclname{Erantsia}%
  \def\ccname{Kopia}%
  \def\headtoname{Nori}%
  \def\pagename{Orria}%
  \def\seename{Ikusi}%
  \def\alsoname{Ikusi, halaber}%
  \def\proofname{Frogapena}%
  \def\glossaryname{Glosarioa}%
  }%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\datebasque}
%    The macro |\datebasque| redefines the command |\today| to
%    produce Basque
% \changes{basque-1.0b}{1997/10/01}{Use \cs{edef} to define \cs{today}
%    to save memory}
% \changes{basque-1.0b}{1998/03/28}{use \cs{def} instead of \cs{edef}}
% \changes{basque-1.0c}{1999/11/22}{fixed typo in April's name}
%    \begin{macrocode}
\def\datebasque{%
  \def\today{\number\year.eko\space\ifcase\month\or
    urtarrilaren\or otsailaren\or martxoaren\or apirilaren\or
    maiatzaren\or ekainaren\or uztailaren\or abuztuaren\or
    irailaren\or urriaren\or azaroaren\or
    abenduaren\fi~\number\day}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\extrasbasque}
% \begin{macro}{\noextrasbasque}
%    The macro |\extrasbasque| will perform all the extra definitions
%    needed for the Basque language. The macro |\noextrasbasque| is
%    used to cancel the actions of |\extrasbasque|. For Basque, some
%    characters are made active or are redefined. In particular, the
%    \texttt{"} character and the |~| character receive new
%    meanings. Therefore these characters have to be treated as
%    `special' characters. 
%
%    \begin{macrocode}
\addto\extrasbasque{\languageshorthands{basque}}
\initiate@active@char{"}
\initiate@active@char{~}
\addto\extrasbasque{%
  \bbl@activate{"}%
  \bbl@activate{~}}
%    \end{macrocode}
%    Don't forget to turn the shorthands off again.
% \changes{basque-1.0d}{1999/12/16}{Deactivate shorthands ouside of
%    Basque}
%    \begin{macrocode}
\addto\noextrasbasque{
  \bbl@deactivate{"}\bbl@deactivate{~}}
%    \end{macrocode}
%
%    Apart from the active characters some other macros get a new
%    definition. Therefore we store the current one to be able to
%    restore them later.
%    \begin{macrocode}
\addto\extrasbasque{%
  \babel@save\"%
  \babel@save\~%
  \def\"{\protect\@umlaut}%
  \def\~{\protect\@tilde}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%  \begin{macro}{\basquehyphenmins}
%    Basque hyphenation uses |\lefthyphenmin| and |\righthyphenmin|
%    both set to~2.
% \changes{basque-1.0e}{2000/09/22}{Now use \cs{providehyphenmins} to
%    provide a default value}
%    \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\tw@}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\dieresia}
%  \begin{macro}{\texttilde}
%    The original definition of |\"| is stored as |\dieresia|, because
%    the we do not know what is its definition, since it depends on
%    the encoding we are using or on special macros that the user
%    might have loaded. The expansion of the macro might use the \TeX\
%    |\accent| primitive using some particular accent that the font
%    provides or might check if a combined accent exists in the font.
%    These two cases happen with respectively OT1 and T1 encodings.
%    For this reason we save the definition of |\"| and use that in
%    the definition of other macros. We do likewise for |\'| and
%    |\~|. The present coding of this option file is incorrect in that
%    it can break when the encoding changes. We do not use 
%    |\tilde| as the macro name because it is already defined as
%    |\mathaccent|.
%    \begin{macrocode}
\let\dieresia\"
\let\texttilde\~
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\@umlaut}
%  \begin{macro}{\@tilde}
%    We check the encoding and if not using T1, we make the accents
%    expand but enabling hyphenation beyond the accent. If this is the
%    case, not all break positions will be found in words that contain
%    accents, but this is a limitation in \TeX. An unsolved problem
%    here is that the encoding can change at any time. The definitions
%    below are made in such a way that a change between two 256-char
%    encodings are supported, but changes between a 128-char and a
%    256-char encoding are not properly supported. We check if T1 is
%    in use. If not, we will give a warning and proceed redefining the
%    accent macros so that \TeX{} at least finds the breaks that are
%    not too close to the accent. The warning will only be printed to
%    the log file.
%    \begin{macrocode}
\ifx\DeclareFontShape\@undefined
  \wlog{Warning: You are using an old LaTeX}
  \wlog{Some word breaks will not be found.}
  \def\@umlaut#1{\allowhyphens\dieresia{#1}\allowhyphens}
  \def\@tilde#1{\allowhyphens\texttilde{#1}\allowhyphens}
\else
  \edef\bbl@next{T1}
  \ifx\f@encoding\bbl@next
    \let\@umlaut\dieresia
    \let\@tilde\texttilde
  \else
    \wlog{Warning: You are using encoding \f@encoding\space
      instead of T1.}
    \wlog{Some word breaks will not be found.}
    \def\@umlaut#1{\allowhyphens\dieresia{#1}\allowhyphens}
    \def\@tilde#1{\allowhyphens\texttilde{#1}\allowhyphens}
  \fi
\fi
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%     Now we can define our shorthands: the french quotes,
% \changes{basque-1.0b}{1997/04/03}{Removed empty groups after
%    guillemot characters}  
%    \begin{macrocode}
\declare@shorthand{basque}{"<}{%
  \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
\declare@shorthand{basque}{">}{%
  \textormath{\guillemotright}{\mbox{\guillemotright}}}
%    \end{macrocode}
%    ordinals\footnote{The code for the ordinals was taken from the
%    answer provided by Raymond Chen
%    (\texttt{raymond@math.berkeley.edu}) to a question by Joseph Gil
%    (\texttt{yogi@cs.ubc.ca}) in \texttt{comp.text.tex}.},
%    \begin{macrocode}
  \declare@shorthand{basque}{''}{%
    \textormath{\textquotedblright}{\sp\bgroup\prim@s'}}
%    \end{macrocode}
%    tildes,
%    \begin{macrocode}
\declare@shorthand{basque}{~n}{\textormath{\~n}{\@tilde n}}
\declare@shorthand{basque}{~N}{\textormath{\~N}{\@tilde N}}
%    \end{macrocode}
%    and some additional commands.
%
%    The shorthand |"-| should be used in places where a word contains
%    an explictit hyphenation character. According to the Academy of
%    the Basque language, when a word break occurs at an explicit
%    hyphen it must appear \emph{both} at the end of the first line
%    \emph{and} at the beginning of the second line.
% \changes{changes-1.0f}{2002/01/07}{The hyphen char needs to appear
%    at the beginning of the line as well.}
%    \begin{macrocode}
\declare@shorthand{basque}{"-}{%
  \nobreak\discretionary{-}{-}{-}\bbl@allowhyphens}
\declare@shorthand{basque}{"|}{%
  \textormath{\nobreak\discretionary{-}{}{\kern.03em}%
              \allowhyphens}{}}
%    \end{macrocode}
%
%    The macro |\ldf@finish| takes care of looking for a
%    configuration file, setting the main language to be switched on
%    at |\begin{document}| and resetting the category code of
%    \texttt{@} to its original value.
%    \begin{macrocode}
\ldf@finish{basque}
%</code>
%    \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
