texlive[62007] Master/texmf-dist: babel (13feb22)

commits+karl at tug.org commits+karl at tug.org
Sun Feb 13 22:27:09 CET 2022


Revision: 62007
          http://tug.org/svn/texlive?view=revision&revision=62007
Author:   karl
Date:     2022-02-13 22:27:08 +0100 (Sun, 13 Feb 2022)
Log Message:
-----------
babel (13feb22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/babel/README.md
    trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
    trunk/Master/texmf-dist/source/latex/babel/babel.dtx
    trunk/Master/texmf-dist/source/latex/babel/babel.ins
    trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
    trunk/Master/texmf-dist/source/latex/babel/locale.zip
    trunk/Master/texmf-dist/tex/generic/babel/babel.def
    trunk/Master/texmf-dist/tex/generic/babel/babel.sty
    trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
    trunk/Master/texmf-dist/tex/generic/babel/locale/sa/babel-sa-Deva.ini
    trunk/Master/texmf-dist/tex/generic/babel/locale/sa/babel-sa.ini
    trunk/Master/texmf-dist/tex/generic/babel/luababel.def
    trunk/Master/texmf-dist/tex/generic/babel/nil.ldf

Modified: trunk/Master/texmf-dist/doc/latex/babel/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/babel/README.md	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/doc/latex/babel/README.md	2022-02-13 21:27:08 UTC (rev 62007)
@@ -1,5 +1,7 @@
-## Babel 3.70
+## Babel 3.71
 
+2022-02-13
+
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages. Many
 language styles work with pdflatex, as well as with xelatex and
@@ -8,9 +10,9 @@
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-Changes in version 3.70 are described in:
+Changes in version 3.71 are described in:
 
-https://latex3.github.io/babel/news/whats-new-in-babel-3.70.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.71.html
 
 Apart from the manual, you can find information on some aspects of babel at:
 
@@ -46,11 +48,13 @@
 
 ### Summary of Latest changes
 ```
-3.70   2022-01-26
-       * Finnish: transform 'prehyphen.nobreak'.
-       * Better fixes for amsmath, as well as for the default
-         'equation' and 'eqnarray' (but still not perfect).
-       * Fix an error with bidi=basic and some fonts for graphics.
+3.71   2022-02-13
+       * IAST transliteration for Sanskrit (by Maximilian Mehner).
+       * Fixes:
+         - Bad interraction between bidi option and mathtools (#166).
+         - 'provide+=' didn’t work with 'hebrew' as a secondary
+           language.
+         - Wrong equation direction in 'cases' and 'array' (#167).
 ```
 
 ### Previous changes

Modified: trunk/Master/texmf-dist/doc/latex/babel/babel.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.dtx	2022-02-13 21:27:08 UTC (rev 62007)
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2022/01/26 v3.70 The Babel package]
+\ProvidesFile{babel.dtx}[2022/02/13 v3.71 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -547,6 +547,7 @@
 \end{note}
 
 \subsection{Mostly monolingual documents}
+\label{mostlymono}
 
 \New{3.39} Very often, multilingual documents consist of a main
 language with small pieces of text in another languages (words, idioms,
@@ -1291,6 +1292,11 @@
 \New{3.16} Selects which layout elements are adapted in bidi
 documents. See sec.~\ref{bidi}.
 
+\Describe{provide=}{\texttt{*}}
+\New{3.49} An alternative to |\babelprovide| for languages passed as
+options. See section~\ref{inifiles}, which describes also the variants
+|provide+=| and |provide*=|.
+
 \subsection{The \texttt{base} option}
 
 With this package option \babel{} just loads some basic macros (those
@@ -1327,12 +1333,12 @@
 \end{verbatim}
 \end{example}
 
-% \begin{note}
-%   With a recent version of \LaTeX, an alternative method to execute
-%   some code just after an |ldf| file is loaded is with |\AddToHook| and
-%   the hook |file/after/<language>.ldf|. \Babel{} does not predeclare
-%   it, and you have to do it yourself with |\NewHook| or |\ProvideHook|.
-% \end{note}
+\begin{note}
+  With a recent version of \LaTeX, an alternative method to execute
+  some code just after an |ldf| file is loaded is with |\AddToHook| and
+  the hook |file/<language>.ldf/after|. \Babel{} does not predeclare
+  it, and you have to do it yourself with |\ActivateGenericHook|.
+\end{note}
 
 \begin{warning}
   Currently this option is not compatible with languages loaded on the
@@ -1344,8 +1350,8 @@
 
 An alternative approach to define a language (or, more precisely, a
 \textit{locale}) is by means of an \texttt{ini} file. Currently
-\babel{} provides about 200 of these files containing the basic data
-required for a locale. 
+\babel{} provides about 250 of these files containing the basic data
+required for a locale, plus basic templates for 500 about locales.
 
 |ini| files are not meant only for \babel, and they has been devised as
 a resource for other packages. To easy interoperability between \TeX{}
@@ -1435,11 +1441,12 @@
 \begin{description}
 \itemsep=-\parskip
 \item[Arabic] Monolingual documents mostly work in \luatex, but it must
-  be fine tuned, particularly graphical elements like |picture|. In \xetex{}
-  \babel{} resorts to the \textsf{bidi} package, which seems to work.
+  be fine tuned, particularly math and graphical elements like
+  |picture|. In \xetex{} \babel{} resorts to the \textsf{bidi} package,
+  which seems to work.
 \item[Hebrew] Niqqud marks seem to work in both engines, but depending 
   on the font cantillation marks might be misplaced (\xetex{} or
-  \luatex{} with Harfbuzz seems better, but still problematic).
+  \luatex{} with Harfbuzz seems better).
 \item[Devanagari] In \luatex{} and the the default renderer many fonts
 work, but some others do not, the main issue being the ‘ra’. You may
 need to set explicitly the script to either |deva| or |dev2|, eg:
@@ -1451,8 +1458,8 @@
   also work with \xetex{}, although unlike with \luatex{} fine tuning
   the font behavior is not always possible.
 \item[Southeast scripts] Thai works in both \luatex{} and \xetex{}, but
-  line breaking differs (rules can be modified in \luatex; they are
-  hard-coded in \xetex). Lao seems to work, too, but there are no
+  line breaking differs (rules are hard-coded in \xetex, but they can
+  be modified in \luatex). Lao seems to work, too, but there are no
   patterns for the latter in \luatex{}. Khemer clusters are rendered
   wrongly with the default renderer. The comment about Indic scripts
   and \textsf{lualatex} also applies here. Some quick patterns can
@@ -1479,7 +1486,7 @@
 \item[Latin, Greek, Cyrillic] Combining chars with the default
  \luatex{} font renderer might be wrong; on then other hand, with the
  Harfbuzz renderer diacritics are stacked correctly, but many
- hyphenations points are discarded (this bug seems related to kerning,
+ hyphenations points are discarded (this bug is related to kerning,
  so it depends on the font). With \xetex{} both combining characters
  and hyphenation work as expected (not quite, but in most cases it
  works; the problem here are font clusters).
@@ -2129,6 +2136,7 @@
 
 \textbf{Modifying and adding values to |ini| files}
 
+\nobreak 
 \New{3.39} There is a way to modify the values of |ini| files when they
 get loaded with |\babelprovide| and |import|. To set, say,
 |digits.native| in the |numbers| section, use something like
@@ -2573,6 +2581,9 @@
 \begin{verbatim}
 \usepackage[italian, polytonicgreek, provide=*]{babel}
 \end{verbatim}
+Finally, also remember you might not need to load |italian| at all if
+there are only a few word in this language (see~\ref{mostlymono}).
+
 \end{example}
 
 \Describe{script=}{\meta{script-name}}
@@ -2630,8 +2641,11 @@
 \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).
 
+\Describe{transforms=}{\meta{transform-list}}
+See section~\ref{transforms}.
+
 \Describe{justification=}{\texttt{kashida} $\string|$
 \texttt{elongated} $\string|$ \texttt{unhyphenated}}
 \New{3.59} There are currently three options, mainly for the Arabic
@@ -2676,10 +2690,10 @@
 
 For example:
 \begin{verbatim}
-\babelprovide[import]{telugu}  % Telugu better with XeTeX
+\babelprovide[import]{telugu}
   % Or also, if you want:
   % \babelprovide[import, maparabic]{telugu}
-\babelfont{rm}{Gautami}
+\babelfont{rm}{Gautami} % With luatex, better with Harfbuzz
 \begin{document}
 _\telugudigits{1234}_
 _\telugucounter{section}_
@@ -2827,7 +2841,7 @@
   {\marg{year}\m{month}\m{day}}}
 
 By default the calendar is the Gregorian, but an |ini| file may define
-strings for other calendars (currently |ar|, |ar-|*, |he|, |fa|, |hi|.)
+strings for other calendars (currently |ar|, |ar-|*, |he|, |fa|, |hi|).
 In the latter case, the three arguments are the year, the month, and
 the day in those in the corresponding calendar. They are \textit{not}
 the Gregorian data to be converted (which means, say, 13 is a valid
@@ -2853,7 +2867,7 @@
 
 If more than one language is used, it might be necessary to know which
 language is active at a specific time. This can be checked by a call
-to |\iflanguage|, but note here ``language'' is used in the \TeX
+to |\iflanguage|, but note here ``language'' is used in the \TeX{}
 sense, as a set of hyphenation patterns, and \textit{not} as its
 \textsf{babel} name. This macro takes three arguments.  The first
 argument is the name of a language; the second and third arguments are
@@ -2940,7 +2954,9 @@
 typically the LGC group, South East Asian, like Thai, and CJK, but
 support depends on the engine: \textsf{pdftex} only deals with the
 former, \xetex{} also with the second one (although in a limited way),
-while \luatex{} provides basic rules for the latter, too.
+while \luatex{} provides basic rules for the latter, too. With \luatex{}
+there are also tools for non-standard hyphenation rules, explained in
+the next section.
 
 \Describe{\babelhyphen}{%
   \colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}\marg{type}}
@@ -3087,6 +3103,7 @@
 |\selectfont| in \xetex).
 
 \subsection{Transforms}
