[latex3-commits] [git/LaTeX3-latex3-babel] master: Bump to 3.30. (c12ffda)

Javier jbezos at dante.de
Mon Apr 22 15:30:42 CEST 2019


Repository : https://github.com/latex3/babel
On branch  : master
Link       : https://github.com/latex3/babel/commit/c12ffda7a349d43b59aa8be293a8dae03a86a3c1

>---------------------------------------------------------------

commit c12ffda7a349d43b59aa8be293a8dae03a86a3c1
Author: Javier <jbezos at localhost>
Date:   Mon Apr 22 15:30:42 2019 +0200

    Bump to 3.30.


>---------------------------------------------------------------

c12ffda7a349d43b59aa8be293a8dae03a86a3c1
 README.md              |   18 ++-
 babel.dtx              |  298 +++++++++++++++++++++++++++++++-----------------
 babel.ins              |    2 +-
 babel.pdf              |  Bin 678923 -> 695563 bytes
 bbcompat.dtx           |    2 +-
 samples/lua-hebrew.pdf |  Bin 83924 -> 84413 bytes
 samples/lua-hebrew.tex |    2 +-
 testfiles/tlb0619.tlg  |   15 ++-
 testfiles/tlb0710.tlg  |   12 +-
 testfiles/tlb1118b.tlg |    2 +-
 testfiles/tlb2611.tlg  |    2 +-
 testfiles/tlb3805.tlg  |    2 +-
 12 files changed, 237 insertions(+), 118 deletions(-)

diff --git a/README.md b/README.md
index 4460cb3..58b7a5e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.29.1605
+## Babel 3.30
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages.  Many
@@ -51,25 +51,34 @@ respective authors.
 ### Latest changes
 
 ```
+3.30   - Fix - dir in boxes inside math (hopefully now it works).
+       - Option mapdigits for \babelprovide (only luatex).
+
 3.29   - The fix for boxes inside math is incompatible with ams.
          Removed (a better fix is under study).
        - Options bidi-l and bidi-r (for the bidi package).
+
 3.28   - Fixes - wrong dir after math, in math inside tabular, in weak L
          inside R inside L, and in boxes inside math.
        - \babelfont now takes into account \defaultfontfeatures. This
          is a potential source of backwards incompatibilities, but
          very likely the risks are very low, and it is, I think, the
          expected behavior.
+
 3.27   - Preliminary support for bidi (by Vafa Khalighi) with xetex.
        - Fix for 3.23 - \ensureascii was redefined even when not 
          necessary.
        - Minor improvements in babel-vi.ini.
+
 3.26   - Fix for 3.25 - \babelprovide raised an error with xetex. 
+
 3.25   - Fixes for 3.23 - mapfont=direction could raise an error.
          Language and Script were not always defined correctly.
        - Improved tentative support for Thai, Lao and Khmer in both 
          luatex and xetex.
+
 3.24   - Prelimimary support for Thai interword spacing with luatex.
+
 3.23   - After extensive tests and fixing some issues, bidi=basic is 
          not experimental any longer.
        - import in \babelprovide does not require a language code if
@@ -81,14 +90,17 @@ respective authors.
          the Japanese script).
        - Set the \thepage bidi bahavior in foots/heads.
        - Fix - Undefined \bbl at stripslash in Plain.
+
 3.22   - Fix - Error with \chapter if empty in ini
        - Prelimimary support for Sanskrit
        - Unknown languages in aux files do not raise an error
          any more (only show a warning).
+
 3.21   - Fix - equation numbers raised an error.
        - Two minor changes: if no language is requested load nil 
          instead of raising an error, and the message 'babel <x.x>...'
          is not printed to the log any more.
+
 3.20   - ini files with the field digits.native define
          \<language>digits and \<language>counters. \arabic can be
          redefined to use native digits.
@@ -99,6 +111,7 @@ respective authors.
        - Fix for luatex 1.07 - An internal change in luatex broke
          bidi at 'automatic' hyphens.
        - Fix for latest latex - babel.ins raised an error.
+
 3.19   - Most changes are for luatex:
          . The main new feature is a bidi method for both implicit L in
            R text, and implicit R in L text, with the possibility of
@@ -128,5 +141,4 @@ respective authors.
 ```
 
 Javier Bezos
