From 31d38d879db092b485e49e1b7c79f96c312fd1fb Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 8 Apr 2021 03:01:42 +0000 Subject: CTAN sync 202104080301 --- macros/latex/required/babel/base/README.md | 26 ++--- macros/latex/required/babel/base/babel.dtx | 139 ++++++++++++++++++++------ macros/latex/required/babel/base/babel.ins | 2 +- macros/latex/required/babel/base/babel.pdf | Bin 824234 -> 826256 bytes macros/latex/required/babel/base/bbcompat.dtx | 2 +- 5 files changed, 122 insertions(+), 47 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 723cf41d82..6d8f47c18c 100644 --- a/macros/latex/required/babel/base/README.md +++ b/macros/latex/required/babel/base/README.md @@ -1,4 +1,4 @@ -## Babel 3.56 +## Babel 3.57 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.56 are described in: +Changes in version 3.57 are described in: -https://github.com/latex3/babel/blob/master/news-guides/news/whats-new-in-babel-3.56.md +https://github.com/latex3/babel/blob/master/news-guides/news/whats-new-in-babel-3.57.md Apart from the manual, you can find information on some aspects of babel at: @@ -46,16 +46,16 @@ respective authors. ### Summary of Latest changes ``` -3.56 2021-03-24 - * Transforms (\babelprehyphenation, \babelposthyphenation) - - Key 'space', in em units. - - Key 'spacefactor', based on the current word separation. - - Multiple 'insert's allowed. - - Definable in 'ini' files. - - Arbitrary characters in pattern. - * Fixes: - - 'insert' and 'data' didn't always set/get the expected node. - - Hyphen was not shown in Marathi (#123) +3.57 2021-04-07 + * Predefined transforms (lua): + - Arabic: transliteration.dad + - Croatian: digraphs.ligatures + - Greek: diaeresis.hyphen + - Hindi: transliteration.hk + - Hungarian: digraphs.hyphen + * Transforms: {xxxx} syntax also in string=. + * Preliminary code for Uyghur hyphenation (lua). + * magyar as alternative to hungarian in \babelprovide. ``` ### Previous changes diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx index 9c8ff775c0..b21384f6a0 100644 --- a/macros/latex/required/babel/base/babel.dtx +++ b/macros/latex/required/babel/base/babel.dtx @@ -31,7 +31,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2021/03/24 v3.56 The Babel package] +\ProvidesFile{babel.dtx}[2021/04/07 v3.57 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -3017,8 +3017,55 @@ spacing conventions and so on.\footnote{They are similar in concept, but not the same, as those in Unicode.} It currently embraces |\babelprehyphenation| and -|\babelposthyphenation|, which have been available for several months. -\New{3.56} In this version they can be defined in |ini| files, too. +|\babelposthyphenation|. + +\New{3.57} Several \textsf{ini} files predefine some transforms. They +are activated with the key |transforms| in |\babelprovide|, either if +the locale is being defined with this macro or the languages has been +previouly loaded as a class or package option, as the following example +illustrates: +\begin{verbatim} + \usepackage[magyar]{babel} + \babelprovide[_transforms = digraphs.hyphen_]{magyar} +\end{verbatim} + +Here are the transforms currently predefined. (More to follow +in future releases.) + +\begingroup +\def\trans#1#2#3{% + \vspace{1mm}% + \parbox[t]{2.4cm}{\strut#1}% + \parbox[t]{4.2cm}{\strut\ttfamily#2}% + \parbox[t]{6.6cm}{\strut#3}\par} +\bigskip\hrule\nobreak\vspace{1mm} +% \strut\hfil Transforms +% \medskip\hrule\nobreak + +\trans{Arabic}{transliteration.dad}{Applies the transliteration system +devised by Yannis Haralambous for \textsf{dad} (simple and +\TeX-friendly). Not yet complete, but sufficient for most texts.} + +\trans{Croatian}{digraphs.ligatures}{Ligatures \textit{DŽ}, \textit{Dž}, +\textit{dž}, \textit{LJ}, \textit{Lj}, \textit{lj}, \textit{NJ}, +\textit{Nj}, \textit{nj}. It assumes they exist. This is not the +recommended way to make these transformations (the best way is with +OTF features), but it can get you out of a hurry.} + +\trans{Greek}{diaeresis.hyphen}{Removes the diaeresis above iota and +upsilon if hyphenated just before. It works with the +three variants.} + +\trans{Hindi}{transliteration.hk}{The Harvard-Kyoto system to romanize +Devanagari.} + +\trans{Hungarian}{digraphs.hyphen}{Hyphenates the long digraphs +\textit{ccs}, \textit{ddz}, \textit{ggy}, \textit{lly}, \textit{nny}, +\textit{ssz}, \textit{tty} and \textit{zzs} as \textit{cs-cs}, +\textit{dz-dz}, etc.} + +\vspace{2mm}\hrule\nobreak +\endgroup \Describe{\babelposthyphenation}{\marg{hyphenrules-name}% \marg{lua-pattern}\marg{replacement}} @@ -3062,10 +3109,11 @@ future implementation may alternatively accept \textsf{lpeg}. \marg{lua-pattern}\marg{replacement}} \New{3.44-3-52} It is similar to the latter, but (as its name implies) -applied before hyphenation. There are other differences: (1) the first -argument is the locale instead the name of hyphenation patterns; (2) in -the search patterns |=| has no special meaning, while \verb+|+ stands -for an ordinary space; (3) in the replacement, discretionaries are not +applied before hyphenation, which is particularly useful in +transliterations. There are other differences: (1) the first argument +is the locale instead of the name of the hyphenation patterns; (2) in the +search patterns |=| has no special meaning, while \verb+|+ stands for +an ordinary space; (3) in the replacement, discretionaries are not accepted. It handles glyphs and spaces. @@ -3092,9 +3140,9 @@ This feature is activated with the first |\babelposthyphenation| or end of a line: \begin{verbatim} \babelprehyphenation{english}{|a|} - {}, {}, % Keep first space and a - {insert, penalty = 10000}, % Insert penalty - {} % Keep last space + {}, {}, % Keep first space and a + { insert, penalty = 10000 }, % Insert penalty + {} % Keep last space } \end{verbatim} \end{example} @@ -4862,8 +4910,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 @@ -10671,6 +10719,7 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@KVP@intrapenalty\@nil \let\bbl@KVP@onchar\@nil \let\bbl@KVP@transforms\@nil + \global\let\bbl@release@transforms\@empty \let\bbl@KVP@alph\@nil \let\bbl@KVP@Alph\@nil \let\bbl@KVP@labels\@nil @@ -10792,7 +10841,7 @@ help from Bernd Raichle, for which I am grateful. Babel.loc_to_scr[\the\localeid] = Babel.script_blocks['\bbl@cl{sbcp}'] end}% - \ifx\bbl@mapselect\@undefined + \ifx\bbl@mapselect\@undefined % TODO. almost the same as mapfont \AtBeginDocument{% \expandafter\bbl@add\csname selectfont \endcsname{{\bbl@mapselect}}% {\selectfont}}% @@ -10820,7 +10869,7 @@ help from Bernd Raichle, for which I am grateful. {See the manual for details.}}}% \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}% - \ifx\bbl@mapselect\@undefined + \ifx\bbl@mapselect\@undefined % TODO. See onchar \AtBeginDocument{% \expandafter\bbl@add\csname selectfont \endcsname{{\bbl@mapselect}}% {\selectfont}}% @@ -10962,6 +11011,8 @@ help from Bernd Raichle, for which I am grateful. \let\atcatcode\relax \fi}% \fi + % == Release saved transforms == + \bbl@release@transforms\relax % \relax closes the last item. % == main == \ifx\bbl@KVP@main\@nil % Restore only if not 'main' \let\languagename\bbl@savelangname @@ -11339,8 +11390,6 @@ help from Bernd Raichle, for which I am grateful. \ifbbl@bcptoname \bbl@csarg\xdef{bcp@map@\bbl@cl{tbcp}}{\languagename}% \fi - % Finish here transforms, too - \bbl@release@transforms\relax % \relax closes the last item. % Conditional \ifnum#1>\z@ % 0 = only info, 1, 2 = basic, (re)new \bbl@exportkey{lnbrk}{typography.linebreaking}{h}% @@ -11721,10 +11770,10 @@ help from Bernd Raichle, for which I am grateful. \ifin@ \in@{.0$}{#2$}&% \ifin@ - \bbl@add\bbl@release@transforms{&% + \g@addto@macro\bbl@release@transforms{&% \relax\bbl@transforms@aux#1{\languagename}{#3}}&% - \else - \bbl@add\bbl@release@transforms{, {#3}}&% + \else + \g@addto@macro\bbl@release@transforms{, {#3}}&% \fi \fi \fi} @@ -13360,10 +13409,10 @@ help from Bernd Raichle, for which I am grateful. Babel.linebreaking = Babel.linebreaking or {} Babel.linebreaking.before = {} Babel.linebreaking.after = {} - Babel.locale = {} % Free to use, indexed with \localeid + Babel.locale = {} % Free to use, indexed by \localeid function Babel.linebreaking.add_before(func) tex.print([[\noexpand\csname bbl@luahyphenate\endcsname]]) - table.insert(Babel.linebreaking.before , func) + table.insert(Babel.linebreaking.before, func) end function Babel.linebreaking.add_after(func) tex.print([[\noexpand\csname bbl@luahyphenate\endcsname]]) @@ -13841,17 +13890,15 @@ end local locale = node.get_attribute(item, Babel.attr_locale) if lang == locale or lang == nil then - if (item.char ~= 124) then &% ie, not | = space - lang = lang or locale - word_string = word_string .. unicode.utf8.char(item.char) - word_nodes[#word_nodes+1] = item - end + lang = lang or locale + word_string = word_string .. unicode.utf8.char(item.char) + word_nodes[#word_nodes+1] = item else break end elseif item.id == 12 and item.subtype == 13 then - word_string = word_string .. '|' + word_string = word_string .. ' ' word_nodes[#word_nodes+1] = item &% Ignore leading unrecognized nodes, too. @@ -13865,7 +13912,7 @@ end &% Here and above we remove some trailing chars but not the &% corresponding nodes. But they aren't accessed. - if word_string:sub(-1) == '|' then + if word_string:sub(-1) == ' ' then word_string = word_string:sub(1,-2) end word_string = unicode.utf8.gsub(word_string, Babel.us_char .. '+$', '') @@ -14050,6 +14097,16 @@ end if Babel.debug then Babel.debug_hyph(w, w_nodes, sc, first, last, last_match) + local ss = '' + for itt in node.traverse(head) do + if itt.id == 29 then + ss = ss .. unicode.utf8.char(itt.char) + else + ss = ss .. '{' .. itt.id .. '}' + end + end + print('*****************', ss) + end local crep = r[rc] @@ -14141,7 +14198,7 @@ end crep.space[2] * quad, crep.space[3] * quad) if mode == 0 then - placeholder = '|' + placeholder = ' ' end head, new = node.insert_before(head, item, d) @@ -14153,7 +14210,7 @@ end crep.spacefactor[2] * base_font.parameters['space_stretch'], crep.spacefactor[3] * base_font.parameters['space_shrink']) if mode == 0 then - placeholder = '|' + placeholder = ' ' end head, new = node.insert_before(head, item, d) @@ -14203,7 +14260,15 @@ end &% The following functions belong to the next macro function Babel.capture_func(key, cap) local ret = "[[" .. cap:gsub('{([0-9])}', "]]..m[%1]..[[") .. "]]" - ret = ret:gsub('{([0-9])|([^|]+)|(.-)}', Babel.capture_func_map) + local cnt + local u = unicode.utf8 + ret, cnt = ret:gsub('{([0-9])|([^|]+)|(.-)}', Babel.capture_func_map) + if cnt == 0 then + ret = u.gsub(ret, '{(%x%x%x%x+)}', + function (n) + return u.char(tonumber(n, 16)) + end) + end ret = ret:gsub("%[%[%]%]%.%.", '') ret = ret:gsub("%.%.%[%[%]%]", '') return key .. [[=function(m) return ]] .. ret .. [[ end]] @@ -14215,6 +14280,15 @@ end &% Handle the {n|abc|ABC} syntax in captures function Babel.capture_func_map(capno, from, to) + local u = unicode.utf8 + from = u.gsub(from, '{(%x%x%x%x+)}', + function (n) + return u.char(tonumber(n, 16)) + end) + to = u.gsub(to, '{(%x%x%x%x+)}', + function (n) + return u.char(tonumber(n, 16)) + end) local froms = {} for s in string.utfcharacters(from) do table.insert(froms, s) @@ -14319,6 +14393,7 @@ end local id = \the\csname bbl@id@@#1\endcsname &% Convert pattern: local patt = string.gsub([==[#2]==], '%s', '') + local patt = string.gsub(patt, '|', ' ') if not u.find(patt, '()', nil, true) then patt = '()' .. patt .. '()' end @@ -14334,7 +14409,7 @@ end end) lbkr[id] = lbkr[id] or {} table.insert(lbkr[id], { pattern = patt, replace = { \babeltempb } }) - }&% + }&% \endgroup} \endgroup \def\bbl@activateposthyphen{% diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins index bb675249c6..ddedf2c667 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/03/24} +\def\filedate{2021/04/07} \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 588c656f93..540babb7bb 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 efd3eb77db..ea7e8ecc5a 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/03/24 v3.56] +\ProvidesFile{bbcompat.dtx}[2021/04/07 v3.57] % % %% File 'bbcompat.dtx' -- cgit v1.2.3