diff options
author | Karl Berry <karl@freefriends.org> | 2017-04-28 21:20:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-04-28 21:20:36 +0000 |
commit | ee0045bb26510bf9200dfc2d5b283d0efd3f73fd (patch) | |
tree | f704475f1daafcca526825bc1efdf31ec4d0ef7a /Master/texmf-dist/source | |
parent | f293e42154e00d9414a9ed54e00742b27b8c9066 (diff) |
babel (28apr17)
git-svn-id: svn://tug.org/texlive/trunk@44101 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.dtx | 1227 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/bbcompat.dtx | 2 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/bbunicode.dtx | 6 |
3 files changed, 390 insertions, 845 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index 59d49aed4d0..621d29730a1 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 2012-2016 Javier Bezos and Johannes L. Braams. +% Copyright 2012-2017 Javier Bezos and Johannes L. Braams. % Copyright 1989-2012 Johannes L. Braams and any individual authors % listed elsewhere in this file. % All rights reserved. @@ -36,7 +36,7 @@ %\iffalse %% File 'babel.dtx' %\fi -%%\ProvidesFile{babel.dtx}[2016/04/23 v3.9r The Babel package] +%%\ProvidesFile{babel.dtx}[2017/04/28 v3.9t The Babel package] %\iffalse % % Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX; @@ -45,9 +45,9 @@ %% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek %% all rights reserved. -%% Copyright (C) 2013-2016 by Johannes Braams +%% Copyright (C) 2013-2017 by Johannes Braams %% TeXniek -%% by Javier Bezos +%% by Javier Bezos %% all rights reserved. % %<*filedriver> @@ -68,8 +68,6 @@ \newcommand*\langlist{% \meta{language}\texttt{,}\meta{language}\texttt{,}...} \newcommand*\langvar{\m{lang}} -\newcommand*\note[1]{} -\newcommand*\bsl{\protect\bslash} \newcommand*\Lopt[1]{\textsf{#1}} \newcommand*\Lenv[1]{\textsf{#1}} \newcommand*\menv[1]{\char`\{#1\char`\}} @@ -92,7 +90,7 @@ \definecolor{lightgray}{gray}{0.95} \IfFileExists{listings.sty}{ \usepackage{listings} - \lstset{ + \lstdefinestyle{verbatim}{ % gobble=1, columns=flexible, keepspaces, @@ -118,7 +116,7 @@ framerule=\fboxrule, } \let\verbatim\relax - \lstnewenvironment{verbatim}[1][]{\lstset{##1}}{} + \lstnewenvironment{verbatim}[1][]{\lstset{style=verbatim,##1}}{} }{} \def\PrintDescribeMacro#1{% \strut\MacroFont\color{thered}\normalsize\string#1} @@ -196,8 +194,8 @@ \vspace{2cm}\hspace{1.5cm} \begin{minipage}{5cm} \Large -Version 3.9r\newline -2016/04/23 +Version 3.9t\newline +2017/04/28 \vspace{1cm} \textit{Original author}\newline @@ -407,13 +405,13 @@ Spaces after the environment are ignored. \Describe\foreignlanguage{\marg{language}\marg{text}} The command |\foreignlanguage| takes two arguments; the second argument is a phrase to be typeset according to the rules of the -language named in its first argument. This command (1) only -switches the extra definitions and the hyphenation rules for the -language, \emph{not} the names and dates, (2) does not send -information about the language to auxiliary files (i.e., the -surrounding language is still in force), and (3) it works even if -the language has not been set as package option (but in such a -case it only sets the hyphenation patterns and a warning is shown). +language named in its first one. This command (1) only switches the +extra definitions and the hyphenation rules for the language, +\emph{not} the names and dates, (2) does not send information about +the language to auxiliary files (i.e., the surrounding language is +still in force), and (3) it works even if the language has not been +set as package option (but in such a case it only sets the hyphenation +patterns and a warning is shown). \Describe{\begin\menv{otherlanguage*}}% {\marg{language}\Eenv{otherlanguage*}} @@ -421,10 +419,10 @@ case it only sets the hyphenation patterns and a warning is shown). Same as |\foreignlanguage| but as environment. Spaces after the environment are \textit{not} ignored. -This environment (or in some cases |otherlanguage|) may be required for -intermixing left-to-right typesetting with right-to-left typesetting -in engines not supporting a change in the writing direction inside a -line. +This environment was also intended for intermixing left-to-right +typesetting with right-to-left typesetting in engines not supporting a +change in the writing direction inside a line. However, its behaviour +is not always the expected one. \Describe{\begin\menv{hyphenrules}}{\marg{language}\Eenv{hyphenrules}} @@ -453,9 +451,9 @@ defined. It adds nothing really new -- it is just syntactical sugar. It defines |\text|\m{tag1}\marg{text} to be |\foreignlanguage|\marg{language1}\marg{text}, and |\begin|\marg{tag1} - to be |\begin{otherlanguage*}|\marg{language1}, and so on. Note - |\|\m{tag1} is also allowed, but remember set it locally inside a - group. So, with +to be |\begin{otherlanguage*}|\marg{language1}, and so on. Note +|\|\m{tag1} is also allowed, but remember set it locally inside a +group. So, with \begin{verbatim} \babeltags{de = german} \end{verbatim} @@ -472,6 +470,8 @@ German text text \end{verbatim} +Something like \verb|\babeltag{finnish = finnish}| is legitimate -- it +defines |\textfinnish| and |\finnish|. \Describe\babelensure{|[include=|\m{commands}|,exclude=|\m{commands}% |,fontenc=|\m{encoding}|]|\marg{language}} @@ -528,9 +528,9 @@ scripts, because they are best selected with either |\fontencoding| (low level) or a language name (high level). Even the Latin script may require different encodings (ie, sets of glyphs) depending on the language, and therefore such a switch would be in a sense -incomplete.\footnote{The so-called Unicode fonts does not improve the +incomplete.\footnote{The so-called Unicode fonts do not improve the situation either. So, a font suited for Vietnamese is not necessarily -suited for, say, romanization of Indic languages, and the fact it +suited for, say, the romanization of Indic languages, and the fact it contains glyphs for Modern Greek does not mean it includes them for Classic Greek. As to directionality, it poses special challenges because it also affects individual characters and layout elements.} @@ -601,6 +601,9 @@ Please, note the following: \item If on a certain level (system, language, user) there is a one-char shorthand, two-char ones starting with that char and on the same level are ignored. +\item Since they are active, a shorthand cannot contain the same + character in its definition (except if it is deactivated with, eg, + |string|). \end{enumerate} A typical error when using shorthands is the following: @@ -787,7 +790,6 @@ which is let, like the standard |~|, to a non breaking space.\footnote{This declaration serves to nothing, but it is preserved for backward compatibility.} - \subsection{Package options} \New{3.9a} @@ -1518,13 +1520,15 @@ Some recommendations: (high level, which in turn may switch the font encoding). Usage of things like |\latintext| is deprecated.\footnote{But not removed, for backward compatibility.} +\item Please, for ``private'' internal macros do not use the |\bbl@| + prefix. It is used by \babel{} and it can lead to incompatibilities. \end{itemize} There are no special requirements for documenting your language files. Now they are not included in the base \babel{} manual, so -provide a standalone document suited for your needs (and the -corresponding PDF, if you like), as well as other files you think can -be useful (eg, samples, readme). +provide a standalone document suited for your needs, as well as other +files you think can be useful. A PDF and a ``readme'' are strongly +recommended. \subsection{Basic macros} @@ -2307,7 +2311,7 @@ help from Bernd Raichle, for which I am grateful. \bibitem{ilatex} Joachim Schrod, \emph{International \LaTeX\ is ready to use}, \emph{TUGboat} 11 (1990) \#1, p.~87--90. - \bibitem{ilatex} Apostolos Syropoulos, Antonis Tsolomitis and Nick + \bibitem{STS} Apostolos Syropoulos, Antonis Tsolomitis and Nick Sofroniu, \emph{Digital typography using \LaTeX}, Springer, 2002, p.~301--373. @@ -2317,8 +2321,6 @@ help from Bernd Raichle, for which I am grateful. \end{document} %</filedriver> %\fi -% \changes{babel~3.7a}{1997/04/16}{Make multiple loading of -% \file{babel.def} impossible} % \changes{babel~3.9a}{2012/05/16}{Now using \cs{ldf@quit} for the test} % \begin{macrocode} %<*core> @@ -2335,57 +2337,6 @@ help from Bernd Raichle, for which I am grateful. % % \GetFileInfo{babel.dtx} % -% \changes{babel~2.0a}{1990/04/02}{Added text about \file{german.sty}} -% \changes{babel~2.0b}{1990/04/18}{Changed order of code to prevent -% plain \TeX from seeing all of it} -% \changes{babel~2.1}{1990/04/24}{Modified user interface, -% \cs{langTeX} no longer necessary} -% \changes{babel~2.1a}{1990/05/01}{Incorporated Nico's comments} -% \changes{babel~2.1b}{1990/05/01}{rename \cs{language} to -% \cs{current@language}} -% \changes{babel~2.1c}{1990/05/22}{abstract for report fixed, missing -% \texttt{\}}, found by Nicolas Brouard} -% \changes{babel~2.1d}{1990/07/04}{Missing right brace in definition of -% abstract environment, found by Werenfried Spit} -% \changes{babel~2.1e}{1990/07/16}{Incorporated more comments from -% Nico} -% \changes{babel~2.2}{1990/07/17}{Renamed \cs{newlanguage} to -% \cs{addlanguage}} -% \changes{babel~2.2a}{1990/08/27}{Modified the documentation -% somewhat} -% \changes{babel~3.0}{1991/04/23}{Moved part of the code to hyphen.doc -% in preparation for \TeX~3.0} -% \changes{babel~3.0a}{1991/05/21}{Updated comments in various places} -% \changes{babel~3.0b}{1991/05/25}{Removed some problems in change log} -% \changes{babel~3.0c}{1991/07/15}{Renamed \file{babel.sty} and -% \file{latexhax.sty} to \file{.com}} -% \changes{babel~3.1}{1991/10/31}{Added the support for active -% characters and for extending a macro} -% \changes{babel~3.1}{1991/11/05}{Removed the need for -% \file{latexhax}} -% \changes{babel~3.2}{1991/11/10}{Some Changes by br} -% \changes{babel~3.2a}{1992/02/15}{Fixups of the code and -% documentation} -% \changes{babel~3.3}{1993/07/06}{Included driver file, and prepared -% for distribution} -% \changes{babel~3.4}{1994/01/30}{Updated for \LaTeXe} -% \changes{babel~3.4}{1994/02/28}{Added language definition file for -% bahasa} -% \changes{babel~3.4b}{1994/05/18}{Added a small driver to be able to -% process just this file} -% \changes{babel~3.5a}{1995/02/03}{Provided common code to handle the -% active double quote} -% \changes{babel~3.5c}{1995/06/14}{corrected a few typos (PR1652)} -% \changes{babel~3.5d}{1995/07/02}{Merged glyphs.dtx into this file} -% \changes{babel~3.5f}{1995/07/13}{repaired a typo} -% \changes{babel~3.5f}{1996/01/09}{replaced \cs{tmp}, \cs{bbl@tmp} and -% \cs{bbl@temp} with \cs{bbl@tempa}} -% \changes{babel~3.5g}{1996/07/09}{replaced \cs{undefined} with -% \cs{@undefined} to be consistent with \LaTeX} -% \changes{babel~3.7d}{1999/05/05}{Fixed a few typos in \cs{changes} -% entries which made typesetting the code impossible} -% \changes{babel~3.7h}{2001/03/01}{Added a number of missing comment -% characters which caused spurious white space} % \changes{babel~3.8e}{2005/03/24}{Many enhancements to the text by % Andrew Young} % \changes{babel~3.9c}{2013/04/04}{Added the ``modifiers'' mechanism} @@ -2433,27 +2384,32 @@ help from Bernd Raichle, for which I am grateful. % little bit of literate programming. % % \begin{macrocode} -%<<version=3.9r>> -%<<date=2016/04/23>> +%<<version=3.9t>> +%<<date=2017/04/28>> % \end{macrocode} % +% \section{Tools} +% +% \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 % \file{babel.def} and in \file{babel.sty}, which means in \LaTeX{} % is executed twice, but we need them when defining options and % \file{babel.def} cannot be load until options have been defined. +% 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} \def\bbl@add#1#2{% - \@ifundefined{\expandafter\@gobble\string#1}% + \bbl@ifunset{\bbl@stripslash#1}% {\def#1{#2}}% {\expandafter\def\expandafter#1\expandafter{#1#2}}} \def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% -\long\def\bbl@afterelse#1\else#2\fi{\fi#1} -\long\def\bbl@afterfi#1\fi{\fi#1} \def\bbl@loop#1#2#3{\bbl@@loop#1{#3}#2,\@nnil,} \def\bbl@loopx#1#2{\expandafter\bbl@loop\expandafter#1\expandafter{#2}} \def\bbl@@loop#1#2#3,{% @@ -2461,6 +2417,147 @@ help from Bernd Raichle, for which I am grateful. \def#1{#3}#2\bbl@afterfi\bbl@@loop#1{#2}% \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}.} +% +% \begin{macro}{\bbl@add@list} +% This internal macro adds its second argument to a comma +% 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{% + \bbl@ifunset{\bbl@stripslash#1}% + {}% + {\ifx#1\@empty\else#1,\fi}% + #2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bbl@afterelse} +% \begin{macro}{\bbl@afterfi} +% Because the code that is used in the handling of active +% characters may need to look ahead, we take extra care to `throw' +% it over the |\else| and |\fi| parts of an +% |\if|-statement\footnote{This code is based on code presented in +% TUGboat vol. 12, no2, June 1991 in ``An expansion Power Lemma'' +% 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} +% +% The following piece of code is stolen (with some changes) from +% \textsf{keyval}, by David Carlisle. It defines two macros: +% |\bbl@trim| and |bbl@trim@def|. The first one strips the leading +% and trailing spaces from the second argument and then applies the +% first argument (a macro, |\toks@| and the like). The second one, as +% its name suggests, defines the first argument as the stripped second +% argument. +% +% \begin{macrocode} +\def\bbl@tempa#1{% + \long\def\bbl@trim##1##2{% + \futurelet\bbl@trim@a\bbl@trim@c##2\@nil\@nil#1\@nil\relax{##1}}% + \def\bbl@trim@c{% + \ifx\bbl@trim@a\@sptoken + \expandafter\bbl@trim@b + \else + \expandafter\bbl@trim@b\expandafter#1% + \fi}% + \long\def\bbl@trim@b#1##1 \@nil{\bbl@trim@i##1}} +\bbl@tempa{ } +\long\def\bbl@trim@i#1\@nil#2\relax#3{#3{#1}} +\long\def\bbl@trim@def#1{\bbl@trim{\def#1}} +% \end{macrocode} +% +% To check if a macro is defined, we create a new macro, which does +% the same as |\@ifundefined|. However, in an $\epsilon$-tex +% engine, it is redefined more robust +% +% \begin{macrocode} +\def\bbl@ifunset#1{% + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\bbl@ifunset{ifcsname}% + {}% + {\def\bbl@ifunset#1{% + \ifcsname#1\endcsname + \expandafter\ifx\csname#1\endcsname\relax + \bbl@afterelse\expandafter\@firstoftwo + \else + \bbl@afterfi\expandafter\@secondoftwo + \fi + \else + \expandafter\@firstoftwo + \fi}} +% \end{macrocode} +% +% A tool from \textsf{url}, by Donald +% Arseneau, which test if a string is empty or space. +% +% \begin{macrocode} +\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} +% \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 +% name (the latter does not define the macro if undefined to |\relax|, +% because it is created locally). The result may be followed by extra +% arguments, if necessary. +% +% \begin{macrocode} +\def\bbl@exp#1{% + \begingroup + \let\\\noexpand + \def\<##1>{\expandafter\noexpand\csname##1\endcsname}% + \edef\bbl@exp@aux{\endgroup#1}% + \bbl@exp@aux} +% \end{macrocode} +% +% Two more tools. |\bbl@samestring| first expand its arguments and +% then compare their expansion (sanitized, so that the catcodes do not +% matter). |\bbl@engine| takes the following values: 0 is pdf\TeX, 1 +% is \luatex, and 2 is \xetex. You may use the latter it in your +% language style if you want. +% +% \begin{macrocode} +\def\bbl@ifsamestring#1#2{% + \begingroup + \protected@edef\bbl@tempb{#1}% + \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}% + \protected@edef\bbl@tempc{#2}% + \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}% + \ifx\bbl@tempb\bbl@tempc + \aftergroup\@firstoftwo + \else + \aftergroup\@secondoftwo + \fi + \endgroup} +\chardef\bbl@engine=% + \ifx\directlua\@undefined + \ifx\XeTeXinputencoding\@undefined + \z@ + \else + \tw@ + \fi + \else + \@ne + \fi %<</Basic macros>> % \end{macrocode} % @@ -2549,8 +2646,6 @@ help from Bernd Raichle, for which I am grateful. % other purposes in these formats. Therefore |\addlanguage| is % defined using a definition based on the macros used to define % |\newlanguage| in plain \TeX\ version~3.0. -% \changes{babel~3.2}{1991/11/11}{Added a \texttt{\%}, removed -% \texttt{by}} % % For formats based on plain version~3.0 the definition of % |\newlanguage| can be simply copied, removing |\outer|. @@ -2563,7 +2658,7 @@ help from Bernd Raichle, for which I am grateful. \global\advance\last@language\@ne \ifnum\last@language<\@cclvi \else - \errmessage{No room for a new \string\language!}% + \errmessage{No room for a new \string\language!}% \fi \global\chardef#1\last@language \wlog{\string#1 = \string\language\the\last@language}} @@ -2577,9 +2672,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % Identify each file that is produced from this source file. -% \changes{babel~3.4c}{1995/04/28}{lhyphen.cfg has become -% lthyphen.cfg} -% \changes{babel~3.5b}{1995/01/25}{lthyphen.cfg has become hyphen.cfg} % \begin{macrocode} %<*driver&!user> \ProvidesFile{babel.drv}[<@date@> <@version@>] @@ -2605,15 +2697,12 @@ 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.0d}{1991/10/29}{Removed use of \cs{@ifundefined}} % \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 % loaded in a different version (or not loaded)} % \changes{babel~3.9a}{2013/01/14}{Added the debug option} % \changes{babel~3.9a}{2013/02/05}{Added \cs{bbl@add}} -% \changes{babel~3.6a}{1996/11/02}{Removed \cs{babel@core@loaded}, no -% longer needed with the advent of \cs{LdfInit}} % % \section{The Package File (\LaTeX)} % @@ -2641,17 +2730,11 @@ help from Bernd Raichle, for which I am grateful. % \LaTeX forgets about the first loading. After |switch.def| has % been loaded (above) and |\AfterBabelLanguage| defined, exits. % -% \changes{babel~3.5d}{1995/07/04}{Added options to influence -% behaviour of active acute and grave accents} % \changes{babel~3.9a}{2012/10/05}{preset option started, % party stolen from fontenc} % \changes{babel~3.9a}{2012/10/17}{Hooks started} % \changes{babel~3.9a}{2013/02/07}{Rejected preset, and replaced by % base} -% \changes{babel~3.5g}{1996/10/10}{We need at least \LaTeX\ from -% December 1994} -% \changes{babel~3.6k}{1999/03/18}{We need at least \LaTeX\ from -% June 1998} % \changes{babel~3.9q}{2016/02/11}{Load patterns with option base. % To be improved. Moved showlanguages before base} % \begin{macrocode} @@ -2689,9 +2772,9 @@ 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 \textsf{polyglossia}, too. +% 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 @@ -2716,7 +2799,7 @@ help from Bernd Raichle, for which I am grateful. % and assigned to |\BabelModifiers| at |\bbl@load@language|; when % 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| o load |keyval|). +% |\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} % @@ -2745,10 +2828,6 @@ help from Bernd Raichle, for which I am grateful. % 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.6f}{1997/01/14}{Added option -% \Lopt{KeepShorthandsActive}} -% \changes{babel~3.7a}{1997/03/21}{No longer define the control -% sequence \cs{KeepShorthandsActive}} % \changes{babel~3.9a}{2012/08/14}{Implemented the \texttt{noconfigs} % option} % \changes{babel~3.9a}{2012/09/26}{Implemented the @@ -2786,8 +2865,8 @@ help from Bernd Raichle, for which I am grateful. % options. % \begin{macrocode} \def\bbl@tempa#1=#2\bbl@tempa{% - \expandafter\ifx\csname bbl@opt@#1\endcsname\@nnil - \expandafter\edef\csname bbl@opt@#1\endcsname{#2}% + \bbl@csarg\ifx{opt@#1}\@nnil + \bbl@csarg\edef{opt@#1}{#2}% \else \bbl@error{% Bad option `#1=#2'. Either you have misspelled the\\% @@ -2808,9 +2887,7 @@ help from Bernd Raichle, for which I am grateful. \ifin@ \expandafter\bbl@tempa\CurrentOption\bbl@tempa \else - \edef\bbl@language@opts{% - \ifx\bbl@language@opts\@empty\else\bbl@language@opts,\fi - \CurrentOption}% + \bbl@add@list\bbl@language@opts{\CurrentOption}% \fi} % \end{macrocode} % Now we finish the first pass (and start over). @@ -2889,7 +2966,9 @@ help from Bernd Raichle, for which I am grateful. % |\bbl@opt@safe| says which macros are redefined (B for bibs and R % for refs). By default, both are set. % \begin{macrocode} -\@ifundefined{bbl@opt@safe}{\def\bbl@opt@safe{BR}}{} +\ifx\bbl@opt@safe\@undefined + \def\bbl@opt@safe{BR} +\fi \ifx\bbl@opt@main\@nnil\else \edef\bbl@language@opts{% \ifx\bbl@language@opts\@empty\else\bbl@language@opts,\fi @@ -2899,66 +2978,18 @@ help from Bernd Raichle, for which I am grateful. % % \subsection{Language options} % -% \changes{babel~3.6c}{1997/01/05}{When \cs{LdfInit} is undefined we -% need to load \file{babel.def} from \file{babel.sty}} -% \changes{babel~3.6l}{1999/04/03}{Don't load \file{babel.def} now, -% but rather define \cs{LdfInit} temporarily in order to load -% \file{babel.def} at the right time, preventing problems with the -% temporary definition of \cs{bbl@redefine}} -% \changes{babel~3.6r}{1999/04/12}{We \textbf{do} need to load -% \file{babel.def} right now as \cs{ProvidesLanguage} needs to be -% defined before the \file{.ldf} files are read and the reason for -% for 3.6l has been removed} % \changes{babel~3.9a}{2012/06/15}{Rewritten the loading mechanism, so % 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.5a}{1995/03/14}{Changed extension of language -% definition files to \texttt{ldf}} -% \changes{babel~3.5d}{1995/07/02}{Load language definition files -% \emph{after} the check for the hyphenation patterns} -% \changes{babel~3.5g}{1996/10/04}{Added option \Lopt{afrikaans}} -% \changes{babel~3.7g}{2001/02/09}{Added option \Lopt{acadian}} % \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.6i}{1997/02/20}{Added the \Lopt{Basque} option} % \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.5b}{1995/05/25}{Added \Lopt{brazilian} as -% alternative for \Lopt{brazil}} -% \changes{babel~3.5d}{1995/07/02}{Added \Lopt{british} as an -% alternative for \Lopt{english} with a preference for british -% hyphenation} -% \changes{babel~3.7f}{2000/09/21}{Added the \Lopt{bulgarian} option} -% \changes{babel~3.7g}{2001/02/07}{Added option \Lopt{canadian}} -% \changes{babel~3.7g}{2001/02/09}{Added option \Lopt{canadien}} -% \changes{babel~3.5b}{1995/06/06}{Added the \Lopt{estonian} option} -% \changes{babel~3.5f}{1996/01/10}{Now use the file \file{frenchb.ldf} -% from Daniel Flipo for french support} -% \changes{babel~3.6e}{1997/01/08}{Added option \Lopt{frenchb} an -% alias for \Lopt{francais}} -% \changes{babel~3.5d}{1995/07/02}{Load \file{french.ldf} when it is -% found instead of \file{frenchb.ldf}} -% \changes{babel~3.7j}{2003/06/07}{\emph{only} load -% \file{frenchb.ldf}} -% \changes{babel~3.5f}{1996/05/31}{Added the \Lopt{greek} option} -% \changes{babel~3.7a}{1997/11/13}{Added the \Lopt{polutonikogreek} -% option} -% \changes{babel~3.7c}{1999/04/22}{set the correct language attribute -% for polutoniko greek} -% \changes{babel~3.7a}{1998/03/27}{Added the \Lopt{hebrew} option} -% \changes{babel~3.7b}{1998/06/25}{Added the \Lopt{latin} option} -% \changes{babel~3.7m}{2003/11/13}{Added the \Lopt{interlingua} -% option} -% \changes{babel~3.6p}{1999/04/10}{Added the \Lopt{ngerman} and -% \Lopt{naustrian} options} -% \changes{babel~3.7f}{2000/09/26}{Added the \Lopt{samin} option} % \changes{babel~3.8c}{2004/06/12}{Added the \Lopt{newzealand} option} -% \changes{babel~3.6e}{1997/01/08}{Added options \Lopt{UKenglish} and -% \Lopt{USenglish}} % \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 @@ -2989,18 +3020,15 @@ help from Bernd Raichle, for which I am grateful. 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 +% Malay, now handled with proxy files} +% % \begin{macrocode} \DeclareOption{acadian}{\bbl@load@language{frenchb}} \DeclareOption{afrikaans}{\bbl@load@language{dutch}} -\DeclareOption{american}{\bbl@load@language{english}} -\DeclareOption{australian}{\bbl@load@language{english}} -\DeclareOption{bahasa}{\bbl@load@language{bahasai}} -\DeclareOption{bahasai}{\bbl@load@language{bahasai}} -\DeclareOption{bahasam}{\bbl@load@language{bahasam}} \DeclareOption{brazil}{\bbl@load@language{portuges}} \DeclareOption{brazilian}{\bbl@load@language{portuges}} -\DeclareOption{british}{\bbl@load@language{english}} -\DeclareOption{canadian}{\bbl@load@language{english}} \DeclareOption{canadien}{\bbl@load@language{frenchb}} \DeclareOption{francais}{\bbl@load@language{frenchb}} \DeclareOption{french}{\bbl@load@language{frenchb}}% @@ -3008,34 +3036,24 @@ help from Bernd Raichle, for which I am grateful. \input{rlbabel.def}% \bbl@load@language{hebrew}} \DeclareOption{hungarian}{\bbl@load@language{magyar}} -\DeclareOption{indon}{\bbl@load@language{bahasai}} -\DeclareOption{indonesian}{\bbl@load@language{bahasai}} \DeclareOption{lowersorbian}{\bbl@load@language{lsorbian}} -\DeclareOption{malay}{\bbl@load@language{bahasam}} -\DeclareOption{meyalu}{\bbl@load@language{bahasam}} -\DeclareOption{melayu}{\bbl@load@language{bahasam}} -\DeclareOption{newzealand}{\bbl@load@language{english}} \DeclareOption{nynorsk}{\bbl@load@language{norsk}} \DeclareOption{polutonikogreek}{% \bbl@load@language{greek}% \languageattribute{greek}{polutoniko}} \DeclareOption{portuguese}{\bbl@load@language{portuges}} \DeclareOption{russian}{\bbl@load@language{russianb}} -\DeclareOption{UKenglish}{\bbl@load@language{english}} \DeclareOption{ukrainian}{\bbl@load@language{ukraineb}} \DeclareOption{uppersorbian}{\bbl@load@language{usorbian}} -\DeclareOption{USenglish}{\bbl@load@language{english}} % \end{macrocode} % -% Another way to extend the list of `known' options for \babel\ is +% Another way to extend the list of `known' options for \babel\ was % to create the file \file{bblopts.cfg} in which one can add option % declarations. However, this mechanism is deprecated -- if you % 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. -% \changes{babel~3.6i}{1997/03/15}{Added the possibility to have a -% \file{bblopts.cfg} file with option declarations.} % \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 @@ -3068,7 +3086,7 @@ help from Bernd Raichle, for which I am grateful. % file are the same. % \begin{macrocode} \bbl@for\bbl@tempa\bbl@language@opts{% - \@ifundefined{ds@\bbl@tempa}% + \bbl@ifunset{ds@\bbl@tempa}% {\edef\bbl@tempb{% \noexpand\DeclareOption {\bbl@tempa}% @@ -3083,7 +3101,7 @@ help from Bernd Raichle, for which I am grateful. % option could be a language. % \begin{macrocode} \bbl@for\bbl@tempa\@classoptionslist{% - \@ifundefined{ds@\bbl@tempa}% + \bbl@ifunset{ds@\bbl@tempa}% {\IfFileExists{\bbl@tempa.ldf}% {\edef\bbl@tempb{% \noexpand\DeclareOption @@ -3103,7 +3121,6 @@ help from Bernd Raichle, for which I am grateful. % \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. -% \changes{babel~3.6i}{1997/03/12}{Added default option} % \changes{babel~3.9a}{2012/12/22}{Default option does nothing} % % The options have to be processed in the order in which the user @@ -3150,15 +3167,11 @@ help from Bernd Raichle, for which I am grateful. {Too late for \string\AfterBabelLanguage}% {Languages have been loaded, so I can do nothing}} % \end{macrocode} -% \changes{babel~3.7c}{1999/03/13}{Added an error message for when no -% language option was specified} +% % In order to catch the case where the user forgot to specify a % 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.7c}{1999/04/09}{No longer us a redefinition of an -% internal macro, just check \cs{bbl@main@language} and load -% \file{babel.def}} % \changes{babel~3.9a}{2012/06/24}{Now babel is not loaded to prevent % the document from raising errors after fixing it} % \begin{macrocode} @@ -3212,10 +3225,6 @@ help from Bernd Raichle, for which I am grateful. % % \subsection{Tools} % -% |\bbl@engine| takes the following values: 0 is pdf\TeX, 1 is -% \luatex, and 2 is \xetex. You may use it in your language style -% if necessary. -% % \changes{babel~3.9k}{2014/03/24}{Added definition for % \cs{uselanguage}} % \changes{babel~3.9n}{2015/12/21}{Define a few macros for 2.09} @@ -3258,38 +3267,8 @@ help from Bernd Raichle, for which I am grateful. \fi <@Load patterns in luatex@> <@Basic macros@> -\def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% -\chardef\bbl@engine=% - \ifx\directlua\@undefined - \ifx\XeTeXinputencoding\@undefined - \z@ - \else - \tw@ - \fi - \else - \@ne - \fi % \end{macrocode} % -% \begin{macro}{\bbl@afterelse} -% \begin{macro}{\bbl@afterfi} -% Because the code that is used in the handling of active -% characters may need to look ahead, we take extra care to `throw' -% it over the |\else| and |\fi| parts of an -% |\if|-statement\footnote{This code is based on code presented in -% TUGboat vol. 12, no2, June 1991 in ``An expansion Power Lemma'' -% 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. -% \changes{babel~3.6i}{1997/02/20}{Made \cs{bbl@afterelse} and -% \cs{bbl@afterfi} \cs{long}} -% \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} -% % \begin{macro}{\addto} % For each language four control sequences have to be defined that % control the language-specific definitions. To be able to add @@ -3307,10 +3286,6 @@ help from Bernd Raichle, for which I am grateful. % \meta{control sequence} is \emph{re}defined, using the contents % of the token register. % -% \changes{babel~3.1}{1991/11/05}{Added macro} -% \changes{babel~3.4}{1994/02/04}{Changed to use toks register} -% \changes{babel~3.6b}{1996/12/30}{Also check if control sequence -% expands to \cs{relax}} % \begin{macrocode} \def\addto#1#2{% \ifx#1\@undefined @@ -3331,8 +3306,6 @@ help from Bernd Raichle, for which I am grateful. % 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.7c}{1999/04/30}{Only execute -% \cs{initiate@active@char} once for each character} % \changes{babel~3.9a}{1999/04/30}{Added \cs{bbl@withactive}} % \begin{macrocode} \def\bbl@withactive#1#2{% @@ -3343,7 +3316,6 @@ help from Bernd Raichle, for which I am grateful. % % % \begin{macro}{\bbl@redefine} -% \changes{babel~3.5f}{1995/11/15}{Macro added} % To redefine a command, we save the old meaning of the macro. % Then we redefine it to call the original macro with the % `sanitized' argument. The reason why we do it this way is that @@ -3355,7 +3327,7 @@ help from Bernd Raichle, for which I am grateful. % new control sequence, |\org@...| % \begin{macrocode} \def\bbl@redefine#1{% - \edef\bbl@tempa{\expandafter\@gobble\string#1}% + \edef\bbl@tempa{\bbl@stripslash#1}% \expandafter\let\csname org@\bbl@tempa\endcsname#1% \expandafter\def\csname\bbl@tempa\endcsname} % \end{macrocode} @@ -3367,12 +3339,11 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@redefine@long} -% \changes{babel~3.6f}{1997/01/14}{Macro added} % 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{\expandafter\@gobble\string#1}% + \edef\bbl@tempa{\bbl@stripslash#1}% \expandafter\let\csname org@\bbl@tempa\endcsname#1% \expandafter\long\expandafter\def\csname\bbl@tempa\endcsname} \@onlypreamble\bbl@redefine@long @@ -3380,9 +3351,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@redefinerobust} -% \changes{babel~3.5f}{1995/11/15}{Macro added} -% \changes{babel~3.5f}{1996/04/09}{Define \cs*{foo } instead of -% \cs{foo}} % For commands that are redefined, but which \textit{might} be % robust we need a slightly more intelligent macro. A robust % command |foo| is defined to expand to |\protect|\verb*|\foo |. So @@ -3391,16 +3359,12 @@ help from Bernd Raichle, for which I am grateful. % afterwards. Therefore all we need to do now is define \verb*|\foo |. % \begin{macrocode} \def\bbl@redefinerobust#1{% - \edef\bbl@tempa{\expandafter\@gobble\string#1}% - \expandafter\ifx\csname\bbl@tempa\space\endcsname\relax - \expandafter\let\csname org@\bbl@tempa\endcsname#1% - \expandafter\edef\csname\bbl@tempa\endcsname{\noexpand\protect - \expandafter\noexpand\csname\bbl@tempa\space\endcsname}% - \else - \expandafter\let\csname org@\bbl@tempa\expandafter\endcsname - \csname\bbl@tempa\space\endcsname - \fi - \expandafter\def\csname\bbl@tempa\space\endcsname} + \edef\bbl@tempa{\bbl@stripslash#1}% + \bbl@ifunset{\bbl@tempa\space}% + {\expandafter\let\csname org@\bbl@tempa\endcsname#1% + \bbl@exp{\def\\#1{\\\protect\<\bbl@tempa\space>}}}% + {\bbl@exp{\let\<org@\bbl@tempa>\<\bbl@tempa\space>}}% + \@namedef{\bbl@tempa\space}} % \end{macrocode} % % This command should only be used in the preamble of the document. @@ -3422,10 +3386,10 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \def\AddBabelHook#1#2{% - \@ifundefined{bbl@hk@#1}{\EnableBabelHook{#1}}{}% + \bbl@ifunset{bbl@hk@#1}{\EnableBabelHook{#1}}{}% \def\bbl@tempa##1,#2=##2,##3\@empty{\def\bbl@tempb{##2}}% \expandafter\bbl@tempa\bbl@evargs,#2=,\@empty - \@ifundefined{bbl@ev@#1@#2}% + \bbl@ifunset{bbl@ev@#1@#2}% {\bbl@csarg\bbl@add{ev@#2}{\bbl@elt{#1}}% \bbl@csarg\newcommand}% {\bbl@csarg\let{ev@#1@#2}\relax @@ -3474,6 +3438,9 @@ help from Bernd Raichle, for which I am grateful. % \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} % % \begin{macrocode} \newcommand\babelensure[2][]{% @@ -3496,28 +3463,27 @@ help from Bernd Raichle, for which I am grateful. \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{% \expandafter{\bbl@ens@exclude}}% \toks@\expandafter{\bbl@tempc}% - \edef\x{% - \endgroup - \noexpand\@namedef{bbl@e@#2}{\the\toks@{\bbl@ens@fontenc}}}% - \x} + \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 \ifx##1\@empty\else \in@{##1}{#2}% \ifin@\else + \bbl@ifunset{bbl@ensure@\languagename}% + {\bbl@exp{% + \\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{% + \\\foreignlanguage{\languagename}% + {\ifx\relax#3\else + \\\fontencoding{#3}\\\selectfont + \fi + ########1}}}}% + {}% \toks@\expandafter{##1}% - \edef\bbl@tempa{% - \noexpand\DeclareRobustCommand - \bbl@csarg\noexpand{ensure@\languagename}[1]{% - \noexpand\foreignlanguage{\languagename}% - {\ifx\relax#3\else - \noexpand\fontencoding{#3}\noexpand\selectfont - \fi - ########1}}}% - \bbl@tempa \edef##1{% \bbl@csarg\noexpand{ensure@\languagename}% - {\the\toks@}} + {\the\toks@}}% \fi \expandafter\bbl@tempb \fi}% @@ -3559,8 +3525,6 @@ help from Bernd Raichle, for which I am grateful. % `=', because it is sometimes used in constructions with the % |\let| primitive. Therefore we store its current catcode and % restore it later on. -% \changes{babel~3.7o}{2003/11/26}{make sure the equals sign has its -% default category code} % % Now we check whether we should perhaps stop the processing of % this file. To do this we first need to check whether the second @@ -3610,10 +3574,7 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\ldf@quit} -% \changes{babel~3.6a}{1996/10/29}{Macro added} % This macro interrupts the processing of a language definition file. -% \changes{babel~3.7o}{2003/11/26}{Also restore the category code of -% the equals sign} % \begin{macrocode} \def\ldf@quit#1{% \expandafter\main@language\expandafter{#1}% @@ -3624,7 +3585,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\ldf@finish} -% \changes{babel~3.6a}{1996/10/16}{Macro added} % This macro takes one argument. It is the name of the language % that was defined in the language definition file. % @@ -3632,8 +3592,6 @@ 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.7o}{2003/11/26}{Also restore the category code of -% the equals sign} % \changes{babel~3.9a}{2012/10/01}{Added \cs{bbl@afterlang} which % executes the code delayed with \cs{AfterBabelLanguage}} % \begin{macrocode} @@ -3659,12 +3617,7 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % % \begin{macro}{\main@language} -% \changes{babel~3.5a}{1995/02/17}{Macro added} -% \changes{babel~3.6a}{1996/10/16}{\cs{main@language} now also sets -% \cs{languagename} and \cs{l@languagename} for use by other -% packages in the preamble of a document} % \begin{macro}{\bbl@main@language} -% \changes{babel~3.5a}{1995/02/17}{Macro added} % This command should be used in the various language definition % files. It stores its argument in |\bbl@main@language|; to be used % to switch to the correct language at the beginning of the @@ -3685,11 +3638,22 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % \end{macro} +% +% A bit of optimization. Select in heads/foots the language only if +% necessary. +% +% \begin{macrocode} +\def\select@language@x#1{% + \ifcase\bbl@select@type + \bbl@ifsamestring\languagename{#1}{}{\select@language{#1}}% + \else + \select@language{#1}% + \fi} +% \end{macrocode} % % \subsection{Shorthands} % % \begin{macro}{\bbl@add@special} -% \changes{babel~3.2}{1991/11/10}{Added macro} % 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). @@ -3727,10 +3691,10 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@remove@special} -% \changes{babel~3.2}{1991/11/10}{Added macro} +% % The companion of the former macro is |\bbl@remove@special|. It -% is used to remove a character from the set macros |\dospecials| -% and |\@sanitize|. +% 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 @@ -3751,7 +3715,7 @@ help from Bernd Raichle, for which I am grateful. \def\@makeother{\x\@makeother}% \edef\x{\endgroup \def\noexpand\dospecials{\dospecials}% - \expandafter\ifx\csname @sanitize\endcsname\relax \else + \expandafter\ifx\csname @sanitize\endcsname\relax\else \def\noexpand\@sanitize{\@sanitize}% \fi}% \x} @@ -3760,8 +3724,6 @@ help from Bernd Raichle, for which I am grateful. % % % \begin{macro}{\initiate@active@char} -% \changes{babel~3.5a}{1995/02/11}{Added macro} -% \changes{babel~3.5b}{1995/03/03}{Renamed macro} % A language definition file can call this macro to make a % character active. This macro takes one argument, the character % that is to be made active. When the character was already active @@ -3805,9 +3767,6 @@ help from Bernd Raichle, for which I am grateful. % 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. -% \changes{babel~3.7e}{1999/09/24}{pass the argument on with braces in -% order to prevent it from breaking up} -% \changes{babel~3.7f}{2000/02/18}{remove the braces again} % \begin{macrocode} \long\@namedef{#3@arg#1}##1{% \expandafter\ifx\csname#2@sh@#1@\string##1@\endcsname\relax @@ -3820,13 +3779,14 @@ help from Bernd Raichle, for which I am grateful. % \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. +% catcodes: active, other (|\string|'ed) and the original one. +% This trick simplifies the code a lot. % \begin{macrocode} \def\initiate@active@char#1{% - \expandafter\ifx\csname active@char\string#1\endcsname\relax - \bbl@withactive - {\expandafter\@initiate@active@char\expandafter}#1\string#1#1% - \fi} + \bbl@ifunset{active@char\string#1}% + {\bbl@withactive + {\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, @@ -3842,14 +3802,12 @@ help from Bernd Raichle, for which I am grateful. % making them |\relax|). % \begin{macrocode} \def\@initiate@active@char#1#2#3{% - \expandafter\edef\csname bbl@oricat@#2\endcsname{% - \catcode`#2=\the\catcode`#2\relax}% + \bbl@csarg\edef{oricat@#2}{\catcode`#2=\the\catcode`#2\relax}% \ifx#1\@undefined - \expandafter\edef\csname bbl@oridef@#2\endcsname{% - \let\noexpand#1\noexpand\@undefined}% + \bbl@csarg\edef{oridef@#2}{\let\noexpand#1\noexpand\@undefined}% \else - \expandafter\let\csname bbl@oridef@@#2\endcsname#1% - \expandafter\edef\csname bbl@oridef@#2\endcsname{% + \bbl@csarg\let{oridef@@#2}#1% + \bbl@csarg\edef{oridef@#2}{% \let\noexpand#1% \expandafter\noexpand\csname bbl@oridef@@#2\endcsname}% \fi @@ -3882,17 +3840,8 @@ help from Bernd Raichle, for which I am grateful. % shorthands are active during the processing of the \file{.aux} % file. Otherwise some citations may give unexpected results in % the printout when a shorthand was used in the optional argument -% of |\bibitem| for example. -% \changes{babel~3.6i}{1997/03/01}{Make shorthands active during -% \file{.aux} file processing}. Then we -% make it active (not strictly necessary, but done for backward -% compatibility). -% \changes{babel~3.5f}{1995/12/01}{Restore the category code of a -% shorthand char at end of package} -% \changes{babel~3.6f}{1997/01/14}{Made restoring of the category code -% of shorthand characters optional} -% \changes{babel~3.7a}{1997/03/21}{Use \cs{@ifpackagewith} to -% determine whether shorthand characters need to remain active} +% of |\bibitem| for example. Then we make it active (not strictly +% necessary, but done for backward compatibility). % \begin{macrocode} \bbl@restoreactive{#2}% \AtBeginDocument{% @@ -3962,8 +3911,6 @@ help from Bernd Raichle, for which I am grateful. % 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.5d}{1995/07/02}{Skip the user-level active char -% with argument if no shorthands with arguments were defined} % \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} @@ -3979,8 +3926,6 @@ 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.7f}{1999/12/09}{Added an extra shorthand -% combination on user level to catch an interfering \cs{protect}} % \changes{babel~3.9a}{2012/8/18}{Use \cs{user@group}, as above, % instead of the hardwired \texttt{user}} % \begin{macrocode} @@ -3997,16 +3942,6 @@ help from Bernd Raichle, for which I am grateful. % works. Therefore an extra level of expansion is introduced with a % check for math mode on the upper level. % -% \changes{babel~3.7f}{1999/12/18}{Insert a check for math mode in -% the definition of \cs{normal@char'}} -% \changes{babel~3.7g}{2000/10/02}{use \cs{textormath} to get rid -% of the \cs{fi} (PR 3266)} -% \changes{babel~3.7f}{1999/12/18}{The redefinition needs to take -% place one level higher, \cs{prim@s} needs to be redefined.} -% \changes{babel~3.7f}{1999/12/18}{Introduced an extra -% level of expansion in the definition of an active caret} -% \changes{babel~3.7f}{2000/09/25}{Make an exception for the active -% caret which needs an extra level of expansion} % \changes{babel~3.9a}{2012/09/11}{The output routine resets the quote % to \cs{active@math@prime}, so we redefine the latter with the new % ``normal'' value} @@ -4089,10 +4024,6 @@ 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|. -% \changes{babel~3.5d}{1995/07/02}{\cs{@protected@cmd} has vanished -% from \file{ltoutenc.dtx}} -% \changes{babel~3.7o}{2003/11/17}{Added handling of the situation -% where \cs{protect} is set to \cs{@unexpandable@protect}} % \begin{macrocode} \def\active@prefix#1{% \ifx\protect\@typeset@protect @@ -4127,7 +4058,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@restore@actives} -% \changes{babel~3.7m}{2003/11/15}{New macro added} % When the output routine kicks in while the % active characters were made ``safe'' this must be undone in % the headers to prevent unexpected typeset results. For this @@ -4139,7 +4069,6 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macro}{\bbl@activate} % \begin{macro}{\bbl@deactivate} -% \changes{babel~3.5a}{1995/02/11}{Added macro} % \changes{babel~3.9a}{2013/01/11}{\cs{bbl@withactive} makes sure the % catcode is active} % Both macros take one argument, like |\initiate@active@char|. The @@ -4179,10 +4108,6 @@ 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.5d}{1995/07/02}{Make a `note' when a shorthand with -% an argument is defined.} -% \changes{babel~3.6i}{1997/02/23}{Make it possible to distinguish the -% constructed control sequences for the case with argument} % \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} @@ -4193,7 +4118,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@tempa{#3}% \ifx\bbl@tempa\@empty \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@scndcs - \@ifundefined{#1@sh@\string#2@}{}% + \bbl@ifunset{#1@sh@\string#2@}{}% {\def\bbl@tempa{#4}% \expandafter\ifx\csname#1@sh@\string#2@\endcsname\bbl@tempa \else @@ -4204,7 +4129,7 @@ help from Bernd Raichle, for which I am grateful. \@namedef{#1@sh@\string#2@}{#4}% \else \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@firstcs - \@ifundefined{#1@sh@\string#2@\string#3@}{}% + \bbl@ifunset{#1@sh@\string#2@\string#3@}{}% {\def\bbl@tempa{#4}% \expandafter\ifx\csname#1@sh@\string#2@\string#3@\endcsname\bbl@tempa \else @@ -4241,8 +4166,6 @@ 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'. -% \changes{babel~3.6i}{1997/02/24}{Have a user group called `user' by -% default} % \begin{macrocode} \def\user@group{user} \def\language@group{english} @@ -4262,11 +4185,6 @@ help from Bernd Raichle, for which I am grateful. % version is also provided which activates them always after the % language has been switched. % -% \changes{babel~3.7j}{2001/11/11}{When \TeX\ has seen a character -% its category code is fixed; need to use a `stand-in' for the -% call of \cs{bbl@activate}} -% \changes{babel~3.7j}{2003/09/11}{The change from 11/112001 was -% incomplete} % \changes{babel~3.9a}{2012/08/05}{Now \cs{bbl@activate} makes sure % the catcode is active, so this part is simplified} % \changes{babel~3.9a}{2012/08/12}{User shorhands can be @@ -4307,7 +4225,7 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\user@language@group{user@\language@group} \def\bbl@set@user@generic#1#2{% - \@ifundefined{user@generic@active#1}% + \bbl@ifunset{user@generic@active#1}% {\bbl@active@def#1\user@language@group{user@active}{user@generic@active}% \bbl@active@def#1\user@group{user@generic@active}{language@active}% \expandafter\edef\csname#2@sh@#1@@\endcsname{% @@ -4338,7 +4256,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\aliasshorthand} -% \changes{babel~3.5f}{1996/01/25}{New command} % First the new shorthand needs to be initialized, % \begin{macrocode} \def\aliasshorthand#1#2{% @@ -4388,11 +4305,7 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\shorthandon} -% \changes{babel~3.7a}{1998/06/07}{Added command} % \begin{macro}{\shorthandoff} -% \changes{babel~3.7a}{1998/06/07}{Added command} -% \changes{babel~3.9a}{2012/09/08}{Added code for the starred variant -% of \cs{shorthandoff}} % The first level definition of these macros just passes the % argument on to |\bbl@switch@sh|, adding |\@nil| at the end to % denote the end of the list of characters. @@ -4404,7 +4317,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % % \begin{macro}{\bbl@switch@sh} -% \changes{babel~3.7a}{1998/06/07}{Added command} % \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 @@ -4424,7 +4336,7 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\bbl@switch@sh#1#2{% \ifx#2\@nnil\else - \@ifundefined{bbl@active@\string#2}% + \bbl@ifunset{bbl@active@\string#2}% {\bbl@error {I cannot switch `\string#2' on or off--not a shorthand}% {This character is not a shorthand. Maybe you made\\% @@ -4451,7 +4363,7 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\babelshorthand{\active@prefix\babelshorthand\bbl@putsh} \def\bbl@putsh#1{% - \@ifundefined{bbl@active@\string#1}% + \bbl@ifunset{bbl@active@\string#1}% {\bbl@putsh@i#1\@empty\@nnil}% {\csname bbl@active@\string#1\endcsname}} \def\bbl@putsh@i#1#2\@nnil{% @@ -4479,10 +4391,7 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.9a}{2012/12/27}{Removed redundant system declarations} % % \begin{macro}{\bbl@prim@s} -% \changes{babel~3.7f}{1999/12/01}{Need to redefine \cs{prim@s} as -% well as plain \TeX's definition uses \cs{next}} % \begin{macro}{\bbl@pr@m@s} -% \changes{babel~3.5a}{1995/03/10}{Added macro} % \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 @@ -4558,8 +4467,6 @@ help from Bernd Raichle, for which I am grateful. % Language attributes provide a means to give the user control over % which features of the language definition files he wants to % enable. -% \changes{babel~3.7c}{1998/07/02}{Added support for language -% attributes} % \begin{macro}{\languageattribute} % \changes{babel~3.9a}{2012/09/07}{Use \cs{@expandtwoargs} with \cs{in@}} % The macro |\languageattribute| checks whether its arguments are @@ -4646,7 +4553,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@ifattributeset} -% \changes{babel~3.7f}{2000/02/12}{macro added} % This internal macro has 4 arguments. It can be used to interpret % \TeX\ code based on whether a certain attribute was set. This % command should appear inside the argument to |\AtBeginDocument| @@ -4684,25 +4590,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % -% \begin{macro}{\bbl@add@list} -% This internal macro adds its second argument to a comma -% separated list in its first argument. When the list is not -% defined yet (or empty), it will be initiated -% \begin{macrocode} -\def\bbl@add@list#1#2{% - \ifx#1\@undefined - \def#1{#2}% - \else - \ifx#1\@empty - \def#1{#2}% - \else - \edef#1{#1,#2}% - \fi - \fi - } -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\bbl@ifknown@ttrib} % An internal macro to check whether a given language/attribute is % known. The macro takes 4 arguments, the language/attribute, the @@ -4738,8 +4625,6 @@ help from Bernd Raichle, for which I am grateful. % \begin{macro}{\bbl@clear@ttribs} % This macro removes all the attribute code from \LaTeX's memory at % |\begin{document}| time (if any is present). -% \changes{babel~3.7e}{1999/09/24}{When \cs{bbl@attributes} is -% undefined this should be a no-op} % \begin{macrocode} \def\bbl@clear@ttribs{% \ifx\bbl@attributes\@undefined\else @@ -4747,8 +4632,7 @@ help from Bernd Raichle, for which I am grateful. \expandafter\bbl@clear@ttrib\bbl@tempa. }% \let\bbl@attributes\@undefined - \fi - } + \fi} \def\bbl@clear@ttrib#1-#2.{% \expandafter\let\csname#1@attr@#2\endcsname\@undefined} \AtBeginDocument{\bbl@clear@ttribs} @@ -4769,9 +4653,7 @@ help from Bernd Raichle, for which I am grateful. % |\relax|'ed. % % \begin{macro}{\babel@savecnt} -% \changes{babel~3.2}{1991/11/10}{Added macro} % \begin{macro}{\babel@beginsave} -% \changes{babel~3.2}{1991/11/10}{Added macro} % The initialization of a new save cycle: reset the counter to % zero. % \begin{macrocode} @@ -4786,7 +4668,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\babel@save} -% \changes{babel~3.2}{1991/11/10}{Added macro} % The macro |\babel@save|\meta{csname} saves the current meaning of % the control sequence \meta{csname} to % |\originalTeX|\footnote{\cs{originalTeX} has to be @@ -4794,10 +4675,6 @@ 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. -% \changes{babel~3.2c}{1992/03/17}{missing backslash led to errors -% when executing \cs{originalTeX}} -% \changes{babel~3.2d}{1992/07/02}{saving in \cs{babel@i} and -% restoring from \cs{@babel@i} doesn't work very well...} % \begin{macrocode} \def\babel@save#1{% \expandafter\let\csname babel@\number\babel@savecnt\endcsname#1\relax @@ -4903,7 +4780,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@fixname\bbl@tempa \bbl@iflanguage\bbl@tempa{% \bbl@csarg\protected@edef{hyphenation@\bbl@tempa}{% - \@ifundefined{bbl@hyphenation@\bbl@tempa}% + \bbl@ifunset{bbl@hyphenation@\bbl@tempa}% \@empty {\csname bbl@hyphenation@\bbl@tempa\endcsname\space}% #2}}}% @@ -4912,18 +4789,19 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@allowhyphens} -% \changes{babel~3.2b}{1992/02/16}{Moved macro from language -% definition files} -% \changes{babel~3.7a}{1998/03/12}{Make \cs{allowhyphens} a no-op for -% T1 fontencoding} +% % \changes{babel-3.9a}{2012/07/28}{Replaced many \cs{allowhyphens} by % \cs{bbl@allowhyphen}. They were either no-op or executed always.} % \changes{babel-3.9i}{2014/01/29}{\cs{bbl@allowhyphens} must be % ignored at the beginning of a paragraph or table cell.} +% \changes{babel-3.9t}{2017/04/26}{Fixed misplaced \cs{nobreak} - +% sx366454 - soft hyphens could vanish.} +% % This macro makes hyphenation possible. Basically its definition % is nothing more than |\nobreak| |\hskip| \texttt{0pt plus % 0pt}\footnote{\TeX\ begins and ends a word for hyphenation at a % glue node. The penalty prevents a linebreak at this glue node.}. +% % \begin{macrocode} \def\bbl@allowhyphens{\ifvmode\else\nobreak\hskip\z@skip\fi} \def\bbl@t@one{T1} @@ -4934,20 +4812,23 @@ help from Bernd Raichle, for which I am grateful. % \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 % |\babelhyphen|. Instead of protecting it with % |\DeclareRobustCommand|, which could insert a |\relax|, we use -% the same procedure as shorthands. +% the same procedure as shorthands, with |\active@prefix|. +% % \begin{macrocode} \newcommand\babelnullhyphen{\char\hyphenchar\font} \def\babelhyphen{\active@prefix\babelhyphen\bbl@hyphen} \def\bbl@hyphen{% \@ifstar{\bbl@hyphen@i @}{\bbl@hyphen@i\@empty}} \def\bbl@hyphen@i#1#2{% - \@ifundefined{bbl@hy@#1#2\@empty}% + \bbl@ifunset{bbl@hy@#1#2\@empty}% {\csname bbl@#1usehyphen\endcsname{\discretionary{#2}{}{#2}}}% {\csname bbl@hy@#1#2\@empty\endcsname}} % \end{macrocode} +% % The following two commands are used to wrap the ``hyphen'' and % set the behaviour of the rest of the word -- the version with a % single |@| is used when further hyphenation is allowed, while @@ -4960,15 +4841,18 @@ help from Bernd Raichle, for which I am grateful. % skip. Unfortunately, this does handle cases like ``(-suffix)''. % |\nobreak| is always preceded by |\leavevmode|, in case the % shorthand starts a paragraph. +% % \begin{macrocode} \def\bbl@usehyphen#1{% \leavevmode - \ifdim\lastskip>\z@\mbox{#1}\nobreak\else\nobreak#1\fi - \hskip\z@skip} + \ifdim\lastskip>\z@\mbox{#1}\else\nobreak#1\fi + \nobreak\hskip\z@skip} \def\bbl@@usehyphen#1{% \leavevmode\ifdim\lastskip>\z@\mbox{#1}\else#1\fi} % \end{macrocode} +% % The following macro inserts the hyphen char. +% % \begin{macrocode} \def\bbl@hyphenchar{% \ifnum\hyphenchar\font=\m@ne @@ -4977,19 +4861,21 @@ help from Bernd Raichle, for which I am grateful. \char\hyphenchar\font \fi} % \end{macrocode} +% % Finally, we define the hyphen ``types''. Their names will not -% change, so you may use them in |ldf|'s. +% change, so you may use them in |ldf|'s. After a space, the +% |\mbox| in |\bbl@hy@nobreak| is redundant. +% % \begin{macrocode} \def\bbl@hy@soft{\bbl@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}} \def\bbl@hy@@soft{\bbl@@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}} \def\bbl@hy@hard{\bbl@usehyphen\bbl@hyphenchar} \def\bbl@hy@@hard{\bbl@@usehyphen\bbl@hyphenchar} -\def\bbl@hy@nobreak{\bbl@usehyphen{\mbox{\bbl@hyphenchar}\nobreak}} +\def\bbl@hy@nobreak{\bbl@usehyphen{\mbox{\bbl@hyphenchar}}} \def\bbl@hy@@nobreak{\mbox{\bbl@hyphenchar}} \def\bbl@hy@repeat{% \bbl@usehyphen{% - \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}% - \nobreak}} + \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}} \def\bbl@hy@@repeat{% \bbl@@usehyphen{% \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}} @@ -4999,8 +4885,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@disc} -% \changes{babel~3.5f}{1996/01/24}{Macro moved from language -% definition files} % For some languages the macro |\bbl@disc| is used to ease the % insertion of discretionaries for letters that behave `abnormally' % at a breakpoint. @@ -5060,7 +4944,7 @@ help from Bernd Raichle, for which I am grateful. \g@addto@macro\@uclclist{\reserved@b{\reserved@b\bbl@uclc}}% \gdef\bbl@uclc##1{% \let\bbl@encoded\bbl@encoded@uclc - \@ifundefined{\languagename @bbl@uclc}% and resumes it + \bbl@ifunset{\languagename @bbl@uclc}% and resumes it {##1}% {\let\bbl@tempa##1\relax % Used by LANG@bbl@uclc \csname\languagename @bbl@uclc\endcsname}% @@ -5175,7 +5059,7 @@ help from Bernd Raichle, for which I am grateful. \edef\bbl@sc@charset{\expandafter\zap@space\bbl@sc@charset\@empty}% \def\bbl@encstring##1##2{% \bbl@for\bbl@tempc\bbl@sc@fontenc{% - \@ifundefined{T@\bbl@tempc}% + \bbl@ifunset{T@\bbl@tempc}% {}% {\ProvideTextCommand##1\bbl@tempc{##2}% \bbl@toglobal##1% @@ -5205,7 +5089,6 @@ help from Bernd Raichle, for which I am grateful. captions or extras, but you set none}}% \fi \ifx\@empty#1% - \@expandtwoargs \bbl@usehooks{defaultcommands}{}% \else \@expandtwoargs @@ -5244,7 +5127,7 @@ help from Bernd Raichle, for which I am grateful. \fi \fi}} \AtEndOfPackage{% - \def\bbl@forlang#1#2{\bbl@for#1\bbl@L{\@ifundefined{date#1}{}{#2}}}% + \def\bbl@forlang#1#2{\bbl@for#1\bbl@L{\bbl@ifunset{date#1}{}{#2}}}% \let\bbl@scswitch\relax} \@onlypreamble\EndBabelCommands \def\EndBabelCommands{% @@ -5271,8 +5154,8 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\bbl@setstring#1#2{% \bbl@forlang\bbl@tempa{% - \edef\bbl@LC{\bbl@tempa\expandafter\@gobble\string#1}% - \@ifundefined{\bbl@LC}% eg, \germanchaptername + \edef\bbl@LC{\bbl@tempa\bbl@stripslash#1}% + \bbl@ifunset{\bbl@LC}% eg, \germanchaptername {\global\expandafter \bbl@add\csname\bbl@G\bbl@tempa\expandafter\endcsname\expandafter {\expandafter\bbl@scset\expandafter#1\csname\bbl@LC\endcsname}}% @@ -5317,6 +5200,8 @@ help from Bernd Raichle, for which I am grateful. % |\StartBabelCommands|. The current definition is % somewhat complicated because we need a count, but |\count@| is % not under our control (remember |\SetString| may call hooks). +% Instead of defining a dedicated count, we just ``pre-expand'' +% its value. % % \changes{babel~3.9h}{2013/10/16}{Tidied up and bug fixed - first % element expanded prematurely.} @@ -5326,7 +5211,7 @@ help from Bernd Raichle, for which I am grateful. \def\SetStringLoop##1##2{% \def\bbl@templ####1{\expandafter\noexpand\csname##1\endcsname}% \count@\z@ - \bbl@loop\bbl@tempa{##2}{% + \bbl@loop\bbl@tempa{##2}{% empty items and spaces are ok \advance\count@\@ne \toks@\expandafter{\bbl@tempa}% \edef\bbl@tempb{% @@ -5438,8 +5323,6 @@ help from Bernd Raichle, for which I am grateful. % \subsection{Macros common to a number of languages} % % \begin{macro}{\set@low@box} -% \changes{babel~3.2b}{1992/02/16}{Moved macro from language -% definition files} % 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} @@ -5450,12 +5333,8 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\save@sf@q} -% \changes{babel~3.2b}{1992/02/16}{Moved macro from language -% definition files} % The macro |\save@sf@q| is used to save and reset the current % space factor. -% \changes{babel~3.7f}{2000/09/19}{PR3119, don't start a paragraph in -% a local group} % \begin{macrocode} \def\save@sf@q#1{\leavevmode \begingroup @@ -5464,8 +5343,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % -% \changes{babel~3.5c}{1995/06/14}{Repaired a typo (itlaic, PR1652)} -% % \subsection{Making glyphs available} % % This section makes a number of glyphs available that either do not @@ -5578,8 +5455,6 @@ 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{dutch-3.7a}{1995/02/04}{Changed the kerning in the faked ij -% to match the dc-version of it} % \changes{babel~3.9a}{2012/07/28}{Removed the first \cs{allowhyphens}. % Moved the second one just after the kern.} % \begin{macrocode} @@ -5610,8 +5485,6 @@ 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}). -% \changes{babel~3.5f}{1996/03/28}{New definition of \cs{dj}, see PR -% 2058} % \begin{macrocode} \def\crrtic@{\hrule height0.1ex width0.3em} \def\crttic@{\hrule height0.1ex width0.33em} @@ -5661,8 +5534,6 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macro}{\glq} % \begin{macro}{\grq} -% \changes{babel~3.7a}{1997/04/25}{Make the definition of \cs{grq} -% dependent on the font encoding} % \changes{babel~3.8b}{2004/05/02}{Made \cs{glq} fontencoding % dependent as well} % The `german' single quotes. @@ -5689,8 +5560,6 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macro}{\glqq} % \begin{macro}{\grqq} -% \changes{babel~3.7a}{1997/04/25}{Make the definition of \cs{grqq} -% dependent on the font encoding} % \changes{babel~3.8b}{2004/05/02}{Made \cs{grqq} fontencoding % dependent as well} % The `german' double quotes. @@ -5717,10 +5586,6 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macro}{\flq} % \begin{macro}{\frq} -% \changes{babel~3.5f}{1995/08/07}{corrected spelling of -% \cs{quilsingl...}} -% \changes{babel~3.5f}{1995/09/05}{now use \cs{textormath} in these -% definitions} % \changes{babel~3.8b}{2004/05/02}{Made \cs{flq} and \cs{frq} % fontencoding dependent} % The `french' single guillemets. @@ -5744,10 +5609,6 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macro}{\flqq} % \begin{macro}{\frqq} -% \changes{babel~3.5f}{1995/08/07}{corrected spelling of -% \cs{quillemot...}} -% \changes{babel~3.5f}{1995/09/05}{now use \cs{textormath} in these -% definitions} % \changes{babel~3.8b}{2004/05/02}{Made \cs{flqq} and \cs{frqq} % fontencoding dependent} % The `french' double guillemets. @@ -5827,8 +5688,6 @@ 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. -% \changes{babel~3.5f}{1996/04/02}{Added a \cs{allowhyphens}} -% \changes{babel~3.5f}{1996/06/25}{removed \cs{allowhyphens}} % \begin{macrocode} \def\lower@umlaut#1{% \leavevmode\bgroup @@ -5871,9 +5730,6 @@ 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.6c}{1997/01/05}{When \file{hyphen.cfg} is not -% loaded in the format \cs{l@english} might not be defined; assume -% english is language 0} % \changes{babel~3.9a}{2012-05-17}{Languages are best assigned with % \cs{chardef}, not \cs{let}} % \begin{macrocode} @@ -5943,7 +5799,6 @@ help from Bernd Raichle, for which I am grateful. % `|macro:#1->\B|' with all category codes set to `other' or % `space'. % \begin{macro}{\newlabel} -% \changes{babel~3.5f}{1995/11/15}{Now use \cs{bbl@redefine}} % The macro |\label| writes a line with a |\newlabel| command % into the |.aux| file to define labels. % \begin{macrocode} @@ -5953,8 +5808,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\@newl@bel} -% \changes{babel~3.6i}{1997/03/01}{Now redefine \cs{@newl@bel} instead -% of \cs{@lbibitem} and \cs{newlabel}} % We need to change the definition of the \LaTeX-internal macro % |\@newl@bel|. This is needed because we need to make sure that % shorthand characters expand to their non-active version. @@ -5973,13 +5826,11 @@ 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. -% \changes{babel~3.7a}{1997/12/19}{Call \cs{@safe@activestrue} -% directly} % \begin{macrocode} \ifx\bbl@opt@safe\@empty\else \def\@newl@bel#1#2#3{% {\@safe@activestrue - \@ifundefined{#1@#2}% + \bbl@ifunset{#1@#2}% \relax {\gdef\@multiplelabels{% \@latex@warning@no@line{There were multiply-defined labels}}% @@ -5996,20 +5847,6 @@ 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. -% \changes{babel~3.4g}{1994/08/30}{Moved the \cs{def} inside the -% macrocode environment} -% \changes{babel~3.5f}{1995/11/15}{Now use \cs{bbl@redefine}} -% \changes{babel~3.5f}{1996/01/09}{Complete rewrite of this macro as -% the same character ended up with different category codes in the -% labels that are being compared. Now use \cs{meaning}} -% \changes{babel~3.5f}{1996/01/16}{Use \cs{strip@prefix} only on -% \cs{bbl@tempa} when it is not \cs{relax}} -% \changes{babel~3.6i}{1997/02/28}{Make sure that shorthands don't get -% expanded at the wrong moment.} -% \changes{babel~3.6i}{1997/03/01}{\cs{@safe@activesfalse} is now -% part of the label definition} -% \changes{babel~3.7a}{1998/03/13}{Removed \cs{@safe@activesfalse} -% from the label definition} % \begin{macrocode} \CheckCommand*\@testdef[3]{% \def\reserved@a{#3}% @@ -6065,17 +5902,6 @@ 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. -% \changes{babel~3.5b}{1995/03/07}{Made \cs{ref} and \cs{pageref} -% robust (PR1353)} -% \changes{babel~3.5d}{1995/07/04}{use a different control sequence -% while making \cs{ref} and \cs{pageref} robust} -% \changes{babel~3.5f}{1995/11/06}{redefine \cs*{ref } if it exists -% instead of \cs{ref}} -% \changes{babel~3.5f}{1995/11/15}{Now use \cs{bbl@redefinerobust}} -% \changes{babel~3.5f}{1996/01/19}{redefine \cs{\@setref} instead of -% \cs{ref} and \cs{pageref} in \LaTeXe.} -% \changes{babel~3.5f}{1996/01/21}{Reverse the previous change as it -% inhibits the use of active characters in labels} % \begin{macrocode} \@expandtwoargs\in@{R}\bbl@opt@safe \ifin@ @@ -6092,15 +5918,12 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\@citex} -% \changes{babel~3.5f}{1995/11/15}{Now use \cs{bbl@redefine}} % The macro used to cite from a bibliography, |\cite|, uses an % internal macro, |\@citex|. % It is this internal macro that picks up the argument(s), % 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. -% \changes{babel~3.7g}{2000/10/01}{The shorthands need to be -% deactivated for the second argument of \cs{@citex} only.} % \begin{macrocode} \@expandtwoargs\in@{B}\bbl@opt@safe \ifin@ @@ -6143,7 +5966,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\nocite} -% \changes{babel~3.5f}{1995/11/15}{Now use \cs{bbl@redefine}} % The macro |\nocite| which is used to instruct BiB\TeX\ to % extract uncited references from the database. % \begin{macrocode} @@ -6153,7 +5975,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bibcite} -% \changes{babel~3.5f}{1995/11/15}{Now use \cs{bbl@redefine}} % The macro that is used in the |.aux| file to define citation % labels. When packages such as \pkg{natbib} or \pkg{cite} are not % loaded its second argument is used to typeset the citation @@ -6164,10 +5985,6 @@ 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. -% \changes{babel~3.6s}{1999/04/13}{Need to determine `online' which -% definition of \cs{bibcite} is needed} -% \changes{babel~3.6v}{1999/04/21}{Also check for \pkg{cite} it can't -% handle \cs{@safe@activesfalse} in its second argument} % \begin{macrocode} \bbl@redefine\bibcite{% % \end{macrocode} @@ -6180,7 +5997,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@bibcite} -% \changes{babel~3.6v}{1999/04/21}{Macro \cs{bbl@bibcite} added} % The macro |\bbl@bibcite| holds the definition of |\bibcite| % needed when neither \pkg{natbib} nor \pkg{cite} is loaded. % \begin{macrocode} @@ -6190,7 +6006,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\bbl@cite@choice} -% \changes{babel~3.6v}{1999/04/21}{Macro \cs{bbl@cite@choice} added} % The macro |\bbl@cite@choice| determines which definition of % |\bibcite| is needed. % \begin{macrocode} @@ -6223,7 +6038,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\@bibitem} -% \changes{babel~3.5f}{1995/11/15}{Now use \cs{bbl@redefine}} % One of the two internal \LaTeX\ macros called by |\bibitem| % that write the citation label on the |.aux| file. % \begin{macrocode} @@ -6241,66 +6055,35 @@ help from Bernd Raichle, for which I am grateful. % \subsection{Marks} % % \begin{macro}{\markright} -% \changes{babel~3.6i}{1997/03/15}{Added redefinition of \cs{mark...} -% commands} % Because the output routine is asynchronous, we must % 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.7c}{1999/04/08}{Removed the use of \cs{head@lang} -% (PR 2990)} -% \changes{babel~3.7c}{1999/04/09}{Avoid expanding the arguments by -% storing them in token registers} -% \changes{babel~3.7m}{2003/11/15}{added \cs{bbl@restore@actives} to -% the mark} % \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} % \changes{babel~3.8f}{2005/05/15}{Make the definition independent of % the original definition; expand \cs{languagename} before passing % it into the token registers} +% \changes{babel~3.9t}{2017/04/23}{Refactored \cs{markright} and +% \cs{markboth}} +% +% We check whether the argument is empty; if it is, we just make +% sure the scratch token register is empty. Next, we store the +% argument to |\markright| in the scratch token register. This way +% these commands will not be expanded later, and we make sure that +% the text is typeset using the correct language settings. While +% 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{% -% \end{macrocode} -% First of all we temporarily store the language switching command, -% using an expanded definition in order to get the current value of -% |\languagename|. -% \begin{macrocode} - \edef\bbl@tempb{\noexpand\protect - \noexpand\foreignlanguage{\languagename}}% -% \end{macrocode} -% Then, we check whether the argument is empty; if it is, we -% just make sure the scratch token register is empty. -% \begin{macrocode} - \def\bbl@arg{#1}% - \ifx\bbl@arg\@empty - \toks@{}% - \else -% \end{macrocode} -% Next, we store the argument to |\markright| in the scratch token -% register, together with the expansion of |\bbl@tempb| (containing -% the language switching command) as defined before. This way -% these commands will not be expanded by using |\edef| later -% on, and we make sure that the text is typeset using the -% correct language settings. While 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} - \expandafter\toks@\expandafter{% - \bbl@tempb{\protect\bbl@restore@actives#1}}% - \fi -% \end{macrocode} -% Then we define a temporary control sequence using |\edef|. -% \begin{macrocode} - \edef\bbl@tempa{% -% \end{macrocode} -% When |\bbl@tempa| is executed, only |\languagename| will be -% expanded, because of the way the token register was filled. -% \begin{macrocode} - \noexpand\org@markright{\the\toks@}}% - \bbl@tempa -} + \bbl@ifblank{#1}% + {\org@markright{}}% + {\toks@{#1}% + \bbl@exp{% + \\\org@markright{\\\protect\\\foreignlanguage{\languagename}% + {\\\protect\\\bbl@restore@actives\the\toks@}}}}} % \end{macrocode} % \end{macro} % @@ -6312,9 +6095,7 @@ help from Bernd Raichle, for which I am grateful. % headings for the page. While doing so they also store a copy of % |\markboth| in |\@mkboth|. Therefore we need to check whether % |\@mkboth| has already been set. If so we neeed to do that again -% with the new definition of |\makrboth|. -% \changes{babel~3.7m}{2003/11/15}{added \cs{bbl@restore@actives} to -% the mark} +% 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} @@ -6333,28 +6114,17 @@ help from Bernd Raichle, for which I am grateful. % Now we can start the new definition of |\markboth| % \begin{macrocode} \bbl@redefine\markboth#1#2{% - \edef\bbl@tempb{\noexpand\protect - \noexpand\foreignlanguage{\languagename}}% - \def\bbl@arg{#1}% - \ifx\bbl@arg\@empty - \toks@{}% - \else - \expandafter\toks@\expandafter{% - \bbl@tempb{\protect\bbl@restore@actives#1}}% - \fi - \def\bbl@arg{#2}% - \ifx\bbl@arg\@empty - \toks8{}% - \else - \expandafter\toks8\expandafter{% - \bbl@tempb{\protect\bbl@restore@actives#2}}% - \fi - \edef\bbl@tempa{% - \noexpand\org@markboth{\the\toks@}{\the\toks8}}% - \bbl@tempa -} -% \end{macrocode} -% and copy it to |\@mkboth| if necesary. + \protected@edef\bbl@tempb##1{% + \protect\foreignlanguage{\languagename}{\protect\bbl@restore@actives##1}}% + \bbl@ifblank{#1}% + {\toks@{}}% + {\toks@\expandafter{\bbl@tempb{#1}}}% + \bbl@ifblank{#2}% + {\@temptokena{}}% + {\@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} @@ -6366,9 +6136,6 @@ help from Bernd Raichle, for which I am grateful. % \subsubsection{\pkg{ifthen}} % % \begin{macro}{\ifthenelse} -% \changes{babel~3.5g}{1996/08/11}{Redefinition of \cs{ifthenelse} -% added to circumvent problems with \cs{pageref} in the argument of -% \cs{isodd}} % \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 @@ -6394,7 +6161,6 @@ help from Bernd Raichle, for which I am grateful. \@ifpackageloaded{ifthen}{% % \end{macrocode} % Then we can redefine |\ifthenelse|: -% \changes{babel~3.6f}{1997/01/14}{\cs{ifthenelse} needs to be long} % \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} @@ -6415,21 +6181,17 @@ help from Bernd Raichle, for which I am grateful. % 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. -% \changes{babel~3.6i}{1997/02/25}{Now reset the @safe@actives switch -% inside the 2nd and 3rd arguments of \cs{ifthenelse}} -% \changes{babel~3.7f}{2000/06/29}{\cs{pageref} needs to have its -% babel definition reinstated in the second and third arguments} % \begin{macrocode} \@safe@activestrue - \org@ifthenelse{#1}{% - \let\pageref\bbl@temp@pref - \let\ref\bbl@temp@ref - \@safe@activesfalse - #2}{% - \let\pageref\bbl@temp@pref - \let\ref\bbl@temp@ref - \@safe@activesfalse - #3}% + \org@ifthenelse{#1}% + {\let\pageref\bbl@temp@pref + \let\ref\bbl@temp@ref + \@safe@activesfalse + #2}% + {\let\pageref\bbl@temp@pref + \let\ref\bbl@temp@ref + \@safe@activesfalse + #3}% }% }{}% } @@ -6439,12 +6201,7 @@ help from Bernd Raichle, for which I am grateful. % \subsubsection{\pkg{varioref}} % % \begin{macro}{\@@vpageref} -% \changes{babel~3.6a}{1996/10/29}{Redefinition of \cs{@@vpageref} -% added to circumvent problems with active \texttt{:} in the -% argument of \cs{vref} when \pkg{varioref} is used} % \begin{macro}{\vrefpagenum} -% \changes{babel~3.7o}{2003/11/18}{Added redefinition of -% \cs{vrefpagenum} which deals with ranges of pages} % \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 @@ -6535,12 +6292,9 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \AtBeginDocument{% - \@ifundefined{pdfstringdefDisableCommands}% - {}% - {\pdfstringdefDisableCommands{% - \languageshorthands{system}}% - }% -} + \ifx\pdfstringdefDisableCommands\@undefined\else + \pdfstringdefDisableCommands{\languageshorthands{system}}% + \fi} % \end{macrocode} % \end{macro} % @@ -6553,8 +6307,6 @@ 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. -% \changes{babel~3.7j}{2003/05/23}{Define \cs{FOREIGNLANGUAGE} -% unconditionally} % \begin{macrocode} \DeclareRobustCommand{\FOREIGNLANGUAGE}[1]{% \lowercase{\foreignlanguage{#1}}} @@ -6565,7 +6317,6 @@ help from Bernd Raichle, for which I am grateful. % 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. -% \changes{babel~3.7j}{2003/06/15}{create file with lowercase name} % \begin{macrocode} \def\substitutefontfamily#1#2#3{% \lowercase{\immediate\openout15=#1#2.fd\relax}% @@ -6592,7 +6343,7 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % -% \subsection{Encoding issues} +% \subsection{Encoding and fonts} % % Because documents may use non-ASCII font encodings, we make sure % that the logos of \TeX\ and \LaTeX\ always come out in the right @@ -6629,7 +6380,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@tempb#1\@@{\uppercase{\bbl@tempc#1}ENC.DEF\@empty\@@}% \def\bbl@tempc#1ENC.DEF#2\@@{% \ifx\@empty#2\else - \@ifundefined{T@#1}% + \bbl@ifunset{T@#1}% {}% {\@expandtwoargs\in@{,#1,}{,\BabelNonASCII,}% \ifin@ @@ -6654,8 +6405,6 @@ help from Bernd Raichle, for which I am grateful. % determine, at |\begin{document}|, which latin fontencoding to use. % % \begin{macro}{\latinencoding} -% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from -% \file{.ldf} files} % When text is being typeset in an encoding other than `latin' % (\texttt{OT1} or \texttt{T1}), it would be nice to still have % Roman numerals come out in the Latin encoding. @@ -6671,18 +6420,6 @@ 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.6k}{1999/03/15}{Use T1 encoding when it is a known -% encoding} -% \changes{babel~3.6m}{1999/04/06}{Can't use \cs{@ifpackageloaded} -% need to parse \cs{@filelist}} -% \changes{babel~3.6n}{1999/04/07}{moved checking for fontenc right to -% the top of \file{babel.sty}} -% \changes{babel~3.6n}{1999/04/07}{Added a check for `manual' selection -% of \texttt{T1} encoding, without loading \pkg{fontenc}} -% \changes{babel~3.6q}{1999/04/12}{Better solution than parsing -% \cs{@filelist}, use \cs{@ifl@aded}} -% \changes{babel~3.6u}{1999/04/20}{Moved this code to -% \file{babel.def}} % \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.} @@ -6692,9 +6429,11 @@ help from Bernd Raichle, for which I am grateful. \AtBeginDocument{% \@ifpackageloaded{fontspec}% {\xdef\latinencoding{% - \@ifundefined{UTFencname}% - {EU\ifcase\bbl@engine\or2\or1\fi}% - {\UTFencname}}}% + \ifx\UTFencname\@undefined + EU\ifcase\bbl@engine\or2\or1\fi + \else + \UTFencname + \fi}}% {\gdef\latinencoding{OT1}% \ifx\cf@encoding\bbl@t@one \xdef\latinencoding{\bbl@t@one}% @@ -6705,8 +6444,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\latintext} -% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from -% \file{.ldf} files} % Then we can define the command |\latintext| which is a % declarative switch to a latin font-encoding. Usage of this macro % is deprecated. @@ -6718,11 +6455,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\textlatin} -% \changes{babel~3.6i}{1997/03/15}{Macro added, moved from -% \file{.ldf} files} -% \changes{babel~3.7j}{2003/03/19}{added \cs{leavevmode} to prevent a -% paragraph starting \emph{inside} the group} -% \changes{babel~3.7k}{2003/10/12}{Use \cs{DeclareTextFontComand}} % 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. @@ -6745,7 +6477,6 @@ help from Bernd Raichle, for which I am grateful. % will be loaded when the language definition file \file{norsk.ldf} % is loaded. % -% \changes{babel~3.5d}{1995/06/22}{Added macro} % For plain-based formats we don't want to override the definition % of |\loadlocalcfg| from \file{plain.def}. % \begin{macrocode} @@ -7122,7 +6853,6 @@ 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. -% \changes{babel~3.2}{1991/11/11}{Added \cs{relax}} % \begin{macrocode} \def\bbl@version{<@version@>} \def\bbl@date{<@date@>} @@ -7136,7 +6866,7 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.9a}{2013/01/23}{New macro to normalize % a macro (eg, \cs{languagename}) to lowercase if necessary} % -% |\bbl@iflanguage| executes code only of the language +% |\bbl@iflanguage| executes code only if the language |l@| % exists. Otherwise raises and error. % % The argument of |\bbl@fixname| has to be a macro name, as it may get @@ -7145,7 +6875,8 @@ help from Bernd Raichle, for which I am grateful. % a |\MakeXXXcase|. However, a lowercase form is not imposed to % improve backward compatibility (perhaps you defined a language % named |MYLANG|, but unfortunately mixed case names cannot be -% trapped). +% trapped). Note |l@| is encapsulated, so that its case does not +% change. % \begin{macrocode} \def\bbl@fixname#1{% \begingroup @@ -7174,10 +6905,6 @@ 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. -% \changes{babel~3.2}{1991/11/11}{Rephrased \cs{ifnum} test} -% \changes{babel~3.7a}{1998/06/10}{Now evaluate the \cs{ifnum} test -% \emph{after} the \cs{fi} from the \cs{ifx} test and use -% \cs{@firstoftwo} and \cs{@secondoftwo}} % \begin{macrocode} \def\iflanguage#1{% \bbl@iflanguage{#1}{% @@ -7219,18 +6946,6 @@ help from Bernd Raichle, for which I am grateful. % If the user gives an empty argument, we provide a default % argument for |\string|. This argument should expand to nothing. % -% \changes{babel~3.0c}{1991/06/06}{Made \cs{selectlanguage} -% robust} -% \changes{babel~3.2}{1991/11/11}{Modified to allow arguments that -% start with an escape character} -% \changes{babel~3.2a}{1991/11/17}{Simplified the modification to -% allow the use in a \cs{write} command} -% \changes{babel~3.5b}{1995/05/13}{Store the name of the current -% language in a control sequence instead of passing the whole macro -% construct to strip the escape character in the argument of -% \cs{selectlanguage }.} -% \changes{babel~3.5f}{1995/11/16}{Moved check for escape character -% one level down in the expansion} % \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} @@ -7261,12 +6976,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % -% \changes{babel~3.5b}{1995/03/04}{Changed the name of the internal -% macro to \cs{selectlanguage }.} -% \changes{babel~3.5b}{1995/03/05}{Added an extra level of expansion to -% separate the switching mechanism from writing to aux files} -% \changes{babel~3.7f}{2000/09/25}{Use \cs{aftergroup} to keep the -% language grouping correct in auxiliary files {PR3091}} % Since version 3.5 \babel\ writes entries to the auxiliary files in % order to typeset table of contents etc. in the correct language % environment. @@ -7280,8 +6989,6 @@ help from Bernd Raichle, for which I am grateful. % executed at the end of the group. It calls |\bbl@set@language| % with the name of the current language as its argument. % -% \changes{babel~3.7j}{2003/03/18}{Introduce the language stack -% mechanism} % \begin{macro}{\bbl@language@stack} % The previous solution works for one level of nesting groups, but % as soon as more levels are used it is no longer adequate. For @@ -7334,7 +7041,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % \end{macro} % -% \changes{babel~3.7j}{2003/03/18}{Now use the language stack mechanism} % \begin{macrocode} \expandafter\def\csname selectlanguage \endcsname#1{% \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\tw@\fi @@ -7342,13 +7048,9 @@ help from Bernd Raichle, for which I am grateful. \aftergroup\bbl@pop@language \bbl@set@language{#1}} % \end{macrocode} -% \changes{babel~3.7m}{2003/11/12}{Removed the superfluous empty -% definition of \cs{bbl@pop@language}} % \end{macro} % % \begin{macro}{\bbl@set@language} -% \changes{babel~3.7f}{2000/09/25}{Macro \cs{bbl@set@language} -% introduced} % % The macro |\bbl@set@language| takes care of switching the % language environment \emph{and} of writing entries on the @@ -7363,8 +7065,6 @@ 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.5a}{1995/02/17}{Write the language change to 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}} @@ -7397,41 +7097,29 @@ help from Bernd Raichle, for which I am grateful. misspelled its name, it has not been installed,\\% or you requested it in a previous run. Fix its name,\\% install it or just rerun the file, respectively}% - {You may proceed, but expect unexpected results}% + {You may proceed, but expect wrong results}% \else \let\bbl@select@type\z@ \expandafter\bbl@switch\expandafter{\languagename}% \fi}} -% A bit of optimization: -\def\select@language@x#1{% - \ifcase\bbl@select@type - \bbl@ifsamestring\languagename{#1}{}{\select@language{#1}}% - \else - \select@language{#1}% - \fi} +% \end{macrocode} +% +% A bit of optimization. Select in heads/foots the language only if +% necessary. The real thing is in \texttt{babel.def}. +% +% \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.0a}{1991/05/29}{Added \cs{@bsphack} and -% \cs{@esphack}} -% \changes{babel~3.0d}{1991/08/08}{Removed superfluous -% \cs{expandafter}} -% \changes{babel~3.0d}{1991/10/07}{Removed space hacks and use of -% \cs{@ifundefined}} -% \changes{babel~3.2a}{1991/11/17}{Added \cs{relax} as first command -% to stop an expansion if \cs{protect} is empty} -% \changes{babel~3.6a}{1996/11/07}{Check for the existence of -% \cs{date...} instead of \cs{l@...}} -% \changes{babel~3.7m}{2003/11/16}{Check for the existence of both -% \cs{l@...} and \cs{date...}} % \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@swith} with code +% \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} @@ -7450,8 +7138,6 @@ 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.5b}{1995/05/13}{Separated the setting of the -% hyphenmin values}% % \changes{babel~3.9c}{2013/04/08}{Removed an extra empty line} % % The switching of the values of |\lefthyphenmin| and @@ -7459,24 +7145,11 @@ help from Bernd Raichle, for which I am grateful. % 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.5b}{1995/06/05}{Addedd default setting of hyphenmin -% parameters} % \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 % \textsc{languagename} so that it has the correct value in the aux % file (eg, shorthand expansion was wrong)} -% \changes{babel~3.0a}{1991/06/06}{Replaced \cs{gdef} with \cs{def}} -% \changes{babel~3.1}{1991/10/31}{\cs{originalTeX} should only be -% executed once} -% \changes{babel~3.2a}{1991/11/17}{Added three \cs{expandafter}s -% to save macro space for \cs{originalTeX}} -% \changes{babel~3.2a}{1991/11/20}{Moved definition of -% \cs{originalTeX} before \cs{extras\langvar}} -% \changes{babel~3.2a}{1991/11/24}{Set \cs{originalTeX} to -% \cs{empty}, because it should be expandable.} -% \changes{babel~3.6d}{1997/01/07}{set the language shorthands to -% `none' before switching on the extras} % \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.9h}{2013/11/29}{Use \cs{def} instead of @@ -7492,8 +7165,8 @@ help from Bernd Raichle, for which I am grateful. \bbl@usehooks{afterreset}{}% \languageshorthands{none}% \ifcase\bbl@select@type - \csname captions#1\endcsname - \csname date#1\endcsname + \csname captions#1\endcsname\relax + \csname date#1\endcsname\relax \fi \bbl@usehooks{beforeextras}{}% \csname extras#1\endcsname\relax @@ -7520,18 +7193,6 @@ help from Bernd Raichle, for which I am grateful. \csname #1hyphenmins\endcsname\relax \fi} % \end{macrocode} -% \begin{macrocode} -\def\bbl@ifsamestring#1#2{% - \protected@edef\bbl@tempb{#1}% - \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}% - \protected@edef\bbl@tempc{#2}% - \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}% - \ifx\bbl@tempb\bbl@tempc - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} -% \end{macrocode} % % \begin{environment}{otherlanguage} % The \Lenv{otherlanguage} environment can be used as an @@ -7545,10 +7206,6 @@ 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.5d}{1995/06/22}{environment added} -% \changes{babel~3.5e}{1995/07/07}{changed name} -% \changes{babel~3.7j}{2003/03/18}{rely on \cs{selectlanguage } to -% keep track of the nesting} % \changes{babel~3.9a}{2012/07/31}{Removed \cs{originalTeX}} % \begin{macrocode} \long\def\otherlanguage#1{% @@ -7569,8 +7226,6 @@ 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|. -% \changes{babel~3.5f}{1996/05/29}{environment added} -% \changes{babel~3.6d}{1997/01/07}{Introduced \cs{foreign@language}} % \begin{macrocode} \expandafter\def\csname otherlanguage*\endcsname#1{% \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi @@ -7596,9 +7251,6 @@ 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.5d}{1995/06/22}{Macro added} -% \changes{babel~3.6d}{1997/01/07}{Introduced \cs{foreign@language}} -% \changes{babel~3.7a}{1998/03/12}{Added executing \cs{originalTeX}} % \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 @@ -7619,7 +7271,7 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\foreign@language} -% \changes{babel~3.6d}{1997/01/07}{New macro} This macro does the +% This macro does the % work for |\foreignlanguage| and the \Lenv{otherlanguage*} % environment. First we need to store the name of the language and % check that it is a known language. Then it just calls @@ -7633,8 +7285,11 @@ help from Bernd Raichle, for which I am grateful. \bbl@iflanguage\languagename{% \expandafter\ifx\csname date\languagename\endcsname\relax \bbl@warning - {You haven't loaded the language \languagename\space yet\\% - I'll proceed, but expect unexpected results.\\% + {Unknown language `#1'. Either you have\\% + misspelled its name, it has not been installed,\\% + or you requested it in a previous run. Fix its name,\\% + install it or just rerun the file, respectively.\\% + I'll proceed, but expect wrong results.\\% Reported}% \fi \let\bbl@select@type\@ne @@ -7674,9 +7329,9 @@ help from Bernd Raichle, for which I am grateful. \else \csname l@#1:\f@encoding\endcsname \edef\bbl@tempa{#1:\f@encoding}% - \fi\relax + \fi \@expandtwoargs\bbl@usehooks{patterns}{{#1}{\bbl@tempa}}% - \@ifundefined{bbl@hyphenation@}{}{% + \@ifundefined{bbl@hyphenation@}{}{% Can be \relax! \begingroup \@expandtwoargs\in@{,\number\language,}{,\bbl@hyphlist}% \ifin@\else @@ -7693,7 +7348,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{environment}{hyphenrules} -% \changes{babel~3.7e}{2000/01/28}{Added environment hyphenrules} % The environment \Lenv{hyphenrules} can be used to select % \emph{just} the hyphenation rules. This environment does % \emph{not} change |\languagename| and when the hyphenation rules @@ -7721,7 +7375,6 @@ help from Bernd Raichle, for which I am grateful. % \end{environment} % % \begin{macro}{\providehyphenmins} -% \changes{babel~3.7f}{2000/02/18}{added macro} % The macro |\providehyphenmins| should be used in the language % definition files to provide a \emph{default} setting for the % hyphenation parameters |\lefthyphenmin| and |\righthyphenmin|. If @@ -7744,9 +7397,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\ProvidesLanguage} -% \changes{babel~3.7a}{1997/03/18}{Added macro to prevent problems -% with unexpected \cs{ProvidesFile} in plain formats because of -% \babel.} % The identification code for each file is something that was % introduced in \LaTeXe. When the command |\ProvidesFile| does not % exist, a dummy definition is provided temporarily. For use in the @@ -7755,14 +7405,6 @@ 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.4e}{1994/06/24}{Redid the identification code, -% provided dummy definition of \cs{ProvidesFile} for plain \TeX} -% \changes{babel~3.5f}{1995/07/26}{Store version in -% \cs{fileversion}} \changes{babel~3.5f}{1995/12/18}{Need to -% temporarily change the definition of \cs{ProvidesFile} for -% December 1995 release} \changes{babel~3.5g}{1996/07/09}{Save a -% few csnames; use \cs{bbl@tempa} instead of \cs{\@ProvidesFile} -% and store message in \cs{toks8}} % \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} @@ -7787,7 +7429,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\LdfInit} -% \changes{babel~3.6a}{1996/10/16}{Macro added} % This macro is defined in two versions. The first version is to be % part of the `kernel' of \babel, ie. the part that is loaded in % the format; the second version is defined in \file{babel.def}. @@ -7811,8 +7452,6 @@ help from Bernd Raichle, for which I am grateful. % 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|. -% \changes{babel~3.2a}{1991/11/24}{Set \cs{originalTeX} to -% \cs{empty}, because it should be expandable.} % \begin{macrocode} \ifx\originalTeX\@undefined\let\originalTeX\@empty\fi % \end{macrocode} @@ -7824,13 +7463,26 @@ help from Bernd Raichle, for which I am grateful. % \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} +% \begin{macrocode} +\newcommand\setlocale{% + \bbl@error + {Not yet available}% + {Find an armchair, sit down and wait}} +\let\uselocale\setlocale +\let\locale\setlocale +\let\selectlocale\setlocale +\let\textlocale\setlocale +\let\textlanguage\setlocale +\let\languagetext\setlocale +% \end{macrocode} +% % \subsection{Errors} % % \begin{macro}{\@nolanerr} -% \changes{babel~3.4e}{1994/06/25}{Use \cs{PackageError} in \LaTeXe\ -% mode} % \begin{macro}{\@nopatterns} -% \changes{babel~3.4e}{1994/06/25}{Macro added} % The \babel\ package will signal an error when a documents tries % to select a language that hasn't been defined earlier. When a % user selects a language for which no hyphenation patterns were @@ -7839,18 +7491,12 @@ help from Bernd Raichle, for which I am grateful. % In most formats that will be (US)english, but it might also be % empty. % \begin{macro}{\@noopterr} -% \changes{babel~3.7m}{2003/11/16}{Macro added} % When the package was loaded without options not everything will % work as expected. An error message is issued in that case. % % 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.0d}{1991/10/07}{Added a percent sign to remove -% unwanted white space} -% \changes{babel~3.5a}{1995/02/15}{Added \cs{@activated} to log active -% characters} -% \changes{babel~3.5c}{1995/06/19}{Added missing closing brace} % \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 @@ -7926,10 +7572,6 @@ 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} -% \changes{bbplain-1.0c}{1995/11/08}{Moved the \cs{dump} code here from -% \file{babel.dtx}} -% \changes{bbplain-0.1}{1991/10/31}{Added redefinition of \cs{dump} to -% add a message to \cs{everyjob}} % We want to add a message to the message \LaTeX$\:$2.09 puts in % the |\everyjob| register. This could be done by the following % code: @@ -7966,19 +7608,10 @@ help from Bernd Raichle, for which I am grateful. % but as this done too often already, we add the new code at the % front of |\@preamblecmds|. But we can only do that after it has % been defined, so we add this piece of code to |\dump|. -% \changes{bbplain-1.0c}{1995/11/19}{Add execution of -% \cs{@begindocumenthook} to \cs{@preamblecmds}} -% \changes{bbplain-1.0i}{1997/01/02}{\cs{document} is not a -% \LaTeX2.09-only command; AMS\TeX defines it too; now use -% \cs{@ztryfc} to detect \LaTeX2.09} -% \changes{bbplain-1.0j}{1997/01/07}{Add the definition of -% \cs{@begindocumenthook} to the \LaTeX2.09 format} % % This new definition starts by adding an instruction to write a % message on the terminal and in the transcript file to inform the % user of the preloaded hyphenation patterns. -% \changes{bbplain-1.0f}{1996/07/09}{Use \cs{toks8} instead of -% \cs{patterns@loaded}} % % Then everything is restored to the old situation and the format % is dumped. @@ -8004,19 +7637,14 @@ help from Bernd Raichle, for which I am grateful. \toks8{Babel <<@version@>> and hyphenation patterns for }% % \end{macrocode} % -% \changes{babel~3.5g}{1996/07/09}{Removed the use of -% \cs{patterns@loaded} altogether} % % \begin{macro}{\process@line} -% \changes{babel~3.5b}{1995/04/28}{added macro} % Each line in the file \file{language.dat} is processed by % |\process@line| after it is read. The first thing this macro does % is to check whether the line starts with \texttt{=}. % 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.5g}{1996/07/09}{Simplified code, removing -% \cs{bbl@eq@}} % \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} @@ -8031,10 +7659,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % \begin{macro}{\process@synonym} -% \changes{babel~3.5b}{1995/04/28}{added macro} -% \changes{babel~3.7c}{1999/04/27}{Use a token register to temporarily -% store a command to set hyphenmin parameters for the synonym which -% is defined \emph{before} the first pattern file is processed} % % This macro takes care of the lines which start with an % \texttt{=}. It needs an empty token register to begin with. @@ -8052,8 +7676,6 @@ 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.7c}{1999/04/22}{Now also store hyphenmin parameters -% for language synonyms} % \changes{babel~3.9a}{2012/06/25}{Added \cs{bbl@languages}} % \begin{macrocode} \def\process@synonym#1{% @@ -8080,18 +7702,9 @@ help from Bernd Raichle, for which I am grateful. % % The first thing to do is call |\addlanguage| to allocate a % pattern register and to make that register `active'. -% \changes{babel~3.0d}{1991/08/08}{Removed superfluous -% \cs{expandafter}} -% \changes{babel~3.0d}{1991/08/21}{Reinserted \cs{expandafter}} -% \changes{babel~3.0d}{1991/10/27}{Added the collection of pattern -% names.} -% \changes{babel~3.7c}{1999/04/22}{Also store \cs{languagename} for -% possible later use in \cs{process@synonym}} % 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.7f}{2000/02/18}{Allow for the encoding to be used -% as part of the language name} % \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)} @@ -8105,16 +7718,6 @@ help from Bernd Raichle, for which I am grateful. % you need to set a behaviour depending on the given encoding (it % is set to empty if no encoding is given). % -% \changes{babel~3.4e}{1994/06/24}{Added code to detect assignments to -% left- and righthyphenmin in the patternfile.} -% \changes{babel~3.7a}{1998/03/27}{Read pattern files in a group} -% \changes{babel~3.7c}{1999/04/05}{need to set hyphenmin values -% globally} -% \changes{babel~3.7c}{1999/04/22}{Set \cs{lefthyphenmin} to \cs{m@ne} -% \emph{inside} the group; explicitly set the hyphenmin parameters -% for language 0} -% \changes{babel~3.7c}{1999/04/25}{Only set hyphenmin values when the -% pattern file changed them} % Pattern files may contain assignments to |\lefthyphenmin| and % |\righthyphenmin|. \TeX\ does not keep track of these % assignments. Therefore we try to detect such assignments and @@ -8134,10 +7737,6 @@ help from Bernd Raichle, for which I am grateful. % the case when the third argument is not empty and when it does % not contain a space token. (Note however there is no need to save % hyphenation exceptions into the format.) -% \changes{babel~3.5b}{1995/04/28}{Added optional reading of file with -% hyphenation exceptions} -% \changes{babel~3.5f}{1995/07/25}{Use \cs{empty} instead of -% \cs{@empty} as the latter is unknown in plain} % % \changes{babel~3.9a}{2012/06/25}{Added \cs{bbl@languages}} % \changes{babel~3.9f}{2013/05/16}{Restored code to set default @@ -8148,8 +7747,6 @@ help from Bernd Raichle, for which I am grateful. % arguments are empty in `dialects' defined in |language.dat| with % |=|. Note also the language name can have encoding info. % -% \changes{babel~3.7c}{1999/04/27}{Added the execution of the contents -% of \cs{toks@}} % Finally, if the counter |\language| is equal to zero we execute the % synonyms stored. % \begin{macrocode} @@ -8188,7 +7785,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % % \begin{macro}{\bbl@get@enc} -% \changes{babel~3.7f}{2000/02/18}{Added macro} % \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 @@ -8261,7 +7857,6 @@ help from Bernd Raichle, for which I am grateful. % first patterns loaded in pattern register number~0 we initialize % |\last@language| with the value~$-1$. % -% \changes{babel~3.1}{1991/05/21}{Removed use of \cs{toks0}} % \begin{macrocode} \last@language\m@ne % \end{macrocode} @@ -8316,20 +7911,13 @@ help from Bernd Raichle, for which I am grateful. \fi % \end{macrocode} % and close the configuration file. -% \changes{babel~3.2a}{1991/11/20}{Free macro space for -% \cs{process@language}} % \begin{macrocode} \closein1 % \end{macrocode} % -% \changes{babel~3.5f}{1995/11/08}{Moved the fiddling with \cs{dump} -% to \file{bbplain.dtx} as it is no longer needed for \LaTeX} % 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.6h}{1997/01/23}{Added a couple of \cs{expandafter}s -% to copy the contents of \cs{toks8} into \cs{everyjob} instead of -% the reference} % \changes{babel~3.9a}{2012/09/25}{The list of languages is not % printed every job any more (it is saved in \cs{bbl@languages}).} % \changes{babel~3.9g}{2013/07/28}{In non-LaTeX formats the number of @@ -8431,8 +8019,6 @@ help from Bernd Raichle, for which I am grateful. %</nil> % \end{macrocode} % -% \changes{bbplain-1.0n}{1998/06/08}{Added the source for the format -% wrapper files} % % \section{Support for Plain \TeX} % @@ -8529,22 +8115,6 @@ help from Bernd Raichle, for which I am grateful. % The following code duplicates or emulates parts of \LaTeXe\ that % are needed for \babel. % -% \changes{bbplain-1.0f}{1996/07/09}{Consistently use \cs{@undefined} -% instead of \cs{undefined}} -% \changes{bbplain-1.0f}{1996/07/09}{added \cs{@empty}} -% \changes{bbplain-1.0h}{1996/10/07}{Only load the necessary parts -% into the format, let this file be read agian by babel.def} -% \changes{bbplain-1.0h}{2012/12/21}{Use \cs{orig@dump} as flag to -% decide if we are building the format, defined in hyphen.cfg} -% -% We need to define |\loadlocalcfg| for plain users as the -% \LaTeX\ definition uses |\InputIfFileExists|. We have to execute -% \cs{@endofldf} in this case. -% \changes{bbplain-1.0c}{1995/07/26}{Added definition of -% \cs{loadlocalcfg}} -% \changes{bbplain-1.0d}{1996/01/08}{Also reset category codes after -% loading the configuration file as \cs{AtEndOfPackage} is -% undefined in this case} % \changes{bbplain-1.0s}{2012/12/21}{\cs{loadlocalcfg} not loaded in % the format} % \begin{macrocode} @@ -8568,8 +8138,6 @@ 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.0n}{1998/06/10}{Added \cs{@secondoftwo}} -% \changes{bbplain-1.0q}{1999/09/16}{Added \cs{@ifundefined}} % \changes{bbplain-1.0t}{2013/04/10}{Added \cs{@expandtwoargs}} % \changes{babel~3.9h}{2013/12/02}{Added \cs{zap@space}} % \changes{babel~3.9k}{2014/03/22}{Added \cs{@nnil}} @@ -8635,9 +8203,6 @@ help from Bernd Raichle, for which I am grateful. \global\let\do\noexpand} % \end{macrocode} % -% \changes{bbplain-1.0j}{1997/01/07}{\cs{@begindocumenthook} might -% already be defined} -% \changes{bbplain-1.0k}{1997/01/14}{missing \cs{@undefined} added} % \begin{macrocode} \ifx\@begindocumenthook\@undefined \def\@begindocumenthook{} @@ -8660,10 +8225,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \LaTeX\ needs to be able to switch off writing to its auxiliary % files; plain doesn't have them by default. -% \changes{bbplain-1.0m}{1997/04/28}{Set \cs{if@filesw} to -% \cs{iffalse} only for plain \TeX} -% \changes{bbplain-1.0n}{1997/09/11}{Repaired typo and added missing -% \cs{endcsname}} % \begin{macrocode} \ifx\if@filesw\@undefined \expandafter\let\csname if@filesw\expandafter\endcsname @@ -8671,8 +8232,6 @@ help from Bernd Raichle, for which I am grateful. \fi % \end{macrocode} % Mimick \LaTeX's commands to define control sequences. -% \changes{bbplain-1.0e}{1996/02/22}{Provide a more complete emulation -% of \cs{DeclareRobustCommand} and \cs{newcommand}} % \begin{macrocode} \def\newcommand{\@star@or@long\new@command} \def\new@command#1{% @@ -8724,11 +8283,9 @@ help from Bernd Raichle, for which I am grateful. \noexpand#1% \fi \noexpand\protect - \expandafter\noexpand\csname - \expandafter\@gobble\string#1 \endcsname + \expandafter\noexpand\csname\bbl@stripslash#1 \endcsname }% - \expandafter\new@command\csname - \expandafter\@gobble\string#1 \endcsname + \expandafter\new@command\csname\bbl@stripslash#1 \endcsname } \def\x@protect#1{% \ifx\protect\@typeset@protect\else @@ -8745,7 +8302,6 @@ 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.0o}{1998/07/02}{Added definition of \cs{in@}} % \changes{bbplain-1.0s}{2013/01/15}{Use \cs{bbl@tempa} as % documented} % \begin{macrocode} @@ -8773,25 +8329,21 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\@ifpackagewith#1#2#3#4{#3} % \end{macrocode} +% % The \LaTeX\ macro |\@ifl@aded| checks whether a file was % loaded. This functionality is not needed for plain \TeX\ but we % need the macro to be defined as a no-op. -% \changes{bbplain-1.0p}{1999/04/27}{Added \cs{@ifl@aded} as a no-op} +% % \begin{macrocode} \def\@ifl@aded#1#2#3#4{} % \end{macrocode} % -% \changes{bbplain-1.0e}{1996/01/15}{Added the \cs{newcommand} code} % For the following code we need to make sure that the commands % |\newcommand| and |\providecommand| exist with some sensible % definition. They are not fully equivalent to their \LaTeXe\ % versions; just enough to make things work in plain~\TeX % environments. % -% \changes{bbplain-1.0k}{1997/01/14}{\cs{newcount} is an \cs{outer} -% command, can't use it inside an \cs{if} construct} -% \changes{bbplain-1.0l}{1997/01/19}{Mixed up the definition of -% \cs{@tempcntb}} % \begin{macrocode} \ifx\@tempcnta\@undefined \csname newcount\endcsname\@tempcnta\relax @@ -8994,11 +8546,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % The following control sequences are used in \file{babel.def} % but are not defined for \textsc{plain} \TeX. -% \changes{bbplain-1.0f}{1996/07/10}{Added \cs{textquotedblright} and -% \cs{textquoteright}} -% \changes{bbplain-1.0g}{1996/08/15}{Added \cs{ss} and \cs{i}} -% \changes{bbplain-1.0r}{2000/10/02}{Added \cs{textquotedblleft} and -% \cs{textquoteleft}} % \begin{macrocode} \DeclareTextSymbol{\textquotedblleft}{OT1}{92} \DeclareTextSymbol{\textquotedblright}{OT1}{`\"} @@ -9011,8 +8558,6 @@ help from Bernd Raichle, for which I am grateful. % |\scriptsize| to be available. Because plain \TeX\ doesn't have % such a sofisticated font mechanism as \LaTeX\ has, we just |\let| % it to |\sevenrm|. -% \changes{bbplain-1.0f}{1996/07/10}{Added definition of -% \cs{scriptsize}} % \begin{macrocode} \ifx\scriptsize\@undefined \let\scriptsize\sevenrm diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx index bd2392526fc..507a2fa5219 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}[2016/04/23 v3.9r] +\ProvidesFile{bbcompat.dtx}[2017/04/28 v3.9t] %</dtx> % %% File 'bbcompat.dtx' diff --git a/Master/texmf-dist/source/latex/babel/bbunicode.dtx b/Master/texmf-dist/source/latex/babel/bbunicode.dtx index edc6b714c46..7c369343994 100644 --- a/Master/texmf-dist/source/latex/babel/bbunicode.dtx +++ b/Master/texmf-dist/source/latex/babel/bbunicode.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 2013-2016 Javier Bezos and any individual authors +% Copyright 2013-2017 Javier Bezos and any individual authors % listed elsewhere in this file. All rights reserved. % % This file is part of the Babel system. @@ -31,12 +31,12 @@ % \iffalse %<*dtx> \ProvidesFile{bbunicode.dtx} - [2016/04/23 v3.9r Babel hooks for Unicode engines] + [2017/04/28 v3.9t Babel hooks for Unicode engines] %</dtx> % %% File `bbunicode.dtx' %% Babel package for LaTeX version 2e -%% Copyright (C) 2103-2016 +%% Copyright (C) 2103-2017 %% by Javier Bezos % %<*filedriver> |