-2019/04/08
-
+2019/04/22
diff --git a/babel.dtx b/babel.dtx
index 994ec88..f90f975 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2019/04/08 v3.29.1605 The Babel package]
+\ProvidesFile{babel.dtx}[2019/04/22 v3.30 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -2133,16 +2133,17 @@ 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.
+Requires |import|.
 
 \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
-(which is the default value).
+(which is the default value). Requires |import|.
 
 \begin{note}
-  (1) If you need shorthands, you can use |\useshorthands| and
-  |\defineshorthand| as described above. (2) Captions and |\today| are
-  ``ensured'' with |\babelensure| (this is the default in
+  (1) If you need shorthands, you can define them with |\useshorthands|
+  and |\defineshorthand| as described above. (2) Captions and |\today|
+  are ``ensured'' with |\babelensure| (this is the default in
   |ini|-based languages).
 \end{note}
 
@@ -2155,7 +2156,8 @@ Currently used only in Southeast Asian scrips, like Thai. Ignored if 0
 the native digits of that language; the second takes a counter name as
 argument. With the option |maparabic| in |\babelprovide|, |\arabic| is
 redefined to produce the native digits (this is done \textit{globally},
-to avoid inconsistencies in, for example, page numbering).
+to avoid inconsistencies in, for example, page numbering, and note as
+well dates do not rely on |\arabic|.)
 
 For example:
 \begin{verbatim}
@@ -2174,6 +2176,14 @@ Languages providing native digits in all or some variants are
 lrc, ml, mr, my, mzn, ne, or, pa, ps, ta, te, th, ug, ur, uz, vai, yue,
 zh.}
 
+\New{3.30} With \luatex{} there is an alternative approach for mapping
+digits, namely, |mapdigits|. Conversion is based on the language and it
+is applied to the typeset text (not math, PDF bookmarks, etc.) before
+bidi and fonts are processed (ie, to the node list as generated by the
+\TeX{} code). This means the local digits have the correct
+bidirectional behavior (unlike |Numbers=Arabic| in \textsf{fontspec},
+which is not recommended).
+
 \subsection{Getting the current language name}
 
 \Describe{\languagename}{}
@@ -2403,9 +2413,10 @@ and it is the preferred method (support for |basic-r| is now limited).
 (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). Integration is still somewhat tentative, but mostly
-works. For RL documents use the former, and for LR ones use the latter.
+\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.
 
 There are samples on GitHub, under \texttt{/required/babel/samples}.
 See particularly |lua-bidibasic.tex| and |lua-secenum.tex|.
@@ -2548,7 +2559,15 @@ required by all engines.
   systems in general. Expect some minor readjustments.}
 
 \item[lists] required in \xetex{} and \pdftex{}, but only in
-  multilingual documents in \luatex{}.
+bidirectional (with both R and L paragraphs) documents in \luatex{}.
+  
+\begin{warning}
+  As of April 2019 there is a bug with |\parshape| in \luatex{} (a
+  \TeX{} primitive) which makes lists to be horizontally misplaced if
+  they are inside a |\vbox| (like |minipage|) and the current direction
+  is different from the main one. A workaround is to restore the main
+  language before the box and then set the local one inside.
+\end{warning}
 
 \item[contents] required in \xetex{} and \pdftex{}; in \luatex{}
   toc entries are R by default if the main language is R.
@@ -2559,9 +2578,9 @@ required by all engines.
   \textsf{multicol}).
 
 \item[footnotes] not required in monolingual documents, but it may be
-  useful in multilingual documents in all engines; you may use
-  alternatively |\BabelFootnote| described below (what this options
-  does exactly is also explained there).
+  useful in bidirectional documents (with both R and L paragraphs) in all
+  engines; you may use alternatively |\BabelFootnote| described below
+  (what this options does exactly is also explained there).
 
 \item[captions] is similar to |sectioning|, but for |\caption|; not
   required in monolingual documents with \luatex{}, but may be
