summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-10-12 22:48:28 +0000
committerKarl Berry <karl@freefriends.org>2013-10-12 22:48:28 +0000
commit246b5665edc2af75b55662b748e9ad83f3dac101 (patch)
treeee34732675812d84422a6593f588e528e3d6fdf2 /Master/texmf-dist/source/latex
parent0ec188e4bda5bbce1ca6bb39f8e121f7c47d0adf (diff)
babel (12oct13)
git-svn-id: svn://tug.org/texlive/trunk@31886 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.dtx2036
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.ins93
-rw-r--r--Master/texmf-dist/source/latex/babel/bbcompat.dtx9
-rw-r--r--Master/texmf-dist/source/latex/babel/bbplain.dtx728
-rw-r--r--Master/texmf-dist/source/latex/babel/bbunicode.dtx50
5 files changed, 1669 insertions, 1247 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index 15a5b97bfb4..ba29be7792f 100644
--- a/Master/texmf-dist/source/latex/babel/babel.dtx
+++ b/Master/texmf-dist/source/latex/babel/babel.dtx
@@ -26,7 +26,7 @@
%
% 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.
+% extension |.ins|) which are part of the distribution.
% \fi
% \CheckSum{5011}
%
@@ -44,7 +44,7 @@
%
%% File 'babel.dtx'
%\fi
-%%\ProvidesFile{babel.dtx}[2013/05/16 v3.9f The Babel package]
+%%\ProvidesFile{babel.dtx}[2013/10/10 v3.9g The Babel package]
%\iffalse
%
% Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX;
@@ -60,8 +60,11 @@
%
%<*filedriver>
\documentclass{ltxdoc}
+\usepackage{bera}
\raggedright
\addtolength{\textwidth}{25pt}
+\addtolength{\textheight}{3.5cm}
+\addtolength{\topmargin}{-2cm}
\font\manual=logo10 % font used for the METAFONT logo, etc.
\newcommand*\MF{{\manual META}\-{\manual FONT}}
\newcommand*\babel{\textsf{babel}}
@@ -86,7 +89,9 @@
\newcommand*\pkg[1]{\texttt{#1}}
\addtolength{\oddsidemargin}{1em}
% Stolen and adapted from microtype:
-\usepackage{color}
+\usepackage{color,colortbl}
+\newcommand\New[1]{%
+ \colorbox[rgb]{.92, .86, .73}{New #1}\enspace\ignorespaces}
\definecolor{thered} {rgb}{0.65,0.04,0.07}
\definecolor{thegreen}{rgb}{0.06,0.44,0.08}
\definecolor{thegrey} {gray}{0.8}
@@ -104,7 +109,7 @@
\babelhyphen,\babelhyphenation,\spanishhyphenmins,\addto,
\StartBabelCommands,\SetString,\EndBabelCommands,\shorthandoff,
\languageshorthands,\useshorthands,\AddBabelHook,\SetStringLoop,
- \SetCase,\AfterBabelLanguage},
+ \SetCase,\AfterBabelLanguage,\SetHyphenMap,\BabelLowerMM},
keywordstyle=[0]\color{thered},
keywords=[1]{ngerman,italian,dutch,english,main,esperanto,
frenchb,shorthands,extrasfrench,extrasrussian,extrasenglish,
@@ -132,6 +137,23 @@
\def\args#1{%
\def\bbl@tempa{#1}%
\ifx\bbl@tempa\@empty\else#1\vskip1ex\fi\ignorespaces}
+\begingroup % Changes to ltxdoc
+ \catcode`\<\active
+ \catcode`\>\active
+ \gdef\check@plus@etc{%
+ \let\bbl@next\pm@module
+ \ifx*\next
+ \let\bbl@next\star@module
+ \else\ifx/\next
+ \let\bbl@next\slash@module
+ \else\ifx<\next
+ \let\bbl@next\var@module
+ \fi\fi\fi
+ \bbl@next}
+ \gdef\var@module#1#2#3>>{%
+ $\langle$\pm@module#2#3>$\rangle$%
+ \ifx*#2\ $\equiv$\fi}
+\endgroup
\makeatother
\begin{document}
\title{Babel, a multilingual package for use with \LaTeX's standard
@@ -146,10 +168,39 @@
\normalsize \texttt{www.tex-tipografia.com}}
\date{Typeset \today}
-
-\maketitle
-
-\begin{abstract}
+\begin{titlepage}
+\begin{minipage}[t][0pt]{30cm}
+\vspace{-3cm}\hspace{-7cm}
+\sffamily
+\begin{tabular}{p{8cm}p{15cm}}
+\cellcolor[rgb]{.86,.73,.67}
+&\cellcolor[rgb]{.95,.95,.95}
+\vspace{3.6cm}%
+\color[rgb]{.55,.4,.35}
+\leftskip5mm
+\sffamily\fontsize{72}{72}\selectfont Babel
+\vspace{1.8cm}
+\\
+\cellcolor[rgb]{.95,.95,.95}
+\vspace{2cm}\hspace{1.5cm}
+\begin{minipage}{5cm}
+\Large
+Version 3.9g\newline
+2013/10/10
+
+\vspace{1cm}
+\textit{Original author}\newline
+Johannes L. Braams
+
+\vspace{.3cm}
+\textit{Current maintainer}\newline
+Javier Bezos
+\end{minipage}
+&\cellcolor[rgb]{.92, .86, .73}
+\vspace{2cm}
+\leftskip5mm
+\begin{minipage}{10cm}
+\large\setlength\parskip{3mm}\raggedright
The standard distribution of \LaTeX\ contains a number of document
classes that are meant to be used, but also serve as examples for
other users to create their own document classes. These document
@@ -157,26 +208,37 @@
be kept in mind that they were designed for American tastes and
typography. At one time they even contained a number of hard-wired
texts.
-
- This report describes \babel{}, a package that makes use of the
+
+ This manual describes \babel{}, a package that makes use of the
capabilities of \TeX\ version 3 and, to some extent, \xetex{} and
\luatex, to provide an environment in which documents can be typeset
- in a language other than US English, or in more than one language.
+ in a language other than US English, or in more than one language or
+ script.
However, no attempt has been done to take full advantage of the
features provided by the latter, which would require a completely
new core (as for example \file{polyglossia} or as part of \LaTeX3).
-\end{abstract}
+ \vspace{20cm}
+\end{minipage}
+\end{tabular}
+\end{minipage}
+\end{titlepage}
\tableofcontents
+\clearpage
\section{The user interface}\label{U-I}
-The user interface of this package is quite simple. It consists of a
-set of commands that switch from one language to another, and a set of
-commands that deal with shorthands. It is also possible to find out
-what the current language is.
+The basic user interface of this package is quite simple. It consists
+of a set of commands that switch from one language to another, and a
+set of commands that deal with shorthands. It is also possible to find
+out what the current language is.
-In \LaTeX2e\ the preamble of the document:
+In most cases, a single language is required, and then all you need in
+\LaTeX{} is to load the package using its standand mechanism for this
+purpose, namely, passing that language as an optional argument.
+
+In multilingual documents, just use several option. So, in \LaTeX2e\
+the preamble of the document:
\begin{verbatim}
\documentclass{article}
\usepackage[dutch,english]{babel}
@@ -209,18 +271,20 @@ with the package option |main|:
\usepackage[ngerman,main=italian]{babel}
\end{verbatim}
-\fbox{New 3.9c} The basic behaviour of some languages can be modified
-when loading \babel. Modifiers are set after the language name, and
-are prefixed with a dot (only when the language is set as package
-option -- neither global options nor the |main| key accept them). An
-example is (spaces are not significant and it can be written closed,
-too):
+\New{3.9c} The basic behaviour of some languages can be modified when
+loading \babel{} by means of \textit{modifiers}. They are set after
+the language name, and are prefixed with a dot (only when the language
+is set as package option -- neither global options nor the |main| key
+accept them). An example is (spaces are not significant and they can
+be added or removed):\footnote{No predefined ``axis'' for modifiers
+are provided because languages and their scripts have quite different
+needs.}
\begin{verbatim}
-\usepackage[latin .medieval, spanish .notilde .lcroman, danish]{babel}
+\usepackage[latin.medieval, spanish.notilde.lcroman, danish]{babel}
\end{verbatim}
Attributes (described below) are considered modifiers, ie, you can
-set an attribute by including it in the modifiers list. However,
+set an attribute by including it in the list of modifiers. However,
modifiers is a more general mechanism.
Currently \babel{} provides no standard interface for
@@ -240,8 +304,15 @@ languages. Please, read the documentation for specific languages for
further info.
Loading directly |sty| files in \LaTeX{} (ie,
-|\usepackage|\marg{language}) is deprected and you will get the error
-``You have used an old interface to call babel''.
+|\usepackage|\marg{language}) is deprecated and you will get the
+error:\footnote{In former versions the error read ``You have used an
+old interface to call babel'', not very helpful.}
+\begin{verbatim}
+! Package babel Error: You are loading directly a language style.
+(babel) This syntax is deprecated and you must use
+(babel) \usepackage[language]{babel}.
+\end{verbatim}
+
In Plain, load languages styles with |\input| and then use
|\begindocument| (the latter is defined by \babel):
@@ -254,8 +325,14 @@ not compatible with Plain.
\subsection{Selecting languages}
+This section describes the commands to be used in the document to
+switch the language in multilingual document.
+
The main language is selected automatically when the |document|
-environment begins.
+environment begins. In the preamble it has \textit{not} been selected,
+except hyphenation patterns and the name assigned to
+|\languagename|. If you need to define boxes and the like in the
+preamble, you might want to use some of the following commands.
\Describe\selectlanguage{\marg{language}}
When a user wants to switch from one language to another he can
@@ -263,7 +340,14 @@ do so using the macro |\selectlanguage|. This macro takes the
language, defined previously by a language definition file, as
its argument. It calls several macros that should be defined in
the language definition files to activate the special definitions
-for the language chosen.
+for the language chosen. For ``historical reasons'', a macro name is
+converted to a language name without the leading |\|; in other words,
+the two following declarations are equivalent:
+\begin{verbatim}
+\selectlanguage{german}
+\selectlanguage{\german}
+\end{verbatim}
+Using a macro instead of a ``real'' name is deprecated.
If used inside braces there might be some non-local changes, as this
would be roughly equivalent to:
@@ -271,18 +355,15 @@ would be roughly equivalent to:
{\selectlanguage{<inner-language>} ...}\selectlanguage{<outer-language>}
\end{verbatim}
If you want a change which is really local, you must enclose this
-code with an additional grouping, like braces |{}|.
+code with an additional grouping level.
This command can be used as environment, too.
\Describe{\begin\menv{otherlanguage}}{\marg{language}\Eenv{otherlanguage}}
The environment \Lenv{otherlanguage} does basically the same as
-|\selectlanguage|, except the language change is (mostly) local to the
-environment. This environment is required for intermixing
-left-to-right typesetting with right-to-left typesetting.
-The language to switch to is specified as an
-argument to |\begin{otherlanguage}|.
+|\selectlanguage|, except the language change is (mostly) local to
+the environment.
Actually, there might be some non-local changes, as this environment
is roughly equivalent to:
@@ -294,11 +375,11 @@ is roughly equivalent to:
\selectlanguage{<outer-language>}
\end{verbatim}
If you want a change which is really local, you must enclose this
-environment with and additional grouping, like braces |{}|.
+environment with an additional grouping, like braces |{}|.
Spaces after the environment are ignored.
-\Describe\foreignlanguage{\oarg{language}\marg{text}}
+\Describe\foreignlanguage{\marg{language}\marg{text}}
The command |\foreignlanguage| takes two arguments; the second
argument is a phrase to be typeset according to the rules of the
language named in its first argument. This command (1) only
@@ -315,6 +396,29 @@ case it only sets the hyphenation patterns).
Same as |\foreignlanguage| but as environment. Spaces after the
environment are \textit{not} ignored.
+This environment (or in some cases |otherlanguage|) may be required for
+intermixing left-to-right typesetting with right-to-left typesetting
+in engines not supporting a change in the writing direction inside a
+line.
+
+\Describe{\begin\menv{hyphenrules}}{\marg{language}\Eenv{hyphenrules}}
+
+The environment \Lenv{hyphenrules} can be used to select \emph{only}
+the hyphenation rules to be used (it can be used as command,
+too). This can for instance be used to select `nohyphenation',
+provided that in \file{language.dat} the `language'
+\textsf{nohyphenation} is defined by loading \file{zerohyph.tex}. It
+deactivates language shorthands, too (but not user shorthands).
+
+Except for these simple uses, |hyphenrules| is discouraged and
+|otherlanguage*| (the starred version) is preferred, as the former
+does not take into account possible changes in encodings or characters
+like, say, |'| done by some languages (eg, \textsf{italian},
+\textsf{frenchb}, \textsf{ukraineb}). To set hyphenation exceptions,
+use |\babelhyphenation| (see below).
+
+\subsection{Getting the current language name}
+
\Describe\languagename{}
The control sequence |\languagename| contains the name of the
current language. However, due to some internal inconsistencies in
@@ -333,22 +437,6 @@ the actions to take if the result of the test is true or false
respectively. The advice about |\languagename| also applies here --
use \textsf{iflang} instead of |\iflanguage| if possible.
-\Describe{\begin\menv{hyphenrules}}{\marg{language}\Eenv{hyphenrules}}
-
-The environment \Lenv{hyphenrules} can be used to select \emph{only}
-the hyphenation rules to be used (it can be used as command,
-too). This can for instance be used to select `nohyphenation',
-provided that in \file{language.dat} the `language'
-\textsf{nohyphenation} is defined by loading \file{zerohyph.tex}. It
-deactivates language shorthands, too (but not user shorthands).
-
-Except for these simple uses, |hyphenrules| is discouraged and
-|otherlanguage*| (the starred version) is preferred, as the former
-does not take into account possible changes in encodings or characters
-like, say, |'| done by some languages (eg, \textsf{italian},
-\textsf{frenchb}, \textsf{ukraineb}). To set hyphenation exceptions,
-use |\babelhyphenation| (see below).
-
\subsection{Shorthands}
A \textit{shorthand} is a sequence of one or two characters that
@@ -356,34 +444,42 @@ expands to arbitrary \TeX{} code.
Shorthands can be used for different kinds of things, as for example:
(1) in some languages shorthands such as |"a| are defined to be able
-to hyphenate the word if the encoding is OT1; (2) in some languages
+to hyphenate the word if the encoding is |OT1|; (2) in some languages
shorthands such as |!| are used to insert the right amount of white
space; (3) several kinds of discretionaries and breaks can be inserted
easily with |"-|, |"=|, etc.
The package \textsf{inputenc} as well as \xetex{} an \luatex{} have
alleviated entering non-ASCII characters, but minority languages and
-some texts can still require characters not directly available in the
-keyboards (and sometimes not even as separated or precomposed Unicode
-characters). As to the point 2, now \textsf{pdfTeX} provides
-|\knbccode|. Tools of point 3 can be still very useful in general.
+some kinds of text can still require characters not directly
+available in the keyboards (and sometimes not even as separated or
+precomposed Unicode characters). As to the point 2, now
+\textsf{pdfTeX} provides |\knbccode|. Tools of point 3 can be still
+very useful in general.
There are three levels of shorthands: \textit{user},
\textit{language}, and \textit{system} (by order of
-precedence). Version 3.9 introduces the \textit{language user}
-level on top of the user level, as described below. In most
-cases, you will use only shorthands provided by languages.
+precedence). Version 3.9 introduces the \textit{language user} level
+on top of the user level, as described below. In most cases, you will
+use only shorthands provided by languages.
Please, note the following:
\begin{enumerate}
\item Activated chars used for two-char shorthands cannot be
followed by a closing brace |}| and the spaces following are
- gobbled. With one-char shorthands (eg, |:|), they are preserved.
+ gobbled. With one-char shorthands (eg,~|:|), they are preserved.
\item If on a certain level (system, language, user) there is a
one-char shorthand, two-char ones starting with that
char and on the same level are ignored.
\end{enumerate}
+A typical error when using shorthands is the following:
+\begin{verbatim}
+! Argument of \language@active@arg" has an extra }.
+\end{verbatim}
+It means there is a closing brace just after a shorthand, which is not
+allowed (eg,~|"}|). Just add |{}| after (eg,~|"{}}|).
+
\Describe{\shorthandon}{\marg{shorthands-list}}
\DescribeOther{\shorthandoff}{%
\colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}%
@@ -400,7 +496,7 @@ sets the |\catcode| to active (13). Both commands only work on `known'
shorthand characters. If a character is not known to be a shorthand
character its category code will be left unchanged.
-\fbox{New 3.9} Note however, |\shorthandoff| does not behave as
+\New{3.9} Note however, |\shorthandoff| does not behave as
you would expect with characters like |~| or |^|, because they
usually are not ``other''. For them |\shorthandoff*| is provided,
so that with
@@ -420,14 +516,14 @@ The command |\useshorthands| initiates the definition of user-defined
shorthand sequences. It has one argument, the character that starts
these personal shorthands.
-\fbox{New 3.9} However, user shorthands are not always alive, as they
-may be deactivated by languages (for example, if you use |"| for your
-user shorthands and switch from \textsf{german} to \textsf{french},
-they stop working). Therefore, a starred version
+\New{3.9} However, user shorthands are not always alive, as they may
+be deactivated by languages (for example, if you use |"| for your user
+shorthands and switch from \textsf{german} to \textsf{french}, they
+stop working). Therefore, a starred version
|\useshorthands*|\marg{char} is provided, which makes sure shorthands
are always activated.
-Currently, if the option |shorthands| is used, you must include any
+Currently, if the package option |shorthands| is used, you must include any
character to be activated with |\useshorthands|. This restriction will
be lifted in a future release.
@@ -438,7 +534,7 @@ The command |\defineshorthand| takes two arguments: the first is
a one- or two-character shorthand sequence, and the second is the
code the shorthand should expand to.
-\fbox{New 3.9} An optional argument allows to (re)define language
+\New{3.9} An optional argument allows to (re)define language
and system shorthands (some languages do not activate shorthands,
so you may want to add |\languageshorthands|\marg{lang} to the
corresponding |\extras|\m{lang}). By default, user shorthands are
@@ -459,7 +555,8 @@ different meanings). You could start with, say:
\end{verbatim}
However, behaviour of hyphens is language dependent. For example, in
languages like Polish and Portugese, a hard hyphen inside compound
-words are repeated at the beginning of the next line. You could set:
+words are repeated at the beginning of the next line. You could then
+set:
\begin{verbatim}
\defineshorthand[*polish,*portugese]{"-}{\babelhyphen{repeat}}
\end{verbatim}
@@ -516,13 +613,13 @@ to easy typing phonetic characters with \textsf{tipa}:
\end{verbatim}
\Describe\babelshorthand{\marg{shorthand}}
-With this command you can use shorthands even if (1) not activated in
+With this command you can use a shorthand even if (1) not activated in
\texttt{shorthands} (in this case only shorthands for the current
language are taken into account, ie, not user shorthands), (2) turned
-off with |\shorthandoff| or (3) deactivated with |\bbl@deactivate|;
-for example, \verb|\babelshorthand{"u}| or \verb|\babelshorthand{:}|.
-(You can conveniently define your own macros, or even you own user
-shorthands provided they do not ovelap.)
+off with |\shorthandoff| or (3) deactivated with the internal
+|\bbl@deactivate|; for example, \verb|\babelshorthand{"u}| or
+\verb|\babelshorthand{:}|. (You can conveniently define your own
+macros, or even you own user shorthands provided they do not ovelap.)
For your records, here is a list of shorthands, but you must check
them, as they may change:\footnote{Thanks to Enrico Gregorio}
@@ -561,9 +658,20 @@ preserved for backward compatibility.}
\subsection{Package options}
-\fbox{New 3.9}
+\New{3.9}
These package options are processed before language options, so
-that they are taken into account irrespective of its order.
+that they are taken into account irrespective of its order. The first
+three options have been available in previous versions.
+
+\Describe{KeepShorthandsActive}{}
+Tells babel not to deactivate shorthands after loading a language
+file, so that they are also availabe in the preamble.
+
+\Describe{activeacute}{} For some languages \babel\ supports this
+options to set |'| as a shorthand in case it is not done by default.
+
+\Describe{activegrave}{}
+Same for |`|.
\Describe{shorthands=}{\meta{char}\meta{char}...
$\string|$ \texttt{off}}
@@ -572,12 +680,13 @@ are those given, like, eg:
\begin{verbatim}
\usepackage[esperanto,frenchb,shorthands=:;!?]{babel}
\end{verbatim}
-If \verb|'| is included, \texttt{activeacute} is set; if \verb|`|
-is included, \texttt{activegrave} is set. Active characters (like
-\verb|~|) should be preceded by \verb|\string| (otherwise they
-will be expanded by \LaTeX{} before they are passed to the package
-and therefore they will not be recognized); however, |t| is provided
-for the common case of |~| (as well as |c| for the comma).
+If \verb|'| is included, \texttt{activeacute} is set; if \verb|`| is
+included, \texttt{activegrave} is set. Active characters (like
+\verb|~|) should be preceded by \verb|\string| (otherwise they will be
+expanded by \LaTeX{} before they are passed to the package and
+therefore they will not be recognized); however, |t| is provided for
+the common case of |~| (as well as |c| for not so common case of the
+comma).
With |shorthands=off| no language shorthands are defined,
As some languages use this mechanism for tools not available
@@ -600,12 +709,13 @@ option with the value |normal| they are deactivated in math mode
(default is |active|) and things like |${a'}$| (a closing brace after
a shorthand) are not a source of trouble any more.
-\Describe{config=}{\meta{file}} Instead of loading |bblopts.cfg|,
-the file \meta{file}\texttt{.cfg} is loaded.
+\Describe{config=}{\meta{file}} Load \meta{file}\texttt{.cfg} instead
+of the default config file |bblopts.cfg|.
-\Describe{main=}{\meta{language}} Sets the main language, as
-explained above, ie, this language is always the last loaded. The
-language may be also given as package or global option or not.
+\Describe{main=}{\meta{language}} Sets the main language, as explained
+above, ie, this language is always loaded last. If it is not given as
+package or global option, it is added to the list of requested
+languages.
\Describe{headfoot=}{\meta{language}} By default, headlines and footlines are
not touched (only marks), and if they contain language dependent
@@ -615,34 +725,51 @@ this option you may set the language in heads and foots.
\Describe{noconfigs}{} Global and
language default config files are not loaded, so you can make sure
your document is not spoilt by an unexpected \texttt{.cfg}
-file. The key |config| still works.
+file. However, if the key |config| is set, this file is loaded.
\Describe{showlanguages}{} Prints to the log the list of languages
loaded when the format was created: number (remember dialects can
share it), name, hyphenation file and exceptions file.
\Describe{strings=}{\texttt{generic} $\string|$ \texttt{unicode}
-$\string|$ \texttt{encoded} $\string|$ \meta{label} $\string|$ \meta{font encoding}}
-Selects the encoding
-of strings in languages supporting this feature. Predefined labels
-are |generic| (for traditional \TeX), |unicode| (for engines like
+$\string|$ \texttt{encoded} $\string|$ \meta{label} $\string|$
+\meta{font encoding}} Selects the encoding of strings in languages
+supporting this feature. Predefined labels are |generic| (for
+traditional \TeX, LICR and ASCII strings), |unicode| (for engines like
\xetex{} and \luatex) and |encoded| (for special cases requiring mixed
encodings). Other allowed values are font encoding codes (|T1|, |T2A|,
-|LGR|, |L7X|...), but only in languages supporting them.
+|LGR|, |L7X|...), but only in languages supporting them.
-\vspace{3ex}
-(The following three options have been available in previous versions
-of \babel.)
+\Describe{hyphenmap=}{\texttt{off} $\string|$ \texttt{main}
+$\string|$ \texttt{select} $\string|$ \texttt{other} $\string|$
+\texttt{other*}}
-\Describe{KeepShorthandsActive}{}
-Tells babel not to deactivate shorthands after loading a language
-file, so that they are also availabe in the preamble.
-
-\Describe{activeacute}{} For some languages \babel\ supports this
-options to set |'| as a shorthand in case it is not done by default.
-
-\Describe{activegrave}{}
-Same for |`|.
+\New{3.9g} Sets the behaviour of case mapping for hyphenation,
+provided the language defines it. It can take the following values:
+\begin{description}
+\renewcommand\makelabel[1]{%
+ \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
+\itemsep=-\parskip
+\item[off] deactivates this feature and no case mapping is applied;
+\item[first] sets it at the first switching commands in the
+ current or parent scope (typically, when the aux file is first read
+ and at |\begin{document}|, but also the first |\selectlanguage| in
+ the preamble), and it's the default if a single
+ language option has been stated;\footnote{Duplicated options count
+ as several ones.}
+\item[select] sets it only at |\selectlanguage|;
+\item[other] also sets it at |otherlanguage|;
+\item[other*] also sets it at |otherlanguage*| as well as in heads and
+ foots (if the option |headfoot| is used) and in auxiliary files (ie,
+ at |\select@language|), and it's the default if several language
+ options have been stated. The option |first| can be regarded as an
+ optimized version of \texttt{other*} for monolingual
+ documents.\footnote{Providing |foreign| is pointless, because the
+ case mapping applied is that at the end of paragraph, but if either
+ \xetex{} or \luatex{} change this behaviour it might be added. On
+ the other hand, |other| is provided even if I [JBL] think it isn't
+ really useful, but who knows.}
+\end{description}
\subsection{The \texttt{base} option}
@@ -652,7 +779,7 @@ selects the hyphenations patterns for the last language passed as
option (by its name in |language.dat|). There are two main uses:
classes and packages, and as a last resort in case there are, for some
reason, incompatible languages. It can be used if you just want to
-select the hyphenations patterns of a single language.
+select the hyphenations patterns of a single language, too.
\Describe\AfterBabelLanguage{\marg{option-name}\marg{code}}
@@ -680,39 +807,25 @@ you attempt to load both. Here is a way to overcome this problem:
\subsection{Hooks}
-\fbox{New 3.9} A hook is code to be executed at certain events. Some
-hooks are predefined when \luatex{} and \xetex{} are used.
+\New{3.9} A hook is a piece of code to be executed at certain
+events. Some hooks are predefined when \luatex{} and \xetex{} are
+used.
\Describe\AddBabelHook{\marg{name}\marg{event}\marg{code}}
The same name can be applied to several events. Hooks may be enabled
and disabled for all defined events with
-|\EnableBabelHook|\marg{name}, |\DisableBabelHook|\marg{name}
-
-Current events are: |adddialect|, |write|, |beforeextras|,
-|afterextras|, |patterns|, |hyphenation|, |defaultcommands|, |encodedcommands|,
-|stopcommands| and |stringprocess|. Four events are used in
-\file{hyphen.cfg}, which are handled in a quite different way for
-efficiency reasons -- these are |everylanguage|, |loadkernel|,
-|loadpatterns| and |loadexceptions|, which, unlike the precedent ones,
-only have a single hook and replace a default definition. (Names
-containing the string |babel| are reserved; they are used, for
+|\EnableBabelHook|\marg{name}, |\DisableBabelHook|\marg{name}. Names
+containing the string |babel| are reserved (they are used, for
example, by |\useshortands*| to add a hook for the event
-|afterextras|.)
+|afterextras|).
-In some of them you can use one or two \TeX{} parameters (|#1|, |#2|),
-with the meaning given below:
+Current events are the following; in some of them you can use one or
+two \TeX{} parameters (|#1|, |#2|), with the meaning given:
\begin{description}
\renewcommand\makelabel[1]{%
\hspace\labelsep\normalfont\ttfamily\color{thered}#1}
\itemsep=-\parskip
-\item[everylanguage] (language) Executed before patterns are loaded.
-\item[loadkernel] (file) By default loads |switch.def|. It can be used
- to load a different version of this files or to load nothing.
-\item[loadpatterns] (patterns file) Loads the patterns file. Used by
- \file{luababel.def}.
-\item[loadexceptions] (exceptions file) Loads the exceptions
- file. Used by \file{luababel.def}.
\item[adddialect] (language name, dialect name) Used by
\file{luababel.def} to load the patterns if not preloaded.
\item[patterns] (language name, language with encoding) Executed just
@@ -737,7 +850,7 @@ with the meaning given below:
\begin{verbatim}
\AddBabelHook{noshort}{afterextras}{\languageshorthands{none}}
\end{verbatim}
-\item[stringprocess] Intead of a parameter, you can manipulate the
+\item[stringprocess] Instead of a parameter, you can manipulate the
macro |\BabelString| containing the string to be defined with
|\SetString|. For example, to use an expanded version of the string
in the definition, write:
@@ -747,14 +860,37 @@ with the meaning given below:
\end{verbatim}
\end{description}
-\subsection{Hyphen tools}
+Four events are used in
+\file{hyphen.cfg}, which are handled in a quite different way for
+efficiency reasons -- unlike the precedent ones, they
+only have a single hook and replace a default definition.
+\begin{description}
+\renewcommand\makelabel[1]{%
+ \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
+\itemsep=-\parskip
+\item[everylanguage] (language) Executed before patterns are loaded.
+\item[loadkernel] (file) By default loads |switch.def|. It can be used
+ to load a different version of this files or to load nothing.
+\item[loadpatterns] (patterns file) Loads the patterns file. Used by
+ \file{luababel.def}.
+\item[loadexceptions] (exceptions file) Loads the exceptions
+ file. Used by \file{luababel.def}.
+\end{description}
+
+\Describe\BabelContentsFiles{}
+\New{3.9} This macro contains a list of ``toc'' types which
+require a command to switch the language. Its default value is
+|toc,lof,lot|, but you may redefine it with |\renewcommand| (it's up
+to you to make sure no toc type is duplicated).
+
+\subsection{Hyphenation tools}
\Describe\babelhyphen{%
\colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}\marg{type}}
\DescribeOther\babelhyphen{%
\colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}\marg{text}}
-\fbox{New 3.9} It is customary to classify hyphens in two types: (1)
+\New{3.9} It is customary to classify hyphens in two types: (1)
\textit{explicit} or \textit{hard hyphens}, which in \TeX\ are
entered as \verb|-|, and (2) \textit{optional} or \textit{soft
hyphens}, which are entered as \verb|\-|. Strictly, a \textit{soft
@@ -809,9 +945,9 @@ of a word, provided it is not immediately preceded by, say, a
parenthesis).
\Describe\babelhyphenation{\texttt{[}\langlist\texttt{]}%^^A
- \marg{exceptions}}
+ \marg{exceptions}}
-\fbox{New 3.9} Sets hyphenation exceptions for the languages given
+\New{3.9} Sets hyphenation exceptions for the languages given
or, without the optional argument, for \textit{all} languages (eg,
proper nouns or common loan words, and of course monolingual
documents). Language exceptions take precedence over global ones.
@@ -841,10 +977,12 @@ preamble and only once -- they cannot be turned on and off.
The command checks whether the language is known in this document
and whether the attribute(s) are known for this language.
+Very often, using a \textit{modifier} in a package option is better.
+
Several language definition files use their own methods to set
options. For example, \textsf{frenchb} uses |\frenchbsetup|,
-\textsf{magyar} (1.5) uses |\magyarOptions| and \textsf{spanish}
-a set of package options (eg, |es-nolayout|). Macros settting
+\textsf{magyar} (1.5) uses |\magyarOptions|; modifiers provided by
+|spanish| have no attribute counterparts. Macros settting
options are also used (eg, |\ProsodicMarksOn| in \textsf{latin}).
\subsection{Languages supported by \babel}
@@ -909,7 +1047,7 @@ ibygreek, bgreek, serbianc, frenchle, ethiop} and \textsf{friulan}.
Most of them work out of the box, but some may require extra fonts,
encoding files, a preprocessor or even a complete framework (like
-CJK). For example, if your have the \textsf{velthuis/devnag} package,
+CJK). For example, if you have got the \textsf{velthuis/devnag} package,
you can create a file with extension |.dn|:
\begin{verbatim}
\documentclass{article}
@@ -921,7 +1059,7 @@ you can create a file with extension |.dn|:
Then you preprocess it with |devnag| \m{file}, which creates
\m{file}|.tex|; you can then typeset the latter with \LaTeX.
-\subsection{Tips, workarounds and know issues}
+\subsection{Tips, workarounds, know issues and notes}
\begin{itemize}
\item If you use the document class \cls{book} \emph{and} you use
@@ -986,6 +1124,72 @@ Then you preprocess it with |devnag| \m{file}, which creates
|\text|\m{script} in different ways.
\end{itemize}
+The following packages can be useful, too (the list is still
+far from complete):
+\begin{description}
+\itemsep=-\parskip
+\item[csquotes] Logical markup for quotes.
+\item[iflang] Tests correctly the current language.
+\item[hyphsubst] Selects a different set of patters for a language.
+\item[translator] An open platform for packages that need to be
+ localized.
+\item[siunitx] Typesetting of numbers and physical quantities.
+\item[biblatex] Programmable bibliographies and citations.
+\item[bicaption] Bilingual captions.
+\item[babelbib] Multilingual bibliographies
+\end{description}
+
+\subsection{Future work}
+
+Useful additions would be, for example, time, currency, addresses and
+personal names.\footnote{See for example POSIX, ISO 14652 and the
+Unicode Common Locale Data Repository (CLDR).}. But that is the easy
+part, because they don't require modifying the \LaTeX{} internals.
+
+More interesting are differences in the sentence structure or related to
+it. For example, in Basque the number precedes the name (including
+chapters), in Hungarian ``from (1)'' is ``(1)-b\H{o}l'', but ``from (3)''
+is ``(3)-b\'{o}l'', in Spanish an item labelled
+``3.$^{\textrm{\scriptsize o}}$'' may
+be referred to as either ``\'{\i}tem 3.$^{\textrm{\scriptsize o}}$'' or ``3.$^{\textrm{\scriptsize er}}$ \'{\i}tem'', and so on.
+
+Even more interesting is right-to-left, vertical and bidi
+typesetting. Babel provided a basic support for bidi text as part of
+the style for Hebrew, but it is somewhat unsatisfactory and internally
+replaces some hardwired commands by other hardwired commands
+(generic changes would be much better).
+
+Handling of Unicode fonts is also problematic. There is
+\textsf{fontspec}, but special macros are required (not only the NFSS
+ones) and it doesn't provide ``orthogonal axis'' for features,
+including those related to the language (mainly language and
+script). A couple of tentative macros, which solve the two main cases,
+are provided by \babel with a partial solution (only \xetex{} and
+\luatex, for obvious reasons), but use them at your own risk, as they
+might be removed in the future. For this very reason, they are
+described here:
+\begin{itemize}
+\item |\babelFSstore|\marg{babel-language} sets the current three
+ basic families (rm, sf, tt) as the default for the language
+ given. In most cases, this macro will be enough.
+\item |\babelFSdefault|\marg{babel-language}\marg{fontspec-features}
+ patches |\fontspec| so that the given features are always passed as
+ the optional argument or added to it (not an ideal solution). Use it
+ only if you select some fonts in the document with |\fontspec|.
+\end{itemize}
+So, for example:
+\begin{verbatim}
+\setmainfont[Language=Turkish]{Minion Pro}
+\setsansfont[Language=Turkish]{Myriad Pro}
+\babelFSstore{turkish}
+\setmainfont{Minion Pro}
+\setsansfont{Myriad Pro}
+\babelFSfeatures{turkish}{Language=Turkish}
+\end{verbatim}
+Note you can set any feature required for the language -- not only
+|Language|, but also |Script| or a local |.fea|. This makes those macros
+a bit more verbose, but also more powerful.
+
\section{Preloading languages with \file{language.dat}}
\TeX{} and most engines based on it (pdf\TeX, \xetex, $\epsilon$-\TeX,
@@ -1078,7 +1282,13 @@ The following assumptions are made:
|\l@|\langvar\ to be a dialect of |\language0| when |\l@|\langvar\
is undefined.
\item Language names must be all lowercase. If an unknow language is
- selected, \babel{} will attempt setting it after lowercasing its name.
+ selected, \babel{} will attempt setting it after lowercasing its
+ name.
+\item The semantics of modifiers is not defined (on purpose). In
+ most cases, they will just be simple separated options (eg.,
+ \texttt{spanish}), but a language might require, say, a set of
+ options organized as a tree with suboptions (in such a case, the
+ recommended separator is \verb|/|).
\end{itemize}
Some recommendations:
@@ -1098,6 +1308,7 @@ Some recommendations:
language specific macros. Use always, if possible, |\bbl@save| and
|\bbl@savevariable| (except if you still want to have access to the
previous value).
+
\end{itemize}
There are no special requirements for documenting your language
@@ -1148,19 +1359,19 @@ were provided by the hyphenation file before it takes any action.
If these values have been already set, this command is ignored
(currenty, default pattern files do \textit{not} set them).
-\DescribeMacro{\captions<lang>}
+\DescribeMacro{\captions\langvar}
The macro |\captions|\langvar\ defines the macros that
hold the texts to replace the original hard-wired texts.
-\DescribeMacro{\date<lang>}
+\DescribeMacro{\date\langvar}
The macro |\date|\langvar\ defines |\today|.
-\DescribeMacro{\extras<lang>}
+\DescribeMacro{\extras\langvar}
The macro |\extras|\langvar\ contains all the extra definitions needed
for a specific language. This macro, like the following, is a hook --
-you can add thing to it, but it must not be used directly.
+you can add things to it, but it must not be used directly.
-\DescribeMacro{\noextras<lang>}
+\DescribeMacro{\noextras\langvar}
Because we want to let the user switch
between languages, but we do not know what state \TeX\ might be in
after the execution of |\extras|\langvar, a macro that brings
@@ -1225,11 +1436,12 @@ first family in the given encoding seems to be needed.
\subsection{Skeleton}
Here is the basic structure of an |ldf| file, with a language, a
-dialect and an attribute.
+dialect and an attribute. Strings are best defined using the method
+explained in in sec. \ref{s:strings} (\babel{} 3.9 and later).
\begin{verbatim}
\ProvidesLanguage{<language>}
- [2013/05/16 v0.0 <Language> support from the babel system]
+ [2013/10/10 v0.0 <Language> support from the babel system]
\LdfInit{<language>}{captions<language>}
\ifx\undefined\l@<language>
@@ -1246,11 +1458,23 @@ dialect and an attribute.
\providehyphenmins{<language>}{\tw@\thr@@}
-\def\captions<language>{}
-\let\captions<dialect>\captions<language>
+\StartBabelCommands*{<language>}{captions}
+\SetString\chaptername{<chapter name>}
+% More strings
+
+\StartBabelCommands*{<language>}{date}
+\SetString\monthiname{<name of first month>}
+% More strings
-\def\date<language>{}
-\def\date<dialect>{}
+\StartBabelCommands*{<dialect>}{captions}
+\SetString\chaptername{<chapter name>}
+% More strings
+
+\StartBabelCommands*{<dialect>}{date}
+\SetString\monthiname{<name of first month>}
+% More strings
+
+\EndBabelCommands
\addto\extras<language>{}
\addto\noextras<language>{}
@@ -1302,7 +1526,7 @@ curly braces. The macros |\bbl@add@special|\meta{char} and
\subsection{Support for saving macro definitions}
Language definition files may want to \emph{re}define macros that
-already exist. Therefor a mechanism for saving (and restoring) the
+already exist. Therefore a mechanism for saving (and restoring) the
original definition of those macros is provided. We provide two macros
for this\footnote{This mechanism was introduced by Bernd Raichle.}.
@@ -1375,8 +1599,9 @@ The commands |\bbl@frenchspacing| and |\bbl@nonfrenchspacing| can be
used to properly switch French spacing on and off.
\subsection{Encoding-dependent strings}
+\label{s:strings}
-\fbox{New 3.9} Babel 3.9 provides a way of defining strings in several
+\New{3.9} Babel 3.9 provides a way of defining strings in several
encodings, intended mainly for \luatex{} and \xetex. This is the only new
feature requiring changes in language files if you want to make use of
it.
@@ -1403,7 +1628,11 @@ is german, just redefine |\germanchaptername|.
The \m{language-list} specifies which languages the block is intended
for. A block is taken into account only if the |\CurrentOption| is
-listed here.
+listed here. Alternatively, you can define |\BabelLanguages| to a
+comma-separated list of languages to be defined (if undefined,
+|\StartBabelCommands| sets it to |\CurrentOption|). You may write
+|\CurrentOption| as the language, but this discouraged -- a explicit
+name (or names) is much better and clearer.
A ``selector'' is a name to be used as value in package option
|strings|, optionally followed by extra info about the encodings to be
@@ -1418,7 +1647,9 @@ the first one take precedence (ie, it works much like
Encoding info is |charset=| followed by a charset, which if given sets
how the strings should be traslated to the internal representation
used by the engine, typically |utf8|, which is the only value
-supported currently (default is no traslations).
+supported currently (default is no traslations). Note |charset| is
+applied by \luatex{} and \xetex{} when reading the file, not when the
+macro or string is used in the document.
A list of font encodings which the strings are expected to work with
can be given after |fontenc=| (separated with spaces, if two or more) --
@@ -1444,11 +1675,11 @@ added.\nb{like `monetary', `time', `address', `name', `case' or
|\SetString| is an error (but not |\SetCase|).
\begin{verbatim}
-\StartBabelCommands\CurrentOption{captions}
+\StartBabelCommands{language}{captions}
[unicode, fontenc=EU1 EU2, charset=utf8]
\SetString{\chaptername}{utf8-string}
-\StartBabelCommands\CurrentOption{captions}
+\StartBabelCommands{language}{captions}
\SetString{\chaptername}{ascii-maybe-LICR-string}
\EndBabelCommands
@@ -1500,15 +1731,23 @@ strings are added). However, when used in the preamble or in a
package, new settings are added to the previous ones, if the language
exists (in the \babel{} sense, ie, if |\date|\m{language} exists).
+\Describe\StartBabelCommands{%
+ \colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}%
+ \marg{language-list}\marg{category}\oarg{selector}}
+The starred version just forces |strings| to take a value -- if not set
+as package option, then the default for the engine is used. This is
+not done by default to prevent backward incompatibilities, but if you
+are creating a new language this version is better. It's up to
+the maintainers of the current languages to decide if using it is
+appropiate.\footnote{This replaces in 3.9g a short-lived
+\texttt{\string\UseStrings} which has been removed because it did
+not work.}
+
\Describe\EndBabelCommands{}
Marks the end of the series of blocks.
-\Describe\UseStrings{}
-You may also want to omit the old way of defining define strings
-altogether. Just add |\UseStrings| after the first
-|\StartBabelCommands| and the generic branchs will be taken into
-account even if there is no |strings| key. This directive applies to
-all subsequent blocks, until |\EndBabelCommands|.
+\Describe\AfterBabelCommands{\marg{code}}
+The code is delayed and executed at the global scope just after |\EndBabelCommands|.
\Describe\SetString{\marg{macro-name}\marg{string}}
Adds \meta{macro-name} to the current category, and defines globally
@@ -1567,6 +1806,40 @@ set for Turkish:
\end{verbatim}
(Note the mapping for |OT1| is not complete.)
+\Describe\SetHyphenMap{\marg{to-lower-macros}}
+\New{3.9g} Case mapping serves in \TeX{} for two unrelated purposes: case
+transforms (upper/lower) and hyphenation. |\SetCase| handles the
+former, while hyphenation is handled by |\SetHyphenMap| and controlled
+with the package option |hyphenmap|. So, even if internally they are based
+on the same \TeX{} primitive (|\lccode|), \babel{} sets them separately.
+
+There are three helper macros to
+be used inside |\SetHyphenMap|:
+\begin{itemize}
+\item |\BabelLower|\marg{uccode}\marg{lccode} is
+ similar to |\lccode| but it's ignored if the char has been set and
+ saves the original lccode to restore it when switching the language
+ (except with |hyphenmap=first|).
+\item |\BabelLowerMM|\marg{uccode-from}\marg{uccode-to}%
+ \marg{step}\marg{lccode-from} loops though the given uppercase
+ codes, using the step, and assigns them the lccode, which is also
+ increased (|MM| stands for \textit{many-to-many}).
+\item |\BabelLowerMO|\marg{uccode-from}\marg{uccode-to}%
+ \marg{step}\marg{lccode} loops though the given uppercase
+ codes, using the step, and assigns them the lccode, which is fixed
+ (|MO| stands for \textit{many-to-one}).
+\end{itemize}
+An example is (which is redundant, because these assignments are done
+by both \luatex{} and \xetex{}):
+\begin{verbatim}
+\SetHyphenMap{\BabelLowerMM{"100}{"11F}{2}{"101}}
+\end{verbatim}
+
+This macro is not intended to fix wrong mappings done by Unicode
+(which are the default in both \xetex{} and \luatex{}) -- if an
+assignment is wrong, fix it directly.
+
+
\section{Compatibility and changes}
\subsection{Compatibility with \file{german.sty}}\label{l-h}
@@ -1756,8 +2029,8 @@ with the previous release. Here is a list of the most important ones:
\item A language change now also writes information in the
\file{.aux} file, as the change might also affect typesetting
the table of contents. The consequence is that an \file{.aux} file
- generated by a LaTeX format with babel preloaded gives errors
- when read with a LaTeX format without babel; but I think this
+ generated by a \LaTeX format with babel preloaded gives errors
+ when read with a \LaTeX format without babel; but I think this
probably doesn't occur;
\item \babel\ is now compatible with the \pkg{inputenc} and
\pkg{fontenc} packages;
@@ -1771,7 +2044,6 @@ can contain any valid \LaTeX\ code.
\end{itemize}
\DocInput{babel.dtx}
-\DocInput{bbplain.dtx}
\DocInput{bbunicode.dtx}
\section{Conclusion}
@@ -1899,6 +2171,18 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.8e}{2005/03/24}{Many enhancements to the text by
% Andrew Young}
% \changes{babel~3.9c}{2013/04/04}{Added the ``modifiers'' mechanism}
+% \changes{babel~3.9g}{2013/06/01}{bbplain merged}
+%\begingroup
+% \catcode`<=\active%
+% \catcode`>=\active
+% \makeatletter
+% \gdef\MakePrivateLetters{%
+% \catcode`@=11\relax
+% \gdef<##1{\ifx##1@$\langle\langle$\bgroup\itshape\rmfamily
+% \expandafter\bblref
+% \else\string<##1\fi}%
+% \gdef\bblref##1@>{##1\/\egroup$\rangle\rangle$}}%
+%\endgroup
%
% \section{Identification and loading of required files}
%
@@ -1907,9 +2191,139 @@ help from Bernd Raichle, for which I am grateful.
% The file \file{babel.sty}\footnote{The file described in this
% section is called \texttt{\filename}, has version
% number~\fileversion\ and was last revised on~\filedate.} is meant
-% for \LaTeXe, therefor we make sure that the format file used is
+% for \LaTeXe, therefore we make sure that the format file used is
% the right one.
%
+% The \babel{} installer extends \textsf{docstrip} with a few
+% ``pseudo-guards'' to set ``variables'' used at installation time.
+% They are used with |<||@name@>| at the appropiated places in the
+% source code and shown below with
+% $\langle\langle$\textit{name}$\rangle\rangle$. That brings a little bit of
+% literate programming.
+%
+% \begin{macrocode}
+%<<version=3.9g>>
+%<<date=2013/10/10>>
+% \end{macrocode}
+%
+% We define some basic which just make the code cleaner. |\bbl@add| is
+% now used internally instead of |\addto| because of the
+% unpredictable behaviour of the latter. Used in \file{babel.def}
+% and in \file{babel.sty}, which means in \LaTeX{} is executed
+% twice, but we need them when defining options and
+% \file{babel.def} cannot be load until options have been defined.
+% \begin{macrocode}
+%<<*Basic macros>>
+\def\bbl@for#1#2#3{\@for#1:=#2\do{\ifx#1\@empty\else#3\fi}}
+\def\bbl@add#1#2{%
+ \@ifundefined{\expandafter\@gobble\string#1}%
+ {\def#1{#2}}%
+ {\expandafter\def\expandafter#1\expandafter{#1#2}}}
+\def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
+\long\def\bbl@afterelse#1\else#2\fi{\fi#1}
+\long\def\bbl@afterfi#1\fi{\fi#1}
+%<</Basic macros>>
+% \end{macrocode}
+%
+% Some files identify themselves with a \LaTeX{} macro. The following
+% code is placed before it to define (and then undefine) if not in
+% \LaTeX.
+%
+% \begin{macrocode}
+%<<*Make sure ProvidesFile is defined>>
+\ifx\ProvidesFile\@undefined
+ \def\ProvidesFile#1[#2 #3 #4]{%
+ \wlog{File: #1 #4 #3 <#2>}%
+ \let\ProvidesFile\@undefined}
+\fi
+%<</Make sure ProvidesFile is defined>>
+% \end{macrocode}
+%
+% The following code is used in \file{babel.sty} and
+% \file{babel.def}, and makes sure the current version of
+% |switch.ldf| is used, if different from that in the format.
+%
+% \begin{macrocode}
+%<<*Load switch if newer>>
+\def\bbl@tempa{<@version@>}%
+\ifx\bbl@version\bbl@tempa\else
+ \input switch.def\relax
+\fi
+%<</Load switch if newer>>
+% \end{macrocode}
+%
+% The following code is used in \file{babel.def} and
+% \file{switch.def}.
+%
+% \begin{macrocode}
+%<<*Load macros for plain if not LaTeX>>
+\ifx\AtBeginDocument\@undefined
+ \input plain.def\relax
+\fi
+%<</Load macros for plain if not LaTeX>>
+% \end{macrocode}
+%
+% \subsection{Multiple languages}
+%
+% \begin{macro}{\language}
+% Plain \TeX\ version~3.0 provides the primitive |\language| that
+% is used to store the current language. When used with a pre-3.0
+% version this function has to be implemented by allocating a
+% counter. The following block is used in \file{switch.def} and
+% \file{hyphen.cfg}; the latter may seem redundant, but remember
+% \babel{} doesn't requires loading \file{switch.def} in the format.
+% \begin{macrocode}
+%<<*Define core switching macros>>
+\ifx\language\@undefined
+ \csname newcount\endcsname\language
+\fi
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\last@language}
+% Another counter is used to store the last language defined. For
+% pre-3.0 formats an extra counter has to be allocated.
+%
+% \begin{macro}{\addlanguage}
+%
+% To add languages to \TeX's memory plain \TeX\ version~3.0
+% supplies |\newlanguage|, in a pre-3.0 environment a similar macro
+% has to be provided. For both cases a new macro is defined here,
+% because the original |\newlanguage| was defined to be |\outer|.
+%
+% For a format based on plain version~2.x, the definition of
+% |\newlanguage| can not be copied because |\count 19| is used for
+% other purposes in these formats. Therefore |\addlanguage| is
+% defined using a definition based on the macros used to define
+% |\newlanguage| in plain \TeX\ version~3.0.
+% \changes{babel~3.2}{1991/11/11}{Added a \texttt{\%}, removed
+% \texttt{by}}
+%
+% For formats based on plain version~3.0 the definition of
+% |\newlanguage| can be simply copied, removing |\outer|.
+% \begin{macrocode}
+\ifx\newlanguage\@undefined
+ \csname newcount\endcsname\last@language
+ \def\addlanguage#1{%
+ \global\advance\last@language\@ne
+ \ifnum\last@language<\@cclvi
+ \else
+ \errmessage{No room for a new \string\language!}%
+ \fi
+ \global\chardef#1\last@language
+ \wlog{\string#1 = \string\language\the\last@language}}
+% \end{macrocode}
+% Plain \TeX\ version 3.0 uses |\count 19| for this purpose.
+% \begin{macrocode}
+\else
+ \countdef\last@language=19
+ \def\addlanguage{\alloc@9\language\chardef\@cclvi}
+\fi
+%<</Define core switching macros>>
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\ProvidesLanguage}
% \changes{babel~3.7a}{1997/03/18}{Added macro to prevent problems
% with unexpected \cs{ProvidesFile} in plain formats because of
@@ -1930,50 +2344,6 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.9a}{2012/12/09}{Save info about the babel version
% in the format (switch.def) so that it can be checked later if
% necessary}
-% \begin{macrocode}
-%<*kernel>
-\def\bbl@version{3.9f}
-\def\bbl@date{2013/05/16}
-%</kernel>
-%<*patterns>
-\xdef\bbl@format{\jobname}
-%</patterns>
-%<*core|kernel|patterns>
-\ifx\ProvidesFile\@undefined
- \def\ProvidesFile#1[#2 #3 #4]{%
- \wlog{File: #1 #4 #3 <#2>}%
- \let\ProvidesFile\@undefined
- }
-%</core|kernel|patterns>
-% \end{macrocode}
-% As an alternative for |\ProvidesFile| we define
-% |\ProvidesLanguage| here to be used in the language definition
-% files.
-% \begin{macrocode}
-%<*kernel>
- \def\ProvidesLanguage#1[#2 #3 #4]{%
- \wlog{Language: #1 #4 #3 <#2>}%
- }
-\else
-% \end{macrocode}
-% When |\ProvidesFile| is defined we give |\ProvidesLanguage| a
-% similar definition.
-% \begin{macrocode}
- \def\ProvidesLanguage#1{%
- \begingroup
- \catcode`\ 10 %
- \@makeother\/%
- \@ifnextchar[%]
- {\@provideslanguage{#1}}{\@provideslanguage{#1}[]}}
- \def\@provideslanguage#1[#2]{%
- \wlog{Language: #1 #2}%
- \expandafter\xdef\csname ver@#1.ldf\endcsname{#2}%
- \endgroup}
-%</kernel>
-%<*core|kernel|patterns>
-\fi
-%</core|kernel|patterns>
-% \end{macrocode}
% \end{macro}
%
% Identify each file that is produced from this source file.
@@ -1981,19 +2351,12 @@ help from Bernd Raichle, for which I am grateful.
% lthyphen.cfg}
% \changes{babel~3.5b}{1995/01/25}{lthyphen.cfg has become hyphen.cfg}
% \begin{macrocode}
-%<package>\ProvidesPackage{babel}
-%<core>\ProvidesFile{babel.def}
-%<patterns>\ProvidesFile{hyphen.cfg}
-%<kernel>\ProvidesFile{switch.def}
-%<nil>\ProvidesLanguage{nil}
-%<driver&!user>\ProvidesFile{babel.drv}
-%<driver&user>\ProvidesFile{user.drv}
- [2013/05/16 v3.9f %
-%<package> The Babel package]
-%<core> Babel common definitions]
-%<kernel|patterns> Babel language switching mechanism]
-%<nil> Nil language]
-%<driver>]
+%<*driver&!user>
+\ProvidesFile{babel.drv}[<@date@> <@version@>]
+%</driver&!user>
+%<*driver&user>
+\ProvidesFile{user.drv}[<@date@> <@version@>]
+%</driver&user>
% \end{macrocode}
%
% Now we make sure all required files are loaded. When the command
@@ -2007,23 +2370,6 @@ help from Bernd Raichle, for which I am grateful.
%
% \changes{babel~3.9a}{2012/12/21}{Use \cs{orig@dump} as flag instead
% of \cs{adddialect}}
-%\begingroup
-% \catcode`&=\active
-% \gdef\MakePrivateLetters{\catcode`@=11\relax\catcode`&=\active}%
-% \gdef&#1&{\quad\colorbox{thegrey}{\textsf{#1}}}
-%\endgroup
-% \begin{macrocode}
-%<*core|kernel|patterns>
-\ifx\AtBeginDocument\@undefined
-%</core|kernel|patterns>
-%<*patterns>
- \let\orig@dump\dump
-%</patterns>
-%<*core|kernel|patterns>
- \input plain.def\relax
-\fi
-%</core|kernel|patterns>
-% \end{macrocode}
%
% Check if the current version of \file{switch.def} has been
% previously loaded (mainly, \file{hyphen.cfg}). If not, load it
@@ -2036,36 +2382,6 @@ help from Bernd Raichle, for which I am grateful.
% loaded in a different version (or not loaded)}
% \changes{babel~3.9a}{2013/01/14}{Added the debug option}
% \changes{babel~3.9a}{2013/02/05}{Added \cs{bbl@add}}
-% \begin{macrocode}
-%<*package>
-\@ifpackagewith{babel}{debug}
- {\let\bbl@tempa\relax}
- {\def\bbl@tempa{3.9f}}%
-%</package>
-%<*core>
-\def\bbl@tempa{3.9f}
-%</core>
-%<*core|package>
-\ifx\bbl@version\bbl@tempa\else
- \input switch.def\relax
-\fi
-% \end{macrocode}
-% The following macros just make the code cleaner. |\bbl@add| is
-% now used internally instead of |\addto| because of the
-% unpredictable behaviour of the latter. (There are some
-% duplications, but, you know, I [JBL] never rememer where the code
-% ends up when intermingled with docstrip.)
-% \begin{macrocode}
-\def\bbl@for#1#2#3{\@for#1:=#2\do{\ifx#1\@empty\else#3\fi}}
-\def\bbl@add#1#2{%
- \@ifundefined{\expandafter\@gobble\string#1}%
- {\def#1{#2}}%
- {\expandafter\def\expandafter#1\expandafter{#1#2}}}
-\def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
-\long\def\bbl@afterelse#1\else#2\fi{\fi#1}
-\long\def\bbl@afterfi#1\fi{\fi#1}
-%</core|package>
-% \end{macrocode}
% \changes{babel~3.6a}{1996/11/02}{Removed \cs{babel@core@loaded}, no
% longer needed with the advent of \cs{LdfInit}}
%
@@ -2092,7 +2408,7 @@ help from Bernd Raichle, for which I am grateful.
%
% The first option to be processed is |base|, which set the
% hyphenation patterns then resets |ver@babel.sty| so that
-% LaTeX forgets about the first loading. After |switch.def| has
+% \LaTeX forgets about the first loading. After |switch.def| has
% been loaded (above) and |\AfterBabelLanguage| defined, exits.
%
% \changes{babel~3.5d}{1995/07/04}{Added options to influence
@@ -2104,6 +2420,11 @@ help from Bernd Raichle, for which I am grateful.
% base}
% \begin{macrocode}
%<*package>
+\ProvidesPackage{babel}[<@date@> <@version@> The Babel package]
+\@ifpackagewith{babel}{debug}
+ {\input switch.def\relax}
+ {<@Load switch if newer@>}
+<@Basic macros@>
\def\AfterBabelLanguage#1{%
\global\expandafter\bbl@add\csname#1.ldf-h@@k\endcsname}%
\@ifpackagewith{babel}{base}{%
@@ -2162,26 +2483,30 @@ help from Bernd Raichle, for which I am grateful.
% \Lopt{KeepShorthandsActive}}
% \changes{babel~3.7a}{1997/03/21}{No longer define the control
% sequence \cs{KeepShorthandsActive}}
-% \begin{macrocode}
-\DeclareOption{KeepShorthandsActive}{}
-% \end{macrocode}
% \changes{babel~3.9a}{2012/08/14}{Implemented the \texttt{noconfigs}
% option}
% \changes{babel~3.9a}{2012/09/26}{Implemented the
% \texttt{showlanguages} option}
+% \changes{babel~3.9g}{2013/08/07}{Options for hyphenmap}
% \begin{macrocode}
+\DeclareOption{KeepShorthandsActive}{}
\DeclareOption{debug}{}
\DeclareOption{noconfigs}{}
\DeclareOption{showlanguages}{}
\DeclareOption{shorthands=off}{\bbl@tempa shorthands=\bbl@tempa}
\DeclareOption{strings}{\def\bbl@opt@strings{\BabelStringsDefault}}
\DeclareOption{strings=encoded}{\let\bbl@opt@strings\relax}
+\def\BabelStringsDefault{generic}
\DeclareOption{safe=none}{\let\bbl@opt@safe\@empty}
\DeclareOption{safe=bib}{\def\bbl@opt@safe{B}}
\DeclareOption{safe=ref}{\def\bbl@opt@safe{R}}
\DeclareOption{math=active}{}
\DeclareOption{math=normal}{\def\bbl@mathnormal{\noexpand\textormath}}
-\def\BabelStringsDefault{generic}
+\DeclareOption{hyphenmap=off}{\chardef\bbl@hymapopt\z@}
+\DeclareOption{hyphenmap=first}{\chardef\bbl@hymapopt\@ne}
+\DeclareOption{hyphenmap=select}{\chardef\bbl@hymapopt\tw@}
+\DeclareOption{hyphenmap=other}{\chardef\bbl@hymapopt\thr@@}
+\DeclareOption{hyphenmap=other*}{\chardef\bbl@hymapopt4\relax}
% \end{macrocode}
%
% Handling of package options is done in three passes. (I [JBL] am not
@@ -2418,11 +2743,11 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\let\expandafter\BabelModifiers
\csname bbl@mod@\CurrentOption\endcsname}%
{\bbl@error{%
- Unknow option `\CurrentOption'. Either you misspelled it\\%
+ Unknown option `\CurrentOption'. Either you misspelled it\\%
or the language definition file \CurrentOption.ldf was not found}{%
- Valid options are: shorthands=..., KeepShorthandsActive,\\%
+ Valid options are: shorthands=, KeepShorthandsActive,\\%
activeacute, activegrave, noconfigs, safe=, main=, math=\\%
- headfoot=, strings=, config=, or a language name.}}}
+ headfoot=, strings=, config=, hyphenmap=, or a language name.}}}
% \end{macrocode}
% Now, we set language options whose names are different from |ldf| files.
% \begin{macrocode}
@@ -2639,8 +2964,17 @@ help from Bernd Raichle, for which I am grateful.
%
% \subsection{Tools}
%
+% |\bbl@engine| takes the following values: 0 is pdf\TeX, 1 is
+% \luatex, and 2 is \xetex. You may use it in your language style
+% if necessary.
+%
% \begin{macrocode}
%<*core>
+<@Make sure ProvidesFile is defined@>
+\ProvidesFile{babel.def}[<@date@> <@version@> Babel common definitions]
+<@Load macros for plain if not LaTeX@>
+<@Load switch if newer@>
+<@Basic macros@>
\ifx\bbl@opt@strings\@undefined
\def\bbl@opt@safe{BR}
\let\bbl@opt@strings\@nnil
@@ -2650,6 +2984,16 @@ help from Bernd Raichle, for which I am grateful.
\ifx\bbl@afterlang\@undefined\let\bbl@afterlang\relax\fi
\providecommand\AfterBabelLanguage[2]{}
\def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
+\chardef\bbl@engine=%
+ \ifx\directlua\@undefined
+ \ifx\XeTeXinputencoding\@undefined
+ \z@
+ \else
+ \tw@
+ \fi
+ \else
+ \@ne
+ \fi
% \end{macrocode}
%
% \begin{macro}{\bbl@afterelse}
@@ -2732,7 +3076,7 @@ help from Bernd Raichle, for which I am grateful.
% command |foo| is defined to expand to |\protect|\verb*|\foo |. So
% it is necessary to check whether \verb*|\foo | exists. The result
% is that the command that is being redefined is always robust
-% afterwards. Therefor all we need to do now is define \verb*|\foo |.
+% afterwards. Therefore all we need to do now is define \verb*|\foo |.
% \begin{macrocode}
\def\bbl@redefinerobust#1{%
\edef\bbl@tempa{\expandafter\@gobble\string#1}%
@@ -2770,7 +3114,7 @@ help from Bernd Raichle, for which I am grateful.
\AtEndOfPackage{\edef\latinencoding{\cf@encoding}}
% \end{macrocode}
% But this might be overruled with a later loading of the package
-% \pkg{fontenc}. Therefor we check at the execution of
+% \pkg{fontenc}. Therefore we check at the execution of
% |\begin{document}| whether it was loaded with the \Lopt{T1}
% option. The normal way to do this (using |\@ifpackageloaded|) is
% disabled for this package. Now we have to revert to parsing the
@@ -2784,7 +3128,7 @@ help from Bernd Raichle, for which I am grateful.
% the top of \file{babel.sty}}
% \changes{babel~3.6n}{1999/04/07}{Added a check for `manual' selection
% of \texttt{T1} encoding, without loading \pkg{fontenc}}
-% \changes{babel~3.6q}{1999/04/12}{Better solution then parsing
+% \changes{babel~3.6q}{1999/04/12}{Better solution than parsing
% \cs{@filelist}, use \cs{@ifl@aded}}
% \changes{babel~3.6u}{1999/04/20}{Moved this code to
% \file{babel.def}}
@@ -2844,7 +3188,7 @@ help from Bernd Raichle, for which I am grateful.
% Another character that needs to have the correct category code
% during processing of language definition files is the equals sign,
% `=', because it is sometimes used in constructions with the
-% |\let| primitive. Therefor we store its current catcode and
+% |\let| primitive. Therefore we store its current catcode and
% restore it later on.
% \changes{babel~3.7o}{2003/11/26}{make sure the equals sign has its
% default category code}
@@ -2857,7 +3201,10 @@ help from Bernd Raichle, for which I am grateful.
% with a control sequence which we can compare with |\@undefined|.
%
% \changes{babel~3.9a}{2012/08/11}{\cs{ldf@quit} is not delayed any
-% more after \cs{fi} , since \cs{endinput} is not executed immediately}
+% more after \cs{fi} , since \cs{endinput} is not executed
+% immediately}
+% \changes{babel~3.9g}{2012/08/11}{Preset the ``family'' of macros
+% \cs{Babel}...}
% If so, we call |\ldf@quit| to set the main language, restore the
% category code of the @-sign and call |\endinput|
%
@@ -2882,6 +3229,9 @@ help from Bernd Raichle, for which I am grateful.
\fi
\fi
\let\bbl@screset\@empty
+ \let\BabelStrings\bbl@opt@strings
+ \let\BabelOptions\@empty
+ \let\BabelLanguages\relax
\ifx\originalTeX\@undefined
\let\originalTeX\@empty
\else
@@ -3272,7 +3622,7 @@ help from Bernd Raichle, for which I am grateful.
% well. Also, make sure that a single |'| in math mode `does the
% right thing'. (2) If we are using the caret (|^|) as a shorthand
% character special care should be taken to make sure math still
-% works. Therefor an extra level of expansion is introduced with a
+% works. Therefore an extra level of expansion is introduced with a
% check for math mode on the upper level.
%
% \changes{babel~3.7f}{1999/12/18}{Insert a check for math mode in
@@ -3658,7 +4008,7 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.7a}{1998/06/07}{Added command}
% \begin{macro}{\shorthandoff}
% \changes{babel~3.7a}{1998/06/07}{Added command}
-% \changes{babel~3.9a}{2012/09/08}{Added code fo the starred variant
+% \changes{babel~3.9a}{2012/09/08}{Added code for the starred variant
% of \cs{shorthandoff}}
% The first level definition of these macros just passes the
% argument on to |\bbl@switch@sh|, adding |\@nil| at the end to
@@ -3720,9 +4070,9 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macrocode}
\def\babelshorthand{\active@prefix\babelshorthand\bbl@putsh}
\def\bbl@putsh#1{%
- \@ifundefined{bbl@active@\string#1}%
- {\bbl@putsh@i#1\@empty\@nnil}%
- {\csname bbl@active@\string#1\endcsname}}
+ \@ifundefined{bbl@active@\string#1}%
+ {\bbl@putsh@i#1\@empty\@nnil}%
+ {\csname bbl@active@\string#1\endcsname}}
\def\bbl@putsh@i#1#2\@nnil{%
\csname\languagename @sh@\string#1@%
\ifx\@empty#2\else\string#2@\fi\endcsname}
@@ -3803,7 +4153,7 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\T1dqpos}
% The position of the double quote character is different for the
% OT1 and T1 encodings. It will later be selected using the
-% |\f@encoding| macro. Therefor we define two macros here to store
+% |\f@encoding| macro. Therefore we define two macros here to store
% the position of the character in these encodings.
% \begin{macrocode}
\expandafter\def\csname OT1dqpos\endcsname{127}
@@ -3840,7 +4190,7 @@ help from Bernd Raichle, for which I am grateful.
\@for\bbl@attr:=#2\do{%
% \end{macrocode}
% We want to make sure that each attribute is selected only once;
-% therefor we store the already selected attributes in
+% therefore we store the already selected attributes in
% |\bbl@known@attribs|. When that control sequence is not yet
% defined this attribute is certainly not selected before.
% \begin{macrocode}
@@ -4330,7 +4680,7 @@ help from Bernd Raichle, for which I am grateful.
% In the \texttt{T1} encoding the opening double quote at the
% baseline is available as a separate character, accessible via
% |\quotedblbase|. In the \texttt{OT1} encoding it is not
-% available, therefor we make it available by lowering the normal
+% available, therefore we make it available by lowering the normal
% open quote character to the baseline.
% \begin{macrocode}
\ProvideTextCommand{\quotedblbase}{OT1}{%
@@ -4429,7 +4779,7 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\IJ}
% The dutch language uses the letter `ij'. It is available in
% \texttt{T1} encoded fonts, but not in the \texttt{OT1} encoded
-% fonts. Therefor we fake it for the \texttt{OT1} encoding.
+% fonts. Therefore we fake it for the \texttt{OT1} encoding.
% \changes{dutch-3.7a}{1995/02/04}{Changed the kerning in the faked ij
% to match the dc-version of it}
% \changes{babel~3.9a}{2012/07/28}{Removed the first \cs{allowhyphens}.
@@ -4499,7 +4849,7 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\SS}
% For the \texttt{T1} encoding |\SS| is defined and selects a
% specific glyph from the font, but for other encodings it is not
-% available. Therefor we make it available here.
+% available. Therefore we make it available here.
% \begin{macrocode}
\DeclareTextCommand{\SS}{OT1}{SS}
\ProvideTextCommandDefault{\SS}{\UseTextSymbol{OT1}{\SS}}
@@ -4699,7 +5049,7 @@ help from Bernd Raichle, for which I am grateful.
% uses |\bbl@umlauta| or |\bbl@umlaute| to position the umlaut
% character. We need to be sure that these definitions override the
% ones that are provided when the package \pkg{fontenc} with
-% option \Lopt{OT1} is used. Therefor these declarations are
+% option \Lopt{OT1} is used. Therefore these declarations are
% postponed until the beginning of the document. Note these
% definitions only apply to some languages, but
% babel sets them for \textit{all} languages -- you may want to
@@ -4729,12 +5079,76 @@ help from Bernd Raichle, for which I am grateful.
%
% The aim following commands is to provide a commom interface for
% strings in several encodings. They also contains several hooks which
-% can be ued by \luatex{} and \xetex.
+% can be ued by \luatex{} and \xetex. The code is organized here with
+% pseudo-guards, so we start with the basic commands.
+%
+% The command |\SetCase| provides a way to change the behaviour of
+% |\MakeUppercase| and |\MakeLowercase|. We need to patch
+% |\@uclclist|, but it is done once and only if |\SetCase| is used.
+% \begin{macrocode}
+\def\bbl@patchuclc{%
+ \let\bbl@patchuclc\relax
+ \@ifundefined{bbl@tolower}{%
+ \g@addto@macro\@uclclist{%
+ \reserved@b{\reserved@b\@gobble}% stops processing the list
+ \@ifundefined{\languagename @bbl@uclc}% and resumes it
+ {\reserved@a}%
+ {\csname\languagename @bbl@uclc\endcsname}%
+ {\bbl@tolower\@empty}{\bbl@toupper\@empty}}%
+ \gdef\bbl@tolower{\csname\languagename @bbl@lc\endcsname}%
+ \gdef\bbl@toupper{\csname\languagename @bbl@uc\endcsname}}{}}%
+% \end{macrocode}
+%
+% The command to be used in the |ldf|.
+%
+% \begin{macrocode}
+%<<*Define SetCase>>
+\newcommand\SetCase[3][]{%
+ \bbl@patchuclc
+ \bbl@forlang\bbl@tempa{%
+ \expandafter\bbl@stringdef
+ \csname\bbl@tempa @bbl@uclc\endcsname{\reserved@a##1}%
+ \expandafter\bbl@stringdef
+ \csname\bbl@tempa @bbl@uc\endcsname{##2}%
+ \expandafter\bbl@stringdef
+ \csname\bbl@tempa @bbl@lc\endcsname{##3}}}%
+%<</Define SetCase>>
+% \end{macrocode}
+%
+% Now we define |\SetStringLoop|. The current definition is
+% somewhat complicated because we need a count, but |\count@| and
+% the like are not under our control (remember |\SetString| may
+% call hooks).
+%
+% \begin{macrocode}
+%<<*Define SetStringLoop>>
+\def\SetStringLoop{\afterassignment\bbl@sclp\def\bbl@templ####1}%
+ \def\bbl@sclp##1{%
+ \def\bbl@tempk{\@ne}%
+ \@for\bbl@tempm:=##1\do{%
+ \count@\bbl@tempk\relax % Because of stringprocess event
+ \toks@\expandafter{\bbl@tempm}%
+ \edef\bbl@tempn{%
+ \expandafter\noexpand
+ \csname\bbl@templ{\romannumeral\count@}\endcsname{\the\toks@}}%
+ \advance\count@\@ne
+ \edef\bbl@tempk{\the\count@}%
+ \expandafter\SetString\bbl@tempn}}%
+%<</Define SetStringLoop>>
+% \end{macrocode}
%
% This is the main command. With the first use it is redefined to
% omit the basic setup in subsequent blocks. We make sure strings
% contain actual letters in the range 128-255, not active characters.
-% \begin{macrocode}
+% \changes{babel~3.9g}{2013/07/29}{Added starred variant. A bit of
+% clean up. Removed \cs{UseString}, which didn't work.}
+% \changes{babel~3.9g}{2013/08/01}{Now several languages can be
+% processed with \cs{BabelLanguages}, if set in the ldf.}
+% \begin{macrocode}
+\def\bbl@aftercmds#1{%
+ \toks@\expandafter{\bbl@scafter#1}%
+ \xdef\bbl@scafter{\the\toks@}}
+\def\bbl@toglobal#1{\global\let#1#1}
\def\bbl@recatcode#1{%
\@tempcnta="7F
\def\bbl@tempa{%
@@ -4748,67 +5162,41 @@ help from Bernd Raichle, for which I am grateful.
\def\StartBabelCommands{%
\begingroup
\bbl@recatcode{11}%
- \def\bbl@scuse{%
- \ifx\bbl@opt@strings\@nnil\def\bbl@opt@strings{generic}\fi}%
- \def\UseStrings{\bbl@scuse\aftergroup\bbl@scuse}%
- \def\SetStringLoop{\afterassignment\bbl@sclp\def\bbl@templ####1}%
- \def\bbl@sclp##1{%
- \count@\z@ % dangerous if a hook is used
- \@for\bbl@tempm:=##1\do{%
- \advance\count@\@ne
- \toks@\expandafter{\bbl@tempm}%
- \edef\bbl@tempn{%
- \expandafter\noexpand
- \csname\bbl@templ{\romannumeral\count@}\endcsname%
- {\the\toks@}}%
- \expandafter\SetString\bbl@tempn}}%
- \def\SetCase{%
- \@ifundefined{bbl@tolower}{%
- \g@addto@macro\@uclclist{%
- \reserved@b{\reserved@b\@gobble}% stops processing the list
- \@ifundefined{\languagename @bbl@uclc}% and resumes it
- {\reserved@a}%
- {\csname\languagename @bbl@uclc\endcsname}%
- {\bbl@tolower\@empty}{\bbl@toupper\@empty}}%
- \gdef\bbl@tolower{\csname\languagename @bbl@lc\endcsname}%
- \gdef\bbl@toupper{\csname\languagename @bbl@uc\endcsname}}{}%
- \let\SetCase\bbl@setcase
- \SetCase}%
- \def\bbl@provstring##1{%
- \@ifundefined{\expandafter\@gobble\string##1}{\gdef##1}\@gobble}%
- \def\bbl@dftstring##1##2{%
- \@dec@text@cmd\gdef##1?{##2}%
- \global\let##1##1}%
- \def\bbl@encstring##1##2{%
- \bbl@for\bbl@tempc\bbl@sc@fontenc{%
- \@ifundefined{T@\bbl@tempc}%
- \@empty
- {\@dec@text@cmd\gdef##1\bbl@tempc{##2}%
- \global\let##1##1}}}%
+ <@Define SetStringLoop@>
+ <@Define SetCase@>
+ \def\bbl@provstring##1##2{%
+ \providecommand##1{##2}%
+ \bbl@toglobal##1}%
+ \global\let\bbl@scafter\@empty
\let\StartBabelCommands\bbl@startcmds
+ \ifx\BabelLanguages\relax
+ \let\BabelLanguages\CurrentOption
+ \fi
\begingroup
\let\bbl@screset\@nnil % local flag - disable 1st stopcommands
\StartBabelCommands}
-\def\bbl@startcmds#1#2{%
+\def\bbl@startcmds{%
\ifx\bbl@screset\@nnil\else
\bbl@usehooks{stopcommands}{}%
\fi
\endgroup
\begingroup
+ \@ifstar
+ {\ifx\bbl@opt@strings\@nnil
+ \let\bbl@opt@strings\BabelStringsDefault
+ \fi
+ \bbl@startcmds@i}%
+ \bbl@startcmds@i}
+\def\bbl@startcmds@i#1#2{%
\edef\bbl@L{\zap@space#1 \@empty}%
\edef\bbl@G{\zap@space#2 \@empty}%
- \let\bbl@sc@charset\space
- \let\bbl@sc@fontenc\space
- \let\SetString\@gobbletwo
- \let\bbl@stringdef\@gobbletwo
- \bbl@startcmds@i}
+ \bbl@startcmds@ii}
% \end{macrocode}
% Parse the encoding info to get the label, input, and font parts.
%
-% Select the behaviour of |\SetString|. Thre are two main cases:
-% |*| blocks, which are always taken into account, and labelled
-% blocks, which are not always taken into account. With |*| and
-% |strings| set to |encoded| or |generic|, strings are defined
+% Select the behaviour of |\SetString|. Thre are two main cases,
+% depending of if there is an optional argument: without it and
+% |strings=encoded|, strings are defined
% always; otherwise, they are set only if they are still undefined
% (ie, fallback values). With labelled blocks and
% |strings=encoded|, define the strings, but with another value,
@@ -4820,46 +5208,63 @@ help from Bernd Raichle, for which I am grateful.
% (above) a couple of default values to gobble the arguments. Then,
% these macros are redefined if necessary according to several
% parameters.
-%
+% \changes{babel~3.9g}{2013/08/04}{Use \cs{ProvideTextCommand}, which
+% does with encoded strings what the manual says.}
+%
% \begin{macrocode}
-\newcommand\bbl@startcmds@i[1][\@empty]{%
+\newcommand\bbl@startcmds@ii[1][\@empty]{%
+ \let\SetString\@gobbletwo
+ \let\bbl@stringdef\@gobbletwo
+ \let\AfterBabelCommands\@gobble
\ifx\@empty#1%
\def\bbl@sc@label{generic}%
- \bbl@scswitch{%
- \ifx\bbl@opt@strings\@nnil
- \let\bbl@stringdef\bbl@dftstring
- \else\ifx\bbl@opt@strings\relax
- \let\SetString\bbl@setstring
- \let\bbl@stringdef\bbl@dftstring
- \else
- \let\SetString\bbl@setstring
- \let\bbl@stringdef\bbl@provstring
- \fi\fi}%
- \@expandtwoargs
- \bbl@usehooks{defaultcommands}{}%
+ \def\bbl@encstring##1##2{%
+ \ProvideTextCommandDefault##1{##2}%
+ \bbl@toglobal##1%
+ \expandafter\bbl@toglobal\csname\string?\string##1\endcsname}%
+ \let\bbl@sctest\in@true
\else
+ \let\bbl@sc@charset\space % <- zapped below
+ \let\bbl@sc@fontenc\space % <- " "
\def\bbl@tempa##1=##2\@nil{%
\bbl@csarg\edef{sc@\zap@space##1 \@empty}{##2 }}%
\bbl@for\bbl@tempb{label=#1}{\expandafter\bbl@tempa\bbl@tempb\@nil}%
- \def\bbl@tempa##1 ##2{%
+ \def\bbl@tempa##1 ##2{% space -> comma
##1%
\ifx\@empty##2\else\ifx,##1,\else,\fi\bbl@afterfi\bbl@tempa##2\fi}%
\edef\bbl@sc@fontenc{\expandafter\bbl@tempa\bbl@sc@fontenc\@empty}%
\edef\bbl@sc@label{\expandafter\zap@space\bbl@sc@label\@empty}%
\edef\bbl@sc@charset{\expandafter\zap@space\bbl@sc@charset\@empty}%
- \bbl@scswitch{%
- \ifx\bbl@opt@strings\@nnil
- \let\bbl@stringdef\bbl@encstring
- \else\ifx\bbl@opt@strings\relax
- \let\SetString\bbl@setstring
- \let\bbl@stringdef\bbl@encstring
- \else
+ \def\bbl@encstring##1##2{%
+ \bbl@for\bbl@tempc\bbl@sc@fontenc{%
+ \@ifundefined{T@\bbl@tempc}%
+ {}%
+ {\ProvideTextCommand##1\bbl@tempc{##2}%
+ \bbl@toglobal##1%
+ \expandafter
+ \bbl@toglobal\csname\bbl@tempc\string##1\endcsname}}}%
+ \def\bbl@sctest{%
\@expandtwoargs
- \in@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}%
- \ifin@
- \let\SetString\bbl@setstring
- \let\bbl@stringdef\bbl@provstring
- \fi\fi\fi}%
+ \in@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}}%
+ \fi
+ \bbl@scswitch{%
+ \ifx\bbl@opt@strings\@nnil % ie, no strings
+ \let\bbl@stringdef\bbl@encstring % for \SetCase
+ \else\ifx\bbl@opt@strings\relax % ie, strings with no value
+ \let\AfterBabelCommands\bbl@aftercmds
+ \let\SetString\bbl@setstring
+ \let\bbl@stringdef\bbl@encstring
+ \else % ie, strings=value
+ \bbl@sctest
+ \ifin@
+ \let\AfterBabelCommands\bbl@aftercmds
+ \let\SetString\bbl@setstring
+ \let\bbl@stringdef\bbl@provstring
+ \fi\fi\fi}%
+ \ifx\@empty#1%
+ \@expandtwoargs
+ \bbl@usehooks{defaultcommands}{}%
+ \else
\@expandtwoargs
\bbl@usehooks{encodedcommands}{{\bbl@sc@charset}{\bbl@sc@fontenc}}%
\fi}
@@ -4871,26 +5276,30 @@ help from Bernd Raichle, for which I am grateful.
% also makes sure |\|\m{group}\m{language} is reset, but only once
% (|\bbl@screset| is used to keep track of this). The second version
% is used in the preamble and packages loaded after \babel{} and
-% defines strings for all known languages.
+% defines strings for all known languages. The macro |\bbl@forlang|
+% loops |\bbl@L| but its body is executed only if the value is in
+% |\BabelLanguages| (inside \babel) or |\date|\m{language} is
+% defined (after \babel{} has been loaded).
%
% \begin{macrocode}
+\def\bbl@forlang#1#2{%
+ \bbl@for#1\bbl@L{%
+ \@expandtwoargs\in@{,#1,}{,\BabelLanguages,}%
+ \ifin@#2\fi}}
\def\bbl@scswitch#1{%
- \@expandtwoargs\in@{,\CurrentOption,}{,\bbl@L,}%
- \ifin@
- \let\bbl@L\CurrentOption
- #1\relax
- \bbl@scswitch@i
+ #1\relax
+ \bbl@scswitch@i
+ \bbl@forlang\bbl@tempa{%
\ifx\bbl@G\@empty\else
\ifx\SetString\@gobbletwo\else
- \edef\bbl@GL{\bbl@G\bbl@L}%
+ \edef\bbl@GL{\bbl@G\bbl@tempa}%
\@expandtwoargs\in@{,\bbl@GL,}{,\bbl@screset,}%
\ifin@\else
\global\expandafter\let\csname\bbl@GL\endcsname\@undefined
\xdef\bbl@screset{\bbl@screset,\bbl@GL}%
\fi
\fi
- \fi
- \fi}
+ \fi}}
\def\bbl@scswitch@i{%
\ifx\bbl@G\@empty
\def\SetString##1##2{%
@@ -4898,12 +5307,15 @@ help from Bernd Raichle, for which I am grateful.
{You must assign strings to some category, typically\\%
captions or extras, but you set none}}%
\fi}
-\AtEndOfPackage{\def\bbl@scswitch#1{#1\relax\bbl@scswitch@i}}
+\AtEndOfPackage{%
+ \def\bbl@scswitch#1{#1\relax\bbl@scswitch@i}%
+ \def\bbl@forlang#1#2{\bbl@for#1\bbl@L{\@ifundefined{date#1}{}{#2}}}}
\@onlypreamble\EndBabelCommands
\def\EndBabelCommands{%
\bbl@usehooks{stopcommands}{}%
\endgroup
- \endgroup}
+ \endgroup
+ \bbl@scafter}
% \end{macrocode}
%
% First save the ``switcher''. Create it if undefined. Strings are
@@ -4912,11 +5324,13 @@ help from Bernd Raichle, for which I am grateful.
% manipulating the value of |\BabelString|. If there are several
% hooks assigned to this event, preprocessing is done in the same
% order as defined. Finally, the string is set.
-%
+% \changes{babel~3.9g}{2013/07/29}{Added \cs{bbl@forlang} to ignore in
+% the preamble unknown languages, as described in the doc.}
+%
% \begin{macrocode}
\def\bbl@scset#1#2{\def#1{#2}}
\def\bbl@setstring#1#2{%
- \bbl@for\bbl@tempa\bbl@L{%
+ \bbl@forlang\bbl@tempa{%
\edef\bbl@LC{\bbl@tempa\expandafter\@gobble\string#1}%
\@ifundefined{\bbl@LC}% eg, \germanchaptername
{\global\expandafter
@@ -4927,14 +5341,53 @@ help from Bernd Raichle, for which I am grateful.
\bbl@usehooks{stringprocess}{}%
\expandafter\bbl@stringdef
\csname\bbl@LC\expandafter\endcsname\expandafter{\BabelString}}}
-\newcommand\bbl@setcase[3][]{%
- \bbl@for\bbl@tempa\bbl@L{%
- \expandafter\bbl@stringdef
- \csname\bbl@tempa @bbl@uclc\endcsname{\reserved@a#1}%
- \expandafter\bbl@stringdef
- \csname\bbl@tempa @bbl@uc\endcsname{#2}%
+% \end{macrocode}
+%
+% Macros to deal with case mapping for hyphenation. To decide if the
+% document is monolingual or multilingual, we make a rough guess --
+% just see if there is a comma in the languages list, built in the
+% first pass of the package options.
+%
+% \begin{macrocode}
+\def\SetHyphenMap#1{%
+ \bbl@forlang\bbl@tempa{%
\expandafter\bbl@stringdef
- \csname\bbl@tempa @bbl@lc\endcsname{#3}}}
+ \csname\bbl@tempa @bbl@hyphenmap\endcsname{#1}}}
+\AtEndOfPackage{%
+ \ifx\bbl@hymapopt\@undefined
+ \@expandtwoargs\in@{,}{\bbl@language@opts}%
+ \chardef\bbl@hymapopt\ifin@4\else\@ne\fi
+ \fi}
+% \end{macrocode}
+%
+% There are 3 helper macros which do most of the work for you.
+%
+% \begin{macrocode}
+\newcommand\BabelLower[2]{% one to one.
+ \ifnum\lccode#1=#2\else
+ \babel@savevariable{\lccode#1}%
+ \lccode#1=#2\relax
+ \fi}
+\newcommand\BabelLowerMM[4]{% many-to-many
+ \@tempcnta=#1\relax
+ \@tempcntb=#4\relax
+ \def\bbl@tempa{%
+ \ifnum\@tempcnta>#2\else
+ \@expandtwoargs\BabelLower{\the\@tempcnta}{\the\@tempcntb}%
+ \advance\@tempcnta#3\relax
+ \advance\@tempcntb#3\relax
+ \expandafter\bbl@tempa
+ \fi}%
+ \bbl@tempa}
+\newcommand\BabelLowerMO[4]{% many-to-one
+ \@tempcnta=#1\relax
+ \def\bbl@tempa{%
+ \ifnum\@tempcnta>#2\else
+ \@expandtwoargs\BabelLower{\the\@tempcnta}{#4}%
+ \advance\@tempcnta#3
+ \expandafter\bbl@tempa
+ \fi}%
+ \bbl@tempa}
% \end{macrocode}
%
% \subsection{Hooks}
@@ -4967,19 +5420,17 @@ help from Bernd Raichle, for which I am grateful.
% implicitly. So, if a further argument is added in the future,
% there is no need to change the existing code. Note events
% intended for \textsf{hyphen.cfg} are also loaded (just in
-% case you need them).
+% case you need them for some reason).
% \begin{macrocode}
\def\bbl@evargs{,% don't delete the comma
everylanguage=1,loadkernel=1,loadpatterns=1,loadexceptions=1,%
adddialect=2,patterns=2,defaultcommands=0,encodedcommands=2,write=0,%
beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,%
hyphenation=2}
-\ifx\directlua\@undefined
- \ifx\XeTeXinputencoding\@undefined\else
- \input xebabel.def
- \fi
-\else
+\ifcase\bbl@engine\or
\input luababel.def
+\or
+ \input xebabel.def
\fi
% \end{macrocode}
%
@@ -5072,7 +5523,7 @@ help from Bernd Raichle, for which I am grateful.
% the |\enddocument| macro. This macro needs to be completely
% rewritten, using |\meaning|. The reason for this is that in some
% cases the expansion of |\#1@#2| contains the same characters as
-% the |#3|; but the character codes differ. Therefor \LaTeX\ keeps
+% the |#3|; but the character codes differ. Therefore \LaTeX\ keeps
% reporting that the labels may have changed.
% \changes{babel~3.4g}{1994/08/30}{Moved the \cs{def} inside the
% macrocode environment}
@@ -5247,7 +5698,7 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.6v}{1999/04/21}{Also check for \pkg{cite} it can't
% handle \cs{@safe@activesfalse} in its second argument}
% \begin{macrocode}
- \bbl@redefine\bibcite{%
+ \bbl@redefine\bibcite{%
% \end{macrocode}
% We call |\bbl@cite@choice| to select the proper definition for
% |\bibcite|. This new definition is then activated.
@@ -5279,7 +5730,7 @@ help from Bernd Raichle, for which I am grateful.
\global\let\bibcite\bbl@bibcite
% \end{macrocode}
% Then, when \pkg{natbib} is loaded we restore the original
-% definition of |\bibcite| .
+% definition of |\bibcite|.
% \begin{macrocode}
\@ifpackageloaded{natbib}{\global\let\bibcite\org@bibcite}{}%
% \end{macrocode}
@@ -5388,7 +5839,7 @@ help from Bernd Raichle, for which I am grateful.
% |\markright|, except that we need two token registers. The
% documentclasses \cls{report} and \cls{book} define and set the
% headings for the page. While doing so they also store a copy of
-% |\markboth| in |\@mkboth|. Therefor we need to check whether
+% |\markboth| in |\@mkboth|. Therefore we need to check whether
% |\@mkboth| has already been set. If so we neeed to do that again
% with the new definition of |\makrboth|.
% \changes{babel~3.7m}{2003/11/15}{added \cs{bbl@restore@actives} to
@@ -5568,7 +6019,7 @@ help from Bernd Raichle, for which I am grateful.
% Delaying the activation of the shorthand characters has introduced
% a problem with the \pkg{hhline} package. The reason is that it
% uses the `:' character which is made active by the french support
-% in \babel. Therefor we need to \emph{reload} the package when
+% in \babel. Therefore we need to \emph{reload} the package when
% the `:' is an active character.
%
% So at |\begin{document}| we check whether \pkg{hhline} is loaded.
@@ -5607,7 +6058,7 @@ help from Bernd Raichle, for which I am grateful.
% following code was introduced to prevent some annoying warnings
% but it broke bookmarks. This was quickly fixed in \pkg{hyperref},
% which essentially made it no-op. However, it will not removed for
-% the moment because \pkg{hyperref} is expecting it, .
+% the moment because \pkg{hyperref} is expecting it.
%
% \begin{macrocode}
\AtBeginDocument{%
@@ -5696,7 +6147,7 @@ help from Bernd Raichle, for which I am grateful.
% order to guard against any characters having the wrong
% |\catcode|s it always calls |\nfss@catcodes| before loading a
% file. Unfortunately, the characters |"| and |'| are not dealt
-% with. Therefor we have to add them until \LaTeX\ does that
+% with. Therefore we have to add them until \LaTeX\ does that
% itself.
% \begin{macrocode}
\bbl@add\nfss@catcodes{%
@@ -6091,62 +6542,17 @@ help from Bernd Raichle, for which I am grateful.
%
% \subsection{Multiple languages}
%
-% \begin{macro}{\language}
% Plain \TeX\ version~3.0 provides the primitive |\language| that
% is used to store the current language. When used with a pre-3.0
% version this function has to be implemented by allocating a
% counter.
% \begin{macrocode}
-%<*kernel|patterns>
-\ifx\language\@undefined
- \csname newcount\endcsname\language
-\fi
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\last@language}
-% Another counter is used to store the last language defined. For
-% pre-3.0 formats an extra counter has to be allocated.
-%
-% \begin{macro}{\addlanguage}
-%
-% To add languages to \TeX's memory plain \TeX\ version~3.0
-% supplies |\newlanguage|, in a pre-3.0 environment a similar macro
-% has to be provided. For both cases a new macro is defined here,
-% because the original |\newlanguage| was defined to be |\outer|.
-%
-% For a format based on plain version~2.x, the definition of
-% |\newlanguage| can not be copied because |\count 19| is used for
-% other purposes in these formats. Therefor |\addlanguage| is
-% defined using a definition based on the macros used to define
-% |\newlanguage| in plain \TeX\ version~3.0.
-% \changes{babel~3.2}{1991/11/11}{Added a \texttt{\%}, removed
-% \texttt{by}}
-%
-% For formats based on plain version~3.0 the definition of
-% |\newlanguage| can be simply copied, removing |\outer|.
-% \begin{macrocode}
-\ifx\newlanguage\@undefined
- \csname newcount\endcsname\last@language
- \def\addlanguage#1{%
- \global\advance\last@language\@ne
- \ifnum\last@language<\@cclvi
- \else
- \errmessage{No room for a new \string\language!}%
- \fi
- \global\chardef#1\last@language
- \wlog{\string#1 = \string\language\the\last@language}}
-% \end{macrocode}
-% plain \TeX\ version 3.0 uses |\count 19| for this purpose.
-% \begin{macrocode}
-\else
- \countdef\last@language=19
- \def\addlanguage{\alloc@9\language\chardef\@cclvi}
-\fi
-%</kernel|patterns>
+%<*kernel>
+<@Make sure ProvidesFile is defined@>
+\ProvidesFile{switch.def}[<@date@> <@version@> Babel switching mechanism]
+<@Load macros for plain if not LaTeX@>
+<@Define core switching macros@>
% \end{macrocode}
-% \end{macro}
-% \end{macro}
%
% \begin{macro}{\adddialect}
% The macro |\adddialect| can be used to add the name of a dialect
@@ -6154,7 +6560,8 @@ help from Bernd Raichle, for which I am grateful.
% table can be used.
% \changes{babel~3.2}{1991/11/11}{Added \cs{relax}}
% \begin{macrocode}
-%<*kernel>
+\def\bbl@version{<@version@>}
+\def\bbl@date{<@date@>}
\def\adddialect#1#2{%
\global\chardef#1#2\relax
\bbl@usehooks{adddialect}{{#1}{#2}}%
@@ -6268,7 +6675,7 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
% Because the command |\selectlanguage| could be used in a moving
% argument it expands to \verb*=\protect\selectlanguage =.
-% Therefor, we have to make sure that a macro |\protect| exists.
+% Therefore, we have to make sure that a macro |\protect| exists.
% If it doesn't it is |\let| to |\relax|.
% \begin{macrocode}
\ifx\@undefined\protect\let\protect\relax\fi
@@ -6276,7 +6683,7 @@ help from Bernd Raichle, for which I am grateful.
% As \LaTeX$\:$2.09 writes to files \textit{expanded} whereas
% \LaTeXe\ takes care \textit{not} to expand the arguments of
% |\write| statements we need to be a bit clever about the way we
-% add information to \file{.aux} files. Therefor we introduce the
+% add information to \file{.aux} files. Therefore we introduce the
% macro |\xstring| which should expand to the right amount of
% |\string|'s.
% \begin{macrocode}
@@ -6300,7 +6707,7 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\bbl@pop@language}
% \emph{But} when the language change happens \emph{inside} a group
% the end of the group doesn't write anything to the auxiliary
-% files. Therefor we need \TeX's |aftergroup| mechanism to help
+% files. Therefore we need \TeX's |aftergroup| mechanism to help
% us. The command |\aftergroup| stores the token immediately
% following it to be executed when the current group is closed. So
% we define a temporary control sequence |\bbl@pop@language| to be
@@ -6364,6 +6771,7 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.7j}{2003/03/18}{Now use the language stack mechanism}
% \begin{macrocode}
\expandafter\def\csname selectlanguage \endcsname#1{%
+ \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\tw@\fi
\bbl@push@language
\aftergroup\bbl@pop@language
\bbl@set@language{#1}}
@@ -6412,6 +6820,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
\fi}
\def\select@language#1{%
+ \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi
\edef\languagename{#1}%
\bbl@fixname\languagename
\bbl@iflanguage\languagename{%
@@ -6515,6 +6924,18 @@ help from Bernd Raichle, for which I am grateful.
\bbl@usehooks{beforeextras}{}%
\csname extras#1\endcsname\relax
\bbl@usehooks{afterextras}{}%
+ \ifcase\bbl@hymapopt\or
+ \renewcommand\BabelLower[2]{\lccode##1=##2\relax}%
+ \ifnum\bbl@hymapsel>4\else
+ \csname\languagename @bbl@hyphenmap\endcsname
+ \fi
+ \chardef\bbl@hymapopt\z@
+ \else
+ \ifnum\bbl@hymapsel>\bbl@hymapopt\else
+ \csname\languagename @bbl@hyphenmap\endcsname
+ \fi
+ \fi
+ \global\let\bbl@hymapsel\@cclv
\bbl@patterns{#1}%
\babel@savevariable\lefthyphenmin
\babel@savevariable\righthyphenmin
@@ -6557,6 +6978,7 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.9a}{2012/07/31}{Removed \cs{originalTeX}}
% \begin{macrocode}
\long\def\otherlanguage#1{%
+ \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\thr@@\fi
\csname selectlanguage \endcsname{#1}%
\ignorespaces}
% \end{macrocode}
@@ -6577,6 +6999,7 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.6d}{1997/01/07}{Introduced \cs{foreign@language}}
% \begin{macrocode}
\expandafter\def\csname otherlanguage*\endcsname#1{%
+ \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi
\foreign@language{#1}}
% \end{macrocode}
% At the end of the environment we need to switch off the extra
@@ -6663,6 +7086,7 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macrocode}
\let\bbl@hyphlist\@empty
\let\bbl@hyphenation@\relax
+\let\bbl@hymapsel=\@cclv
\def\bbl@patterns#1{%
\language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax
\csname l@#1\endcsname
@@ -6739,6 +7163,29 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
% \end{macro}
%
+% As an alternative for |\ProvidesFile| we define
+% |\ProvidesLanguage| here to be used in the language definition
+% files. Depending on the format, ie, on if the former is defined,
+% we use a similar definition or not.
+% \begin{macrocode}
+\ifx\ProvidesFile\@undefined
+ \def\ProvidesLanguage#1[#2 #3 #4]{%
+ \wlog{Language: #1 #4 #3 <#2>}%
+ }
+\else
+ \def\ProvidesLanguage#1{%
+ \begingroup
+ \catcode`\ 10 %
+ \@makeother\/%
+ \@ifnextchar[%]
+ {\@provideslanguage{#1}}{\@provideslanguage{#1}[]}}
+ \def\@provideslanguage#1[#2]{%
+ \wlog{Language: #1 #2}%
+ \expandafter\xdef\csname ver@#1.ldf\endcsname{#2}%
+ \endgroup}
+\fi
+% \end{macrocode}
+%
% \begin{macro}{\LdfInit}
% \changes{babel~3.6a}{1996/10/16}{Macro added}
% This macro is defined in two versions. The first version is to be
@@ -6862,17 +7309,91 @@ help from Bernd Raichle, for which I am grateful.
% \end{macro}
% \end{macro}
%
-% The following code is meant to be read by ini\TeX\ because it
-% should instruct \TeX\ to read hyphenation patterns. To this end
-% the \texttt{docstrip} option \texttt{patterns} can be used to
-% include this code in the file \file{hyphen.cfg}. Code is at lower
-% level than the rest.
+% The following code is meant to be read by ini\TeX\ because it
+% should instruct \TeX\ to read hyphenation patterns. To this end the
+% \texttt{docstrip} option \texttt{patterns} can be used to include
+% this code in the file \file{hyphen.cfg}. Code is written with lower
+% level macros.
%
% |toks8| stores info to be shown when the program is run.
%
+% \changes{babel~3.9g}{2013/05/30}{Code moved from plain.def}
+% \changes{bbplain-1.0c}{1995/11/08}{Moved the \cs{dump} code here from
+% \file{babel.dtx}}
+% \changes{bbplain-0.1}{1991/10/31}{Added redefinition of \cs{dump} to
+% add a message to \cs{everyjob}}
+% We want to add a message to the message \LaTeX$\:$2.09 puts in
+% the |\everyjob| register. This could be done by the following
+% code:
+% \begin{verbatim}
+% \let\orgeveryjob\everyjob
+% \def\everyjob#1{%
+% \orgeveryjob{#1}%
+% \orgeveryjob\expandafter{\the\orgeveryjob\immediate\write16{%
+% hyphenation patterns for \the\loaded@patterns loaded.}}%
+% \let\everyjob\orgeveryjob\let\orgeveryjob\@undefined}
+% \end{verbatim}
+% The code above redefines the control sequence \cs{everyjob}
+% in order to be able to add something to the current contents of
+% the register. This is necessary because the processing of
+% hyphenation patterns happens long before \LaTeX\ fills the
+% register.
+%
+% There are some problems with this approach though.
+% \begin{itemize}
+% \item When someone wants to use several hyphenation patterns with
+% \SliTeX\ the above scheme won't work. The reason is that \SliTeX\
+% overwrites the contents of the |\everyjob| register with its own
+% message.
+% \item Plain \TeX\ does not use the |\everyjob| register so the
+% message would not be displayed.
+% \end{itemize}
+% To circumvent this a `dirty trick' can be used. As this code is
+% only processed when creating a new format file there is one
+% command that is sure to be used, |\dump|. Therefore the original
+% |\dump| is saved in |\org@dump| and a new definition is supplied.
+%
+% To make sure that \LaTeX$\:$2.09 executes the
+% |\@begindocumenthook| we would want to alter |\begin{document}|,
+% but as this done too often already, we add the new code at the
+% front of |\@preamblecmds|. But we can only do that after it has
+% been defined, so we add this piece of code to |\dump|.
+% \changes{bbplain-1.0c}{1995/11/19}{Add execution of
+% \cs{@begindocumenthook} to \cs{@preamblecmds}}
+% \changes{bbplain-1.0i}{1997/01/02}{\cs{document} is not a
+% \LaTeX2.09-only command; AMS\TeX defines it too; now use
+% \cs{@ztryfc} to detect \LaTeX2.09}
+% \changes{bbplain-1.0j}{1997/01/07}{Add the definition of
+% \cs{@begindocumenthook} to the \LaTeX2.09 format}
+%
+% This new definition starts by adding an instruction to write a
+% message on the terminal and in the transcript file to inform the
+% user of the preloaded hyphenation patterns.
+% \changes{bbplain-1.0f}{1996/07/09}{Use \cs{toks8} instead of
+% \cs{patterns@loaded}}
+%
+% Then everything is restored to the old situation and the format
+% is dumped.
+%
% \begin{macrocode}
%<*patterns>
-\toks8{Babel <3.9f> and hyphenation patterns for }%
+<@Make sure ProvidesFile is defined@>
+\ProvidesFile{hyphen.cfg}[<@date@> <@version@> Babel hyphens]
+\xdef\bbl@format{\jobname}
+\ifx\AtBeginDocument\@undefined
+ \def\@empty{}
+ \let\orig@dump\dump
+ \def\dump{%
+ \ifx\@ztryfc\@undefined
+ \else
+ \toks0=\expandafter{\@preamblecmds}%
+ \edef\@preamblecmds{\noexpand\@begindocumenthook\the\toks0}%
+ \def\@begindocumenthook{}%
+ \fi
+ \let\dump\orig@dump\let\orig@dump\@undefined\dump}
+\fi
+<@Define core switching macros@>
+\toks8{Babel <<@version@>> and hyphenation patterns for }%
% \end{macrocode}
%
% \changes{babel~3.5g}{1996/07/09}{Removed the use of
@@ -6988,13 +7509,13 @@ help from Bernd Raichle, for which I am grateful.
% pattern file changed them}
% Pattern files may contain assignments to |\lefthyphenmin| and
% |\righthyphenmin|. \TeX\ does not keep track of these
-% assignments. Therefor we try to detect such assignments and
+% assignments. Therefore we try to detect such assignments and
% store them in the |\|\langvar|hyphenmins| macro. When no
% assignments were made we provide a default setting.
%
% Some pattern files contain changes to the |\lccode| en |\uccode|
% arrays. Such changes should remain local to the language;
-% therefor we process the pattern file in a group; the |\patterns|
+% therefore we process the pattern file in a group; the |\patterns|
% command acts globally so its effect will be remembered.
%
% Then we globally store the settings of |\lefthyphenmin| and
@@ -7202,19 +7723,25 @@ help from Bernd Raichle, for which I am grateful.
% to copy the contents of \cs{toks8} into \cs{everyjob} instead of
% the reference}
% \changes{babel~3.9a}{2012/09/25}{The list of languages is not
-% printed every job any more (it is saved in \cs{bbl@languages}).}
+% printed every job any more (it is saved in \cs{bbl@languages}).}
+% \changes{babel~3.9g}{2013/07/28}{In non-LaTeX formats the number of
+% languages were not printed. Moved from \cs{dump} and cleaned up:
+% now \cs{toks}8 is expanded here.}
% \begin{macrocode}
\if/\the\toks@/\else
\errhelp{language.dat loads no language, only synonyms}
\errmessage{Orphan language synonym}
\fi
-\ifx\addto@hook\@undefined
-\else
- \edef\bbl@tempa{%
- \noexpand\typeout{\the\toks8 \the\last@language\space languages
- loaded.}}%
- \expandafter\addto@hook\expandafter\everyjob\expandafter{\bbl@tempa}
-\fi
+\edef\bbl@tempa{%
+ \everyjob{%
+ \the\everyjob
+ \ifx\typeout\@undefined
+ \immediate\write16%
+ \else
+ \noexpand\typeout
+ \fi
+ {\the\toks8 \the\last@language\space languages loaded.}}}
+\bbl@tempa
% \end{macrocode}
% Also remove some macros from memory and raise an error
% if |\toks@| is not empty. Finally load \file{switch.def}, but the
@@ -7251,6 +7778,7 @@ help from Bernd Raichle, for which I am grateful.
% \texttt{@} sign, etc.
% \begin{macrocode}
%<*nil>
+\ProvidesLanguage{nil}[<@date@> <@version@> Nil language]
\LdfInit{nil}{datenil}
% \end{macrocode}
%
@@ -7291,6 +7819,568 @@ help from Bernd Raichle, for which I am grateful.
%</nil>
% \end{macrocode}
%
+% \changes{bbplain-1.0n}{1998/06/08}{Added the source for the format
+% wrapper files}
+%
+% \section{Support for Plain \TeX}
+%
+% \subsection{Not renaming \file{hyphen.tex}}
+% As Don Knuth has declared that the filename \file{hyphen.tex} may
+% only be used to designate \emph{his} version of the american
+% English hyphenation patterns, a new solution has to be found in
+% order to be able to load hyphenation patterns for other languages
+% in a plain-based \TeX-format.
+% When asked he responded:
+% \begin{quote}
+% That file name is ``sacred'', and if anybody changes it they will
+% cause severe upward/downward compatibility headaches.
+%
+% People can have a file localhyphen.tex or whatever they like,
+% but they mustn't diddle with hyphen.tex (or plain.tex except to
+% preload additional fonts).
+% \end{quote}
+%
+% The files \file{bplain.tex} and \file{blplain.tex} can be used as
+% replacement wrappers around \file{plain.tex} and
+% \file{lplain.tex} to acheive the desired effect, based on the
+% \pkg{babel} package. If you load each of them with ini\TeX, you
+% will get a file called either \file{bplain.fmt} or
+% \file{blplain.fmt}, which you can use as replacements for
+% \file{plain.fmt} and \file{lplain.fmt}.
+%
+% As these files are going to be read as the first thing ini\TeX\
+% sees, we need to set some category codes just to be able to
+% change the definition of |\input|
+% \begin{macrocode}
+%<*bplain|blplain>
+\catcode`\{=1 % left brace is begin-group character
+\catcode`\}=2 % right brace is end-group character
+\catcode`\#=6 % hash mark is macro parameter character
+% \end{macrocode}
+% Now let's see if a file called \file{hyphen.cfg} can be found
+% somewhere on \TeX's input path by trying to open it for
+% reading...
+% \begin{macrocode}
+\openin 0 hyphen.cfg
+% \end{macrocode}
+% If the file wasn't found the following test turns out true.
+% \begin{macrocode}
+\ifeof0
+\else
+% \end{macrocode}
+% When \file{hyphen.cfg} could be opened we make sure that
+% \emph{it} will be read instead of the file \file{hyphen.tex}
+% which should (according to Don Knuth's ruling) contain the
+% american English hyphenation patterns and nothing else.
+%
+% We do this by first saving the original meaning of |\input| (and
+% I use a one letter control sequence for that so as not to waste
+% multi-letter control sequence on this in the format).
+% \begin{macrocode}
+ \let\a\input
+% \end{macrocode}
+% Then |\input| is defined to forget about its argument and load
+% \file{hyphen.cfg} instead.
+% \begin{macrocode}
+ \def\input #1 {%
+ \let\input\a
+ \a hyphen.cfg
+% \end{macrocode}
+% Once that's done the original meaning of |\input| can be restored
+% and the definition of |\a| can be forgotten.
+% \begin{macrocode}
+ \let\a\undefined
+ }
+\fi
+%</bplain|blplain>
+% \end{macrocode}
+% Now that we have made sure that \file{hyphen.cfg} will be loaded
+% at the right moment it is time to load \file{plain.tex}.
+% \begin{macrocode}
+%<bplain>\a plain.tex
+%<blplain>\a lplain.tex
+% \end{macrocode}
+% Finally we change the contents of |\fmtname| to indicate that
+% this is \emph{not} the plain format, but a format based on plain
+% with the \pkg{babel} package preloaded.
+% \begin{macrocode}
+%<bplain>\def\fmtname{babel-plain}
+%<blplain>\def\fmtname{babel-lplain}
+% \end{macrocode}
+%
+% When you are using a different format, based on plain.tex you can
+% make a copy of blplain.tex, rename it and replace \file{plain.tex}
+% with the name of your format file.
+%
+% \subsection{Emulating some \LaTeX{} features}
+%
+% The following code duplicates or emulates parts of \LaTeXe\ that
+% are needed for \babel.
+%
+% \changes{bbplain-1.0f}{1996/07/09}{Consistently use \cs{@undefined}
+% instead of \cs{undefined}}
+% \changes{bbplain-1.0f}{1996/07/09}{added \cs{@empty}}
+% \changes{bbplain-1.0h}{1996/10/07}{Only load the necessary parts
+% into the format, let this file be read agian by babel.def}
+% \changes{bbplain-1.0h}{2012/12/21}{Use \cs{orig@dump} as flag to
+% decide if we are building the format, defined in hyphen.cfg}
+%
+% We need to define |\loadlocalcfg| for plain users as the
+% \LaTeX\ definition uses |\InputIfFileExists|. We have to execute
+% \cs{@endofldf} in this case.
+% \changes{bbplain-1.0c}{1995/07/26}{Added definition of
+% \cs{loadlocalcfg}}
+% \changes{bbplain-1.0d}{1996/01/08}{Also reset category codes after
+% loading the configuration file as \cs{AtEndOfPackage} is
+% undefined in this case}
+% \changes{bbplain-1.0s}{2012/12/21}{\cs{loadlocalcfg} not loaded in
+% the format}
+% \begin{macrocode}
+%<*plain>
+\def\@empty{}
+\def\loadlocalcfg#1{%
+ \openin0#1.cfg
+ \ifeof0
+ \closein0
+ \else
+ \closein0
+ {\immediate\write16{*************************************}%
+ \immediate\write16{* Local config file #1.cfg used}%
+ \immediate\write16{*}%
+ }
+ \input #1.cfg\relax
+ \fi
+ \@endofldf}
+% \end{macrocode}
+%
+% A number of \LaTeX\ macro's that are needed later on.
+% \changes{bbplain-1.0n}{1998/06/10}{Added \cs{@secondoftwo}}
+% \changes{bbplain-1.0q}{1999/09/16}{Added \cs{@ifundefined}}
+% \changes{bbplain-1.0t}{2013/04/10}{Added \cs{@expandtwoargs}}
+% \begin{macrocode}
+\long\def\@firstofone#1{#1}
+\long\def\@firstoftwo#1#2{#1}
+\long\def\@secondoftwo#1#2{#2}
+\def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
+\def\@star@or@long#1{%
+ \@ifstar
+ {\let\l@ngrel@x\relax#1}%
+ {\let\l@ngrel@x\long#1}}
+\let\l@ngrel@x\relax
+\def\@car#1#2\@nil{#1}
+\def\@cdr#1#2\@nil{#2}
+\let\@typeset@protect\relax
+\long\def\@gobble#1{}
+\edef\@backslashchar{\expandafter\@gobble\string\\}
+\def\strip@prefix#1>{}
+\def\g@addto@macro#1#2{{%
+ \toks@\expandafter{#1#2}%
+ \xdef#1{\the\toks@}}}
+\def\@namedef#1{\expandafter\def\csname #1\endcsname}
+\def\@nameuse#1{\csname #1\endcsname}
+\def\@ifundefined#1{%
+ \expandafter\ifx\csname#1\endcsname\relax
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\def\@expandtwoargs#1#2#3{%
+ \edef\reserved@a{\noexpand#1{#2}{#3}}\reserved@a}
+% \end{macrocode}
+% \LaTeXe\ has the command |\@onlypreamble| which adds commands to
+% a list of commands that are no longer needed after
+% |\begin{document}|.
+% \begin{macrocode}
+\ifx\@preamblecmds\@undefined
+ \def\@preamblecmds{}
+\fi
+\def\@onlypreamble#1{%
+ \expandafter\gdef\expandafter\@preamblecmds\expandafter{%
+ \@preamblecmds\do#1}}
+\@onlypreamble\@onlypreamble
+% \end{macrocode}
+% Mimick \LaTeX's |\AtBeginDocument|; for this to work the user
+% needs to add |\begindocument| to his file.
+% \begin{macrocode}
+\def\begindocument{%
+ \@begindocumenthook
+ \global\let\@begindocumenthook\@undefined
+ \def\do##1{\global\let ##1\@undefined}%
+ \@preamblecmds
+ \global\let\do\noexpand
+ }
+% \end{macrocode}
+%
+% \changes{bbplain-1.0j}{1997/01/07}{\cs{@begindocumenthook} might
+% already be defined}
+% \changes{bbplain-1.0k}{1997/01/14}{missing \cs{@undefined} added}
+% \begin{macrocode}
+\ifx\@begindocumenthook\@undefined
+ \def\@begindocumenthook{}
+\fi
+\@onlypreamble\@begindocumenthook
+\def\AtBeginDocument{\g@addto@macro\@begindocumenthook}
+% \end{macrocode}
+% We also have to mimick \LaTeX's |\AtEndOfPackage|. Our
+% replacement macro is much simpler; it stores its argument in
+% |\@endofldf|.
+% \begin{macrocode}
+\def\AtEndOfPackage#1{\g@addto@macro\@endofldf{#1}}
+\@onlypreamble\AtEndOfPackage
+\def\@endofldf{}
+\@onlypreamble\@endofldf
+\let\bbl@afterlang\@empty
+% \end{macrocode}
+% \LaTeX\ needs to be able to switch off writing to its auxiliary
+% files; plain doesn't have them by default.
+% \changes{bbplain-1.0m}{1997/04/28}{Set \cs{if@filesw} to
+% \cs{iffalse} only for plain \TeX}
+% \changes{bbplain-1.0n}{1997/09/11}{Repaired typo and added missing
+% \cs{endcsname}}
+% \begin{macrocode}
+\ifx\if@filesw\@undefined
+ \expandafter\let\csname if@filesw\expandafter\endcsname
+ \csname iffalse\endcsname
+\fi
+% \end{macrocode}
+% Mimick \LaTeX's commands to define control sequences.
+% \changes{bbplain-1.0e}{1996/02/22}{Provide a more complete emulation
+% of \cs{DeclareRobustCommand} and \cs{newcommand}}
+% \begin{macrocode}
+\def\newcommand{\@star@or@long\new@command}
+\def\new@command#1{%
+ \@testopt{\@newcommand#1}0}
+\def\@newcommand#1[#2]{%
+ \@ifnextchar [{\@xargdef#1[#2]}%
+ {\@argdef#1[#2]}}
+\long\def\@argdef#1[#2]#3{%
+ \@yargdef#1\@ne{#2}{#3}}
+\long\def\@xargdef#1[#2][#3]#4{%
+ \expandafter\def\expandafter#1\expandafter{%
+ \expandafter\@protected@testopt\expandafter #1%
+ \csname\string#1\expandafter\endcsname{#3}}%
+ \expandafter\@yargdef \csname\string#1\endcsname
+ \tw@{#2}{#4}}
+\long\def\@yargdef#1#2#3{%
+ \@tempcnta#3\relax
+ \advance \@tempcnta \@ne
+ \let\@hash@\relax
+ \edef\reserved@a{\ifx#2\tw@ [\@hash@1]\fi}%
+ \@tempcntb #2%
+ \@whilenum\@tempcntb <\@tempcnta
+ \do{%
+ \edef\reserved@a{\reserved@a\@hash@\the\@tempcntb}%
+ \advance\@tempcntb \@ne}%
+ \let\@hash@##%
+ \l@ngrel@x\expandafter\def\expandafter#1\reserved@a}
+\let\providecommand\newcommand
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\DeclareRobustCommand{\@star@or@long\declare@robustcommand}
+\def\declare@robustcommand#1{%
+ \edef\reserved@a{\string#1}%
+ \def\reserved@b{#1}%
+ \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
+ \edef#1{%
+ \ifx\reserved@a\reserved@b
+ \noexpand\x@protect
+ \noexpand#1%
+ \fi
+ \noexpand\protect
+ \expandafter\noexpand\csname
+ \expandafter\@gobble\string#1 \endcsname
+ }%
+ \expandafter\new@command\csname
+ \expandafter\@gobble\string#1 \endcsname
+}
+\def\x@protect#1{%
+ \ifx\protect\@typeset@protect\else
+ \@x@protect#1%
+ \fi
+}
+\def\@x@protect#1\fi#2#3{%
+ \fi\protect#1%
+}
+% \end{macrocode}
+%
+% The following little macro |\in@| is taken from \file{latex.ltx};
+% it checks whether its first argument is part of its second
+% argument. It uses the boolean |\in@|; allocating a new boolean
+% inside conditionally executed code is not possible, hence the
+% construct with the temporary definition of |\bbl@tempa|.
+% \changes{bbplain-1.0o}{1998/07/02}{Added definition of \cs{in@}}
+% \changes{bbplain-1.0s}{2013/01/15}{Use \cs{bbl@tempa} as
+% documented}
+% \begin{macrocode}
+\def\bbl@tempa{\csname newif\endcsname\ifin@}
+\ifx\in@\@undefined
+ \def\in@#1#2{%
+ \def\in@@##1#1##2##3\in@@{%
+ \ifx\in@##2\in@false\else\in@true\fi}%
+ \in@@#2#1\in@\in@@}
+\else
+ \let\bbl@tempa\@empty
+\fi
+\bbl@tempa
+% \end{macrocode}
+%
+% \LaTeX\ has a macro to check whether a certain package was loaded
+% with specific options. The command has two extra arguments which
+% are code to be executed in either the true or false case.
+% This is used to detect whether the document needs one of the
+% accents to be activated (\Lopt{activegrave} and
+% \Lopt{activeacute}). For plain \TeX\ we assume that the user
+% wants them to be active by default. Therefore the only thing we
+% do is execute the third argument (the code for the true case).
+%
+% \begin{macrocode}
+\def\@ifpackagewith#1#2#3#4{#3}
+% \end{macrocode}
+% The \LaTeX\ macro |\@ifl@aded| checks whether a file was
+% loaded. This functionality is not needed for plain \TeX\ but we
+% need the macro to be defined as a no-op.
+% \changes{bbplain-1.0p}{1999/04/27}{Added \cs{@ifl@aded} as a no-op}
+% \begin{macrocode}
+\def\@ifl@aded#1#2#3#4{}
+% \end{macrocode}
+%
+% \changes{bbplain-1.0e}{1996/01/15}{Added the \cs{newcommand} code}
+% For the following code we need to make sure that the commands
+% |\newcommand| and |\providecommand| exist with some sensible
+% definition. They are not fully equivalent to their \LaTeXe\
+% versions; just enough to make things work in plain~\TeX
+% environments.
+%
+% \changes{bbplain-1.0k}{1997/01/14}{\cs{newcount} is an \cs{outer}
+% command, can't use it inside an \cs{if} construct}
+% \changes{bbplain-1.0l}{1997/01/19}{Mixed up the definition of
+% \cs{@tempcntb}}
+% \begin{macrocode}
+\ifx\@tempcnta\@undefined
+ \csname newcount\endcsname\@tempcnta\relax
+\fi
+\ifx\@tempcntb\@undefined
+ \csname newcount\endcsname\@tempcntb\relax
+\fi
+% \end{macrocode}
+% To prevent wasting two counters in \LaTeX$\:$2.09 (because
+% counters with the same name are allocated later by it) we reset
+% the counter that holds the next free counter (|\count10|).
+% \begin{macrocode}
+\ifx\bye\@undefined
+ \advance\count10 by -2\relax
+\fi
+\ifx\@ifnextchar\@undefined
+ \def\@ifnextchar#1#2#3{%
+ \let\reserved@d=#1%
+ \def\reserved@a{#2}\def\reserved@b{#3}%
+ \futurelet\@let@token\@ifnch}
+ \def\@ifnch{%
+ \ifx\@let@token\@sptoken
+ \let\reserved@c\@xifnch
+ \else
+ \ifx\@let@token\reserved@d
+ \let\reserved@c\reserved@a
+ \else
+ \let\reserved@c\reserved@b
+ \fi
+ \fi
+ \reserved@c}
+ \def\:{\let\@sptoken= } \: % this makes \@sptoken a space token
+ \def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch}
+\fi
+\def\@testopt#1#2{%
+ \@ifnextchar[{#1}{#1[#2]}}
+\def\@protected@testopt#1{%%
+ \ifx\protect\@typeset@protect
+ \expandafter\@testopt
+ \else
+ \@x@protect#1%
+ \fi}
+\long\def\@whilenum#1\do #2{\ifnum #1\relax #2\relax\@iwhilenum{#1\relax
+ #2\relax}\fi}
+\long\def\@iwhilenum#1{\ifnum #1\expandafter\@iwhilenum
+ \else\expandafter\@gobble\fi{#1}}
+% \end{macrocode}
+% Code from \file{ltoutenc.dtx}, adapted for use in the plain \TeX\
+% environment.
+% \begin{macrocode}
+\def\DeclareTextCommand{%
+ \@dec@text@cmd\providecommand
+}
+\def\ProvideTextCommand{%
+ \@dec@text@cmd\providecommand
+}
+\def\DeclareTextSymbol#1#2#3{%
+ \@dec@text@cmd\chardef#1{#2}#3\relax
+}
+\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
+}
+\def\@current@cmd#1{%
+ \ifx\protect\@typeset@protect\else
+ \noexpand#1\expandafter\@gobble
+ \fi
+}
+\def\@changed@cmd#1#2{%
+ \ifx\protect\@typeset@protect
+ \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
+ \expandafter\ifx\csname ?\string#1\endcsname\relax
+ \expandafter\def\csname ?\string#1\endcsname{%
+ \@changed@x@err{#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
+}
+\def\@changed@x@err#1{%
+ \errhelp{Your command will be ignored, type <return> to proceed}%
+ \errmessage{Command \protect#1 undefined in encoding \cf@encoding}}
+\def\DeclareTextCommandDefault#1{%
+ \DeclareTextCommand#1?%
+}
+\def\ProvideTextCommandDefault#1{%
+ \ProvideTextCommand#1?%
+}
+\expandafter\let\csname OT1-cmd\endcsname\@current@cmd
+\expandafter\let\csname?-cmd\endcsname\@changed@cmd
+\def\DeclareTextAccent#1#2#3{%
+ \DeclareTextCommand#1{#2}[1]{\accent#3 ##1}
+}
+\def\DeclareTextCompositeCommand#1#2#3#4{%
+ \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
+ \edef\reserved@b{\string##1}%
+ \edef\reserved@c{%
+ \expandafter\@strip@args\meaning\reserved@a:-\@strip@args}%
+ \ifx\reserved@b\reserved@c
+ \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\endcsname{#4}
+ \else
+ \errhelp{Your command will be ignored, type <return> to proceed}%
+ \errmessage{\string\DeclareTextCompositeCommand\space used on
+ inappropriate command \protect#1}
+ \fi
+}
+\def\@text@composite#1#2#3\@text@composite{%
+ \expandafter\@text@composite@x
+ \csname\string#1-\string#2\endcsname
+}
+\def\@text@composite@x#1#2{%
+ \ifx#1\relax
+ #2%
+ \else
+ #1%
+ \fi
+}
+%
+\def\@strip@args#1:#2-#3\@strip@args{#2}
+\def\DeclareTextComposite#1#2#3#4{%
+ \def\reserved@a{\DeclareTextCompositeCommand#1{#2}{#3}}%
+ \bgroup
+ \lccode`\@=#4%
+ \lowercase{%
+ \egroup
+ \reserved@a @%
+ }%
+}
+%
+\def\UseTextSymbol#1#2{%
+% \let\@curr@enc\cf@encoding
+% \@use@text@encoding{#1}%
+ #2%
+% \@use@text@encoding\@curr@enc
+}
+\def\UseTextAccent#1#2#3{%
+% \let\@curr@enc\cf@encoding
+% \@use@text@encoding{#1}%
+% #2{\@use@text@encoding\@curr@enc\selectfont#3}%
+% \@use@text@encoding\@curr@enc
+}
+\def\@use@text@encoding#1{%
+% \edef\f@encoding{#1}%
+% \xdef\font@name{%
+% \csname\curr@fontshape/\f@size\endcsname
+% }%
+% \pickup@font
+% \font@name
+% \@@enc@update
+}
+\def\DeclareTextSymbolDefault#1#2{%
+ \DeclareTextCommandDefault#1{\UseTextSymbol{#2}#1}%
+}
+\def\DeclareTextAccentDefault#1#2{%
+ \DeclareTextCommandDefault#1{\UseTextAccent{#2}#1}%
+}
+\def\cf@encoding{OT1}
+% \end{macrocode}
+% Currently we only use the \LaTeXe\ method for accents for those
+% that are known to be made active in \emph{some} language
+% definition file.
+% \begin{macrocode}
+\DeclareTextAccent{\"}{OT1}{127}
+\DeclareTextAccent{\'}{OT1}{19}
+\DeclareTextAccent{\^}{OT1}{94}
+\DeclareTextAccent{\`}{OT1}{18}
+\DeclareTextAccent{\~}{OT1}{126}
+% \end{macrocode}
+% The following control sequences are used in \file{babel.def}
+% but are not defined for \textsc{plain} \TeX.
+% \changes{bbplain-1.0f}{1996/07/10}{Added \cs{textquotedblright} and
+% \cs{textquoteright}}
+% \changes{bbplain-1.0g}{1996/08/15}{Added \cs{ss} and \cs{i}}
+% \changes{bbplain-1.0r}{2000/10/02}{Added \cs{textquotedblleft} and
+% \cs{textquoteleft}}
+% \begin{macrocode}
+\DeclareTextSymbol{\textquotedblleft}{OT1}{92}
+\DeclareTextSymbol{\textquotedblright}{OT1}{`\"}
+\DeclareTextSymbol{\textquoteleft}{OT1}{`\`}
+\DeclareTextSymbol{\textquoteright}{OT1}{`\'}
+\DeclareTextSymbol{\i}{OT1}{16}
+\DeclareTextSymbol{\ss}{OT1}{25}
+% \end{macrocode}
+% For a couple of languages we need the \LaTeX-control sequence
+% |\scriptsize| to be available. Because plain \TeX\ doesn't have
+% such a sofisticated font mechanism as \LaTeX\ has, we just |\let|
+% it to |\sevenrm|.
+% \changes{bbplain-1.0f}{1996/07/10}{Added definition of
+% \cs{scriptsize}}
+% \begin{macrocode}
+\ifx\scriptsize\@undefined
+ \let\scriptsize\sevenrm
+\fi
+%</plain>
+% \end{macrocode}
+%
% \Finale
%
%%
diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins
index 1ddc7d9f07f..539ffba53e9 100644
--- a/Master/texmf-dist/source/latex/babel/babel.ins
+++ b/Master/texmf-dist/source/latex/babel/babel.ins
@@ -42,7 +42,7 @@
%%
%% You are not allowed to modify its contents.
%%
-\def\filedate{2013/04/10}
+\def\filedate{2013/10/10}
\def\batchfile{babel.ins}
\input docstrip.tex
@@ -61,6 +61,51 @@
\csname @@end\endcsname
\fi}
+% Modify docstrip. A pseudo-guard is defined to set variables:
+% <<name=value>>. These variables are used with <@name@>
+% Two further pseudo-guards define "block" variables: <<*name>> and
+% <</name>> delimite the lines to be retrived with <@name@>. Note
+% the verbatim guard is overriden, which it's not used here.
+
+\def\replaceVar#1<@#2{%
+ #1%
+ \ifx\endLine#2\else
+ \expandafter\replaceVarX\expandafter#2%
+ \fi}
+
+\def\replaceVarX#1@>{\csname #1Var\endcsname\replaceVar}
+
+\def\normalLine#1\endLine{%
+ \advance\codeLinesPassed\@ne
+ \maybeMsg{.}%
+ \edef\inLine{\replaceVar#1<@\endLine}%
+ \let\do\putline@do
+ \ifcollect
+ \xdef\varCollect{\varCollect^^J\inLine}%
+ \else
+ \activefiles
+ \fi}
+
+\newif\ifcollect
+
+\def\verbOption<#1#2>>#3{%
+ \ifx#1*%
+ \maybeMsg{<<*#2>>}%
+ \global\collecttrue
+ \gdef\varCollect##1{}%
+ \else\ifx#1/%
+ \global\collectfalse
+ \global\expandafter\let\csname #2Var\endcsname\varCollect
+ \else
+ \varOptionI#1#2>%
+ \fi\fi}
+
+\def\varOptionI#1=#2>{%
+ \maybeMsg{<<#1=#2>>}%
+ \expandafter\gdef\csname #1Var\endcsname{#2}}
+
+% Preambles
+
\declarepreamble\mainpreamble
This is a generated file.
@@ -96,44 +141,6 @@ and covered by LPPL is defined by the unpacking scripts (with
extension .ins) which are part of the distribution.
\endpreamble
-\declarepreamble\fdpreamble
-This is a generated file.
-
-Copyright 2012-2013 Javier Bezos and Johannes L. Braams.
-Copyright 1989-2008 Johannes L. Braams and any individual authors
-listed elsewhere in this file. All rights reserved.
-
-This file was generated from file(s) of the Babel system.
----------------------------------------------------------
-
-It may be distributed and/or modified under the
-conditions of the LaTeX Project Public License, either version 1.3
-of this license or (at your option) any later version.
-The latest version of this license is in
- http://www.latex-project.org/lppl.txt
-and version 1.3 or later is part of all distributions of LaTeX
-version 2003/12/01 or later.
-
-This work has the LPPL maintenance status "maintained".
-
-The Current Maintainer of this work is Javier Bezos.
-
-This file may only be distributed together with a copy of the Babel
-system. You may however distribute the Babel system without
-such generated files.
-
-The list of all files belonging to the Babel distribution is
-given in the file `manifest.bbl'. See also `legal.bbl for additional
-information.
-
-In particular, permission is granted to customize the declarations in
-this file to serve the needs of your installation.
-
-However, NO PERMISSION is granted to distribute a modified version
-of this file under its original name.
-
-\endpreamble
-
\declarepreamble\drvpreamble
This file was generated from file(s) of the Babel system.
@@ -169,6 +176,8 @@ This file is a style file for the MakeIndex program
\askforoverwritefalse
+\tracingmacros2
+
\generate{\file{babel.sty}{\from{babel.dtx}{package}}
\file{babel.def}{\from{babel.dtx}{core}}
\file{switch.def}{\from{babel.dtx}{kernel}}
@@ -176,9 +185,9 @@ This file is a style file for the MakeIndex program
\file{nil.ldf}{\from{babel.dtx}{nil}}
}
% Support for plain users
-\generate{\file{plain.def}{\from{bbplain.dtx}{code}}
- \file{bplain.tex}{\from{bbplain.dtx}{bplain}}
- \file{blplain.tex}{\from{bbplain.dtx}{blplain}}
+\generate{\file{plain.def}{\from{babel.dtx}{plain}}
+ \file{bplain.tex}{\from{babel.dtx}{bplain}}
+ \file{blplain.tex}{\from{babel.dtx}{blplain}}
}
% Support for Unicode-based engines
\generate{\file{xebabel.def}{\from{bbunicode.dtx}{xetex}}
diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx
index bf9c637eaeb..342e394e91e 100644
--- a/Master/texmf-dist/source/latex/babel/bbcompat.dtx
+++ b/Master/texmf-dist/source/latex/babel/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2008/07/06 v1.2k]
+\ProvidesFile{bbcompat.dtx}[2013/07/28 v1.2l]
%</dtx>
%
%% File 'bbcompat.dtx'
@@ -95,11 +95,14 @@
% \end{macrocode}
% Now we define an error message which `deletes' itself from
% memory.
+% \changes{bbcompat-1.2l}{2013/07/28}{Raise a more useful error.}
+%
% \begin{macrocode}
\def\bblstyerror{%
\PackageError{babel}%
- {You have used an old interface to call babel\MessageBreak
- You may expect compatibility problems wit other packages}%
+ {You are loading directly a language style.\MessageBreak
+ This syntax is deprecated and you must use\MessageBreak
+ \string\usepackage[language]\string{babel\string}}%
{You could proceed but don't complain if you run into errors}%
\let\bblstyerror\@undefined
}
diff --git a/Master/texmf-dist/source/latex/babel/bbplain.dtx b/Master/texmf-dist/source/latex/babel/bbplain.dtx
deleted file mode 100644
index b454b897fd6..00000000000
--- a/Master/texmf-dist/source/latex/babel/bbplain.dtx
+++ /dev/null
@@ -1,728 +0,0 @@
-% \iffalse meta-comment
-%
-% Copyright 2012-2013 Javier Bezos and Johannes L. Braams.
-% Copyright 1989-2008 Johannes L. Braams and any individual authors
-% listed elsewhere in this file. All rights reserved.
-%
-% This file is part of the Babel system.
-% --------------------------------------
-%
-% It may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either version 1.3
-% of this license or (at your option) any later version.
-% The latest version of this license is in
-% http://www.latex-project.org/lppl.txt
-% and version 1.3 or later is part of all distributions of LaTeX
-% version 2003/12/01 or later.
-%
-% This work has the LPPL maintenance status "maintained".
-%
-% The Current Maintainer of this work is Javier Bezos.
-%
-% The list of all files belonging to the Babel system is
-% given in the file `manifest.bbl. See also `legal.bbl' 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
-% \CheckSum{795}
-%
-% \iffalse
-%<*dtx>
-\ProvidesFile{bbplain.dtx}
- [2013/04/10 v1.0t Babel support for plain-based formats]
-%</dtx>
-%
-%% File `bbplain.dtx'
-%% Babel package for LaTeX version 2e
-%% Copyright (C) 1989 - 2008
-%% by Johannes Braams
-%% Copyright (C) 2013 by Johannes Braams
-%% TeXniek
-%% by Javier Bezos
-%% all rights reserved.
-%
-%
-% This file is part of the babel system, it provides the source
-% code for the extra definitions needed to be able to use babel
-% with a plain-based format.
-%<*filedriver>
-\documentclass{ltxdoc}
-\font\manual=logo10 % font used for the METAFONT logo, etc.
-\newcommand*\MF{{\manual META}\-{\manual FONT}}
-\newcommand*{\babel}{\textsf{babel}}
-\newcommand*{\langvar}{$\langle \it lang \rangle$}
-\newcommand*{\note}[1]{}
-\newcommand*{\pkg}[1]{\textsf{#1}}
-\newcommand*{\Lopt}[1]{\textsf{#1}}
-\newcommand*{\file}[1]{\texttt{#1}}
-\begin{document}
- \DocInput{bbplain.dtx}
-\end{document}
-%</filedriver>
-% \fi
-%
-% \GetFileInfo{bbplain.dtx}
-% \StopEventually{}
-% \changes{bbplain-1.0n}{1998/06/08}{Added the source for the format
-% wrapper files}
-%
-% \section{Support for Plain \TeX}
-%
-% \subsection{Not renaming \file{hyphen.tex}}
-% As Don Knuth has declared that the filename \file{hyphen.tex} may
-% only be used to designate \emph{his} version of the american
-% English hyphenation patterns, a new solution has to be found in
-% order to be able to load hyphenation patterns for other languages
-% in a plain-based \TeX-format.
-% When asked he responded:
-% \begin{quote}
-% That file name is "sacred", and if anybody changes it they will
-% cause severe upward/downward compatibility headaches.
-%
-% People can have a file localhyphen.tex or whatever they like,
-% but they mustn't diddle with hyphen.tex (or plain.tex except to
-% preload additional fonts).
-% \end{quote}
-%
-% The files \file{bplain.tex} and \file{blplain.tex} can be used as
-% replacement wrappers around \file{plain.tex} and
-% \file{lplain.tex} to acheive the desired effect, based on the
-% \pkg{babel} package. If you load each of them with ini\TeX, you
-% will get a file called either \file{bplain.fmt} or
-% \file{blplain.fmt}, which you can use as replacements for
-% \file{plain.fmt} and \file{lplain.fmt}.
-%
-% As these files are going to be read as the first thing ini\TeX\
-% sees, we need to set some category codes just to be able to
-% change the definition of |\input|
-% \begin{macrocode}
-%<*bplain|blplain>
-\catcode`\{=1 % left brace is begin-group character
-\catcode`\}=2 % right brace is end-group character
-\catcode`\#=6 % hash mark is macro parameter character
-% \end{macrocode}
-% Now let's see if a file called \file{hyphen.cfg} can be found
-% somewhere on \TeX's input path by trying to open it for
-% reading...
-% \begin{macrocode}
-\openin 0 hyphen.cfg
-% \end{macrocode}
-% If the file wasn't found the following test turns out true.
-% \begin{macrocode}
-\ifeof0
-\else
-% \end{macrocode}
-% When \file{hyphen.cfg} could be opened we make sure that
-% \emph{it} will be read instead of the file \file{hyphen.tex}
-% which should (according to Don Knuth's ruling) contain the
-% american English hyphenation patterns and nothing else.
-%
-% We do this by first saving the original meaning of |\input| (and
-% I use a one letter control sequence for that so as not to waste
-% multi-letter control sequence on this in the format).
-% \begin{macrocode}
- \let\a\input
-% \end{macrocode}
-% Then |\input| is defined to forget about its argument and load
-% \file{hyphen.cfg} instead.
-% \begin{macrocode}
- \def\input #1 {%
- \let\input\a
- \a hyphen.cfg
-% \end{macrocode}
-% Once that's done the original meaning of |\input| can be restored
-% and the definition of |\a| can be forgotten.
-% \begin{macrocode}
- \let\a\undefined
- }
-\fi
-%</bplain|blplain>
-% \end{macrocode}
-% Now that we have made sure that \file{hyphen.cfg} will be loaded
-% at the right moment it is time to load \file{plain.tex}.
-% \begin{macrocode}
-%<bplain>\a plain.tex
-%<blplain>\a lplain.tex
-% \end{macrocode}
-% Finally we change the contents of |\fmtname| to indicate that
-% this is \emph{not} the plain format, but a format based on plain
-% with the \pkg{babel} package preloaded.
-% \begin{macrocode}
-%<bplain>\def\fmtname{babel-plain}
-%<blplain>\def\fmtname{babel-lplain}
-% \end{macrocode}
-%
-% When you are using a different format, based on plain.tex you can
-% make a copy of blplain.tex, rename it and replace \file{plain.tex}
-% with the name of your format file.
-%
-% \subsection{Emulating some \LaTeX{} features}
-%
-% The following code duplicates or emulates parts of \LaTeXe\ that
-% are needed for \babel.
-%
-% \changes{bbplain-1.0f}{1996/07/09}{Consistently use \cs{@undefined}
-% instead of \cs{undefined}}
-% \changes{bbplain-1.0f}{1996/07/09}{added \cs{@empty}}
-% \changes{bbplain-1.0h}{1996/10/07}{Only load the necessary parts
-% into the format, let this file be read agian by babel.def}
-% \changes{bbplain-1.0h}{2012/12/21}{Use \cs{orig@dump} as flag to
-% decide if we are building the format, defined in hyphen.cfg}
-%
-% When |\adddialect| is still undefined we are making a
-% format. In that case only the first part of this file is needed.
-% \begin{macrocode}
-%<*code>
-\def\@empty{}
-\ifx\orig@dump\@undefined\else
-% \end{macrocode}
-%
-% \changes{bbplain-1.0c}{1995/11/08}{Moved the \cs{dump} code here from
-% \file{babel.dtx}}
-% \changes{bbplain-0.1}{1991/10/31}{Added redefinition of \cs{dump} to
-% add a message to \cs{everyjob}}
-% We want to add a message to the message \LaTeX$\:$2.09 puts in
-% the |\everyjob| register. This could be done by the following
-% code:
-% \begin{verbatim}
-% \let\orgeveryjob\everyjob
-% \def\everyjob#1{%
-% \orgeveryjob{#1}%
-% \orgeveryjob\expandafter{\the\orgeveryjob\immediate\write16{%
-% hyphenation patterns for \the\loaded@patterns loaded.}}%
-% \let\everyjob\orgeveryjob\let\orgeveryjob\@undefined}
-% \end{verbatim}
-% The code above redefines the control sequence \cs{everyjob}
-% in order to be able to add something to the current contents of
-% the register. This is necessary because the processing of
-% hyphenation patterns happens long before \LaTeX\ fills the
-% register.
-%
-% There are some problems with this approach though.
-% \begin{itemize}
-% \item When someone wants to use several hyphenation patterns with
-% \SliTeX\ the above scheme won't work. The reason is that \SliTeX\
-% overwrites the contents of the |\everyjob| register with its own
-% message.
-% \item Plain \TeX\ does not use the |\everyjob| register so the
-% message would not be displayed.
-% \end{itemize}
-% To circumvent this a `dirty trick' can be used. As this code is
-% only processed when creating a new format file there is one
-% command that is sure to be used, |\dump|. Therefore the original
-% |\dump| is saved in |\org@dump| and a new definition is supplied.
-%
-% To make sure that \LaTeX$\:$2.09 executes the
-% |\@begindocumenthook| we would want to alter |\begin{document}|,
-% but as this done too often already, we add the new code at the
-% front of |\@preamblecmds|. But we can only do that after it has
-% been defined, so we add this piece of code to |\dump|.
-% \changes{bbplain-1.0c}{1995/11/19}{Add execution of
-% \cs{@begindocumenthook} to \cs{@preamblecmds}}
-% \changes{bbplain-1.0i}{1997/01/02}{\cs{document} is not a
-% \LaTeX2.09-only command; AMS\TeX defines it too; now use
-% \cs{@ztryfc} to detect \LaTeX2.09}
-% \changes{bbplain-1.0j}{1997/01/07}{Add the definition of
-% \cs{@begindocumenthook} to the \LaTeX2.09 format}
-% \begin{macrocode}
- \def\dump{%
- \ifx\@ztryfc\@undefined
- \else
- \toks0=\expandafter{\@preamblecmds}
- \edef\@preamblecmds{\noexpand\@begindocumenthook\the\toks0}
- \def\@begindocumenthook{}
- \fi
-% \end{macrocode}
-% This new definition starts by adding an instruction to write a
-% message on the terminal and in the transcript file to inform the
-% user of the preloaded hyphenation patterns.
-% \changes{bbplain-1.0f}{1996/07/09}{Use \cs{toks8} instead of
-% \cs{patterns@loaded}}
-% \begin{macrocode}
- \everyjob\expandafter{\the\everyjob%
- \immediate\write16{\the\toks8 loaded.}}%
-% \end{macrocode}
-% Then everything is restored to the old situation and the format
-% is dumped.
-% \begin{macrocode}
- \let\dump\orig@dump\let\orig@dump\@undefined\dump}
- \expandafter\endinput
-\fi
-% \end{macrocode}
-% The rest of this file is not processed by ini\TeX\ but during the
-% normal document run.
-%
-% We need to define |\loadlocalcfg| for plain users as the
-% \LaTeX\ definition uses |\InputIfFileExists|. We have to execute
-% \cs{@endofldf} in this case.
-% \changes{bbplain-1.0c}{1995/07/26}{Added definition of
-% \cs{loadlocalcfg}}
-% \changes{bbplain-1.0d}{1996/01/08}{Also reset category codes after
-% loading the configuration file as \cs{AtEndOfPackage} is
-% undefined in this case}
-% \changes{bbplain-1.0s}{2012/12/21}{\cs{loadlocalcfg} not loaded in
-% the format}
-% \begin{macrocode}
-\def\loadlocalcfg#1{%
- \openin0#1.cfg
- \ifeof0
- \closein0
- \else
- \closein0
- {\immediate\write16{*************************************}%
- \immediate\write16{* Local config file #1.cfg used}%
- \immediate\write16{*}%
- }
- \input #1.cfg\relax
- \fi
- \@endofldf}
-% \end{macrocode}
-%
-% A number of \LaTeX\ macro's that are needed later on.
-% \changes{bbplain-1.0n}{1998/06/10}{Added \cs{@secondoftwo}}
-% \changes{bbplain-1.0q}{1999/09/16}{Added \cs{@ifundefined}}
-% \changes{bbplain-1.0t}{2013/04/10}{Added \cs{@expandtwoargs}}
-% \begin{macrocode}
-\long\def\@firstofone#1{#1}
-\long\def\@firstoftwo#1#2{#1}
-\long\def\@secondoftwo#1#2{#2}
-\def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
-\def\@star@or@long#1{%
- \@ifstar
- {\let\l@ngrel@x\relax#1}%
- {\let\l@ngrel@x\long#1}}
-\let\l@ngrel@x\relax
-\def\@car#1#2\@nil{#1}
-\def\@cdr#1#2\@nil{#2}
-\let\@typeset@protect\relax
-\long\def\@gobble#1{}
-\edef\@backslashchar{\expandafter\@gobble\string\\}
-\def\strip@prefix#1>{}
-\def\g@addto@macro#1#2{{%
- \toks@\expandafter{#1#2}%
- \xdef#1{\the\toks@}}}
-\def\@namedef#1{\expandafter\def\csname #1\endcsname}
-\def\@nameuse#1{\csname #1\endcsname}
-\def\@ifundefined#1{%
- \expandafter\ifx\csname#1\endcsname\relax
- \expandafter\@firstoftwo
- \else
- \expandafter\@secondoftwo
- \fi}
-\def\@expandtwoargs#1#2#3{%
- \edef\reserved@a{\noexpand#1{#2}{#3}}\reserved@a}
-% \end{macrocode}
-% \LaTeXe\ has the command |\@onlypreamble| which adds commands to
-% a list of commands that are no longer needed after
-% |\begin{document}|.
-% \begin{macrocode}
-\ifx\@preamblecmds\@undefined
- \def\@preamblecmds{}
-\fi
-\def\@onlypreamble#1{%
- \expandafter\gdef\expandafter\@preamblecmds\expandafter{%
- \@preamblecmds\do#1}}
-\@onlypreamble\@onlypreamble
-% \end{macrocode}
-% Mimick \LaTeX's |\AtBeginDocument|; for this to work the user
-% needs to add |\begindocument| to his file.
-% \begin{macrocode}
-\def\begindocument{%
- \@begindocumenthook
- \global\let\@begindocumenthook\@undefined
- \def\do##1{\global\let ##1\@undefined}%
- \@preamblecmds
- \global\let\do\noexpand
- }
-% \end{macrocode}
-%
-% \changes{bbplain-1.0j}{1997/01/07}{\cs{@begindocumenthook} might
-% already be defined}
-% \changes{bbplain-1.0k}{1997/01/14}{missing \cs{@undefined} added}
-% \begin{macrocode}
-\ifx\@begindocumenthook\@undefined
- \def\@begindocumenthook{}
-\fi
-\@onlypreamble\@begindocumenthook
-\def\AtBeginDocument{\g@addto@macro\@begindocumenthook}
-% \end{macrocode}
-% We also have to mimick \LaTeX's |\AtEndOfPackage|. Our
-% replacement macro is much simpler; it stores its argument in
-% |\@endofldf|.
-% \begin{macrocode}
-\def\AtEndOfPackage#1{\g@addto@macro\@endofldf{#1}}
-\@onlypreamble\AtEndOfPackage
-\def\@endofldf{}
-\@onlypreamble\@endofldf
-\let\bbl@afterlang\@empty
-% \end{macrocode}
-% \LaTeX\ needs to be able to switch off writing to its auxiliary
-% files; plain doesn't have them by default.
-% \changes{bbplain-1.0m}{1997/04/28}{Set \cs{if@filesw} to
-% \cs{iffalse} only for plain \TeX}
-% \changes{bbplain-1.0n}{1997/09/11}{Repaired typo and added missing
-% \cs{endcsname}}
-% \begin{macrocode}
-\ifx\if@filesw\@undefined
- \expandafter\let\csname if@filesw\expandafter\endcsname
- \csname iffalse\endcsname
-\fi
-% \end{macrocode}
-% Mimick \LaTeX's commands to define control sequences.
-% \changes{bbplain-1.0e}{1996/02/22}{Provide a more complete emulation
-% of \cs{DeclareRobustCommand} and \cs{newcommand}}
-% \begin{macrocode}
-\def\newcommand{\@star@or@long\new@command}
-\def\new@command#1{%
- \@testopt{\@newcommand#1}0}
-\def\@newcommand#1[#2]{%
- \@ifnextchar [{\@xargdef#1[#2]}%
- {\@argdef#1[#2]}}
-\long\def\@argdef#1[#2]#3{%
- \@yargdef#1\@ne{#2}{#3}}
-\long\def\@xargdef#1[#2][#3]#4{%
- \expandafter\def\expandafter#1\expandafter{%
- \expandafter\@protected@testopt\expandafter #1%
- \csname\string#1\expandafter\endcsname{#3}}%
- \expandafter\@yargdef \csname\string#1\endcsname
- \tw@{#2}{#4}}
-\long\def\@yargdef#1#2#3{%
- \@tempcnta#3\relax
- \advance \@tempcnta \@ne
- \let\@hash@\relax
- \edef\reserved@a{\ifx#2\tw@ [\@hash@1]\fi}%
- \@tempcntb #2%
- \@whilenum\@tempcntb <\@tempcnta
- \do{%
- \edef\reserved@a{\reserved@a\@hash@\the\@tempcntb}%
- \advance\@tempcntb \@ne}%
- \let\@hash@##%
- \l@ngrel@x\expandafter\def\expandafter#1\reserved@a}
-\let\providecommand\newcommand
-% \end{macrocode}
-%
-% \begin{macrocode}
-\def\DeclareRobustCommand{\@star@or@long\declare@robustcommand}
-\def\declare@robustcommand#1{%
- \edef\reserved@a{\string#1}%
- \def\reserved@b{#1}%
- \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
- \edef#1{%
- \ifx\reserved@a\reserved@b
- \noexpand\x@protect
- \noexpand#1%
- \fi
- \noexpand\protect
- \expandafter\noexpand\csname
- \expandafter\@gobble\string#1 \endcsname
- }%
- \expandafter\new@command\csname
- \expandafter\@gobble\string#1 \endcsname
-}
-\def\x@protect#1{%
- \ifx\protect\@typeset@protect\else
- \@x@protect#1%
- \fi
-}
-\def\@x@protect#1\fi#2#3{%
- \fi\protect#1%
-}
-% \end{macrocode}
-%
-% The following little macro |\in@| is taken from latex.ltx; it
-% checks whether its first argument is part of its second
-% argument. It uses the boolean |\in@|; allocating a new boolean
-% inside conditionally executed code is not possible, hence the
-% construct with the temporary definition of |\bbl@tempa|.
-% \changes{bbplain-1.0o}{1998/07/02}{Added definition of \cs{in@}}
-% \changes{bbplain-1.0s}{2013/01/15}{Use \cs{bbl@tempa} as documented}
-% \begin{macrocode}
-\def\bbl@tempa{\csname newif\endcsname\ifin@}
-\ifx\in@\@undefined
- \def\in@#1#2{%
- \def\in@@##1#1##2##3\in@@{%
- \ifx\in@##2\in@false\else\in@true\fi}%
- \in@@#2#1\in@\in@@}
-\else
- \let\bbl@tempa\@empty
-\fi
-\bbl@tempa
-% \end{macrocode}
-%
-% \LaTeX\ has a macro to check whether a certain package was loaded
-% with specific options. The command has two extra arguments which
-% are code to be executed in either the true or false case.
-% This is used to detect whether the document needs one of the
-% accents to be activated (\Lopt{activegrave} and
-% \Lopt{activeacute}). For plain \TeX\ we assume that the user
-% wants them to be active by default. Therefore the only thing we
-% do is execute the third argument (the code for the true case).
-%
-% \begin{macrocode}
-\def\@ifpackagewith#1#2#3#4{%
- #3}
-% \end{macrocode}
-% The \LaTeX\ macro |\@ifl@aded| checks whether a file was
-% loaded. This functionality is not needed for plain \TeX\ but we
-% need the macro to be defined as a no-op.
-% \changes{bbplain-1.0p}{1999/04/27}{Added \cs{@ifl@aded} as a no-op}
-% \begin{macrocode}
-\def\@ifl@aded#1#2#3#4{}
-% \end{macrocode}
-%
-% \changes{bbplain-1.0e}{1996/01/15}{Added the \cs{newcommand} code}
-% For the following code we need to make sure that the commands
-% |\newcommand| and |\providecommand| exist with some sensible
-% definition. They are not fully equivalent to their \LaTeXe\
-% versions; just enough to make things work in plain~\TeX
-% environments.
-%
-% \changes{bbplain-1.0k}{1997/01/14}{\cs{newcount} is an \cs{outer}
-% command, can't use it inside an \cs{if} construct}
-% \changes{bbplain-1.0l}{1997/01/19}{Mixed up the definition of
-% \cs{@tempcntb}}
-% \begin{macrocode}
-\ifx\@tempcnta\@undefined
- \csname newcount\endcsname\@tempcnta\relax
-\fi
-\ifx\@tempcntb\@undefined
- \csname newcount\endcsname\@tempcntb\relax
-\fi
-% \end{macrocode}
-% To prevent wasting two counters in \LaTeX$\:$2.09 (because
-% counters with the same name are allocated later by it) we reset
-% the counter that holds the next free counter (|\count10|).
-% \begin{macrocode}
-\ifx\bye\@undefined
- \advance\count10 by -2\relax
-\fi
-\ifx\@ifnextchar\@undefined
- \def\@ifnextchar#1#2#3{%
- \let\reserved@d=#1%
- \def\reserved@a{#2}\def\reserved@b{#3}%
- \futurelet\@let@token\@ifnch}
- \def\@ifnch{%
- \ifx\@let@token\@sptoken
- \let\reserved@c\@xifnch
- \else
- \ifx\@let@token\reserved@d
- \let\reserved@c\reserved@a
- \else
- \let\reserved@c\reserved@b
- \fi
- \fi
- \reserved@c}
- \def\:{\let\@sptoken= } \: % this makes \@sptoken a space token
- \def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch}
-\fi
-\def\@testopt#1#2{%
- \@ifnextchar[{#1}{#1[#2]}}
-\def\@protected@testopt#1{%%
- \ifx\protect\@typeset@protect
- \expandafter\@testopt
- \else
- \@x@protect#1%
- \fi}
-\long\def\@whilenum#1\do #2{\ifnum #1\relax #2\relax\@iwhilenum{#1\relax
- #2\relax}\fi}
-\long\def\@iwhilenum#1{\ifnum #1\expandafter\@iwhilenum
- \else\expandafter\@gobble\fi{#1}}
-% \end{macrocode}
-% Code from \file{ltoutenc.dtx}, adapted for use in the plain \TeX\
-% environment.
-% \begin{macrocode}
-\def\DeclareTextCommand{%
- \@dec@text@cmd\providecommand
-}
-\def\ProvideTextCommand{%
- \@dec@text@cmd\providecommand
-}
-\def\DeclareTextSymbol#1#2#3{%
- \@dec@text@cmd\chardef#1{#2}#3\relax
-}
-\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
-}
-\def\@current@cmd#1{%
- \ifx\protect\@typeset@protect\else
- \noexpand#1\expandafter\@gobble
- \fi
-}
-\def\@changed@cmd#1#2{%
- \ifx\protect\@typeset@protect
- \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
- \expandafter\ifx\csname ?\string#1\endcsname\relax
- \expandafter\def\csname ?\string#1\endcsname{%
- \@changed@x@err{#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
-}
-\def\@changed@x@err#1{%
- \errhelp{Your command will be ignored, type <return> to proceed}%
- \errmessage{Command \protect#1 undefined in encoding \cf@encoding}}
-\def\DeclareTextCommandDefault#1{%
- \DeclareTextCommand#1?%
-}
-\def\ProvideTextCommandDefault#1{%
- \ProvideTextCommand#1?%
-}
-\expandafter\let\csname OT1-cmd\endcsname\@current@cmd
-\expandafter\let\csname?-cmd\endcsname\@changed@cmd
-\def\DeclareTextAccent#1#2#3{%
- \DeclareTextCommand#1{#2}[1]{\accent#3 ##1}
-}
-\def\DeclareTextCompositeCommand#1#2#3#4{%
- \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
- \edef\reserved@b{\string##1}%
- \edef\reserved@c{%
- \expandafter\@strip@args\meaning\reserved@a:-\@strip@args}%
- \ifx\reserved@b\reserved@c
- \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\endcsname{#4}
- \else
- \errhelp{Your command will be ignored, type <return> to proceed}%
- \errmessage{\string\DeclareTextCompositeCommand\space used on
- inappropriate command \protect#1}
- \fi
-}
-\def\@text@composite#1#2#3\@text@composite{%
- \expandafter\@text@composite@x
- \csname\string#1-\string#2\endcsname
-}
-\def\@text@composite@x#1#2{%
- \ifx#1\relax
- #2%
- \else
- #1%
- \fi
-}
-%
-\def\@strip@args#1:#2-#3\@strip@args{#2}
-\def\DeclareTextComposite#1#2#3#4{%
- \def\reserved@a{\DeclareTextCompositeCommand#1{#2}{#3}}%
- \bgroup
- \lccode`\@=#4%
- \lowercase{%
- \egroup
- \reserved@a @%
- }%
-}
-%
-\def\UseTextSymbol#1#2{%
-% \let\@curr@enc\cf@encoding
-% \@use@text@encoding{#1}%
- #2%
-% \@use@text@encoding\@curr@enc
-}
-\def\UseTextAccent#1#2#3{%
-% \let\@curr@enc\cf@encoding
-% \@use@text@encoding{#1}%
-% #2{\@use@text@encoding\@curr@enc\selectfont#3}%
-% \@use@text@encoding\@curr@enc
-}
-\def\@use@text@encoding#1{%
-% \edef\f@encoding{#1}%
-% \xdef\font@name{%
-% \csname\curr@fontshape/\f@size\endcsname
-% }%
-% \pickup@font
-% \font@name
-% \@@enc@update
-}
-\def\DeclareTextSymbolDefault#1#2{%
- \DeclareTextCommandDefault#1{\UseTextSymbol{#2}#1}%
-}
-\def\DeclareTextAccentDefault#1#2{%
- \DeclareTextCommandDefault#1{\UseTextAccent{#2}#1}%
-}
-\def\cf@encoding{OT1}
-% \end{macrocode}
-% Currently we only use the \LaTeXe\ method for accents for those
-% that are known to be made active in \emph{some} language
-% definition file.
-% \begin{macrocode}
-\DeclareTextAccent{\"}{OT1}{127}
-\DeclareTextAccent{\'}{OT1}{19}
-\DeclareTextAccent{\^}{OT1}{94}
-\DeclareTextAccent{\`}{OT1}{18}
-\DeclareTextAccent{\~}{OT1}{126}
-% \end{macrocode}
-% The following control sequences are used in \file{babel.def}
-% but are not defined for \textsc{plain} \TeX.
-% \changes{bbplain-1.0f}{1996/07/10}{Added \cs{textquotedblright} and
-% \cs{textquoteright}}
-% \changes{bbplain-1.0g}{1996/08/15}{Added \cs{ss} and \cs{i}}
-% \changes{bbplain-1.0r}{2000/10/02}{Added \cs{textquotedblleft} and
-% \cs{textquoteleft}}
-% \begin{macrocode}
-\DeclareTextSymbol{\textquotedblleft}{OT1}{92}
-\DeclareTextSymbol{\textquotedblright}{OT1}{`\"}
-\DeclareTextSymbol{\textquoteleft}{OT1}{`\`}
-\DeclareTextSymbol{\textquoteright}{OT1}{`\'}
-\DeclareTextSymbol{\i}{OT1}{16}
-\DeclareTextSymbol{\ss}{OT1}{25}
-% \end{macrocode}
-% For a couple of languages we need the \LaTeX-control sequence
-% |\scriptsize| to be available. Because plain \TeX\ doesn't have
-% such a sofisticated font mechanism as \LaTeX\ has, we just |\let|
-% it to |\sevenrm|.
-% \changes{bbplain-1.0f}{1996/07/10}{Added definition of
-% \cs{scriptsize}}
-% \begin{macrocode}
-\ifx\scriptsize\@undefined
- \let\scriptsize\sevenrm
-\fi
-%</code>
-% \end{macrocode}
-%
-\endinput
-%%
-%% \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 \~}
diff --git a/Master/texmf-dist/source/latex/babel/bbunicode.dtx b/Master/texmf-dist/source/latex/babel/bbunicode.dtx
index 79677ae1edb..78a4d817f71 100644
--- a/Master/texmf-dist/source/latex/babel/bbunicode.dtx
+++ b/Master/texmf-dist/source/latex/babel/bbunicode.dtx
@@ -58,12 +58,58 @@
% \GetFileInfo{bbunicode.dtx}
% \StopEventually{}
%
+% \section{Tentative font handling}
+%
+% A general solution is far from trivial:
+% \begin{itemize}
+% \item |\addfontfeature| only sets it for the current family and it's
+% not very efficient, and
+% \item |\defaultfontfeatures| requires to redefine the font (and the
+% opti\texttt{}ons aren't ``orthogonal'').
+% \end{itemize}
+%
+%<<*Font selection>>
+\def\babelFSstore#1{%
+ \bbl@for\bbl@tempa{#1}{%
+ \edef\bbl@tempb{\noexpand\bbl@FSstore{\bbl@tempa}}
+ \bbl@tempb{rm}\rmdefault\bbl@save@rmdefault
+ \bbl@tempb{sf}\sfdefault\bbl@save@sfdefault
+ \bbl@tempb{tt}\ttdefault\bbl@save@ttdefault}}
+\def\bbl@FSstore#1#2#3#4{%
+ \bbl@csarg\edef{#2default#1}{#3}%
+ \expandafter\addto\csname extras#1\endcsname{%
+ \let#4#3%
+ \ifx#3\f@family
+ \edef#3{\csname bbl@#2default#1\endcsname}%
+ \fontfamily{#3}\selectfont
+ \else
+ \edef#3{\csname bbl@#2default#1\endcsname}%
+ \fi}%
+ \expandafter\addto\csname noextras#1\endcsname{%
+ \ifx#3\f@family
+ \fontfamily{#4}\selectfont
+ \fi
+ \let#3#4}}
+\let\bbl@langfeatures\@empty
+\def\babelFSfeatures{%
+ \let\bbl@ori@fontspec\fontspec
+ \renewcommand\fontspec[1][]{%
+ \bbl@ori@fontspec[\bbl@langfeatures##1]}
+ \let\babelFSfeatures\bbl@FSfeatures
+ \babelFSfeatures}
+\def\bbl@FSfeatures#1#2{%
+ \expandafter\addto\csname extras#1\endcsname{%
+ \babel@save\bbl@langfeatures
+ \edef\bbl@langfeatures{#2,}}}
+%<</Font selection>>
+%
% \section{Hooks for XeTeX and LuaTeX}
%
% \subsection{XeTeX}
%
% Unfortunately, the current encoding cannot be retrieved and
-% therefore it is reset always to |utf8|, which seems a sensible default.
+% therefore it is reset always to |utf8|, which seems a sensible
+% default.
% \begin{macrocode}
%<*xetex>
\def\BabelStringsDefault{unicode}
@@ -79,6 +125,7 @@
\AddBabelHook{xetex}{stopcommands}{%
\xebbl@stop
\let\xebbl@stop\relax}
+<@Font selection@>
%</xetex>
% \end{macrocode}
% \subsection{LuaTeX}
@@ -158,6 +205,7 @@
\input #1\relax
\fi
\directlua{processnow = nil}}
+<@Font selection@>
%</luatex>
% \end{macrocode}
%