summaryrefslogtreecommitdiff
path: root/macros/latex/required/babel/base/babel.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/required/babel/base/babel.dtx')
-rw-r--r--macros/latex/required/babel/base/babel.dtx129
1 files changed, 77 insertions, 52 deletions
diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx
index 76a7168fb2..937d698789 100644
--- a/macros/latex/required/babel/base/babel.dtx
+++ b/macros/latex/required/babel/base/babel.dtx
@@ -32,7 +32,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2023/03/28 v3.87 The Babel package]
+\ProvidesFile{babel.dtx}[2023/04/18 v3.88 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -2579,7 +2579,7 @@ languages.
Polytonic Greek with but with some sections in Italian. Then, the
first attempt should be:
\begin{verbatim}
-\usepackage[italian, greek.polutonico]{babel}
+\usepackage[italian, greek.polutoniko]{babel}
\end{verbatim}
But if, say, accents in Greek are not shown correctly, you can try
\begin{verbatim}
@@ -2791,7 +2791,7 @@ which is not recommended).
\end{note}
\Describe{\localenumeral}{\marg{style}\marg{number}}
-\DescribeOther{\localecounterl}{\marg{style}\marg{counter}}
+\DescribeOther{\localecounter}{\marg{style}\marg{counter}}
\New{3.41} Many `ini` locale files has been extended with information
about non-positional numerical systems, based on those predefined in
@@ -2991,7 +2991,7 @@ expandable, and the available fields are:
extension whose singleton is \m{s} (currently the recognized
singletons are |x|, |t| and |u|). The internal syntax can be somewhat
complex, and this feature is still somewhat tentative. An example is
- \textsf{classiclatin} which sets |extension.x.tag.bcp47| to classic.
+ \textsf{classiclatin} which sets |extension.x.tag.bcp47| to |classic|.
\New{3.75}
\end{description}
@@ -4036,6 +4036,11 @@ three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given:
\item[afterreset] \New{3.9i} Executed when selecting a language just after
|\originalTeX| is run and reset to its base value, before executing
|\captions|\m{language} and |\date|\m{language}.
+\item[begindocument] \New{3.88} Executed before the code written by
+ |ldf| files with |\AtBeginDocument|. The optional argument with the
+ language in this particular case is the language that wrote the code.
+ The special value |/| means ‘return to the core \babel{} definitions’
+ (in other words, what follows hasn’t been written by any language).
% STILL UNDER STUDY:
% \item[beforestart] \New{3.34} Executed either at the beginning of the
% |aux| file (when read at the start of the document), or else at begin
@@ -5295,8 +5300,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.87>>
-%<<date=2023/03/28>>
+%<<version=3.88>>
+%<<date=2023/04/18>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -7222,16 +7227,17 @@ help from Bernd Raichle, for which I am grateful.
\bbl@csarg\newcommand{ev@#2@#3@#1}[\bbl@tempb]}
\newcommand\EnableBabelHook[1]{\bbl@csarg\let{hk@#1}\@firstofone}
\newcommand\DisableBabelHook[1]{\bbl@csarg\let{hk@#1}\@gobble}
-\def\bbl@usehooks#1#2{%
- \ifx\UseHook\@undefined\else\UseHook{babel/*/#1}\fi
+\def\bbl@usehooks{\bbl@usehooks@lang\languagename}
+\def\bbl@usehooks@lang#1#2#3{%
+ \ifx\UseHook\@undefined\else\UseHook{babel/*/#2}\fi
\def\bbl@elth##1{%
- \bbl@cs{hk@##1}{\bbl@cs{ev@##1@#1@}#2}}%
- \bbl@cs{ev@#1@}%
+ \bbl@cs{hk@##1}{\bbl@cs{ev@##1@#2@}#3}}%
+ \bbl@cs{ev@#2@}%
\ifx\languagename\@undefined\else % Test required for Plain (?)
- \ifx\UseHook\@undefined\else\UseHook{babel/\languagename/#1}\fi
+ \ifx\UseHook\@undefined\else\UseHook{babel/#1/#2}\fi
\def\bbl@elth##1{%
- \bbl@cs{hk@##1}{\bbl@cl{ev@##1@#1}#2}}%
- \bbl@cl{ev@#1}%
+ \bbl@cs{hk@##1}{\bbl@cs{ev@##1@#2@#1}#3}}%
+ \bbl@cs{ev@#2@#1}%
\fi}
% \end{macrocode}
%
@@ -7247,7 +7253,7 @@ help from Bernd Raichle, for which I am grateful.
adddialect=2,patterns=2,defaultcommands=0,encodedcommands=2,write=0,%
beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,%
hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,%
- beforestart=0,languagename=2}
+ beforestart=0,languagename=2,begindocument=1}
\ifx\NewHook\@undefined\else
\def\bbl@tempa#1=#2\@@{\NewHook{babel/#1}}
\bbl@foreach\bbl@evargs{\bbl@tempa#1\@@}
@@ -7499,8 +7505,10 @@ help from Bernd Raichle, for which I am grateful.
\renewcommand\selectlanguage[1]{}%
\renewcommand\foreignlanguage[2]{#2}%
\global\let\babel@aux\@gobbletwo % Also as flag
- \fi
- \ifcase\bbl@engine\or\pagedir\bodydir\fi} % TODO - a better place
+ \fi}
+\ifcase\bbl@engine\or
+ \AtBeginDocument{\pagedir\bodydir} % TODO - a better place
+\fi
% \end{macrocode}
%
% \end{macro}
@@ -8498,8 +8506,7 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@clear@ttribs{%
\ifx\bbl@attributes\@undefined\else
\bbl@loopx\bbl@tempa{\bbl@attributes}{%
- \expandafter\bbl@clear@ttrib\bbl@tempa.
- }%
+ \expandafter\bbl@clear@ttrib\bbl@tempa.}%
\let\bbl@attributes\@undefined
\fi}
\def\bbl@clear@ttrib#1-#2.{%
@@ -9822,7 +9829,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@vforeach{captions,date,import,main,script,language,%
hyphenrules,linebreaking,justification,mapfont,maparabic,%
mapdigits,intraspace,intrapenalty,onchar,transforms,alph,%
- Alph,labels,labels*,calendar,date}%
+ Alph,labels,labels*,calendar,date,casing}%
{\bbl@csarg\let{KVP@##1}\@nnil}%
\global\let\bbl@release@transforms\@empty
\let\bbl@calendars\@empty
@@ -9830,8 +9837,8 @@ help from Bernd Raichle, for which I am grateful.
\global\let\bbl@extend@ini\@gobble
\gdef\bbl@key@list{;}%
\bbl@forkv{#1}{%
- \in@{/}{##1}%
- \ifin@
+ \in@{/}{##1}% With /, (re)sets a value in the ini
+ \ifin@
\global\let\bbl@extend@ini\bbl@extend@ini@aux
\bbl@renewinikey##1\@@{##2}%
\else
@@ -10126,6 +10133,10 @@ help from Bernd Raichle, for which I am grateful.
\\\babel@save\\\@Alph
\let\\\@Alph\<bbl@cntr@\bbl@KVP@Alph @\languagename>}}%
\fi
+ % == Casing ==
+ \bbl@exp{\def\<bbl@casing@\languagename>%
+ {\<bbl@lbcp@\languagename>%
+ \ifx\bbl@KVP@casing\@nnil\else-x-\bbl@KVP@casing\fi}}%
% == Calendars ==
\ifx\bbl@KVP@calendar\@nnil
\edef\bbl@KVP@calendar{\bbl@cl{calpr}}%
@@ -10307,7 +10318,8 @@ help from Bernd Raichle, for which I am grateful.
\fi}%
\ifnum\@tempcnta=\m@ne
\bbl@warning{%
- Requested 'hyphenrules=' for '\languagename' not found.\\%
+ Requested 'hyphenrules' for '\languagename' not found:\\%
+ \bbl@KVP@hyphenrules.\\%
Using the default value. Reported}%
\fi
\fi
@@ -10434,7 +10446,7 @@ help from Bernd Raichle, for which I am grateful.
\ifx\bbl@required@inis\@empty\else
\bbl@replace\bbl@required@inis{ }{,}%
\bbl@foreach\bbl@required@inis{%
- \openin\bbl@readstream=##1.ini
+ \openin\bbl@readstream=babel-##1.ini
\bbl@loop@ini}%
\fi
% == Process stored data ==
@@ -10460,10 +10472,6 @@ help from Bernd Raichle, for which I am grateful.
{\bbl@ini@calendar{##1}}%
{}%
\fi
- \in@{=identification/extension.}{=##1/##2}%
- \ifin@
- \bbl@ini@extension{##2}%
- \fi
\bbl@ifunset{bbl@inikv@##1}{}%
{\csname bbl@inikv@##1\endcsname{##2}{##3}}}%
\bbl@inidata}
@@ -10567,6 +10575,11 @@ help from Bernd Raichle, for which I am grateful.
% is called always (via |\bbl@inisec|), while |\bbl@after@ini| must be
% called explicitly after |\bbl@read@ini| if necessary.
%
+% Although BCP 47 doesn’t treat ‘-x-’ as an extension, the CLDR and
+% many other sources do (as a \textit{private use extension}). For
+% consistency with other single-letter subtags or ‘singletons’, here
+% is considered an extension, too.
+%
% \begin{macrocode}
\def\bbl@iniwarning#1{%
\bbl@ifunset{bbl@@kv@identification.warning#1}{}%
@@ -10576,25 +10589,6 @@ help from Bernd Raichle, for which I am grateful.
Reported }}}
%
\let\bbl@release@transforms\@empty
-% \end{macrocode}
-%
-% BCP 47 extensions are separated by a single letter (eg,
-% |latin-x-medieval|. The following macro handles this special case to
-% create correctly the correspondig info.
-%
-% \begin{macrocode}
-\def\bbl@ini@extension#1{%
- \def\bbl@tempa{#1}%
- \bbl@replace\bbl@tempa{extension.}{}%
- \bbl@replace\bbl@tempa{.tag.bcp47}{}%
- \bbl@ifunset{bbl@info@#1}%
- {\bbl@csarg\xdef{info@#1}{ext/\bbl@tempa}%
- \bbl@exp{%
- \\\g@addto@macro\\\bbl@moreinfo{%
- \\\bbl@exportkey{ext/\bbl@tempa}{identification.#1}{}}}}%
- {}}
-\let\bbl@moreinfo\@empty
-%
\def\bbl@ini@exports#1{%
% Identification always exported
\bbl@iniwarning{}%
@@ -10611,6 +10605,8 @@ help from Bernd Raichle, for which I am grateful.
{\csname bbl@elname@\languagename\endcsname}}%
\bbl@exportkey{tbcp}{identification.tag.bcp47}{}%
\bbl@exportkey{lbcp}{identification.language.tag.bcp47}{}%
+ % Somewhat hackish. TODO
+ \bbl@exportkey{casing}{identification.language.tag.bcp47}{}%
\bbl@exportkey{lotf}{identification.tag.opentype}{dflt}%
\bbl@exportkey{esname}{identification.script.name}{}%
\bbl@exp{\\\bbl@exportkey{sname}{identification.script.name.opentype}%
@@ -10619,7 +10615,9 @@ help from Bernd Raichle, for which I am grateful.
\bbl@exportkey{sotf}{identification.script.tag.opentype}{DFLT}%
\bbl@exportkey{rbcp}{identification.region.tag.bcp47}{}%
\bbl@exportkey{vbcp}{identification.variant.tag.bcp47}{}%
- \bbl@moreinfo
+ \bbl@exportkey{extt}{identification.extension.t.tag.bcp47}{}%
+ \bbl@exportkey{extu}{identification.extension.u.tag.bcp47}{}%
+ \bbl@exportkey{extx}{identification.extension.x.tag.bcp47}{}%
% Also maps bcp47 -> languagename
\ifbbl@bcptoname
\bbl@csarg\xdef{bcp@map@\bbl@cl{tbcp}}{\languagename}%
@@ -11251,9 +11249,29 @@ help from Bernd Raichle, for which I am grateful.
\@namedef{bbl@info@script.tag.opentype}{sotf}
\@namedef{bbl@info@region.tag.bcp47}{rbcp}
\@namedef{bbl@info@variant.tag.bcp47}{vbcp}
-% Extensions are dealt with in a special way
-% Now, an internal \LaTeX{} macro:
-\providecommand\BCPdata[1]{\localeinfo*{#1.tag.bcp47}}
+\@namedef{bbl@info@extension.t.tag.bcp47}{extt}
+\@namedef{bbl@info@extension.u.tag.bcp47}{extu}
+\@namedef{bbl@info@extension.x.tag.bcp47}{extx}
+% \end{macrocode}
+%
+% \LaTeX{} needs to know the BCP 47 codes for some features. For that,
+% it expects |\BCPdata| to be defined. While |language|, |region|,
+% |script|, and |variant| are recognized, |extension.|\m{s} for
+% singletons may change.
+%
+% \begin{macrocode}
+\providecommand\BCPdata{}
+\ifx\renewcommand\@undefined\else % For plain. TODO. It’s a quick fix
+ \renewcommand\BCPdata[1]{%
+ \bbl@ifunset{bbl@info@#1.tag.bcp47}%
+ {\bbl@error{Unknown field '#1' in \string\BCPdata.\\%
+ Perhaps you misspelled it.}%
+ {See the manual for details.}}%
+ {\bbl@ifunset{bbl@\csname bbl@info@#1.tag.bcp47\endcsname @\languagename}{}%
+ {\bbl@cs{\csname bbl@info@#1.tag.bcp47\endcsname @\languagename}}}}
+\fi
+% Still somewhat hackish:
+\@namedef{bbl@info@casing.tag.bcp47}{casing}
% \end{macrocode}
%
% With version 3.75 |\BabelEnsureInfo| is executed always, but there is
@@ -11271,6 +11289,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@ifunset{bbl@lname@##1}{\bbl@load@info{##1}}{}}%
\fi
\bbl@foreach\bbl@loaded{{%
+ \let\bbl@ensuring\@empty % Flag used in a couple of babel-*.tex files
\def\languagename{##1}%
\bbl@ensureinfo{##1}}}}
\@ifpackagewith{babel}{ensureinfo=off}{}%
@@ -12386,7 +12405,9 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\let\expandafter\bbl@afterlang
\csname\CurrentOption.ldf-h@@k\endcsname
\expandafter\let\expandafter\BabelModifiers
- \csname bbl@mod@\CurrentOption\endcsname}%
+ \csname bbl@mod@\CurrentOption\endcsname
+ \bbl@exp{\\\AtBeginDocument{%
+ \\\bbl@usehooks@lang{\CurrentOption}{begindocument}{{\CurrentOption}}}}}%
{\bbl@error{%
Unknown option '\CurrentOption'. Either you misspelled it\\%
or the language definition file \CurrentOption.ldf was not found}{%
@@ -12476,7 +12497,8 @@ help from Bernd Raichle, for which I am grateful.
\else
\bbl@info{Main language set with 'main='. Except if you have\\%
problems, prefer the default mechanism for setting\\%
- the main language. Reported}
+ the main language, ie, as the last declared.\\%
+ Reported}
\fi
% \end{macrocode}
%
@@ -12595,6 +12617,8 @@ help from Bernd Raichle, for which I am grateful.
\DeclareOption*{}
\ProcessOptions*
\fi
+\bbl@exp{%
+ \\\AtBeginDocument{\\\bbl@usehooks@lang{/}{begindocument}{{}}}}%
\def\AfterBabelLanguage{%
\bbl@error
{Too late for \string\AfterBabelLanguage}%
@@ -23176,6 +23200,7 @@ Babel.cjk_breaks = {
\bbl@elt{identification}{derivate}{no}}
\@namedef{bbl@tbcp@nil}{und}
\@namedef{bbl@lbcp@nil}{und}
+\@namedef{bbl@casing@nil}{und} % TODO
\@namedef{bbl@lotf@nil}{dflt}
\@namedef{bbl@elname@nil}{nil}
\@namedef{bbl@lname@nil}{nil}