@@ -2571,13 +2590,21 @@ required by all engines.
 \item[tabular] required in \luatex{} for R |tabular| (it has been
   tested only with simple tables, so expect some readjustments in the
   future); ignored in \pdftex{} or \xetex{} (which will not support a
-  similar option in the short term) \New{3.18},
+  similar option in the short term) \New{3.18}.
 
 \item[extras] is used for miscellaneous readjustments which do not fit into
   the previous groups. Currently redefines in \luatex{} |\underline| and
   |\LaTeX2e| \New{3.19}.
 \end{description}
 
+\begin{example}
+  Typically, in an Arabic document you would need:
+\begin{verbatim}
+\usepackage[bidi=basic,
+            layout=counters.tabular]{babel}
+\end{verbatim}
+\end{example}
+
 \Describe{\babelsublr}{\marg{lr-text}}
 
 Digits in \pdftex{} must be marked up explicitly (unlike \luatex{} with
@@ -3938,8 +3965,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.29.1605>>
-%<<date=2019/04/08>>
+%<<version=3.30>>
+%<<date=2019/04/22>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -4384,6 +4411,9 @@ help from Bernd Raichle, for which I am grateful.
 % |\bbl at languages|), get the name of the 0-th to show the actual
 % language used.
 %
+% \changes{babel~3.30}{2019/04/22}{Callbacks aren't specific to
+%   bidi any more, so they are moved.}
+%
 %    \begin{macrocode}
 \ifx\bbl at languages\@undefined\else
   \begingroup
@@ -4404,6 +4434,46 @@ help from Bernd Raichle, for which I am grateful.
   \bbl at languages
 \fi
 \ifodd\bbl at engine
+  \def\bbl at activate@preotf{%
+    \let\bbl at activate@preotf\relax  % only once
+    \directlua{
+      Babel = Babel or {}
+      %
+      function Babel.pre_otfload_v(head)
+        if Babel.numbers and Babel.digits_mapped then
+          head = Babel.numbers(head)
+        end
+        if Babel.bidi_enabled then
+          head = Babel.bidi(head, false, dir)
+        end
+        return head
+      end
+      %
+      function Babel.pre_otfload_h(head, gc, sz, pt, dir)
+        if Babel.numbers and Babel.digits_mapped then
+          head = Babel.numbers(head)
+        end
+        if Babel.fixboxdirs then          % Temporary!
+          head = Babel.fixboxdirs(head)
+        end
+        if Babel.bidi_enabled then
+          head = Babel.bidi(head, false, dir)
+        end
+        return head
+      end
+      %
+      luatexbase.add_to_callback('pre_linebreak_filter',
+        Babel.pre_otfload_v,
+        'Babel.pre_otfload_v',
+        luatexbase.priority_in_callback('pre_linebreak_filter',
+          'luaotfload.node_processor') or nil)
+      %
+      luatexbase.add_to_callback('hpack_filter',
+        Babel.pre_otfload_h,
+        'Babel.pre_otfload_h',
+        luatexbase.priority_in_callback('hpack_filter',
+          'luaotfload.node_processor') or nil)
+    }}
   \let\bbl at tempa\relax
   \@ifpackagewith{babel}{bidi=basic}%
     {\def\bbl at tempa{basic}}%
@@ -4417,17 +4487,8 @@ help from Bernd Raichle, for which I am grateful.
     \directlua{
       require('babel-bidi.lua')
       require('babel-bidi-\bbl at tempa.lua')
-      luatexbase.add_to_callback('pre_linebreak_filter',
-        Babel.pre_otfload_v,
-        'Babel.pre_otfload_v',
-        luatexbase.priority_in_callback('pre_linebreak_filter',
-          'luaotfload.node_processor') or nil)
-      luatexbase.add_to_callback('hpack_filter',
-        Babel.pre_otfload_h,
-        'Babel.pre_otfload_h',
-        luatexbase.priority_in_callback('hpack_filter',
-          'luaotfload.node_processor') or nil)
-     }
+    }
+    \bbl at activate@preotf
   \fi
 \fi
 %    \end{macrocode}
