% \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
%%% ====================================================================
%%%  @TeX-file{
%%%     author          = "Johannes",
%%%     version         = "1.0",
%%%     date            = "05 December 1995",
%%%     time            = "22:43:54 MET",
%%%     filename        = "tbstatus.tex",
%%%     address         = "TeXniek,
%%%                        Kersengaarde 33
%%%                        2723 BP Zoetermeer
%%%                        The Netherlands",
%%%     telephone       = "+31 79 352 28 19",
%%%     FAX             = "+31 70 343 23 95",
%%%     checksum        = "",
%%%     email           = "babel@braams.cistron.nl (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "",
%%%     supported       = "yes",
%%%     abstract        = "",
%%%     docstring       = "This article is derived from my
%%%                        presentation at the EuroTeX'95 conference
%%%                        and will appear in a future issue of
%%%                        TuGboat.
%%%
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================
\NeedsTeXFormat{LaTeX2e}
\IfFileExists{ltugboat.cls}{%
  \documentclass{ltugboat}
  \def\rtitlex{TUGboat, Volume 16 (1995), No. 4}
  %\def\midrtitle{}
  %\def\PrelimDraftfooter{}
  %\let\TBmaketitle\maketitle
  %\SelfDocumenting
  \setcounter{page}{1}
  }{%
  \documentclass{article}
  \newcommand\address[1]{}
  \newcommand\netaddress[1]{}
  \newcommand\TUB{\textsl{TUGboat\/}}
  \newcommand\TeXhax{\TeX hax}}
\usepackage{shortvrb}
\MakeShortVerb{\|}

\newcommand\figrule{\kern3pt\hrule\kern3pt}
\newcommand*{\file}[1]{\texttt{#1}}
\newcommand*{\cls}[1]{\texttt{#1}}
\newcommand*{\pkg}[1]{\texttt{#1}}
\newcommand*{\Lenv}[1]{\textsf{#1}}
\newcommand*{\opt}[1]{\textsf{#1}}
\newcommand*{\meta}[1]{\mbox{$\langle$\it #1\/$\rangle$}}
\newcommand*\babel{\textsf{babel}}
\newcommand*\bs{\char'134}
\let\osn\oldstylenums

\begin{document}

\title{The status of \babel}
\author{Johannes L. Braams}
\address{%
  \TeX niek\\
  Kersengaarde 33\\
  2723 BP Zoetermeer\\
  The Netherlands}
\netaddress{babel@braams.cistron.nl}
\date{september 1995}
\maketitle

\begin{abstract}
  In this article I will give an overview of what has happened to
  \babel\ lately. First I will briefly describe the history of \babel;
  then I will introduce the concept of `shorthands'. New ways of
  changing the `language' have been introduced and \babel\ can now
  easily be adapted for local needs. Finally I will discuss some
  compatibility issues.
\end{abstract}

\section{A brief history of \babel}

The first ideas of developing a set of macros to support typesetting
documents with \TeX\ in languages other than English developed around
the time of the Euro\TeX\ conference in Karls\-ruhe (\osn{1989}). Back
then I had created support for typesetting in Dutch by stealing
\file{german.tex} (by Hubert Partl c.s.) and modifying it for Dutch
conventions. This worked, but I was not completely satisfied as I hate
the duplication of code. Soon after that I found that more `copies' of
\file{german.tex} existed to support other languages. This led me to
the idea of creating a package that combined these kind of language
support packages. It would have to consist of at least two `layers':
all the code the various copies of \file{german.tex} had in common in
one place, loaded only once by \TeX, and a set of files with the code
needed to support language specific needs. During the Karlsruhe
conference the name `\babel' came up in discussions I had. It seemed
an appropriate name and I sticked to it.

\begin{table}[hbt]
  \begin{center}
    \begin{tabular}{l}
      \hline
      First ideas at Euro\protect\TeX'89 Karlsruhe\\
      First published in TUGboat 12--2\\
      Update article in TUGboat 14--1\\
      Presentation of new release at Euro\protect\TeX'95\\
      \hline
    \end{tabular}
    \caption{A brief history of \babel}
  \end{center}
\end{table}

After the conference I started to work on ``\babel, a multilingual
style-option system for use with \LaTeX' standard document styles''.
The first release with support for about half a dozen languages
appeared in the first half of \osn{1990}. In TUGboat volume \osn{12}
number \osn{2} an article appeared describing \babel.  Soon thereafter
people started contributing translations for the `standard terms' for
languages not yet present in \babel. The next big update appeared in
\osn{1992}, accompanied by an article in TUGboat volume \osn{14}
number \osn{1}. The main new features were that an interface was added
to `push' and `pop' macro definitions and values of registers. Also
some code was moved from language files to the core of \babel. In
\osn{1994} some changes were needed to get \babel\ to work with
\LaTeXe. As it turned out a lot of problems were still unsolved,
amongst which the incompatibility between \babel\ and the use of
\textsc{T}\osn{1} encoded fonts was most important.

\noindent Therefore \babel\ version \osn{3}.\osn{5} has appeared.
It's main features are:

\begin{itemize}
\item complete rewrite of the way active characters are dealt with;
\item new ways to switch the language;
\item A language switch is also written to the \file{.aux} file;
\item possibility to `configure' the language specific files;
\item extended syntax of \file{language.dat};
\item compatibility with both the \pkg{inputenc} and\\
  \pkg{fontenc} packages; 
\item new languages (breton, estonian, irish, scottish, lower and
  upper sorbian).
\end{itemize}

\noindent These changes are described in the remainder of this article.

\section{Shorthands and active characters}

During \babel's lifetime the number of languages for which one or more
characters were made active has grown. Until \babel\ release
\osn{3}.\osn{4} this needed a lot of duplication of code for each
extra active character. A situation with which I obviously was not
very happy as I hate the duplication of code. Another problematic
aspect of the way \babel\ dealt with active characters was the way
\babel\ made it possible to still use them in the arguments of cross
referencing commands. \textsf{Babel} did this with a trick that
involves the use of |\meaning|. This resulted in the fact that the
argument of |\label| was no longer expanded by \TeX.

Because of these problems I set out to find a different implementation
of active characters. A starting point was that a character that is
made active should remain active for the rest of the document; only
it's definition should change. During the development of this new
implementation it was suggested in discussions I had within the
\LaTeX3 team to devise a way to have `different kinds' of active
characters. Out of this discussion came the current `shorthands'.

\begin{quote}
  \textsl{A shorthand is a sequence of one or two characters that
    expands to arbitrary \TeX\ code.}
\end{quote}

These shorthands are implemented in such a way that there are three
levels of shorthands:

\begin{itemize}
\item user level
\item language level
\item system level
\end{itemize}

\noindent Shorthands can be used for different kinds of things:
\begin{itemize}
\item the character \verb=~= is redefined by \babel\ as a one
  character, system level shorthand;
\item In some languages shorthands such as \verb="a= are defined to be
  able to hyphenate the word;
\item In some languages shorthands such as \verb=!= are used to insert
  the right amount of white space.
\end{itemize}

When you want to use or define shorthands you should keep the
following in mind:
\begin{itemize}
\item User level takes precedence over language level;
\item Language level takes precedence over system level;
\item One character shorthands take precedence over two character
  shorthands;
\item Shorthands are written unexpanded to \file{.aux} files.
\end{itemize}

\noindent In table~\ref{tab:sh-ov} an overview is given of the
various shorthand characters that are used for different languages.

\begin{table}[ht]
  \begin{center}
    \begin{tabular}{ll}
      \hline
      \texttt{\char'176} & system, catalan, estonian, galician, spanish \\
      \texttt{:} & breton, francais, turkish \\
      \texttt{;} & breton, francais \\
      \texttt{!} & breton, francais, turkish \\
      \texttt{?} & breton, francais \\
      \texttt{"} & catalan, danish, dutch, estonian, finnish\\
                 & galician, german, polish, portuguese, slovene\\
                 & spanish, upper~sorbian\\
      \texttt{`} & catalan (optional)\\
      \texttt{'} & catalan, galician, spanish (optional)\\
      \texttt{\char'136} & esperanto\\
      \texttt{=} & turkish \\
      \hline
    \end{tabular}
    \caption{Overview of shorthands}\label{tab:sh-ov}
  \end{center}
\end{table}

Note that the acute and grave characters are only used as shorthand
characters when the options \opt{activeacute} and \opt{activegrave}
are used.

On the user level three additional commands are available to deal with
shorthands:
\begin{description}
\item[\texttt{\bs useshorthands}] This command takes one argument, the
  character that should become a shorthand character.
\item[\texttt{\bs defineshorthand}] This command takes two arguments,
  the first argument being the shorthand character sequence, the
  second argument being the code the shorthand should expand to.
\item[\texttt{\bs languageshorthands}] This last command (which takes
  one argument, the name of a language) can be used to switch to the
  shorthands of another language, \emph{not} switching other language
  facilities. Of course this only works if both languages were
  specified as an option when loading the package \babel.
\end{description}

On the level of the language definition files four new commands are
introduced to interface with the shorthand code.
\begin{description}
\item[\texttt{\bs initiate@active@char}] This command is used to tell
  \LaTeX\ that the character in its argument is going to be used as a
  shorthand character. It makes the character active, but lets it
  expand to its non-active self.
\item[\texttt{\bs bbl@activate}] This can be used to switch
  the expansion of an active character to its active code.
\item[\texttt{\bs bbl@deactivate}] This command resets the expansion
  of an active character to expand to its non-active self.
\item[\texttt{\bs declare@shorthand}] This command is the internal
  command for (and also used by) |\defineshorthand|; it has
  \emph{three} arguments: the first argument is the name of the
  language for which to define the shorthands, the other two are the
  same as for |\defineshorthand|.
\end{description}

One of the goals of the introduction of shorthands was to reduce the
amount of code needed in the language definition files to support
active characters. This goal has been reached; when a language needs
the double quote character (\texttt{"}) to be active all one has to
put into the language definition file are code fragments such as shown
in figure~\ref{fig:dq}.

\begin{figure}[ht]
  \figrule
\begin{verbatim}
\initiate@active@char{"}
\addto\extrasdutch{%
  \languageshorthands{dutch}%
  \bbl@activate{"}}
...
\declare@shorthand{dutch}{"`}{%
  \textormath{\quotedblbase{}}%
             {\mbox{\quotedblbase}}}
...
\end{verbatim}
  \figrule
  \caption{Example of defining a shorthand}\label{fig:dq}
\end{figure}

Apart from removing a lot of code from language definition files by
introducing shorthands, some other code has been moved to
\file{babel.def} as well. In some language definition files it was
necessary to provide access to glyphs that are not normally easily
available (such as the |\quotedblbase| in the example in
figure~\ref{fig:dq}. Some of these glyphs have to be `constructed' for
\textsc{ot}\osn{1} encoding while they are present in
\textsc{t}\osn{1} encoded fonts. Having all such (encoding dependent)
code together in one place has the advantage these glyphs are the same
for all the language definition files of \babel; also maintenance is
easier this way.

\section{Switching the language}

Until release \osn{3}.\osn{5} \babel\ only had \emph{one} command to
switch between languages: |\selectlanguage|. It takes the name of the
language to switch to as an argument; the command is used as a
declaration and always switches everything\footnote{that means the
  hyphenation pattern, the \texttt{\bs lefthyphenmin} and \texttt{\bs
    righthyphenmin} parameters, the translations of the words, the
  date and the specials}. Two new ways to switch to another language
have now been introduced.

\begin{description}
\item[\texttt{\bs selectlanguage}] This command was available in
  \babel\ from the start.
\item[\texttt{\bs foreignlanguage}] This new command is meant to be
  used when a short piece of text (such as a quote) comes from another
  language. This text should not be longer than \emph{one} paragraph.
  For the text the hyphenation patterns and the specials are switched.
  The command has two arguments: the name of the language and the text
  from that language.
\item[environment `otherlanguage'] This new environment switches the
  same aspects as the command |\selectlanguage| does. The difference
  is that the switches are local to the environment whereas one either
  has to use |\selectlanguage| in a group to get the same effect or
  one has to issue multiple |\selectlanguage| commands. Also the
  environment is one of the things needed to enable the development of
  language definition files that support right-to-left typesetting.
\end{description}

An aspect of some multilingual documents might be that they have
section titles or figure captions in different languages. For this to
work properly \babel\ now writes some information on the \file{.aux}
file when a language switch from either |\selectlanguage| or the
\Lenv{otherlanguage} environment occurs.  \textsf{Babel} nows about
the \file{.toc}, \file{.lof} and \file{.lot} files; if you have added
an extra table of contents you should be aware of this.
  
\section{Adapting \babel\ for local usage}

In the past people have had to find ways to adapt \babel\ to document
classes that have been developed locally (implementing house style for
instance). Some have found ways to that without changing any of the
babel files, others have modified language definition files and have
found themselves having to make these changes each time a new release
of \babel\ is made available\footnote{which doesn't happen too often
  \texttt{;-)}.}. It has been suggested to provide an easier way of
doing this. Therefore I have copied the concept of configuration files
from \LaTeXe\ and introduced language configuration files. For each
language definition file that is loaded \LaTeX\ will try to find a
configuration file. Such files have the same name as the language
definition file; except for their extension which has to be
\file{.cfg}.

\section{Loading hyphenation patterns}

An important change to the core of \babel\ is that the syntax of
\file{language.dat} has been extended. This was suggested by Bernard
Gaulle, author of the package \pkg{french}. His package supports an
enhanced version of \file{language.dat} in which one can optionally
indicate that a file with a list of hyphenation excpetions has to be
loaded. It is also possible to have more than one name for the same
hyphenation pattern register.

\begin{figure}[ht]
  \figrule
\begin{verbatim}
% File    : language.dat
% Purpose : specify which hypenation 
%           patterns to load while running
%           iniTeX 
=american
english hyphen.english exceptions.english
=USenglish
french  fr8hyph.tex
english ukhyphen.tex
=UKenglish
=british
dutch   hyphen.dutch
german  hyphen.german 
\end{verbatim}
  \figrule
  \caption{Example of \file{language.dat}}\label{fig:l.d}
\end{figure}

As you can see in the example of \file{language.dat} in
figure~\ref{fig:l.d}, an equals sign ($=$) on the beginning of a line
now has a significant meaning. It tells \LaTeX\ that the name which
follows the equals sign is to be an alternate name for the hyphenation
patterns that were loaded last. As you probably expect, there is one
exception to this rule: when the first (non-comment) line starts with
an equals sign it will be an alternate name for the \emph{next}
hyphenation patterns that will be loaded. Hence, in the example the
hyphenation patterns stored in the file \file{hyphen.english} will be
known to \TeX\ as: `american', `english' and `USenglish'. You can also
see in figuree~\ref{fig:l.d} that for `english' an extra file is
specified. It will be loaded after \file{hyphen.english} and should
contain some hyphenation exceptions.

\section{Compatibility with other formats}

This release of \babel\ has been tested with \LaTeXe; with and
without either of the packages \pkg{inputenc} or \pkg{fontenc}. There
should no longer be any problems using one (or both) of these packages
together with \babel.

\noindent This release has also been tested with \textsc{Plain}~\TeX, it should
not provide any problems when used with that format.  Therefore
\babel~version \osn{3}.\osn{5} should not pose any problems when used
with any format which is based on \textsc{Plain}~\TeX; this has
\emph{not} been tested by me though.  Some provisions are made to make
\babel~\osn{3}.\osn{5} work with \LaTeX$\:$\osn{2}.\osn{09}; but not
all features may work as expected as I haven't tested this fully.

Please note that although it was necessary to copy parts of
\pkg{inputenc} and \pkg{fontenc} this does not mean that you get
\textsc{t}\osn{1} support in \textsc{Plain}~\TeX, simply by adding
\babel. To acheive that much more work is needed.

\end{document}