+\label{transforms}
 
 Transforms (only \luatex) provide a way to process the text on the
 typesetting level in several language-dependent ways, like non-standard
@@ -3193,6 +3210,9 @@
 \trans{Latin}{letters.uv}{Replaces \textit{v}, \textit{U} with
 \textit{u}, \textit{V}.}
 
+\trans{Sanskrit}{transliteration.iast}{The IAST system to
+romanize Devanagari.\footnote{Thanks to Maximilian Mehner}}
+
 \trans{Serbian}{transliteration.gajica}{(Note |serbian| with |ini|
 files refers to the Cyrillic script, which is here the target.) The
 standard system devised by Ljudevit Gaj.}
@@ -3280,7 +3300,7 @@
 \babelprovide[hyphenrules=+]{russian-latin}   % Create locale
 \babelprehyphenation{russian-latin}{([sz])h}  % Create rule
 {
-  string = {1|sz|šž},
+  string = _{1|sz|šž}_,
   remove
 }
 \end{verbatim}
@@ -3449,15 +3469,16 @@
 
 \begin{warning}
   The current code for \textbf{text} in \luatex{} should be considered
-  essentially stable, but, of course, it is not bug-free and there
-  can be improvements in the future, because setting bidi text has
-  many subtleties (see for example <https://www.w3.org/TR/html-bidi/>).
-  A basic stable version for other engines must wait. This applies to
+  essentially stable, but, of course, it is not bug-free and there can
+  be improvements in the future, because setting bidi text has many
+  subtleties (see for example <https://www.w3.org/TR/html-bidi/>). A
+  basic stable version for other engines must wait. This applies to
   text; there is a basic support for \textbf{graphical} elements,
   including the |picture| environment (with \textsf{pict2e}) and
   \textsf{pfg/tikz}. Also, indexes and the like are under study, as
-  well as math (there is progress in the latter, too, but for
-  example |cases| may fail).
+  well as math (there are progresses in the latter, including
+  \textsf{amsmath} and \textsf{mathtools} too, but for example
+  |gathered| may fail).
 
   An effort is being made to avoid incompatibilities in the future
   (this one of the reason currently bidi must be explicitly requested
@@ -4156,7 +4177,7 @@
 See the code section for |\foreignlanguage*| (a new starred
 version of |\foreignlanguage|).
 
-For old an deprecated functions, see the wiki.
+For old an deprecated functions, see the \babel{} site.
 
 \medskip
 \textbf{Options for locales loaded on the fly}
@@ -4173,7 +4194,8 @@
 \New{3.48} There is some work in progress for \babel{} to deal with
 labels, both with the relation to captions (chapters, part), and how
 counters are used to define them. It is still somewhat tentative
-because it is far from trivial -- see the wiki for further details.
+because it is far from trivial -- see the \babel{} site for further
+details.
 
 \section{Loading languages with \file{language.dat}}
 
@@ -4925,50 +4947,6 @@
 
 Its natural place of use is in hooks or in |\extras|\m{language}.
 
-\section{Changes}
-
-\subsection{Changes in \babel\ version 3.9}
-
-Most of the changes in version 3.9 were related to bugs, either to fix
-them (there were lots), or to provide some alternatives. Even new
-features like |\babelhyphen| are intended to solve a certain problem
-(in this case, the lacking of a uniform syntax and behavior for
-shorthands across languages). These changes, as well as the subsequent
-ones ($\ge$3.10), are described in this manual in the corresponding
-place. A selective list of the changes in 3.9 follows:
-\begin{itemize}
-\item |\select at language| did not set |\languagename|. This meant the
-  language in force when auxiliary files were loaded was the one used
-  in, for example, shorthands -- if the language was |german|, a
-  |\select at language{spanish}| had no effect.
-
-\item |\foreignlanguage| and |otherlanguage*| messed up
-  |\extras<language>|. Scripts, encodings and many other things were
-  not switched correctly.
-
-\item The |:ENC| mechanism for hyphenation patterns used the encoding
-  of the \textit{previous} language, not that of the language being
-  selected.
-
-\item |'| (with |activeacute|) had the original value when writing to an
-  auxiliary file, and things like an infinite loop can happen. It
-  worked incorrectly with |^| (if activated) and also if deactivated.
-
-\item Active chars where not reset at the end of language options, and
-  that lead to incompatibilities between languages.
-
-\item |\textormath| raised an error with a conditional.
-
-\item |\aliasshorthand| didn't work (or only in a few and very specific
-  cases).
-
-\item |\l at english| was defined incorrectly (using |\let| instead of
-  |\chardef|).
-
-\item |ldf| files not bundled with babel were not recognized when
-  called as global options.
-\end{itemize}
-
 \DocInput{babel.dtx}
 
 \section{Acknowledgements}
@@ -5122,8 +5100,8 @@
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.70>>
-%<<date=2022/01/26>>
+%<<version=3.71>>
+%<<date=2022/02/13>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -12172,39 +12150,38 @@
 % the language exists. With class options, check if the option is a
 % language by checking if the correspondin file exists.
 % 
-%
 %    \begin{macrocode}
 \bbl at foreach\bbl at language@opts{%
   \def\bbl at tempa{#1}%
   \ifx\bbl at tempa\bbl at opt@main\else
-    \bbl at ifunset{ds@#1}%
-      {\ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
-         \DeclareOption{#1}{\bbl at load@language{#1}}%
-       \else                      % + * (other = ini)
-         \DeclareOption{#1}{%
-           \bbl at ldfinit
-           \babelprovide[import]{#1}%
-           \bbl at afterldf{}}%
-       \fi}%
-      {}%
+    \ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
+      \bbl at ifunset{ds@#1}%
+        {\DeclareOption{#1}{\bbl at load@language{#1}}}%
+        {}%
+    \else                      % + * (other = ini)
+      \DeclareOption{#1}{%
+        \bbl at ldfinit
+        \babelprovide[import]{#1}%
+        \bbl at afterldf{}}%
+    \fi
   \fi}
 \bbl at foreach\@classoptionslist{%
   \def\bbl at tempa{#1}%
   \ifx\bbl at tempa\bbl at opt@main\else
-    \bbl at ifunset{ds@#1}%
-      {\ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
-         \IfFileExists{#1.ldf}%
-           {\DeclareOption{#1}{\bbl at load@language{#1}}}%
-           {}%
-       \else                      % + * (other = ini)
-         \IfFileExists{babel-#1.tex}% 
-           {\DeclareOption{#1}{%  
-              \bbl at ldfinit
-              \babelprovide[import]{#1}%
-              \bbl at afterldf{}}}%
-           {}%
-       \fi}%
-    {}%
+    \ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
+      \bbl at ifunset{ds@#1}%
+        {\IfFileExists{#1.ldf}%
+          {\DeclareOption{#1}{\bbl at load@language{#1}}}%
+          {}}%
+        {}%
+     \else                      % + * (other = ini)
+       \IfFileExists{babel-#1.tex}% 
+         {\DeclareOption{#1}{%  
+            \bbl at ldfinit
+            \babelprovide[import]{#1}%
+            \bbl at afterldf{}}}%
+         {}%
+     \fi
   \fi}
 %    \end{macrocode}
 %
@@ -13484,6 +13461,30 @@
     end
     lang.patterns(lg, pats)
   end
+  function Babel.hlist_has_bidi(head)
+    local has_bidi = false
+    for item in node.traverse(head) do
+      if item.id == node.id'glyph' then
+        local itemchar = item.char
+        local chardata = Babel.characters[itemchar]
+        local dir = chardata and chardata.d or nil
+        if not dir then
+          for nn, et in ipairs(Babel.ranges) do
+            if itemchar < et[1] then
+              break
+            elseif itemchar <= et[2] then
+              dir = et[3]
+              break
+            end
+          end
+        end
+        if dir and (dir == 'al' or dir == 'r') then
+          has_bidi = true
+        end
+      end
+    end
+    return has_bidi
+  end
 }
 \endgroup
 \ifx\newattribute\@undefined\else
@@ -14462,9 +14463,11 @@
       #2 TRT\relax
     \fi
   \fi}
+\def\bbl at thedir{0}
 \def\bbl at textdir#1{%
   \bbl at setluadir{text}\textdir{#1}%
   \chardef\bbl at thetextdir#1\relax
+  \edef\bbl at thedir{\the\numexpr\bbl at thepardir*3+#1}%
   \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*3+#1}}
 \def\bbl at pardir#1{%
   \bbl at setluadir{par}\pardir{#1}%
@@ -14474,6 +14477,7 @@
 \def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
 %
 \ifnum\bbl at bidimode>\z@
+  \def\bbl at insidemath{0}%
   \def\bbl at mathboxdir{%
     \ifcase\bbl at thetextdir\relax
       \everyhbox{\bbl at mathboxdir@aux L}%
@@ -14482,15 +14486,35 @@
      \fi}
   \def\bbl at mathboxdir@aux#1{%
     \@ifnextchar\egroup{}{\textdir T#1T\relax}}
+  \def\bbl at everymath{\def\bbl at insidemath{1}}
+  \def\bbl at everydisplay{%
+    \bbl at mathboxdir
+    \def\bbl at everymath{\bbl at mathboxdir}%
+    \def\bbl at insidemath{2}}
   \frozen at everymath\expandafter{%
-    \expandafter\bbl at mathboxdir\the\frozen at everymath}
+    \expandafter\bbl at everymath\the\frozen at everymath}
   \frozen at everydisplay\expandafter{%
-    \expandafter\bbl at mathboxdir\the\frozen at everydisplay}
+    \expandafter\bbl at everydisplay\the\frozen at everydisplay}
+  \AtBeginDocument{
+    \directlua{
+      function Babel.math_box_dir(head)
+        if not (token.get_macro('bbl at insidemath') == '0') then
+          if Babel.hlist_has_bidi(head) then
+            local d = node.new(node.id'dir')
+            d.dir = '+TRT'
+            node.insert_before(head, node.has_glyph(head), d)
+            for item in node.traverse(head) do
+              node.set_attribute(item,
+                Babel.attr_dir, token.get_macro('bbl at thedir'))
+            end
+          end
+        end
+        return head
+      end
+      luatexbase.add_to_callback("hpack_filter", Babel.math_box_dir,
+        "Babel.math_box_dir", 0)
+  }}%
 \fi
-\def\bbl at truellap{%s
-  \ifcase\bbl at attr@dir\expandafter\llap\else\expandafter\rlap\fi}
-\def\bbl at truerlap{%
-  \ifcase\bbl at attr@dir\expandafter\rlap\else\expandafter\llap\fi}
 %    \end{macrocode}
 %
 % \subsection{Layout}
@@ -14518,8 +14542,12 @@
 %
 %    \begin{macrocode}
 \bbl at trace{Redefinitions for bidi layout}
+\def\BabelNoAMSMath{\let\bbl at noamsmath\relax}
 \ifnum\bbl at bidimode>\z@
   \let\bbl at eqnodir\relax
+%   \ifx\matheqdirmode\@undefined\else
+%     \matheqdirmode\@ne
+%   \fi
   \AtBeginDocument{%
     \ifx\maketag@@@\@undefined % Normal equation, eqnarray
       \AddToHook{env/eqnarray/begin}{%
@@ -14538,65 +14566,74 @@
       \bbl at xin@{,leqno,}{,\@classoptionslist,}%
       \ifin@
         \def\@eqnnum{%
-           \setbox\z@\hbox{\normalfont\normalcolor(\theequation)}%
-           \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
+          \setbox\z@\hbox{\normalfont\normalcolor(\theequation)}%
+          \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
       \fi
     \else % amstex
-      \bbl at sreplace\intertext@{\normalbaselines}%
-        {\normalbaselines
-         \ifx\bbl at eqnodir\relax\else\bbl at pardir\@ne\bbl at textdir\@ne\fi}
-      \def\bbl at ams@tagbox#1#2{#1{\bbl at eqnodir#2}}% #1=\hbox|ams at lap
-      \def\bbl at ams@eqtagbox#1{%
-        \setbox\z@\hbox{\bbl at eqnodir#1}%
-        \hbox to\wd\z@{%
-          \ifx\bbl at ams@lap\hbox
-            \hss\hbox to\displaywidth{\box\z@\hss}%
-          \else
-            \hbox to\displaywidth{\hss\box\z@}\hss
-          \fi}}
-      \def\bbl at ams@preset#1{%
-        \ifnum\bbl at thetextdir>\z@
-          \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
-          \chardef\bbl at thetextdir\z@
-          \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
-          \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@tagbox#1}%
-        \fi}
-      \@ifpackagewith{amsmath}{leqno}%
-        {\let\bbl at ams@lap\hbox}% = leqno
-        {\let\bbl at ams@lap\llap}% = default
-      % Not required?: split, alignat
-      \AddToHook{env/cases/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      \AddToHook{env/multline/begin}{\bbl at ams@preset\hbox}%
-      \AddToHook{env/gather/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      \AddToHook{env/gather*/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      \AddToHook{env/align/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      \AddToHook{env/align*/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      % Hackish, for proper alignment-don’t ask me why it works! :-)
-      \bbl at exp{%
-        \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
-      \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
-      \AddToHook{env/split/before}{%
-        \def\bbl at tempa{equation}%
-        \ifx\@currenvir\bbl at tempa
-          \def\bbl at ams@eqtagbox#1{%
-            \setbox\z@\hbox{\bbl at eqnodir#1}%
-            \hbox to\wd\z@{\box\z@}}%
-        \fi}
-      \AddToHook{env/equation/begin}{%
-        \bbl at add\ignorespacesafterend{\hrule\@height\z@}%
-        \ifnum\bbl at thetextdir>\z@
-          \ifx\bbl at ams@lap\llap\hrule\@height\z@\fi        
-          \def\bbl at eqnodir{\bbl at textdir\@ne}%
-          \bbl at textdir\z@
-          \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@eqtagbox}%
-        \fi}%
-      \AddToHook{env/equation*/begin}{%
-        \bbl at add\ignorespacesafterend{\hrule\@height\z@}%
-        \ifnum\bbl at thetextdir>\z@            
-          \def\bbl at eqnodir{\bbl at textdir\@ne}%
-          \bbl at textdir\z@
-          \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@eqtagbox}%
-        \fi}%
+      \ifx\bbl at noamsmath\@undefined
+        \edef\bbl at tempa{%
+          \catcode58=\the\catcode58\relax
+          \catcode95=\the\catcode95\relax}%
+        \catcode58=11
+        \catcode95=11
+        \bbl at sreplace\intertext@{\normalbaselines}%
+          {\normalbaselines
+           \ifx\bbl at eqnodir\relax\else\bbl at pardir\@ne\bbl at eqnodir\fi}%
+        \bbl at tempa
+        \def\bbl at ams@tagbox#1#2{#1{\bbl at eqnodir#2}}% #1=\hbox|ams at lap
+        \def\bbl at ams@eqtagbox#1{%
+          \setbox\z@\hbox{\bbl at eqnodir#1}%
+          \hbox to 0.01pt{%
+            \ifx\bbl at ams@lap\hbox
+              \hbox to\displaywidth{\hss\box\z@}\hss
+            \else
+              \hss\hbox to\displaywidth{\box\z@\hss}%
+            \fi}}
+        \def\bbl at ams@preset#1{%
+          \ifnum\bbl at thetextdir>\z@
+            \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
+            \chardef\bbl at thetextdir\z@
+            \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
+            \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@tagbox#1}%
+          \fi}
+        \@ifpackagewith{amsmath}{leqno}%
+          {\let\bbl at ams@lap\hbox}% = leqno
+          {\let\bbl at ams@lap\llap}% = default
+        % 
+        \AddToHook{env/cases/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        \AddToHook{env/multline/begin}{\bbl at ams@preset\hbox}%
+        \AddToHook{env/gather/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        \AddToHook{env/gather*/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        \AddToHook{env/align/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        \AddToHook{env/align*/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        % Hackish, for proper alignment-don’t ask me why it works! :-)
+        \bbl at exp{%
+          \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
+        \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
+        \AddToHook{env/split/before}{%
+          \ifnum\bbl at thetextdir>\z@
+            \def\bbl at tempa{equation}%
+            \ifx\@currenvir\bbl at tempa
+              \def\bbl at ams@eqtagbox#1{%
+                \ifx\bbl at ams@lap\hbox
+                  \hbox to0.01pt{\hss\bbl at eqnodir#1}% leqno
+                \else
+                  \hbox to0.01pt{\bbl at eqnodir#1\hss}% eqno
+                \fi}
+            \fi
+          \fi}
+        \AddToHook{env/equation/begin}{%
+          \ifnum\bbl at thetextdir>\z@
+            \ifx\bbl at ams@lap\llap\hrule\@height\z@\fi
+            \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
+            \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@eqtagbox}%
+          \fi}%
+        \AddToHook{env/equation*/begin}{%
+          \ifnum\bbl at thetextdir>\z@
+            \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
+            \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@eqtagbox}%
+          \fi}%
+        \fi
       \fi}
 \fi
 \ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
@@ -14603,6 +14640,7 @@
 \ifnum\bbl at bidimode>\z@
   \def\bbl at nextfake#1{%  non-local changes, use always inside a group!
     \bbl at exp{%
+      \def\\\bbl at insidemath{0}%
       \mathdir\the\bodydir  
       #1%              Once entered in math, set boxes to restore values
       \<ifmmode>%
@@ -14665,28 +14703,11 @@
      \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
-         for item in node.traverse(head) do
-           if item.id == node.id'glyph' then
-             local itemchar = item.char
-             % TODO. Copypaste pattern from Babel.bidi (-r)
-             local chardata = Babel.characters[itemchar]
-             local dir = chardata and chardata.d or nil
-             if not dir then
-               for nn, et in ipairs(Babel.ranges) do
-                 if itemchar < et[1] then
-                   break
-                 elseif itemchar <= et[2] then
-                   dir = et[3]
-                   break
-                 end
-               end
-             end
-             if dir and (dir == 'al' or dir == 'r') then
-               Babel.picture_has_bidi = 1
-             end
-           end
+         if Babel.hlist_has_bidi(head) then 
+           Babel.picture_has_bidi = 1
          end
          return head
        end

Modified: trunk/Master/texmf-dist/source/latex/babel/babel.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/babel.ins	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/source/latex/babel/babel.ins	2022-02-13 21:27:08 UTC (rev 62007)
@@ -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/01/26}
+\def\filedate{2022/02/13}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 

Modified: trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/source/latex/babel/bbcompat.dtx	2022-02-13 21:27:08 UTC (rev 62007)
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/01/26 v3.70]
+\ProvidesFile{bbcompat.dtx}[2022/02/13 v3.71]
 %</dtx>
 %
 %% File 'bbcompat.dtx'

Modified: trunk/Master/texmf-dist/source/latex/babel/locale.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.def	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.def	2022-02-13 21:27:08 UTC (rev 62007)
@@ -40,7 +40,7 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{babel.def}[2022/01/26 3.70 Babel common definitions]
+\ProvidesFile{babel.def}[2022/02/13 3.71 Babel common definitions]
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
   \def\@empty{}
 \def\loadlocalcfg#1{%
@@ -406,8 +406,8 @@
 \expandafter\newif\csname ifbbl at single\endcsname
 \chardef\bbl at bidimode\z@
 \fi
-\def\bbl at version{3.70}
-\def\bbl at date{2022/01/26}
+\def\bbl at version{3.71}
+\def\bbl at date{2022/02/13}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi

Modified: trunk/Master/texmf-dist/tex/generic/babel/babel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/tex/generic/babel/babel.sty	2022-02-13 21:27:08 UTC (rev 62007)
@@ -34,7 +34,7 @@
 %%
 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{babel}[2022/01/26 3.70 The Babel package]
+\ProvidesPackage{babel}[2022/02/13 3.71 The Babel package]
 \@ifpackagewith{babel}{debug}
   {\providecommand\bbl at trace[1]{\message{^^J[ #1 ]}}%
    \let\bbl at debug\@firstofone
@@ -453,8 +453,8 @@
       \expandafter\@secondoftwo
     \fi}
 \fi
-\def\bbl at version{3.70}
-\def\bbl at date{2022/01/26}
+\def\bbl at version{3.71}
+\def\bbl at date{2022/02/13}
 \ifx\language\@undefined
   \csname newcount\endcsname\language
 \fi
@@ -4219,34 +4219,34 @@
 \bbl at foreach\bbl at language@opts{%
   \def\bbl at tempa{#1}%
   \ifx\bbl at tempa\bbl at opt@main\else
-    \bbl at ifunset{ds@#1}%
-      {\ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
-         \DeclareOption{#1}{\bbl at load@language{#1}}%
-       \else                      % + * (other = ini)
-         \DeclareOption{#1}{%
-           \bbl at ldfinit
-           \babelprovide[import]{#1}%
-           \bbl at afterldf{}}%
-       \fi}%
-      {}%
+    \ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
+      \bbl at ifunset{ds@#1}%
+        {\DeclareOption{#1}{\bbl at load@language{#1}}}%
+        {}%
+    \else                      % + * (other = ini)
+      \DeclareOption{#1}{%
+        \bbl at ldfinit
+        \babelprovide[import]{#1}%
+        \bbl at afterldf{}}%
+    \fi
   \fi}
 \bbl at foreach\@classoptionslist{%
   \def\bbl at tempa{#1}%
   \ifx\bbl at tempa\bbl at opt@main\else
-    \bbl at ifunset{ds@#1}%
-      {\ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
-         \IfFileExists{#1.ldf}%
-           {\DeclareOption{#1}{\bbl at load@language{#1}}}%
-           {}%
-       \else                      % + * (other = ini)
-         \IfFileExists{babel-#1.tex}%
-           {\DeclareOption{#1}{%
-              \bbl at ldfinit
-              \babelprovide[import]{#1}%
-              \bbl at afterldf{}}}%
-           {}%
-       \fi}%
-    {}%
+    \ifnum\bbl at iniflag<\tw@    % 0 ø (other = ldf)
+      \bbl at ifunset{ds@#1}%
+        {\IfFileExists{#1.ldf}%
+          {\DeclareOption{#1}{\bbl at load@language{#1}}}%
+          {}}%
+        {}%
+     \else                      % + * (other = ini)
+       \IfFileExists{babel-#1.tex}%
+         {\DeclareOption{#1}{%
+            \bbl at ldfinit
+            \babelprovide[import]{#1}%
+            \bbl at afterldf{}}}%
+         {}%
+     \fi
   \fi}
 \def\AfterBabelLanguage#1{%
   \bbl at ifsamestring\CurrentOption{#1}{\global\bbl at add\bbl at afterlang}{}}

Modified: trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/tex/generic/babel/hyphen.cfg	2022-02-13 21:27:08 UTC (rev 62007)
@@ -38,10 +38,10 @@
     \wlog{File: #1 #4 #3 <#2>}%
     \let\ProvidesFile\@undefined}
 \fi
-\ProvidesFile{hyphen.cfg}[2022/01/26 3.70 Babel hyphens]
+\ProvidesFile{hyphen.cfg}[2022/02/13 3.71 Babel hyphens]
 \xdef\bbl at format{\jobname}
-\def\bbl at version{3.70}
-\def\bbl at date{2022/01/26}
+\def\bbl at version{3.71}
+\def\bbl at date{2022/02/13}
 \ifx\AtBeginDocument\@undefined
   \def\@empty{}
 \fi

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sa/babel-sa-Deva.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sa/babel-sa-Deva.ini	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sa/babel-sa-Deva.ini	2022-02-13 21:27:08 UTC (rev 62007)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 0.11
-date = 2021-04-24
+version = 0.12
+date = 2022-02-06
 name.local = संस्कृत
 name.english = Sanskrit
 name.babel = sanskrit
@@ -159,4 +159,100 @@
 ; Inherent a
 transliteration.hk.11.0 = { [{0915}-{0939}]{0905} }
 transliteration.hk.11.1 =   {}
-transliteration.hk.11.2 =   { remove }
\ No newline at end of file
+transliteration.hk.11.2 =   { remove }
+; == IAST ==
+; Contributed by Maximilian Mehner
+; uppercase to lowercase
+transliteration.iast.1.0 = { ([AIUṚṜḶḸEOṂḤKGṄCJÑṬḌṆTDNPBMYRLVŚṢSH]) }
+transliteration.iast.1.1 =   { string = {1|AIUṚṜḶḸEOṂḤKGṄCJÑṬḌṆTDNPBMYRLVŚṢSH|aiuṛṝḷḹeoṃḥkgṅcjñṭḍṇtdnpbmyrlvśṣsh} }
+; whitespace
+transliteration.iast.2.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh])|([aiuṛṝḷḹeokgṅcjñṭḍṇtdnpbmyrlvśṣsh]) }
+transliteration.iast.2.1 =   { string = {1} }
+transliteration.iast.2.2 =   { remove }
+transliteration.iast.2.3 =   { string = {2} }
+; special strings
+transliteration.iast.3.0 = { oṃ }
+transliteration.iast.3.1 =   { string = ॐ }
+; aspirata with vowels
+transliteration.iast.4.0 = { ([kgcjṭḍtdpb])[h][a]([iu]) }
+transliteration.iast.4.1 =   { string = {1|kgcjṭḍtdpb|खघछझठढथधफभ} }
+transliteration.iast.4.2 =   { remove }
+transliteration.iast.4.3 =   { remove }
+transliteration.iast.4.4 =   { string = {2|iu|ैौ} }
+;
+transliteration.iast.5.0 = { ([kgcjṭḍtdpb])[h][a] }
+transliteration.iast.5.1 =   { string = {1|kgcjṭḍtdpb|खघछझठढथधफभ} }
+transliteration.iast.5.2 =   { remove }
+transliteration.iast.5.3 =   { remove }
+;
+transliteration.iast.6.0 = { ([kgcjṭḍtdpb])[h]([āiīuūṛṝḷḹeo]) }
+transliteration.iast.6.1 =   { string = {1|kgcjṭḍtdpb|खघछझठढथधफभ} }
+transliteration.iast.6.2 =   { remove }
+transliteration.iast.6.3 =   { string = {2|āiīuūṛṝḷḹeo|ािीुूृॄॢॣेो} }
+; aspirata without vowels
+transliteration.iast.7.0 = { ([kgcjṭḍtdpb])[h] }
+transliteration.iast.7.1 =   { string = {1|kgcjṭḍtdpb|खघछझठढथधफभ}् }
+transliteration.iast.7.2 =   { remove }
+; tenues with vowels
+transliteration.iast.8.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh])[a]([iu]) }
+transliteration.iast.8.1 =   { string = {1|kgṅcjñṭḍṇtdnpbmyrlvśṣsh|कगङचजञटडणतदनपबमयरलवशषसह} }
+transliteration.iast.8.2 =   { remove }
+transliteration.iast.8.3 =   { string = {2|iu|ैौ} }
+;
+transliteration.iast.9.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh])[a] }
+transliteration.iast.9.1 =   { string = {1|kgṅcjñṭḍṇtdnpbmyrlvśṣsh|कगङचजञटडणतदनपबमयरलवशषसह} }
+transliteration.iast.9.2 =   { remove }
+;
+transliteration.iast.10.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh])([āiīuūṛṝḷḹeo]) }
+transliteration.iast.10.1 =   { string = {1|kgṅcjñṭḍṇtdnpbmyrlvśṣsh|कगङचजञटडणतदनपबमयरलवशषसह} }
+transliteration.iast.10.2 =   { string = {2|āiīuūṛṝḷḹeo|ािीुूृॄॢॣेो} }
+; tenues without vowels
+transliteration.iast.11.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh]) }
+transliteration.iast.11.1 =   { string = {1|kgṅcjñṭḍṇtdnpbmyrlvśṣsh|कगङचजञटडणतदनपबमयरलवशषसह}् }
+; vowels
+; initial vowels
+transliteration.iast.12.0 = { ai }
+transliteration.iast.12.1 =   { string = ऐ }
+transliteration.iast.13.0 = { au }
+transliteration.iast.13.1 =   { string = औ }
+transliteration.iast.14.0 = { a }
+transliteration.iast.14.1 =   { string = अ }
+transliteration.iast.15.0 = { ā }
+transliteration.iast.15.1 =   { string = आ }
+transliteration.iast.16.0 = { i }
+transliteration.iast.16.1 =   { string = इ }
+transliteration.iast.17.0 = { ī }
+transliteration.iast.17.1 =   { string = ई }
+transliteration.iast.18.0 = { u }
+transliteration.iast.18.1 =   { string = उ }
+transliteration.iast.19.0 = { ū }
+transliteration.iast.19.1 =   { string = ऊ }
+transliteration.iast.20.0 = { ṛ }
+transliteration.iast.20.1 =   { string = ऋ }
+transliteration.iast.21.0 = { ṝ }
+transliteration.iast.21.1 =   { string = ॠ }
+transliteration.iast.22.0 = { ḷ }
+transliteration.iast.22.1 =   { string = लृ }
+transliteration.iast.23.0 = { ḹ }
+transliteration.iast.23.1 =   { string = लॄ }
+transliteration.iast.24.0 = { e }
+transliteration.iast.24.1 =   { string = ए }
+transliteration.iast.25.0 = { o }
+transliteration.iast.25.1 =   { string = ओ }}
+; special characters
+transliteration.iast.26.0 = { ' }
+transliteration.iast.26.1 =   { string = ऽ }
+transliteration.iast.27.0 = { ṃ }
+transliteration.iast.27.1 =   { string = ं }
+transliteration.iast.28.0 = { ḥ }
+transliteration.iast.28.1 =   { string = ः }
+; numbers
+transliteration.iast.29.0 = { ([0123456789]) }
+transliteration.iast.29.1 =   { string = {1|0123456789|०१२३४५६७८९} }
+; punctuation
+transliteration.iast.30.0 = { [./][./] }
+transliteration.iast.30.1 =   { string = ॥ }
+transliteration.iast.31.0 = { [./] }
+transliteration.iast.31.1 =   { string = । }
+transliteration.iast.32.0 = { [:] }
+transliteration.iast.32.1 =   { string = – }
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/generic/babel/locale/sa/babel-sa.ini
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/locale/sa/babel-sa.ini	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/tex/generic/babel/locale/sa/babel-sa.ini	2022-02-13 21:27:08 UTC (rev 62007)
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 0.11
-date = 2021-04-2430
+version = 0.12
+date = 2022-02-05
 name.english = Sanskrit
 name.babel = sanskrit
 name.polyglossia = sanskrit
@@ -145,3 +145,99 @@
 transliteration.hk.11.0 = { [{0915}-{0939}]{0905} }
 transliteration.hk.11.1 =   {}
 transliteration.hk.11.2 =   { remove }
+; == IAST ==
+; Contributed by Maximilian Mehner
+; uppercase to lowercase
+transliteration.iast.1.0 = { ([AIUṚṜḶḸEOṂḤKGṄCJÑṬḌṆTDNPBMYRLVŚṢSH]) }
+transliteration.iast.1.1 =   { string = {1|AIUṚṜḶḸEOṂḤKGṄCJÑṬḌṆTDNPBMYRLVŚṢSH|aiuṛṝḷḹeoṃḥkgṅcjñṭḍṇtdnpbmyrlvśṣsh} }
+; whitespace
+transliteration.iast.2.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh])|([aiuṛṝḷḹeokgṅcjñṭḍṇtdnpbmyrlvśṣsh]) }
+transliteration.iast.2.1 =   { string = {1} }
+transliteration.iast.2.2 =   { remove }
+transliteration.iast.2.3 =   { string = {2} }
+; special strings
+transliteration.iast.3.0 = { oṃ }
+transliteration.iast.3.1 =   { string = ॐ }
+; aspirata with vowels
+transliteration.iast.4.0 = { ([kgcjṭḍtdpb])[h][a]([iu]) }
+transliteration.iast.4.1 =   { string = {1|kgcjṭḍtdpb|खघछझठढथधफभ} }
+transliteration.iast.4.2 =   { remove }
+transliteration.iast.4.3 =   { remove }
+transliteration.iast.4.4 =   { string = {2|iu|ैौ} }
+;
+transliteration.iast.5.0 = { ([kgcjṭḍtdpb])[h][a] }
+transliteration.iast.5.1 =   { string = {1|kgcjṭḍtdpb|खघछझठढथधफभ} }
+transliteration.iast.5.2 =   { remove }
+transliteration.iast.5.3 =   { remove }
+;
+transliteration.iast.6.0 = { ([kgcjṭḍtdpb])[h]([āiīuūṛṝḷḹeo]) }
+transliteration.iast.6.1 =   { string = {1|kgcjṭḍtdpb|खघछझठढथधफभ} }
+transliteration.iast.6.2 =   { remove }
+transliteration.iast.6.3 =   { string = {2|āiīuūṛṝḷḹeo|ािीुूृॄॢॣेो} }
+; aspirata without vowels
+transliteration.iast.7.0 = { ([kgcjṭḍtdpb])[h] }
+transliteration.iast.7.1 =   { string = {1|kgcjṭḍtdpb|खघछझठढथधफभ}् }
+transliteration.iast.7.2 =   { remove }
+; tenues with vowels
+transliteration.iast.8.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh])[a]([iu]) }
+transliteration.iast.8.1 =   { string = {1|kgṅcjñṭḍṇtdnpbmyrlvśṣsh|कगङचजञटडणतदनपबमयरलवशषसह} }
+transliteration.iast.8.2 =   { remove }
+transliteration.iast.8.3 =   { string = {2|iu|ैौ} }
+;
+transliteration.iast.9.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh])[a] }
+transliteration.iast.9.1 =   { string = {1|kgṅcjñṭḍṇtdnpbmyrlvśṣsh|कगङचजञटडणतदनपबमयरलवशषसह} }
+transliteration.iast.9.2 =   { remove }
+;
+transliteration.iast.10.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh])([āiīuūṛṝḷḹeo]) }
+transliteration.iast.10.1 =   { string = {1|kgṅcjñṭḍṇtdnpbmyrlvśṣsh|कगङचजञटडणतदनपबमयरलवशषसह} }
+transliteration.iast.10.2 =   { string = {2|āiīuūṛṝḷḹeo|ािीुूृॄॢॣेो} }
+; tenues without vowels
+transliteration.iast.11.0 = { ([kgṅcjñṭḍṇtdnpbmyrlvśṣsh]) }
+transliteration.iast.11.1 =   { string = {1|kgṅcjñṭḍṇtdnpbmyrlvśṣsh|कगङचजञटडणतदनपबमयरलवशषसह}् }
+; vowels
+; initial vowels
+transliteration.iast.12.0 = { ai }
+transliteration.iast.12.1 =   { string = ऐ }
+transliteration.iast.13.0 = { au }
+transliteration.iast.13.1 =   { string = औ }
+transliteration.iast.14.0 = { a }
+transliteration.iast.14.1 =   { string = अ }
+transliteration.iast.15.0 = { ā }
+transliteration.iast.15.1 =   { string = आ }
+transliteration.iast.16.0 = { i }
+transliteration.iast.16.1 =   { string = इ }
+transliteration.iast.17.0 = { ī }
+transliteration.iast.17.1 =   { string = ई }
+transliteration.iast.18.0 = { u }
+transliteration.iast.18.1 =   { string = उ }
+transliteration.iast.19.0 = { ū }
+transliteration.iast.19.1 =   { string = ऊ }
+transliteration.iast.20.0 = { ṛ }
+transliteration.iast.20.1 =   { string = ऋ }
+transliteration.iast.21.0 = { ṝ }
+transliteration.iast.21.1 =   { string = ॠ }
+transliteration.iast.22.0 = { ḷ }
+transliteration.iast.22.1 =   { string = लृ }
+transliteration.iast.23.0 = { ḹ }
+transliteration.iast.23.1 =   { string = लॄ }
+transliteration.iast.24.0 = { e }
+transliteration.iast.24.1 =   { string = ए }
+transliteration.iast.25.0 = { o }
+transliteration.iast.25.1 =   { string = ओ }}
+; special characters
+transliteration.iast.26.0 = { ' }
+transliteration.iast.26.1 =   { string = ऽ }
+transliteration.iast.27.0 = { ṃ }
+transliteration.iast.27.1 =   { string = ं }
+transliteration.iast.28.0 = { ḥ }
+transliteration.iast.28.1 =   { string = ः }
+; numbers
+transliteration.iast.29.0 = { ([0123456789]) }
+transliteration.iast.29.1 =   { string = {1|0123456789|०१२३४५६७८९} }
+; punctuation
+transliteration.iast.30.0 = { [./][./] }
+transliteration.iast.30.1 =   { string = ॥ }
+transliteration.iast.31.0 = { [./] }
+transliteration.iast.31.1 =   { string = । }
+transliteration.iast.32.0 = { [:] }
+transliteration.iast.32.1 =   { string = – }

Modified: trunk/Master/texmf-dist/tex/generic/babel/luababel.def
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/tex/generic/babel/luababel.def	2022-02-13 21:27:08 UTC (rev 62007)
@@ -248,6 +248,30 @@
     end
     lang.patterns(lg, pats)
   end
+  function Babel.hlist_has_bidi(head)
+    local has_bidi = false
+    for item in node.traverse(head) do
+      if item.id == node.id'glyph' then
+        local itemchar = item.char
+        local chardata = Babel.characters[itemchar]
+        local dir = chardata and chardata.d or nil
+        if not dir then
+          for nn, et in ipairs(Babel.ranges) do
+            if itemchar < et[1] then
+              break
+            elseif itemchar <= et[2] then
+              dir = et[3]
+              break
+            end
+          end
+        end
+        if dir and (dir == 'al' or dir == 'r') then
+          has_bidi = true
+        end
+      end
+    end
+    return has_bidi
+  end
 }
 \endgroup
 \ifx\newattribute\@undefined\else
@@ -1310,9 +1334,11 @@
       #2 TRT\relax
     \fi
   \fi}
+\def\bbl at thedir{0}
 \def\bbl at textdir#1{%
   \bbl at setluadir{text}\textdir{#1}%
   \chardef\bbl at thetextdir#1\relax
+  \edef\bbl at thedir{\the\numexpr\bbl at thepardir*3+#1}%
   \setattribute\bbl at attr@dir{\numexpr\bbl at thepardir*3+#1}}
 \def\bbl at pardir#1{%
   \bbl at setluadir{par}\pardir{#1}%
@@ -1321,6 +1347,7 @@
 \def\bbl at pagedir{\bbl at setluadir{page}\pagedir}
 \def\bbl at dirparastext{\pardir\the\textdir\relax}%   %%%%
 \ifnum\bbl at bidimode>\z@
+  \def\bbl at insidemath{0}%
   \def\bbl at mathboxdir{%
     \ifcase\bbl at thetextdir\relax
       \everyhbox{\bbl at mathboxdir@aux L}%
@@ -1329,16 +1356,37 @@
      \fi}
   \def\bbl at mathboxdir@aux#1{%
     \@ifnextchar\egroup{}{\textdir T#1T\relax}}
+  \def\bbl at everymath{\def\bbl at insidemath{1}}
+  \def\bbl at everydisplay{%
+    \bbl at mathboxdir
+    \def\bbl at everymath{\bbl at mathboxdir}%
+    \def\bbl at insidemath{2}}
   \frozen at everymath\expandafter{%
-    \expandafter\bbl at mathboxdir\the\frozen at everymath}
+    \expandafter\bbl at everymath\the\frozen at everymath}
   \frozen at everydisplay\expandafter{%
-    \expandafter\bbl at mathboxdir\the\frozen at everydisplay}
+    \expandafter\bbl at everydisplay\the\frozen at everydisplay}
+  \AtBeginDocument{
+    \directlua{
+      function Babel.math_box_dir(head)
+        if not (token.get_macro('bbl at insidemath') == '0') then
+          if Babel.hlist_has_bidi(head) then
+            local d = node.new(node.id'dir')
+            d.dir = '+TRT'
+            node.insert_before(head, node.has_glyph(head), d)
+            for item in node.traverse(head) do
+              node.set_attribute(item,
+                Babel.attr_dir, token.get_macro('bbl at thedir'))
+            end
+          end
+        end
+        return head
+      end
+      luatexbase.add_to_callback("hpack_filter", Babel.math_box_dir,
+        "Babel.math_box_dir", 0)
+  }}%
 \fi
-\def\bbl at truellap{%s
-  \ifcase\bbl at attr@dir\expandafter\llap\else\expandafter\rlap\fi}
-\def\bbl at truerlap{%
-  \ifcase\bbl at attr@dir\expandafter\rlap\else\expandafter\llap\fi}
 \bbl at trace{Redefinitions for bidi layout}
+\def\BabelNoAMSMath{\let\bbl at noamsmath\relax}
 \ifnum\bbl at bidimode>\z@
   \let\bbl at eqnodir\relax
   \AtBeginDocument{%
@@ -1359,65 +1407,74 @@
       \bbl at xin@{,leqno,}{,\@classoptionslist,}%
       \ifin@
         \def\@eqnnum{%
-           \setbox\z@\hbox{\normalfont\normalcolor(\theequation)}%
-           \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
+          \setbox\z@\hbox{\normalfont\normalcolor(\theequation)}%
+          \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
       \fi
     \else % amstex
-      \bbl at sreplace\intertext@{\normalbaselines}%
-        {\normalbaselines
-         \ifx\bbl at eqnodir\relax\else\bbl at pardir\@ne\bbl at textdir\@ne\fi}
-      \def\bbl at ams@tagbox#1#2{#1{\bbl at eqnodir#2}}% #1=\hbox|ams at lap
-      \def\bbl at ams@eqtagbox#1{%
-        \setbox\z@\hbox{\bbl at eqnodir#1}%
-        \hbox to\wd\z@{%
-          \ifx\bbl at ams@lap\hbox
-            \hss\hbox to\displaywidth{\box\z@\hss}%
-          \else
-            \hbox to\displaywidth{\hss\box\z@}\hss
-          \fi}}
-      \def\bbl at ams@preset#1{%
-        \ifnum\bbl at thetextdir>\z@
-          \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
-          \chardef\bbl at thetextdir\z@
-          \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
-          \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@tagbox#1}%
-        \fi}
-      \@ifpackagewith{amsmath}{leqno}%
-        {\let\bbl at ams@lap\hbox}% = leqno
-        {\let\bbl at ams@lap\llap}% = default
-      % Not required?: split, alignat
-      \AddToHook{env/cases/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      \AddToHook{env/multline/begin}{\bbl at ams@preset\hbox}%
-      \AddToHook{env/gather/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      \AddToHook{env/gather*/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      \AddToHook{env/align/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      \AddToHook{env/align*/begin}{\bbl at ams@preset\bbl at ams@lap}%
-      % Hackish, for proper alignment-don’t ask me why it works! :-)
-      \bbl at exp{%
-        \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
-      \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
-      \AddToHook{env/split/before}{%
-        \def\bbl at tempa{equation}%
-        \ifx\@currenvir\bbl at tempa
-          \def\bbl at ams@eqtagbox#1{%
-            \setbox\z@\hbox{\bbl at eqnodir#1}%
-            \hbox to\wd\z@{\box\z@}}%
-        \fi}
-      \AddToHook{env/equation/begin}{%
-        \bbl at add\ignorespacesafterend{\hrule\@height\z@}%
-        \ifnum\bbl at thetextdir>\z@
-          \ifx\bbl at ams@lap\llap\hrule\@height\z@\fi
-          \def\bbl at eqnodir{\bbl at textdir\@ne}%
-          \bbl at textdir\z@
-          \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@eqtagbox}%
-        \fi}%
-      \AddToHook{env/equation*/begin}{%
-        \bbl at add\ignorespacesafterend{\hrule\@height\z@}%
-        \ifnum\bbl at thetextdir>\z@
-          \def\bbl at eqnodir{\bbl at textdir\@ne}%
-          \bbl at textdir\z@
-          \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@eqtagbox}%
-        \fi}%
+      \ifx\bbl at noamsmath\@undefined
+        \edef\bbl at tempa{%
+          \catcode58=\the\catcode58\relax
+          \catcode95=\the\catcode95\relax}%
+        \catcode58=11
+        \catcode95=11
+        \bbl at sreplace\intertext@{\normalbaselines}%
+          {\normalbaselines
+           \ifx\bbl at eqnodir\relax\else\bbl at pardir\@ne\bbl at eqnodir\fi}%
+        \bbl at tempa
+        \def\bbl at ams@tagbox#1#2{#1{\bbl at eqnodir#2}}% #1=\hbox|ams at lap
+        \def\bbl at ams@eqtagbox#1{%
+          \setbox\z@\hbox{\bbl at eqnodir#1}%
+          \hbox to 0.01pt{%
+            \ifx\bbl at ams@lap\hbox
+              \hbox to\displaywidth{\hss\box\z@}\hss
+            \else
+              \hss\hbox to\displaywidth{\box\z@\hss}%
+            \fi}}
+        \def\bbl at ams@preset#1{%
+          \ifnum\bbl at thetextdir>\z@
+            \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
+            \chardef\bbl at thetextdir\z@
+            \bbl at sreplace\textdef@{\hbox}{\bbl at ams@tagbox\hbox}%
+            \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@tagbox#1}%
+          \fi}
+        \@ifpackagewith{amsmath}{leqno}%
+          {\let\bbl at ams@lap\hbox}% = leqno
+          {\let\bbl at ams@lap\llap}% = default
+        %
+        \AddToHook{env/cases/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        \AddToHook{env/multline/begin}{\bbl at ams@preset\hbox}%
+        \AddToHook{env/gather/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        \AddToHook{env/gather*/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        \AddToHook{env/align/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        \AddToHook{env/align*/begin}{\bbl at ams@preset\bbl at ams@lap}%
+        % Hackish, for proper alignment-don’t ask me why it works! :-)
+        \bbl at exp{%
+          \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
+        \AddToHook{env/flalign/begin}{\bbl at ams@preset\hbox}%
+        \AddToHook{env/split/before}{%
+          \ifnum\bbl at thetextdir>\z@
+            \def\bbl at tempa{equation}%
+            \ifx\@currenvir\bbl at tempa
+              \def\bbl at ams@eqtagbox#1{%
+                \ifx\bbl at ams@lap\hbox
+                  \hbox to0.01pt{\hss\bbl at eqnodir#1}% leqno
+                \else
+                  \hbox to0.01pt{\bbl at eqnodir#1\hss}% eqno
+                \fi}
+            \fi
+          \fi}
+        \AddToHook{env/equation/begin}{%
+          \ifnum\bbl at thetextdir>\z@
+            \ifx\bbl at ams@lap\llap\hrule\@height\z@\fi
+            \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
+            \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@eqtagbox}%
+          \fi}%
+        \AddToHook{env/equation*/begin}{%
+          \ifnum\bbl at thetextdir>\z@
+            \edef\bbl at eqnodir{\noexpand\bbl at textdir{\the\bbl at thetextdir}}%
+            \bbl at sreplace\maketag@@@{\hbox}{\bbl at ams@eqtagbox}%
+          \fi}%
+        \fi
       \fi}
 \fi
 \ifx\bbl at opt@layout\@nnil\endinput\fi  % if no layout
@@ -1424,6 +1481,7 @@
 \ifnum\bbl at bidimode>\z@
   \def\bbl at nextfake#1{%  non-local changes, use always inside a group!
     \bbl at exp{%
+      \def\\\bbl at insidemath{0}%
       \mathdir\the\bodydir
       #1%              Once entered in math, set boxes to restore values
       \<ifmmode>%
@@ -1486,28 +1544,11 @@
      \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
-         for item in node.traverse(head) do
-           if item.id == node.id'glyph' then
-             local itemchar = item.char
-             % TODO. Copypaste pattern from Babel.bidi (-r)
-             local chardata = Babel.characters[itemchar]
-             local dir = chardata and chardata.d or nil
-             if not dir then
-               for nn, et in ipairs(Babel.ranges) do
-                 if itemchar < et[1] then
-                   break
-                 elseif itemchar <= et[2] then
-                   dir = et[3]
-                   break
-                 end
-               end
-             end
-             if dir and (dir == 'al' or dir == 'r') then
-               Babel.picture_has_bidi = 1
-             end
-           end
+         if Babel.hlist_has_bidi(head) then
+           Babel.picture_has_bidi = 1
          end
          return head
        end

Modified: trunk/Master/texmf-dist/tex/generic/babel/nil.ldf
===================================================================
--- trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2022-02-13 21:25:53 UTC (rev 62006)
+++ trunk/Master/texmf-dist/tex/generic/babel/nil.ldf	2022-02-13 21:27:08 UTC (rev 62007)
@@ -33,7 +33,7 @@
 %% extension |.ins|) which are part of the distribution.
 %%
 
-\ProvidesLanguage{nil}[2022/01/26 3.70 Nil language]
+\ProvidesLanguage{nil}[2022/02/13 3.71 Nil language]
 \LdfInit{nil}{datenil}
 \ifx\l at nil\@undefined
   \newlanguage\l at nil



More information about the tex-live-commits mailing list.