@@ -7790,9 +7851,9 @@ help from Bernd Raichle, for which I am grateful.
 % \subsection{Creating languages}
 %
 % |\babelprovide| is a general purpose tool for creating and modifying
-% languages. It creates the language infrastructure, and
-% loads, if requested, an |ini| file. It may be used in conjunction to
-% previouly loaded |ldf| files.
+% languages. It creates the language infrastructure, and loads, if
+% requested, an |ini| file. It may be used in conjunction to previouly
+% loaded |ldf| files.
 %
 % \changes{3.10}{2017/05/19}{Added \cs{babelprovide}}
 % \changes{3.13}{2017/08/30}{Added \cs{import}, which also reads
@@ -7807,12 +7868,21 @@ help from Bernd Raichle, for which I am grateful.
 % \changes{babel~3.23}{2018/09/01}{Valueless import}
 % \changes{babel~3.26}{2018/10/16}{Quick fix for xetex - test the 
 %   script for intraspace}
+% \changes{3.30}{2019/04/22}{Read some basic parameters from ini
+%   even without import.}
+% \changes{3.30}{2019/04/22}{Native digits (lua level).}
+% \changes{3.30}{2019/04/22}{New attribute in luatex for `locale'. Also
+%   \cs{localeid}}
 %
 %    \begin{macrocode}
 \bbl at trace{Creating languages and reading ini files}
 \newcommand\babelprovide[2][]{%
   \let\bbl at savelangname\languagename
+  \edef\bbl at savelocaleid{\the\localeid}%
+  % Set name and locale id
   \def\languagename{#2}%
+  \bbl at id@assign
+  \chardef\localeid\@nameuse{bbl at id@@\languagename}%
   \let\bbl at KVP@captions\@nil
   \let\bbl at KVP@import\@nil
   \let\bbl at KVP@main\@nil
@@ -7855,7 +7925,25 @@ help from Bernd Raichle, for which I am grateful.
         \\\foreignlanguage{\languagename}%
         {####1}}}}%
     {}%
-  % To override script and language names
+  % 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 load the very basic parameters: ids and a few
+  % more.
+  \bbl at ifunset{bbl at lname@#2}%
+    {\def\BabelBeforeIni##1##2{%
+       \begingroup
+         \catcode`\[=12 \catcode`\]=12 \catcode`\==12 %
+         \let\bbl at ini@captions at aux\@gobbletwo
+         \def\bbl at inidate ####1.####2.####3.####4\relax ####5####6{}%
+         \let\bbl at inikv@typography\bbl at iniskip
+         \bbl at read@ini{##1}%
+         \bbl at exportkey{chrng}{characters.ranges}{}%
+         \bbl at exportkey{dgnat}{numbers.digits.native}{}%
+       \endgroup}%           boxed, to avoid extra spaces:
+     {\setbox\z@\hbox{\InputIfFileExists{babel-#2.tex}{}{}}}}%
+    {}%
+  % -
+  % Override script and language names with script= and language=
   \ifx\bbl at KVP@script\@nil\else
     \bbl at csarg\edef{sname@#2}{\bbl at KVP@script}%
   \fi
@@ -7887,7 +7975,7 @@ help from Bernd Raichle, for which I am grateful.
     \fi
     \bbl at exp{\\\bbl at add\\\bbl at mapselect{\\\bbl at mapdir{\languagename}}}%
   \fi
-  % For Southeast Asian, if interspace in ini
+  % For Southeast Asian, if interspace in ini -- TODO: as hook
   \ifcase\bbl at engine\or
     \bbl at ifunset{bbl at intsp@\languagename}{}%
       {\expandafter\ifx\csname bbl at intsp@\languagename\endcsname\@empty\else
@@ -7956,26 +8044,40 @@ help from Bernd Raichle, for which I am grateful.
         \fi
       \fi}%
   \fi
-  % Native digits (lua level). First steps only, for testing
+  % Native digits (lua level).
   \ifodd\bbl at engine
     \ifx\bbl at KVP@mapdigits\@nil\else
-      \bbl at tentative{mapdigits}%
       \bbl at ifunset{bbl at dgnat@\languagename}{}%
-        {\directlua{
-           Babel = Babel or {}
+        {\RequirePackage{luatexbase}%
+         \bbl at activate@preotf
+         \directlua{
+           Babel = Babel or {}  %%% -> presets in luababel
            Babel.digits_mapped = true
-           Babel.digits =
+           Babel.digits = Babel.digits or {}
+           Babel.digits[\the\localeid] =
              table.pack(string.utfvalue('\bbl at cs{dgnat@\languagename}'))
-           function Babel.numbers(head)
-             for item in node.traverse_id(node.id'glyph',head) do
-               local chr = item.char
-               if chr > 47 and chr < 58 then
-                 item.char = Babel.digits[chr-47]
+           if not Babel.numbers then
+             function Babel.numbers(head)
+               local LOCALE = luatexbase.registernumber'bbl at attr@locale'
+               local GLYPH = node.id'glyph'
+               local inmath = false
+               for item in node.traverse(head) do
+                 if not inmath and item.id == GLYPH then
+                   local temp = node.get_attribute(item, LOCALE)
+                   if Babel.digits[temp] then
+                     local chr = item.char
+                     if chr > 47 and chr < 58 then
+                       item.char = Babel.digits[temp][chr-47]
+                     end
+                   end
+                 elseif item.id == node.id'math' then
+                   inmath = (item.subtype == 0)
+                 end
                end
+               return head
              end
-             return head
            end
-         }}
+        }}
     \fi
   \fi
   % To load or reaload the babel-*.tex, if require.babel in ini
@@ -7988,7 +8090,8 @@ help from Bernd Raichle, for which I am grateful.
        \catcode`\@=\atcatcode
        \let\atcatcode\relax
      \fi}%
-  \let\languagename\bbl at savelangname}
+  \let\languagename\bbl at savelangname
+  \chardef\localeid\bbl at savelocaleid\relax}
 %    \end{macrocode}
 %
 % A tool to define the macros for native digits from the list provided 
@@ -8127,7 +8230,7 @@ help from Bernd Raichle, for which I am grateful.
 %
 %    \begin{macrocode}
 \def\bbl at read@ini#1{%
-  \openin1=babel-#1.ini
+  \openin1=babel-#1.ini        % FIXME - number must not be hardcoded
   \ifeof1
     \bbl at error
       {There is no ini file for the requested language\\%
@@ -8290,7 +8393,7 @@ help from Bernd Raichle, for which I am grateful.
 \ifcase\bbl at engine
   \bbl at csarg\def{inikv at date.gregorian.licr}#1=#2\@@{%  override
     \bbl at inidate#1...\relax{#2}{}}
-  \bbl at csarg\def{secpre at date.gregorian.licr}{%           discard uni
+  \bbl at csarg\def{secpre at date.gregorian.licr}{%         discard uni
     \ifcase\bbl at engine\let\bbl at savedate\@empty\fi}
 \fi
 % eg: 1=months, 2=wide, 3=1, 4=dummy
@@ -9723,6 +9826,26 @@ help from Bernd Raichle, for which I am grateful.
 %  \end{macro}
 %  \end{macro}
 %
+%  An alternative way to identify languages (in the \babel{} sense)
+%  with a numerical value is introduced in 3.30. This is one of the
+%  first steps for a new interface based on the concept of locale,
+%  which explains the name of |\localeid|. This means |\l at ...| will be
+%  reserved for hyphenation patterns.
+%
+%    \begin{macrocode}
+\chardef\localeid\z@
+\def\bbl at id@last{0}    % No real need for a new counter
+\def\bbl at id@assign{%
+  \bbl at ifunset{bbl at id@@\languagename}%
+    {\count@\bbl at id@last\relax
+     \advance\count@\@ne
+     \bbl at csarg\chardef{id@@\languagename}\count@
+     \edef\bbl at id@last{\the\count@}}%
+    {}}
+%    \end{macrocode}
+%
+% The unprotected part of |\selectlanguage|.
+%
 %    \begin{macrocode}
 \expandafter\def\csname selectlanguage \endcsname#1{%
   \ifnum\bbl at hymapsel=\@cclv\let\bbl at hymapsel\tw@\fi
@@ -9880,6 +10003,9 @@ help from Bernd Raichle, for which I am grateful.
     \babel at beginsave}%
   \bbl at usehooks{afterreset}{}%
   \languageshorthands{none}%
+  % set the locale id
+  \bbl at id@assign
+  \chardef\localeid\@nameuse{bbl at id@@\languagename}%
   % switch captions, date
   \ifcase\bbl at select@type
     \ifhmode
@@ -10839,6 +10965,9 @@ help from Bernd Raichle, for which I am grateful.
 % by LaTeX. Just in case, consider the possibility it has not been
 % loaded. First, a couple of definitions related to bidi [misplaced].
 %
+% \changes{babel~3.30}{2019/04/22}{Ensure the current textdir inside
+%   boxes within math.}
+%
 %    \begin{macrocode}
 %<<*More package options>>
 \ifodd\bbl at engine
@@ -10847,9 +10976,11 @@ help from Bernd Raichle, for which I am grateful.
   \DeclareOption{bidi=basic}%
     {\let\bbl at beforeforeign\leavevmode
      \newattribute\bbl at attr@dir
-     % TODO - the same trick as bbl at severypar? Or too strong?
-     \everymath{\bbl at mathboxdir}%
-     \everydisplay{\bbl at mathboxdir}%
+     % I don't like it, hackish:
+     \frozen at everymath\expandafter{%
+       \expandafter\bbl at mathboxdir\the\frozen at everymath}%
+     \frozen at everydisplay\expandafter{%
+       \expandafter\bbl at mathboxdir\the\frozen at everydisplay}%
      \bbl at exp{\output{\bodydir\pagedir\the\output}}%
      \AtEndOfPackage{\EnableBabelHook{babel-bidi}}}
 \else
@@ -11686,6 +11817,11 @@ help from Bernd Raichle, for which I am grateful.
   end
 }
 \endgroup
+\ifx\newattribute\@undefined\else
+  \newattribute\bbl at attr@locale
+  \AddBabelHook{luatex}{beforeextras}{%
+    \setattribute\bbl at attr@locale\localeid}
+\fi
 \def\BabelStringsDefault{unicode}
 \let\luabbl at stop\relax
 \AddBabelHook{luatex}{encodedcommands}{%
@@ -18184,10 +18320,9 @@ Babel.characters={
 % excels, because everything related to bidi writing is under our
 % control.
 %
-% TODO: math mode (as weak L?)
-%
 % \changes{babel~3.20}{2018/05/01}{Adapted to exhyphens in luatex >=
 %   1.07. Fix - now attr at dir is mod 3.}
+% \changes{babel~3.30}{2019/04/22}{Switch to enable/disable bidi.}
 %
 %    \begin{macrocode}
 %<*basic-r>
@@ -18212,29 +18347,6 @@ local function dir_mark(head, from, to, outer)
   node.insert_after(head, to, d)
 end
 
-function Babel.pre_otfload_v(head)
-  if Babel.numbers and Babel.digits_mapped then
-    head = Babel.numbers(head)
-  end
-  if Babel.bidi_enabled then
-    head = Babel.bidi(head, false, dir)
-  end
-  return head
-end
-
-function Babel.pre_otfload_h(head)
-  if Babel.numbers and Babel.digits_mapped then
-    head = Babel.numbers(head)
-  end
-  if Babel.fixboxdirs then          -- Temporary!
-    head = Babel.fixboxdirs(head)
-  end
-  if Babel.bidi_enabled then
-    head = Babel.bidi(head, false, dir)
-  end
-  return head
-end
-
 function Babel.bidi(head, ispar)
   local first_n, last_n            -- first and last char with nums
   local last_es                    -- an auxiliary 'last' used with nums
@@ -18293,7 +18405,9 @@ function Babel.bidi(head, ispar)
 %      switches the script with its dir. We treat a language block as
 %      a separate Unicode sequence. The following piece of code is
 %      executed at the first glyph after a `dir' node. We don't know
-%      the current language until then.
+%      the current language until then. This is not exactly true, as
+%      the math mode may insert explicit dirs in the node list, so, for
+%      the moment there is a hack by brute force (just above).
 %
 %    \begin{macrocode}
       if new_dir then
@@ -18491,29 +18605,6 @@ Babel.fontmap[2] = {}      -- al/an
 
 Babel.bidi_enabled = true
 
-function Babel.pre_otfload_v(head)
-  if Babel.numbers and Babel.digits_mapped then
-    head = Babel.numbers(head)
-  end
-  if Babel.bidi_enabled then
-    head = Babel.bidi(head, false, dir)
-  end
-  return head
-end
-
-function Babel.pre_otfload_h(head, gc, sz, pt, dir)
-  if Babel.numbers and Babel.digits_mapped then
-    head = Babel.numbers(head)
-  end
-  if Babel.fixboxdirs then          -- Temporary!
-    head = Babel.fixboxdirs(head)
-  end
-  if Babel.bidi_enabled then
-    head = Babel.bidi(head, false, dir)
-  end
-  return head
-end
-
 require('babel-bidi.lua')
 
 local characters = Babel.characters
@@ -18632,7 +18723,6 @@ function Babel.bidi(head, ispar, hdir)
         end
       end
       d = d or 'l'
-      if inmath then d = ('TRT' == tex.mathdir) and 'r' or 'l' end
       
       -- A short 'pause' in bidi for mapfont
       d_font = d_font or d
@@ -18647,8 +18737,12 @@ function Babel.bidi(head, ispar, hdir)
 
       if new_d then
         table.insert(nodes, {nil, (outer == 'l') and 'l' or 'r', nil})
-        attr_d = node.get_attribute(item, ATDIR)
-        attr_d = attr_d % 3
+        if inmath then
+          attr_d = 0
+        else
+          attr_d = node.get_attribute(item, ATDIR)
+          attr_d = attr_d % 3
+        end
         if attr_d == 1 then
           outer_first = 'r'
           last = 'r'
diff --git a/babel.ins b/babel.ins
index 835e099..408833d 100644
--- a/babel.ins
+++ b/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{2019/04/08}
+\def\filedate{2019/04/22}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index f52a4ab..6db73cf 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index fe2b0f3..4b31d63 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2019/04/08 v3.29.1605]
+\ProvidesFile{bbcompat.dtx}[2019/04/22 v3.30]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/samples/lua-hebrew.pdf b/samples/lua-hebrew.pdf
index af9afe2..9367b14 100644
Binary files a/samples/lua-hebrew.pdf and b/samples/lua-hebrew.pdf differ
diff --git a/samples/lua-hebrew.tex b/samples/lua-hebrew.tex
index 9af5121..2def224 100644
--- a/samples/lua-hebrew.tex
+++ b/samples/lua-hebrew.tex
@@ -35,7 +35,7 @@
 לפי ההיררכיה הבאה:
 
 \begin{center}
-  \begin{tabular}{lll}
+  \begin{tabular}{|l|ll|}
     \hline
     עברית	 & לטינית	  & אנגלית   \\
     \hline
diff --git a/testfiles/tlb0619.tlg b/testfiles/tlb0619.tlg
index 90cb595..65ddeb2 100644
--- a/testfiles/tlb0619.tlg
+++ b/testfiles/tlb0619.tlg
@@ -7,15 +7,24 @@ Package: t1enc
 Package: babel
     Options: germanb
 > \box...=
-\hbox(8.91449+0.0)x43.04504
+\hbox(8.91449+0.0)x43.32275
 .\T1/cmr/m/n/10 ^^c4
-.\kern-0.27771
+.\penalty 10000
+.\glue 0.0
 .\T1/cmr/m/n/10 ^^d6
+.\penalty 10000
+.\glue 0.0
 .\T1/cmr/m/n/10 ^^dc
+.\penalty 10000
+.\glue 0.0
 .\T1/cmr/m/n/10 ^^e4
+.\penalty 10000
+.\glue 0.0
 .\T1/cmr/m/n/10 ^^f6
+.\penalty 10000
+.\glue 0.0
 .\T1/cmr/m/n/10 ^^fc
-.\T1/cmr/m/n/10 ^^ff
+.etc.
 ! OK.
 l. ...\showbox0
 > \box...=
diff --git a/testfiles/tlb0710.tlg b/testfiles/tlb0710.tlg
index 438e8da..3bcfeb4 100644
--- a/testfiles/tlb0710.tlg
+++ b/testfiles/tlb0710.tlg
@@ -9,16 +9,20 @@ Package: babel
 > \box...=
 \hbox(8.91449+0.0)x54.98657
 .\T1/cmr/m/n/10 ^^c4
+.\penalty 10000
+.\glue 0.0
 .\glue 3.33252 plus 1.66458 minus 1.11194
 .\T1/cmr/m/n/10 ^^d6
+.\penalty 10000
+.\glue 0.0
 .\glue 3.33252 plus 1.66458 minus 1.11194
 .\T1/cmr/m/n/10 ^^dc
+.\penalty 10000
+.\glue 0.0
 .\glue 3.33252 plus 1.66458 minus 1.11194
 .\T1/cmr/m/n/10 ^^e4
-.\glue 3.33252 plus 1.66626 minus 1.11084
-.\T1/cmr/m/n/10 ^^f6
-.\glue 3.33252 plus 1.66626 minus 1.11084
-.\T1/cmr/m/n/10 ^^fc
+.\penalty 10000
+.etc.
 ! OK.
 l. ...\showbox0
 > \box...=
diff --git a/testfiles/tlb1118b.tlg b/testfiles/tlb1118b.tlg
index f867225..38088a4 100644
--- a/testfiles/tlb1118b.tlg
+++ b/testfiles/tlb1118b.tlg
@@ -8,5 +8,5 @@ Package: babel
 Package: fontenc
     Options: T1
 Underfull \hbox (badness 10000) in paragraph at lines 18--18
-[] \T1/cmr/m/n/10 ^^fcber-tra-gungs-ein-rich-tun-gen
+[] \T1/cmr/m/n/10 ^^fcbert-ra-gungs-ein-rich-tun-gen
 \hbox(6.8872+1.94397)x16383.99998, glue set 9751.88171 []
diff --git a/testfiles/tlb2611.tlg b/testfiles/tlb2611.tlg
index 7dd50e6..ea48c21 100644
--- a/testfiles/tlb2611.tlg
+++ b/testfiles/tlb2611.tlg
@@ -13,7 +13,7 @@ Underfull \hbox (badness 10000) in paragraph at lines 35--35
 [] \T1/cmr/m/n/10 Be-ein-flu^^ffu-ng
 \hbox(6.8872+1.94397)x16383.99998, glue set 9787.88171 []
 Underfull \hbox (badness 10000) in paragraph at lines 38--38
-[] \T1/cmr/m/n/10 Ob-jekt-iden-ti-t^^e4t
+[] \T1/cmr/m/n/10 Ob-jek-ti-den-ti-t^^e4t
 \hbox(6.8872+1.94397)x16383.99998, glue set 9780.96504 []
 Underfull \hbox (badness 10000) in paragraph at lines 39--39
 [] \T1/cmr/m/n/10 Ob-jekt-iden-ti-t^^e4t
diff --git a/testfiles/tlb3805.tlg b/testfiles/tlb3805.tlg
index 1fc0a74..7df92ef 100644
--- a/testfiles/tlb3805.tlg
+++ b/testfiles/tlb3805.tlg
@@ -116,7 +116,7 @@ Package atveryend Info: Executing hook `AtVeryEndDocument' on input line ....
   test2e.tex
  article.cls    ....-..-.. v... Standard LaTeX document class
   size10.clo    ....-..-.. v... Standard LaTeX file (size option)
-   babel.sty    ....-..-.. 3.26.1445 The Babel package
+   babel.sty    ....-..-.. 3.29.1617 The Babel package
 american.ldf    ....-..-.. v... English support from the babel system
  nameref.sty    ....-..-.. v... Cross-referencing by name of section
 refcount.sty    ....-..-.. v... Data extraction from label references (HO)





More information about the latex3-commits mailing list