From d231c6331f53a048d29c2f847254a9f56d5ee2dd Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 3 Jun 2021 03:02:31 +0000 Subject: CTAN sync 202106030302 --- macros/latex/required/babel/base/README.md | 18 +- macros/latex/required/babel/base/babel.dtx | 309 ++++++++++++++------------ macros/latex/required/babel/base/babel.ins | 2 +- macros/latex/required/babel/base/babel.pdf | Bin 844087 -> 843759 bytes macros/latex/required/babel/base/bbcompat.dtx | 2 +- 5 files changed, 184 insertions(+), 147 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 bd9cd86eb0..f901605218 100644 --- a/macros/latex/required/babel/base/README.md +++ b/macros/latex/required/babel/base/README.md @@ -1,4 +1,4 @@ -## Babel 3.59 +## Babel 3.60 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.59 are described in: +Changes in version 3.60 are described in: -https://github.com/latex3/babel/blob/master/news-guides/news/whats-new-in-babel-3.59.md +https://github.com/latex3/babel/blob/master/news-guides/news/whats-new-in-babel-3.60.md Apart from the manual, you can find information on some aspects of babel at: @@ -46,12 +46,12 @@ respective authors. ### Summary of Latest changes ``` -3.59 2021-05-16 - * Tentative kashida with user-definable rules (via transforms). - * Fixes: - - \babel@texpdf inconsistently defined (#130) - - Partial fix for #131 (quotation with CJK). - * Removed doubleletter.hyphen (Norsk), which serves to nothing. +3.60 2021-06-02 + * A major fix for a bug with the latest LaTeX releases: class + options were messed up. + * Improved justification=kashida/elongated: lists, vowelized texts. + * Fix: Underfull \hbox with amsmath (#133). + * Improved the ini file for Basque (captions). ``` ### Previous changes diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx index 76bb9a1f93..257ecd3851 100644 --- a/macros/latex/required/babel/base/babel.dtx +++ b/macros/latex/required/babel/base/babel.dtx @@ -20,6 +20,7 @@ %% This work has the LPPL maintenance status "maintained". %% %% The Current Maintainer of this work is Javier Bezos. + %% %% The list of derived (unpacked) files belonging to the distribution %% and covered by LPPL is defined by the unpacking scripts (with @@ -31,7 +32,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2021/05/16 v3.59 The Babel package] +\ProvidesFile{babel.dtx}[2021/06/02 v3.60 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -4967,8 +4968,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 @@ -5435,14 +5436,14 @@ help from Bernd Raichle, for which I am grateful. Reported}} \def\@nolanerr#1{% \bbl@error - {You haven't defined the language #1\space yet.\\% + {You haven't defined the language '#1' yet.\\% Perhaps you misspelled it or your installation\\% is not complete}% {Your command will be ignored, type to proceed}} \def\@nopatterns#1{% \bbl@warning {No hyphenation patterns were preloaded for\\% - the language `#1' into the format.\\% + the language '#1' into the format.\\% Please, configure your TeX system to add them and\\% rebuild the format. Now I will use the patterns\\% preloaded for \bbl@nulllanguage\space instead}} @@ -5607,10 +5608,10 @@ help from Bernd Raichle, for which I am grateful. \bbl@csarg\edef{opt@#1}{#2}% \else \bbl@error - {Bad option `#1=#2'. Either you have misspelled the\\% - key or there is a previous setting of `#1'. Valid\\% - keys are, among others, `shorthands', `main', `bidi',\\% - `strings', `config', `headfoot', `safe', `math'.}% + {Bad option '#1=#2'. Either you have misspelled the\\% + key or there is a previous setting of '#1'. Valid\\% + keys are, among others, 'shorthands', 'main', 'bidi',\\% + 'strings', 'config', 'headfoot', 'safe', 'math'.}% {See the manual for further details.} \fi} % \end{macrocode} @@ -6534,8 +6535,8 @@ help from Bernd Raichle, for which I am grateful. \else \ifnum\bbl@bidimode>100 \ifnum\bbl@bidimode<200 \bbl@error - {The bidi method `basic' is available only in\\% - luatex. I'll continue with `bidi=default', so\\% + {The bidi method 'basic' is available only in\\% + luatex. I'll continue with 'bidi=default', so\\% expect wrong results}% {See the manual for further details.}% \let\bbl@beforeforeign\leavevmode @@ -6661,16 +6662,20 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@dirparastext{\pardir\the\textdir\relax}% %%%% % Sadly, we have to deal with boxes in math with basic. % Activated every math with the package option bidi=: - \def\bbl@mathboxdir{% - \ifcase\bbl@thetextdir\relax - \everyhbox{\textdir TLT\relax}% - \else - \everyhbox{\textdir TRT\relax}% - \fi} - \frozen@everymath\expandafter{% - \expandafter\bbl@mathboxdir\the\frozen@everymath} - \frozen@everydisplay\expandafter{% - \expandafter\bbl@mathboxdir\the\frozen@everydisplay} + \ifnum\bbl@bidimode>\z@ + \def\bbl@mathboxdir{% + \ifcase\bbl@thetextdir\relax + \everyhbox{\bbl@mathboxdir@aux L}% + \else + \everyhbox{\bbl@mathboxdir@aux R}% + \fi} + \def\bbl@mathboxdir@aux#1{% + \@ifnextchar\egroup{}{\textdir T#1T\relax}} + \frozen@everymath\expandafter{% + \expandafter\bbl@mathboxdir\the\frozen@everymath} + \frozen@everydisplay\expandafter{% + \expandafter\bbl@mathboxdir\the\frozen@everydisplay} + \fi \else % pdftex=0, xetex=2 \newcount\bbl@dirlevel \chardef\bbl@thetextdir\z@ @@ -6832,7 +6837,7 @@ help from Bernd Raichle, for which I am grateful. \expandafter\let\expandafter\BabelModifiers \csname bbl@mod@\CurrentOption\endcsname}% {\bbl@error{% - Unknown option `\CurrentOption'. Either you misspelled it\\% + Unknown option '\CurrentOption'. Either you misspelled it\\% or the language definition file \CurrentOption.ldf was not found}{% Valid options are, among others: shorthands=, KeepShorthandsActive,\\% activeacute, activegrave, noconfigs, safe=, main=, math=\\% @@ -6884,7 +6889,7 @@ help from Bernd Raichle, for which I am grateful. * Local config file \bbl@opt@config.cfg used^^J% *}}% {\bbl@error{% - Local config file `\bbl@opt@config.cfg' not found}{% + Local config file '\bbl@opt@config.cfg' not found}{% Perhaps you misspelled it.}}% \fi % \end{macrocode} @@ -6943,19 +6948,27 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@tempb\@nnil \bbl@foreach\@classoptionslist{% \bbl@ifunset{ds@#1}% - {\IfFileExists{#1.ldf}{}% - {\IfFileExists{babel-#1.tex}{}{\@namedef{ds@#1}{}}}}% - {}% - \bbl@ifunset{ds@#1}% - {\def\bbl@tempb{#1}% - \DeclareOption{#1}{% - \ifnum\bbl@iniflag>\@ne - \bbl@ldfinit - \babelprovide[import]{#1}% - \bbl@afterldf{}% - \else - \bbl@load@language{#1}% - \fi}}% + {\IfFileExists{#1.ldf}% + {\def\bbl@tempb{#1}% + \DeclareOption{#1}{% + \ifnum\bbl@iniflag>\@ne + \bbl@ldfinit + \babelprovide[import]{#1}% + \bbl@afterldf{}% + \else + \bbl@load@language{#1}% + \fi}}% + {\IfFileExists{babel-#1.tex}% TODO. Copypaste pattern + {\def\bbl@tempb{#1}% + \DeclareOption{#1}{% + \ifnum\bbl@iniflag>\@ne + \bbl@ldfinit + \babelprovide[import]{#1}% + \bbl@afterldf{}% + \else + \bbl@load@language{#1}% + \fi}}% + {}}}% {}} % \end{macrocode} % @@ -7013,10 +7026,10 @@ help from Bernd Raichle, for which I am grateful. \expandafter\bbl@tempa\bbl@loaded,\@nnil \ifx\bbl@tempb\bbl@tempc\else \bbl@warning{% - Last declared language option is `\bbl@tempc',\\% - but the last processed one was `\bbl@tempb'.\\% - The main language cannot be set as both a global\\% - and a package option. Use `main=\bbl@tempc' as\\% + Last declared language option is '\bbl@tempc',\\% + but the last processed one was '\bbl@tempb'.\\% + The main language can't be set as both a global\\% + and a package option. Use 'main=\bbl@tempc' as\\% option. Reported}% \fi \else @@ -7555,7 +7568,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@iflanguage\languagename{% \expandafter\ifx\csname date\languagename\endcsname\relax \bbl@error - {Unknown language `\languagename'. Either you have\\% + {Unknown language '\languagename'. 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. In\\% @@ -7832,7 +7845,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@iflanguage\languagename{% \expandafter\ifx\csname date\languagename\endcsname\relax \bbl@warning % TODO - why a warning, not an error? - {Unknown language `#1'. Either you have\\% + {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. In\\% @@ -8089,14 +8102,14 @@ help from Bernd Raichle, for which I am grateful. Reported}} \def\@nolanerr#1{% \bbl@error - {You haven't defined the language #1\space yet.\\% + {You haven't defined the language '#1' yet.\\% Perhaps you misspelled it or your installation\\% is not complete}% {Your command will be ignored, type to proceed}} \def\@nopatterns#1{% \bbl@warning {No hyphenation patterns were preloaded for\\% - the language `#1' into the format.\\% + the language '#1' into the format.\\% Please, configure your TeX system to add them and\\% rebuild the format. Now I will use the patterns\\% preloaded for \bbl@nulllanguage\space instead}} @@ -9182,7 +9195,7 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\@notshorthand#1{% \bbl@error{% - The character `\string #1' should be made a shorthand character;\\% + The character '\string #1' should be made a shorthand character;\\% add the command \string\useshorthands\string{#1\string} to the preamble.\\% I will ignore your instruction}% @@ -9225,7 +9238,7 @@ help from Bernd Raichle, for which I am grateful. \ifx#2\@nnil\else \bbl@ifunset{bbl@active@\string#2}% {\bbl@error - {I cannot switch `\string#2' on or off--not a shorthand}% + {I can't switch '\string#2' on or off--not a shorthand}% {This character is not a shorthand. Maybe you made\\% a typing mistake? I will ignore your instruction.}}% {\ifcase#1% off, on, off* @@ -10954,8 +10967,8 @@ help from Bernd Raichle, for which I am grateful. % For bidi texts, to switch the font based on direction \ifx\bbl@KVP@mapfont\@nil\else \bbl@ifsamestring{\bbl@KVP@mapfont}{direction}{}% - {\bbl@error{Option `\bbl@KVP@mapfont' unknown for\\% - mapfont. Use `direction'.% + {\bbl@error{Option '\bbl@KVP@mapfont' unknown for\\% + mapfont. Use 'direction'.% {See the manual for details.}}}% \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}% @@ -13770,6 +13783,8 @@ help from Bernd Raichle, for which I am grateful. Babel.arabic.elong_map[\the\localeid] = {} luatexbase.add_to_callback('post_linebreak_filter', Babel.arabic.justify, 'Babel.arabic.justify') +% luatexbase.add_to_callback('hpack_filter', +% Babel.arabic.justify_hbox, 'Babel.arabic.justify_hbox') }}% % Save both node lists to make replacement. TODO. Save also widths to % make computations @@ -13840,112 +13855,134 @@ Babel.arabic.justify_enabled = true function Babel.arabic.justify(head) if not Babel.arabic.justify_enabled then return head end + for line in node.traverse_id(node.id'hlist', head) do + Babel.arabic.justify_hlist(head, line) + end + return head +end + +function Babel.arabic.justify_hbox(head, gc, size, pack) + if Babel.arabic.justify_enabled and pack == 'exactly' then + Babel.arabic.justify_hlist(head, nil, gc, size, pack) + end + return head +end + +function Babel.arabic.justify_hlist(head, line, gc, size, pack) local d, new local k_list, k_item, pos_inline - local width, width_new, full, k_curr, wt_pos, goal + local width, width_new, full, k_curr, wt_pos, goal, shift local subst_done = false local elong_map = Babel.arabic.elong_map local last_line local GLYPH = node.id'glyph' local KASHIDA = luatexbase.registernumber'bblar@kashida' local LOCALE = luatexbase.registernumber'bbl@attr@locale' + + if line == nil then + line = {} + line.glue_sign = 1 + line.glue_order = 0 + line.head = head + line.shift = 0 + line.width = size + end - for line in node.traverse_id(node.id'hlist', head) do - % Exclude last line. todo. But-- it discards one-word lines, too! - % ? Look for glue = 12:15 - if (line.glue_sign == 1 and line.glue_order == 0) then - elongs = {} % Stores elongated candidates of each line - k_list = {} % And all letters with kashida - pos_inline = 0 % Not yet used - - for n in node.traverse_id(GLYPH, line.head) do - pos_inline = pos_inline + 1 % To find where it is. Not used. - - % Elongated glyphs - if elong_map then - local locale = node.get_attribute(n, LOCALE) - if elong_map[locale] and elong_map[locale][n.font] and - elong_map[locale][n.font][n.char] then - table.insert(elongs, {node = n, locale = locale} ) - node.set_attribute(n.prev, KASHIDA, 0) - end + % Exclude last line. todo. But-- it discards one-word lines, too! + % ? Look for glue = 12:15 + if (line.glue_sign == 1 and line.glue_order == 0) then + elongs = {} % Stores elongated candidates of each line + k_list = {} % And all letters with kashida + pos_inline = 0 % Not yet used + + for n in node.traverse_id(GLYPH, line.head) do + pos_inline = pos_inline + 1 % To find where it is. Not used. + + % Elongated glyphs + if elong_map then + local locale = node.get_attribute(n, LOCALE) + if elong_map[locale] and elong_map[locale][n.font] and + elong_map[locale][n.font][n.char] then + table.insert(elongs, {node = n, locale = locale} ) + node.set_attribute(n.prev, KASHIDA, 0) end + end - % Tatwil - if Babel.kashida_wts then - local k_wt = node.get_attribute(n, KASHIDA) - if k_wt > 0 then % todo. parameter for multi inserts - table.insert(k_list, {node = n, weight = k_wt, pos = pos_inline}) - end + % Tatwil + if Babel.kashida_wts then + local k_wt = node.get_attribute(n, KASHIDA) + if k_wt > 0 then % todo. parameter for multi inserts + table.insert(k_list, {node = n, weight = k_wt, pos = pos_inline}) end - - end % of node.traverse_id - - if #elongs == 0 and #k_list == 0 then goto next_line end - - full = line.width - goal = full * Babel.arabic.justify_factor % A bit crude - width = node.dimensions(line.head) % The 'natural' width - - % == Elongated == - % Original idea taken from 'chikenize' - while (#elongs > 0 and width < goal) do - subst_done = true - local x = #elongs - local curr = elongs[x].node - local oldchar = curr.char - curr.char = elong_map[elongs[x].locale][curr.font][curr.char] - width = node.dimensions(line.head) % Check if the line is too wide - % Substitute back if the line would be too wide and break: - if width > goal then - curr.char = oldchar - break - end - % If continue, pop the just substituted node from the list: - table.remove(elongs, x) end - % == Tatwil == - if #k_list == 0 then goto next_line end - - width = node.dimensions(line.head) % The 'natural' width - k_curr = #k_list - wt_pos = 1 - - while width < goal do - subst_done = true - k_item = k_list[k_curr].node - if k_list[k_curr].weight == Babel.kashida_wts[wt_pos] then - d = node.copy(k_item) - d.char = 0x0640 - line.head, new = node.insert_after(line.head, k_item, d) - width_new = node.dimensions(line.head) - if width > goal or width == width_new then - node.remove(line.head, new) % Better compute before - break - end - width = width_new - end - if k_curr == 1 then - k_curr = #k_list - wt_pos = (wt_pos >= table.getn(Babel.kashida_wts)) and 1 or wt_pos+1 - else - k_curr = k_curr - 1 + end % of node.traverse_id + + if #elongs == 0 and #k_list == 0 then goto next_line end + full = line.width + shift = line.shift + goal = full * Babel.arabic.justify_factor % A bit crude + width = node.dimensions(line.head) % The 'natural' width + + % == Elongated == + % Original idea taken from 'chikenize' + while (#elongs > 0 and width < goal) do + subst_done = true + local x = #elongs + local curr = elongs[x].node + local oldchar = curr.char + curr.char = elong_map[elongs[x].locale][curr.font][curr.char] + width = node.dimensions(line.head) % Check if the line is too wide + % Substitute back if the line would be too wide and break: + if width > goal then + curr.char = oldchar + break + end + % If continue, pop the just substituted node from the list: + table.remove(elongs, x) + end + + % == Tatwil == + if #k_list == 0 then goto next_line end + + width = node.dimensions(line.head) % The 'natural' width + k_curr = #k_list + wt_pos = 1 + + while width < goal do + subst_done = true + k_item = k_list[k_curr].node + if k_list[k_curr].weight == Babel.kashida_wts[wt_pos] then + d = node.copy(k_item) + d.char = 0x0640 + line.head, new = node.insert_after(line.head, k_item, d) + width_new = node.dimensions(line.head) + if width > goal or width == width_new then + node.remove(line.head, new) % Better compute before + break end + width = width_new end + if k_curr == 1 then + k_curr = #k_list + wt_pos = (wt_pos >= table.getn(Babel.kashida_wts)) and 1 or wt_pos+1 + else + k_curr = k_curr - 1 + end + end - ::next_line:: + ::next_line:: - % Must take into account marks and ins, see luatex manual. - % Have to be executed only if there are changes. Investigate - % what's going on exactly. - if subst_done then - node.insert_before(head, line, node.hpack(line.head, full, 'exactly')) - node.remove(head, line) - end - end % if process line - end % for lines - return head + % Must take into account marks and ins, see luatex manual. + % Have to be executed only if there are changes. Investigate + % what's going on exactly. + if subst_done and not gc then + d = node.hpack(line.head, full, 'exactly') + d.shift = shift + node.insert_before(head, line, d) + node.remove(head, line) + end + end % if process line end } \endgroup diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins index 064fd5a50c..448f711c9e 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{2021/05/16} +\def\filedate{2021/06/02} \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 f8be6b4104..a184df48a2 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 4310c06af1..601f524b83 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}[2021/05/16 v3.59] +\ProvidesFile{bbcompat.dtx}[2021/06/02 v3.60] % % %% File 'bbcompat.dtx' -- cgit v1.2.3