diff options
Diffstat (limited to 'macros/latex/required/babel/base')
-rw-r--r-- | macros/latex/required/babel/base/README.md | 16 | ||||
-rw-r--r-- | macros/latex/required/babel/base/babel-code.pdf | bin | 647068 -> 650256 bytes | |||
-rw-r--r-- | macros/latex/required/babel/base/babel.dtx | 186 | ||||
-rw-r--r-- | macros/latex/required/babel/base/babel.ins | 4 | ||||
-rw-r--r-- | macros/latex/required/babel/base/babel.pdf | bin | 423110 -> 423559 bytes | |||
-rw-r--r-- | macros/latex/required/babel/base/bbcompat.dtx | 2 |
6 files changed, 140 insertions, 68 deletions
diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md index 07a872c4ab..c84cd4389b 100644 --- a/macros/latex/required/babel/base/README.md +++ b/macros/latex/required/babel/base/README.md @@ -1,6 +1,6 @@ -## Babel 24.4 +## Babel 24.7 -2024-04-20 +2024-06-26 `babel` is the multilingual framework for localizing documents in LaTeX, LuaLaTeX, XeLaTeX. It manages culturally-determined @@ -10,9 +10,9 @@ languages even work with Plain formats. The latest stable version is available on <https://ctan.org/pkg/babel>. -Changes in version 24.4 are described in: +Changes in version 24.7 are described in: -https://latex3.github.io/babel/news/whats-new-in-babel-24.4.html +https://latex3.github.io/babel/news/whats-new-in-babel-24.7.html Apart from the manual, you can find information on some aspects of babel at: @@ -48,10 +48,10 @@ respective authors. ### Summary of latest changes ``` -24.4 2024-04-20 - * New ‘interchar’ declarations for Cantonese, Chinese, Japanese and - Korean: linebreak.basic (xe). - * Fixed Tibetan line breaking with closing punctuation (lua). +24.7 2024-06-26 + * Improvements in some locales: + - Filipino (thanks to Leothelion, @ponte-vecchio) + - Line breaking in Blin, Geez, Tigre, Tigrinya, Wolaytta. ``` ### Previous changes diff --git a/macros/latex/required/babel/base/babel-code.pdf b/macros/latex/required/babel/base/babel-code.pdf Binary files differindex b157d32efd..8be7825803 100644 --- a/macros/latex/required/babel/base/babel-code.pdf +++ b/macros/latex/required/babel/base/babel-code.pdf diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx index 256ec0384c..19db345759 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}[2024/04/20 v24.4 The Babel package] +\ProvidesFile{babel.dtx}[2024/06/26 v24.7 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -865,7 +865,7 @@ behavior is not desired, you may use the environment \begin{warning} Being similar to |\selectlanguage|, the warning above about the internal |\write| also applies here. The current mode (vertical or - horizonal) is also not changed. + horizontal) is also not changed. \end{warning} \Describe{\begin\menv{otherlanguage*}}% @@ -1600,7 +1600,7 @@ files, with |\babelprovide| (or |provide=|). With these languages, |\babelprovide| with a valueless |import|, which will load the |ini| file with the tag given in parenthesis. -Many locale are quite useable, provided captions and dates are +Many locale are quite usable, provided captions and dates are not required (which is a very frequent case, particularly in ancient languages). So, they are included in the default \babel{} distribution. This can serve to encourage contributions, too. A warning will remember @@ -2567,11 +2567,11 @@ languages above. So, the previous example is best written as: \babelprovide[_import_]{hungarian} \end{verbatim} -There are about 250 |ini| files, with data taken from the |ldf| files -and the CLDR provided by Unicode. Not all languages in the latter are -complete, and therefore neither are the |ini| files. A few languages -may show a warning about the current lack of suitability of some -features. +There are 380 |ini| files for about 300 languages, with data taken from +the |ldf| files and the CLDR provided by Unicode. Not all languages in +the latter are complete, and therefore neither are the |ini| files. A +few languages may show a warning about the current lack of suitability +of some features. Besides |\today|, this option defines an additional command for dates: |\<language>date|, which takes three arguments, namely, year, month and @@ -2731,12 +2731,12 @@ one whose script is Latin. Sets the interword space for the writing system of the language, in em units (so, |0 .1 0| is |0em plus .1em|). Like |\spaceskip|, the em unit applied is that of the current text (more precisely, the previous -glyph). Currently used only in Southeast Asian scrips, like Thai, and +glyph). Currently used only in Southeast Asian scripts, like Thai, and CJK. \Describe{intrapenalty=}{\meta{penalty}} Sets the interword penalty for the writing system of this language. -Currently used only in Southeast Asian scrips, like Thai. Ignored if 0 +Currently used only in Southeast Asian scripts, like Thai. Ignored if 0 (which is the default value). \Describe{transforms=}{\meta{transform-list}} @@ -3148,7 +3148,7 @@ Each language in the \babel{} sense has its own unique numeric identifier, which can be retrieved with |\localeid|. The |\localeid| is not the same as the |\language| identifier, which -refers to a set of hyphenation patters (which, in turn, is just a +refers to a set of hyphenation patterns (which, in turn, is just a component of the line breaking algorithm described in the next section). The data about preloaded patterns are store in an internal macro named |\bbl@languages| (see the code for further details), but @@ -3892,22 +3892,26 @@ There are some package options controlling bidi writing. $\string|$ \texttt{basic-r} $\string|$ \texttt{bidi-l} $\string|$ \texttt{bidi-r}} -\New{3.14} Selects the bidi algorithm to be used. With |default| the -bidi mechanism is just activated (by default it is not), but every -change must be marked up. In \xetex{} and \pdftex{} this is the only -option. +\New{3.14} Selects the bidi algorithm to be used. -In \luatex, |basic-r| provides a simple and fast method for R text, -which handles numbers and unmarked L text within an R context many in -typical cases. \New{3.19} Finally, |basic| supports both L and R text, -and it is the preferred method (support for |basic-r| is currently -limited). (They are named \texttt{basic} mainly because they only -consider the intrinsic direction of scripts and weak directionality.) +With |default| the bidi mechanism is just activated (by default it is +not), but every change must be marked up. In \pdftex{} this is the only +option. If the RL text only consists of letters and punctuation, it +will be fine in most cases, but numbers, for example, will be rendered +in the wrong order. -\New{3.29} In \xetex, |bidi-r| and |bidi-l| resort to the package -\textsf{bidi} (by Vafa Khalighi). Integration is still somewhat -tentative, but it mostly works. For RL documents use the former, and -for LR ones use the latter. +In \luatex, the preferred method is |basic|, which supports both L and +R text. |basic-r| was a first attempt to create a bidi algorithm and +provides a simple and fast method for R text in some typical cases. +(They are named \texttt{basic} mainly because they only consider the +intrinsic direction of scripts and weak directionality.) + +In \xetex, |bidi-r| and |bidi-l| resort to the package \textsf{bidi} +(by Vafa Khalighi). For RL documents use the former, and for LR ones +use the latter. However, this package patches heavily lots of macros +and packages even if the RL script is not the main one, which can lead +to some surprising results, so for short and simple texts (letters and +punctuation) the |default| method can be preferable. There are samples on GitHub, under \texttt{/required/babel/samples}. See particularly |lua-bidibasic.tex| and |lua-secenum.tex|. @@ -4127,7 +4131,7 @@ There are \textit{three} R blocks and \textit{two} L blocks, and the order is \textit{RTL B and still ltr 1 ltr text RTL A}. This is by design to provide the proper behavior in the most usual cases — but if you need to use |\ref| in an L text inside R, the L text must be marked -up explictly; for example: +up explicitly; for example: \begin{verbatim} RTL A \foreignlanguage{english}{ltr text \thechapter{} and still ltr} RTL B \end{verbatim} @@ -5475,8 +5479,8 @@ wouldn’t exist. % \section{Tools} % % \begin{macrocode} -%<<version=24.4>> -%<<date=2024/04/20>> +%<<version=24.7>> +%<<date=2024/06/26>> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -10354,15 +10358,15 @@ wouldn’t exist. \@namedef{extras#1}{}% \@namedef{noextras#1}{}% \bbl@startcommands*{#1}{captions}% - \ifx\bbl@KVP@captions\@nnil % and also if import, implicit + \ifx\bbl@KVP@captions\@nnil % and also if import, implicit \def\bbl@tempb##1{% elt for \bbl@captionslist - \ifx##1\@empty\else + \ifx##1\@nnil\else \bbl@exp{% \\\SetString\\##1{% \\\bbl@nocaption{\bbl@stripslash##1}{#1\bbl@stripslash##1}}}% \expandafter\bbl@tempb \fi}% - \expandafter\bbl@tempb\bbl@captionslist\@empty + \expandafter\bbl@tempb\bbl@captionslist\@nnil \else \ifx\bbl@initoload\relax \bbl@read@ini{\bbl@KVP@captions}2% % Here letters cat = 11 @@ -11533,7 +11537,7 @@ wouldn’t exist. \typeout{*******}} % \end{macrocode} % -% \section{Adjusting the Babel bahavior} +% \section{Adjusting the Babel behavior} % % A generic high level interface is provided to adjust some global % and general settings. @@ -11993,7 +11997,7 @@ wouldn’t exist. % documentclasses \cls{report} and \cls{book} define and set the % headings for the page. While doing so they also store a copy of % |\markboth| in |\@mkboth|. Therefore we need to check whether -% |\@mkboth| has already been set. If so we neeed to do that again +% |\@mkboth| has already been set. If so we need to do that again % with the new definition of |\markboth|. (As of Oct 2019, \LaTeX{} % stores the definition in an intermediate macro, so it's not % necessary anymore, but it's preserved for older versions.) @@ -12107,7 +12111,7 @@ wouldn’t exist. % \end{macrocode} % % The package \pkg{varioref} defines |\Ref| to be a robust command -% wich uppercases the first character of the reference text. In +% which uppercases the first character of the reference text. In % order to be able to do that it needs to access the expandable form % of |\ref|. So we employ a little trick here. We redefine the % (internal) command \verb*|\Ref | to call |\org@ref| instead of @@ -12391,16 +12395,16 @@ wouldn’t exist. \fi \fi % TODO? Separate: -\ifnum\bbl@bidimode=\@ne % Any bidi= except default=1 +\ifnum\bbl@bidimode=\@ne % bidi=default \let\bbl@beforeforeign\leavevmode - \ifodd\bbl@engine + \ifodd\bbl@engine % lua \newattribute\bbl@attr@dir \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl@attr@dir' } \bbl@exp{\output{\bodydir\pagedir\the\output}} \fi \AtEndOfPackage{% - \EnableBabelHook{babel-bidi}% - \ifodd\bbl@engine\else + \EnableBabelHook{babel-bidi}% pdf/lua/xe + \ifodd\bbl@engine\else % pdf/xe \bbl@xebidipar \fi} \fi @@ -13991,12 +13995,12 @@ wouldn’t exist. %<*xetex|texxet> \providecommand\bbl@provide@intraspace{} \bbl@trace{Redefinitions for bidi layout} -\def\bbl@sspre@caption{% +\def\bbl@sspre@caption{% TODO: Unused! \bbl@exp{\everyhbox{\\\bbl@textdir\bbl@cs{wdir@\bbl@main@language}}}} \ifx\bbl@opt@layout\@nnil\else % if layout=.. \def\bbl@startskip{\ifcase\bbl@thepardir\leftskip\else\rightskip\fi} \def\bbl@endskip{\ifcase\bbl@thepardir\rightskip\else\leftskip\fi} -\ifx\bbl@beforeforeign\leavevmode % A poor test for bidi= +\ifnum\bbl@bidimode>\z@ % TODO: always? \def\@hangfrom#1{% \setbox\@tempboxa\hbox{{#1}}% \hangindent\ifcase\bbl@thepardir\wd\@tempboxa\else-\wd\@tempboxa\fi @@ -14088,7 +14092,7 @@ wouldn’t exist. % % Which start just above, because some code is shared with \xetex. Now, % 8-bit specific stuff. If just one encoding has been declared, then -% asume no switching is necessary (1). +% assume no switching is necessary (1). % % \begin{macrocode} %<*texxet> @@ -14353,6 +14357,7 @@ wouldn’t exist. \endinput\fi % Here stops reading code for hyphen.cfg % The following is read the 2nd time it's loaded + % First, global declarations for lua \begingroup % TODO - to a lua file \catcode`\%=12 \catcode`\'=12 @@ -14360,6 +14365,10 @@ wouldn’t exist. \catcode`\:=12 \directlua{ Babel = Babel or {} + function Babel.lua_error(e, a) + tex.print([[\noexpand\csname bbl@error\endcsname{]] .. + e .. '}{' .. (a or '') .. '}{}{}') + end function Babel.bytes(line) return line:gsub("(.)", function (chr) return unicode.utf8.char(string.byte(chr)) end) @@ -14592,10 +14601,10 @@ end }} \begingroup \catcode`\%=12 -\catcode`\^=14 +\catcode`\&=14 \catcode`\'=12 \catcode`\~=12 -\gdef\bbl@seaintraspace{^ +\gdef\bbl@seaintraspace{& \let\bbl@seaintraspace\relax \directlua{ Babel = Babel or {} @@ -14611,7 +14620,7 @@ end function Babel.sea_disc_to_space (head) local sea_ranges = Babel.sea_ranges local last_char = nil - local quad = 655360 ^% 10 pt = 655360 = 10 * 65536 + local quad = 655360 &% 10 pt = 655360 = 10 * 65536 for item in node.traverse(head) do local i = item.id if i == node.id'glyph' then @@ -14621,16 +14630,16 @@ end quad = font.getfont(last_char.font).size for lg, rg in pairs(sea_ranges) do if last_char.char > rg[1] and last_char.char < rg[2] then - lg = lg:sub(1, 4) ^% Remove trailing number of, eg, Cyrl1 + lg = lg:sub(1, 4) &% Remove trailing number of, eg, Cyrl1 local intraspace = Babel.intraspaces[lg] local intrapenalty = Babel.intrapenalties[lg] local n if intrapenalty ~= 0 then - n = node.new(14, 0) ^% penalty + n = node.new(14, 0) &% penalty n.penalty = intrapenalty node.insert_before(head, item, n) end - n = node.new(12, 13) ^% (glue, spaceskip) + n = node.new(12, 13) &% (glue, spaceskip) node.setglue(n, intraspace.b * quad, intraspace.p * quad, intraspace.m * quad) @@ -14641,7 +14650,7 @@ end end end end - }^^ + }& \bbl@luahyphenate} % \end{macrocode} % @@ -15319,11 +15328,18 @@ end local rep = [=[##1]=] rep = rep:gsub('^%s*(remove)%s*$', 'remove = true') rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ') + rep = rep:gsub('^%s*(after)%s*,', 'after = true, ') rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func) + rep = rep:gsub('node%s*=%s*(%a+)%s*(%a*)', Babel.capture_node) + rep = rep:gsub(&% + '(norule)%s*=%s*([%-%d%.]+)%s+([%-%d%.]+)%s+([%-%d%.]+)', + 'norule = {' .. '%2, %3, %4' .. '}') if #1 == 0 or #1 == 2 then - rep = rep:gsub('(space)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', + rep = rep:gsub(&% + '(space)%s*=%s*([%-%d%.]+)%s+([%-%d%.]+)%s+([%-%d%.]+)', 'space = {' .. '%2, %3, %4' .. '}') - rep = rep:gsub('(spacefactor)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)', + rep = rep:gsub(&% + '(spacefactor)%s*=%s*([%-%d%.]+)%s+([%-%d%.]+)%s+([%-%d%.]+)', 'spacefactor = {' .. '%2, %3, %4' .. '}') rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida) else @@ -15335,8 +15351,8 @@ end }}}&% \bbl@foreach\babeltempb{&% \bbl@forkv{{##1}}{&% - \in@{,####1,}{,nil,step,data,remove,insert,string,no,pre,&% - no,post,penalty,kashida,space,spacefactor,}&% + \in@{,####1,}{,nil,step,data,remove,insert,string,no,pre,no,&% + post,penalty,kashida,space,spacefactor,kern,node,after,norule,}&% \ifin@\else \bbl@error{bad-transform-option}{####1}{}{}&% \fi}}&% @@ -16352,6 +16368,7 @@ function Babel.hyphenate_replace(head, mode) print('=====') end local new -- used when inserting and removing nodes + local dummy_node -- used by after local matches = { u.match(w, p, last_match) } @@ -16396,7 +16413,8 @@ function Babel.hyphenate_replace(head, mode) -- rc = the replacement table index local rc = 0 - while rc < last-first+1 do -- for each replacement +------- TODO. dummy_node? + while rc < last-first+1 or dummy_node do -- for each replacement if Babel.debug then print('.....', rc + 1) end @@ -16428,11 +16446,31 @@ function Babel.hyphenate_replace(head, mode) end if crep then - step = crep.step or 0 + step = crep.step or step + end + + if crep and crep.after then + crep.insert = true + if dummy_node then + item = dummy_node + else -- TODO. if there is a node after? + d = node.copy(item_base) + head, item = node.insert_after(head, item, d) + dummy_node = item + end + end + + if crep and not crep.after and dummy_node then + node.remove(head, dummy_node) + dummy_node = nil end if (not enabled) or (crep and next(crep) == nil) then -- = {} - last_match = save_last -- Optimization + if step == 0 then + last_match = save_last -- Optimization + else + last_match = utf8.offset(w, sc+step) + end goto next elseif crep == nil or crep.remove then @@ -16442,7 +16480,7 @@ function Babel.hyphenate_replace(head, mode) sc = sc - 1 -- Nothing has been inserted. last_match = utf8.offset(w, sc+1+step) goto next - + elseif crep and crep.kashida then -- Experimental node.set_attribute(item, Babel.attr_kashida, @@ -16520,6 +16558,15 @@ function Babel.hyphenate_replace(head, mode) placeholder = ' ' end head, new = node.insert_before(head, item, d) + + elseif crep and crep.norule then + -- 655360 = 10 pt = 10 * 65536 sp + d = node.new(2, 3) -- (rule, empty) = \no*rule + local quad = font.getfont(item_base.font).size or 655360 + d.width = crep.norule[1] * quad + d.height = crep.norule[2] * quad + d.depth = crep.norule[3] * quad + head, new = node.insert_before(head, item, d) elseif crep and crep.spacefactor then d = node.new(12, 13) -- (glue, spaceskip) @@ -16535,10 +16582,22 @@ function Babel.hyphenate_replace(head, mode) elseif mode == 0 and crep and crep.space then -- ERROR + + elseif crep and crep.kern then + d = node.new(13, 1) -- (kern, user) + local quad = font.getfont(item_base.font).size or 655360 + d.attr = item_base.attr + d.kern = crep.kern * quad + head, new = node.insert_before(head, item, d) + + elseif crep and crep.node then + d = node.new(crep.node[1], crep.node[2]) + d.attr = item_base.attr + head, new = node.insert_before(head, item, d) end -- ie replacement cases - -- Shared by disc, space and penalty. + -- Shared by disc, space(factor), kern, node and penalty. if sc == 1 then word_head = head end @@ -16562,6 +16621,11 @@ function Babel.hyphenate_replace(head, mode) print('.....', '/') Babel.debug_hyph(w, w_nodes, sc, first, last, last_match) end + + if dummy_node then + node.remove(head, dummy_node) + dummy_node = nil + end end -- for match @@ -16643,6 +16707,14 @@ function Babel.capture_kashida(key, wt) return 'kashida = ' .. wt end +function Babel.capture_node(id, subtype) + local sbt = 0 + for k, v in pairs(node.subtypes(id)) do + if v == subtype then sbt = k end + end + return 'node = {' .. node.id(id) .. ', ' .. sbt .. '}' +end + -- Experimental: applies prehyphenation transforms to a string (letters -- and spaces). function Babel.string_prehyphenation(str, locale) diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins index 4bd22c8667..9c640a94cb 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{2024/04/20} +\def\filedate{2024/06/26} \def\batchfile{babel.ins} \input docstrip.tex @@ -48,7 +48,7 @@ % Modify docstrip. A pseudo-guard is defined to set variables: % <<name=value>>. These variables are used with <@name@> Two further % pseudo-guards define "block" variables: <<*name>> and <</name>> -% delimite the lines to be retrived with <@name@>. Note the verbatim +% delimite the lines to be retrieved with <@name@>. Note the verbatim % guard is overridden, but it's not used here. This is done in two % passes: 1) with saving true, there is a dummy pass, generating % nothing, but blocks are read and saved; 2) with saving false, blocks diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf Binary files differindex 55df378a61..8d3e32fbc8 100644 --- a/macros/latex/required/babel/base/babel.pdf +++ b/macros/latex/required/babel/base/babel.pdf diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx index f36bd4b705..d88b690b23 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}[2024/04/20 v24.4] +\ProvidesFile{bbcompat.dtx}[2024/06/26 v24.7] %</dtx> % %% File 'bbcompat.dtx' |