From 989493fc0cf04ec736a261d39eee40e1d7bdf4be Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 23 May 2022 03:03:21 +0000 Subject: CTAN sync 202205230303 --- macros/latex/required/babel/base/README.md | 23 ++- macros/latex/required/babel/base/babel.dtx | 255 ++++++++++++++++++-------- macros/latex/required/babel/base/babel.ins | 2 +- macros/latex/required/babel/base/babel.pdf | Bin 857732 -> 861855 bytes macros/latex/required/babel/base/bbcompat.dtx | 2 +- 5 files changed, 201 insertions(+), 81 deletions(-) (limited to 'macros/latex/required') diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md index 537cda320d..2342ebae59 100644 --- a/macros/latex/required/babel/base/README.md +++ b/macros/latex/required/babel/base/README.md @@ -1,4 +1,4 @@ -## Babel 3.74 +## Babel 3.75 This package manages culturally-determined typographical (and other) rules, and hyphenation patterns for a wide range of languages. Many @@ -8,9 +8,9 @@ is a set of ini files for about 250 languages. The latest stable version is available on . -Changes in version 3.74 are described in: +Changes in version 3.75 are described in: -https://latex3.github.io/babel/news/whats-new-in-babel-3.74.html +https://latex3.github.io/babel/news/whats-new-in-babel-3.75.html Apart from the manual, you can find information on some aspects of babel at: @@ -46,11 +46,20 @@ respective authors. ### Summary of latest changes ``` -3.74 2022-04-30 +3.75 2022-05-22 + * `\BabelEnsureInfo` is active by default, to make sure the BCP 47 + codes are always available, as they may be required by the + LaTeX kernel. + * `\localeinfo*` is like `\localeinfo` but expands to empty if + unknown (fully expandable). + * The key `character`/`ranges` in `ini` files now sets the + corresponding Unicode script ranges (as used by `onchar`). * Fixes: - - Error in transforms if | is active. - - Minor fixes in Khemer, Turkmen, Marathi. - * RTL math improved (with luatex). + - Misplaced rule un diagbox (#43) + - Caption names of 'chapter' and 'part' swapped in Chinese (#180). + - Captions after numbers in Lithuanian. + - `hyphenrules` in the `ini` files for `en-AU` and + `en-NZ` where set to `english` instead of `ukenglish`. ``` ### Previous changes diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx index 980ab2b11e..6bc32b0c7b 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}[2022/04/30 v3.74 The Babel package] +\ProvidesFile{babel.dtx}[2022/05/22 v3.75 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -184,11 +184,7 @@ Poppelier, Piet van Oostrum and many others have been used. Bernd Raichle has provided many helpful suggestions.}} \author{Johannes Braams\\ - Kersengaarde 33\\ - 2723 BP Zoetermeer\\ - The Netherlands\\ - \normalsize From version 3.9 on, Javier Bezos\\ - \normalsize \texttt{www.texnia.com}} + Javier Bezos} \date{Typeset \today} \begin{titlepage} @@ -213,12 +209,12 @@ Version \csname @gobble\expandafter\endcsname\fileversion\newline \LARGE \vspace{1.2cm} -Johannes L. Braams\\[-.5ex] -{\large Original author} - -\vspace{.3cm} Javier Bezos\\[-.5ex] {\large Current maintainer} + +\vspace{.3cm} +Johannes L. Braams\\[-.5ex] +{\large Original author} \end{minipage} &\cellcolor[rgb]{.92, .86, .73} \vspace{2cm} @@ -2890,7 +2886,8 @@ argument is the name of a language; the second and third arguments are the actions to take if the result of the test is true or false respectively. -\Describe{\localeinfo}{\marg{field}} +\Describe{\localeinfo}{% + \colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}{\marg{field}}} \New{3.38} If an |ini| file has been loaded for the current language, you may access the information stored in it. This macro is fully @@ -2902,15 +2899,30 @@ expandable, and the available fields are: %%% activated because the bug in \languagename is far from trivial. \item[|tag.ini|] is the tag of the |ini| file (the way this file is identified in its name). -\item[|tag.bcp47|] is the full BCP 47 tag (see the warning below). +\item[|tag.bcp47|] is the full BCP 47 tag (see the warning below). This + is the value to be used for the ‘real' provided tag (\babel{} may + fill other fields if they are considered necessary). \item[|language.tag.bcp47|] is the BCP 47 language tag. \item[|tag.opentype|] is the tag used by OpenType (usually, but not always, the same as BCP 47). \item[|script.name|], as provided by the Unicode CLDR. \item[|script.tag.bcp47|] is the BCP 47 tag of the script - used by this locale. + used by this locale. This is a required field for the fonts to be + correctly set up, and therefore it should be always defined. \item[|script.tag.opentype|] is the tag used by OpenType (usually, but not always, the same as BCP 47). +\item[|region.tag.bcp47|] is the BCP 47 tag of the region or territory. + Defined only if the locale loaded actually contains it (eg, |es-MX| + does, but |es| doesn’t), which is how locales behave in the CLDR. + \New{3.75} +\item[|variant.tag.bcp47|] is the BCP 47 tag of the variant (in the BCP 47 + sense, like |1901| for German). \New{3.75} +\item[|extension.|\m{s}|.tag.bcp47|] is the BCP 47 value of the + 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. + \New{3.75} \end{description} \begin{warning} @@ -2919,6 +2931,18 @@ expandable, and the available fields are: counterintuitive. \end{warning} +\New{3.75} Sometimes, it comes in handy to be able to use |\localeinfo| +in an expandable way even if something went wrong (for example, the +locale currently active is undefined). For these cases, |localeinfo*| +just returns an empty string instead of raising an error. Bear in mind +that \babel{}, following the CLDR, may leave the region unset, which +means |\getlanguageproperty*|, described below, is the preferred +command, so that the existence of a field can be checked before. This +also means building a string with the language and the region with +|\localeinfo*{language.tab.bcp47}|\allowbreak |-|\allowbreak +|\localeinfo*{region.tab.bcp47}| is not usually a good idea (because of +the hyphen). + \Describe{\getlocaleproperty}{% \colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}% \marg{macro}\marg{locale}\marg{property}} @@ -2955,12 +2979,15 @@ named |\LocaleForEach| to traverse the list, where |#1| is the name of the current item, so that |\LocaleForEach{\message{ **#1** }}| just shows the loaded |ini|’s. -\Describe{\BabelEnsureInfo}{} -|ini| files are loaded with |\babelprovide| and also when languages are -selected if there is a |\babelfont| or they have not been explicitly -declared. To ensure the |ini| files are loaded (and therefore the -corresponding data) even if these two conditions are not met, write -|\BabelEnsureInfo| in the preamble. +\Describe{ensureinfo=off}{} +\New{3.75} Previously, |ini| files are loaded only with |\babelprovide| +and also when languages are selected if there is a |\babelfont| or they +have not been explicitly declared. Now the |ini| files are loaded (and +therefore the corresponding data) even if these two conditions are not +met (in previous versions you had to enable it with |\BabelEnsureInfo| +in the preamble). Because of the way this feature works, problems are +very unlikely, but there is switch as a package option to turn the new +behavior off (|ensureinfo=off|). \subsection{Hyphenation and line breaking} @@ -5116,8 +5143,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 @@ -9747,6 +9774,11 @@ help from Bernd Raichle, for which I am grateful. \fi \ifx\bbl@KVP@language\@nil\else \bbl@csarg\edef{lname@#2}{\bbl@KVP@language}% + \fi + \ifcase\bbl@engine\or + \bbl@ifunset{bbl@chrng@\languagename}{}% + {\directlua{ + Babel.set_chranges_b('\bbl@cl{sbcp}', '\bbl@cl{chrng}') }}% \fi % == onchar == \ifx\bbl@KVP@onchar\@nil\else @@ -10251,6 +10283,10 @@ help from Bernd Raichle, for which I am grateful. \ifin@ \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} @@ -10360,6 +10396,24 @@ 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 @@ -10383,6 +10437,9 @@ 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}% + \bbl@exportkey{rbcp}{identification.region.tag.bcp47}{}% + \bbl@exportkey{vbcp}{identification.variant.tag.bcp47}{}% + \bbl@moreinfo % Also maps bcp47 -> languagename \ifbbl@bcptoname \bbl@csarg\xdef{bcp@map@\bbl@cl{tbcp}}{\languagename}% @@ -10951,13 +11008,21 @@ help from Bernd Raichle, for which I am grateful. % following macro just exposes it with a user command. % % \begin{macrocode} +\def\bbl@localeinfo#1#2{% + \bbl@ifunset{bbl@info@#2}{#1}% + {\bbl@ifunset{bbl@\csname bbl@info@#2\endcsname @\languagename}{#1}% + {\bbl@cs{\csname bbl@info@#2\endcsname @\languagename}}}} \newcommand\localeinfo[1]{% - \bbl@ifunset{bbl@\csname bbl@info@#1\endcsname @\languagename}% - {\bbl@error{I've found no info for the current locale.\\% - The corresponding ini file has not been loaded\\% - Perhaps it doesn't exist}% - {See the manual for details.}}% - {\bbl@cs{\csname bbl@info@#1\endcsname @\languagename}}} + \ifx*#1\@empty % TODO. A bit hackish to make it expandable. + \bbl@afterelse\bbl@localeinfo{}% + \else + \bbl@localeinfo + {\bbl@error{I've found no info for the current locale.\\% + The corresponding ini file has not been loaded\\% + Perhaps it doesn't exist}% + {See the manual for details.}}% + {#1}% + \fi} % \@namedef{bbl@info@name.locale}{lcname} \@namedef{bbl@info@tag.ini}{lini} \@namedef{bbl@info@name.english}{elname} @@ -10968,7 +11033,22 @@ help from Bernd Raichle, for which I am grateful. \@namedef{bbl@info@script.name}{esname} \@namedef{bbl@info@script.name.opentype}{sname} \@namedef{bbl@info@script.tag.bcp47}{sbcp} -\@namedef{bbl@info@script.tag.opentype}{sotf} +\@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}} +% \end{macrocode} +% +% With version 3.75 |\BabelEnsureInfo| is executed always, but there is +% an option to disable it. +% +% \begin{macrocode} +%<<*More package options>> +\DeclareOption{ensureinfo=off}{} +%<> +% \let\bbl@ensureinfo\@gobble \newcommand\BabelEnsureInfo{% \ifx\InputIfFileExists\@undefined\else @@ -10978,12 +11058,15 @@ help from Bernd Raichle, for which I am grateful. \bbl@foreach\bbl@loaded{{% \def\languagename{##1}% \bbl@ensureinfo{##1}}}} +\@ifpackagewith{babel}{ensureinfo=off}{}% + {\AtEndOfPackage{% Test for plain. + \ifx\@undefined\bbl@loaded\else\BabelEnsureInfo\fi}} % \end{macrocode} % % More general, but non-expandable, is |\getlocaleproperty|. To inspect % every possible loaded |ini|, we define |\LocaleForEach|, where % |\bbl@ini@loaded| is a comma-separated list of locales, built by -% |\bbl@read@ini|. +% |\bbl@read@ini|. % % \begin{macrocode} \newcommand\getlocaleproperty{% @@ -11791,11 +11874,7 @@ help from Bernd Raichle, for which I am grateful. % latter solution will be eventually removed). % % \begin{macrocode} -\bbl@ifformatlater{2021-06-01}% - {\def\bbl@patchfont#1{\AddToHook{selectfont}{#1}}} - {\def\bbl@patchfont#1{% - \expandafter\bbl@add\csname selectfont \endcsname{#1}% - \expandafter\bbl@toglobal\csname selectfont \endcsname}} +\def\bbl@patchfont#1{\AddToHook{selectfont}{#1}} % \end{macrocode} % % \end{macro} @@ -13524,6 +13603,15 @@ help from Bernd Raichle, for which I am grateful. end return has_bidi end + function Babel.set_chranges_b (script, chrng) + if chrng == '' then return end + texio.write('Replacing ' .. script .. ' script ranges') + Babel.script_blocks[script] = {} + for s, e in string.gmatch(chrng..' ', '(.-)%.%.(.-)%s') do + table.insert( + Babel.script_blocks[script], {tonumber(s,16), tonumber(e,16)}) + end + end } \endgroup \ifx\newattribute\@undefined\else @@ -14767,22 +14855,21 @@ end % \(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\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 - if Babel.hlist_has_bidi(head) then - Babel.picture_has_bidi = 1 - end - return head + \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 + if Babel.hlist_has_bidi(head) then + Babel.picture_has_bidi = 1 end - luatexbase.add_to_callback("hpack_filter", Babel.picture_dir, - "Babel.picture_dir") - }% + return head + end + luatexbase.add_to_callback("hpack_filter", Babel.picture_dir, + "Babel.picture_dir") + }% \AtBeginDocument{% \long\def\put(#1,#2)#3{% \@killglue @@ -14797,7 +14884,7 @@ end \setbox\z@\hb@xt@\z@{% \@defaultunitsset\@tempdimc{#1}\unitlength \kern\@tempdimc - #3\hss}% + #3\hss}% TODO: #3 executed twice (below). That’s bad. \edef\bbl@tempc{\directlua{tex.print(Babel.picture_has_bidi)}}% \fi % Do: @@ -14807,35 +14894,26 @@ end \kern\@tempdimc {\ifnum\bbl@tempc>\z@\bbl@pictresetdir\fi#3}\hss}% \ignorespaces}% - \MakeRobust\put}% - \fi + \MakeRobust\put}% \AtBeginDocument - {\ifx\pgfpicture\@undefined\else % TODO. Allow deactivate? - \ifx\AddToHook\@undefined - \bbl@sreplace\pgfpicture{\pgfpicturetrue}% - {\bbl@pictsetdir\z@\pgfpicturetrue}% - \else - \AddToHook{env/pgfpicture/begin}{\bbl@pictsetdir\@ne}% - \fi + {\AddToHook{cmd/diagbox@pict/before}{\let\bbl@pictsetdir\@gobble}% + \ifx\pgfpicture\@undefined\else % TODO. Allow deactivate? + \AddToHook{env/pgfpicture/begin}{\bbl@pictsetdir\@ne}% \bbl@add\pgfinterruptpicture{\bbl@pictresetdir}% \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir\z@}% \fi - \ifx\tikzpicture\@undefined\else - \ifx\AddToHook\@undefined\else - \AddToHook{env/tikzpicture/begin}{\bbl@pictsetdir\z@}% - \fi + \ifx\tikzpicture\@undefined\else + \AddToHook{env/tikzpicture/begin}{\bbl@pictsetdir\z@}% \bbl@add\tikz@atbegin@node{\bbl@pictresetdir}% \bbl@sreplace\tikz{\begingroup}{\begingroup\bbl@pictsetdir\tw@}% \fi - \ifx\AddToHook\@undefined\else - \ifx\tcolorbox\@undefined\else - \AddToHook{env/tcolorbox/begin}{\bbl@pictsetdir\@ne}% - \bbl@sreplace\tcb@savebox - {\ignorespaces}{\ignorespaces\bbl@pictresetdir}% - \ifx\tikzpicture@tcb@hooked\@undefined\else - \bbl@sreplace\tikzpicture@tcb@hooked{\noexpand\tikzpicture}% - {\textdir TLT\noexpand\tikzpicture}% - \fi + \ifx\tcolorbox\@undefined\else + \AddToHook{env/tcolorbox/begin}{\bbl@pictsetdir\@ne}% + \bbl@sreplace\tcb@savebox + {\ignorespaces}{\ignorespaces\bbl@pictresetdir}% + \ifx\tikzpicture@tcb@hooked\@undefined\else + \bbl@sreplace\tikzpicture@tcb@hooked{\noexpand\tikzpicture}% + {\textdir TLT\noexpand\tikzpicture}% \fi \fi }} @@ -22564,6 +22642,39 @@ Babel.cjk_breaks = { % \end{macro} % \end{macro} % +% There is no locale file for this pseudo-language, so the +% corresponding fields are defined here. +% +% \begin{macrocode} +\def\bbl@inidata@nil{% + \bbl@elt{identification}{tag.ini}{und}% + \bbl@elt{identification}{load.level}{0}% + \bbl@elt{identification}{charset}{utf8}% + \bbl@elt{identification}{version}{1.0}% + \bbl@elt{identification}{date}{2022-05-16}% + \bbl@elt{identification}{name.local}{nil}% + \bbl@elt{identification}{name.english}{nil}% + \bbl@elt{identification}{name.babel}{nil}% + \bbl@elt{identification}{tag.bcp47}{und}% + \bbl@elt{identification}{language.tag.bcp47}{und}% + \bbl@elt{identification}{tag.opentype}{dflt}% + \bbl@elt{identification}{script.name}{Latin}% + \bbl@elt{identification}{script.tag.bcp47}{Latn}% + \bbl@elt{identification}{script.tag.opentype}{DFLT}% + \bbl@elt{identification}{level}{1}% + \bbl@elt{identification}{encodings}{}% + \bbl@elt{identification}{derivate}{no}} +\@namedef{bbl@tbcp@nil}{und} +\@namedef{bbl@lbcp@nil}{und} +\@namedef{bbl@lotf@nil}{dflt} +\@namedef{bbl@elname@nil}{nil} +\@namedef{bbl@lname@nil}{nil} +\@namedef{bbl@esname@nil}{Latin} +\@namedef{bbl@sname@nil}{Latin} +\@namedef{bbl@sbcp@nil}{Latn} +\@namedef{bbl@sotf@nil}{Latn} +% \end{macrocode} +% % The macro |\ldf@finish| takes care of looking for a % configuration file, setting the main language to be switched on % at |\begin{document}| and resetting the category code of diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins index 1c80ae6d80..188056d227 100644 --- a/macros/latex/required/babel/base/babel.ins +++ b/macros/latex/required/babel/base/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{2022/04/30} +\def\filedate{2022/05/22} \def\batchfile{babel.ins} \input docstrip.tex diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf index b68346d6e5..52960c988b 100644 Binary files a/macros/latex/required/babel/base/babel.pdf and b/macros/latex/required/babel/base/babel.pdf differ diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx index b7a7c3dfbc..725de441f2 100644 --- a/macros/latex/required/babel/base/bbcompat.dtx +++ b/macros/latex/required/babel/base/bbcompat.dtx @@ -30,7 +30,7 @@ % % \iffalse %<*dtx> -\ProvidesFile{bbcompat.dtx}[2022/04/30 v3.74] +\ProvidesFile{bbcompat.dtx}[2022/05/22 v3.75] % % %% File 'bbcompat.dtx' -- cgit v1.2.3