summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-05-19 21:04:34 +0000
committerKarl Berry <karl@freefriends.org>2017-05-19 21:04:34 +0000
commitf8c0d78dfb667dc3616ccb52c746d8a365a18985 (patch)
tree2b306eb06b41ea0998b5c3d8a53eeb61cb1cc531 /Master/texmf-dist
parent5d9ea1718230f7705e5aba6f17989d5415e28cad (diff)
babel (19may17)
git-svn-id: svn://tug.org/texlive/trunk@44427 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/babel/README142
-rw-r--r--Master/texmf-dist/doc/latex/babel/babel.pdfbin402360 -> 406147 bytes
-rw-r--r--Master/texmf-dist/doc/latex/babel/locale.zipbin687378 -> 687382 bytes
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.dtx1614
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.ins2
-rw-r--r--Master/texmf-dist/source/latex/babel/bbcompat.dtx322
-rw-r--r--Master/texmf-dist/source/latex/babel/bbunicode.dtx2
-rw-r--r--Master/texmf-dist/tex/generic/babel/UKenglish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/USenglish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/afrikaans.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/albanian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/american.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/austrian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/babel.def330
-rw-r--r--Master/texmf-dist/tex/generic/babel/babel.sty71
-rw-r--r--Master/texmf-dist/tex/generic/babel/bahasa.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/bahasam.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/basque.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/blplain.tex2
-rw-r--r--Master/texmf-dist/tex/generic/babel/bplain.tex2
-rw-r--r--Master/texmf-dist/tex/generic/babel/breton.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/british.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/bulgarian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/catalan.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/croatian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/czech.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/danish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/dutch.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/english.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/esperanto.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/estonian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/finnish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/francais.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/galician.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/germanb.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/greek.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/hebrew.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/hyphen.cfg6
-rw-r--r--Master/texmf-dist/tex/generic/babel/icelandic.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/interlingua.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/irish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/italian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/latin.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/lsorbian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/magyar.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/naustrian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/ngermanb.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/nil.ldf4
-rw-r--r--Master/texmf-dist/tex/generic/babel/norsk.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/plain.def4
-rw-r--r--Master/texmf-dist/tex/generic/babel/polish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/portuges.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/romanian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/russianb.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/samin.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/scottish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/serbian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/slovak.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/slovene.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/spanish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/swedish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/switch.def26
-rw-r--r--Master/texmf-dist/tex/generic/babel/turkish.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/ukraineb.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/usorbian.sty2
-rw-r--r--Master/texmf-dist/tex/generic/babel/welsh.sty2
66 files changed, 1846 insertions, 783 deletions
diff --git a/Master/texmf-dist/doc/latex/babel/README b/Master/texmf-dist/doc/latex/babel/README
index 5499b94d1da..56d02ee289e 100644
--- a/Master/texmf-dist/doc/latex/babel/README
+++ b/Master/texmf-dist/doc/latex/babel/README
@@ -1,30 +1,41 @@
-Babel 3.9t
+Babel 3.10
----------
-This is Babel 3.9t.
-
-*** Babel 3.9o and 3.9p are deprecated ***
-*** For incompatibilities with polyglossia read the manual ***
-*** You must recreate the formats if coming from version <3.9q ***
+This package manages culturally-determined typographical (and other)
+rules, and hyphenation patterns for a wide range of languages. Many
+language styles work with pdflatex, as well as with xelatex and
+lualatex out of the box. A few even work with plain formats.
Version 3.9a fixed lots of bugs and added some new features, intended
mainly to make it compatible somehow with Unicode engines. Some bugs
have not been fixed to avoid backward incompatibilities, but they have
-been documented. Most of the new features (like package options) are
+been documented. Most of the new features (like package options) were
intended to overcome issues in previous releases without changing
significantly the behaviour of Babel.
+Current development is focused on Unicode engines (XeTeX and LuaTeX).
+New features related to font selection, bidi writing and the like will
+be added incrementally. Versions numbers drop the letter and now 3.10,
+3.11, etc., will be used instead. So, 3.9t is the last in the former
+series.
+
+Included is a pre-release of the new ini files (for about 200
+languages) to be used in forthcoming versions. They are currenly not
+used, but this way they can be fine-tuned before the final release
+(they are based mainly on the CLDR, and some settings are not well
+suited for fine typesetting).
+
Languages are not part of the Babel core any more; in particular, it
shall be no longer necessary to synchronize Babel core releases with
releases of Babel language files. See CONTRIB for further details
-about contributing a language.
+about contributing a language. You may also create an ini file or
+improve the existing ones -- it's a trivial task (no programming
+skills required at all), but don't hesitate to ask for help.
-To install it, just tex babel.ins and move the generated files to the
-corresponding place in your TeX distribution. Unlike former releases,
-formats must not be recreated, but it is recommended, at least the
-first time Babel is updated from 3.8 (or previous versions).
+The best way to install and/or update it is with the help of package
+managers.
-Changes are described in babel.pdf with the label "New 3.9". The
+Changes are described in babel.pdf with the label "New <version>". The
manual has been expanded to include some tips and tricks, but it will
be improved in next releases.
@@ -39,95 +50,32 @@ http://www.texnia.com/contact.html
Bugs related to specific languages are best reported to their
respective authors.
-Versions >=3.9i presumes the german style has been updated to 2.7.
-
-New
----
-* babel.dtx
-3.9b - Fixed an idiot slip in hyphen.cfg: a \def instead of \let
-3.9c - Added the "modifiers" mechanism
- - Option shorthands accepts t for ~ and c for ,
- - \foreinglanguage inserted a par (because of an empty line
- in the doc part)
-3.9d - Fixed undefined \@expandtwoargs in Plain
- - Code reorganized (just an "internal" change)
-3.9e - Fixed a bug introduced in 3.9c which mangled key=value
- options.
-3.9f - Default hyphenmins were not set to 2 3. Now they are again.
-3.9g - bbplain.dtx and babel.dtx merged.
- - The number of languages was not printed in some formats.
- - A new mechanism to force \StartBabelCommands even without the
- 'strings' key (\UseStrings didn't work at all).
- - With \AfterBabelCommands macros can be defined in the global scope.
- - A tool for readjusting lccodes for hyphenation (\SetHyphenMap and a
- package option).
- - Tentative macros for \fontspec.
-3.9h - Fixed bugs in \SetStringLoop (first token expanded prematurely)
- and \SetCase (sometimes ignored).
- - bplain didn't work (again). Fixed.
- - Other minor internal changes.
-3.9i - With LuaTeX, spaces are not ignored after shorthands and closing
- braces can follow them.
- - \textlatin and friends are deprecated. For the logos (see
- below) a new macro is used if necessary (\ensureascii), so
- \textlatin is not used in the core any more.
- - \babelensure can be used to wrap caption texts with \foreignlanguage,
- as well as to enforce an encoding.
- - \babeltags is just for syntactical sugar, and defines macros
- with short names to switch the language (eg, \textdeu and \deu).
- - Partial compatibility with languages named as \lang@ instead
- of \l@ (plain etex/xetex/luatex).
- - Bug fix. The logos \TeX and \LaTeX were typeset in a wrong font
- in some cases. Now if a non-ASCII font is not loaded they are not
- redefined at all.
- - Bug fix. \bbl@allowhyphens is now ignored in vertical mode.
- - Bug fix. Loops with \@for failed in Plain.
- - Bug fix. A few codes in xetex where wrong when loading patterns.
- - Bug fix. With strings=encoded captions were left unchanged in
- \MakeUppercase/\MakeLowercase.
-3.9j - Bug fix. Plain formats didn't work (Undefined \@filelist).
-3.9k - Code and doc reorganized with some `literate' concepts (with a
- slightly patched docstrip).
- - Removed the luatex stuff for shorthands. It was just a first step,
- but ended up in the final release of 3.9i (it shouldn't).
- - Improvements for Plain and other non-LaTeX formats.
-3.9l - Formerly, fontspec set \latinencoding to EUx if babel was loaded.
- Now, babel sets it if fontspec is loaded.
- - New package options 'nocase' (\SetCase is ignored) and 'silent'
- - Improved compatibility (hopefully) with babelbib.
-3.9m - Fixed melayu name (from meyalu).
- - A few lines for \babelpatterns (only luatex, see below).
-3.9n - Just fixes a couple of minor bugs (related to 2.09 and ifthen).
-3.9o - Adapted to the forthcoming Unicode encoding.
-3.9p - A little change for bbunicode 1.1b.
-3.9q - base now reads patterns in lua
- - Some minor changes for luatex
-3.9r - The three main dtx files now share version numbers.
- - bbunicode - Fixed a line break at \cs{foreignlanguage} with
- unloaded patterns. Also added \babelcatcodetablenum, just in
- case.
-3.9s - Bug fix - extra speces with \babelensure
-3.9t - Part of the code for 3.10 has been "back-ported" to this
+Recent changes
+--------------
+
+3.10 - New versioning
+ - New macro - \babelprovide
+
+3.9t - Part of the code for 3.10 ss has been "back-ported" to this
release, but they are only internal changes.
- Fix - with \babelhyphen{soft} the hyphen could vanish.
- English, Indonesian and Malay "dialects" now rely on the proxy
files provided by these languages (eg, american.ldf, melayu.ldf).
- If you upgrade babel, you must upgrade those languages, too.
-
-* bbunicode.dtx
-1.0b - Improvements by Elie Roux for LuaTeX.
-1.0c - Bug fix. A few codes in xetex where wrong when loading patterns.
-1.0e - \babelpatterns, which adds patterns to a language.
- - Use [[]] instead of \luaescapestring (the latter is not always
- available).
-1.0f - Code for luatex assigned mistakenly to xetex.
-1.1a - Revamped hyphenation loader for luatex.
-1.1b - Now patterns are loaded with lua(e)tex (and a bug fixed).
-1.1c - Patterns loader thorougly revised
-3.9r and later - The three main dtx files now share version numbers. See
- changes above
+ If you upgrade babel, you MUST upgrade those languages, too.
+
+3.9s - Bug fix - extra spaces with \babelensure
+
+3.9r - The three main dtx files now share version numbers.
+ - bbunicode - Fixed a line break at \cs{foreignlanguage} with
+ unloaded patterns. Also added \babelcatcodetablenum, just in
+ case.
+
+3.9q - base now reads patterns in lua
+ - Some minor changes for luatex
+
+*** Babel 3.9o and 3.9p are deprecated ***
------------
Javier Bezos
-2017-04-28
+2017-05-19
diff --git a/Master/texmf-dist/doc/latex/babel/babel.pdf b/Master/texmf-dist/doc/latex/babel/babel.pdf
index ba7f378d6c0..c5fc7ec2660 100644
--- a/Master/texmf-dist/doc/latex/babel/babel.pdf
+++ b/Master/texmf-dist/doc/latex/babel/babel.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/babel/locale.zip b/Master/texmf-dist/doc/latex/babel/locale.zip
index de93a1195bc..30df4fca1a7 100644
--- a/Master/texmf-dist/doc/latex/babel/locale.zip
+++ b/Master/texmf-dist/doc/latex/babel/locale.zip
Binary files differ
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index 621d29730a1..75cea56e4d5 100644
--- a/Master/texmf-dist/source/latex/babel/babel.dtx
+++ b/Master/texmf-dist/source/latex/babel/babel.dtx
@@ -36,7 +36,7 @@
%\iffalse
%% File 'babel.dtx'
%\fi
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%\iffalse
%
% Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX;
@@ -52,6 +52,8 @@
%
%<*filedriver>
\documentclass{ltxdoc}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
\usepackage{bera}
\raggedright
\addtolength{\textwidth}{25pt}
@@ -88,8 +90,19 @@
\definecolor{theshade}{rgb}{1,1,0.97}
\definecolor{theframe}{gray}{0.6}
\definecolor{lightgray}{gray}{0.95}
+\definecolor{messages}{rgb}{.66,.13,.27}
+\makeatletter
+\def\@begintheorem#1#2{%
+ \list{}{}%
+ \global\advance\@listdepth\m@ne
+ \item[{\sffamily\bfseries\color{messages}\MakeUppercase{#1}}]}%
+\makeatother
+\newtheorem{warning}{Warning}
+\newtheorem{note}{Note}
+\newtheorem{example}{Example}
\IfFileExists{listings.sty}{
\usepackage{listings}
+ \usepackage{listingsutf8}
\lstdefinestyle{verbatim}{
% gobble=1,
columns=flexible,
@@ -114,6 +127,7 @@
backgroundcolor=\color{theshade},
rulecolor=\color{theframe},
framerule=\fboxrule,
+ inputencoding=utf8
}
\let\verbatim\relax
\lstnewenvironment{verbatim}[1][]{\lstset{style=verbatim,##1}}{}
@@ -194,8 +208,8 @@
\vspace{2cm}\hspace{1.5cm}
\begin{minipage}{5cm}
\Large
-Version 3.9t\newline
-2017/04/28
+Version 3.10\newline
+2017/05/19
\vspace{1cm}
\textit{Original author}\newline
@@ -247,7 +261,28 @@ out what the current language is.
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.
+purpose, namely, passing that language as an optional argument. In
+addition, you may want to set the font and input encodings. Here is a
+simple full example:
+\begin{verbatim}[escapechar=\&]
+\documentclass{article}
+
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+
+\usepackage[frenchb]{babel}
+
+\begin{document}
+
+Plus &\c c&a change, plus c'est la m&\^e&me chose!
+
+\end{document}
+\end{verbatim}
+
+\begin{warning}
+A common source of trouble is a wrong setting of the input
+encoding. Make sure you set the encoding actually used by your editor.
+\end{warning}
In multilingual documents, just use several option. So, in \LaTeX2e\
the preamble of the document:
@@ -299,15 +334,18 @@ Attributes (described below) are considered modifiers, ie, you can
set an attribute by including it in the list of modifiers. However,
modifiers is a more general mechanism.
-Because of the way \babel{} has evolved, ``language'' can refer to (1)
-a set of hyphenation patterns as preloaded into the format, (2) a
-package option, (3) an |ldf| file, and (4) a name used in the document
-to select a language or dialect. So, a package option refers to a
-language in a generic way -- sometimes it is the actual language name
-used to select it, sometimes it is a file name loading a language with
-a different name, sometimes it is a file name loading several
-languages. Please, read the documentation for specific languages for
-further info.
+\begin{note}
+ Because of the way \babel{} has evolved, ``language'' can refer to
+ (1) a set of hyphenation patterns as preloaded into the format, (2)
+ a package option, (3) an |ldf| file, and (4) a name used in the
+ document to select a language or dialect. So, a package option
+ refers to a language in a generic way -- sometimes it is the actual
+ language name used to select it, sometimes it is a file name loading
+ a language with a different name, sometimes it is a file name
+ loading several languages. Please, read the documentation for
+ specific languages for further info.
+\end{note}
+
Loading directly |sty| files in \LaTeX{} (ie,
|\usepackage|\marg{language}) is deprecated and you will get the
@@ -952,6 +990,86 @@ you attempt to load both. Here is a way to overcome this problem:
\usepackage[foo,bar]{babel}
\end{verbatim}
+\subsection{Creating a language}
+
+\New{3.10} And what if there is no style for your language or none
+fits your needs? You may then define quickly a language with the
+help of the following macro in the preamble.
+
+\Describe\babelprovide{\oarg{options}\marg{language-name}}
+
+Defines the internal structure of the language with some defaults: the
+hyphen rules, if not available, are set to the current ones, left and
+right hyphen mins are set to 2 and 3, but captions and date are not
+defined. Conveniently, \babel{} warns you about what to do. Very
+likely you will find warnings like that in the |log| file:
+\begin{verbatim}
+Package babel Warning: \mylangchaptername not set. Please, define
+(babel) it in the preamble with something like:
+(babel) \renewcommand\maylangchaptername{..}
+(babel) Reported on input line 18.
+\end{verbatim}
+
+In most cases, you will only need to define a few macros.
+
+For example, if you need a language named |arhinish|:
+\begin{verbatim}
+\usepackage[danish]{babel}
+\babelprovide{arhinish}
+\renewcommand\arhinishchaptername{Chapitula}
+\renewcommand\arhinishrefname{Refirenke}
+\renewcommand\arhinishhyphenmins{22}
+\end{verbatim}
+
+The main language is not changed (\texttt{danish} in this example).
+So, you must add |\selectlanguage{arhinish}| or other selectors when
+necessary.
+
+\Describe{captions=}{\meta{language-tag}}
+Currently, the \oarg{options} may be used to load captions from an
+|ini| file, but note these files are still tentative and might change.
+For example:
+\begin{verbatim}
+\babelprovide[captions=hu]{hungarian}
+\end{verbatim}
+It just loads the strings, no more. Encoding, font,
+\textsf{fontspec} language and script, writing direction, etc., are
+not touched at all. Unicode engines load the UTF-8 variants, while
+8-bit engines load the LICR (ie, with macros like |\'| or |\ss|) ones.
+
+\Describe{hyphenrules=}{\meta{language-list}} With this option, with a
+space-separated list of hyphenation rules, \babel{} assigns to the
+language the first valid hyphenation rules in the list. For example:
+\begin{verbatim}
+\babelprovide[hyphenrules=chavacano spanish italian]{chavacano}
+\end{verbatim}
+If none of the listed hyphenrules exist, the default behaviour
+applies. Note in this example we set |chavacano| as first option --
+without it, it would select |spanish| even if |chavacano| exists.
+
+A special value is |+|, which allocates a new language (in the \TeX{}
+sense). It only makes sense as the last value (or the only one; the
+subsequent ones are silently ignored). It is mostly useful with
+\luatex, because you can add some patterns with |\babelpatterns|, as
+for example:
+\begin{verbatim}
+\babelprovide[hyphenrules=+]{neo}
+\babelpatterns[neo]{a1 e2 i1 o1 u1}
+\end{verbatim}
+In other engines it just supresses hyphenation (because the pattern
+list is empty).
+
+\Describe{main}{} This valueless option makes the language the main
+one. Only in newly defined languages.
+
+\begin{note}
+ (1) Setting \verb|\today| is not so easy, and requires more work
+ (some tools are on the way). (2) If you need shorthands, you can use
+ |\useshorthands| and |\defineshorthand| as described above. (3)
+ Captions and |\today| are ``ensured'' with |\babelensure| (because
+ this will be the default in |ini|-based languages).
+\end{note}
+
\subsection{Hooks}
\New{3.9a} A hook is a piece of code to be executed at certain
@@ -2321,7 +2439,9 @@ help from Bernd Raichle, for which I am grateful.
\end{document}
%</filedriver>
%\fi
+%
% \changes{babel~3.9a}{2012/05/16}{Now using \cs{ldf@quit} for the test}
+%
% \begin{macrocode}
%<*core>
\ifx\ldf@quit\@undefined
@@ -2330,6 +2450,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
%</core>
% \end{macrocode}
+%
%<*dtx>
\ProvidesFile{babel.dtx}
%</dtx>
@@ -2343,6 +2464,7 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.9g}{2013/06/01}{bbplain merged}
% \changes{babel~3.9k}{2014/03/23}{Code and doc reorganized, and some
% minor enhancements}
+%
%\begingroup
% \catcode`<=\active%
% \catcode`>=\active
@@ -2384,15 +2506,21 @@ help from Bernd Raichle, for which I am grateful.
% little bit of literate programming.
%
% \begin{macrocode}
-%<<version=3.9t>>
-%<<date=2017/04/28>>
+%<<version=3.10>>
+%<<date=2017/05/19>>
% \end{macrocode}
%
% \section{Tools}
%
+% \textbf{Do not use the following macros in ldf files. They may
+% change in the future}. This applies mainly to those recently added
+% for replacing, trimming and looping. The older ones, like
+% |\bbl@afterfi|, will not change.
+%
% \changes{babel~3.9t}{2017/04/22}{Added new helper macros. Not all are
% currently used, but will be in 3.10 -- \cs{bbl@trim},
% \cs{bbl@ifunset}, \cs{bbl@exp}, \cs{bbl@stripslash}}
+%
% We define some basic macros 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
@@ -2400,8 +2528,10 @@ help from Bernd Raichle, for which I am grateful.
% is executed twice, but we need them when defining options and
% \file{babel.def} cannot be load until options have been defined.
% This does not hurt, but should be fixed somehow.
+%
% \changes{babel~3.9i}{2014/02/16}{\cs{@for} didn't work with
% Plain. Added \cs{bbl@loop}}
+%
% \begin{macrocode}
%<<*Basic macros>>
\def\bbl@stripslash{\expandafter\@gobble\string}
@@ -2418,6 +2548,7 @@ help from Bernd Raichle, for which I am grateful.
\fi}
\def\bbl@for#1#2#3{\bbl@loopx#1{#2}{\ifx#1\@empty\else#3\fi}}
% \end{macrocode}
+%
% \changes{babel~3.9t}{2017/04/22}{Use \cs{bbl@ifunset} instead of
% \cs{@ifundefined}.}
%
@@ -2426,8 +2557,10 @@ help from Bernd Raichle, for which I am grateful.
% separated list in its first argument. When the list is not
% defined yet (or empty), it will be initiated. It presumes
% expandable character strings.
+%
% \changes{babel~3.9t}{2017/04/22}{Redefined to avoid infinite loops
% if the macro is \cs{relax}.}
+%
% \begin{macrocode}
\def\bbl@add@list#1#2{%
\edef#1{%
@@ -2436,6 +2569,7 @@ help from Bernd Raichle, for which I am grateful.
{\ifx#1\@empty\else#1,\fi}%
#2}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@afterelse}
@@ -2448,10 +2582,12 @@ help from Bernd Raichle, for which I am grateful.
% by Sonja Maus.}. These macros will break if another |\if...\fi|
% statement appears in one of the arguments and it is not enclosed
% in braces.
+%
% \begin{macrocode}
\long\def\bbl@afterelse#1\else#2\fi{\fi#1}
\long\def\bbl@afterfi#1\fi{\fi#1}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -2513,6 +2649,58 @@ help from Bernd Raichle, for which I am grateful.
\long\def\bbl@ifblank@i#1#2\@nil#3#4#5\@nil{#4}
% \end{macrocode}
%
+% For each element in the comma separated <key>|=|<value> list,
+% execute <code> with |#1| and |#2| as the key and the value of
+% current item (trimmed). In addition, the item is passed verbatim as
+% |#3|. With the <key> alone, it passes |\@empty| (ie, the macro thus
+% named, not an empty argument, which is what you get with <key>|=|
+% and no value).
+%
+% \begin{macrocode}
+\def\bbl@forkv#1#2{%
+ \def\bbl@kvcmd##1##2##3{#2}%
+ \bbl@kvnext#1,\@nil,}
+\def\bbl@kvnext#1,{%
+ \ifx\@nil#1\relax\else
+ \bbl@ifblank{#1}{}{\bbl@forkv@eq#1=\@empty=\@nil{#1}}%
+ \expandafter\bbl@kvnext
+ \fi}
+\def\bbl@forkv@eq#1=#2=#3\@nil#4{%
+ \bbl@trim@def\bbl@forkv@a{#1}%
+ \bbl@trim{\expandafter\bbl@kvcmd\expandafter{\bbl@forkv@a}}{#2}{#4}}
+% \end{macrocode}
+%
+% A \textit{for} loop. Each item (trimmed), is |#1|. It cannot be
+% nested (it's doable, but we don't need it).
+%
+% \begin{macrocode}
+\def\bbl@vforeach#1#2{%
+ \def\bbl@forcmd##1{#2}%
+ \bbl@fornext#1,\@nil,}
+\def\bbl@fornext#1,{%
+ \ifx\@nil#1\relax\else
+ \bbl@ifblank{#1}{}{\bbl@trim\bbl@forcmd{#1}}%
+ \expandafter\bbl@fornext
+ \fi}
+\def\bbl@foreach#1{\expandafter\bbl@vforeach\expandafter{#1}}
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\def\bbl@replace#1#2#3{% in #1 -> repl #2 by #3
+ \toks@{}%
+ \def\bbl@replace@aux##1#2##2#2{%
+ \ifx\bbl@nil##2%
+ \toks@\expandafter{\the\toks@##1}%
+ \else
+ \toks@\expandafter{\the\toks@##1#3}%
+ \bbl@afterfi
+ \bbl@replace@aux##2#2%
+ \fi}%
+ \expandafter\bbl@replace@aux#1#2\bbl@nil#2%
+ \edef#1{\the\toks@}}
+% \end{macrocode}
+%
% Now, just syntactical sugar, but it makes partial expansion of some
% code a lot more simple and readable. Here |\\| stands for
% |\noexpand| and |\<..>| for |\noexpand| applied to a built macro
@@ -2621,6 +2809,7 @@ help from Bernd Raichle, for which I am grateful.
% 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
@@ -2628,6 +2817,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
%<</Define core switching macros>>
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\last@language}
@@ -2650,6 +2840,7 @@ help from Bernd Raichle, for which I am grateful.
% For formats based on plain version~3.0 the definition of
% |\newlanguage| can be simply copied, removing |\outer|.
% Plain \TeX\ version 3.0 uses |\count 19| for this purpose.
+%
% \begin{macrocode}
%<<*Define core switching macros>>
\ifx\newlanguage\@undefined
@@ -2668,10 +2859,12 @@ help from Bernd Raichle, for which I am grateful.
\fi
%<</Define core switching macros>>
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
% Identify each file that is produced from this source file.
+%
% \begin{macrocode}
%<*driver&!user>
\ProvidesFile{babel.drv}[<@date@> <@version@>]
@@ -2697,6 +2890,7 @@ help from Bernd Raichle, for which I am grateful.
% previously loaded (mainly, \file{hyphen.cfg}). If not, load it
% now. We cannot load |babel.def| here because we first need to
% declare and process the package options.
+%
% \changes{babel~3.9a}{2012/08/11}{Now switch.def is loaded always, so
% that there is no need to rebuild formats just to update babel}
% \changes{babel~3.9a}{2012/12/13}{But switch.def is loaded only if
@@ -2737,21 +2931,26 @@ help from Bernd Raichle, for which I am grateful.
% base}
% \changes{babel~3.9q}{2016/02/11}{Load patterns with option base.
% To be improved. Moved showlanguages before base}
+%
% \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{babel}[<@date@> <@version@> The Babel package]
\@ifpackagewith{babel}{debug}
- {\input switch.def\relax}
- {<@Load switch if newer@>}
+ {\let\bbl@debug\@firstofone
+ \input switch.def\relax}
+ {\let\bbl@debug\@gobble
+ <@Load switch if newer@>}
<@Load patterns in luatex@>
<@Basic macros@>
\def\AfterBabelLanguage#1{%
\global\expandafter\bbl@add\csname#1.ldf-h@@k\endcsname}%
% \end{macrocode}
+%
% If the format created a list of loaded languages (in
% |\bbl@languages|), get the name of the 0-th to show the actual
% language used.
+%
% \begin{macrocode}
\ifx\bbl@languages\@undefined\else
\begingroup
@@ -2772,9 +2971,11 @@ help from Bernd Raichle, for which I am grateful.
\bbl@languages
\fi
% \end{macrocode}
+%
% Now the \texttt{base} option. With it we can define (and load, with
% \luatex) hyphenation patterns, even if we are not interesed in the
% rest of babel. Useful for old versions of \textsf{polyglossia}, too.
+%
% \begin{macrocode}
\@ifpackagewith{babel}{base}{%
\ifx\directlua\@undefined
@@ -2800,6 +3001,7 @@ help from Bernd Raichle, for which I am grateful.
% no modifiers have been given, the former is |\relax|. How
% modifiers are handled are left to language styles; they can use
% |\in@|, loop them with |\@for| or load |keyval|, for example).
+%
% \changes{babel~3.9e}{2013/04/15}{Bug fixed - a dot was added in
% key=value pairs}
%
@@ -2819,21 +3021,23 @@ help from Bernd Raichle, for which I am grateful.
\fi
\fi}
\let\bbl@tempc\@empty
-\bbl@for\bbl@tempa\bbl@tempa{%
- \expandafter\bbl@tempd\bbl@tempa.\@empty\@nnil}
+\bbl@foreach\bbl@tempa{\bbl@tempd#1.\@empty\@nnil}
\expandafter\let\csname opt@babel.sty\endcsname\bbl@tempc
% \end{macrocode}
+%
% The next option tells \babel\ to leave shorthand characters
% active at the end of processing the package. This is \emph{not}
% the default as it can cause problems with other packages, but for
% those who want to use the shorthand characters in the preamble of
% their documents this can help.
+%
% \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}
% \changes{babel~3.9l}{2014/07/29}{Option \texttt{silent}}
+%
% \begin{macrocode}
\DeclareOption{KeepShorthandsActive}{}
\DeclareOption{activeacute}{}
@@ -2853,16 +3057,20 @@ help from Bernd Raichle, for which I am grateful.
% loads the requested languages, except the main one if set with
% the key |main|, and the third one loads the latter. First, we
% ``flag'' valid keys with a nil value.
+%
% \changes{babel~3.9a}{2012/08/10}{Added the `safe' key, including code
% below for selecting the redefined macros}
+%
% \begin{macrocode}
\let\bbl@opt@shorthands\@nnil
\let\bbl@opt@config\@nnil
\let\bbl@opt@main\@nnil
\let\bbl@opt@headfoot\@nnil
% \end{macrocode}
+%
% The following tool is defined temporarily to store the values of
% options.
+%
% \begin{macrocode}
\def\bbl@tempa#1=#2\bbl@tempa{%
\bbl@csarg\ifx{opt@#1}\@nnil
@@ -2875,11 +3083,13 @@ help from Bernd Raichle, for which I am grateful.
`headfoot', `safe', `math'}
\fi}
% \end{macrocode}
+%
% Now the option list is processed, taking into account only
% currently declared options (including those declared with a |=|),
% and |<key>=<value>| options (the former take precedence).
% Unrecognized options are saved in |\bbl@language@opts|, because
% they are language options.
+%
% \begin{macrocode}
\let\bbl@language@opts\@empty
\DeclareOption*{%
@@ -2890,7 +3100,9 @@ help from Bernd Raichle, for which I am grateful.
\bbl@add@list\bbl@language@opts{\CurrentOption}%
\fi}
% \end{macrocode}
+%
% Now we finish the first pass (and start over).
+%
% \begin{macrocode}
\ProcessOptions*
% \end{macrocode}
@@ -2904,8 +3116,10 @@ help from Bernd Raichle, for which I am grateful.
% A bit of optimization: if there is no |shorthands=|, then
% |\bbl@ifshorthands| is always true, and it is always false if
% |shorthands| is empty. Also, some code makes sense only with
-% |shorthands=...|.
+% |shorthands=...|.
+%
% \changes{babel~3.9c}{2013/04/07}{Added t and c for tilde and comma}
+%
% \begin{macrocode}
\def\bbl@sh@string#1{%
\ifx#1\@empty\else
@@ -2921,8 +3135,10 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@ifshorthand#1#2#3{#3}%
\else
% \end{macrocode}
+%
% The following macro tests if a shortand is one of the allowed
% ones.
+%
% \begin{macrocode}
\def\bbl@ifshorthand#1{%
\@expandtwoargs\in@{\string#1}{\bbl@opt@shorthands}%
@@ -2932,8 +3148,10 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\@secondoftwo
\fi}
% \end{macrocode}
+%
% We make sure all chars in the string are `other', with the help
% of an auxiliary macro defined above (which also zaps spaces).
+%
% \begin{macrocode}
\edef\bbl@opt@shorthands{%
\expandafter\bbl@sh@string\bbl@opt@shorthands\@empty}%
@@ -2949,11 +3167,14 @@ help from Bernd Raichle, for which I am grateful.
{\PassOptionsToPackage{activegrave}{babel}}{}
\fi\fi
% \end{macrocode}
+%
% \changes{babel~3.9a}{2012/07/30}{Code setting language in
% head/foots. Related to babel/3796}
+%
% With |headfoot=lang| we can set the language used in heads/foots.
% For example, in babel/3796 just adds |headfoot=english|. It
% misuses \cs{@resetactivechars} but seems to work.
+%
% \begin{macrocode}
\ifx\bbl@opt@headfoot\@nnil\else
\g@addto@macro\@resetactivechars{%
@@ -2962,9 +3183,11 @@ help from Bernd Raichle, for which I am grateful.
\let\protect\noexpand}
\fi
% \end{macrocode}
+%
% For the option safe we use a different approach --
% |\bbl@opt@safe| says which macros are redefined (B for bibs and R
% for refs). By default, both are set.
+%
% \begin{macrocode}
\ifx\bbl@opt@safe\@undefined
\def\bbl@opt@safe{BR}
@@ -2982,24 +3205,15 @@ help from Bernd Raichle, for which I am grateful.
% that languages not declared are also correctly recognized, even
% if given as global options}
% \changes{babel~3.9a}{2012/08/12}{Revised the loading mechanism}
-% \changes{babel~3.8c}{2004/06/12}{Added option \Lopt{australian}}
-% \changes{babel~3.8h}{2005/11/23}{Added option \Lopt{albanian}}
-% \changes{babel~3.8h}{2005/11/23}{added synonyms \Lopt{indonesian},
-% \Lopt{indon} and \Lopt{bahasai} for the original bahasa
-% (indonesia) support}
-% \changes{babel~3.8h}{2005/11/23}{added \Lopt{malay}, \Lopt{meyalu}
-% and \Lopt{bahasam} for the Bahasa Malaysia support}
-% \changes{babel~3.8c}{2004/06/12}{Added the \Lopt{newzealand} option}
% \changes{babel~3.9i}{2014/03/01}{Removed German options, because
% they are now loaded directly}
-% \changes{babel~3.9m}{2015/07/28}{Added melayu (meyalu preserved for
-% compatibility)}
%
% Languages are loaded when processing the corresponding option
% \textit{except} if a |main| language has been set. In such a
% case, it is not loaded until all options has been processed.
% The following macro inputs the ldf file and does some additional
% checks (|\input| works, too, but possible errors are not catched).
+%
% \begin{macrocode}
\let\bbl@afterlang\relax
\let\BabelModifiers\relax
@@ -3019,6 +3233,7 @@ help from Bernd Raichle, for which I am grateful.
activeacute, activegrave, noconfigs, safe=, main=, math=\\%
headfoot=, strings=, config=, hyphenmap=, or a language name.}}}
% \end{macrocode}
+%
% Now, we set language options whose names are different from |ldf| files.
%
% \changes{babel~3.9t}{2017/04/23}{Removed options for English, Indonesian and
@@ -3053,11 +3268,13 @@ help from Bernd Raichle, for which I am grateful.
% want an alternative name for a language, just create a new |.ldf|
% file loading the actual one. You can also set the name
% of the file with the package option |config=<name>|, which will
-% load |<name>.cfg| instead.
+% load |<name>.cfg| instead.
+%
% \changes{babel~3.9a}{2012/06/28}{Added the \cs{AfterBabelLanguage}
% mechanism, to be used mainly with the local cfg file.}
% \changes{babel~3.9a}{2012/06/31}{Now you can set the name of the
% local cfg file.}
+%
% \begin{macrocode}
\ifx\bbl@opt@config\@nnil
\@ifpackagewith{babel}{noconfigs}{}%
@@ -3084,6 +3301,7 @@ help from Bernd Raichle, for which I am grateful.
% languages (note this list also contains the language given with
% |main|). If not declared above, the name of the option and the
% file are the same.
+%
% \begin{macrocode}
\bbl@for\bbl@tempa\bbl@language@opts{%
\bbl@ifunset{ds@\bbl@tempa}%
@@ -3094,24 +3312,24 @@ help from Bernd Raichle, for which I am grateful.
\bbl@tempb}%
\@empty}
% \end{macrocode}
+%
% Now, we make sure an option is explicitly declared for any
% language set as global option, by checking if an |ldf|
% exists. The previous step was, in fact, somewhat redundant, but
% that way we minimize accesing the file system just to see if the
% option could be a language.
+%
% \begin{macrocode}
-\bbl@for\bbl@tempa\@classoptionslist{%
- \bbl@ifunset{ds@\bbl@tempa}%
- {\IfFileExists{\bbl@tempa.ldf}%
- {\edef\bbl@tempb{%
- \noexpand\DeclareOption
- {\bbl@tempa}%
- {\noexpand\bbl@load@language{\bbl@tempa}}}%
- \bbl@tempb}%
- \@empty}%
- \@empty}
+\bbl@foreach\@classoptionslist{%
+ \bbl@ifunset{ds@#1}%
+ {\IfFileExists{#1.ldf}%
+ {\DeclareOption{#1}{\bbl@load@language{#1}}}%
+ {}}%
+ {}}
% \end{macrocode}
+%
% If a main language has been set, store it for the third pass.
+%
% \begin{macrocode}
\ifx\bbl@opt@main\@nnil\else
\expandafter
@@ -3119,19 +3337,24 @@ help from Bernd Raichle, for which I am grateful.
\DeclareOption{\bbl@opt@main}{}
\fi
% \end{macrocode}
+%
% And we are done, because all options for this pass has been
-% declared. Those already processed in the first pass are just ignored.
+% declared. Those already processed in the first pass are just
+% ignored.
+%
% \changes{babel~3.9a}{2012/12/22}{Default option does nothing}
%
% The options have to be processed in the order in which the user
% specified them (except, of course, global options, which \LaTeX{}
% processes before):
+%
% \begin{macrocode}
\def\AfterBabelLanguage#1{%
\bbl@ifsamestring\CurrentOption{#1}{\global\bbl@add\bbl@afterlang}{}}
\DeclareOption*{}
\ProcessOptions*
% \end{macrocode}
+%
% This finished the second pass. Now the third one begins, which
% loads the main language set with the key |main|. A warning is
% raised if the main language is not the same as the last named
@@ -3139,6 +3362,7 @@ help from Bernd Raichle, for which I am grateful.
% execute directly the option (because it could be used only in
% |main|). After loading all languages, we deactivate
% |\AfterBabelLanguage|.
+%
% \begin{macrocode}
\ifx\bbl@opt@main\@nnil
\edef\bbl@tempa{\@classoptionslist,\bbl@language@opts}
@@ -3172,8 +3396,10 @@ help from Bernd Raichle, for which I am grateful.
% language we check whether |\bbl@main@language|, has become
% defined. If not, no language has been loaded and an error
% message is displayed.
+%
% \changes{babel~3.9a}{2012/06/24}{Now babel is not loaded to prevent
% the document from raising errors after fixing it}
+%
% \begin{macrocode}
\ifx\bbl@main@language\@undefined
\bbl@error{%
@@ -3299,14 +3525,18 @@ help from Bernd Raichle, for which I am grateful.
\fi
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \changes{babel~3.9a}{2012/08/10}{Removed the \cs{peek@token} and
% \textsc{test@token} stuff}
+%
% The macro |\initiate@active@char| takes all the necessary actions
% to make its argument a shorthand character. The real work is
% performed once for each character.
+%
% \changes{babel~3.9a}{1999/04/30}{Added \cs{bbl@withactive}}
+%
% \begin{macrocode}
\def\bbl@withactive#1#2{%
\begingroup
@@ -3325,6 +3555,7 @@ help from Bernd Raichle, for which I am grateful.
% Because we need to redefine a number of commands we define the
% command |\bbl@redefine| which takes care of this. It creates a
% new control sequence, |\org@...|
+%
% \begin{macrocode}
\def\bbl@redefine#1{%
\edef\bbl@tempa{\bbl@stripslash#1}%
@@ -3333,14 +3564,17 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% This command should only be used in the preamble of the document.
+%
% \begin{macrocode}
\@onlypreamble\bbl@redefine
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@redefine@long}
% This version of |\babel@redefine| can be used to redefine |\long|
% commands such as |\ifthenelse|.
+%
% \begin{macrocode}
\def\bbl@redefine@long#1{%
\edef\bbl@tempa{\bbl@stripslash#1}%
@@ -3348,6 +3582,7 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\long\expandafter\def\csname\bbl@tempa\endcsname}
\@onlypreamble\bbl@redefine@long
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@redefinerobust}
@@ -3357,6 +3592,7 @@ help from Bernd Raichle, for which I am grateful.
% it is necessary to check whether \verb*|\foo | exists. The result
% is that the command that is being redefined is always robust
% afterwards. Therefore all we need to do now is define \verb*|\foo |.
+%
% \begin{macrocode}
\def\bbl@redefinerobust#1{%
\edef\bbl@tempa{\bbl@stripslash#1}%
@@ -3368,9 +3604,11 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% This command should only be used in the preamble of the document.
+%
% \begin{macrocode}
\@onlypreamble\bbl@redefinerobust
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Hooks}
@@ -3380,7 +3618,8 @@ help from Bernd Raichle, for which I am grateful.
% below). Admittedly, the current implementation is a somewhat
% simplistic and does vety little to catch errors, but it is intended
% for developpers, after all. |\bbl@usehooks| is the commands used by
-% babel to execute hooks defined for an event.
+% babel to execute hooks defined for an event.
+%
% \changes{babel~3.9k}{2014/03/23}{Removed a \cs{newcommand},
% undefined in Plain}
%
@@ -3402,11 +3641,13 @@ help from Bernd Raichle, for which I am grateful.
\@nameuse{bbl@hk@##1}{\@nameuse{bbl@ev@##1@#1}#2}}%
\@nameuse{bbl@ev@#1}}
% \end{macrocode}
+%
% To ensure forward compatibility, arguments in hooks are set
% 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 for some reason).
+%
% \begin{macrocode}
\def\bbl@evargs{,% don't delete the comma
everylanguage=1,loadkernel=1,loadpatterns=1,loadexceptions=1,%
@@ -3418,32 +3659,35 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\babelensure}
%
% The user command just parses the optional argument and creates a
-% new macro named |\bbl@ens@|\m{language}. We register a hook at the
+% new macro named |\bbl@e@|\m{language}. We register a hook at the
% |afterextras| event which just executes this macro in a
% ``complete'' selection (which, if undefined, is |\relax| and does
% nothing). This part is somewhat involved because we have to make
% sure things are expanded the correct number of times.
%
-% The macro |\bbl@ens@|\m{language} contains
-% |\bbl@ensure|\marg{include}\marg{exclude}\marg{fontenc}, which
-% in turn loops over the macros names in |\bbl@ensured|, excluding
+% The macro |\bbl@e@|\m{language} contains
+% |\bbl@ensure|\marg{include}\marg{exclude}\marg{fontenc}, which in in
+% turn loops over the macros names in |\bbl@captionslist|, excluding
% (with the help of |\in@|) those in the |exclude| list. If the
-% |fontenc| is given (and not |\relax|), the |\fontencoding| is
-% also added. Then we loop over the |include| list, but if the
-% macro already contains |\foreignlanguage|, nothing is done.
-% Note this macro (1) is not restricted to the preamble, and (2)
-% changes are local.
+% |fontenc| is given (and not |\relax|), the |\fontencoding| is also
+% added. Then we loop over the |include| list, but if the macro
+% already contains |\foreignlanguage|, nothing is done. Note this
+% macro (1) is not restricted to the preamble, and (2) changes are
+% local.
%
-% |\bbl@ensured| is the list of macros supposed to be ``ensured''.
% \changes{babel~3.9i}{2014/02/14}{Macro \cs{babelensure} added}
% \changes{babel~3.9k}{2014/03/23}{Encapsulate \cs{foreignlanguage} in
% \cs{bbl@ensure@}language, to "protect" strings}
% \changes{babel~3.9s}{2017/04/10}{Bug fix - extra spaces because a
% missing percent}
-% \changes{babel~3.9s}{2017/04/10}{\cs{bbl@ensure@lang} defined only once}
+% \changes{babel~3.9s}{2017/04/10}{\cs{bbl@ensure@lang} defined only
+% once}
+% \changes{babel~3.10}{2017/05/06}{\cs{bbl@ensured} renamed to
+% \cs{bbl@captionslist} (for \cs{babelprovide}), which means
+% \cs{today} must be given explicitly in \cs{babelensure}}
%
% \begin{macrocode}
-\newcommand\babelensure[2][]{%
+\newcommand\babelensure[2][]{% TODO - revise test files
\AddBabelHook{babel-ensure}{afterextras}{%
\ifcase\bbl@select@type
\@nameuse{bbl@e@\languagename}%
@@ -3456,7 +3700,7 @@ help from Bernd Raichle, for which I am grateful.
\ifx\@empty##1\else\noexpand##1\expandafter\bbl@tempb\fi}%
\edef\bbl@tempa{\bbl@tempb#1\@empty}%
\def\bbl@tempb##1=##2\@@{\@namedef{bbl@ens@##1}{##2}}%
- \bbl@for\bbl@tempa\bbl@tempa{\expandafter\bbl@tempb\bbl@tempa\@@}%
+ \bbl@foreach\bbl@tempa{\bbl@tempb##1\@@}%
\def\bbl@tempc{\bbl@ensure}%
\expandafter\bbl@add\expandafter\bbl@tempc\expandafter{%
\expandafter{\bbl@ens@include}}%
@@ -3466,8 +3710,8 @@ help from Bernd Raichle, for which I am grateful.
\bbl@exp{%
\endgroup
\def\<bbl@e@#2>{\the\toks@{\bbl@ens@fontenc}}}}
-\def\bbl@ensure#1#2#3{%
- \def\bbl@tempb##1{% elt for \bbl@ensured list
+\def\bbl@ensure#1#2#3{% 1: include 2: exclude 3: fontenc
+ \def\bbl@tempb##1{% elt for (excluding) \bbl@captionslist list
\ifx##1\@empty\else
\in@{##1}{#2}%
\ifin@\else
@@ -3487,7 +3731,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
\expandafter\bbl@tempb
\fi}%
- \expandafter\bbl@tempb\bbl@ensured\@empty
+ \expandafter\bbl@tempb\bbl@captionslist\today\@empty
\def\bbl@tempa##1{% elt for include list
\ifx##1\@empty\else
\bbl@csarg\in@{ensure@\languagename\expandafter}\expandafter{##1}%
@@ -3497,12 +3741,13 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\bbl@tempa
\fi}%
\bbl@tempa#1\@empty}
-\def\bbl@ensured{%
+\def\bbl@captionslist{%
\prefacename\refname\abstractname\bibname\chaptername\appendixname
\contentsname\listfigurename\listtablename\indexname\figurename
\tablename\partname\enclname\ccname\headtoname\pagename\seename
- \alsoname\proofname\glossaryname\today}
+ \alsoname\proofname\glossaryname}
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Setting up language files}
@@ -3537,7 +3782,8 @@ help from Bernd Raichle, for which I am grateful.
% 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}...}
+% \cs{Babel}...}
+%
% If so, we call |\ldf@quit| to set the main language, restore the
% category code of the @-sign and call |\endinput|
%
@@ -3545,7 +3791,18 @@ help from Bernd Raichle, for which I am grateful.
% compare it with |\relax|.
%
% Finally we check |\originalTeX|.
+%
% \begin{macrocode}
+\def\bbl@ldfinit{%
+ \let\bbl@screset\@empty
+ \let\BabelStrings\bbl@opt@string
+ \let\BabelOptions\@empty
+ \let\BabelLanguages\relax
+ \ifx\originalTeX\@undefined
+ \let\originalTeX\@empty
+ \else
+ \originalTeX
+ \fi}
\def\LdfInit#1#2{%
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
@@ -3561,20 +3818,14 @@ help from Bernd Raichle, for which I am grateful.
\ldf@quit{#1}%
\fi
\fi
- \let\bbl@screset\@empty
- \let\BabelStrings\bbl@opt@strings
- \let\BabelOptions\@empty
- \let\BabelLanguages\relax
- \ifx\originalTeX\@undefined
- \let\originalTeX\@empty
- \else
- \originalTeX
- \fi}
+ \bbl@ldfinit}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\ldf@quit}
% This macro interrupts the processing of a language definition file.
+%
% \begin{macrocode}
\def\ldf@quit#1{%
\expandafter\main@language\expandafter{#1}%
@@ -3582,6 +3833,7 @@ help from Bernd Raichle, for which I am grateful.
\catcode`\==\eqcatcode \let\eqcatcode\relax
\endinput}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\ldf@finish}
@@ -3592,24 +3844,30 @@ help from Bernd Raichle, for which I am grateful.
% the main language (taking into account that the argument might be
% a control sequence that needs to be expanded) and reset the
% category code of the @-sign.
+%
% \changes{babel~3.9a}{2012/10/01}{Added \cs{bbl@afterlang} which
% executes the code delayed with \cs{AfterBabelLanguage}}
+%
% \begin{macrocode}
-\def\ldf@finish#1{%
- \loadlocalcfg{#1}%
+\def\bbl@afterldf#1{%
\bbl@afterlang
\let\bbl@afterlang\relax
\let\BabelModifiers\relax
- \let\bbl@screset\relax
+ \let\bbl@screset\relax}%
+\def\ldf@finish#1{%
+ \loadlocalcfg{#1}%
+ \bbl@afterldf{#1}%
\expandafter\main@language\expandafter{#1}%
\catcode`\@=\atcatcode \let\atcatcode\relax
\catcode`\==\eqcatcode \let\eqcatcode\relax}
% \end{macrocode}
+%
% \end{macro}
%
% After the preamble of the document the commands |\LdfInit|,
% |\ldf@quit| and |\ldf@finish| are no longer needed. Therefore
% they are turned into warning messages in \LaTeX.
+%
% \begin{macrocode}
\@onlypreamble\LdfInit
\@onlypreamble\ldf@quit
@@ -3622,7 +3880,9 @@ help from Bernd Raichle, for which I am grateful.
% files. It stores its argument in |\bbl@main@language|; to be used
% to switch to the correct language at the beginning of the
% document.
+%
% \changes{babel~3.8l}{2008/07/06}{Use \cs{bbl@patterns}}
+%
% \begin{macrocode}
\def\main@language#1{%
\def\bbl@main@language{#1}%
@@ -3632,10 +3892,12 @@ help from Bernd Raichle, for which I am grateful.
%
% We also have to make sure that some code gets executed at the
% beginning of the document.
+%
% \begin{macrocode}
\AtBeginDocument{%
\expandafter\selectlanguage\expandafter{\bbl@main@language}}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -3656,37 +3918,34 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\bbl@add@special}
% The macro |\bbl@add@special| is used to add a new character (or
% single character control sequence) to the macro |\dospecials|
-% (and |\@sanitize| if \LaTeX\ is used).
+% (and |\@sanitize| if \LaTeX\ is used). It is used only at one
+% place, namely when |\initiate@active@char| is called (which is
+% ignored if the char has been made active before). Because
+% |\@sanitize| can be undefined, we put the definition inside a
+% conditional.
%
-% To keep all changes local, we begin a new group. Then we
-% redefine the macros |\do| and |\@makeother| to add themselves and
-% the given character without expansion.
+% Items are added to the lists without checking its existence or
+% the original catcode. It does not hurt, but should be fixed. It's
+% already done with |\nfss@catcodes|, added in 3.10.
+%
+% \changes{3.10}{2017/05/14}{Refactored. Add to \cs{nfss@catcodes} too.}
%
-% To add the character to the macros, we expand the original macros
-% with the additional character inside the redefinition of the
-% macros. Because |\@sanitize| can be undefined, we put the
-% definition inside a conditional.
% \begin{macrocode}
-\def\bbl@add@special#1{%
- \begingroup
- \def\do{\noexpand\do\noexpand}%
- \def\@makeother{\noexpand\@makeother\noexpand}%
- \edef\x{\endgroup
- \def\noexpand\dospecials{\dospecials\do#1}%
- \expandafter\ifx\csname @sanitize\endcsname\relax \else
- \def\noexpand\@sanitize{\@sanitize\@makeother#1}%
- \fi}%
- \x}
+\def\bbl@add@special#1{% 1:a macro like \", \?, etc.
+ \bbl@add\dospecials{\do#1}% test @sanitize = \relax, for back. compat.
+ \bbl@ifunset{@sanitize}{}{\bbl@add\@sanitize{\@makeother#1}}%
+ \ifx\nfss@catcodes\@undefined\else % TODO - same for above
+ \begingroup
+ \catcode`#1\active
+ \nfss@catcodes
+ \ifnum\catcode`#1=\active
+ \endgroup
+ \bbl@add\nfss@catcodes{\@makeother#1}%
+ \else
+ \endgroup
+ \fi
+ \fi}
% \end{macrocode}
-% The macro |\x| contains at this moment the following:\\
-% |\endgroup\def\dospecials{|\textit{old contents}%
-% |\do|\meta{char}|}|.\\
-% If |\@sanitize| is defined, it contains an additional definition
-% of this macro. The last thing we have to do, is the expansion of
-% |\x|. Then |\endgroup| is executed, which restores the old
-% meaning of |\x|, |\do| and |\@makeother|. After the group is
-% closed, the new definition of |\dospecials| (and |\@sanitize|) is
-% assigned.
%
% \end{macro}
%
@@ -3696,16 +3955,6 @@ help from Bernd Raichle, for which I am grateful.
% removes a character from the set macros |\dospecials| and
% |\@sanitize|, but it is not used at all in the \babel{} core.
%
-% To keep all changes local, we begin a new group. Then we define
-% a help macro |\x|, which expands to empty if the characters
-% match, otherwise it expands to its nonexpandable input. Because
-% \TeX\ inserts a |\relax|, if the corresponding |\else| or |\fi|
-% is scanned before the comparison is evaluated, we provide a `stop
-% sign' which should expand to nothing.
-%
-% With the help of this macro we define |\do| and |\make@other|.
-%
-% The rest of the work is similar to |\bbl@add@special|.
% \begin{macrocode}
\def\bbl@remove@special#1{%
\begingroup
@@ -3720,8 +3969,8 @@ help from Bernd Raichle, for which I am grateful.
\fi}%
\x}
% \end{macrocode}
-% \end{macro}
%
+% \end{macro}
%
% \begin{macro}{\initiate@active@char}
% A language definition file can call this macro to make a
@@ -3752,9 +4001,11 @@ help from Bernd Raichle, for which I am grateful.
% The following macro is used to define shorthands in the three
% levels. It takes 4 arguments: the (string'ed) character,
% |\<level>@group|, |<level>@active| and |<next-level>@active|
-% (except in |system|).
+% (except in |system|).
+%
% \changes{babel~3.9a}{2012/08/18}{New macro, with code from
% \cs{@initiate@active@char}}
+%
% \begin{macrocode}
\def\bbl@active@def#1#2#3#4{%
\@namedef{#3#1}{%
@@ -3764,9 +4015,11 @@ help from Bernd Raichle, for which I am grateful.
\bbl@afterfi\csname#2@sh@#1@\endcsname
\fi}%
% \end{macrocode}
+%
% When there is also no current-level shorthand with an argument we
% will check whether there is a next-level defined shorthand for
% this active character.
+%
% \begin{macrocode}
\long\@namedef{#3@arg#1}##1{%
\expandafter\ifx\csname#2@sh@#1@\string##1@\endcsname\relax
@@ -3775,12 +4028,15 @@ help from Bernd Raichle, for which I am grateful.
\bbl@afterfi\csname#2@sh@#1@\string##1@\endcsname
\fi}}%
% \end{macrocode}
+%
% \changes{babel~3.9a}{2012/08/18}{Removed an extra hash. Now calls
% \cs{@initiate@active@char} with 3 arguments.}
+%
% |\initiate@active@char| calls |\@initiate@active@char| with 3
% arguments. All of them are the same character with different
% catcodes: active, other (|\string|'ed) and the original one.
% This trick simplifies the code a lot.
+%
% \begin{macrocode}
\def\initiate@active@char#1{%
\bbl@ifunset{active@char\string#1}%
@@ -3788,6 +4044,7 @@ help from Bernd Raichle, for which I am grateful.
{\expandafter\@initiate@active@char\expandafter}#1\string#1#1}%
{}}
% \end{macrocode}
+%
% \changes{babel~3.9e}{2012/08/18}{Introduced the 3-argument
% \cs{@initiate@active@char}, with different catcodes: active,
% string'ed, and original. Reorganized}
@@ -3796,10 +4053,12 @@ help from Bernd Raichle, for which I am grateful.
% too}
% \changes{babel~3.9a}{2012/12/27}{Take into account mathematically
% active chars, to avoid infinite loops}
+%
% The very first thing to do is saving the original catcode and the
% original definition, even if not active, which is possible
% (undefined characters require a special treatement to avoid
% making them |\relax|).
+%
% \begin{macrocode}
\def\@initiate@active@char#1#2#3{%
\bbl@csarg\edef{oricat@#2}{\catcode`#2=\the\catcode`#2\relax}%
@@ -3812,6 +4071,7 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\noexpand\csname bbl@oridef@@#2\endcsname}%
\fi
% \end{macrocode}
+%
% If the character is already active we provide the default
% expansion under this shorthand mechanism. Otherwise we write a
% message in the transcript file, and define |\normal@char|\m{char}
@@ -3820,6 +4080,7 @@ help from Bernd Raichle, for which I am grateful.
% |'|) the normal expansion is somewhat different to avoid an
% infinite loop (but it does not prevent the loop if the mathcode
% is set to |"8000| \textit{a posteriori}).
+%
% \begin{macrocode}
\ifx#1#3\relax
\expandafter\let\csname normal@char#2\endcsname#3%
@@ -3832,6 +4093,7 @@ help from Bernd Raichle, for which I am grateful.
\@namedef{normal@char#2}{#3}%
\fi
% \end{macrocode}
+%
% To prevent problems with the loading of other packages after
% \babel\ we reset the catcode of the character to the original one
% at the end of the package and of each language file (except with
@@ -3842,6 +4104,7 @@ help from Bernd Raichle, for which I am grateful.
% the printout when a shorthand was used in the optional argument
% of |\bibitem| for example. Then we make it active (not strictly
% necessary, but done for backward compatibility).
+%
% \begin{macrocode}
\bbl@restoreactive{#2}%
\AtBeginDocument{%
@@ -3853,6 +4116,7 @@ help from Bernd Raichle, for which I am grateful.
\catcode`#2\active
\fi
% \end{macrocode}
+%
% Now we have set |\normal@char|\m{char}, we must define
% |\active@char|\m{char}, to be executed when the character is
% activated. We define the first level expansion of
@@ -3861,9 +4125,11 @@ help from Bernd Raichle, for which I am grateful.
% this character, otherwise we call |\user@active|\m{char} to start
% the search of a definition in the user, language and system
% levels (or eventually |normal@char|\m{char}).
+%
% \changes{babel~3.9a}{2012/12/27}{Added code for option math=normal}
% \changes{babel~3.9i}{2014/02/03}{Don't call directly
-% \cs{user@active}, but with an intermediate step}
+% \cs{user@active}, but with an intermediate step}
+%
% \begin{macrocode}
\let\bbl@tempa\@firstoftwo
\if\string^#2%
@@ -3907,18 +4173,22 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\noexpand\csname normal@char#2\endcsname}%
\expandafter\let\expandafter#1\csname bbl@normal@#2\endcsname
% \end{macrocode}
+%
% The next level of the code checks whether a user has defined a
% shorthand for himself with this character. First we check for a
% single character shorthand. If that doesn't exist we check for a
% shorthand with an argument.
+%
% \changes{babel~3.8b}{2004/04/19}{Now use \cs{bbl@sh@select}}
% \changes{babel~3.9a}{2012/08/18}{Instead of the ``copy-paste pattern''
-% a new macro is used}
+% a new macro is used}
+%
% \begin{macrocode}
\bbl@active@def#2\user@group{user@active}{language@active}%
\bbl@active@def#2\language@group{language@active}{system@active}%
\bbl@active@def#2\system@group{system@active}{normal@char}%
% \end{macrocode}
+%
% In order to do the right thing when a shorthand with an argument
% is used by itself at the end of the line we provide a definition
% for the case of an empty argument. For that case we let the
@@ -3926,14 +4196,17 @@ help from Bernd Raichle, for which I am grateful.
% shorthand combination such as |''| ends up in a heading \TeX\
% would see |\protect'\protect'|. To prevent this from happening a
% couple of shorthand needs to be defined at user level.
+%
% \changes{babel~3.9a}{2012/8/18}{Use \cs{user@group}, as above,
% instead of the hardwired \texttt{user}}
+%
% \begin{macrocode}
\expandafter\edef\csname\user@group @sh@#2@@\endcsname
{\expandafter\noexpand\csname normal@char#2\endcsname}%
\expandafter\edef\csname\user@group @sh@#2@\string\protect@\endcsname
{\expandafter\noexpand\csname user@active#2\endcsname}%
% \end{macrocode}
+%
% Finally, a couple of special cases are taken care of. (1) If we
% are making the right quote (|'|) active we need to change |\pr@m@s| as
% well. Also, make sure that a single |'| in math mode `does the
@@ -3956,6 +4229,7 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.9a}{2012/12/29}{Removed the intermediate step of
% \cs{bbl@act@caret} and moved above}
% \changes{babel~3.9i}{2012/12/29}{Added the event \cs{initiateactive}}
+%
% \begin{macrocode}
\if\string'#2%
\let\prim@s\bbl@prim@s
@@ -3966,12 +4240,14 @@ help from Bernd Raichle, for which I am grateful.
%
% The following package options control the behaviour of shorthands
% in math mode.
+%
% \begin{macrocode}
%<<*More package options>>
\DeclareOption{math=active}{}
\DeclareOption{math=normal}{\def\bbl@mathnormal{\noexpand\textormath}}
%<</More package options>>
% \end{macrocode}
+%
% Initiating a shorthand makes active the char. That is not
% strictly necessary but it is still done for backward
% compatibility. So we need to restore the original catcode at the
@@ -3987,13 +4263,14 @@ help from Bernd Raichle, for which I am grateful.
\@ifpackagewith{babel}{KeepShorthandsActive}%
{\let\bbl@restoreactive\@gobble}%
{\def\bbl@restoreactive#1{%
- \edef\bbl@tempa{%
- \noexpand\AfterBabelLanguage\noexpand\CurrentOption
+ \bbl@exp{%
+ \\\AfterBabelLanguage\\\CurrentOption
{\catcode`#1=\the\catcode`#1\relax}%
- \noexpand\AtEndOfPackage{\catcode`#1=\the\catcode`#1\relax}}%
- \bbl@tempa}%
+ \\\AtEndOfPackage
+ {\catcode`#1=\the\catcode`#1\relax}}}%
\AtEndOfPackage{\let\bbl@restoreactive\@gobble}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@sh@select}
@@ -4006,9 +4283,11 @@ help from Bernd Raichle, for which I am grateful.
% argument and a shorthand character in its second argument. It
% will expand to either |\bbl@firstcs| or |\bbl@scndcs|. Hence two
% more arguments need to follow it.
+%
% \changes{babel~3.8b}{2004/04/19}{Added command}
% \changes{babel~3.9a}{2012/08/18}{Removed \cs{string}s, because the
% char are already string'ed}
+%
% \begin{macrocode}
\def\bbl@sh@select#1#2{%
\expandafter\ifx\csname#1@sh@#2@sel\endcsname\relax
@@ -4017,6 +4296,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@afterfi\csname#1@sh@#2@sel\endcsname
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\active@prefix}
@@ -4024,16 +4304,19 @@ help from Bernd Raichle, for which I am grateful.
% active characters has a function similar to |\OT1-cmd| in that it
% |\protect|s the active character whenever |\protect| is
% \emph{not} |\@typeset@protect|.
+%
% \begin{macrocode}
\def\active@prefix#1{%
\ifx\protect\@typeset@protect
\else
% \end{macrocode}
+%
% When |\protect| is set to |\@unexpandable@protect| we make sure
% that the active character is als \emph{not} expanded by inserting
% |\noexpand| in front of it. The |\@gobble| is needed to remove
% a token such as |\activechar:| (when the double colon was the
% active character to be dealt with).
+%
% \begin{macrocode}
\ifx\protect\@unexpandable@protect
\noexpand#1%
@@ -4043,6 +4326,7 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\@gobble
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\if@safe@actives}
@@ -4051,10 +4335,12 @@ help from Bernd Raichle, for which I am grateful.
% switch |@safe@actives| is available. The setting of this switch
% should be checked in the first level expansion of
% |\active@char|\m{char}.
+%
% \begin{macrocode}
\newif\if@safe@actives
\@safe@activesfalse
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@restore@actives}
@@ -4062,20 +4348,25 @@ help from Bernd Raichle, for which I am grateful.
% active characters were made ``safe'' this must be undone in
% the headers to prevent unexpected typeset results. For this
% situation we define a command to make them ``unsafe'' again.
+%
% \begin{macrocode}
\def\bbl@restore@actives{\if@safe@actives\@safe@activesfalse\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@activate}
% \begin{macro}{\bbl@deactivate}
+%
% \changes{babel~3.9a}{2013/01/11}{\cs{bbl@withactive} makes sure the
-% catcode is active}
+% catcode is active}
+%
% Both macros take one argument, like |\initiate@active@char|. The
% macro is used to change the definition of an active character to
% expand to |\active@char|\m{char} in the case of |\bbl@activate|,
% or |\normal@char|\m{char} in the case of
% |\bbl@deactivate|.
+%
% \begin{macrocode}
\def\bbl@activate#1{%
\bbl@withactive{\expandafter\let\expandafter}#1%
@@ -4084,6 +4375,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@withactive{\expandafter\let\expandafter}#1%
\csname bbl@normal@\string#1\endcsname}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -4091,10 +4383,12 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\bbl@scndcs}
% These macros have two arguments. They use one of their arguments
% to build a control sequence from.
+%
% \begin{macrocode}
\def\bbl@firstcs#1#2{\csname#1\endcsname}
\def\bbl@scndcs#1#2{\csname#2\endcsname}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -4108,10 +4402,12 @@ help from Bernd Raichle, for which I am grateful.
% i.e. |~| or |"a|;
% \item the code to be executed when the shorthand is encountered.
% \end{enumerate}
+%
% \changes{babel~3.8b}{2004/04/19}{We need to support shorthands with
% and without argument in different groups; added the name of the
% group to the storage macro}
% \changes{babel~3.9a}{2012/07/03}{Check if shorthands are redefined}
+%
% \begin{macrocode}
\def\declare@shorthand#1#2{\@decl@short{#1}#2\@nil}
\def\@decl@short#1#2#3\@nil#4{%
@@ -4140,14 +4436,17 @@ help from Bernd Raichle, for which I am grateful.
\@namedef{#1@sh@\string#2@\string#3@}{#4}%
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\textormath}
% Some of the shorthands that will be declared by the language
% definition files have to be usable in both text and mathmode. To
% achieve this the helper macro |\textormath| is provided.
+%
% \changes{babel~3.9a}{2012/12/29}{Failed if an argument had a
% condicional. Use the more robust mechanism of \cs{XXXoftwo}}
+%
% \begin{macrocode}
\def\textormath{%
\ifmmode
@@ -4156,6 +4455,7 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\@firstoftwo
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\user@group}
@@ -4166,11 +4466,13 @@ help from Bernd Raichle, for which I am grateful.
% group is stored in a macro. The default is to have a user group;
% use language group `english' and have a system group called
% `system'.
+%
% \begin{macrocode}
\def\user@group{user}
\def\language@group{english}
\def\system@group{system}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
% \end{macro}
@@ -4189,6 +4491,7 @@ help from Bernd Raichle, for which I am grateful.
% the catcode is active, so this part is simplified}
% \changes{babel~3.9a}{2012/08/12}{User shorhands can be
% defined even with shorthands=off}
+%
% \begin{macrocode}
\def\useshorthands{%
\@ifstar\bbl@usesh@s{\bbl@usesh@x{}}}
@@ -4207,13 +4510,16 @@ help from Bernd Raichle, for which I am grateful.
{Sorry, but you cannot use shorthands which have been\\%
turned off in the package options}}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\defineshorthand}
+%
% \changes{babel~3.9a}{2012/08/05}{Added optional argument, to provide
% a way to (re)define language shorthands}
% \changes{babel~3.9a}{2012/08/25}{Extended for language-dependent
% user macros, with two new auxiliary macros}
+%
% Currently we only support two groups of user level shorthands,
% named internally |user| and |user@<lang>| (language-dependent
% user shorthands). By default, only the first one is taken into
@@ -4222,6 +4528,7 @@ help from Bernd Raichle, for which I am grateful.
% (|user@generic|, done by |\bbl@set@user@generic|); we make also
% sure |{}| and |\protect| are taken into account in this new top
% level.
+%
% \begin{macrocode}
\def\user@language@group{user@\language@group}
\def\bbl@set@user@generic#1#2{%
@@ -4243,6 +4550,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
\declare@shorthand{\bbl@tempb}{#2}{#3}}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\languageshorthands}
@@ -4250,13 +4558,16 @@ help from Bernd Raichle, for which I am grateful.
% are used. Unfortunately, \babel{} currently does not keep track
% of defined groups, and therefore there is no way to catch a
% possible change in casing.
+%
% \begin{macrocode}
\def\languageshorthands#1{\def\language@group{#1}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\aliasshorthand}
% First the new shorthand needs to be initialized,
+%
% \begin{macrocode}
\def\aliasshorthand#1#2{%
\bbl@ifshorthand{#2}%
@@ -4266,15 +4577,18 @@ help from Bernd Raichle, for which I am grateful.
\else
\initiate@active@char{#2}%
% \end{macrocode}
+%
% \changes{babel~3.9a}{2012/08/06}{Instead of letting the new shorthand to
% the original char, which very often didn't work, we define it
% directly}
% \changes{babel~3.9a}{2012/08/20}{Make sure both characters (old an
% new) are active}
+%
% Then, we define the new shorthand in terms of the original
% one, but note with |\aliasshorthands{"}{/}| is
% |\active@prefix /\active@char/|, so we still need to let the
% lattest to |\active@char"|.
+%
% \begin{macrocode}
\expandafter\let\csname active@char\string#2\expandafter\endcsname
\csname active@char\string#1\endcsname
@@ -4288,9 +4602,11 @@ help from Bernd Raichle, for which I am grateful.
{Sorry, but you cannot use shorthands which have been\\%
turned off in the package options}}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\@notshorthand}
+%
% \changes{v3.8d}{2004/11/20}{Error message added}
%
% \begin{macrocode}
@@ -4302,6 +4618,7 @@ help from Bernd Raichle, for which I am grateful.
I will ignore your instruction}%
{You may proceed, but expect unexpected results}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\shorthandon}
@@ -4309,6 +4626,7 @@ help from Bernd Raichle, for which I am grateful.
% The first level definition of these macros just passes the
% argument on to |\bbl@switch@sh|, adding |\@nil| at the end to
% denote the end of the list of characters.
+%
% \begin{macrocode}
\newcommand*\shorthandon[1]{\bbl@switch@sh\@ne#1\@nnil}
\DeclareRobustCommand*\shorthandoff{%
@@ -4317,7 +4635,9 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% \begin{macro}{\bbl@switch@sh}
-% \changes{babel~3.9a}{2013/02/21}{Code revised}
+%
+% \changes{babel~3.9a}{2013/02/21}{Code revised}
+%
% The macro |\bbl@switch@sh| takes the list of characters apart one
% by one and subsequently switches the category code of the
% shorthand character according to the first argument of
@@ -4352,6 +4672,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@afterfi\bbl@switch@sh#1%
\fi}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
% \end{macro}
@@ -4360,6 +4681,7 @@ help from Bernd Raichle, for which I am grateful.
%
% Note the value is that at the expansion time, eg, in the preample
% shorhands are usually deactivated.
+%
% \begin{macrocode}
\def\babelshorthand{\active@prefix\babelshorthand\bbl@putsh}
\def\bbl@putsh#1{%
@@ -4392,14 +4714,17 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macro}{\bbl@prim@s}
% \begin{macro}{\bbl@pr@m@s}
+%
% \changes{babel~3.9a}{2012/07/29}{\cs{bbl@pr@m@s} rewritten to
% take into account catcodes for both the quote and the hat}
+%
% One of the internal macros that are involved in substituting
% |\prime| for each right quote in mathmode is |\prim@s|. This
% checks if the next character is a right quote. When the right
% quote is active, the definition of this macro needs to be adapted
% to look also for an active right quote; the hat could be active,
% too.
+%
% \begin{macrocode}
\def\bbl@prim@s{%
\prime\futurelet\@let@token\bbl@pr@m@s}
@@ -4421,6 +4746,7 @@ help from Bernd Raichle, for which I am grateful.
{\bbl@if@primes*^\pr@@@t\egroup}}}
\endgroup
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -4433,9 +4759,11 @@ help from Bernd Raichle, for which I am grateful.
% and in some cases is inconvenient (if |~| has been redefined);
% however, for backward compatibility it is maintained (some
% existing documents may rely on the \babel{} value).
+%
% \changes{babel~3.9i}{2014/02/06}{Moved from above, after
% \cs{bbl@usehook} has been defined}
% \changes{babel~3.9k}{2014/02/06}{Moved again at the original place}
+%
% \begin{macrocode}
\initiate@active@char{~}
\declare@shorthand{system}{~}{\leavevmode\nobreak\ }
@@ -4448,17 +4776,21 @@ help from Bernd Raichle, for which I am grateful.
% OT1 and T1 encodings. It will later be selected using the
% |\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}
\expandafter\def\csname T1dqpos\endcsname{4}
% \end{macrocode}
+%
% When the macro |\f@encoding| is undefined (as it is in plain
% \TeX) we define it here to expand to \texttt{OT1}
+%
% \begin{macrocode}
\ifx\f@encoding\@undefined
\def\f@encoding{OT1}
\fi
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -4468,68 +4800,83 @@ help from Bernd Raichle, for which I am grateful.
% which features of the language definition files he wants to
% enable.
% \begin{macro}{\languageattribute}
-% \changes{babel~3.9a}{2012/09/07}{Use \cs{@expandtwoargs} with \cs{in@}}
+%
+% \changes{babel~3.9a}{2012/09/07}{Use \cs{@expandtwoargs} with
+% \cs{in@}}
+%
% The macro |\languageattribute| checks whether its arguments are
% valid and then activates the selected language attribute.
% First check whether the language is known, and then process each
% attribute in the list.
+%
% \begin{macrocode}
\newcommand\languageattribute[2]{%
\def\bbl@tempc{#1}%
\bbl@fixname\bbl@tempc
\bbl@iflanguage\bbl@tempc{%
- \bbl@loopx\bbl@attr{#2}{%
+ \bbl@vforeach{#2}{%
% \end{macrocode}
+%
% We want to make sure that each attribute is selected only once;
% 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}
\ifx\bbl@known@attribs\@undefined
\in@false
\else
% \end{macrocode}
+%
% Now we need to see if the attribute occurs in the list of
% already selected attributes.
+%
% \begin{macrocode}
- \@expandtwoargs\in@{,\bbl@tempc-\bbl@attr,}{,\bbl@known@attribs,}%
+ \@expandtwoargs\in@{,\bbl@tempc-##1,}{,\bbl@known@attribs,}%
\fi
% \end{macrocode}
+%
% When the attribute was in the list we issue a warning; this might
% not be the users intention.
+%
% \begin{macrocode}
\ifin@
\bbl@warning{%
- You have more than once selected the attribute '\bbl@attr'\\%
+ You have more than once selected the attribute '##1'\\%
for language #1}%
\else
% \end{macrocode}
+%
% When we end up here the attribute is not selected before. So, we
% add it to the list of selected attributes and execute the
% associated \TeX-code.
+%
% \begin{macrocode}
- \edef\bbl@tempa{%
- \noexpand\bbl@add@list
- \noexpand\bbl@known@attribs{\bbl@tempc-\bbl@attr}}%
- \bbl@tempa
- \edef\bbl@tempa{\bbl@tempc-\bbl@attr}%
+ \bbl@exp{%
+ \\\bbl@add@list\\\bbl@known@attribs{\bbl@tempc-##1}}%
+ \edef\bbl@tempa{\bbl@tempc-##1}%
\expandafter\bbl@ifknown@ttrib\expandafter{\bbl@tempa}\bbl@attributes%
- {\csname\bbl@tempc @attr@\bbl@attr\endcsname}%
- {\@attrerr{\bbl@tempc}{\bbl@attr}}%
+ {\csname\bbl@tempc @attr@##1\endcsname}%
+ {\@attrerr{\bbl@tempc}{##1}}%
\fi}}}
% \end{macrocode}
+%
% This command should only be used in the preamble of a document.
+%
% \begin{macrocode}
\@onlypreamble\languageattribute
% \end{macrocode}
+%
% The error text to be issued when an unknown attribute is
% selected.
+%
% \begin{macrocode}
\newcommand*{\@attrerr}[2]{%
\bbl@error
{The attribute #2 is unknown for language #1.}%
{Your command will be ignored, type <return> to proceed}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@declare@ttribute}
@@ -4541,6 +4888,7 @@ help from Bernd Raichle, for which I am grateful.
% that the macro |\extras...| for the current language is extended,
% otherwise the attribute will not work as its code is removed from
% memory at |\begin{document}|.
+%
% \begin{macrocode}
\def\bbl@declare@ttribute#1#2#3{%
\@expandtwoargs\in@{,#2,}{,\BabelModifiers,}%
@@ -4550,6 +4898,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@add@list\bbl@attributes{#1-#2}%
\expandafter\def\csname#1@attr@#2\endcsname{#3}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@ifattributeset}
@@ -4562,24 +4911,31 @@ help from Bernd Raichle, for which I am grateful.
% The first argument is the language, the second argument the
% attribute being checked, and the third and fourth arguments are
% the true and false clauses.
+%
% \begin{macrocode}
\def\bbl@ifattributeset#1#2#3#4{%
% \end{macrocode}
+%
% First we need to find out if any attributes were set; if not
% we're done.
+%
% \begin{macrocode}
\ifx\bbl@known@attribs\@undefined
\in@false
\else
% \end{macrocode}
+%
% The we need to check the list of known attributes.
+%
% \begin{macrocode}
\@expandtwoargs\in@{,#1-#2,}{,\bbl@known@attribs,}%
\fi
% \end{macrocode}
+%
% When we're this far |\ifin@| has a value indicating if the
% attribute in question was set or not. Just to be safe the code to
% be executed is `thrown over the |\fi|'.
+%
% \begin{macrocode}
\ifin@
\bbl@afterelse#3%
@@ -4588,6 +4944,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@ifknown@ttrib}
@@ -4595,36 +4952,47 @@ help from Bernd Raichle, for which I am grateful.
% known. The macro takes 4 arguments, the language/attribute, the
% attribute list, the \TeX-code to be executed when the attribute
% is known and the \TeX-code to be executed otherwise.
+%
% \begin{macrocode}
\def\bbl@ifknown@ttrib#1#2{%
% \end{macrocode}
+%
% We first assume the attribute is unknown.
+%
% \begin{macrocode}
\let\bbl@tempa\@secondoftwo
% \end{macrocode}
+%
% Then we loop over the list of known attributes, trying to find a
% match.
+%
% \begin{macrocode}
\bbl@loopx\bbl@tempb{#2}{%
\expandafter\in@\expandafter{\expandafter,\bbl@tempb,}{,#1,}%
\ifin@
% \end{macrocode}
+%
% When a match is found the definition of |\bbl@tempa| is changed.
+%
% \begin{macrocode}
\let\bbl@tempa\@firstoftwo
\else
\fi}%
% \end{macrocode}
+%
% Finally we execute |\bbl@tempa|.
+%
% \begin{macrocode}
\bbl@tempa
}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@clear@ttribs}
% This macro removes all the attribute code from \LaTeX's memory at
% |\begin{document}| time (if any is present).
+%
% \begin{macrocode}
\def\bbl@clear@ttribs{%
\ifx\bbl@attributes\@undefined\else
@@ -4637,6 +5005,7 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\let\csname#1@attr@#2\endcsname\@undefined}
\AtBeginDocument{\bbl@clear@ttribs}
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Support for saving macro definitions}
@@ -4656,14 +5025,18 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\babel@beginsave}
% The initialization of a new save cycle: reset the counter to
% zero.
+%
% \begin{macrocode}
\def\babel@beginsave{\babel@savecnt\z@}
% \end{macrocode}
+%
% Before it's forgotten, allocate the counter and initialize all.
+%
% \begin{macrocode}
\newcount\babel@savecnt
\babel@beginsave
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -4675,31 +5048,30 @@ help from Bernd Raichle, for which I am grateful.
% To do this, we let the current meaning to a temporary control
% sequence, the restore commands are appended to |\originalTeX| and
% the counter is incremented.
+%
% \begin{macrocode}
\def\babel@save#1{%
\expandafter\let\csname babel@\number\babel@savecnt\endcsname#1\relax
- \begingroup
- \toks@\expandafter{\originalTeX\let#1=}%
- \edef\x{\endgroup
- \def\noexpand\originalTeX{\the\toks@ \expandafter\noexpand
- \csname babel@\number\babel@savecnt\endcsname\relax}}%
- \x
+ \toks@\expandafter{\originalTeX\let#1=}%
+ \bbl@exp{%
+ \def\\\originalTeX{\the\toks@\<babel@\number\babel@savecnt>\relax}}%
\advance\babel@savecnt\@ne}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\babel@savevariable}
-% \changes{babel~3.2}{1991/11/10}{Added macro}
+%
% The macro |\babel@savevariable|\meta{variable} saves the value of
% the variable. \meta{variable} can be anything allowed after the
% |\the| primitive.
+%
% \begin{macrocode}
-\def\babel@savevariable#1{\begingroup
- \toks@\expandafter{\originalTeX #1=}%
- \edef\x{\endgroup
- \def\noexpand\originalTeX{\the\toks@ \the#1\relax}}%
- \x}
+\def\babel@savevariable#1{%
+ \toks@\expandafter{\originalTeX #1=}%
+ \bbl@exp{\def\\\originalTeX{\the\toks@\the#1\relax}}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@frenchspacing}
@@ -4708,6 +5080,7 @@ help from Bernd Raichle, for which I am grateful.
% don't want that. The command |\bbl@frenchspacing| switches it on
% when it isn't already in effect and |\bbl@nonfrenchspacing|
% switches it off if necessary.
+%
% \begin{macrocode}
\def\bbl@frenchspacing{%
\ifnum\the\sfcode`\.=\@m
@@ -4718,6 +5091,7 @@ help from Bernd Raichle, for which I am grateful.
\fi}
\let\bbl@nonfrenchspacing\nonfrenchspacing
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -4727,7 +5101,8 @@ help from Bernd Raichle, for which I am grateful.
% This macro is straightforward. After zapping spaces, we
% loop over the list and define the macros |\text|\m{tag} and
% |\|\m{tag}. Definitions are first expanded so that they don't
-% contain |\csname| but the actual macro.
+% contain |\csname| but the actual macro.
+%
% \changes{babel~3.9i}{2014/02/21}{Macro \cs{babeltags} added}
%
% \begin{macrocode}
@@ -4746,6 +5121,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@for\bbl@tempa\bbl@tempa{%
\expandafter\bbl@tempb\bbl@tempa\@@}}
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Hyphens}
@@ -4757,6 +5133,7 @@ help from Bernd Raichle, for which I am grateful.
% |\bbl@hyphenation<lang>| for language ones. See |\bbl@patterns|
% above for further details. We make sure there is a space between
% words when multiple commands are used.
+%
% \changes{babel~3.9a}{2012/08/28}{Macro added}
%
% \begin{macrocode}
@@ -4775,8 +5152,8 @@ help from Bernd Raichle, for which I am grateful.
\ifx\@empty#1%
\protected@edef\bbl@hyphenation@{\bbl@hyphenation@\space#2}%
\else
- \edef\bbl@tempb{\zap@space#1 \@empty}%
- \bbl@for\bbl@tempa\bbl@tempb{%
+ \bbl@vforeach{#1}{%
+ \def\bbl@tempa{##1}%
\bbl@fixname\bbl@tempa
\bbl@iflanguage\bbl@tempa{%
\bbl@csarg\protected@edef{hyphenation@\bbl@tempa}{%
@@ -4786,6 +5163,7 @@ help from Bernd Raichle, for which I am grateful.
#2}}}%
\fi}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@allowhyphens}
@@ -4807,10 +5185,12 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@t@one{T1}
\def\allowhyphens{\ifx\cf@encoding\bbl@t@one\else\bbl@allowhyphens\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \changes{babel-3.9a}{2012/08/27}{Added \cs{babelhyphen} and related
% macros}
+%
% \begin{macro}{\babelhyphen}
%
% Macros to insert common hyphens. Note the space before |@| in
@@ -4882,15 +5262,18 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@hy@empty{\hskip\z@skip}
\def\bbl@hy@@empty{\discretionary{}{}{}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@disc}
% For some languages the macro |\bbl@disc| is used to ease the
% insertion of discretionaries for letters that behave `abnormally'
% at a breakpoint.
+%
% \begin{macrocode}
\def\bbl@disc#1#2{\nobreak\discretionary{#2-}{}{#1}\bbl@allowhyphens}
% \end{macrocode}
+%
% \end{macro}
% \subsection{Multiencoding strings}
%
@@ -4907,6 +5290,7 @@ help from Bernd Raichle, for which I am grateful.
%
% But first, a couple of tools. The first one makes global a local
% variable. This is not the best solution, but it works.
+%
% \begin{macrocode}
\def\bbl@toglobal#1{\global\let#1#1}
\def\bbl@recatcode#1{%
@@ -4934,8 +5318,10 @@ help from Bernd Raichle, for which I am grateful.
% \let\bbl@tolower\@empty\bbl@toupper\@empty
% \end{verbatim}
% and starts over (and similarly when lowercasing).
+%
% \changes{babel~3.9l}{2014/07/29}{Now tries to catch the parsing
% macro. Removed some redundant code. Option |nocase|.}
+%
% \begin{macrocode}
\@ifpackagewith{babel}{nocase}%
{\let\bbl@patchuclc\relax}%
@@ -4974,10 +5360,12 @@ help from Bernd Raichle, for which I am grateful.
% 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.
+%
% \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}
\@onlypreamble\StartBabelCommands
\def\StartBabelCommands{%
@@ -5012,6 +5400,7 @@ help from Bernd Raichle, for which I am grateful.
\edef\bbl@G{\zap@space#2 \@empty}%
\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,
@@ -5028,6 +5417,7 @@ 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.}
% \changes{babel~3.9h}{2013/11/08}{Tidied up code related to
@@ -5050,7 +5440,7 @@ help from Bernd Raichle, for which I am grateful.
\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}%
+ \bbl@vforeach{label=#1}{\bbl@tempa##1\@nil}%
\def\bbl@tempa##1 ##2{% space -> comma
##1%
\ifx\@empty##2\else\ifx,##1,\else,\fi\bbl@afterfi\bbl@tempa##2\fi}%
@@ -5058,13 +5448,13 @@ help from Bernd Raichle, for which I am grateful.
\edef\bbl@sc@label{\expandafter\zap@space\bbl@sc@label\@empty}%
\edef\bbl@sc@charset{\expandafter\zap@space\bbl@sc@charset\@empty}%
\def\bbl@encstring##1##2{%
- \bbl@for\bbl@tempc\bbl@sc@fontenc{%
- \bbl@ifunset{T@\bbl@tempc}%
+ \bbl@foreach\bbl@sc@fontenc{%
+ \bbl@ifunset{T@####1}%
{}%
- {\ProvideTextCommand##1\bbl@tempc{##2}%
+ {\ProvideTextCommand##1{####1}{##2}%
\bbl@toglobal##1%
\expandafter
- \bbl@toglobal\csname\bbl@tempc\string##1\endcsname}}}%
+ \bbl@toglobal\csname####1\string##1\endcsname}}}%
\def\bbl@sctest{%
\@expandtwoargs
\in@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}}%
@@ -5148,6 +5538,7 @@ 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.}
%
@@ -5156,7 +5547,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@forlang\bbl@tempa{%
\edef\bbl@LC{\bbl@tempa\bbl@stripslash#1}%
\bbl@ifunset{\bbl@LC}% eg, \germanchaptername
- {\global\expandafter
+ {\global\expandafter % TODO - con \bbl@exp ?
\bbl@add\csname\bbl@G\bbl@tempa\expandafter\endcsname\expandafter
{\expandafter\bbl@scset\expandafter#1\csname\bbl@LC\endcsname}}%
{}%
@@ -5214,10 +5605,9 @@ help from Bernd Raichle, for which I am grateful.
\bbl@loop\bbl@tempa{##2}{% empty items and spaces are ok
\advance\count@\@ne
\toks@\expandafter{\bbl@tempa}%
- \edef\bbl@tempb{%
- \bbl@templ{\romannumeral\count@}{\the\toks@}%
- \count@=\the\count@\relax}%
- \expandafter\SetString\bbl@tempb}}%
+ \bbl@exp{%
+ \\\SetString\bbl@templ{\romannumeral\count@}{\the\toks@}%
+ \count@=\the\count@\relax}}}%
%<</Macros local to BabelCommands>>
% \end{macrocode}
%
@@ -5238,6 +5628,7 @@ help from Bernd Raichle, for which I am grateful.
%
% \changes{babel~3.9h}{2013/11/08}{Use \cs{bbl@encstrings} - they
% should be defined always, even if no `strings'}
+%
% \begin{macrocode}
%<<*Macros local to BabelCommands>>
\newcommand\SetCase[3][]{%
@@ -5299,13 +5690,16 @@ help from Bernd Raichle, for which I am grateful.
% The following package options control the behaviour of
% hyphenation mapping.
%
+% \changes{babel~3.9t}{2017/04/28}{Renamed \cs{bbl@hymapopt} to
+% \cs{bbl@opt@hyphenmap} for consistency}
+%
% \begin{macrocode}
%<<*More package options>>
-\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}
+\DeclareOption{hyphenmap=off}{\chardef\bbl@opt@hyphenmap\z@}
+\DeclareOption{hyphenmap=first}{\chardef\bbl@opt@hyphenmap\@ne}
+\DeclareOption{hyphenmap=select}{\chardef\bbl@opt@hyphenmap\tw@}
+\DeclareOption{hyphenmap=other}{\chardef\bbl@opt@hyphenmap\thr@@}
+\DeclareOption{hyphenmap=other*}{\chardef\bbl@opt@hyphenmap4\relax}
%<</More package options>>
% \end{macrocode}
%
@@ -5314,9 +5708,9 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\AtEndOfPackage{%
- \ifx\bbl@hymapopt\@undefined
+ \ifx\bbl@opt@hyphenmap\@undefined
\@expandtwoargs\in@{,}{\bbl@language@opts}%
- \chardef\bbl@hymapopt\ifin@4\else\@ne\fi
+ \chardef\bbl@opt@hyphenmap\ifin@4\else\@ne\fi
\fi}
% \end{macrocode}
%
@@ -5325,22 +5719,26 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\set@low@box}
% The following macro is used to lower quotes to the same level as
% the comma. It prepares its argument in box register~0.
+%
% \begin{macrocode}
\def\set@low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}%
\dimen\z@\ht\z@ \advance\dimen\z@ -\ht\tw@%
\setbox\z@\hbox{\lower\dimen\z@ \box\z@}\ht\z@\ht\tw@ \dp\z@\dp\tw@}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\save@sf@q}
% The macro |\save@sf@q| is used to save and reset the current
% space factor.
+%
% \begin{macrocode}
\def\save@sf@q#1{\leavevmode
\begingroup
\edef\@SF{\spacefactor\the\spacefactor}#1\@SF
\endgroup}
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Making glyphs available}
@@ -5357,38 +5755,47 @@ help from Bernd Raichle, for which I am grateful.
% |\quotedblbase|. In the \texttt{OT1} encoding it is not
% available, therefore we make it available by lowering the normal
% open quote character to the baseline.
+%
% \begin{macrocode}
\ProvideTextCommand{\quotedblbase}{OT1}{%
\save@sf@q{\set@low@box{\textquotedblright\/}%
\box\z@\kern-.04em\bbl@allowhyphens}}
% \end{macrocode}
+%
% Make sure that when an encoding other than \texttt{OT1} or
% \texttt{T1} is used this glyph can still be typeset.
+%
% \begin{macrocode}
\ProvideTextCommandDefault{\quotedblbase}{%
\UseTextSymbol{OT1}{\quotedblbase}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\quotesinglbase}
% We also need the single quote character at the baseline.
+%
% \begin{macrocode}
\ProvideTextCommand{\quotesinglbase}{OT1}{%
\save@sf@q{\set@low@box{\textquoteright\/}%
\box\z@\kern-.04em\bbl@allowhyphens}}
% \end{macrocode}
+%
% Make sure that when an encoding other than \texttt{OT1} or
% \texttt{T1} is used this glyph can still be typeset.
+%
% \begin{macrocode}
\ProvideTextCommandDefault{\quotesinglbase}{%
\UseTextSymbol{OT1}{\quotesinglbase}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\guillemotleft}
% \begin{macro}{\guillemotright}
% The guillemet characters are not available in \texttt{OT1}
% encoding. They are faked.
+%
% \begin{macrocode}
\ProvideTextCommand{\guillemotleft}{OT1}{%
\ifmmode
@@ -5405,14 +5812,17 @@ help from Bernd Raichle, for which I am grateful.
\raise.2ex\hbox{$\scriptscriptstyle\gg$}\bbl@allowhyphens}%
\fi}
% \end{macrocode}
+%
% Make sure that when an encoding other than \texttt{OT1} or
% \texttt{T1} is used these glyphs can still be typeset.
+%
% \begin{macrocode}
\ProvideTextCommandDefault{\guillemotleft}{%
\UseTextSymbol{OT1}{\guillemotleft}}
\ProvideTextCommandDefault{\guillemotright}{%
\UseTextSymbol{OT1}{\guillemotright}}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -5420,6 +5830,7 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\guilsinglright}
% The single guillemets are not available in \texttt{OT1}
% encoding. They are faked.
+%
% \begin{macrocode}
\ProvideTextCommand{\guilsinglleft}{OT1}{%
\ifmmode
@@ -5436,18 +5847,20 @@ help from Bernd Raichle, for which I am grateful.
\raise.2ex\hbox{$\scriptscriptstyle>$}\bbl@allowhyphens}%
\fi}
% \end{macrocode}
+%
% Make sure that when an encoding other than \texttt{OT1} or
% \texttt{T1} is used these glyphs can still be typeset.
+%
% \begin{macrocode}
\ProvideTextCommandDefault{\guilsinglleft}{%
\UseTextSymbol{OT1}{\guilsinglleft}}
\ProvideTextCommandDefault{\guilsinglright}{%
\UseTextSymbol{OT1}{\guilsinglright}}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
-%
% \subsubsection{Letters}
%
% \begin{macro}{\ij}
@@ -5455,8 +5868,10 @@ help from Bernd Raichle, for which I am grateful.
% The dutch language uses the letter `ij'. It is available in
% \texttt{T1} encoded fonts, but not in the \texttt{OT1} encoded
% fonts. Therefore we fake it for the \texttt{OT1} encoding.
+%
% \changes{babel~3.9a}{2012/07/28}{Removed the first \cs{allowhyphens}.
% Moved the second one just after the kern.}
+%
% \begin{macrocode}
\DeclareTextCommand{\ij}{OT1}{%
i\kern-0.02em\bbl@allowhyphens j}
@@ -5465,14 +5880,17 @@ help from Bernd Raichle, for which I am grateful.
\DeclareTextCommand{\ij}{T1}{\char188}
\DeclareTextCommand{\IJ}{T1}{\char156}
% \end{macrocode}
+%
% Make sure that when an encoding other than \texttt{OT1} or
% \texttt{T1} is used these glyphs can still be typeset.
+%
% \begin{macrocode}
\ProvideTextCommandDefault{\ij}{%
\UseTextSymbol{OT1}{\ij}}
\ProvideTextCommandDefault{\IJ}{%
\UseTextSymbol{OT1}{\IJ}}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -5485,6 +5903,7 @@ help from Bernd Raichle, for which I am grateful.
% Some code to construct these glyphs for the \texttt{OT1} encoding
% was made available to me by Stipcevic Mario,
% (\texttt{stipcevic@olimp.irb.hr}).
+%
% \begin{macrocode}
\def\crrtic@{\hrule height0.1ex width0.3em}
\def\crttic@{\hrule height0.1ex width0.33em}
@@ -5506,14 +5925,17 @@ help from Bernd Raichle, for which I am grateful.
\DeclareTextCommand{\dj}{OT1}{\ddj@ d}
\DeclareTextCommand{\DJ}{OT1}{\DDJ@ D}
% \end{macrocode}
+%
% Make sure that when an encoding other than \texttt{OT1} or
% \texttt{T1} is used these glyphs can still be typeset.
+%
% \begin{macrocode}
\ProvideTextCommandDefault{\dj}{%
\UseTextSymbol{OT1}{\dj}}
\ProvideTextCommandDefault{\DJ}{%
\UseTextSymbol{OT1}{\DJ}}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -5521,10 +5943,12 @@ help from Bernd Raichle, for which I am grateful.
% For the \texttt{T1} encoding |\SS| is defined and selects a
% specific glyph from the font, but for other encodings it is not
% available. Therefore we make it available here.
+%
% \begin{macrocode}
\DeclareTextCommand{\SS}{OT1}{SS}
\ProvideTextCommandDefault{\SS}{\UseTextSymbol{OT1}{\SS}}
% \end{macrocode}
+%
% \end{macro}
%
% \subsubsection{Shorthands for quotation marks}
@@ -5534,9 +5958,12 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macro}{\glq}
% \begin{macro}{\grq}
+%
% \changes{babel~3.8b}{2004/05/02}{Made \cs{glq} fontencoding
-% dependent as well}
+% dependent as well}
+%
% The `german' single quotes.
+%
% \begin{macrocode}
\ProvideTextCommand{\glq}{OT1}{%
\textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
@@ -5544,8 +5971,10 @@ help from Bernd Raichle, for which I am grateful.
\textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
\ProvideTextCommandDefault{\glq}{\UseTextSymbol{OT1}\glq}
% \end{macrocode}
+%
% The definition of |\grq| depends on the fontencoding. With
% \texttt{T1} encoding no extra kerning is needed.
+%
% \begin{macrocode}
\ProvideTextCommand{\grq}{T1}{%
\textormath{\textquoteleft}{\mbox{\textquoteleft}}}
@@ -5555,14 +5984,18 @@ help from Bernd Raichle, for which I am grateful.
\kern.07em\relax}}
\ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
% \begin{macro}{\glqq}
% \begin{macro}{\grqq}
+%
% \changes{babel~3.8b}{2004/05/02}{Made \cs{grqq} fontencoding
-% dependent as well}
+% dependent as well}
+%
% The `german' double quotes.
+%
% \begin{macrocode}
\ProvideTextCommand{\glqq}{OT1}{%
\textormath{\quotedblbase}{\mbox{\quotedblbase}}}
@@ -5570,8 +6003,10 @@ help from Bernd Raichle, for which I am grateful.
\textormath{\quotedblbase}{\mbox{\quotedblbase}}}
\ProvideTextCommandDefault{\glqq}{\UseTextSymbol{OT1}\glqq}
% \end{macrocode}
+%
% The definition of |\grqq| depends on the % fontencoding. With
% \texttt{T1} encoding no extra kerning is needed.
+%
% \begin{macrocode}
\ProvideTextCommand{\grqq}{T1}{%
\textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
@@ -5581,14 +6016,18 @@ help from Bernd Raichle, for which I am grateful.
\kern.07em\relax}}
\ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
% \begin{macro}{\flq}
% \begin{macro}{\frq}
+%
% \changes{babel~3.8b}{2004/05/02}{Made \cs{flq} and \cs{frq}
-% fontencoding dependent}
+% fontencoding dependent}
+%
% The `french' single guillemets.
+%
% \begin{macrocode}
\ProvideTextCommand{\flq}{OT1}{%
\textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
@@ -5604,14 +6043,18 @@ help from Bernd Raichle, for which I am grateful.
\textormath{\guilsinglright}{\mbox{\guilsinglright}}}
\ProvideTextCommandDefault{\frq}{\UseTextSymbol{OT1}\frq}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
% \begin{macro}{\flqq}
% \begin{macro}{\frqq}
+%
% \changes{babel~3.8b}{2004/05/02}{Made \cs{flqq} and \cs{frqq}
-% fontencoding dependent}
+% fontencoding dependent}
+%
% The `french' double guillemets.
+%
% \begin{macrocode}
\ProvideTextCommand{\flqq}{OT1}{%
\textormath{\guillemotleft}{\mbox{\guillemotleft}}}
@@ -5627,6 +6070,7 @@ help from Bernd Raichle, for which I am grateful.
\textormath{\guillemotright}{\mbox{\guillemotright}}}
\ProvideTextCommandDefault{\frqq}{\UseTextSymbol{OT1}\frqq}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -5640,12 +6084,15 @@ help from Bernd Raichle, for which I am grateful.
% always placed in the lower position.
%
% \begin{macro}{\umlauthigh}
+%
% \changes{v3.8a}{2004/02/19}{Use \cs{leavevmode}\cs{bgroup} to
% prevent problems when this command occurs in vertical mode.}
+%
% \begin{macro}{\umlautlow}
% To be able to provide both positions of |\"| we provide two
% commands to switch the positioning, the default will be
% |\umlauthigh| (the normal positioning).
+%
% \begin{macrocode}
\def\umlauthigh{%
\def\bbl@umlauta##1{\leavevmode\bgroup%
@@ -5658,6 +6105,7 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@umlaute{\protect\lower@umlaut}}
\umlauthigh
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -5667,17 +6115,20 @@ help from Bernd Raichle, for which I am grateful.
%
% We want the umlaut character lowered, nearer to the letter. To do
% this we need an extra \meta{dimen} register.
+%
% \begin{macrocode}
\expandafter\ifx\csname U@D\endcsname\relax
\csname newdimen\endcsname\U@D
\fi
% \end{macrocode}
+%
% The following code fools \TeX's \texttt{make\_accent} procedure
% about the current x-height of the font to force another placement
% of the umlaut character.
% First we have to save the current x-height of the font, because
% we'll change this font dimension and this is always done
% globally.
+%
% \changes{v3.8a}{2004/02/19}{Use \cs{leavevmode}\cs{bgroup} to
% prevent problems when this command occurs in vertical mode.}
%
@@ -5688,6 +6139,7 @@ help from Bernd Raichle, for which I am grateful.
% If the new x-height is too low, it is not changed.
% Finally we call the |\accent| primitive, reset the old x-height
% and insert the base character in the argument.
+%
% \begin{macrocode}
\def\lower@umlaut#1{%
\leavevmode\bgroup
@@ -5700,6 +6152,7 @@ help from Bernd Raichle, for which I am grateful.
\fontdimen5\font\U@D #1%
\egroup}
% \end{macrocode}
+%
% \end{macro}
%
% For all vowels we declare |\"| to be a composite command which
@@ -5713,6 +6166,7 @@ help from Bernd Raichle, for which I am grateful.
% redefine |\bbl@umlauta| and/or |\bbl@umlaute| for a language
% in the corresponding |ldf| (using the babel switching mechanism,
% of course).
+%
% \begin{macrocode}
\AtBeginDocument{%
\DeclareTextCompositeCommand{\"}{OT1}{a}{\bbl@umlauta{a}}%
@@ -5730,8 +6184,10 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% Finally, the default is to use English as the main language.
+%
% \changes{babel~3.9a}{2012-05-17}{Languages are best assigned with
% \cs{chardef}, not \cs{let}}
+%
% \begin{macrocode}
\ifx\l@english\@undefined
\chardef\l@english\z@
@@ -5762,6 +6218,7 @@ help from Bernd Raichle, for which I am grateful.
% unclosed group, the processing of the command |\endinput| is
% deferred until after the group is closed. This is accomplished by
% the command |\aftergroup|.
+%
% \begin{macrocode}
{\def\format{lplain}
\ifx\fmtname\format
@@ -5774,6 +6231,192 @@ help from Bernd Raichle, for which I am grateful.
\fi}
% \end{macrocode}
%
+% \section{Creating languages}
+%
+% |\babelprovide| is a general purpose tool for creating
+% languages. Currently it just creates the language infrastructure,
+% but in the future it will be able to read data from |ini| files, as
+% well as to create variants. Unlike the \textsf{nil} pseudo-language,
+% captions are defined, but with a warning to invite the user to
+% provide the real string.
+%
+% \changes{3.10}{2017/05/19}{Added \cs{babelprovide}}
+%
+% \begin{macrocode}
+\newcommand\babelprovide[2][]{%
+ \let\bbl@savelangname\languagename
+ \def\languagename{#2}%
+ \let\bbl@KVP@captions\@nil
+ \let\bbl@KVP@main\@nil
+ \let\bbl@KVP@hyphenrules\@nil
+ \bbl@forkv{#1}{\bbl@csarg\def{KVP@##1}{##2}}% TODO - error handling
+ \bbl@ifunset{date#2}%
+ {\bbl@provide@new{#2}}%
+ {\bbl@ifblank{#1}%
+ {\bbl@error
+ {If you want to modify `#2' you must tell how in\\%
+ the optional argument. Currently there are two\\%
+ options: captions=lang-tag, hyphenrules=lang-list}%
+ {Use this macro as documented}
+}%
+ {\bbl@provide@renew{#2}}}%
+ \babelensure{#2}%
+ \let\languagename\bbl@savelangname}
+% \end{macrocode}
+%
+% Depending on whether or not the language exists, we define two macros.
+%
+% \begin{macrocode}
+\def\bbl@provide@new#1{%
+ \bbl@provide@hyphens{#1}%
+ \@namedef{date#1}{}% marks lang exists - required by \StartBabelCommands
+ \@namedef{extras#1}{}%
+ \@namedef{noextras#1}{}%
+ \StartBabelCommands*{#1}{captions}%
+ \ifx\bbl@KVP@captions\@nil
+ \def\bbl@tempb##1{% elt for \bbl@captionslist
+ \ifx##1\@empty\else
+ \bbl@exp{%
+ \\\SetString\\##1{%
+ \\\bbl@nocaption{\bbl@stripslash##1}{\<#1\bbl@stripslash##1>}}}%
+ \expandafter\bbl@tempb
+ \fi}%
+ \expandafter\bbl@tempb\bbl@captionslist\@empty
+ \else
+ \bbl@read@ini{\bbl@KVP@captions}% Here all letters cat = 11
+ \bbl@after@ini
+ \bbl@savestrings
+ \fi
+ \StartBabelCommands*{#1}{date}%
+ \bbl@exp{%
+ \\\SetString\\\today{\\\bbl@nocaption{today}{\<#1today>}}}%
+ \EndBabelCommands
+ \expandafter\gdef\csname#1hyphenmins\endcsname{23}%
+ \ifx\bbl@KVP@main\@nil\else
+ \expandafter\main@language\expandafter{#1}%
+ \fi}
+\def\bbl@provide@renew#1{%
+ \bbl@provide@hyphens{#1}%
+ \ifx\bbl@KVP@captions\@nil\else
+ \StartBabelCommands*{#1}{captions}%
+ \bbl@read@ini{\bbl@KVP@captions}% Here all letters cat = 11
+ \bbl@after@ini
+ \bbl@savestrings
+ \EndBabelCommands
+ \fi}
+% \end{macrocode}
+%
+% The |hyphenrules| options is handled with an auxiliary macro.
+%
+% \begin{macrocode}
+\def\bbl@provide@hyphens#1{%
+ \let\bbl@tempa\relax
+ \ifx\bbl@KVP@hyphenrules\@nil\else
+ \bbl@replace\bbl@KVP@hyphenrules{ }{,}%
+ \bbl@foreach\bbl@KVP@hyphenrules{%
+ \ifx\bbl@tempa\relax % if not yet found
+ \bbl@ifsamestring{##1}{+}%
+ {{\bbl@exp{\\\addlanguage\<l@##1>}}}%
+ {}%
+ \bbl@ifunset{l@##1}%
+ {}%
+ {\bbl@exp{\let\bbl@tempa\<l@##1>}}%
+ \fi}%
+ \fi
+ \ifx\bbl@tempa\relax % if no option or no language found
+ \bbl@ifunset{l@#1}% no hyphenrules found - fallback
+ {\bbl@exp{\\\adddialect\<l@#1>\language}}%
+ {}%
+ \else
+ \bbl@exp{\\\adddialect\<l@#1>\bbl@tempa}% found in opt list
+ \fi}
+% \end{macrocode}
+%
+% The reader of |ini| files. There are 3 possible cases: a section name
+% (in the form |[...]|), a comment (starting with |;|) and a
+% key/value pair. \textit{TODO - Work in progress.}
+%
+% \begin{macrocode}
+\def\bbl@read@ini#1{%
+ \openin1=babel-#1.ini
+ \ifeof1
+ \bbl@error
+ {There is no ini file for the requested language\\%
+ (#1). Perhaps you misspelled it or your installation\\%
+ is not complete.}%
+ {Fix the name or reinstall babel.}%
+ \else
+ \let\bbl@section\@empty
+ \let\bbl@savestrings\@empty
+ \loop
+ \endlinechar\m@ne
+ \read1 to \bbl@line
+ \endlinechar`\^^M
+ \if T\ifeof1F\fi T\relax % Trick, because inside \loop
+ \ifx\bbl@line\@empty\else
+ \expandafter\bbl@iniline\bbl@line\bbl@iniline
+ \fi
+ \repeat
+ \fi}
+\def\bbl@iniline#1\bbl@iniline{%
+ \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inikv}#1\@@} %]
+\def\bbl@iniskip#1\@@{}% if starts with ;
+\def\bbl@inisec[#1]#2\@@{% if starts with opening bracket
+ \def\bbl@section{#1}%
+ \bbl@debug{\message{[[ #1 ]]^^J}}}
+\def\bbl@inikv#1=#2\@@{% otherwise, key=value
+ \bbl@trim@def\bbl@tempa{#1}%
+ \bbl@trim\toks@{#2}%
+ \bbl@ifunset{bbl@ini@\bbl@section}%
+ {}%
+ {\bbl@exp{%
+ \<bbl@ini@\bbl@section>\bbl@tempa=\the\toks@\\\@nil}}}
+\def\bbl@after@ini{%
+ % make sure Script and Language takes some value
+ \bbl@exp{\\\bbl@ifblank{\@nameuse{bbl@lotf@\languagename}}}%
+ {\bbl@csarg\gdef{lotf@\languagename}{dflt}}{}%
+ \bbl@exp{\\\bbl@ifblank{\@nameuse{bbl@sotf@\languagename}}}%
+ {\bbl@csarg\gdef{sotf@\languagename}{DFLT}}{}}
+% \end{macrocode}
+%
+% Key-value pairs are treated differently depending on the section in
+% the |ini| file. The following macros are the readers for
+% |captions| (with Unicode) or |captions.licr| (for 8-bit) and for
+% |identification|. But first, an auxiliary macros.
+%
+% \begin{macrocode}
+\def\bbl@exportkey#1#2#3#4{% 1:bbl id,2:ini name,3:ini key,4:ini val
+ \bbl@ifsamestring{#2}{#3}%
+ {\bbl@csarg\gdef{#1@\languagename}{#4}}%
+ {}}
+\ifcase\bbl@engine
+ \bbl@csarg\def{ini@captions.licr}#1=#2\@nil{% TODO - copypaste pattern
+ \bbl@ifblank{#2}%
+ {\bbl@exp{%
+ \toks@{\\\bbl@nocaption{#1}\<\languagename#1name>}}}%
+ {\toks@{#2}}%
+ \bbl@exp{%
+ \\\bbl@add\\\bbl@savestrings{% NOTE - with date will be global
+ \\\SetString\<#1name>{\the\toks@}}}}
+\else
+ \def\bbl@ini@captions#1=#2\@nil{%
+ \bbl@ifblank{#2}%
+ {\bbl@exp{%
+ \toks@{\\\bbl@nocaption{#1}\<\languagename#1name>}}}%
+ {\toks@{#2}}%
+ \bbl@exp{%
+ \\\bbl@add\\\bbl@savestrings{%
+ \\\SetString\<#1name>{\the\toks@}}}}
+\fi
+\def\bbl@ini@identification#1=#2\@nil{% TODO - not only with captions
+ \bbl@exportkey{lname}{name.english}{#1}{#2}%
+ \bbl@exportkey{lbcp}{tag.bcp47}{#1}{#2}%
+ \bbl@exportkey{lotf}{tag.opentype}{#1}{#2}%
+ \bbl@exportkey{sname}{script.name}{#1}{#2}%
+ \bbl@exportkey{sbcp}{script.tag.bcp47}{#1}{#2}%
+ \bbl@exportkey{sotf}{script.tag.opentype}{#1}{#2}}
+% \end{macrocode}
+%
% \subsection{Cross referencing macros}
%
% The \LaTeX\ book states:
@@ -5801,10 +6444,12 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\newlabel}
% The macro |\label| writes a line with a |\newlabel| command
% into the |.aux| file to define labels.
+%
% \begin{macrocode}
%\bbl@redefine\newlabel#1#2{%
% \@safe@activestrue\org@newlabel{#1}{#2}\@safe@activesfalse}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\@newl@bel}
@@ -5814,6 +6459,7 @@ help from Bernd Raichle, for which I am grateful.
%
% The following package options control which macros are to be
% redefined.
+%
% \begin{macrocode}
%<<*More package options>>
\DeclareOption{safe=none}{\let\bbl@opt@safe\@empty}
@@ -5826,6 +6472,7 @@ help from Bernd Raichle, for which I am grateful.
% |\protect| local and then we set the |@safe@actives| switch to
% true to make sure that any shorthand that appears in any of the
% arguments immediately expands to its non-active self.
+%
% \begin{macrocode}
\ifx\bbl@opt@safe\@empty\else
\def\@newl@bel#1#2#3{%
@@ -5837,6 +6484,7 @@ help from Bernd Raichle, for which I am grateful.
\@latex@warning@no@line{Label `#2' multiply defined}}%
\global\@namedef{#1@#2}{#3}}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\@testdef}
@@ -5847,6 +6495,7 @@ help from Bernd Raichle, for which I am grateful.
% cases the expansion of |\#1@#2| contains the same characters as
% the |#3|; but the character codes differ. Therefore \LaTeX\ keeps
% reporting that the labels may have changed.
+%
% \begin{macrocode}
\CheckCommand*\@testdef[3]{%
\def\reserved@a{#3}%
@@ -5855,37 +6504,49 @@ help from Bernd Raichle, for which I am grateful.
\@tempswatrue
\fi}
% \end{macrocode}
+%
% Now that we made sure that |\@testdef| still has the same
% definition we can rewrite it. First we make the shorthands
% `safe'.
+%
% \begin{macrocode}
\def\@testdef#1#2#3{%
\@safe@activestrue
% \end{macrocode}
+%
% Then we use |\bbl@tempa| as an `alias' for the macro that
% contains the label which is being checked.
+%
% \begin{macrocode}
\expandafter\let\expandafter\bbl@tempa\csname #1@#2\endcsname
% \end{macrocode}
+%
% Then we define |\bbl@tempb| just as |\@newl@bel| does it.
+%
% \begin{macrocode}
\def\bbl@tempb{#3}%
\@safe@activesfalse
% \end{macrocode}
+%
% When the label is defined we replace the definition of
% |\bbl@tempa| by its meaning.
+%
% \begin{macrocode}
\ifx\bbl@tempa\relax
\else
\edef\bbl@tempa{\expandafter\strip@prefix\meaning\bbl@tempa}%
\fi
% \end{macrocode}
+%
% We do the same for |\bbl@tempb|.
+%
% \begin{macrocode}
\edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}%
% \end{macrocode}
+%
% If the label didn't change, |\bbl@tempa| and |\bbl@tempb| should
% be identical macros.
+%
% \begin{macrocode}
\ifx\bbl@tempa\bbl@tempb
\else
@@ -5893,6 +6554,7 @@ help from Bernd Raichle, for which I am grateful.
\fi}
\fi
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\ref}
@@ -5902,6 +6564,7 @@ help from Bernd Raichle, for which I am grateful.
% |\pageref|. While we change these macros, we make them robust as
% well (if they weren't already) to prevent problems if they should
% become expanded at the wrong moment.
+%
% \begin{macrocode}
\@expandtwoargs\in@{R}\bbl@opt@safe
\ifin@
@@ -5914,6 +6577,7 @@ help from Bernd Raichle, for which I am grateful.
\let\org@pageref\pageref
\fi
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -5924,6 +6588,7 @@ help from Bernd Raichle, for which I am grateful.
% so we redefine this internal macro and leave |\cite| alone. The
% first argument is used for typesetting, so the shorthands need
% only be deactivated in the second argument.
+%
% \begin{macrocode}
\@expandtwoargs\in@{B}\bbl@opt@safe
\ifin@
@@ -5931,16 +6596,19 @@ help from Bernd Raichle, for which I am grateful.
\@safe@activestrue\edef\@tempa{#2}\@safe@activesfalse
\org@@citex[#1]{\@tempa}}
% \end{macrocode}
+%
% Unfortunately, the packages \pkg{natbib} and \pkg{cite} need a
% different definition of |\@citex|...
% To begin with, \pkg{natbib} has a definition for |\@citex| with
% \emph{three} arguments... We only know that a package is loaded
% when |\begin{document}| is executed, so we need to postpone the
% different redefinition.
+%
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{natbib}{%
% \end{macrocode}
+%
% Notice that we use |\def| here instead of |\bbl@redefine| because
% |\org@@citex| is already defined and we don't want to overwrite
% that definition (it would result in parameter stack overflow
@@ -5948,14 +6616,17 @@ help from Bernd Raichle, for which I am grateful.
%
% (Recent versions of natbib change dynamically |\@citex|, so PR4087
% doesn't seem fixable in a simple way. Just load natbib before.)
+%
% \begin{macrocode}
\def\@citex[#1][#2]#3{%
\@safe@activestrue\edef\@tempa{#3}\@safe@activesfalse
\org@@citex[#1][#2]{\@tempa}}%
}{}}
% \end{macrocode}
+%
% The package \pkg{cite} has a definition of |\@citex| where the
% shorthands need to be turned off in both arguments.
+%
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{cite}{%
@@ -5963,15 +6634,18 @@ help from Bernd Raichle, for which I am grateful.
\@safe@activestrue\org@@citex[#1]{#2}\@safe@activesfalse}%
}{}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\nocite}
% The macro |\nocite| which is used to instruct BiB\TeX\ to
% extract uncited references from the database.
+%
% \begin{macrocode}
\bbl@redefine\nocite#1{%
\@safe@activestrue\org@nocite{#1}\@safe@activesfalse}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bibcite}
@@ -5985,46 +6659,61 @@ help from Bernd Raichle, for which I am grateful.
% determine during \file{.aux} file processing which definition of
% |\bibcite| is needed we define |\bibcite| in such a way that it
% redefines itself with the proper definition.
+%
% \begin{macrocode}
\bbl@redefine\bibcite{%
% \end{macrocode}
+%
% We call |\bbl@cite@choice| to select the proper definition for
% |\bibcite|. This new definition is then activated.
+%
% \begin{macrocode}
\bbl@cite@choice
\bibcite}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@bibcite}
% The macro |\bbl@bibcite| holds the definition of |\bibcite|
% needed when neither \pkg{natbib} nor \pkg{cite} is loaded.
+%
% \begin{macrocode}
\def\bbl@bibcite#1#2{%
\org@bibcite{#1}{\@safe@activesfalse#2}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@cite@choice}
% The macro |\bbl@cite@choice| determines which definition of
% |\bibcite| is needed.
+%
% \begin{macrocode}
\def\bbl@cite@choice{%
% \end{macrocode}
+%
% First we give |\bibcite| its default definition.
+%
% \begin{macrocode}
\global\let\bibcite\bbl@bibcite
% \end{macrocode}
+%
% Then, when \pkg{natbib} is loaded we restore the original
% definition of |\bibcite|.
+%
% \begin{macrocode}
\@ifpackageloaded{natbib}{\global\let\bibcite\org@bibcite}{}%
% \end{macrocode}
+%
% For \pkg{cite} we do the same.
+%
% \begin{macrocode}
\@ifpackageloaded{cite}{\global\let\bibcite\org@bibcite}{}%
% \end{macrocode}
+%
% Make sure this only happens once.
+%
% \begin{macrocode}
\global\let\bbl@cite@choice\relax}
% \end{macrocode}
@@ -6032,14 +6721,17 @@ help from Bernd Raichle, for which I am grateful.
% When a document is run for the first time, no \file{.aux} file is
% available, and |\bibcite| will not yet be properly defined. In
% this case, this has to happen before the document starts.
+%
% \begin{macrocode}
\AtBeginDocument{\bbl@cite@choice}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\@bibitem}
% One of the two internal \LaTeX\ macros called by |\bibitem|
% that write the citation label on the |.aux| file.
+%
% \begin{macrocode}
\bbl@redefine\@bibitem#1{%
\@safe@activestrue\org@@bibitem{#1}\@safe@activesfalse}
@@ -6050,6 +6742,7 @@ help from Bernd Raichle, for which I am grateful.
\let\org@@bibitem\@bibitem
\fi
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Marks}
@@ -6059,6 +6752,7 @@ help from Bernd Raichle, for which I am grateful.
% pass the current language attribute to the head lines, together
% with the text that is put into them. To achieve this we need to
% adapt the definition of |\markright| and |\markboth| somewhat.
+%
% \changes{babel~3.8c}{2004/05/26}{No need to add \emph{anything} to
% an empty mark; prevented this by checking the contents of the
% argument}
@@ -6076,6 +6770,7 @@ help from Bernd Raichle, for which I am grateful.
% doing so, we make sure that active characters that may end up in
% the mark are not disabled by the output routine kicking in while
% \cs{@safe@activestrue} is in effect.
+%
% \begin{macrocode}
\bbl@redefine\markright#1{%
\bbl@ifblank{#1}%
@@ -6085,6 +6780,7 @@ help from Bernd Raichle, for which I am grateful.
\\\org@markright{\\\protect\\\foreignlanguage{\languagename}%
{\\\protect\\\bbl@restore@actives\the\toks@}}}}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\markboth}
@@ -6096,6 +6792,7 @@ help from Bernd Raichle, for which I am grateful.
% |\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 |\markboth|.
+%
% \changes{babel~3.8c}{2004/05/26}{No need to add \emph{anything} to
% an empty mark, prevented this by checking the contents of the
% arguments}
@@ -6104,6 +6801,7 @@ help from Bernd Raichle, for which I am grateful.
% it into the token registers}
% \changes{babel~3.8j}{2008/03/21}{Added setting of \cs{@mkboth} (PR
% 3826)}
+%
% \begin{macrocode}
\ifx\@mkboth\markboth
\def\bbl@tempc{\let\@mkboth\markboth}
@@ -6111,7 +6809,9 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@tempc{}
\fi
% \end{macrocode}
+%
% Now we can start the new definition of |\markboth|
+%
% \begin{macrocode}
\bbl@redefine\markboth#1#2{%
\protected@edef\bbl@tempb##1{%
@@ -6124,10 +6824,13 @@ help from Bernd Raichle, for which I am grateful.
{\@temptokena\expandafter{\bbl@tempb{#2}}}%
\bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}
% \end{macrocode}
+%
% and copy it to |\@mkboth| if necessary.
+%
% \begin{macrocode}
\bbl@tempc
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -6136,8 +6839,10 @@ help from Bernd Raichle, for which I am grateful.
% \subsubsection{\pkg{ifthen}}
%
% \begin{macro}{\ifthenelse}
-% \changes{babel~3.9a}{2012/09/07}{Redefine only if `ref' is `safe'}%
+%
+% \changes{babel~3.9a}{2012/09/07}{Redefine only if `ref' is `safe'}
% \changes{babel~3.9a}{2013/01/03}{Moved to babel.def}
+%
% Sometimes a document writer wants to create a special effect
% depending on the page a certain fragment of text appears on. This
% can be achieved by the following piece of code:
@@ -6154,33 +6859,41 @@ help from Bernd Raichle, for which I am grateful.
% The first thing we need to do is check if the package
% \pkg{ifthen} is loaded. This should be done at |\begin{document}|
% time.
+%
% \begin{macrocode}
\@expandtwoargs\in@{R}\bbl@opt@safe
\ifin@
\AtBeginDocument{%
\@ifpackageloaded{ifthen}{%
% \end{macrocode}
+%
% Then we can redefine |\ifthenelse|:
+%
% \changes{babel~3.9a}{2012/06/22}{\cs{ref} is also taken into account}
% \changes{babel~3.9n}{2015/12/14}{Don't use generic temp
% macros. babel/4441}
+%
% \begin{macrocode}
\bbl@redefine@long\ifthenelse#1#2#3{%
% \end{macrocode}
+%
% We want to revert the definition of |\pageref| and |\ref| to
% their original definition for the first argument of |\ifthenelse|,
% so we first need to store their current meanings.
+%
% \begin{macrocode}
\let\bbl@temp@pref\pageref
\let\pageref\org@pageref
\let\bbl@temp@ref\ref
\let\ref\org@ref
% \end{macrocode}
+%
% Then we can set the |\@safe@actives| switch and call the original
% |\ifthenelse|. In order to be able to use shorthands in the
% second and third arguments of |\ifthenelse| the resetting of the
% switch \emph{and} the definition of |\pageref| happens inside
% those arguments. When the package wasn't loaded we do nothing.
+%
% \begin{macrocode}
\@safe@activestrue
\org@ifthenelse{#1}%
@@ -6196,6 +6909,7 @@ help from Bernd Raichle, for which I am grateful.
}{}%
}
% \end{macrocode}
+%
% \end{macro}
%
% \subsubsection{\pkg{varioref}}
@@ -6203,12 +6917,15 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\@@vpageref}
% \begin{macro}{\vrefpagenum}
% \begin{macro}{\Ref}
+%
% \changes{babel~3.8g}{2005/05/21}{We also need to adapt \cs{Ref}
% which needs to be able to uppercase the first letter of the
-% expansion of \cs{ref}}
+% expansion of \cs{ref}}
+%
% When the package varioref is in use we need to modify its
% internal command |\@@vpageref| in order to prevent problems when
% an active character ends up in the argument of |\vref|.
+%
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{varioref}{%
@@ -6217,13 +6934,16 @@ help from Bernd Raichle, for which I am grateful.
\org@@@vpageref{#1}[#2]{#3}%
\@safe@activesfalse}%
% \end{macrocode}
+%
% The same needs to happen for |\vrefpagenum|.
+%
% \begin{macrocode}
\bbl@redefine\vrefpagenum#1#2{%
\@safe@activestrue
\org@vrefpagenum{#1}{#2}%
\@safe@activesfalse}%
% \end{macrocode}
+%
% The package \pkg{varioref} defines |\Ref| to be a robust command
% wich uppercases the first character of the reference text. In
% order to be able to do that it needs to access the exandable form
@@ -6232,6 +6952,7 @@ help from Bernd Raichle, for which I am grateful.
% |\ref|. The disadvantgage of this solution is that whenever the
% derfinition of |\Ref| changes, this definition needs to be updated
% as well.
+%
% \begin{macrocode}
\expandafter\def\csname Ref \endcsname#1{%
\protected@edef\@tempa{\org@ref{#1}}\expandafter\MakeUppercase\@tempa}
@@ -6239,6 +6960,7 @@ help from Bernd Raichle, for which I am grateful.
}
\fi
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
% \end{macro}
@@ -6253,33 +6975,41 @@ help from Bernd Raichle, for which I am grateful.
% the `:' is an active character.
%
% So at |\begin{document}| we check whether \pkg{hhline} is loaded.
+%
% \begin{macrocode}
\AtEndOfPackage{%
\AtBeginDocument{%
\@ifpackageloaded{hhline}%
% \end{macrocode}
+%
% Then we check whether the expansion of |\normal@char:| is not
% equal to |\relax|.
+%
% \changes{babel~3.8b}{2004/04/19}{added \cs{string} to prevent
% unwanted expansion of the colon}
+%
% \begin{macrocode}
{\expandafter\ifx\csname normal@char\string:\endcsname\relax
\else
% \end{macrocode}
+%
% In that case we simply reload the package. Note that this happens
% \emph{after} the category code of the @-sign has been changed to
% other, so we need to temporarily change it to letter again.
+%
% \begin{macrocode}
\makeatletter
\def\@currname{hhline}\input{hhline.sty}\makeatother
\fi}%
{}}}
% \end{macrocode}
+%
% \end{macro}
%
% \subsubsection{\pkg{hyperref}}
%
% \begin{macro}{\pdfstringdefDisableCommands}
+%
% \changes{babel~3.8j}{2008/03/16}{Inform \pkg{hyperref} to use
% shorthands at system level (PR4006)}
%
@@ -6296,6 +7026,7 @@ help from Bernd Raichle, for which I am grateful.
\pdfstringdefDisableCommands{\languageshorthands{system}}%
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \subsubsection{\pkg{fancyhdr}}
@@ -6307,16 +7038,19 @@ help from Bernd Raichle, for which I am grateful.
% marks can end up inside the argument of |\MakeUppercase|. To
% prevent unexpected results we need to define |\FOREIGNLANGUAGE|
% here.
+%
% \begin{macrocode}
\DeclareRobustCommand{\FOREIGNLANGUAGE}[1]{%
\lowercase{\foreignlanguage{#1}}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\substitutefontfamily}
% The command |\substitutefontfamily| creates an
% \file{.fd} file on the fly. The first argument is an encoding
% mnemonic, the second and third arguments are font family names.
+%
% \begin{macrocode}
\def\substitutefontfamily#1#2#3{%
\lowercase{\immediate\openout15=#1#2.fd\relax}%
@@ -6337,10 +7071,13 @@ help from Bernd Raichle, for which I am grateful.
\closeout15
}
% \end{macrocode}
+%
% This command should only be used in the preamble of a document.
+%
% \begin{macrocode}
\@onlypreamble\substitutefontfamily
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Encoding and fonts}
@@ -6357,10 +7094,12 @@ help from Bernd Raichle, for which I am grateful.
% loaded, or |OT1|.
%
% \begin{macro}{\ensureascii}
+%
% \changes{babel~3.9i}{2014/02/14}{Macro added, to replace
% \cs{textlatin} and friends}
% \changes{babel~3.9j}{2014/03/17}{Moved mispaced code - it should be
% executed only with LaTeX}
+%
% \begin{macrocode}
\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU,}
\let\org@TeX\TeX
@@ -6368,11 +7107,10 @@ help from Bernd Raichle, for which I am grateful.
\let\ensureascii\@firstofone
\AtBeginDocument{%
\in@false
- \bbl@loopx\bbl@tempa\BabelNonASCII{% is there a non-ascii enc?
+ \bbl@foreach\BabelNonASCII{% is there a non-ascii enc?
\ifin@\else
- \edef\bbl@tempb{{,\bbl@tempa enc.def,}{,\@filelist,}}%
- \lowercase\expandafter{\expandafter\in@\bbl@tempb}%
- \fi}
+ \lowercase{\@expandtwoargs\in@{,#1enc.def,}{,\@filelist,}}%
+ \fi}%
\ifin@ % if a non-ascii has been loaded
\def\ensureascii#1{{\fontencoding{OT1}\selectfont#1}}%
\DeclareTextCommandDefault{\TeX}{\org@TeX}%
@@ -6390,7 +7128,7 @@ help from Bernd Raichle, for which I am grateful.
\def\ensureascii##1{{\fontencoding{#1}\selectfont##1}}%
\fi}%
\fi}%
- \bbl@loopx\bbl@tempa\@filelist{\expandafter\bbl@tempb\bbl@tempa\@@}%
+ \bbl@foreach\@filelist{\bbl@tempb#1\@@}% TODO - \@@ de mas??
\@expandtwoargs\in@{,\cf@encoding,}{,\BabelNonASCII,}%
\ifin@\else
\edef\ensureascii#1{{%
@@ -6398,6 +7136,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% Now comes the old deprecated stuff (with a little change in 3.9l,
@@ -6410,9 +7149,11 @@ help from Bernd Raichle, for which I am grateful.
% Roman numerals come out in the Latin encoding.
% So we first assume that the current encoding at the end
% of processing the package is the Latin encoding.
+%
% \begin{macrocode}
\AtEndOfPackage{\edef\latinencoding{\cf@encoding}}
% \end{macrocode}
+%
% But this might be overruled with a later loading of the package
% \pkg{fontenc}. Therefore we check at the execution of
% |\begin{document}| whether it was loaded with the \Lopt{T1}
@@ -6420,11 +7161,13 @@ help from Bernd Raichle, for which I am grateful.
% disabled for this package. Now we have to revert to parsing the
% internal macro |\@filelist| which contains all the filenames
% loaded.
+%
% \changes{babel~3.9l}{2014/08/02}{fontspec used to set
% \cs{latinencoding} to EUx, but now it doesn't. So, it's done
% here.}
% \changes{babel~3.9o}{2016/01/27}{With fontspec, first check if
% \cs{UTFencname} exists.}
+%
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{fontspec}%
@@ -6441,23 +7184,27 @@ help from Bernd Raichle, for which I am grateful.
\@ifl@aded{def}{t1enc}{\xdef\latinencoding{\bbl@t@one}}{}%
\fi}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\latintext}
% Then we can define the command |\latintext| which is a
% declarative switch to a latin font-encoding. Usage of this macro
% is deprecated.
+%
% \begin{macrocode}
\DeclareRobustCommand{\latintext}{%
\fontencoding{\latinencoding}\selectfont
\def\encodingdefault{\latinencoding}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\textlatin}
% This command takes an argument which is then typeset using the
% requested font encoding. In order to avoid many encoding switches
% it operates in a local scope.
+%
% \begin{macrocode}
\ifx\@undefined\DeclareTextFontCommand
\DeclareRobustCommand{\textlatin}[1]{\leavevmode{\latintext #1}}
@@ -6465,6 +7212,7 @@ help from Bernd Raichle, for which I am grateful.
\DeclareTextFontCommand{\textlatin}{\latintext}
\fi
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Local Language Configuration}
@@ -6479,6 +7227,7 @@ help from Bernd Raichle, for which I am grateful.
%
% For plain-based formats we don't want to override the definition
% of |\loadlocalcfg| from \file{plain.def}.
+%
% \begin{macrocode}
\ifx\loadlocalcfg\@undefined
\@ifpackagewith{babel}{noconfigs}%
@@ -6491,8 +7240,10 @@ help from Bernd Raichle, for which I am grateful.
\@empty}}
\fi
% \end{macrocode}
+%
% Just to be compatible with \LaTeX$\:$2.09 we add a few more lines
% of code:
+%
% \begin{macrocode}
\ifx\@unexpandable@protect\@undefined
\def\@unexpandable@protect{\noexpand\protect\noexpand}
@@ -6510,337 +7261,13 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}%
% \end{macro}
%
-% \section{Internationalizing \LaTeX{} 2.09}
-%
-% Now that we're sure that the code is seen by \LaTeX\ only, we
-% have to find out what the main (primary) document style is
-% because we want to redefine some macros. This is only necessary
-% for releases of \LaTeX\ dated before December~1991. Therefore
-% this part of the code can optionally be included in
-% \file{babel.def} by specifying the \texttt{docstrip} option
-% \texttt{names}.
-%
-% The standard styles can be distinguished by checking whether some
-% macros are defined. In table~\ref{styles} an overview is given of
-% the macros that can be used for this purpose.
-% \begin{table}[htb]
-% \begin{center}
-% \DeleteShortVerb{\|}
-% \begin{tabular}{|lcp{8cm}|}
-% \hline
-% article & : & both the \verb+\chapter+ and \verb+\opening+
-% macros are undefined\\
-% report and book & : & the \verb+\chapter+ macro is defined and
-% the \verb+\opening+ is undefined\\
-% letter & : & the \verb+\chapter+ macro is undefined and
-% the \verb+\opening+ is defined\\
-% \hline
-% \end{tabular}
-% \caption{How to determine the main document style}\label{styles}
-% \MakeShortVerb{\|}
-% \end{center}
-% \end{table}
-%
-% \noindent The macros that have to be redefined for the
-% \texttt{report} and \texttt{book} document styles happen to be
-% the same, so there is no need to distinguish between those two
-% styles.
-%
-% \begin{macro}{\doc@style}
-% First a parameter |\doc@style| is defined to identify the current
-% document style. This parameter might have been defined by a
-% document style that already uses macros instead of hard-wired
-% texts, such as \file{artikel1.sty}~\cite{BEP}, so the existence of
-% |\doc@style| is checked. If this macro is undefined, i.\,e., if
-% the document style is unknown and could therefore contain
-% hard-wired texts, |\doc@style| is defined to the default
-% value~`0'.
-% \changes{babel~3.0d}{1991/10/29}{Removed use of \cs{@ifundefined}}
-% \begin{macrocode}
-%<*names>
-\ifx\@undefined\doc@style
- \def\doc@style{0}%
-% \end{macrocode}
-% This parameter is defined in the following \texttt{if}
-% construction (see table~\ref{styles}):
-%
-% \begin{macrocode}
- \ifx\@undefined\opening
- \ifx\@undefined\chapter
- \def\doc@style{1}%
- \else
- \def\doc@style{2}%
- \fi
- \else
- \def\doc@style{3}%
- \fi%
-\fi%
-% \end{macrocode}
-% \end{macro}
-%
-% \changes{babel~3.1}{1991/11/05}{Removed definition of
-% \cs{if@restonecol}}
-%
-% Now here comes the real work: we start to redefine things and
-% replace hard-wired texts by macros. These redefinitions should be
-% carried out conditionally, in case it has already been done.
-%
-% For the \texttt{figure} and \texttt{table} environments we have
-% in all styles:
-% \begin{macrocode}
-\@ifundefined{figurename}{\def\fnum@figure{\figurename{} \thefigure}}{}
-\@ifundefined{tablename}{\def\fnum@table{\tablename{} \thetable}}{}
-% \end{macrocode}
-%
-% The rest of the macros have to be treated differently for each
-% style. When |\doc@style| still has its default value nothing
-% needs to be done.
-% \begin{macrocode}
-\ifcase \doc@style\relax
-\or
-% \end{macrocode}
-%
-% This means that \file{babel.def} is read after the
-% \texttt{article} style, where no |\chapter| and |\opening|
-% commands are defined\footnote{A fact that was pointed out to me
-% by Nico Poppelier and was already used in Piet van Oostrum's
-% document style option~\texttt{nl}.}.
-%
-% First we have the |\tableofcontents|,
-% |\listoffigures| and |\listoftables|:
-% \begin{macrocode}
-\@ifundefined{contentsname}%
- {\def\tableofcontents{\section*{\contentsname\@mkboth
- {\uppercase{\contentsname}}{\uppercase{\contentsname}}}%
- \@starttoc{toc}}}{}
-\@ifundefined{listfigurename}%
- {\def\listoffigures{\section*{\listfigurename\@mkboth
- {\uppercase{\listfigurename}}{\uppercase{\listfigurename}}}%
- \@starttoc{lof}}}{}
-\@ifundefined{listtablename}%
- {\def\listoftables{\section*{\listtablename\@mkboth
- {\uppercase{\listtablename}}{\uppercase{\listtablename}}}%
- \@starttoc{lot}}}{}
-% \end{macrocode}
-%
-% Then the |\thebibliography| and |\theindex| environments.
-%
-% \begin{macrocode}
-\@ifundefined{refname}%
- {\def\thebibliography#1{\section*{\refname
- \@mkboth{\uppercase{\refname}}{\uppercase{\refname}}}%
- \list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}%
- \leftmargin\labelwidth
- \advance\leftmargin\labelsep
- \usecounter{enumi}}%
- \def\newblock{\hskip.11em plus.33em minus.07em}%
- \sloppy\clubpenalty4000\widowpenalty\clubpenalty
- \sfcode`\.=1000\relax}}{}
-\@ifundefined{indexname}%
- {\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
- \columnseprule \z@
- \columnsep 35pt\twocolumn[\section*{\indexname}]%
- \@mkboth{\uppercase{\indexname}}{\uppercase{\indexname}}%
- \thispagestyle{plain}%
- \parskip\z@ plus.3pt\parindent\z@\let\item\@idxitem}}{}
-% \end{macrocode}
-%
-% The |abstract| environment:
-%
-% \begin{macrocode}
-\@ifundefined{abstractname}%
- {\def\abstract{\if@twocolumn
- \section*{\abstractname}%
- \else \small
- \begin{center}%
- {\bf \abstractname\vspace{-.5em}\vspace{\z@}}%
- \end{center}%
- \quotation
- \fi}}{}
-% \end{macrocode}
-%
-% And last but not least, the macro |\part|:
-%
-% \begin{macrocode}
-\@ifundefined{partname}%
-{\def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne
- \refstepcounter{part}%
- \addcontentsline{toc}{part}{\thepart
- \hspace{1em}#1}\else
- \addcontentsline{toc}{part}{#1}\fi
- {\parindent\z@ \raggedright
- \ifnum \c@secnumdepth >\m@ne
- \Large \bf \partname{} \thepart
- \par \nobreak
- \fi
- \huge \bf
- #2\markboth{}{}\par}%
- \nobreak
- \vskip 3ex\@afterheading}%
-}{}
-% \end{macrocode}
-%
-% This is all that needs to be done for the \texttt{article} style.
-%
-% \begin{macrocode}
-\or
-% \end{macrocode}
-%
-% The next case is formed by the two styles \texttt{book} and
-% \texttt{report}. Basically we have to do the same as for the
-% \texttt{article} style, except now we must also change the
-% |\chapter| command.
-%
-% The tables of contents, figures and tables:
-% \begin{macrocode}
-\@ifundefined{contentsname}%
- {\def\tableofcontents{\@restonecolfalse
- \if@twocolumn\@restonecoltrue\onecolumn
- \fi\chapter*{\contentsname\@mkboth
- {\uppercase{\contentsname}}{\uppercase{\contentsname}}}%
- \@starttoc{toc}%
- \csname if@restonecol\endcsname\twocolumn
- \csname fi\endcsname}}{}
-\@ifundefined{listfigurename}%
- {\def\listoffigures{\@restonecolfalse
- \if@twocolumn\@restonecoltrue\onecolumn
- \fi\chapter*{\listfigurename\@mkboth
- {\uppercase{\listfigurename}}{\uppercase{\listfigurename}}}%
- \@starttoc{lof}%
- \csname if@restonecol\endcsname\twocolumn
- \csname fi\endcsname}}{}
-\@ifundefined{listtablename}%
- {\def\listoftables{\@restonecolfalse
- \if@twocolumn\@restonecoltrue\onecolumn
- \fi\chapter*{\listtablename\@mkboth
- {\uppercase{\listtablename}}{\uppercase{\listtablename}}}%
- \@starttoc{lot}%
- \csname if@restonecol\endcsname\twocolumn
- \csname fi\endcsname}}{}
-% \end{macrocode}
-%
-% Again, the |bibliography| and |index| environments; notice that
-% in this case we use |\bibname| instead of |\refname| as in the
-% definitions for the \texttt{article} style. The reason for this
-% is that in the \texttt{article} document style the term
-% `References' is used in the definition of |\thebibliography|. In
-% the \texttt{report} and \texttt{book} document styles the term
-% `Bibliography' is used.
-% \begin{macrocode}
-\@ifundefined{bibname}%
- {\def\thebibliography#1{\chapter*{\bibname
- \@mkboth{\uppercase{\bibname}}{\uppercase{\bibname}}}%
- \list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}%
- \leftmargin\labelwidth \advance\leftmargin\labelsep
- \usecounter{enumi}}%
- \def\newblock{\hskip.11em plus.33em minus.07em}%
- \sloppy\clubpenalty4000\widowpenalty\clubpenalty
- \sfcode`\.=1000\relax}}{}
-\@ifundefined{indexname}%
- {\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
- \columnseprule \z@
- \columnsep 35pt\twocolumn[\@makeschapterhead{\indexname}]%
- \@mkboth{\uppercase{\indexname}}{\uppercase{\indexname}}%
- \thispagestyle{plain}%
- \parskip\z@ plus.3pt\parindent\z@ \let\item\@idxitem}}{}
-% \end{macrocode}
-%
-% Here is the |abstract| environment:
-% \begin{macrocode}
-\@ifundefined{abstractname}%
- {\def\abstract{\titlepage
- \null\vfil
- \begin{center}%
- {\bf \abstractname}%
- \end{center}}}{}
-% \end{macrocode}
-%
-% And last but not least the |\chapter|, |\appendix| and
-% |\part| macros.
-% \begin{macrocode}
-\@ifundefined{chaptername}{\def\@chapapp{\chaptername}}{}
-%
-\@ifundefined{appendixname}%
- {\def\appendix{\par
- \setcounter{chapter}{0}%
- \setcounter{section}{0}%
- \def\@chapapp{\appendixname}%
- \def\thechapter{\Alph{chapter}}}}{}
-%
-\@ifundefined{partname}%
- {\def\@part[#1]#2{\ifnum \c@secnumdepth >-2\relax
- \refstepcounter{part}%
- \addcontentsline{toc}{part}{\thepart
- \hspace{1em}#1}\else
- \addcontentsline{toc}{part}{#1}\fi
- \markboth{}{}%
- {\centering
- \ifnum \c@secnumdepth >-2\relax
- \huge\bf \partname{} \thepart
- \par
- \vskip 20pt \fi
- \Huge \bf
- #1\par}\@endpart}}{}%
-% \end{macrocode}
-%
-% \begin{macrocode}
-\or
-% \end{macrocode}
-%
-% Now we address the case where \file{babel.def} is read after the
-% \texttt{letter} style. The \texttt{letter} document style
-% defines the macro |\opening| and some other macros that are
-% specific to \texttt{letter}. This means that we have to redefine
-% other macros, compared to the previous two cases.
-%
-% First two macros for the material at the end of a letter, the
-% |\cc| and |\encl| macros.
-% \begin{macrocode}
-\@ifundefined{ccname}%
- {\def\cc#1{\par\noindent
- \parbox[t]{\textwidth}%
- {\@hangfrom{\rm \ccname : }\ignorespaces #1\strut}\par}}{}
-\@ifundefined{enclname}%
- {\def\encl#1{\par\noindent
- \parbox[t]{\textwidth}%
- {\@hangfrom{\rm \enclname : }\ignorespaces #1\strut}\par}}{}
-% \end{macrocode}
-%
-% The last thing we have to do here is to redefine the
-% \texttt{headings} pagestyle:
-% \changes{babel~3.3}{1993/07/11}{\cs{headpagename} should be
-% \cs{pagename}}
-% \begin{macrocode}
-\@ifundefined{headtoname}%
- {\def\ps@headings{%
- \def\@oddhead{\sl \headtoname{} \ignorespaces\toname \hfil
- \@date \hfil \pagename{} \thepage}%
- \def\@oddfoot{}}}{}
-% \end{macrocode}
-%
-% This was the last of the four standard document styles, so if
-% |\doc@style| has another value we do nothing and just close the
-% \texttt{if} construction.
-% \begin{macrocode}
-\fi
-%</names>
-% \end{macrocode}
-% Here ends the code that can be optionally included when a version
-% of \LaTeX\ is in use that is dated \emph{before} December~1991.
-%
-%
-% We also need to redefine a number of commands to ensure that the
-% right font encoding is used, but this can't be done before
-% \file{babel.def} is loaded.
-% \changes{babel~3.6o}{1999/04/07}{Moved the rest of the font encoding
-% related definitions to their original place}
-%
% \section{Multiple languages}
%
% 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>
<@Make sure ProvidesFile is defined@>
@@ -6853,6 +7280,7 @@ help from Bernd Raichle, for which I am grateful.
% The macro |\adddialect| can be used to add the name of a dialect
% or variant language, for which an already defined hyphenation
% table can be used.
+%
% \begin{macrocode}
\def\bbl@version{<@version@>}
\def\bbl@date{<@date@>}
@@ -6861,7 +7289,9 @@ help from Bernd Raichle, for which I am grateful.
\bbl@usehooks{adddialect}{{#1}{#2}}%
\wlog{\string#1 = a dialect from \string\language#2}}
% \end{macrocode}
+%
% \end{macro}
+%
% \changes{babel~3.9a}{2012/09/07}{Added macro}
% \changes{babel~3.9a}{2013/01/23}{New macro to normalize
% a macro (eg, \cs{languagename}) to lowercase if necessary}
@@ -6877,6 +7307,7 @@ help from Bernd Raichle, for which I am grateful.
% named |MYLANG|, but unfortunately mixed case names cannot be
% trapped). Note |l@| is encapsulated, so that its case does not
% change.
+%
% \begin{macrocode}
\def\bbl@fixname#1{%
\begingroup
@@ -6905,6 +7336,7 @@ help from Bernd Raichle, for which I am grateful.
% compares the first argument with the value of |\language|. Then,
% depending on the result of the comparison, it executes either the
% second or the third argument.
+%
% \begin{macrocode}
\def\iflanguage#1{%
\bbl@iflanguage{#1}{%
@@ -6914,6 +7346,7 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\@secondoftwo
\fi}}
% \end{macrocode}
+%
% \end{macro}
%
% \subsection{Selecting the language}
@@ -6948,25 +7381,30 @@ help from Bernd Raichle, for which I am grateful.
%
% \changes{babel~3.9a}{2012/11/16}{\cs{bbl@select@type} keep tracks of
% the selection method: 0 is select, 1 is foreign}
+%
% \begin{macrocode}
\let\bbl@select@type\z@
\edef\selectlanguage{%
\noexpand\protect
\expandafter\noexpand\csname selectlanguage \endcsname}
% \end{macrocode}
+%
% Because the command |\selectlanguage| could be used in a moving
% argument it expands to \verb*=\protect\selectlanguage =.
% 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
% \end{macrocode}
+%
% 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. Therefore we introduce the
% macro |\xstring| which should expand to the right amount of
% |\string|'s.
+%
% \begin{macrocode}
\ifx\documentclass\@undefined
\def\xstring{\string\string\string}
@@ -6974,6 +7412,7 @@ help from Bernd Raichle, for which I am grateful.
\let\xstring\string
\fi
% \end{macrocode}
+%
% \end{macro}
%
% Since version 3.5 \babel\ writes entries to the auxiliary files in
@@ -6995,19 +7434,23 @@ help from Bernd Raichle, for which I am grateful.
% that case we need to keep track of the nested languages using a
% stack mechanism. This stack is called |\bbl@language@stack| and
% initially empty.
+%
% \begin{macrocode}
\def\bbl@language@stack{}
% \end{macrocode}
+%
% When using a stack we need a mechanism to push an element on the
% stack and to retrieve the information afterwards.
% \begin{macro}{\bbl@push@language}
% \begin{macro}{\bbl@pop@language}
% The stack is simply a list of languagenames, separated with a `+'
% sign; the push function can be simple:
+%
% \begin{macrocode}
\def\bbl@push@language{%
\xdef\bbl@language@stack{\languagename+\bbl@language@stack}}
% \end{macrocode}
+%
% Retrieving information from the stack is a little bit less simple,
% as we need to remove the element from the stack while storing it
% in the macro |\languagename|. For this we first define a helper function.
@@ -7015,10 +7458,12 @@ help from Bernd Raichle, for which I am grateful.
% This macro stores its first element (which is delimited by the
% `+'-sign) in |\languagename| and stores the rest of the string
% (delimited by `-') in its third argument.
+%
% \begin{macrocode}
\def\bbl@pop@lang#1+#2-#3{%
\edef\languagename{#1}\xdef#3{#2}}
% \end{macrocode}
+%
% \end{macro}
% The reason for the somewhat weird arrangement of arguments to the
% helper function is the fact it is called in the following way.
@@ -7029,11 +7474,13 @@ help from Bernd Raichle, for which I am grateful.
% (zero language names won't occur as this macro will only be
% called after something has been pushed on the stack) followed by
% the `-'-sign and finally the reference to the stack.
+%
% \begin{macrocode}
\def\bbl@pop@language{%
\expandafter\bbl@pop@lang\bbl@language@stack-\bbl@language@stack
\expandafter\bbl@set@language\expandafter{\languagename}}
% \end{macrocode}
+%
% Once the name of the previous language is retrieved from the stack,
% it is fed to |\bbl@set@language| to do the actual work of
% switching everything that needs switching.
@@ -7048,6 +7495,7 @@ help from Bernd Raichle, for which I am grateful.
\aftergroup\bbl@pop@language
\bbl@set@language{#1}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@set@language}
@@ -7065,12 +7513,14 @@ help from Bernd Raichle, for which I am grateful.
%
% We also write a command to change the current language in the
% auxiliary files.
+%
% \changes{babel~3.9a}{2012/09/09}{Added hook}
% \changes{babel~3.9a}{2012/11/07}{Use a loop for contents files, with
% the help of \cs{BabelContentsFiles}}
% \changes{babel~3.9a}{2013/03/08}{Don't write to aux if language is
% unknown}
% \changes{babel~3.9h}{2013/11/20}{Error with a more helpful text }
+%
% \begin{macrocode}
\def\BabelContentsFiles{toc,lof,lot}
\def\bbl@set@language#1{%
@@ -7081,8 +7531,8 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\ifx\csname date\languagename\endcsname\relax\else
\if@filesw
\protected@write\@auxout{}{\string\select@language{\languagename}}%
- \bbl@for\bbl@tempa\BabelContentsFiles{%
- \addtocontents{\bbl@tempa}{\xstring\select@language{\languagename}}}%
+ \bbl@foreach\BabelContentsFiles{%
+ \addtocontents{##1}{\xstring\select@language{\languagename}}}%
\bbl@usehooks{write}{}%
\fi
\fi}
@@ -7110,19 +7560,20 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macrocode}
\let\select@language@x\select@language
% \end{macrocode}
+%
% \end{macro}
%
% First, check if the user asks for a known language. If so,
% update the value of |\language| and call |\originalTeX|
% to bring \TeX\ in a certain pre-defined state.
+%
% \changes{babel~3.8l}{2008/07/06}{Use \cs{bbl@patterns}}
% \changes{babel~3.9a}{2012/07/27}{Moved \cs{bbl@patterns} to the
% correct place, after setting the extras for the current
% language}
% \changes{babel~3.9a}{2012/08/01}{Created \cs{bbl@switch} with code
% shared by \cs{select@language} and \cs{foreing@language}}
-% \begin{macrocode}
-% \end{macrocode}
+%
% The name of the language is stored in the control sequence
% |\languagename|.
%
@@ -7138,13 +7589,14 @@ help from Bernd Raichle, for which I am grateful.
% macros. \nb{What if \cs{hyphenation} was used in |extras|? Patch
% temply set@hyphenmins and hyphenation. It can be done in hooks if
% necessary.}
-% \changes{babel~3.9c}{2013/04/08}{Removed an extra empty line}
+%
%
% The switching of the values of |\lefthyphenmin| and
% |\righthyphenmin| is somewhat different. First we save their
% current values, then we check if |\|\langvar|hyphenmins| is
% defined. If it is not, we set default values (2 and 3), otherwise
% the values in |\|\langvar|hyphenmins| will be used.
+%
% \changes{babel~3.9a}{2012/08/01}{Adddd \cs{bbl@iflanguagename} and
% \cs{select@language@x}, which is no-op if the language is the same}
% \changes{babel~3.9a}{2013/01/23}{\cs{select@language} sets
@@ -7152,9 +7604,11 @@ help from Bernd Raichle, for which I am grateful.
% file (eg, shorthand expansion was wrong)}
% \changes{babel~3.9a}{2012/08/14}{Make sure the save counter is reset
% even if \cs{originalTeX} is used in other contexts}
+% \changes{babel~3.9c}{2013/04/08}{Removed an extra empty line}
% \changes{babel~3.9h}{2013/11/29}{Use \cs{def} instead of
% \cs{renewcommand} for \cs{BabelLower}}
% \changes{babel~3.9i}{2014/03/04}{Added `afterreset' hook}
+%
% \begin{macrocode}
\def\bbl@switch#1{%
\originalTeX
@@ -7171,14 +7625,14 @@ help from Bernd Raichle, for which I am grateful.
\bbl@usehooks{beforeextras}{}%
\csname extras#1\endcsname\relax
\bbl@usehooks{afterextras}{}%
- \ifcase\bbl@hymapopt\or
+ \ifcase\bbl@opt@hyphenmap\or
\def\BabelLower##1##2{\lccode##1=##2\relax}%
\ifnum\bbl@hymapsel>4\else
\csname\languagename @bbl@hyphenmap\endcsname
\fi
- \chardef\bbl@hymapopt\z@
+ \chardef\bbl@opt@hyphenmap\z@
\else
- \ifnum\bbl@hymapsel>\bbl@hymapopt\else
+ \ifnum\bbl@hymapsel>\bbl@opt@hyphenmap\else
\csname\languagename @bbl@hyphenmap\endcsname
\fi
\fi
@@ -7206,19 +7660,24 @@ help from Bernd Raichle, for which I am grateful.
% \verb*=\selectlanguage = to switch on everything that is needed for
% this language The |\ignorespaces| command is necessary to hide
% the environment when it is entered in horizontal mode.
+%
% \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}
+%
% The |\endotherlanguage| part of the environment tries to hide
% itself when it is called in horizontal mode.
+%
% \begin{macrocode}
\long\def\endotherlanguage{%
\global\@ignoretrue\ignorespaces}
% \end{macrocode}
+%
% \end{environment}
%
% \begin{environment}{otherlanguage*}
@@ -7226,17 +7685,21 @@ help from Bernd Raichle, for which I am grateful.
% large part of text from a different language needs to be typeset,
% but without changing the translation of words such as `figure'.
% This environment makes use of |\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
% definitions. The grouping mechanism of the environment will take
% care of resetting the correct hyphenation rules and ``extras''.
+%
% \begin{macrocode}
\expandafter\let\csname endotherlanguage*\endcsname\relax
% \end{macrocode}
+%
% \end{environment}
%
% \begin{macro}{\foreignlanguage}
@@ -7251,6 +7714,7 @@ help from Bernd Raichle, for which I am grateful.
% a group and assumes the |\extras|\langvar\ command doesn't make
% any |\global| changes. The coding is very similar to part of
% |\selectlanguage|.
+%
% \changes{babel~3.9a}{2012/07/30}{Removed unnecesary \cs{noextras}
% just before closing the group}
% \changes{babel~3.9a}{2012/07/31}{Moved \cs{originalTeX} to
@@ -7258,6 +7722,7 @@ help from Bernd Raichle, for which I am grateful.
% \texttt{otherlanguage*}}
% \changes{babel~3.9a}{2012/12/24}{\cs{foreignlanguage} defined
% similarly to \cs{selectlanguage}, protecting the whole macro}
+%
% \begin{macrocode}
\edef\foreignlanguage{%
\noexpand\protect
@@ -7268,6 +7733,7 @@ help from Bernd Raichle, for which I am grateful.
#2%
\endgroup}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\foreign@language}
@@ -7276,8 +7742,10 @@ help from Bernd Raichle, for which I am grateful.
% environment. First we need to store the name of the language and
% check that it is a known language. Then it just calls
% |bbl@switch|.
+%
% \changes{babel~3.9h}{2013/11/29}{The warning shows the language
% actually selected (with fixed case)}
+%
% \begin{macrocode}
\def\foreign@language#1{%
\edef\languagename{#1}%
@@ -7295,14 +7763,17 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@select@type\@ne
\expandafter\bbl@switch\expandafter{\languagename}}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\bbl@patterns}
+%
% \changes{babel~3.8l}{2008/07/06}{Macro added}
% \changes{babel~3.9a}{2012/08/28}{Extended to set hyphenation
% exceptions as defined with \cs{babelhyphenation}}
% \changes{babel~3.9m}{2015/07/25}{Preset \cs{bbl@pttnlist} and
-% \cs{bbl@patterns@} to relax, for luatex.}
+% \cs{bbl@patterns@} to relax, for luatex.}
+%
% This macro selects the hyphenation patterns by changing the
% \cs{language} register. If special hyphenation patterns
% are available specifically for the current font encoding,
@@ -7316,6 +7787,7 @@ help from Bernd Raichle, for which I am grateful.
% |:ENC| is taken into account) has been set, then use
% |\hyphenation| with both global and language exceptions and empty
% the latter to mark they must not be set again.
+%
% \begin{macrocode}
\let\bbl@hyphlist\@empty
\let\bbl@hyphenation@\relax
@@ -7345,6 +7817,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
\endgroup}}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{environment}{hyphenrules}
@@ -7354,9 +7827,11 @@ help from Bernd Raichle, for which I am grateful.
% specified were not loaded it has no effect. Note however,
% |\lccode|'s and font encodings are not set at all, so in most
% cases you should use |otherlanguage*|.
+%
% \changes{babel~3.8j}{2008/03/16}{Also set the hyphenmin parameters to
% the correct value (PR3997)}
% \changes{babel~3.8l}{2008/07/06}{Use \cs{bbl@patterns}}
+%
% \begin{macrocode}
\def\hyphenrules#1{%
\edef\languagename{#1}%
@@ -7372,6 +7847,7 @@ help from Bernd Raichle, for which I am grateful.
\fi}}
\let\endhyphenrules\@empty
% \end{macrocode}
+%
% \end{environment}
%
% \begin{macro}{\providehyphenmins}
@@ -7380,20 +7856,24 @@ help from Bernd Raichle, for which I am grateful.
% hyphenation parameters |\lefthyphenmin| and |\righthyphenmin|. If
% the macro |\|\langvar|hyphenmins| is already defined this command
% has no effect.
+%
% \begin{macrocode}
\def\providehyphenmins#1#2{%
\expandafter\ifx\csname #1hyphenmins\endcsname\relax
\@namedef{#1hyphenmins}{#2}%
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\set@hyphenmins}
% This macro sets the values of |\lefthyphenmin| and
% |\righthyphenmin|. It expects two values as its argument.
+%
% \begin{macrocode}
\def\set@hyphenmins#1#2{\lefthyphenmin#1\relax\righthyphenmin#2\relax}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\ProvidesLanguage}
@@ -7405,9 +7885,11 @@ help from Bernd Raichle, for which I am grateful.
%
% Depending on the format, ie, on if the former is defined, we use
% a similar definition or not.
+%
% \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}
\ifx\ProvidesFile\@undefined
\def\ProvidesLanguage#1[#2 #3 #4]{%
@@ -7426,6 +7908,7 @@ help from Bernd Raichle, for which I am grateful.
\endgroup}
\fi
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\LdfInit}
@@ -7438,6 +7921,7 @@ help from Bernd Raichle, for which I am grateful.
% The category code of the ampersand is restored and the macro
% calls itself again with the new definition from
% \file{babel.def}
+%
% \begin{macrocode}
\def\LdfInit{%
\chardef\atcatcode=\catcode`\@
@@ -7446,26 +7930,33 @@ help from Bernd Raichle, for which I am grateful.
\catcode`\@=\atcatcode \let\atcatcode\relax
\LdfInit}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\originalTeX}
% The macro|\originalTeX| should be known to \TeX\ at this moment.
% As it has to be expandable we |\let| it to |\@empty| instead of
% |\relax|.
+%
% \begin{macrocode}
\ifx\originalTeX\@undefined\let\originalTeX\@empty\fi
% \end{macrocode}
+%
% Because this part of the code can be included in a format, we
% make sure that the macro which initialises the save mechanism,
% |\babel@beginsave|, is not considered to be undefined.
+%
% \begin{macrocode}
\ifx\babel@beginsave\@undefined\let\babel@beginsave\relax\fi
% \end{macrocode}
+%
% \end{macro}
%
% A few macro names are reserved for future releases of \babel, which
% will use the concept of `locale':
-% \changes{babel~3.9s}{2017/04/13}{Reserved macros}
+%
+% \changes{babel~3.9s}{2017/04/13}{Reserved macro names for `locale'}
+%
% \begin{macrocode}
\newcommand\setlocale{%
\bbl@error
@@ -7497,10 +7988,12 @@ help from Bernd Raichle, for which I am grateful.
% When the format knows about |\PackageError| it must be \LaTeXe,
% so we can safely use its error handling interface. Otherwise
% we'll have to `keep it simple'.
+%
% \changes{babel~3.9a}{2012/07/30}{\cs{newcommand}s replaced by
% \cs{def}'s, so that the file can be loaded twice}
% \changes{babel~3.9a}{2013/01/26}{Define generic variants instead of
% duplicating each predefined message}
+%
% \begin{macrocode}
\edef\bbl@nulllanguage{\string\language=0}
\ifx\PackageError\@undefined
@@ -7543,6 +8036,14 @@ help from Bernd Raichle, for which I am grateful.
{\let\bbl@info\@gobble
\let\bbl@warning\@gobble}
{}
+\def\bbl@nocaption#1#2{% 1: text to be printed 2: caption macro \langXname
+ \gdef#2{\textbf{?#1?}}%
+ #2%
+ \bbl@warning{%
+ \string#2 not set. Please, define\\%
+ it in the preamble with something like:\\%
+ \string\renewcommand\string#2{..}\\%
+ Reported}}
\def\@nolanerr#1{%
\bbl@error
{You haven't defined the language #1\space yet}%
@@ -7557,6 +8058,7 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@usehooks\@gobbletwo
%</kernel>
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
% \end{macro}
@@ -7572,6 +8074,7 @@ help from Bernd Raichle, for which I am grateful.
% |toks8| stores info to be shown when the program is run.
%
% \changes{babel~3.9g}{2013/05/30}{Code moved from plain.def}
+%
% 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:
@@ -7645,8 +8148,10 @@ help from Bernd Raichle, for which I am grateful.
% When the first token of a line is an \texttt{=}, the macro
% |\process@synonym| is called; otherwise the macro
% |\process@language| will continue.
+%
% \changes{babel~3.9a}{2012/12/12}{Use spaces as delimiters, to avoid
% extra spaces. Once parsed, pass them in the traditional way}
+%
% \begin{macrocode}
\def\process@line#1#2 #3 #4 {%
\ifx=#1%
@@ -7656,6 +8161,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
\ignorespaces}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\process@synonym}
@@ -7663,10 +8169,12 @@ help from Bernd Raichle, for which I am grateful.
% This macro takes care of the lines which start with an
% \texttt{=}. It needs an empty token register to begin with.
% |\bbl@languages| is also set to empty.
+%
% \begin{macrocode}
\toks@{}
\def\bbl@languages{}
% \end{macrocode}
+%
% When no languages have been loaded yet, the name following the
% \texttt{=} will be a synonym for hyphenation register 0. So, it is stored
% in a token register and executed when the first pattern file has
@@ -7676,7 +8184,9 @@ help from Bernd Raichle, for which I am grateful.
% Otherwise the name will be a synonym for the language loaded last.
%
% We also need to copy the hyphenmin parameters for the synonym.
+%
% \changes{babel~3.9a}{2012/06/25}{Added \cs{bbl@languages}}
+%
% \begin{macrocode}
\def\process@synonym#1{%
\ifnum\last@language=\m@ne
@@ -7690,6 +8200,7 @@ help from Bernd Raichle, for which I am grateful.
\edef\bbl@languages{\bbl@languages\bbl@elt{#1}{\the\last@language}{}{}}%
\fi}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macro}{\process@language}
@@ -7705,6 +8216,7 @@ help from Bernd Raichle, for which I am grateful.
% Then the `name' of the language that will be loaded now is
% added to the token register |\toks8|. and finally
% the pattern file is read.
+%
% \changes{babel~3.9a}{2012/12/10}{Removed \cs{selectfont} (I presume
% it was intended to catch wrong encoding codes, but I don't think
% this is necessary and as a side effect it might preload fonts)}
@@ -7740,7 +8252,8 @@ help from Bernd Raichle, for which I am grateful.
%
% \changes{babel~3.9a}{2012/06/25}{Added \cs{bbl@languages}}
% \changes{babel~3.9f}{2013/05/16}{Restored code to set default
-% hyphenmins, which was deleted mistakenly}
+% hyphenmins, which was deleted mistakenly}
+%
% \cs{bbl@languages} saves a snapshot of the loaded languagues in the
% form \cs{bbl@elt}\marg{language-name}\marg{number}%
% \marg{patterns-file}\marg{exceptions-file}. Note the last 2
@@ -7749,6 +8262,7 @@ help from Bernd Raichle, for which I am grateful.
%
% Finally, if the counter |\language| is equal to zero we execute the
% synonyms stored.
+%
% \begin{macrocode}
\def\process@language#1#2#3{%
\expandafter\addlanguage\csname l@#1\endcsname
@@ -7785,14 +8299,18 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% \begin{macro}{\bbl@get@enc}
-% \changes{babel~3.9a}{2012/12/11}{Code much simplified}
+%
+% \changes{babel~3.9a}{2012/12/11}{Code much simplified}
+%
% \begin{macro}{\bbl@hyph@enc}
% The macro |\bbl@get@enc| extracts the font encoding from the
% language name and stores it in |\bbl@hyph@enc|. It uses delimited
% arguments to achieve this.
+%
% \begin{macrocode}
\def\bbl@get@enc#1:#2:#3\@@@{\def\bbl@hyph@enc{#2}}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
% \end{macro}
@@ -7800,8 +8318,10 @@ help from Bernd Raichle, for which I am grateful.
% Now, hooks are defined. For efficiency reasons, they are dealt
% here in a special way. Besides \luatex, format specific
% configuration files are taken into account.
+%
% \changes{babel~3.9b}{2013/03/25}{Fixed an idiot slip: \cs{def}
% intead of \cs{let}}
+%
% \begin{macrocode}
\def\bbl@hook@everylanguage#1{}
\def\bbl@hook@loadpatterns#1{\input #1\relax}
@@ -7831,8 +8351,10 @@ help from Bernd Raichle, for which I am grateful.
\endgroup
\bbl@hook@loadkernel{switch.def}
% \end{macrocode}
+%
% \begin{macro}{\readconfigfile}
% The configuration file can now be opened for reading.
+%
% \begin{macrocode}
\openin1 = language.dat
% \end{macrocode}
@@ -7897,9 +8419,11 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% Check for the end of the file. We must reverse the test for
-% |\ifeof| without |\else|. Then reactivate the default patterns,
+% |\ifeof| without |\else|. Then reactivate the default patterns.
+%
% \changes{babel~3.8m}{2008/07/08}{Also restore the name of the
% language in \cs{languagename} (PR 4039)}
+%
% \begin{macrocode}
\begingroup
\def\bbl@elt#1#2#3#4{%
@@ -7910,7 +8434,9 @@ help from Bernd Raichle, for which I am grateful.
\endgroup
\fi
% \end{macrocode}
+%
% and close the configuration file.
+%
% \begin{macrocode}
\closein1
% \end{macrocode}
@@ -7918,6 +8444,7 @@ help from Bernd Raichle, for which I am grateful.
% We add a message about the fact that babel is loaded in the
% format and with which language patterns to the \cs{everyjob}
% register.
+%
% \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}).}
% \changes{babel~3.9g}{2013/07/28}{In non-LaTeX formats the number of
@@ -7925,6 +8452,7 @@ help from Bernd Raichle, for which I am grateful.
% now \cs{toks}8 is expanded here.}
% \changes{babel~3.9o}{2016/01/25}{The number of languages loaded was
% off by 1.}
+%
% \begin{macrocode}
\if/\the\toks@/\else
\errhelp{language.dat loads no language, only synonyms}
@@ -7943,11 +8471,15 @@ help from Bernd Raichle, for which I am grateful.
\advance\last@language\m@ne
\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
-% letter is not required and the line inputting it may be commented out.
+% letter is not required and the line inputting it may be commented
+% out.
+%
% \changes{babel~3.9a}{2012/12/11}{Raise error if there are synonyms
% without languages}
+%
% \begin{macrocode}
\let\bbl@line\@undefined
\let\process@line\@undefined
@@ -7962,6 +8494,7 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@hook@loadexceptions\@undefined
%</patterns>
% \end{macrocode}
+%
% Here the code for ini\TeX\ ends.
% \end{macro}
%
@@ -7976,6 +8509,7 @@ help from Bernd Raichle, for which I am grateful.
% The macro |\LdfInit| takes care of preventing that this file is
% loaded more than once, checking the category code of the
% \texttt{@} sign, etc.
+%
% \begin{macrocode}
%<*nil>
\ProvidesLanguage{nil}[<@date@> <@version@> Nil language]
@@ -7985,6 +8519,7 @@ help from Bernd Raichle, for which I am grateful.
% When this file is read as an option, i.e. by the |\usepackage|
% command, \texttt{nil} could be an `unknown' language in which
% case we have to make it known.
+%
% \begin{macrocode}
\ifx\l@nohyphenation\@undefined
\@nopatterns{nil}
@@ -7993,8 +8528,10 @@ help from Bernd Raichle, for which I am grateful.
\let\l@nil\l@nohyphenation
\fi
% \end{macrocode}
+%
% This macro is used to store the values of the hyphenation
% parameters |\lefthyphenmin| and |\righthyphenmin|.
+%
% \begin{macrocode}
\providehyphenmins{\CurrentOption}{\m@ne\m@ne}
% \end{macrocode}
@@ -8003,10 +8540,12 @@ help from Bernd Raichle, for which I am grateful.
% from) the `nil' language.
% \begin{macro}{\captionnil}
% \begin{macro}{\datenil}
+%
% \begin{macrocode}
\let\captionsnil\@empty
\let\datenil\@empty
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
@@ -8014,6 +8553,7 @@ help from Bernd Raichle, for which I am grateful.
% configuration file, setting the main language to be switched on
% at |\begin{document}| and resetting the category code of
% \texttt{@} to its original value.
+%
% \begin{macrocode}
\ldf@finish{nil}
%</nil>
@@ -8049,23 +8589,29 @@ help from Bernd Raichle, for which I am grateful.
% 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
@@ -8074,33 +8620,42 @@ help from Bernd Raichle, for which I am grateful.
% 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}
@@ -8117,6 +8672,7 @@ help from Bernd Raichle, for which I am grateful.
%
% \changes{bbplain-1.0s}{2012/12/21}{\cs{loadlocalcfg} not loaded in
% the format}
+%
% \begin{macrocode}
%<*plain>
\def\@empty{}
@@ -8138,11 +8694,13 @@ help from Bernd Raichle, for which I am grateful.
% \subsection{General tools}
%
% A number of \LaTeX\ macro's that are needed later on.
+%
% \changes{bbplain-1.0t}{2013/04/10}{Added \cs{@expandtwoargs}}
% \changes{babel~3.9h}{2013/12/02}{Added \cs{zap@space}}
% \changes{babel~3.9k}{2014/03/22}{Added \cs{@nnil}}
% \changes{babel~3.9k}{2014/03/22}{Added \cs{@gobbletwo}}
% \changes{babel~3.9k}{2014/03/22}{Added \cs{protected@edef}}
+%
% \begin{macrocode}
\long\def\@firstofone#1{#1}
\long\def\@firstoftwo#1#2{#1}
@@ -8180,9 +8738,11 @@ help from Bernd Raichle, for which I am grateful.
\ifx#2\@empty\else\expandafter\zap@space\fi
#2}
% \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{}
@@ -8192,8 +8752,10 @@ help from Bernd Raichle, for which I am grateful.
\@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
@@ -8210,28 +8772,35 @@ help from Bernd Raichle, for which I am grateful.
\@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|.
-% \changes{babel~3.9h}{2013/11/28}{Set \cs{bbl@hymapopt} to 0 - we
+%
+% \changes{babel~3.9h}{2013/11/28}{Set \cs{bbl@opt@hyphenmap} to 0 - we
% presume hyphenmap=off in plain}
+%
% \begin{macrocode}
\def\AtEndOfPackage#1{\g@addto@macro\@endofldf{#1}}
\@onlypreamble\AtEndOfPackage
\def\@endofldf{}
\@onlypreamble\@endofldf
\let\bbl@afterlang\@empty
-\chardef\bbl@hymapopt\z@
+\chardef\bbl@opt@hyphenmap\z@
% \end{macrocode}
+%
% \LaTeX\ needs to be able to switch off writing to its auxiliary
% files; plain doesn't have them by default.
+%
% \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.
+%
% \begin{macrocode}
\def\newcommand{\@star@or@long\new@command}
\def\new@command#1{%
@@ -8302,8 +8871,10 @@ help from Bernd Raichle, for which I am grateful.
% 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.0s}{2013/01/15}{Use \cs{bbl@tempa} as
% documented}
+%
% \begin{macrocode}
\def\bbl@tempa{\csname newif\endcsname\ifin@}
\ifx\in@\@undefined
@@ -8352,9 +8923,11 @@ help from Bernd Raichle, for which I am grateful.
\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
@@ -8396,6 +8969,7 @@ help from Bernd Raichle, for which I am grateful.
%
% Code from \file{ltoutenc.dtx}, adapted for use in the plain \TeX\
% environment.
+%
% \begin{macrocode}
\def\DeclareTextCommand{%
\@dec@text@cmd\providecommand
@@ -8534,9 +9108,11 @@ help from Bernd Raichle, for which I am grateful.
}
\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}
@@ -8544,8 +9120,10 @@ help from Bernd Raichle, for which I am grateful.
\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.
+%
% \begin{macrocode}
\DeclareTextSymbol{\textquotedblleft}{OT1}{92}
\DeclareTextSymbol{\textquotedblright}{OT1}{`\"}
@@ -8554,10 +9132,12 @@ help from Bernd Raichle, for which I am grateful.
\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|.
+%
% \begin{macrocode}
\ifx\scriptsize\@undefined
\let\scriptsize\sevenrm
diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins
index 4028b50ff77..e19a527280d 100644
--- a/Master/texmf-dist/source/latex/babel/babel.ins
+++ b/Master/texmf-dist/source/latex/babel/babel.ins
@@ -217,7 +217,7 @@ This file is a style file for the MakeIndex program
}
% compatibility files
-\def\compatfile#1{\file{#1.sty}{\from{bbcompat.dtx}{#1}}}
+\def\compatfile#1{\file{#1.sty}{\from{bbcompat.dtx}{styfile,#1}}}
\generate{%
\compatfile{esperanto}
diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx
index 507a2fa5219..9b12be77cba 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}[2017/04/28 v3.9t]
+\ProvidesFile{bbcompat.dtx}[2017/05/19 v3.10]
%</dtx>
%
%% File 'bbcompat.dtx'
@@ -256,6 +256,326 @@
%<+hebrew>\def\CurrentOption{hebrew}
%<+hebrew>\input rlbabel.def\input hebrew.ldf\relax
% \end{macrocode}
+%
+% \section{Internationalizing \LaTeX{} 2.09}
+%
+% Now that we're sure that the code is seen by \LaTeX\ only, we
+% have to find out what the main (primary) document style is
+% because we want to redefine some macros. This is only necessary
+% for releases of \LaTeX\ dated before December~1991. Therefore
+% this part of the code can optionally be included in
+% \file{babel.def} by specifying the \texttt{docstrip} option
+% \texttt{names}.
+%
+% The standard styles can be distinguished by checking whether some
+% macros are defined. In table~\ref{styles} an overview is given of
+% the macros that can be used for this purpose.
+% \begin{table}[htb]
+% \begin{center}
+% \DeleteShortVerb{\|}
+% \begin{tabular}{|lcp{8cm}|}
+% \hline
+% article & : & both the \verb+\chapter+ and \verb+\opening+
+% macros are undefined\\
+% report and book & : & the \verb+\chapter+ macro is defined and
+% the \verb+\opening+ is undefined\\
+% letter & : & the \verb+\chapter+ macro is undefined and
+% the \verb+\opening+ is defined\\
+% \hline
+% \end{tabular}
+% \caption{How to determine the main document style}\label{styles}
+% \MakeShortVerb{\|}
+% \end{center}
+% \end{table}
+%
+% \noindent The macros that have to be redefined for the
+% \texttt{report} and \texttt{book} document styles happen to be
+% the same, so there is no need to distinguish between those two
+% styles.
+%
+% \begin{macro}{\doc@style}
+% First a parameter |\doc@style| is defined to identify the current
+% document style. This parameter might have been defined by a
+% document style that already uses macros instead of hard-wired
+% texts, such as \file{artikel1.sty}~\cite{BEP}, so the existence of
+% |\doc@style| is checked. If this macro is undefined, i.\,e., if
+% the document style is unknown and could therefore contain
+% hard-wired texts, |\doc@style| is defined to the default
+% value~`0'.
+% \changes{babel~3.0d}{1991/10/29}{Removed use of \cs{@ifundefined}}
+% \begin{macrocode}
+%<*names>
+\ifx\@undefined\doc@style
+ \def\doc@style{0}%
+% \end{macrocode}
+% This parameter is defined in the following \texttt{if}
+% construction (see table~\ref{styles}):
+%
+% \begin{macrocode}
+ \ifx\@undefined\opening
+ \ifx\@undefined\chapter
+ \def\doc@style{1}%
+ \else
+ \def\doc@style{2}%
+ \fi
+ \else
+ \def\doc@style{3}%
+ \fi%
+\fi%
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{babel~3.1}{1991/11/05}{Removed definition of
+% \cs{if@restonecol}}
+%
+% Now here comes the real work: we start to redefine things and
+% replace hard-wired texts by macros. These redefinitions should be
+% carried out conditionally, in case it has already been done.
+%
+% For the \texttt{figure} and \texttt{table} environments we have
+% in all styles:
+% \begin{macrocode}
+\@ifundefined{figurename}{\def\fnum@figure{\figurename{} \thefigure}}{}
+\@ifundefined{tablename}{\def\fnum@table{\tablename{} \thetable}}{}
+% \end{macrocode}
+%
+% The rest of the macros have to be treated differently for each
+% style. When |\doc@style| still has its default value nothing
+% needs to be done.
+% \begin{macrocode}
+\ifcase\doc@style\relax
+\or
+% \end{macrocode}
+%
+% This means that \file{babel.def} is read after the
+% \texttt{article} style, where no |\chapter| and |\opening|
+% commands are defined\footnote{A fact that was pointed out to me
+% by Nico Poppelier and was already used in Piet van Oostrum's
+% document style option~\texttt{nl}.}.
+%
+% First we have the |\tableofcontents|,
+% |\listoffigures| and |\listoftables|:
+% \begin{macrocode}
+\@ifundefined{contentsname}%
+ {\def\tableofcontents{\section*{\contentsname\@mkboth
+ {\uppercase{\contentsname}}{\uppercase{\contentsname}}}%
+ \@starttoc{toc}}}{}
+\@ifundefined{listfigurename}%
+ {\def\listoffigures{\section*{\listfigurename\@mkboth
+ {\uppercase{\listfigurename}}{\uppercase{\listfigurename}}}%
+ \@starttoc{lof}}}{}
+\@ifundefined{listtablename}%
+ {\def\listoftables{\section*{\listtablename\@mkboth
+ {\uppercase{\listtablename}}{\uppercase{\listtablename}}}%
+ \@starttoc{lot}}}{}
+% \end{macrocode}
+%
+% Then the |\thebibliography| and |\theindex| environments.
+%
+% \begin{macrocode}
+\@ifundefined{refname}%
+ {\def\thebibliography#1{\section*{\refname
+ \@mkboth{\uppercase{\refname}}{\uppercase{\refname}}}%
+ \list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}%
+ \leftmargin\labelwidth
+ \advance\leftmargin\labelsep
+ \usecounter{enumi}}%
+ \def\newblock{\hskip.11em plus.33em minus.07em}%
+ \sloppy\clubpenalty4000\widowpenalty\clubpenalty
+ \sfcode`\.=1000\relax}}{}
+\@ifundefined{indexname}%
+ {\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
+ \columnseprule \z@
+ \columnsep 35pt\twocolumn[\section*{\indexname}]%
+ \@mkboth{\uppercase{\indexname}}{\uppercase{\indexname}}%
+ \thispagestyle{plain}%
+ \parskip\z@ plus.3pt\parindent\z@\let\item\@idxitem}}{}
+% \end{macrocode}
+%
+% The |abstract| environment:
+%
+% \begin{macrocode}
+\@ifundefined{abstractname}%
+ {\def\abstract{\if@twocolumn
+ \section*{\abstractname}%
+ \else \small
+ \begin{center}%
+ {\bf \abstractname\vspace{-.5em}\vspace{\z@}}%
+ \end{center}%
+ \quotation
+ \fi}}{}
+% \end{macrocode}
+%
+% And last but not least, the macro |\part|:
+%
+% \begin{macrocode}
+\@ifundefined{partname}%
+{\def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}{\thepart
+ \hspace{1em}#1}\else
+ \addcontentsline{toc}{part}{#1}\fi
+ {\parindent\z@ \raggedright
+ \ifnum \c@secnumdepth >\m@ne
+ \Large \bf \partname{} \thepart
+ \par \nobreak
+ \fi
+ \huge \bf
+ #2\markboth{}{}\par}%
+ \nobreak
+ \vskip 3ex\@afterheading}%
+}{}
+% \end{macrocode}
+%
+% This is all that needs to be done for the \texttt{article} style.
+%
+% \begin{macrocode}
+\or
+% \end{macrocode}
+%
+% The next case is formed by the two styles \texttt{book} and
+% \texttt{report}. Basically we have to do the same as for the
+% \texttt{article} style, except now we must also change the
+% |\chapter| command.
+%
+% The tables of contents, figures and tables:
+% \begin{macrocode}
+\@ifundefined{contentsname}%
+ {\def\tableofcontents{\@restonecolfalse
+ \if@twocolumn\@restonecoltrue\onecolumn
+ \fi\chapter*{\contentsname\@mkboth
+ {\uppercase{\contentsname}}{\uppercase{\contentsname}}}%
+ \@starttoc{toc}%
+ \csname if@restonecol\endcsname\twocolumn
+ \csname fi\endcsname}}{}
+\@ifundefined{listfigurename}%
+ {\def\listoffigures{\@restonecolfalse
+ \if@twocolumn\@restonecoltrue\onecolumn
+ \fi\chapter*{\listfigurename\@mkboth
+ {\uppercase{\listfigurename}}{\uppercase{\listfigurename}}}%
+ \@starttoc{lof}%
+ \csname if@restonecol\endcsname\twocolumn
+ \csname fi\endcsname}}{}
+\@ifundefined{listtablename}%
+ {\def\listoftables{\@restonecolfalse
+ \if@twocolumn\@restonecoltrue\onecolumn
+ \fi\chapter*{\listtablename\@mkboth
+ {\uppercase{\listtablename}}{\uppercase{\listtablename}}}%
+ \@starttoc{lot}%
+ \csname if@restonecol\endcsname\twocolumn
+ \csname fi\endcsname}}{}
+% \end{macrocode}
+%
+% Again, the |bibliography| and |index| environments; notice that
+% in this case we use |\bibname| instead of |\refname| as in the
+% definitions for the \texttt{article} style. The reason for this
+% is that in the \texttt{article} document style the term
+% `References' is used in the definition of |\thebibliography|. In
+% the \texttt{report} and \texttt{book} document styles the term
+% `Bibliography' is used.
+% \begin{macrocode}
+\@ifundefined{bibname}%
+ {\def\thebibliography#1{\chapter*{\bibname
+ \@mkboth{\uppercase{\bibname}}{\uppercase{\bibname}}}%
+ \list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}%
+ \leftmargin\labelwidth \advance\leftmargin\labelsep
+ \usecounter{enumi}}%
+ \def\newblock{\hskip.11em plus.33em minus.07em}%
+ \sloppy\clubpenalty4000\widowpenalty\clubpenalty
+ \sfcode`\.=1000\relax}}{}
+\@ifundefined{indexname}%
+ {\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
+ \columnseprule \z@
+ \columnsep 35pt\twocolumn[\@makeschapterhead{\indexname}]%
+ \@mkboth{\uppercase{\indexname}}{\uppercase{\indexname}}%
+ \thispagestyle{plain}%
+ \parskip\z@ plus.3pt\parindent\z@ \let\item\@idxitem}}{}
+% \end{macrocode}
+%
+% Here is the |abstract| environment:
+% \begin{macrocode}
+\@ifundefined{abstractname}%
+ {\def\abstract{\titlepage
+ \null\vfil
+ \begin{center}%
+ {\bf \abstractname}%
+ \end{center}}}{}
+% \end{macrocode}
+%
+% And last but not least the |\chapter|, |\appendix| and
+% |\part| macros.
+% \begin{macrocode}
+\@ifundefined{chaptername}{\def\@chapapp{\chaptername}}{}
+%
+\@ifundefined{appendixname}%
+ {\def\appendix{\par
+ \setcounter{chapter}{0}%
+ \setcounter{section}{0}%
+ \def\@chapapp{\appendixname}%
+ \def\thechapter{\Alph{chapter}}}}{}
+%
+\@ifundefined{partname}%
+ {\def\@part[#1]#2{\ifnum \c@secnumdepth >-2\relax
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}{\thepart
+ \hspace{1em}#1}\else
+ \addcontentsline{toc}{part}{#1}\fi
+ \markboth{}{}%
+ {\centering
+ \ifnum \c@secnumdepth >-2\relax
+ \huge\bf \partname{} \thepart
+ \par
+ \vskip 20pt \fi
+ \Huge \bf
+ #1\par}\@endpart}}{}%
+\or
+% \end{macrocode}
+%
+% Now we address the case where \file{babel.def} is read after the
+% \texttt{letter} style. The \texttt{letter} document style
+% defines the macro |\opening| and some other macros that are
+% specific to \texttt{letter}. This means that we have to redefine
+% other macros, compared to the previous two cases.
+%
+% First two macros for the material at the end of a letter, the
+% |\cc| and |\encl| macros.
+% \begin{macrocode}
+\@ifundefined{ccname}%
+ {\def\cc#1{\par\noindent
+ \parbox[t]{\textwidth}%
+ {\@hangfrom{\rm \ccname : }\ignorespaces #1\strut}\par}}{}
+\@ifundefined{enclname}%
+ {\def\encl#1{\par\noindent
+ \parbox[t]{\textwidth}%
+ {\@hangfrom{\rm \enclname : }\ignorespaces #1\strut}\par}}{}
+% \end{macrocode}
+%
+% The last thing we have to do here is to redefine the
+% \texttt{headings} pagestyle:
+% \changes{babel~3.3}{1993/07/11}{\cs{headpagename} should be
+% \cs{pagename}}
+% \begin{macrocode}
+\@ifundefined{headtoname}%
+ {\def\ps@headings{%
+ \def\@oddhead{\sl \headtoname{} \ignorespaces\toname \hfil
+ \@date \hfil \pagename{} \thepage}%
+ \def\@oddfoot{}}}{}
+\fi
+%</names>
+% \end{macrocode}
+%
+% This was the last of the four standard document styles, so if
+% |\doc@style| has another value we do nothing and just close the
+% \texttt{if} construction. Here ends the code that can be optionally
+% included when a version of \LaTeX\ is in use that is dated
+% \emph{before} December~1991.
+%
+% We also need to redefine a number of commands to ensure that the
+% right font encoding is used, but this can't be done before
+% \file{babel.def} is loaded.
+% \changes{babel~3.6o}{1999/04/07}{Moved the rest of the font encoding
+% related definitions to their original place}
+%
%%
%% \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
diff --git a/Master/texmf-dist/source/latex/babel/bbunicode.dtx b/Master/texmf-dist/source/latex/babel/bbunicode.dtx
index 7c369343994..a8177272a7f 100644
--- a/Master/texmf-dist/source/latex/babel/bbunicode.dtx
+++ b/Master/texmf-dist/source/latex/babel/bbunicode.dtx
@@ -31,7 +31,7 @@
% \iffalse
%<*dtx>
\ProvidesFile{bbunicode.dtx}
- [2017/04/28 v3.9t Babel hooks for Unicode engines]
+ [2017/05/19 v3.10 Babel hooks for Unicode engines]
%</dtx>
%
%% File `bbunicode.dtx'
diff --git a/Master/texmf-dist/tex/generic/babel/UKenglish.sty b/Master/texmf-dist/tex/generic/babel/UKenglish.sty
index 7d6c01a8452..0cdf3958c32 100644
--- a/Master/texmf-dist/tex/generic/babel/UKenglish.sty
+++ b/Master/texmf-dist/tex/generic/babel/UKenglish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `UKenglish')
+%% bbcompat.dtx (with options: `styfile,UKenglish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/USenglish.sty b/Master/texmf-dist/tex/generic/babel/USenglish.sty
index 18b6877a918..ab864c2016d 100644
--- a/Master/texmf-dist/tex/generic/babel/USenglish.sty
+++ b/Master/texmf-dist/tex/generic/babel/USenglish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `USenglish')
+%% bbcompat.dtx (with options: `styfile,USenglish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/afrikaans.sty b/Master/texmf-dist/tex/generic/babel/afrikaans.sty
index 2b922fb66d7..8e516364bec 100644
--- a/Master/texmf-dist/tex/generic/babel/afrikaans.sty
+++ b/Master/texmf-dist/tex/generic/babel/afrikaans.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `afrikaans')
+%% bbcompat.dtx (with options: `styfile,afrikaans')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/albanian.sty b/Master/texmf-dist/tex/generic/babel/albanian.sty
index c21f77378a9..1bc0d30e100 100644
--- a/Master/texmf-dist/tex/generic/babel/albanian.sty
+++ b/Master/texmf-dist/tex/generic/babel/albanian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `albanian')
+%% bbcompat.dtx (with options: `styfile,albanian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/american.sty b/Master/texmf-dist/tex/generic/babel/american.sty
index 32b26472b1b..677b98851f1 100644
--- a/Master/texmf-dist/tex/generic/babel/american.sty
+++ b/Master/texmf-dist/tex/generic/babel/american.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `american')
+%% bbcompat.dtx (with options: `styfile,american')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/austrian.sty b/Master/texmf-dist/tex/generic/babel/austrian.sty
index 18ae3670324..c90892b3680 100644
--- a/Master/texmf-dist/tex/generic/babel/austrian.sty
+++ b/Master/texmf-dist/tex/generic/babel/austrian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `austrian')
+%% bbcompat.dtx (with options: `styfile,austrian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def
index 4d3a6bbcae9..815dedaecb6 100644
--- a/Master/texmf-dist/tex/generic/babel/babel.def
+++ b/Master/texmf-dist/tex/generic/babel/babel.def
@@ -38,7 +38,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File 'babel.dtx'
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%% Babel package for LaTeX2e.
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
@@ -56,7 +56,7 @@
\wlog{File: #1 #4 #3 <#2>}%
\let\ProvidesFile\@undefined}
\fi
-\ProvidesFile{babel.def}[2017/04/28 3.9t Babel common definitions]
+\ProvidesFile{babel.def}[2017/05/19 3.10 Babel common definitions]
\ifx\AtBeginDocument\@undefined
\input plain.def\relax
\fi
@@ -67,7 +67,7 @@
\let\bbl@afterlang\relax
\let\bbl@language@opts\@empty
\fi
-\def\bbl@tempa{3.9t}%
+\def\bbl@tempa{3.10}%
\ifx\bbl@version\bbl@tempa\else
\input switch.def\relax
\fi
@@ -152,6 +152,38 @@
\def\bbl@ifblank#1{%
\bbl@ifblank@i#1\@nil\@nil\@secondoftwo\@firstoftwo\@nil}
\long\def\bbl@ifblank@i#1#2\@nil#3#4#5\@nil{#4}
+\def\bbl@forkv#1#2{%
+ \def\bbl@kvcmd##1##2##3{#2}%
+ \bbl@kvnext#1,\@nil,}
+\def\bbl@kvnext#1,{%
+ \ifx\@nil#1\relax\else
+ \bbl@ifblank{#1}{}{\bbl@forkv@eq#1=\@empty=\@nil{#1}}%
+ \expandafter\bbl@kvnext
+ \fi}
+\def\bbl@forkv@eq#1=#2=#3\@nil#4{%
+ \bbl@trim@def\bbl@forkv@a{#1}%
+ \bbl@trim{\expandafter\bbl@kvcmd\expandafter{\bbl@forkv@a}}{#2}{#4}}
+\def\bbl@vforeach#1#2{%
+ \def\bbl@forcmd##1{#2}%
+ \bbl@fornext#1,\@nil,}
+\def\bbl@fornext#1,{%
+ \ifx\@nil#1\relax\else
+ \bbl@ifblank{#1}{}{\bbl@trim\bbl@forcmd{#1}}%
+ \expandafter\bbl@fornext
+ \fi}
+\def\bbl@foreach#1{\expandafter\bbl@vforeach\expandafter{#1}}
+\def\bbl@replace#1#2#3{% in #1 -> repl #2 by #3
+ \toks@{}%
+ \def\bbl@replace@aux##1#2##2#2{%
+ \ifx\bbl@nil##2%
+ \toks@\expandafter{\the\toks@##1}%
+ \else
+ \toks@\expandafter{\the\toks@##1#3}%
+ \bbl@afterfi
+ \bbl@replace@aux##2#2%
+ \fi}%
+ \expandafter\bbl@replace@aux#1#2\bbl@nil#2%
+ \edef#1{\the\toks@}}
\def\bbl@exp#1{%
\begingroup
\let\\\noexpand
@@ -234,7 +266,7 @@
adddialect=2,patterns=2,defaultcommands=0,encodedcommands=2,write=0,%
beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,%
hyphenation=2,initiateactive=3,afterreset=0}
-\newcommand\babelensure[2][]{%
+\newcommand\babelensure[2][]{% TODO - revise test files
\AddBabelHook{babel-ensure}{afterextras}{%
\ifcase\bbl@select@type
\@nameuse{bbl@e@\languagename}%
@@ -247,7 +279,7 @@
\ifx\@empty##1\else\noexpand##1\expandafter\bbl@tempb\fi}%
\edef\bbl@tempa{\bbl@tempb#1\@empty}%
\def\bbl@tempb##1=##2\@@{\@namedef{bbl@ens@##1}{##2}}%
- \bbl@for\bbl@tempa\bbl@tempa{\expandafter\bbl@tempb\bbl@tempa\@@}%
+ \bbl@foreach\bbl@tempa{\bbl@tempb##1\@@}%
\def\bbl@tempc{\bbl@ensure}%
\expandafter\bbl@add\expandafter\bbl@tempc\expandafter{%
\expandafter{\bbl@ens@include}}%
@@ -257,8 +289,8 @@
\bbl@exp{%
\endgroup
\def\<bbl@e@#2>{\the\toks@{\bbl@ens@fontenc}}}}
-\def\bbl@ensure#1#2#3{%
- \def\bbl@tempb##1{% elt for \bbl@ensured list
+\def\bbl@ensure#1#2#3{% 1: include 2: exclude 3: fontenc
+ \def\bbl@tempb##1{% elt for (excluding) \bbl@captionslist list
\ifx##1\@empty\else
\in@{##1}{#2}%
\ifin@\else
@@ -278,7 +310,7 @@
\fi
\expandafter\bbl@tempb
\fi}%
- \expandafter\bbl@tempb\bbl@ensured\@empty
+ \expandafter\bbl@tempb\bbl@captionslist\today\@empty
\def\bbl@tempa##1{% elt for include list
\ifx##1\@empty\else
\bbl@csarg\in@{ensure@\languagename\expandafter}\expandafter{##1}%
@@ -288,11 +320,21 @@
\expandafter\bbl@tempa
\fi}%
\bbl@tempa#1\@empty}
-\def\bbl@ensured{%
+\def\bbl@captionslist{%
\prefacename\refname\abstractname\bibname\chaptername\appendixname
\contentsname\listfigurename\listtablename\indexname\figurename
\tablename\partname\enclname\ccname\headtoname\pagename\seename
- \alsoname\proofname\glossaryname\today}
+ \alsoname\proofname\glossaryname}
+\def\bbl@ldfinit{%
+ \let\bbl@screset\@empty
+ \let\BabelStrings\bbl@opt@string
+ \let\BabelOptions\@empty
+ \let\BabelLanguages\relax
+ \ifx\originalTeX\@undefined
+ \let\originalTeX\@empty
+ \else
+ \originalTeX
+ \fi}
\def\LdfInit#1#2{%
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
@@ -308,26 +350,20 @@
\ldf@quit{#1}%
\fi
\fi
- \let\bbl@screset\@empty
- \let\BabelStrings\bbl@opt@strings
- \let\BabelOptions\@empty
- \let\BabelLanguages\relax
- \ifx\originalTeX\@undefined
- \let\originalTeX\@empty
- \else
- \originalTeX
- \fi}
+ \bbl@ldfinit}
\def\ldf@quit#1{%
\expandafter\main@language\expandafter{#1}%
\catcode`\@=\atcatcode \let\atcatcode\relax
\catcode`\==\eqcatcode \let\eqcatcode\relax
\endinput}
-\def\ldf@finish#1{%
- \loadlocalcfg{#1}%
+\def\bbl@afterldf#1{%
\bbl@afterlang
\let\bbl@afterlang\relax
\let\BabelModifiers\relax
- \let\bbl@screset\relax
+ \let\bbl@screset\relax}%
+\def\ldf@finish#1{%
+ \loadlocalcfg{#1}%
+ \bbl@afterldf{#1}%
\expandafter\main@language\expandafter{#1}%
\catcode`\@=\atcatcode \let\atcatcode\relax
\catcode`\==\eqcatcode \let\eqcatcode\relax}
@@ -346,16 +382,20 @@
\else
\select@language{#1}%
\fi}
-\def\bbl@add@special#1{%
- \begingroup
- \def\do{\noexpand\do\noexpand}%
- \def\@makeother{\noexpand\@makeother\noexpand}%
- \edef\x{\endgroup
- \def\noexpand\dospecials{\dospecials\do#1}%
- \expandafter\ifx\csname @sanitize\endcsname\relax \else
- \def\noexpand\@sanitize{\@sanitize\@makeother#1}%
- \fi}%
- \x}
+\def\bbl@add@special#1{% 1:a macro like \", \?, etc.
+ \bbl@add\dospecials{\do#1}% test @sanitize = \relax, for back. compat.
+ \bbl@ifunset{@sanitize}{}{\bbl@add\@sanitize{\@makeother#1}}%
+ \ifx\nfss@catcodes\@undefined\else % TODO - same for above
+ \begingroup
+ \catcode`#1\active
+ \nfss@catcodes
+ \ifnum\catcode`#1=\active
+ \endgroup
+ \bbl@add\nfss@catcodes{\@makeother#1}%
+ \else
+ \endgroup
+ \fi
+ \fi}
\def\bbl@remove@special#1{%
\begingroup
\def\x##1##2{\ifnum`#1=`##2\noexpand\@empty
@@ -457,11 +497,11 @@
\@ifpackagewith{babel}{KeepShorthandsActive}%
{\let\bbl@restoreactive\@gobble}%
{\def\bbl@restoreactive#1{%
- \edef\bbl@tempa{%
- \noexpand\AfterBabelLanguage\noexpand\CurrentOption
+ \bbl@exp{%
+ \\\AfterBabelLanguage\\\CurrentOption
{\catcode`#1=\the\catcode`#1\relax}%
- \noexpand\AtEndOfPackage{\catcode`#1=\the\catcode`#1\relax}}%
- \bbl@tempa}%
+ \\\AtEndOfPackage
+ {\catcode`#1=\the\catcode`#1\relax}}}%
\AtEndOfPackage{\let\bbl@restoreactive\@gobble}}
\def\bbl@sh@select#1#2{%
\expandafter\ifx\csname#1@sh@#2@sel\endcsname\relax
@@ -663,25 +703,23 @@
\def\bbl@tempc{#1}%
\bbl@fixname\bbl@tempc
\bbl@iflanguage\bbl@tempc{%
- \bbl@loopx\bbl@attr{#2}{%
+ \bbl@vforeach{#2}{%
\ifx\bbl@known@attribs\@undefined
\in@false
\else
- \@expandtwoargs\in@{,\bbl@tempc-\bbl@attr,}{,\bbl@known@attribs,}%
+ \@expandtwoargs\in@{,\bbl@tempc-##1,}{,\bbl@known@attribs,}%
\fi
\ifin@
\bbl@warning{%
- You have more than once selected the attribute '\bbl@attr'\\%
+ You have more than once selected the attribute '##1'\\%
for language #1}%
\else
- \edef\bbl@tempa{%
- \noexpand\bbl@add@list
- \noexpand\bbl@known@attribs{\bbl@tempc-\bbl@attr}}%
- \bbl@tempa
- \edef\bbl@tempa{\bbl@tempc-\bbl@attr}%
+ \bbl@exp{%
+ \\\bbl@add@list\\\bbl@known@attribs{\bbl@tempc-##1}}%
+ \edef\bbl@tempa{\bbl@tempc-##1}%
\expandafter\bbl@ifknown@ttrib\expandafter{\bbl@tempa}\bbl@attributes%
- {\csname\bbl@tempc @attr@\bbl@attr\endcsname}%
- {\@attrerr{\bbl@tempc}{\bbl@attr}}%
+ {\csname\bbl@tempc @attr@##1\endcsname}%
+ {\@attrerr{\bbl@tempc}{##1}}%
\fi}}}
\@onlypreamble\languageattribute
\newcommand*{\@attrerr}[2]{%
@@ -732,18 +770,13 @@
\babel@beginsave
\def\babel@save#1{%
\expandafter\let\csname babel@\number\babel@savecnt\endcsname#1\relax
- \begingroup
- \toks@\expandafter{\originalTeX\let#1=}%
- \edef\x{\endgroup
- \def\noexpand\originalTeX{\the\toks@ \expandafter\noexpand
- \csname babel@\number\babel@savecnt\endcsname\relax}}%
- \x
+ \toks@\expandafter{\originalTeX\let#1=}%
+ \bbl@exp{%
+ \def\\\originalTeX{\the\toks@\<babel@\number\babel@savecnt>\relax}}%
\advance\babel@savecnt\@ne}
-\def\babel@savevariable#1{\begingroup
- \toks@\expandafter{\originalTeX #1=}%
- \edef\x{\endgroup
- \def\noexpand\originalTeX{\the\toks@ \the#1\relax}}%
- \x}
+\def\babel@savevariable#1{%
+ \toks@\expandafter{\originalTeX #1=}%
+ \bbl@exp{\def\\\originalTeX{\the\toks@\the#1\relax}}}
\def\bbl@frenchspacing{%
\ifnum\the\sfcode`\.=\@m
\let\bbl@nonfrenchspacing\relax
@@ -781,8 +814,8 @@
\ifx\@empty#1%
\protected@edef\bbl@hyphenation@{\bbl@hyphenation@\space#2}%
\else
- \edef\bbl@tempb{\zap@space#1 \@empty}%
- \bbl@for\bbl@tempa\bbl@tempb{%
+ \bbl@vforeach{#1}{%
+ \def\bbl@tempa{##1}%
\bbl@fixname\bbl@tempa
\bbl@iflanguage\bbl@tempa{%
\bbl@csarg\protected@edef{hyphenation@\bbl@tempa}{%
@@ -863,10 +896,9 @@
\bbl@loop\bbl@tempa{##2}{% empty items and spaces are ok
\advance\count@\@ne
\toks@\expandafter{\bbl@tempa}%
- \edef\bbl@tempb{%
- \bbl@templ{\romannumeral\count@}{\the\toks@}%
- \count@=\the\count@\relax}%
- \expandafter\SetString\bbl@tempb}}%
+ \bbl@exp{%
+ \\\SetString\bbl@templ{\romannumeral\count@}{\the\toks@}%
+ \count@=\the\count@\relax}}}%
\newcommand\SetCase[3][]{%
\bbl@patchuclc
\bbl@forlang\bbl@tempa{%
@@ -923,7 +955,7 @@
\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}%
+ \bbl@vforeach{label=#1}{\bbl@tempa##1\@nil}%
\def\bbl@tempa##1 ##2{% space -> comma
##1%
\ifx\@empty##2\else\ifx,##1,\else,\fi\bbl@afterfi\bbl@tempa##2\fi}%
@@ -931,13 +963,13 @@
\edef\bbl@sc@label{\expandafter\zap@space\bbl@sc@label\@empty}%
\edef\bbl@sc@charset{\expandafter\zap@space\bbl@sc@charset\@empty}%
\def\bbl@encstring##1##2{%
- \bbl@for\bbl@tempc\bbl@sc@fontenc{%
- \bbl@ifunset{T@\bbl@tempc}%
+ \bbl@foreach\bbl@sc@fontenc{%
+ \bbl@ifunset{T@####1}%
{}%
- {\ProvideTextCommand##1\bbl@tempc{##2}%
+ {\ProvideTextCommand##1{####1}{##2}%
\bbl@toglobal##1%
\expandafter
- \bbl@toglobal\csname\bbl@tempc\string##1\endcsname}}}%
+ \bbl@toglobal\csname####1\string##1\endcsname}}}%
\def\bbl@sctest{%
\@expandtwoargs
\in@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}}%
@@ -996,7 +1028,7 @@
\bbl@forlang\bbl@tempa{%
\edef\bbl@LC{\bbl@tempa\bbl@stripslash#1}%
\bbl@ifunset{\bbl@LC}% eg, \germanchaptername
- {\global\expandafter
+ {\global\expandafter % TODO - con \bbl@exp ?
\bbl@add\csname\bbl@G\bbl@tempa\expandafter\endcsname\expandafter
{\expandafter\bbl@scset\expandafter#1\csname\bbl@LC\endcsname}}%
{}%
@@ -1051,9 +1083,9 @@
\fi}%
\bbl@tempa}
\AtEndOfPackage{%
- \ifx\bbl@hymapopt\@undefined
+ \ifx\bbl@opt@hyphenmap\@undefined
\@expandtwoargs\in@{,}{\bbl@language@opts}%
- \chardef\bbl@hymapopt\ifin@4\else\@ne\fi
+ \chardef\bbl@opt@hyphenmap\ifin@4\else\@ne\fi
\fi}
\def\set@low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}%
\dimen\z@\ht\z@ \advance\dimen\z@ -\ht\tw@%
@@ -1240,6 +1272,153 @@
\aftergroup\endinput
\fi
\fi}
+\newcommand\babelprovide[2][]{%
+ \let\bbl@savelangname\languagename
+ \def\languagename{#2}%
+ \let\bbl@KVP@captions\@nil
+ \let\bbl@KVP@main\@nil
+ \let\bbl@KVP@hyphenrules\@nil
+ \bbl@forkv{#1}{\bbl@csarg\def{KVP@##1}{##2}}% TODO - error handling
+ \bbl@ifunset{date#2}%
+ {\bbl@provide@new{#2}}%
+ {\bbl@ifblank{#1}%
+ {\bbl@error
+ {If you want to modify `#2' you must tell how in\\%
+ the optional argument. Currently there are two\\%
+ options: captions=lang-tag, hyphenrules=lang-list}%
+ {Use this macro as documented}
+}%
+ {\bbl@provide@renew{#2}}}%
+ \babelensure{#2}%
+ \let\languagename\bbl@savelangname}
+\def\bbl@provide@new#1{%
+ \bbl@provide@hyphens{#1}%
+ \@namedef{date#1}{}% marks lang exists - required by \StartBabelCommands
+ \@namedef{extras#1}{}%
+ \@namedef{noextras#1}{}%
+ \StartBabelCommands*{#1}{captions}%
+ \ifx\bbl@KVP@captions\@nil
+ \def\bbl@tempb##1{% elt for \bbl@captionslist
+ \ifx##1\@empty\else
+ \bbl@exp{%
+ \\\SetString\\##1{%
+ \\\bbl@nocaption{\bbl@stripslash##1}{\<#1\bbl@stripslash##1>}}}%
+ \expandafter\bbl@tempb
+ \fi}%
+ \expandafter\bbl@tempb\bbl@captionslist\@empty
+ \else
+ \bbl@read@ini{\bbl@KVP@captions}% Here all letters cat = 11
+ \bbl@after@ini
+ \bbl@savestrings
+ \fi
+ \StartBabelCommands*{#1}{date}%
+ \bbl@exp{%
+ \\\SetString\\\today{\\\bbl@nocaption{today}{\<#1today>}}}%
+ \EndBabelCommands
+ \expandafter\gdef\csname#1hyphenmins\endcsname{23}%
+ \ifx\bbl@KVP@main\@nil\else
+ \expandafter\main@language\expandafter{#1}%
+ \fi}
+\def\bbl@provide@renew#1{%
+ \bbl@provide@hyphens{#1}%
+ \ifx\bbl@KVP@captions\@nil\else
+ \StartBabelCommands*{#1}{captions}%
+ \bbl@read@ini{\bbl@KVP@captions}% Here all letters cat = 11
+ \bbl@after@ini
+ \bbl@savestrings
+ \EndBabelCommands
+ \fi}
+\def\bbl@provide@hyphens#1{%
+ \let\bbl@tempa\relax
+ \ifx\bbl@KVP@hyphenrules\@nil\else
+ \bbl@replace\bbl@KVP@hyphenrules{ }{,}%
+ \bbl@foreach\bbl@KVP@hyphenrules{%
+ \ifx\bbl@tempa\relax % if not yet found
+ \bbl@ifsamestring{##1}{+}%
+ {{\bbl@exp{\\\addlanguage\<l@##1>}}}%
+ {}%
+ \bbl@ifunset{l@##1}%
+ {}%
+ {\bbl@exp{\let\bbl@tempa\<l@##1>}}%
+ \fi}%
+ \fi
+ \ifx\bbl@tempa\relax % if no option or no language found
+ \bbl@ifunset{l@#1}% no hyphenrules found - fallback
+ {\bbl@exp{\\\adddialect\<l@#1>\language}}%
+ {}%
+ \else
+ \bbl@exp{\\\adddialect\<l@#1>\bbl@tempa}% found in opt list
+ \fi}
+\def\bbl@read@ini#1{%
+ \openin1=babel-#1.ini
+ \ifeof1
+ \bbl@error
+ {There is no ini file for the requested language\\%
+ (#1). Perhaps you misspelled it or your installation\\%
+ is not complete.}%
+ {Fix the name or reinstall babel.}%
+ \else
+ \let\bbl@section\@empty
+ \let\bbl@savestrings\@empty
+ \loop
+ \endlinechar\m@ne
+ \read1 to \bbl@line
+ \endlinechar`\^^M
+ \if T\ifeof1F\fi T\relax % Trick, because inside \loop
+ \ifx\bbl@line\@empty\else
+ \expandafter\bbl@iniline\bbl@line\bbl@iniline
+ \fi
+ \repeat
+ \fi}
+\def\bbl@iniline#1\bbl@iniline{%
+ \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inikv}#1\@@} %]
+\def\bbl@iniskip#1\@@{}% if starts with ;
+\def\bbl@inisec[#1]#2\@@{% if starts with opening bracket
+ \def\bbl@section{#1}%
+ \bbl@debug{\message{[[ #1 ]]^^J}}}
+\def\bbl@inikv#1=#2\@@{% otherwise, key=value
+ \bbl@trim@def\bbl@tempa{#1}%
+ \bbl@trim\toks@{#2}%
+ \bbl@ifunset{bbl@ini@\bbl@section}%
+ {}%
+ {\bbl@exp{%
+ \<bbl@ini@\bbl@section>\bbl@tempa=\the\toks@\\\@nil}}}
+\def\bbl@after@ini{%
+ % make sure Script and Language takes some value
+ \bbl@exp{\\\bbl@ifblank{\@nameuse{bbl@lotf@\languagename}}}%
+ {\bbl@csarg\gdef{lotf@\languagename}{dflt}}{}%
+ \bbl@exp{\\\bbl@ifblank{\@nameuse{bbl@sotf@\languagename}}}%
+ {\bbl@csarg\gdef{sotf@\languagename}{DFLT}}{}}
+\def\bbl@exportkey#1#2#3#4{% 1:bbl id,2:ini name,3:ini key,4:ini val
+ \bbl@ifsamestring{#2}{#3}%
+ {\bbl@csarg\gdef{#1@\languagename}{#4}}%
+ {}}
+\ifcase\bbl@engine
+ \bbl@csarg\def{ini@captions.licr}#1=#2\@nil{% TODO - copypaste pattern
+ \bbl@ifblank{#2}%
+ {\bbl@exp{%
+ \toks@{\\\bbl@nocaption{#1}\<\languagename#1name>}}}%
+ {\toks@{#2}}%
+ \bbl@exp{%
+ \\\bbl@add\\\bbl@savestrings{% NOTE - with date will be global
+ \\\SetString\<#1name>{\the\toks@}}}}
+\else
+ \def\bbl@ini@captions#1=#2\@nil{%
+ \bbl@ifblank{#2}%
+ {\bbl@exp{%
+ \toks@{\\\bbl@nocaption{#1}\<\languagename#1name>}}}%
+ {\toks@{#2}}%
+ \bbl@exp{%
+ \\\bbl@add\\\bbl@savestrings{%
+ \\\SetString\<#1name>{\the\toks@}}}}
+\fi
+\def\bbl@ini@identification#1=#2\@nil{% TODO - not only with captions
+ \bbl@exportkey{lname}{name.english}{#1}{#2}%
+ \bbl@exportkey{lbcp}{tag.bcp47}{#1}{#2}%
+ \bbl@exportkey{lotf}{tag.opentype}{#1}{#2}%
+ \bbl@exportkey{sname}{script.name}{#1}{#2}%
+ \bbl@exportkey{sbcp}{script.tag.bcp47}{#1}{#2}%
+ \bbl@exportkey{sotf}{script.tag.opentype}{#1}{#2}}
\ifx\bbl@opt@safe\@empty\else
\def\@newl@bel#1#2#3{%
{\@safe@activestrue
@@ -1417,11 +1596,10 @@
\let\ensureascii\@firstofone
\AtBeginDocument{%
\in@false
- \bbl@loopx\bbl@tempa\BabelNonASCII{% is there a non-ascii enc?
+ \bbl@foreach\BabelNonASCII{% is there a non-ascii enc?
\ifin@\else
- \edef\bbl@tempb{{,\bbl@tempa enc.def,}{,\@filelist,}}%
- \lowercase\expandafter{\expandafter\in@\bbl@tempb}%
- \fi}
+ \lowercase{\@expandtwoargs\in@{,#1enc.def,}{,\@filelist,}}%
+ \fi}%
\ifin@ % if a non-ascii has been loaded
\def\ensureascii#1{{\fontencoding{OT1}\selectfont#1}}%
\DeclareTextCommandDefault{\TeX}{\org@TeX}%
@@ -1439,7 +1617,7 @@
\def\ensureascii##1{{\fontencoding{#1}\selectfont##1}}%
\fi}%
\fi}%
- \bbl@loopx\bbl@tempa\@filelist{\expandafter\bbl@tempb\bbl@tempa\@@}%
+ \bbl@foreach\@filelist{\bbl@tempb#1\@@}% TODO - \@@ de mas??
\@expandtwoargs\in@{,\cf@encoding,}{,\BabelNonASCII,}%
\ifin@\else
\edef\ensureascii#1{{%
diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty
index 2021e85f21a..f183ce68e6b 100644
--- a/Master/texmf-dist/tex/generic/babel/babel.sty
+++ b/Master/texmf-dist/tex/generic/babel/babel.sty
@@ -38,7 +38,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File 'babel.dtx'
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%% Babel package for LaTeX2e.
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
@@ -48,10 +48,12 @@
%% by Javier Bezos
%% all rights reserved.
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2017/04/28 3.9t The Babel package]
+\ProvidesPackage{babel}[2017/05/19 3.10 The Babel package]
\@ifpackagewith{babel}{debug}
- {\input switch.def\relax}
- {\def\bbl@tempa{3.9t}%
+ {\let\bbl@debug\@firstofone
+ \input switch.def\relax}
+ {\let\bbl@debug\@gobble
+ \def\bbl@tempa{3.10}%
\ifx\bbl@version\bbl@tempa\else
\input switch.def\relax
\fi}
@@ -115,6 +117,38 @@
\def\bbl@ifblank#1{%
\bbl@ifblank@i#1\@nil\@nil\@secondoftwo\@firstoftwo\@nil}
\long\def\bbl@ifblank@i#1#2\@nil#3#4#5\@nil{#4}
+\def\bbl@forkv#1#2{%
+ \def\bbl@kvcmd##1##2##3{#2}%
+ \bbl@kvnext#1,\@nil,}
+\def\bbl@kvnext#1,{%
+ \ifx\@nil#1\relax\else
+ \bbl@ifblank{#1}{}{\bbl@forkv@eq#1=\@empty=\@nil{#1}}%
+ \expandafter\bbl@kvnext
+ \fi}
+\def\bbl@forkv@eq#1=#2=#3\@nil#4{%
+ \bbl@trim@def\bbl@forkv@a{#1}%
+ \bbl@trim{\expandafter\bbl@kvcmd\expandafter{\bbl@forkv@a}}{#2}{#4}}
+\def\bbl@vforeach#1#2{%
+ \def\bbl@forcmd##1{#2}%
+ \bbl@fornext#1,\@nil,}
+\def\bbl@fornext#1,{%
+ \ifx\@nil#1\relax\else
+ \bbl@ifblank{#1}{}{\bbl@trim\bbl@forcmd{#1}}%
+ \expandafter\bbl@fornext
+ \fi}
+\def\bbl@foreach#1{\expandafter\bbl@vforeach\expandafter{#1}}
+\def\bbl@replace#1#2#3{% in #1 -> repl #2 by #3
+ \toks@{}%
+ \def\bbl@replace@aux##1#2##2#2{%
+ \ifx\bbl@nil##2%
+ \toks@\expandafter{\the\toks@##1}%
+ \else
+ \toks@\expandafter{\the\toks@##1#3}%
+ \bbl@afterfi
+ \bbl@replace@aux##2#2%
+ \fi}%
+ \expandafter\bbl@replace@aux#1#2\bbl@nil#2%
+ \edef#1{\the\toks@}}
\def\bbl@exp#1{%
\begingroup
\let\\\noexpand
@@ -192,8 +226,7 @@
\fi
\fi}
\let\bbl@tempc\@empty
-\bbl@for\bbl@tempa\bbl@tempa{%
- \expandafter\bbl@tempd\bbl@tempa.\@empty\@nnil}
+\bbl@foreach\bbl@tempa{\bbl@tempd#1.\@empty\@nnil}
\expandafter\let\csname opt@babel.sty\endcsname\bbl@tempc
\DeclareOption{KeepShorthandsActive}{}
\DeclareOption{activeacute}{}
@@ -210,11 +243,11 @@
\DeclareOption{strings}{\def\bbl@opt@strings{\BabelStringsDefault}}
\DeclareOption{strings=encoded}{\let\bbl@opt@strings\relax}
\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}
+\DeclareOption{hyphenmap=off}{\chardef\bbl@opt@hyphenmap\z@}
+\DeclareOption{hyphenmap=first}{\chardef\bbl@opt@hyphenmap\@ne}
+\DeclareOption{hyphenmap=select}{\chardef\bbl@opt@hyphenmap\tw@}
+\DeclareOption{hyphenmap=other}{\chardef\bbl@opt@hyphenmap\thr@@}
+\DeclareOption{hyphenmap=other*}{\chardef\bbl@opt@hyphenmap4\relax}
\DeclareOption{safe=none}{\let\bbl@opt@safe\@empty}
\DeclareOption{safe=bib}{\def\bbl@opt@safe{B}}
\DeclareOption{safe=ref}{\def\bbl@opt@safe{R}}
@@ -343,16 +376,12 @@
{\noexpand\bbl@load@language{\bbl@tempa}}}%
\bbl@tempb}%
\@empty}
-\bbl@for\bbl@tempa\@classoptionslist{%
- \bbl@ifunset{ds@\bbl@tempa}%
- {\IfFileExists{\bbl@tempa.ldf}%
- {\edef\bbl@tempb{%
- \noexpand\DeclareOption
- {\bbl@tempa}%
- {\noexpand\bbl@load@language{\bbl@tempa}}}%
- \bbl@tempb}%
- \@empty}%
- \@empty}
+\bbl@foreach\@classoptionslist{%
+ \bbl@ifunset{ds@#1}%
+ {\IfFileExists{#1.ldf}%
+ {\DeclareOption{#1}{\bbl@load@language{#1}}}%
+ {}}%
+ {}}
\ifx\bbl@opt@main\@nnil\else
\expandafter
\let\expandafter\bbl@loadmain\csname ds@\bbl@opt@main\endcsname
diff --git a/Master/texmf-dist/tex/generic/babel/bahasa.sty b/Master/texmf-dist/tex/generic/babel/bahasa.sty
index 55c75e82da0..9aa1c88a7ce 100644
--- a/Master/texmf-dist/tex/generic/babel/bahasa.sty
+++ b/Master/texmf-dist/tex/generic/babel/bahasa.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `bahasa')
+%% bbcompat.dtx (with options: `styfile,bahasa')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/bahasam.sty b/Master/texmf-dist/tex/generic/babel/bahasam.sty
index 98c9a0e7535..cdd3ee32a6f 100644
--- a/Master/texmf-dist/tex/generic/babel/bahasam.sty
+++ b/Master/texmf-dist/tex/generic/babel/bahasam.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `bahasam')
+%% bbcompat.dtx (with options: `styfile,bahasam')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/basque.sty b/Master/texmf-dist/tex/generic/babel/basque.sty
index 51f74b1532b..011ae537a66 100644
--- a/Master/texmf-dist/tex/generic/babel/basque.sty
+++ b/Master/texmf-dist/tex/generic/babel/basque.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `basque')
+%% bbcompat.dtx (with options: `styfile,basque')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/blplain.tex b/Master/texmf-dist/tex/generic/babel/blplain.tex
index 5229065aca4..d81d99177d5 100644
--- a/Master/texmf-dist/tex/generic/babel/blplain.tex
+++ b/Master/texmf-dist/tex/generic/babel/blplain.tex
@@ -38,7 +38,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File 'babel.dtx'
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%% Babel package for LaTeX2e.
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
diff --git a/Master/texmf-dist/tex/generic/babel/bplain.tex b/Master/texmf-dist/tex/generic/babel/bplain.tex
index cb55c63c05d..4ef65deba93 100644
--- a/Master/texmf-dist/tex/generic/babel/bplain.tex
+++ b/Master/texmf-dist/tex/generic/babel/bplain.tex
@@ -38,7 +38,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File 'babel.dtx'
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%% Babel package for LaTeX2e.
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
diff --git a/Master/texmf-dist/tex/generic/babel/breton.sty b/Master/texmf-dist/tex/generic/babel/breton.sty
index f7a5e405d27..30254afbeef 100644
--- a/Master/texmf-dist/tex/generic/babel/breton.sty
+++ b/Master/texmf-dist/tex/generic/babel/breton.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `breton')
+%% bbcompat.dtx (with options: `styfile,breton')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/british.sty b/Master/texmf-dist/tex/generic/babel/british.sty
index 7961f024391..73105587673 100644
--- a/Master/texmf-dist/tex/generic/babel/british.sty
+++ b/Master/texmf-dist/tex/generic/babel/british.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `british')
+%% bbcompat.dtx (with options: `styfile,british')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/bulgarian.sty b/Master/texmf-dist/tex/generic/babel/bulgarian.sty
index 9d86b73e1e5..d4868661c7a 100644
--- a/Master/texmf-dist/tex/generic/babel/bulgarian.sty
+++ b/Master/texmf-dist/tex/generic/babel/bulgarian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `bulgarian')
+%% bbcompat.dtx (with options: `styfile,bulgarian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/catalan.sty b/Master/texmf-dist/tex/generic/babel/catalan.sty
index cbc7788b945..071a98082e0 100644
--- a/Master/texmf-dist/tex/generic/babel/catalan.sty
+++ b/Master/texmf-dist/tex/generic/babel/catalan.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `catalan')
+%% bbcompat.dtx (with options: `styfile,catalan')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/croatian.sty b/Master/texmf-dist/tex/generic/babel/croatian.sty
index 9a5ccbc52a4..1b822b5e7a7 100644
--- a/Master/texmf-dist/tex/generic/babel/croatian.sty
+++ b/Master/texmf-dist/tex/generic/babel/croatian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `croatian')
+%% bbcompat.dtx (with options: `styfile,croatian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/czech.sty b/Master/texmf-dist/tex/generic/babel/czech.sty
index 99e2a235ada..60df29108d1 100644
--- a/Master/texmf-dist/tex/generic/babel/czech.sty
+++ b/Master/texmf-dist/tex/generic/babel/czech.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `czech')
+%% bbcompat.dtx (with options: `styfile,czech')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/danish.sty b/Master/texmf-dist/tex/generic/babel/danish.sty
index 497cfea88d0..c08157aaace 100644
--- a/Master/texmf-dist/tex/generic/babel/danish.sty
+++ b/Master/texmf-dist/tex/generic/babel/danish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `danish')
+%% bbcompat.dtx (with options: `styfile,danish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/dutch.sty b/Master/texmf-dist/tex/generic/babel/dutch.sty
index 2326073a85c..9ed815ceb45 100644
--- a/Master/texmf-dist/tex/generic/babel/dutch.sty
+++ b/Master/texmf-dist/tex/generic/babel/dutch.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `dutch')
+%% bbcompat.dtx (with options: `styfile,dutch')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/english.sty b/Master/texmf-dist/tex/generic/babel/english.sty
index 142e3883d54..e28be7ef94a 100644
--- a/Master/texmf-dist/tex/generic/babel/english.sty
+++ b/Master/texmf-dist/tex/generic/babel/english.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `english')
+%% bbcompat.dtx (with options: `styfile,english')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/esperanto.sty b/Master/texmf-dist/tex/generic/babel/esperanto.sty
index 5f4c0bad53f..2d5d3898b93 100644
--- a/Master/texmf-dist/tex/generic/babel/esperanto.sty
+++ b/Master/texmf-dist/tex/generic/babel/esperanto.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `esperanto')
+%% bbcompat.dtx (with options: `styfile,esperanto')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/estonian.sty b/Master/texmf-dist/tex/generic/babel/estonian.sty
index e4b7cb18116..f4256990dfd 100644
--- a/Master/texmf-dist/tex/generic/babel/estonian.sty
+++ b/Master/texmf-dist/tex/generic/babel/estonian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `estonian')
+%% bbcompat.dtx (with options: `styfile,estonian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/finnish.sty b/Master/texmf-dist/tex/generic/babel/finnish.sty
index 974a4e2b0b7..eeb8941c776 100644
--- a/Master/texmf-dist/tex/generic/babel/finnish.sty
+++ b/Master/texmf-dist/tex/generic/babel/finnish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `finnish')
+%% bbcompat.dtx (with options: `styfile,finnish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/francais.sty b/Master/texmf-dist/tex/generic/babel/francais.sty
index 2e2c568a5c3..a7d479481b0 100644
--- a/Master/texmf-dist/tex/generic/babel/francais.sty
+++ b/Master/texmf-dist/tex/generic/babel/francais.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `francais')
+%% bbcompat.dtx (with options: `styfile,francais')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/galician.sty b/Master/texmf-dist/tex/generic/babel/galician.sty
index 021135727fc..e1de53c693e 100644
--- a/Master/texmf-dist/tex/generic/babel/galician.sty
+++ b/Master/texmf-dist/tex/generic/babel/galician.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `galician')
+%% bbcompat.dtx (with options: `styfile,galician')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/germanb.sty b/Master/texmf-dist/tex/generic/babel/germanb.sty
index 21a2a9b8cf9..a42a3c772dc 100644
--- a/Master/texmf-dist/tex/generic/babel/germanb.sty
+++ b/Master/texmf-dist/tex/generic/babel/germanb.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `germanb')
+%% bbcompat.dtx (with options: `styfile,germanb')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/greek.sty b/Master/texmf-dist/tex/generic/babel/greek.sty
index 54c1cc09264..6ff22d5ed86 100644
--- a/Master/texmf-dist/tex/generic/babel/greek.sty
+++ b/Master/texmf-dist/tex/generic/babel/greek.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `greek')
+%% bbcompat.dtx (with options: `styfile,greek')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/hebrew.sty b/Master/texmf-dist/tex/generic/babel/hebrew.sty
index e7bda310ed3..ecf06f5c2ba 100644
--- a/Master/texmf-dist/tex/generic/babel/hebrew.sty
+++ b/Master/texmf-dist/tex/generic/babel/hebrew.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `hebrew')
+%% bbcompat.dtx (with options: `styfile,hebrew')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/hyphen.cfg b/Master/texmf-dist/tex/generic/babel/hyphen.cfg
index b851d625c26..2a42ed321a0 100644
--- a/Master/texmf-dist/tex/generic/babel/hyphen.cfg
+++ b/Master/texmf-dist/tex/generic/babel/hyphen.cfg
@@ -38,7 +38,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File 'babel.dtx'
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%% Babel package for LaTeX2e.
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
@@ -52,7 +52,7 @@
\wlog{File: #1 #4 #3 <#2>}%
\let\ProvidesFile\@undefined}
\fi
-\ProvidesFile{hyphen.cfg}[2017/04/28 3.9t Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2017/05/19 3.10 Babel hyphens]
\xdef\bbl@format{\jobname}
\ifx\AtBeginDocument\@undefined
\def\@empty{}
@@ -83,7 +83,7 @@
\countdef\last@language=19
\def\addlanguage{\alloc@9\language\chardef\@cclvi}
\fi
-\toks8{Babel <3.9t> and hyphenation patterns for }%
+\toks8{Babel <3.10> and hyphenation patterns for }%
\def\process@line#1#2 #3 #4 {%
\ifx=#1%
\process@synonym{#2}%
diff --git a/Master/texmf-dist/tex/generic/babel/icelandic.sty b/Master/texmf-dist/tex/generic/babel/icelandic.sty
index b011585ee88..81c7904bee6 100644
--- a/Master/texmf-dist/tex/generic/babel/icelandic.sty
+++ b/Master/texmf-dist/tex/generic/babel/icelandic.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `icelandic')
+%% bbcompat.dtx (with options: `styfile,icelandic')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/interlingua.sty b/Master/texmf-dist/tex/generic/babel/interlingua.sty
index 12b5f1cf110..9039f01ba74 100644
--- a/Master/texmf-dist/tex/generic/babel/interlingua.sty
+++ b/Master/texmf-dist/tex/generic/babel/interlingua.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `interlingua')
+%% bbcompat.dtx (with options: `styfile,interlingua')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/irish.sty b/Master/texmf-dist/tex/generic/babel/irish.sty
index f6f1bcc9ea2..a04a3cfee83 100644
--- a/Master/texmf-dist/tex/generic/babel/irish.sty
+++ b/Master/texmf-dist/tex/generic/babel/irish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `irish')
+%% bbcompat.dtx (with options: `styfile,irish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/italian.sty b/Master/texmf-dist/tex/generic/babel/italian.sty
index 0d30b8921a1..7a06e92390c 100644
--- a/Master/texmf-dist/tex/generic/babel/italian.sty
+++ b/Master/texmf-dist/tex/generic/babel/italian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `italian')
+%% bbcompat.dtx (with options: `styfile,italian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/latin.sty b/Master/texmf-dist/tex/generic/babel/latin.sty
index 0b86a8ba44c..843916ad06f 100644
--- a/Master/texmf-dist/tex/generic/babel/latin.sty
+++ b/Master/texmf-dist/tex/generic/babel/latin.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `latin')
+%% bbcompat.dtx (with options: `styfile,latin')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/lsorbian.sty b/Master/texmf-dist/tex/generic/babel/lsorbian.sty
index d1e131f52cc..b755fff5107 100644
--- a/Master/texmf-dist/tex/generic/babel/lsorbian.sty
+++ b/Master/texmf-dist/tex/generic/babel/lsorbian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `lsorbian')
+%% bbcompat.dtx (with options: `styfile,lsorbian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/magyar.sty b/Master/texmf-dist/tex/generic/babel/magyar.sty
index e0dc24d91cb..40e6a5fd0e5 100644
--- a/Master/texmf-dist/tex/generic/babel/magyar.sty
+++ b/Master/texmf-dist/tex/generic/babel/magyar.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `magyar')
+%% bbcompat.dtx (with options: `styfile,magyar')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/naustrian.sty b/Master/texmf-dist/tex/generic/babel/naustrian.sty
index 92bae5b9213..ccddfdd7edc 100644
--- a/Master/texmf-dist/tex/generic/babel/naustrian.sty
+++ b/Master/texmf-dist/tex/generic/babel/naustrian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `naustrian')
+%% bbcompat.dtx (with options: `styfile,naustrian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/ngermanb.sty b/Master/texmf-dist/tex/generic/babel/ngermanb.sty
index 668e01b8438..39c09a66509 100644
--- a/Master/texmf-dist/tex/generic/babel/ngermanb.sty
+++ b/Master/texmf-dist/tex/generic/babel/ngermanb.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `ngermanb')
+%% bbcompat.dtx (with options: `styfile,ngermanb')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/nil.ldf b/Master/texmf-dist/tex/generic/babel/nil.ldf
index d70837a6a66..e0e67ad406e 100644
--- a/Master/texmf-dist/tex/generic/babel/nil.ldf
+++ b/Master/texmf-dist/tex/generic/babel/nil.ldf
@@ -38,7 +38,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File 'babel.dtx'
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%% Babel package for LaTeX2e.
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
@@ -47,7 +47,7 @@
%% TeXniek
%% by Javier Bezos
%% all rights reserved.
-\ProvidesLanguage{nil}[2017/04/28 3.9t Nil language]
+\ProvidesLanguage{nil}[2017/05/19 3.10 Nil language]
\LdfInit{nil}{datenil}
\ifx\l@nohyphenation\@undefined
\@nopatterns{nil}
diff --git a/Master/texmf-dist/tex/generic/babel/norsk.sty b/Master/texmf-dist/tex/generic/babel/norsk.sty
index 9c49a8e6cd6..3f89d0e2c06 100644
--- a/Master/texmf-dist/tex/generic/babel/norsk.sty
+++ b/Master/texmf-dist/tex/generic/babel/norsk.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `norsk')
+%% bbcompat.dtx (with options: `styfile,norsk')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/plain.def b/Master/texmf-dist/tex/generic/babel/plain.def
index 6793f38f045..57341d51c9b 100644
--- a/Master/texmf-dist/tex/generic/babel/plain.def
+++ b/Master/texmf-dist/tex/generic/babel/plain.def
@@ -38,7 +38,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File 'babel.dtx'
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%% Babel package for LaTeX2e.
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
@@ -119,7 +119,7 @@
\def\@endofldf{}
\@onlypreamble\@endofldf
\let\bbl@afterlang\@empty
-\chardef\bbl@hymapopt\z@
+\chardef\bbl@opt@hyphenmap\z@
\ifx\if@filesw\@undefined
\expandafter\let\csname if@filesw\expandafter\endcsname
\csname iffalse\endcsname
diff --git a/Master/texmf-dist/tex/generic/babel/polish.sty b/Master/texmf-dist/tex/generic/babel/polish.sty
index b33904153f0..fb609193d7a 100644
--- a/Master/texmf-dist/tex/generic/babel/polish.sty
+++ b/Master/texmf-dist/tex/generic/babel/polish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `polish')
+%% bbcompat.dtx (with options: `styfile,polish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/portuges.sty b/Master/texmf-dist/tex/generic/babel/portuges.sty
index 6a0a382ab73..1748409cf86 100644
--- a/Master/texmf-dist/tex/generic/babel/portuges.sty
+++ b/Master/texmf-dist/tex/generic/babel/portuges.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `portuges')
+%% bbcompat.dtx (with options: `styfile,portuges')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/romanian.sty b/Master/texmf-dist/tex/generic/babel/romanian.sty
index 4bc595f8402..4170c23e4a0 100644
--- a/Master/texmf-dist/tex/generic/babel/romanian.sty
+++ b/Master/texmf-dist/tex/generic/babel/romanian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `romanian')
+%% bbcompat.dtx (with options: `styfile,romanian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/russianb.sty b/Master/texmf-dist/tex/generic/babel/russianb.sty
index 9b14a3764a9..1c37b6ecd18 100644
--- a/Master/texmf-dist/tex/generic/babel/russianb.sty
+++ b/Master/texmf-dist/tex/generic/babel/russianb.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `russianb')
+%% bbcompat.dtx (with options: `styfile,russianb')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/samin.sty b/Master/texmf-dist/tex/generic/babel/samin.sty
index 92d3c693909..41f64109bea 100644
--- a/Master/texmf-dist/tex/generic/babel/samin.sty
+++ b/Master/texmf-dist/tex/generic/babel/samin.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `samin')
+%% bbcompat.dtx (with options: `styfile,samin')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/scottish.sty b/Master/texmf-dist/tex/generic/babel/scottish.sty
index 874b926dbca..51f9930d656 100644
--- a/Master/texmf-dist/tex/generic/babel/scottish.sty
+++ b/Master/texmf-dist/tex/generic/babel/scottish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `scottish')
+%% bbcompat.dtx (with options: `styfile,scottish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/serbian.sty b/Master/texmf-dist/tex/generic/babel/serbian.sty
index 6245d8632c3..9e23edaba82 100644
--- a/Master/texmf-dist/tex/generic/babel/serbian.sty
+++ b/Master/texmf-dist/tex/generic/babel/serbian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `serbian')
+%% bbcompat.dtx (with options: `styfile,serbian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/slovak.sty b/Master/texmf-dist/tex/generic/babel/slovak.sty
index 2126d6c84a5..15c1e277c77 100644
--- a/Master/texmf-dist/tex/generic/babel/slovak.sty
+++ b/Master/texmf-dist/tex/generic/babel/slovak.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `slovak')
+%% bbcompat.dtx (with options: `styfile,slovak')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/slovene.sty b/Master/texmf-dist/tex/generic/babel/slovene.sty
index 5399aab67b4..d515622871a 100644
--- a/Master/texmf-dist/tex/generic/babel/slovene.sty
+++ b/Master/texmf-dist/tex/generic/babel/slovene.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `slovene')
+%% bbcompat.dtx (with options: `styfile,slovene')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/spanish.sty b/Master/texmf-dist/tex/generic/babel/spanish.sty
index 18de3e71752..c286f0a6697 100644
--- a/Master/texmf-dist/tex/generic/babel/spanish.sty
+++ b/Master/texmf-dist/tex/generic/babel/spanish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `spanish')
+%% bbcompat.dtx (with options: `styfile,spanish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/swedish.sty b/Master/texmf-dist/tex/generic/babel/swedish.sty
index 98458ab5ba9..a1e42203285 100644
--- a/Master/texmf-dist/tex/generic/babel/swedish.sty
+++ b/Master/texmf-dist/tex/generic/babel/swedish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `swedish')
+%% bbcompat.dtx (with options: `styfile,swedish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/switch.def b/Master/texmf-dist/tex/generic/babel/switch.def
index 89156b84423..a06711562f7 100644
--- a/Master/texmf-dist/tex/generic/babel/switch.def
+++ b/Master/texmf-dist/tex/generic/babel/switch.def
@@ -38,7 +38,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File 'babel.dtx'
-%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package]
+%%\ProvidesFile{babel.dtx}[2017/05/19 v3.10 The Babel package]
%% Babel package for LaTeX2e.
%% Copyright (C) 1989-2008 by Johannes Braams,
%% TeXniek
@@ -52,7 +52,7 @@
\wlog{File: #1 #4 #3 <#2>}%
\let\ProvidesFile\@undefined}
\fi
-\ProvidesFile{switch.def}[2017/04/28 3.9t Babel switching mechanism]
+\ProvidesFile{switch.def}[2017/05/19 3.10 Babel switching mechanism]
\ifx\AtBeginDocument\@undefined
\input plain.def\relax
\fi
@@ -73,8 +73,8 @@
\countdef\last@language=19
\def\addlanguage{\alloc@9\language\chardef\@cclvi}
\fi
-\def\bbl@version{3.9t}
-\def\bbl@date{2017/04/28}
+\def\bbl@version{3.10}
+\def\bbl@date{2017/05/19}
\def\adddialect#1#2{%
\global\chardef#1#2\relax
\bbl@usehooks{adddialect}{{#1}{#2}}%
@@ -135,8 +135,8 @@
\expandafter\ifx\csname date\languagename\endcsname\relax\else
\if@filesw
\protected@write\@auxout{}{\string\select@language{\languagename}}%
- \bbl@for\bbl@tempa\BabelContentsFiles{%
- \addtocontents{\bbl@tempa}{\xstring\select@language{\languagename}}}%
+ \bbl@foreach\BabelContentsFiles{%
+ \addtocontents{##1}{\xstring\select@language{\languagename}}}%
\bbl@usehooks{write}{}%
\fi
\fi}
@@ -172,14 +172,14 @@
\bbl@usehooks{beforeextras}{}%
\csname extras#1\endcsname\relax
\bbl@usehooks{afterextras}{}%
- \ifcase\bbl@hymapopt\or
+ \ifcase\bbl@opt@hyphenmap\or
\def\BabelLower##1##2{\lccode##1=##2\relax}%
\ifnum\bbl@hymapsel>4\else
\csname\languagename @bbl@hyphenmap\endcsname
\fi
- \chardef\bbl@hymapopt\z@
+ \chardef\bbl@opt@hyphenmap\z@
\else
- \ifnum\bbl@hymapsel>\bbl@hymapopt\else
+ \ifnum\bbl@hymapsel>\bbl@opt@hyphenmap\else
\csname\languagename @bbl@hyphenmap\endcsname
\fi
\fi
@@ -346,6 +346,14 @@
{\let\bbl@info\@gobble
\let\bbl@warning\@gobble}
{}
+\def\bbl@nocaption#1#2{% 1: text to be printed 2: caption macro \langXname
+ \gdef#2{\textbf{?#1?}}%
+ #2%
+ \bbl@warning{%
+ \string#2 not set. Please, define\\%
+ it in the preamble with something like:\\%
+ \string\renewcommand\string#2{..}\\%
+ Reported}}
\def\@nolanerr#1{%
\bbl@error
{You haven't defined the language #1\space yet}%
diff --git a/Master/texmf-dist/tex/generic/babel/turkish.sty b/Master/texmf-dist/tex/generic/babel/turkish.sty
index b5f763bb892..b05d537eaed 100644
--- a/Master/texmf-dist/tex/generic/babel/turkish.sty
+++ b/Master/texmf-dist/tex/generic/babel/turkish.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `turkish')
+%% bbcompat.dtx (with options: `styfile,turkish')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/ukraineb.sty b/Master/texmf-dist/tex/generic/babel/ukraineb.sty
index bb757d9327e..17344a98205 100644
--- a/Master/texmf-dist/tex/generic/babel/ukraineb.sty
+++ b/Master/texmf-dist/tex/generic/babel/ukraineb.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `ukraineb')
+%% bbcompat.dtx (with options: `styfile,ukraineb')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/usorbian.sty b/Master/texmf-dist/tex/generic/babel/usorbian.sty
index 2e87cd5c2f7..1aa770efaf6 100644
--- a/Master/texmf-dist/tex/generic/babel/usorbian.sty
+++ b/Master/texmf-dist/tex/generic/babel/usorbian.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `usorbian')
+%% bbcompat.dtx (with options: `styfile,usorbian')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.
diff --git a/Master/texmf-dist/tex/generic/babel/welsh.sty b/Master/texmf-dist/tex/generic/babel/welsh.sty
index 6bba740600f..12f520f46cb 100644
--- a/Master/texmf-dist/tex/generic/babel/welsh.sty
+++ b/Master/texmf-dist/tex/generic/babel/welsh.sty
@@ -4,7 +4,7 @@
%%
%% The original source files were:
%%
-%% bbcompat.dtx (with options: `welsh')
+%% bbcompat.dtx (with options: `styfile,welsh')
%% This is a generated file.
%%
%% Copyright 2012-2016 Javier Bezos and Johannes L. Braams.