From 857d7c0417fbae7ac17a048e73e82dd10e9ebb3d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 22 Feb 2021 21:54:37 +0000 Subject: babel (22feb21) git-svn-id: svn://tug.org/texlive/trunk@57847 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/babel/README.md | 46 +-- Master/texmf-dist/doc/latex/babel/babel.pdf | Bin 815772 -> 818447 bytes Master/texmf-dist/source/latex/babel/babel.dtx | 464 +++++++++++++--------- Master/texmf-dist/source/latex/babel/babel.ins | 2 +- Master/texmf-dist/source/latex/babel/bbcompat.dtx | 2 +- Master/texmf-dist/source/latex/babel/locale.zip | Bin 778055 -> 778055 bytes Master/texmf-dist/tex/generic/babel/babel.def | 275 +++++++------ Master/texmf-dist/tex/generic/babel/babel.sty | 19 +- Master/texmf-dist/tex/generic/babel/hyphen.cfg | 6 +- Master/texmf-dist/tex/generic/babel/luababel.def | 77 +++- Master/texmf-dist/tex/generic/babel/nil.ldf | 2 +- 11 files changed, 513 insertions(+), 380 deletions(-) diff --git a/Master/texmf-dist/doc/latex/babel/README.md b/Master/texmf-dist/doc/latex/babel/README.md index 32c5db5278d..fe4414073f2 100644 --- a/Master/texmf-dist/doc/latex/babel/README.md +++ b/Master/texmf-dist/doc/latex/babel/README.md @@ -1,4 +1,4 @@ -## Babel 3.53 +## Babel 3.54 This package manages culturally-determined typographical (and other) rules, and hyphenation patterns for a wide range of languages. Many @@ -7,9 +7,9 @@ lualatex out of the box. A few even work with plain formats. The latest stable version is available on . -Changes in version 3.53 are described in: +Changes in version 3.54 are described in: -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.53 +https://github.com/latex3/babel/wiki/What's-new-in-babel-3.54 Included is a set of ini files for about 250 languages. @@ -43,6 +43,14 @@ respective authors. ### Latest changes ``` +3.54 2021-02-22 + * RTL text inside \put (with pict2e) correctly rendered in + typical cases (lua, #98). + * Same for \tikz (lua). + * The main change in internal (loader of ini files refactored). + * Fixes: + - The tentative \foreignlanguage* stopped working. + 3.53 2021-01-26 * Extended \setlocalecaption to allow .template (related to #111). @@ -55,6 +63,7 @@ respective authors. bidi in lua. - Parenthesis sometimes mirrored at the end of math with bidi=basic. +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.53 3.52 2020-12-16 * WARNING. If you need the style for Afrikaans you must update @@ -69,7 +78,7 @@ respective authors. - Save size overflow with many \selectlanguage's (#109). - Albanian: fix a typo in contents name (#104) - Missing ‘Unused global option(s)’ warning (#110) -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52 3.51 2020-10-27 * Common interface to (re)define captions (with @@ -84,13 +93,13 @@ https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52 - An error was raised with CJK and a null font (#99). - language.tag.bcp47 and tag.ini in \localeinfo didn't work (#102). -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.52 3.50 2020-10-06 * Fixes: - main= stopped working in some cases (#96). - Footnotes were not \long with layout=footnotes. -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.50 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.50 3.49 2020-10-03 * BUG. This version has a severe bug with main= (fixed in 3.50). @@ -99,7 +108,7 @@ https://github.com/latex3/babel/wiki/What's-new-in-babel-3.50 * frenchspacing is set with ini files. * Fixes: - layout.lists=off didn't work (#94) -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.49 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.49 3.48 2020-09-01 * New (tentative) tools to customize some labels (like chapters @@ -110,7 +119,7 @@ https://github.com/latex3/babel/wiki/What's-new-in-babel-3.49 - \babelshorthand didn't work with some dialects (#91). - \selectlanguage and otherlanguage raised an error inside tabular. -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.48 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.48 3.47 2020-07-13 * Fixes: @@ -121,7 +130,7 @@ https://github.com/latex3/babel/wiki/What's-new-in-babel-3.48 * New - \getlocaleproperty*, which doesn't raise an error. * Basic ini+tex templates for about 500 languages in the GitHub repository. -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.47 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.47 3.46 2020-07-06 * Languages can now be optionally selected with their BCP 47 @@ -137,29 +146,16 @@ https://github.com/latex3/babel/wiki/What's-new-in-babel-3.47 - Locale info was not loaded if the name had uppercase letters in some OSs (#80). - The [..|..] syntax in ini dates didn't recognize 'digits'. -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.46 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.46 3.45 2020-06-10 - * Minor fixes in Hindi, Ancient Greek, Macedonian. - * Improvements in Kurdish, Marathi. - * Alternative date formats with \localedate[calendar=..., - variant=...]{y}{m}{d} (note: no calendar computations, just - strings). - * \today is (again) case-aware. - * \localenumeral{digits}{..} and \localecounter{digits}{cntr} - for native digits. - * Fixes - - Improved handling of math with \babelposthyphenation and - \babelprehyphenation (it was ignoring too much). - - An error related to \bbl@foreign@x could be raised in some - rare cases. See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.45 3.44 2020-05-13 -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.44 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.44 3.43 2020-04-28 -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.43 +See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.43 3.42 2020-03-22 See https://github.com/latex3/babel/wiki/What's-new-in-babel-3.42 diff --git a/Master/texmf-dist/doc/latex/babel/babel.pdf b/Master/texmf-dist/doc/latex/babel/babel.pdf index c51f220b88f..f455a616471 100644 Binary files a/Master/texmf-dist/doc/latex/babel/babel.pdf and b/Master/texmf-dist/doc/latex/babel/babel.pdf differ diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index 1a19d9f2d35..093a61a6f1c 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -31,7 +31,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2021/01/26 v3.53 The Babel package] +\ProvidesFile{babel.dtx}[2021/02/22 v3.54 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -2408,12 +2408,11 @@ Conveniently, some options allow to fill the language, and \babel{} warns you about what to do if there is a missing string. Very likely you will find alerts like that in the |log| file: \begin{verbatim} -Package babel Warning: \mylangchaptername not set. Please, define it -(babel) after the language has been loaded (typically -(babel) in the preamble) with the help of -(babel) \setlocalecaption. An example is: +Package babel Warning: \chaptername not set for 'mylang'. Please, +(babel) define it after the language has been loaded +(babel) (typically in the preamble) with: (babel) \setlocalecaption{mylang}{chapter}{..} -(babel) Reported on input line 18. +(babel) Reported on input line 26. \end{verbatim} In most cases, you will only need to define a few macros. Note @@ -3445,10 +3444,8 @@ bidirectional (with both R and L paragraphs) documents in \luatex{}. \item[graphics] modifies the |picture| environment so that the whole figure is L but the text is R. It \textit{does not} work with the -standard |picture|, and \textit{pict2e} is required if you want sloped -lines \textbf{(With recent versions of \LaTeX, this feature has -stopped working)}. It attempts to do the same for \textsf{pgf/tikz}. -Somewhat experimental. \New{3.32}. +standard |picture|, and \textit{pict2e} is required. It attempts to do +the same for \textsf{pgf/tikz}. Somewhat experimental. \New{3.32}. \item[extras] is used for miscellaneous readjustments which do not fit into the previous groups. Currently redefines in \luatex{} |\underline| and @@ -4851,8 +4848,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<> -%<> +%<> +%<> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -5274,7 +5271,7 @@ help from Bernd Raichle, for which I am grateful. Babel.debug = false }% \fi} <@Basic macros@> - % Temporarily repeat here the code for errors + % Temporarily repeat here the code for errors. TODO. \def\bbl@error#1#2{% \begingroup \def\\{\MessageBreak}% @@ -5297,16 +5294,18 @@ help from Bernd Raichle, for which I am grateful. \def\\{\MessageBreak}% \PackageInfo{babel}{#1}% \endgroup} - \def\bbl@nocaption{\protect\bbl@nocaption@i} +\def\bbl@nocaption{\protect\bbl@nocaption@i} +% TODO - Wrong for \today !!! Must be a separate macro. \def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname \global\@namedef{#2}{\textbf{?#1?}}% \@nameuse{#2}% - \bbl@warning{% TODO. - \@backslashchar#2 not set. Please, define it\\% - after the language has been loaded (typically\\% - in the preamble) with the help of\\% - \string\setlocalecaption. An example is:\\% - \string\setlocalecaption{mylang}{chapter}{..}\\ + \edef\bbl@tempa{#1}% + \bbl@sreplace\bbl@tempa{name}{}% + \bbl@warning{% + \@backslashchar#1 not set for '\languagename'. Please,\\% + define it after the language has been loaded\\% + (typically in the preamble) with\\% + \string\setlocalecaption{\languagename}{\bbl@tempa}{..}\\% Reported}} \def\bbl@tentative{\protect\bbl@tentative@i} \def\bbl@tentative@i#1{% @@ -7666,6 +7665,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par \begingroup {\par}% + \let\bbl@select@opts\@empty \let\BabelText\@firstofone \foreign@language{#1}% \bbl@usehooks{foreign*}{}% @@ -7938,12 +7938,13 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname \global\@namedef{#2}{\textbf{?#1?}}% \@nameuse{#2}% - \bbl@warning{% - \@backslashchar#2 not set. Please, define it\\% - after the language has been loaded (typically\\% - in the preamble) with the help of\\% - \string\setlocalecaption. An example is\\% - \string\setlocalecaption{mylang}{chapter}{..}\\ + \edef\bbl@tempa{#1}% + \bbl@sreplace\bbl@tempa{name}{}% + \bbl@warning{% TODO. + \@backslashchar#1 not set for '\languagename'. Please,\\% + define it after the language has been loaded\\% + (typically in the preamble) with:\\% + \string\setlocalecaption{\languagename}{\bbl@tempa}{..}\\% Reported}} \def\bbl@tentative{\protect\bbl@tentative@i} \def\bbl@tentative@i#1{% @@ -9317,12 +9318,6 @@ help from Bernd Raichle, for which I am grateful. % attribute being checked, and the third and fourth arguments are % the true and false clauses. % -% First we need to find out if any attributes were set; if not we're -% done. Then we need to check the list of known attributes. When -% we're this far |\ifin@| has a value indicating if the attribute in -% question was set or not. Just to be safe the code to be executed -% is `thrown over the |\fi|'. -% % \begin{macrocode} \def\bbl@ifattributeset#1#2#3#4{% \ifx\bbl@known@attribs\@undefined @@ -9334,8 +9329,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@afterelse#3% \else \bbl@afterfi#4% - \fi - } + \fi} % \end{macrocode} % % \end{macro} @@ -9347,9 +9341,7 @@ help from Bernd Raichle, for which I am grateful. % is known and the \TeX-code to be executed otherwise. % % We first assume the attribute is unknown. Then we loop over the -% list of known attributes, trying to find a match. When a match is -% found the definition of |\bbl@tempa| is changed. Finally we -% execute |\bbl@tempa|. +% list of known attributes, trying to find a match. % % \begin{macrocode} \def\bbl@ifknown@ttrib#1#2{% @@ -9360,8 +9352,7 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@tempa\@firstoftwo \else \fi}% - \bbl@tempa -} + \bbl@tempa} % \end{macrocode} % % \end{macro} @@ -9451,7 +9442,10 @@ help from Bernd Raichle, for which I am grateful. % Some languages need to have |\frenchspacing| in effect. Others % don't want that. The command |\bbl@frenchspacing| switches it on % when it isn't already in effect and |\bbl@nonfrenchspacing| -% switches it off if necessary. +% switches it off if necessary. A more refined way to switch the +% catcodes is done with |ini| files. Here an auxiliary macro is +% defined, but the main part is in |\babelprovide|. This new method +% should be ideally the default one. % % \begin{macrocode} \def\bbl@frenchspacing{% @@ -9462,7 +9456,6 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@nonfrenchspacing\nonfrenchspacing \fi} \let\bbl@nonfrenchspacing\nonfrenchspacing -% \let\bbl@elt\relax \edef\bbl@fs@chars{% \bbl@elt{\string.}\@m{3000}\bbl@elt{\string?}\@m{3000}% @@ -9503,7 +9496,7 @@ help from Bernd Raichle, for which I am grateful. % % \subsection{Hyphens} % -% \begin{macro}{\babelhyphenation} +% \begin{macro}{\babelhyphenation} % % This macro saves hyphenation exceptions. Two macros are used to % store them: |\bbl@hyphenation@| for the global ones and @@ -9534,7 +9527,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@iflanguage\bbl@tempa{% \bbl@csarg\protected@edef{hyphenation@\bbl@tempa}{% \bbl@ifunset{bbl@hyphenation@\bbl@tempa}% - \@empty + {}% {\csname bbl@hyphenation@\bbl@tempa\endcsname\space}% #2}}}% \fi}} @@ -10667,6 +10660,7 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@KVP@Alph\@nil \let\bbl@KVP@labels\@nil \bbl@csarg\let{KVP@labels*}\@nil + \global\let\bbl@inidata\@empty \bbl@forkv{#1}{% TODO - error handling \in@{/}{##1}% \ifin@ @@ -10732,7 +10726,8 @@ help from Bernd Raichle, for which I am grateful. % == % At this point all parameters are defined if 'import'. Now we % execute some code depending on them. But what about if nothing was - % imported? We just set the very basic parameters. + % imported? We just set the basic parameters, but still loading the + % whole ini file. \bbl@load@basic{#2}% % == script, language == % Override the values from ini or defines them @@ -10974,12 +10969,10 @@ help from Bernd Raichle, for which I am grateful. \expandafter\bbl@tempb\bbl@captionslist\@empty \else \ifx\bbl@initoload\relax - \bbl@read@ini{\bbl@KVP@captions}0% Here letters cat = 11 + \bbl@read@ini{\bbl@KVP@captions}2% % Here letters cat = 11 \else - \bbl@read@ini{\bbl@initoload}0% Here all letters cat = 11 + \bbl@read@ini{\bbl@initoload}2% % Same \fi - \bbl@after@ini - \bbl@savestrings \fi \StartBabelCommands*{#1}{date}% \ifx\bbl@KVP@import\@nil @@ -11031,9 +11024,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@provide@renew#1{% \ifx\bbl@KVP@captions\@nil\else \StartBabelCommands*{#1}{captions}% - \bbl@read@ini{\bbl@KVP@captions}0% Here all letters cat = 11 - \bbl@after@ini - \bbl@savestrings + \bbl@read@ini{\bbl@KVP@captions}2% % Here all letters cat = 11 \EndBabelCommands \fi \ifx\bbl@KVP@import\@nil\else @@ -11046,24 +11037,18 @@ help from Bernd Raichle, for which I am grateful. \ifx\bbl@lbkflag\@empty \bbl@provide@hyphens{#1}% \fi} +% \end{macrocode} +% % Load the basic parameters (ids, typography, counters, and a few % more), while captions and dates are left out. But it may happen some % data has been loaded before automatically, so we first discard the % saved values. -\def\bbl@linebreak@export{% - \bbl@exportkey{lnbrk}{typography.linebreaking}{h}% - \bbl@exportkey{hyphr}{typography.hyphenrules}{}% - \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}% - \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}% - \bbl@exportkey{prehc}{typography.prehyphenchar}{}% - \bbl@exportkey{hyotl}{typography.hyphenate.other.locale}{}% - \bbl@exportkey{hyots}{typography.hyphenate.other.script}{}% - \bbl@exportkey{intsp}{typography.intraspace}{}% - \bbl@exportkey{chrng}{characters.ranges}{}} +% +% \begin{macrocode} \def\bbl@load@basic#1{% \bbl@ifunset{bbl@inidata@\languagename}{}% {\getlocaleproperty\bbl@tempa{\languagename}{identification/load.level}% - \ifcase\bbl@tempa\else + \ifcase\bbl@tempa \bbl@csarg\let{lname@\languagename}\relax \fi}% \bbl@ifunset{bbl@lname@#1}% @@ -11071,10 +11056,7 @@ help from Bernd Raichle, for which I am grateful. \begingroup \let\bbl@ini@captions@aux\@gobbletwo \def\bbl@inidate ####1.####2.####3.####4\relax ####5####6{}% - \bbl@read@ini{##1}0% - \bbl@linebreak@export - \bbl@exportkey{dgnat}{numbers.digits.native}{}% - \bbl@exportkey{frspc}{typography.frenchspacing}{u}% unset + \bbl@read@ini{##1}1% \ifx\bbl@initoload\relax\endinput\fi \endgroup}% \begingroup % boxed, to avoid extra spaces: @@ -11126,14 +11108,10 @@ help from Bernd Raichle, for which I am grateful. {\bbl@exp{\\\adddialect\\bbl@tempa}}}% found in opt list or ini % \end{macrocode} % -% The reader of |ini| files. There are 3 possible cases: a section name -% (in the form |[...]|), a comment (starting with |;|) and a -% key/value pair. +% The reader of |babel-...tex| files. We reset temporarily some +% catcodes. % % \begin{macrocode} -\ifx\bbl@readstream\@undefined - \csname newread\endcsname\bbl@readstream -\fi \def\bbl@input@texini#1{% \bbl@bsphack \bbl@exp{% @@ -11145,20 +11123,51 @@ help from Bernd Raichle, for which I am grateful. \catcode`\\\{=\the\catcode`\{\relax \catcode`\\\}=\the\catcode`\}\relax}% \bbl@esphack} -\def\bbl@inipreread#1=#2\@@{% - \bbl@trim@def\bbl@tempa{#1}% Redundant below !! +% \end{macrocode} +% +% The following macros read and store |ini| files (but don't process +% them). For each line, there are 3 possible actions: ignore if starts +% with |;|, switch section if starts with |[|, and store otherwise. +% There are used in the first step of |\bbl@read@ini|. +% +% \begin{macrocode} +\def\bbl@iniline#1\bbl@iniline{% + \@ifnextchar[\bbl@inisect{\@ifnextchar;\bbl@iniskip\bbl@inistore}#1\@@}% ] +\def\bbl@inisect[#1]#2\@@{\def\bbl@section{#1}}% +\def\bbl@iniskip#1\@@{}% if starts with ; +\def\bbl@inistore#1=#2\@@{% full (default) + \bbl@trim@def\bbl@tempa{#1}% \bbl@trim\toks@{#2}% - % Move trims here ?? \bbl@ifunset{bbl@KVP@\bbl@section/\bbl@tempa}% {\bbl@exp{% - \\\g@addto@macro\\\bbl@inidata{% - \\\bbl@elt{\bbl@section}{\bbl@tempa}{\the\toks@}}}% - \expandafter\bbl@inireader\bbl@tempa=#2\@@}% + \\\g@addto@macro\\\bbl@inidata{% + \\\bbl@elt{\bbl@section}{\bbl@tempa}{\the\toks@}}}}% {}}% -\def\bbl@fetch@ini#1#2{% - \bbl@exp{\def\\\bbl@inidata{% - \\\bbl@elt{identification}{tag.ini}{#1}% - \\\bbl@elt{identification}{load.level}{#2}}}% +\def\bbl@inistore@min#1=#2\@@{% minimal (maybe set in \bbl@read@ini) + \bbl@trim@def\bbl@tempa{#1}% + \bbl@trim\toks@{#2}% + \bbl@xin@{.identification.}{.\bbl@section.}% + \ifin@ + \bbl@exp{\\\g@addto@macro\\\bbl@inidata{% + \\\bbl@elt{identification}{\bbl@tempa}{\the\toks@}}}% + \fi}% +% \end{macrocode} +% +% Now, the ‘main loop’, which \textbf{**must be executed inside a +% group**}. At this point, |\bbl@inidata| may contain data declared in +% |\babelprovide|, with ‘slashed’ keys. There are 3 steps: first read +% the ini file and store it; then traverse the stored values, and +% process some groups if required (date, captions, labels, counters); +% finally, ‘export’ some values by defining global macros +% (identification, typography, characters, numbers). The second +% argument is 0 when called to read the minimal data for fonts; with +% |\babelprovide| it's either 1 or 2. +% +% \begin{macrocode} +\ifx\bbl@readstream\@undefined + \csname newread\endcsname\bbl@readstream +\fi +\def\bbl@read@ini#1#2{% \openin\bbl@readstream=babel-#1.ini \ifeof\bbl@readstream \bbl@error @@ -11167,12 +11176,20 @@ help from Bernd Raichle, for which I am grateful. is not complete.}% {Fix the name or reinstall babel.}% \else + % Store ini data in \bbl@inidata \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12 \catcode`\;=12 \catcode`\|=12 \catcode`\%=14 \catcode`\-=12 \bbl@info{Importing - \ifcase#2 \or font and identification \or basic \fi - data for \languagename\\% + \ifcase#2font and identification \or basic \fi + data for \languagename\\% from babel-#1.ini. Reported}% + \ifnum#2=\z@ + \global\let\bbl@inidata\@empty + \let\bbl@inistore\bbl@inistore@min % Remember it's local + \fi + \def\bbl@section{identification}% + \bbl@exp{\\\bbl@inistore tag.ini=#1\\\@@}% + \bbl@inistore load.level=#2\@@ \loop \if T\ifeof\bbl@readstream F\fi T\relax % Trick, because inside \loop \endlinechar\m@ne @@ -11182,95 +11199,70 @@ help from Bernd Raichle, for which I am grateful. \expandafter\bbl@iniline\bbl@line\bbl@iniline \fi \repeat + % Process stored data + \bbl@csarg\xdef{lini@\languagename}{#1}% + \let\bbl@savestrings\@empty + \let\bbl@savetoday\@empty + \let\bbl@savedate\@empty + \def\bbl@elt##1##2##3{% + \def\bbl@section{##1}% + \in@{=date.}{=##1}% Find a better place + \ifin@ + \bbl@ini@calendar{##1}% + \fi + \global\bbl@csarg\let{bbl@KVP@##1/##2}\relax + \bbl@ifunset{bbl@inikv@##1}{}% + {\csname bbl@inikv@##1\endcsname{##2}{##3}}}% + \bbl@inidata + % 'Export' data + \bbl@ini@exports{#2}% + \global\bbl@csarg\let{inidata@\languagename}\bbl@inidata + \global\let\bbl@inidata\@empty + \bbl@exp{\\\bbl@add@list\\\bbl@ini@loaded{\languagename}}% + \bbl@toglobal\bbl@ini@loaded \fi} -\def\bbl@read@ini#1#2{% - \bbl@csarg\xdef{lini@\languagename}{#1}% - \let\bbl@section\@empty - \let\bbl@savestrings\@empty - \let\bbl@savetoday\@empty - \let\bbl@savedate\@empty - \let\bbl@inireader\bbl@iniskip - \bbl@fetch@ini{#1}{#2}% - \bbl@foreach\bbl@renewlist{% - \bbl@ifunset{bbl@renew@##1}{}{\bbl@inisec[##1]\@@}}% - \global\let\bbl@renewlist\@empty - % Ends last section. See \bbl@inisec - \def\bbl@elt##1##2{\bbl@inireader##1=##2\@@}% - \bbl@cs{renew@\bbl@section}% - \global\bbl@csarg\let{renew@\bbl@section}\relax - \bbl@cs{secpost@\bbl@section}% - \bbl@csarg{\global\expandafter\let}{inidata@\languagename}\bbl@inidata - \bbl@exp{\\\bbl@add@list\\\bbl@ini@loaded{\languagename}}% - \bbl@toglobal\bbl@ini@loaded} -\def\bbl@iniline#1\bbl@iniline{% - \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inipreread}#1\@@}% ] % \end{macrocode} % -% The special cases for comment lines and sections are handled by the -% two following commands. In sections, we provide the posibility to -% take extra actions at the end or at the start. By default, key=val -% pairs are ignored. The |secpost| ``hook'' is used only by -% `identification', while |secpre| only by |date.gregorian.licr|. +% A somewhat hackish tool to handle calendar sections. To be improved. % % \begin{macrocode} -\def\bbl@iniskip#1\@@{}% if starts with ; -\def\bbl@inisec[#1]#2\@@{% if starts with opening bracket - \def\bbl@elt##1##2{% - \expandafter\toks@\expandafter{% - \expandafter{\bbl@section}{##1}{##2}}% - \bbl@exp{% - \\\g@addto@macro\\\bbl@inidata{\\\bbl@elt\the\toks@}}% - \bbl@inireader##1=##2\@@}% - \bbl@cs{renew@\bbl@section}% - \global\bbl@csarg\let{renew@\bbl@section}\relax - \bbl@cs{secpost@\bbl@section}% - % The previous code belongs to the previous section. - % -------------------------- - % Now start the current one. - \in@{=date.}{=#1}% - \ifin@ - \lowercase{\def\bbl@tempa{=#1=}}% - \bbl@replace\bbl@tempa{=date.gregorian}{}% - \bbl@replace\bbl@tempa{=date.}{}% - \in@{.licr=}{#1=}% - \ifin@ - \ifcase\bbl@engine - \bbl@replace\bbl@tempa{.licr=}{}% - \else - \let\bbl@tempa\relax - \fi - \fi - \ifx\bbl@tempa\relax\else - \bbl@replace\bbl@tempa{=}{}% - \bbl@exp{% - \def\####1=####2\\\@@{% - \\\bbl@inidate####1...\relax{####2}{\bbl@tempa}}}% - \fi - \fi - \def\bbl@section{#1}% - \def\bbl@elt##1##2{% - \@namedef{bbl@KVP@#1/##1}{}}% - \bbl@cs{renew@#1}% - \bbl@cs{secpre@#1}% pre-section `hook' - \bbl@ifunset{bbl@inikv@#1}% - {\let\bbl@inireader\bbl@iniskip}% - {\bbl@exp{\let\\\bbl@inireader\}}} -\let\bbl@renewlist\@empty -\def\bbl@renewinikey#1/#2\@@#3{% - \bbl@ifunset{bbl@renew@#1}% - {\bbl@add@list\bbl@renewlist{#1}}% - {}% - \bbl@csarg\bbl@add{renew@#1}{\bbl@elt{#2}{#3}}} -% \end{macrocode} -% -% Reads a key=val line and stores the trimmed val in -% |\bbl@@kv@
.|. +\def\bbl@ini@calendar#1{% + \lowercase{\def\bbl@tempa{=#1=}}% + \bbl@replace\bbl@tempa{=date.gregorian}{}% + \bbl@replace\bbl@tempa{=date.}{}% + \in@{.licr=}{#1=}% + \ifin@ + \ifcase\bbl@engine + \bbl@replace\bbl@tempa{.licr=}{}% + \else + \let\bbl@tempa\relax + \fi + \fi + \ifx\bbl@tempa\relax\else + \bbl@replace\bbl@tempa{=}{}% + \bbl@exp{% + \def\####1####2{% + \\\bbl@inidate####1...\relax{####2}{\bbl@tempa}}}% + \fi} +% \end{macrocode} +% +% A key with a slash in |\babelprovide| replaces the value in the |ini| +% file (which is ignored altogether). The mechanism is simple (but +% suboptimal): add the data to the |ini| one (at this point the |ini| +% file has not yet been read), and define a dummy macro. When the |ini| +% file is read, just skip the corresponding key and reset the macro (in +% |\bbl@inistore| above). +% % % \begin{macrocode} -\def\bbl@inikv#1=#2\@@{% key=value - \bbl@trim@def\bbl@tempa{#1}% - \bbl@trim\toks@{#2}% - \bbl@csarg\edef{@kv@\bbl@section.\bbl@tempa}{\the\toks@}} +\def\bbl@renewinikey#1/#2\@@#3{% + \edef\bbl@tempa{\zap@space #1 \@empty}% section + \edef\bbl@tempb{\zap@space #2 \@empty}% key + \bbl@trim\toks@{#3}% value + \bbl@exp{% + \global\let\\\\@empty % just a flag + \\\g@addto@macro\\\bbl@inidata{% + \\\bbl@elt{\bbl@tempa}{\bbl@tempb}{\the\toks@}}}}% % \end{macrocode} % % The previous assignments are local, so we need to export them. If @@ -11289,7 +11281,7 @@ help from Bernd Raichle, for which I am grateful. % % Key-value pairs are treated differently depending on the section in % the |ini| file. The following macros are the readers for -% |identification| and |typography|. Note |\bbl@secpost@identification| +% |identification| and |typography|. Note |\bbl@ini@exports| % is called always (via |\bbl@inisec|), while |\bbl@after@ini| must be % called explicitly after |\bbl@read@ini| if necessary. % @@ -11301,8 +11293,8 @@ help from Bernd Raichle, for which I am grateful. \bbl@cs{@kv@identification.warning#1}\\% Reported }}} % -\let\bbl@inikv@identification\bbl@inikv -\def\bbl@secpost@identification{% +\def\bbl@ini@exports#1{% + % Identification always exported \bbl@iniwarning{}% \ifcase\bbl@engine \bbl@iniwarning{.pdflatex}% @@ -11322,15 +11314,46 @@ help from Bernd Raichle, for which I am grateful. {\csname bbl@esname@\languagename\endcsname}}% \bbl@exportkey{sbcp}{identification.script.tag.bcp47}{}% \bbl@exportkey{sotf}{identification.script.tag.opentype}{DFLT}% + % Also maps bcp47 -> languagename \ifbbl@bcptoname \bbl@csarg\xdef{bcp@map@\bbl@cl{tbcp}}{\languagename}% + \fi + % Conditional + \ifnum#1>\z@ % 0 = only info, 1, 2 = basic, (re)new + \bbl@exportkey{lnbrk}{typography.linebreaking}{h}% + \bbl@exportkey{hyphr}{typography.hyphenrules}{}% + \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}% + \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}% + \bbl@exportkey{prehc}{typography.prehyphenchar}{}% + \bbl@exportkey{hyotl}{typography.hyphenate.other.locale}{}% + \bbl@exportkey{hyots}{typography.hyphenate.other.script}{}% + \bbl@exportkey{intsp}{typography.intraspace}{}% + \bbl@exportkey{chrng}{characters.ranges}{}% + \bbl@exportkey{dgnat}{numbers.digits.native}{}% + \bbl@exportkey{frspc}{typography.frenchspacing}{u}% + \ifnum#1=\tw@ % only (re)new + \bbl@exportkey{rqtex}{identification.require.babel}{}% + \bbl@toglobal\bbl@savetoday + \bbl@toglobal\bbl@savedate + \bbl@savestrings + \fi \fi} % \end{macrocode} % +% A shared handler for key=val lines to be stored in +% |\bbl@@kv@
.|. +% +% \begin{macrocode} +\def\bbl@inikv#1#2{% key=value + \toks@{#2}% This hides #'s from ini values + \bbl@csarg\edef{@kv@\bbl@section.#1}{\the\toks@}} +% \end{macrocode} +% % By default, the following sections are just read. Actions are taken % later. % % \begin{macrocode} +\let\bbl@inikv@identification\bbl@inikv \let\bbl@inikv@typography\bbl@inikv \let\bbl@inikv@characters\bbl@inikv \let\bbl@inikv@numbers\bbl@inikv @@ -11342,7 +11365,7 @@ help from Bernd Raichle, for which I am grateful. % the ‘units’. % % \begin{macrocode} -\def\bbl@inikv@counters#1=#2\@@{% +\def\bbl@inikv@counters#1#2{% \bbl@ifsamestring{#1}{digits}% {\bbl@error{The counter name 'digits' is reserved for mapping\\% decimal digits}% @@ -11365,13 +11388,6 @@ help from Bernd Raichle, for which I am grateful. \expandafter\bbl@buildifcase\bbl@tempb* \\ % Space after \\ \bbl@csarg{\global\expandafter\let}{cntr@#1@\languagename}\bbl@tempa \fi} -\def\bbl@after@ini{% - \bbl@linebreak@export - \bbl@exportkey{dgnat}{numbers.digits.native}{}% - \bbl@exportkey{rqtex}{identification.require.babel}{}% - \bbl@exportkey{frspc}{typography.frenchspacing}{u}% unset - \bbl@toglobal\bbl@savetoday - \bbl@toglobal\bbl@savedate} % \end{macrocode} % % Now |captions| and |captions.licr|, depending on the engine. And @@ -11381,10 +11397,10 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \ifcase\bbl@engine - \bbl@csarg\def{inikv@captions.licr}#1=#2\@@{% + \bbl@csarg\def{inikv@captions.licr}#1#2{% \bbl@ini@captions@aux{#1}{#2}} \else - \def\bbl@inikv@captions#1=#2\@@{% + \def\bbl@inikv@captions#1#2{% \bbl@ini@captions@aux{#1}{#2}} \fi % \end{macrocode} @@ -11445,7 +11461,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@ifunset{bbl@map@#1@\languagename}% {\@nameuse{#1}}% {\@nameuse{bbl@map@#1@\languagename}}} -\def\bbl@inikv@labels#1=#2\@@{% +\def\bbl@inikv@labels#1#2{% \in@{.map}{#1}% \ifin@ \ifx\bbl@KVP@labels\@nil\else @@ -11665,7 +11681,7 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\bbl@provide@lsys#1{% \bbl@ifunset{bbl@lname@#1}% - {\bbl@ini@basic{#1}}% + {\bbl@load@info{#1}}% {}% \bbl@csarg\let{lsys@#1}\@empty \bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}% @@ -11717,14 +11733,13 @@ help from Bernd Raichle, for which I am grateful. % must be enabled. This means we must make sure a few characters are % not active. The |ini| is not read directly, but with a proxy |tex| % file named as the language (which means any code in it must be -% skipped, too. +% skipped, too). % % \begin{macrocode} -\def\bbl@ini@basic#1{% +\def\bbl@load@info#1{% \def\BabelBeforeIni##1##2{% \begingroup - \bbl@add\bbl@secpost@identification{\closein\bbl@readstream }% - \bbl@read@ini{##1}1% + \bbl@read@ini{##1}0% \endinput % babel- .tex may contain onlypreamble's \endgroup}% boxed, to avoid extra spaces: {\bbl@input@texini{#1}}} @@ -11850,7 +11865,7 @@ help from Bernd Raichle, for which I am grateful. \newcommand\BabelEnsureInfo{% \ifx\InputIfFileExists\@undefined\else \def\bbl@ensureinfo##1{% - \bbl@ifunset{bbl@lname@##1}{\bbl@ini@basic{##1}}{}}% + \bbl@ifunset{bbl@lname@##1}{\bbl@load@info{##1}}{}}% \fi \bbl@foreach\bbl@loaded{{% \def\languagename{##1}% @@ -13373,7 +13388,7 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@cjkintraspace\relax \directlua{ Babel = Babel or {} - require'babel-data-cjk.lua' + require('babel-data-cjk.lua') Babel.cjk_enabled = true function Babel.cjk_linebreak(head) local GLYPH = node.id'glyph' @@ -14276,21 +14291,86 @@ end \ifcase\bbl@thetextdir \let\bbl@pictresetdir\relax \else - \bodydir TLT + \ifcase#1\bodydir TLT % Remember this sets the inner boxes + \or\textdir TLT + \else\bodydir TLT \textdir TLT + \fi % \(text|par)dir required in pgf: \def\bbl@pictresetdir{\bodydir TRT\pardir TRT\textdir TRT\relax}% \fi}% \ifx\AddToHook\@undefined\else - \AddToHook{env/picture/begin}{\bbl@pictsetdir\z@}% + \AddToHook{env/picture/begin}{\bbl@pictsetdir\tw@}% + \directlua{ + Babel.get_picture_dir = true + Babel.picture_has_bidi = 0 + function Babel.picture_dir (head) + if not Babel.get_picture_dir then return head end + for item in node.traverse(head) do + if item.id == node.id'glyph' then + local itemchar = item.char + % TODO. Copypaste pattern from Babel.bidi (-r) + local chardata = Babel.characters[itemchar] + local dir = chardata and chardata.d or nil + if not dir then + for nn, et in ipairs(Babel.ranges) do + if itemchar < et[1] then + break + elseif itemchar <= et[2] then + dir = et[3] + break + end + end + end + if dir and (dir == 'al' or dir == 'r') then + Babel.picture_has_bidi = 1 + end + end + end + return head + end + luatexbase.add_to_callback("hpack_filter", Babel.picture_dir, + "Babel.picture_dir") + }% + \AtBeginDocument{% + \long\def\put(#1,#2)#3{% + \@killglue + % Try: + \ifx\bbl@pictresetdir\relax + \def\bbl@tempc{0}% + \else + \directlua{ + Babel.get_picture_dir = true + Babel.picture_has_bidi = 0 + }% + \setbox\z@\hb@xt@\z@{% + \@defaultunitsset\@tempdimc{#1}\unitlength + \kern\@tempdimc + #3\hss}% + \edef\bbl@tempc{\directlua{tex.print(Babel.picture_has_bidi)}}% + \fi + % Do: + \@defaultunitsset\@tempdimc{#2}\unitlength + \raise\@tempdimc\hb@xt@\z@{% + \@defaultunitsset\@tempdimc{#1}\unitlength + \kern\@tempdimc + {\ifnum\bbl@tempc>\z@\bbl@pictresetdir\fi#3}\hss}% + \ignorespaces}% + \MakeRobust\put}% \fi \AtBeginDocument {\ifx\tikz@atbegin@node\@undefined\else \let\bbl@OL@pgfpicture\pgfpicture \bbl@sreplace\pgfpicture{\pgfpicturetrue}% - {\bbl@pictsetdir\@ne\pgfpicturetrue}% - \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir\@ne}% + {\bbl@pictsetdir\z@\pgfpicturetrue}% + \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir\z@}% \bbl@add\tikz@atbegin@node{\bbl@pictresetdir}% - \fi}} + \bbl@sreplace\tikz{\begingroup}% + {\begingroup\bbl@pictsetdir\tw@}% + \fi + \ifx\AddToHook\@undefined\else + \AddToHook{env/tcolorbox/begin}{\bbl@pictsetdir\@ne}% + \fi + }} {} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins index cd1597a837a..73a8825c196 100644 --- a/Master/texmf-dist/source/latex/babel/babel.ins +++ b/Master/texmf-dist/source/latex/babel/babel.ins @@ -26,7 +26,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% -\def\filedate{2021/01/26} +\def\filedate{2021/02/22} \def\batchfile{babel.ins} \input docstrip.tex diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx index 84c388a78cc..bd6f5b7bfd8 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}[2021/01/26 v3.53] +\ProvidesFile{bbcompat.dtx}[2021/02/22 v3.54] % % %% File 'bbcompat.dtx' diff --git a/Master/texmf-dist/source/latex/babel/locale.zip b/Master/texmf-dist/source/latex/babel/locale.zip index a04b7bdfeb7..6524dc27fcf 100644 Binary files a/Master/texmf-dist/source/latex/babel/locale.zip and b/Master/texmf-dist/source/latex/babel/locale.zip differ diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index e02952cb58b..5242215ff52 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -39,7 +39,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2021/01/26 3.53 Babel common definitions] +\ProvidesFile{babel.def}[2021/02/22 3.54 Babel common definitions] \ifx\AtBeginDocument\@undefined % TODO. change test. % == Code for plain == \def\@empty{} @@ -397,8 +397,8 @@ \fi \countdef\last@language=19 % TODO. why? remove? \def\addlanguage{\csname newlanguage\endcsname} -\def\bbl@version{3.53} -\def\bbl@date{2021/01/26} +\def\bbl@version{3.54} +\def\bbl@date{2021/02/22} \def\adddialect#1#2{% \global\chardef#1#2\relax \bbl@usehooks{adddialect}{{#1}{#2}}% @@ -735,6 +735,7 @@ \def\bbl@foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par \begingroup {\par}% + \let\bbl@select@opts\@empty \let\BabelText\@firstofone \foreign@language{#1}% \bbl@usehooks{foreign*}{}% @@ -871,12 +872,13 @@ \def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname \global\@namedef{#2}{\textbf{?#1?}}% \@nameuse{#2}% - \bbl@warning{% - \@backslashchar#2 not set. Please, define it\\% - after the language has been loaded (typically\\% - in the preamble) with the help of\\% - \string\setlocalecaption. An example is\\% - \string\setlocalecaption{mylang}{chapter}{..}\\ + \edef\bbl@tempa{#1}% + \bbl@sreplace\bbl@tempa{name}{}% + \bbl@warning{% TODO. + \@backslashchar#1 not set for '\languagename'. Please,\\% + define it after the language has been loaded\\% + (typically in the preamble) with:\\% + \string\setlocalecaption{\languagename}{\bbl@tempa}{..}\\% Reported}} \def\bbl@tentative{\protect\bbl@tentative@i} \def\bbl@tentative@i#1{% @@ -1687,8 +1689,7 @@ \bbl@afterelse#3% \else \bbl@afterfi#4% - \fi - } + \fi} \def\bbl@ifknown@ttrib#1#2{% \let\bbl@tempa\@secondoftwo \bbl@loopx\bbl@tempb{#2}{% @@ -1697,8 +1698,7 @@ \let\bbl@tempa\@firstoftwo \else \fi}% - \bbl@tempa -} + \bbl@tempa} \def\bbl@clear@ttribs{% \ifx\bbl@attributes\@undefined\else \bbl@loopx\bbl@tempa{\bbl@attributes}{% @@ -1772,7 +1772,7 @@ \bbl@iflanguage\bbl@tempa{% \bbl@csarg\protected@edef{hyphenation@\bbl@tempa}{% \bbl@ifunset{bbl@hyphenation@\bbl@tempa}% - \@empty + {}% {\csname bbl@hyphenation@\bbl@tempa\endcsname\space}% #2}}}% \fi}} @@ -2339,6 +2339,7 @@ \let\bbl@KVP@Alph\@nil \let\bbl@KVP@labels\@nil \bbl@csarg\let{KVP@labels*}\@nil + \global\let\bbl@inidata\@empty \bbl@forkv{#1}{% TODO - error handling \in@{/}{##1}% \ifin@ @@ -2404,7 +2405,8 @@ % == % At this point all parameters are defined if 'import'. Now we % execute some code depending on them. But what about if nothing was - % imported? We just set the very basic parameters. + % imported? We just set the basic parameters, but still loading the + % whole ini file. \bbl@load@basic{#2}% % == script, language == % Override the values from ini or defines them @@ -2641,12 +2643,10 @@ \expandafter\bbl@tempb\bbl@captionslist\@empty \else \ifx\bbl@initoload\relax - \bbl@read@ini{\bbl@KVP@captions}0% Here letters cat = 11 + \bbl@read@ini{\bbl@KVP@captions}2% % Here letters cat = 11 \else - \bbl@read@ini{\bbl@initoload}0% Here all letters cat = 11 + \bbl@read@ini{\bbl@initoload}2% % Same \fi - \bbl@after@ini - \bbl@savestrings \fi \StartBabelCommands*{#1}{date}% \ifx\bbl@KVP@import\@nil @@ -2696,9 +2696,7 @@ \def\bbl@provide@renew#1{% \ifx\bbl@KVP@captions\@nil\else \StartBabelCommands*{#1}{captions}% - \bbl@read@ini{\bbl@KVP@captions}0% Here all letters cat = 11 - \bbl@after@ini - \bbl@savestrings + \bbl@read@ini{\bbl@KVP@captions}2% % Here all letters cat = 11 \EndBabelCommands \fi \ifx\bbl@KVP@import\@nil\else @@ -2711,20 +2709,10 @@ \ifx\bbl@lbkflag\@empty \bbl@provide@hyphens{#1}% \fi} -\def\bbl@linebreak@export{% - \bbl@exportkey{lnbrk}{typography.linebreaking}{h}% - \bbl@exportkey{hyphr}{typography.hyphenrules}{}% - \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}% - \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}% - \bbl@exportkey{prehc}{typography.prehyphenchar}{}% - \bbl@exportkey{hyotl}{typography.hyphenate.other.locale}{}% - \bbl@exportkey{hyots}{typography.hyphenate.other.script}{}% - \bbl@exportkey{intsp}{typography.intraspace}{}% - \bbl@exportkey{chrng}{characters.ranges}{}} \def\bbl@load@basic#1{% \bbl@ifunset{bbl@inidata@\languagename}{}% {\getlocaleproperty\bbl@tempa{\languagename}{identification/load.level}% - \ifcase\bbl@tempa\else + \ifcase\bbl@tempa \bbl@csarg\let{lname@\languagename}\relax \fi}% \bbl@ifunset{bbl@lname@#1}% @@ -2732,10 +2720,7 @@ \begingroup \let\bbl@ini@captions@aux\@gobbletwo \def\bbl@inidate ####1.####2.####3.####4\relax ####5####6{}% - \bbl@read@ini{##1}0% - \bbl@linebreak@export - \bbl@exportkey{dgnat}{numbers.digits.native}{}% - \bbl@exportkey{frspc}{typography.frenchspacing}{u}% unset + \bbl@read@ini{##1}1% \ifx\bbl@initoload\relax\endinput\fi \endgroup}% \begingroup % boxed, to avoid extra spaces: @@ -2780,9 +2765,6 @@ {\bbl@exp{\\\adddialect\\language}}% {}}% so, l@ is ok - nothing to do {\bbl@exp{\\\adddialect\\bbl@tempa}}}% found in opt list or ini -\ifx\bbl@readstream\@undefined - \csname newread\endcsname\bbl@readstream -\fi \def\bbl@input@texini#1{% \bbl@bsphack \bbl@exp{% @@ -2794,20 +2776,30 @@ \catcode`\\\{=\the\catcode`\{\relax \catcode`\\\}=\the\catcode`\}\relax}% \bbl@esphack} -\def\bbl@inipreread#1=#2\@@{% - \bbl@trim@def\bbl@tempa{#1}% Redundant below !! +\def\bbl@iniline#1\bbl@iniline{% + \@ifnextchar[\bbl@inisect{\@ifnextchar;\bbl@iniskip\bbl@inistore}#1\@@}% ] +\def\bbl@inisect[#1]#2\@@{\def\bbl@section{#1}}% +\def\bbl@iniskip#1\@@{}% if starts with ; +\def\bbl@inistore#1=#2\@@{% full (default) + \bbl@trim@def\bbl@tempa{#1}% \bbl@trim\toks@{#2}% - % Move trims here ?? \bbl@ifunset{bbl@KVP@\bbl@section/\bbl@tempa}% {\bbl@exp{% - \\\g@addto@macro\\\bbl@inidata{% - \\\bbl@elt{\bbl@section}{\bbl@tempa}{\the\toks@}}}% - \expandafter\bbl@inireader\bbl@tempa=#2\@@}% + \\\g@addto@macro\\\bbl@inidata{% + \\\bbl@elt{\bbl@section}{\bbl@tempa}{\the\toks@}}}}% {}}% -\def\bbl@fetch@ini#1#2{% - \bbl@exp{\def\\\bbl@inidata{% - \\\bbl@elt{identification}{tag.ini}{#1}% - \\\bbl@elt{identification}{load.level}{#2}}}% +\def\bbl@inistore@min#1=#2\@@{% minimal (maybe set in \bbl@read@ini) + \bbl@trim@def\bbl@tempa{#1}% + \bbl@trim\toks@{#2}% + \bbl@xin@{.identification.}{.\bbl@section.}% + \ifin@ + \bbl@exp{\\\g@addto@macro\\\bbl@inidata{% + \\\bbl@elt{identification}{\bbl@tempa}{\the\toks@}}}% + \fi}% +\ifx\bbl@readstream\@undefined + \csname newread\endcsname\bbl@readstream +\fi +\def\bbl@read@ini#1#2{% \openin\bbl@readstream=babel-#1.ini \ifeof\bbl@readstream \bbl@error @@ -2816,12 +2808,20 @@ is not complete.}% {Fix the name or reinstall babel.}% \else + % Store ini data in \bbl@inidata \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12 \catcode`\;=12 \catcode`\|=12 \catcode`\%=14 \catcode`\-=12 \bbl@info{Importing - \ifcase#2 \or font and identification \or basic \fi - data for \languagename\\% + \ifcase#2font and identification \or basic \fi + data for \languagename\\% from babel-#1.ini. Reported}% + \ifnum#2=\z@ + \global\let\bbl@inidata\@empty + \let\bbl@inistore\bbl@inistore@min % Remember it's local + \fi + \def\bbl@section{identification}% + \bbl@exp{\\\bbl@inistore tag.ini=#1\\\@@}% + \bbl@inistore load.level=#2\@@ \loop \if T\ifeof\bbl@readstream F\fi T\relax % Trick, because inside \loop \endlinechar\m@ne @@ -2831,80 +2831,54 @@ \expandafter\bbl@iniline\bbl@line\bbl@iniline \fi \repeat - \fi} -\def\bbl@read@ini#1#2{% - \bbl@csarg\xdef{lini@\languagename}{#1}% - \let\bbl@section\@empty - \let\bbl@savestrings\@empty - \let\bbl@savetoday\@empty - \let\bbl@savedate\@empty - \let\bbl@inireader\bbl@iniskip - \bbl@fetch@ini{#1}{#2}% - \bbl@foreach\bbl@renewlist{% - \bbl@ifunset{bbl@renew@##1}{}{\bbl@inisec[##1]\@@}}% - \global\let\bbl@renewlist\@empty - % Ends last section. See \bbl@inisec - \def\bbl@elt##1##2{\bbl@inireader##1=##2\@@}% - \bbl@cs{renew@\bbl@section}% - \global\bbl@csarg\let{renew@\bbl@section}\relax - \bbl@cs{secpost@\bbl@section}% - \bbl@csarg{\global\expandafter\let}{inidata@\languagename}\bbl@inidata - \bbl@exp{\\\bbl@add@list\\\bbl@ini@loaded{\languagename}}% - \bbl@toglobal\bbl@ini@loaded} -\def\bbl@iniline#1\bbl@iniline{% - \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inipreread}#1\@@}% ] -\def\bbl@iniskip#1\@@{}% if starts with ; -\def\bbl@inisec[#1]#2\@@{% if starts with opening bracket - \def\bbl@elt##1##2{% - \expandafter\toks@\expandafter{% - \expandafter{\bbl@section}{##1}{##2}}% - \bbl@exp{% - \\\g@addto@macro\\\bbl@inidata{\\\bbl@elt\the\toks@}}% - \bbl@inireader##1=##2\@@}% - \bbl@cs{renew@\bbl@section}% - \global\bbl@csarg\let{renew@\bbl@section}\relax - \bbl@cs{secpost@\bbl@section}% - % The previous code belongs to the previous section. - % -------------------------- - % Now start the current one. - \in@{=date.}{=#1}% - \ifin@ - \lowercase{\def\bbl@tempa{=#1=}}% - \bbl@replace\bbl@tempa{=date.gregorian}{}% - \bbl@replace\bbl@tempa{=date.}{}% - \in@{.licr=}{#1=}% - \ifin@ - \ifcase\bbl@engine - \bbl@replace\bbl@tempa{.licr=}{}% - \else - \let\bbl@tempa\relax + % Process stored data + \bbl@csarg\xdef{lini@\languagename}{#1}% + \let\bbl@savestrings\@empty + \let\bbl@savetoday\@empty + \let\bbl@savedate\@empty + \def\bbl@elt##1##2##3{% + \def\bbl@section{##1}% + \in@{=date.}{=##1}% Find a better place + \ifin@ + \bbl@ini@calendar{##1}% \fi - \fi - \ifx\bbl@tempa\relax\else - \bbl@replace\bbl@tempa{=}{}% - \bbl@exp{% - \def\####1=####2\\\@@{% - \\\bbl@inidate####1...\relax{####2}{\bbl@tempa}}}% - \fi - \fi - \def\bbl@section{#1}% - \def\bbl@elt##1##2{% - \@namedef{bbl@KVP@#1/##1}{}}% - \bbl@cs{renew@#1}% - \bbl@cs{secpre@#1}% pre-section `hook' - \bbl@ifunset{bbl@inikv@#1}% - {\let\bbl@inireader\bbl@iniskip}% - {\bbl@exp{\let\\\bbl@inireader\}}} -\let\bbl@renewlist\@empty + \global\bbl@csarg\let{bbl@KVP@##1/##2}\relax + \bbl@ifunset{bbl@inikv@##1}{}% + {\csname bbl@inikv@##1\endcsname{##2}{##3}}}% + \bbl@inidata + % 'Export' data + \bbl@ini@exports{#2}% + \global\bbl@csarg\let{inidata@\languagename}\bbl@inidata + \global\let\bbl@inidata\@empty + \bbl@exp{\\\bbl@add@list\\\bbl@ini@loaded{\languagename}}% + \bbl@toglobal\bbl@ini@loaded + \fi} +\def\bbl@ini@calendar#1{% + \lowercase{\def\bbl@tempa{=#1=}}% + \bbl@replace\bbl@tempa{=date.gregorian}{}% + \bbl@replace\bbl@tempa{=date.}{}% + \in@{.licr=}{#1=}% + \ifin@ + \ifcase\bbl@engine + \bbl@replace\bbl@tempa{.licr=}{}% + \else + \let\bbl@tempa\relax + \fi + \fi + \ifx\bbl@tempa\relax\else + \bbl@replace\bbl@tempa{=}{}% + \bbl@exp{% + \def\####1####2{% + \\\bbl@inidate####1...\relax{####2}{\bbl@tempa}}}% + \fi} \def\bbl@renewinikey#1/#2\@@#3{% - \bbl@ifunset{bbl@renew@#1}% - {\bbl@add@list\bbl@renewlist{#1}}% - {}% - \bbl@csarg\bbl@add{renew@#1}{\bbl@elt{#2}{#3}}} -\def\bbl@inikv#1=#2\@@{% key=value - \bbl@trim@def\bbl@tempa{#1}% - \bbl@trim\toks@{#2}% - \bbl@csarg\edef{@kv@\bbl@section.\bbl@tempa}{\the\toks@}} + \edef\bbl@tempa{\zap@space #1 \@empty}% section + \edef\bbl@tempb{\zap@space #2 \@empty}% key + \bbl@trim\toks@{#3}% value + \bbl@exp{% + \global\let\\\\@empty % just a flag + \\\g@addto@macro\\\bbl@inidata{% + \\\bbl@elt{\bbl@tempa}{\bbl@tempb}{\the\toks@}}}}% \def\bbl@exportkey#1#2#3{% \bbl@ifunset{bbl@@kv@#2}% {\bbl@csarg\gdef{#1@\languagename}{#3}}% @@ -2919,8 +2893,8 @@ From babel-\bbl@cs{lini@\languagename}.ini:\\% \bbl@cs{@kv@identification.warning#1}\\% Reported }}} -\let\bbl@inikv@identification\bbl@inikv -\def\bbl@secpost@identification{% +\def\bbl@ini@exports#1{% + % Identification always exported \bbl@iniwarning{}% \ifcase\bbl@engine \bbl@iniwarning{.pdflatex}% @@ -2940,13 +2914,38 @@ {\csname bbl@esname@\languagename\endcsname}}% \bbl@exportkey{sbcp}{identification.script.tag.bcp47}{}% \bbl@exportkey{sotf}{identification.script.tag.opentype}{DFLT}% + % Also maps bcp47 -> languagename \ifbbl@bcptoname \bbl@csarg\xdef{bcp@map@\bbl@cl{tbcp}}{\languagename}% + \fi + % Conditional + \ifnum#1>\z@ % 0 = only info, 1, 2 = basic, (re)new + \bbl@exportkey{lnbrk}{typography.linebreaking}{h}% + \bbl@exportkey{hyphr}{typography.hyphenrules}{}% + \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}% + \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}% + \bbl@exportkey{prehc}{typography.prehyphenchar}{}% + \bbl@exportkey{hyotl}{typography.hyphenate.other.locale}{}% + \bbl@exportkey{hyots}{typography.hyphenate.other.script}{}% + \bbl@exportkey{intsp}{typography.intraspace}{}% + \bbl@exportkey{chrng}{characters.ranges}{}% + \bbl@exportkey{dgnat}{numbers.digits.native}{}% + \bbl@exportkey{frspc}{typography.frenchspacing}{u}% + \ifnum#1=\tw@ % only (re)new + \bbl@exportkey{rqtex}{identification.require.babel}{}% + \bbl@toglobal\bbl@savetoday + \bbl@toglobal\bbl@savedate + \bbl@savestrings + \fi \fi} +\def\bbl@inikv#1#2{% key=value + \toks@{#2}% This hides #'s from ini values + \bbl@csarg\edef{@kv@\bbl@section.#1}{\the\toks@}} +\let\bbl@inikv@identification\bbl@inikv \let\bbl@inikv@typography\bbl@inikv \let\bbl@inikv@characters\bbl@inikv \let\bbl@inikv@numbers\bbl@inikv -\def\bbl@inikv@counters#1=#2\@@{% +\def\bbl@inikv@counters#1#2{% \bbl@ifsamestring{#1}{digits}% {\bbl@error{The counter name 'digits' is reserved for mapping\\% decimal digits}% @@ -2969,18 +2968,11 @@ \expandafter\bbl@buildifcase\bbl@tempb* \\ % Space after \\ \bbl@csarg{\global\expandafter\let}{cntr@#1@\languagename}\bbl@tempa \fi} -\def\bbl@after@ini{% - \bbl@linebreak@export - \bbl@exportkey{dgnat}{numbers.digits.native}{}% - \bbl@exportkey{rqtex}{identification.require.babel}{}% - \bbl@exportkey{frspc}{typography.frenchspacing}{u}% unset - \bbl@toglobal\bbl@savetoday - \bbl@toglobal\bbl@savedate} \ifcase\bbl@engine - \bbl@csarg\def{inikv@captions.licr}#1=#2\@@{% + \bbl@csarg\def{inikv@captions.licr}#1#2{% \bbl@ini@captions@aux{#1}{#2}} \else - \def\bbl@inikv@captions#1=#2\@@{% + \def\bbl@inikv@captions#1#2{% \bbl@ini@captions@aux{#1}{#2}} \fi \def\bbl@ini@captions@template#1#2{% string language tempa=capt-name @@ -3030,7 +3022,7 @@ \bbl@ifunset{bbl@map@#1@\languagename}% {\@nameuse{#1}}% {\@nameuse{bbl@map@#1@\languagename}}} -\def\bbl@inikv@labels#1=#2\@@{% +\def\bbl@inikv@labels#1#2{% \in@{.map}{#1}% \ifin@ \ifx\bbl@KVP@labels\@nil\else @@ -3218,7 +3210,7 @@ \def\bbl@xdatecntr[#1|#2]{\localenumeral{#2}{#1}} \def\bbl@provide@lsys#1{% \bbl@ifunset{bbl@lname@#1}% - {\bbl@ini@basic{#1}}% + {\bbl@load@info{#1}}% {}% \bbl@csarg\let{lsys@#1}\@empty \bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}% @@ -3262,11 +3254,10 @@ \fi}% {\hyphenchar\font\defaulthyphenchar}} % \fi} -\def\bbl@ini@basic#1{% +\def\bbl@load@info#1{% \def\BabelBeforeIni##1##2{% \begingroup - \bbl@add\bbl@secpost@identification{\closein\bbl@readstream }% - \bbl@read@ini{##1}1% + \bbl@read@ini{##1}0% \endinput % babel- .tex may contain onlypreamble's \endgroup}% boxed, to avoid extra spaces: {\bbl@input@texini{#1}}} @@ -3360,7 +3351,7 @@ \newcommand\BabelEnsureInfo{% \ifx\InputIfFileExists\@undefined\else \def\bbl@ensureinfo##1{% - \bbl@ifunset{bbl@lname@##1}{\bbl@ini@basic{##1}}{}}% + \bbl@ifunset{bbl@lname@##1}{\bbl@load@info{##1}}{}}% \fi \bbl@foreach\bbl@loaded{{% \def\languagename{##1}% diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty index b524f7ede80..b7dc33eea74 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.sty +++ b/Master/texmf-dist/tex/generic/babel/babel.sty @@ -33,7 +33,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{babel}[2021/01/26 3.53 The Babel package] +\ProvidesPackage{babel}[2021/02/22 3.54 The Babel package] \@ifpackagewith{babel}{debug} {\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}% \let\bbl@debug\@firstofone @@ -216,7 +216,7 @@ \else \expandafter\@firstofone \fi} - % Temporarily repeat here the code for errors + % Temporarily repeat here the code for errors. TODO. \def\bbl@error#1#2{% \begingroup \def\\{\MessageBreak}% @@ -239,16 +239,17 @@ \def\\{\MessageBreak}% \PackageInfo{babel}{#1}% \endgroup} - \def\bbl@nocaption{\protect\bbl@nocaption@i} +\def\bbl@nocaption{\protect\bbl@nocaption@i} \def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname \global\@namedef{#2}{\textbf{?#1?}}% \@nameuse{#2}% - \bbl@warning{% TODO. - \@backslashchar#2 not set. Please, define it\\% - after the language has been loaded (typically\\% - in the preamble) with the help of\\% - \string\setlocalecaption. An example is:\\% - \string\setlocalecaption{mylang}{chapter}{..}\\ + \edef\bbl@tempa{#1}% + \bbl@sreplace\bbl@tempa{name}{}% + \bbl@warning{% + \@backslashchar#1 not set for '\languagename'. Please,\\% + define it after the language has been loaded\\% + (typically in the preamble) with\\% + \string\setlocalecaption{\languagename}{\bbl@tempa}{..}\\% Reported}} \def\bbl@tentative{\protect\bbl@tentative@i} \def\bbl@tentative@i#1{% diff --git a/Master/texmf-dist/tex/generic/babel/hyphen.cfg b/Master/texmf-dist/tex/generic/babel/hyphen.cfg index ffcd74741e2..9ad1aa862e9 100644 --- a/Master/texmf-dist/tex/generic/babel/hyphen.cfg +++ b/Master/texmf-dist/tex/generic/babel/hyphen.cfg @@ -37,10 +37,10 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{hyphen.cfg}[2021/01/26 3.53 Babel hyphens] +\ProvidesFile{hyphen.cfg}[2021/02/22 3.54 Babel hyphens] \xdef\bbl@format{\jobname} -\def\bbl@version{3.53} -\def\bbl@date{2021/01/26} +\def\bbl@version{3.54} +\def\bbl@date{2021/02/22} \ifx\AtBeginDocument\@undefined \def\@empty{} \let\orig@dump\dump diff --git a/Master/texmf-dist/tex/generic/babel/luababel.def b/Master/texmf-dist/tex/generic/babel/luababel.def index 5f489e8062d..fb2459868e8 100644 --- a/Master/texmf-dist/tex/generic/babel/luababel.def +++ b/Master/texmf-dist/tex/generic/babel/luababel.def @@ -417,7 +417,7 @@ \let\bbl@cjkintraspace\relax \directlua{ Babel = Babel or {} - require'babel-data-cjk.lua' + require('babel-data-cjk.lua') Babel.cjk_enabled = true function Babel.cjk_linebreak(head) local GLYPH = node.id'glyph' @@ -1413,21 +1413,86 @@ end \ifcase\bbl@thetextdir \let\bbl@pictresetdir\relax \else - \bodydir TLT + \ifcase#1\bodydir TLT % Remember this sets the inner boxes + \or\textdir TLT + \else\bodydir TLT \textdir TLT + \fi % \(text|par)dir required in pgf: \def\bbl@pictresetdir{\bodydir TRT\pardir TRT\textdir TRT\relax}% \fi}% \ifx\AddToHook\@undefined\else - \AddToHook{env/picture/begin}{\bbl@pictsetdir\z@}% + \AddToHook{env/picture/begin}{\bbl@pictsetdir\tw@}% + \directlua{ + Babel.get_picture_dir = true + Babel.picture_has_bidi = 0 + function Babel.picture_dir (head) + if not Babel.get_picture_dir then return head end + for item in node.traverse(head) do + if item.id == node.id'glyph' then + local itemchar = item.char + % TODO. Copypaste pattern from Babel.bidi (-r) + local chardata = Babel.characters[itemchar] + local dir = chardata and chardata.d or nil + if not dir then + for nn, et in ipairs(Babel.ranges) do + if itemchar < et[1] then + break + elseif itemchar <= et[2] then + dir = et[3] + break + end + end + end + if dir and (dir == 'al' or dir == 'r') then + Babel.picture_has_bidi = 1 + end + end + end + return head + end + luatexbase.add_to_callback("hpack_filter", Babel.picture_dir, + "Babel.picture_dir") + }% + \AtBeginDocument{% + \long\def\put(#1,#2)#3{% + \@killglue + % Try: + \ifx\bbl@pictresetdir\relax + \def\bbl@tempc{0}% + \else + \directlua{ + Babel.get_picture_dir = true + Babel.picture_has_bidi = 0 + }% + \setbox\z@\hb@xt@\z@{% + \@defaultunitsset\@tempdimc{#1}\unitlength + \kern\@tempdimc + #3\hss}% + \edef\bbl@tempc{\directlua{tex.print(Babel.picture_has_bidi)}}% + \fi + % Do: + \@defaultunitsset\@tempdimc{#2}\unitlength + \raise\@tempdimc\hb@xt@\z@{% + \@defaultunitsset\@tempdimc{#1}\unitlength + \kern\@tempdimc + {\ifnum\bbl@tempc>\z@\bbl@pictresetdir\fi#3}\hss}% + \ignorespaces}% + \MakeRobust\put}% \fi \AtBeginDocument {\ifx\tikz@atbegin@node\@undefined\else \let\bbl@OL@pgfpicture\pgfpicture \bbl@sreplace\pgfpicture{\pgfpicturetrue}% - {\bbl@pictsetdir\@ne\pgfpicturetrue}% - \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir\@ne}% + {\bbl@pictsetdir\z@\pgfpicturetrue}% + \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir\z@}% \bbl@add\tikz@atbegin@node{\bbl@pictresetdir}% - \fi}} + \bbl@sreplace\tikz{\begingroup}% + {\begingroup\bbl@pictsetdir\tw@}% + \fi + \ifx\AddToHook\@undefined\else + \AddToHook{env/tcolorbox/begin}{\bbl@pictsetdir\@ne}% + \fi + }} {} \IfBabelLayout{counters}% {\let\bbl@OL@@textsuperscript\@textsuperscript diff --git a/Master/texmf-dist/tex/generic/babel/nil.ldf b/Master/texmf-dist/tex/generic/babel/nil.ldf index f909f2f9e48..68e9eaad3c4 100644 --- a/Master/texmf-dist/tex/generic/babel/nil.ldf +++ b/Master/texmf-dist/tex/generic/babel/nil.ldf @@ -32,7 +32,7 @@ %% extension |.ins|) which are part of the distribution. %% -\ProvidesLanguage{nil}[2021/01/26 3.53 Nil language] +\ProvidesLanguage{nil}[2021/02/22 3.54 Nil language] \LdfInit{nil}{datenil} \ifx\l@nil\@undefined \newlanguage\l@nil -- cgit v1.2.3