[latex3-commits] [git/LaTeX3-latex3-babel] master: (babel) \babelfont. Fixes in bidi text. (fbaa1eb)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Apr 1 19:40:34 CEST 2019


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

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

commit fbaa1ebad832a9cd9930d8bb5bfa51f4b254177b
Author: Javier <jbezos at localhost>
Date:   Tue Mar 19 15:45:01 2019 +0100

    (babel) \babelfont. Fixes in bidi text.
    
    * \babelfont, now takes \defaultfontfeatures into account.
    * First steps in calendars.
    * Fixes in basic-r (with math) and basic (wrong weak L, within R, within L).


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

fbaa1ebad832a9cd9930d8bb5bfa51f4b254177b
 README.md    |    9 +-
 babel.dtx    |  260 +++++++++++++++++++++++++++++++++++++---------------------
 babel.ins    |    2 +-
 babel.pdf    |  Bin 660189 -> 671700 bytes
 bbcompat.dtx |    2 +-
 5 files changed, 176 insertions(+), 97 deletions(-)

diff --git a/README.md b/README.md
index 0e99ab6..805317c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.27
+## Babel 3.27.1585
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages.  Many
@@ -51,6 +51,11 @@ respective authors.
 ### Latest changes
 
 ```
+3.28   - Fix - wrong dir after math with basic-r
+       - Fix - wrong dir in weak L inside R inside L 
+       - \babelfont now takes into account \defaultfontfeatures. This
+         is potentially a source of backwards incompatibilities, but
+         very likely the risks are very low. 
 3.27   - Preliminary support for bidi (by Vafa Khalighi) with xetex.
        - Fix for 3.23 - \ensureascii was redefined even when not 
          necessary.
@@ -119,5 +124,5 @@ respective authors.
 ```
 
 Javier Bezos
-2018/11/13
+2019/03/19
 
diff --git a/babel.dtx b/babel.dtx
index 73602cb..dac8110 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2018/11/13 v3.27 The Babel package]
+\ProvidesFile{babel.dtx}[2019/03/19 v3.27.1585 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -362,6 +362,15 @@ You can also set the main language explicitly:
 \usepackage[_main=english_,dutch]{babel}
 \end{verbatim}
 
+\begin{note}
+Some classes load \babel{} with a hardcoded language option. Sometimes,
+the main language could be overridden with something like that before
+|\documentclass|:
+\begin{verbatim}
+\PassOptionsToPackage{main=english}{babel}
+\end{verbatim}
+\end{note}
+
 \begin{warning}
   Languages may be set as global and as package option at the same
   time, but in such a case you should set explicitly the main language
@@ -380,7 +389,7 @@ You can also set the main language explicitly:
   want to use some of the language selectors described below.
 \end{warning}
 
-To switch the language there are two basic macros, decribed below in
+To switch the language there are two basic macros, described below in
 detail: |\selectlanguage| is used for blocks of text, while
 |\foreignlanguage| is for chunks of text inside paragraphs.
 
@@ -969,7 +978,7 @@ three options have been available in previous versions.
 
 \Describe{KeepShorthandsActive}{}
 Tells babel not to deactivate shorthands after loading a language
-file, so that they are also availabe in the preamble.
+file, so that they are also available in the preamble.
 
 \Describe{activeacute}{} For some languages \babel\ supports this
 options to set |'| as a shorthand in case it is not done by default.
@@ -1855,7 +1864,7 @@ replace the red line above with, say:
 
 |\babelfont| can be used to implicitly define a new font family. Just
 write its name instead of |rm|, |sf| or |tt|. This is the preferred way
-to select fonts in addition to the three basic ones.
+to select fonts in addition to the three basic families.
 
 \begin{example}
   Here is how to do it:
@@ -1877,13 +1886,17 @@ to select fonts in addition to the three basic ones.
   |dev2| (\luatex{} does not detect automatically the correct 
   script\footnote{And even with the correct code some fonts could be 
   rendered incorrectly by \textsf{fontspec}, so double check the 
-  results. \xetex{} fares better, but some font are still problematic.}).
+  results. \xetex{} fares better, but some font are still
+  problematic.}). You may also pass some options to \textsf{fontspec}:
+  with |silent|, the annoying warnings about unavailable scripts or
+  languages are not shown (they are only really useful when the document
+  format is being set up).
 \end{note}
 
 \begin{note}
-  Directionality is a property affecting margins, intentation, column
+  Directionality is a property affecting margins, indentation, column
   order, etc., not just text. Therefore, it is under the direct
-  control of the language, which appplies both the script and the
+  control of the language, which applies both the script and the
   direction to the text. As a consequence, there is no need to set
   \texttt{Script} when declaring a font (nor \texttt{Language}). In
   fact, it is even discouraged.
@@ -1954,16 +1967,28 @@ unselected: |\noextras|\m{lang}.
 \end{itemize}
 
 \begin{note}
-  These macros (|\captions|\m{lang}, |\extras|\m{lang}) may be redefined, but
-  must not be used as such -- they just pass information to \babel{},
-  which executes them in the proper context.
+  These macros (|\captions|\m{lang}, |\extras|\m{lang}) may be
+  redefined, but \textit{must not} be used as such -- they just pass
+  information to \babel{}, which executes them in the proper context.
 \end{note}
 
+Another way to modify a language loaded as a package or class option
+is by means of |\babelprovide|, described below in depth. So,
+something like:
+\begin{verbatim}
+\usepackage[danish]{babel}
+\babelprovide[captions=da,hyphenrules=nohyphenation]{danish}
+\end{verbatim}
+first loads |danish.ldf|, and then redefines the captions for
+\texttt{danish} (as provided by the |ini| file) and prevents
+hyphenation. The rest of the language definitions are not touched.
+
 \subsection{Creating a language}
 
-\New{3.10} And what if there is no style for your language or none
-fits your needs? You may then define quickly a language with the
-help of the following macro in the preamble.
+\New{3.10} And what if there is no style for your language or none fits
+your needs? You may then define quickly a language with the help of the
+following macro in the preamble (which may be used to modify an
+existing language, too, as explained in the previous subsection).
 
 \Describe{\babelprovide}{\oarg{options}\marg{language-name}}
 
@@ -2054,7 +2079,7 @@ for example:
 \babelprovide[hyphenrules=+]{neo}
 \babelpatterns[neo]{a1 e1 i1 o1 u1}
 \end{verbatim}
-In other engines it just supresses hyphenation (because the pattern
+In other engines it just suppresses hyphenation (because the pattern
 list is empty).
 
 \Describe{main}{} This valueless option makes the language the main
@@ -2080,14 +2105,15 @@ inconsistent, this makes setting a language up easier in most typical
 cases.
 
 \Describe{mapfont=}{\texttt{direction}}
-Assigns the font for the writing direction of this language. More
-precisely, what |mapfont=direction| means is, ‘when a character has the
-same direction as the script for the “provided” language, then change
-its font to that set for this language’. There are 3 directions,
-following the bidi Unicode algorithm, namely, Arabic-like, Hebrew-like
-and left to right.\footnote{In future realeases an new value 
-(\texttt{script}) will be added.} So, there should be at most 3 
-directives of this kind.
+Assigns the font for the writing direction of this
+language.\footnote{There will be another value, \texttt{language}, not
+yet implemented.} More precisely, what |mapfont=direction| means is,
+‘when a character has the same direction as the script for the
+“provided” language, then change its font to that set for this
+language’. There are 3 directions, following the bidi Unicode
+algorithm, namely, Arabic-like, Hebrew-like and left to
+right.\footnote{In future releases an new value (\texttt{script}) will
+be added.} So, there should be at most 3 directives of this kind.
 
 \Describe{intraspace=}{\meta{base} \meta{shrink} \meta{stretch}}
 Sets the interword space for the writing system of the language, in em
@@ -2095,7 +2121,7 @@ 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.
 
-\Describe{intrapenalty}{\meta{penalty}}
+\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).
@@ -2174,20 +2200,20 @@ respectively.
 \textit{explicit} or \textit{hard hyphens}, which in \TeX\ are
 entered as \verb|-|, and (2) \textit{optional} or \textit{soft
 hyphens}, which are entered as \verb|\-|. Strictly, a \textit{soft
-hyphen} is not a hyphen, but just a breaking oportunity or, in
+hyphen} is not a hyphen, but just a breaking opportunity or, in
 \TeX\ terms, a ``discretionary''; a \textit{hard hyphen} is a hyphen
-with a breaking oportunity after it. A further type is a
+with a breaking opportunity after it. A further type is a
 \textit{non-breaking hyphen}, a hyphen without a breaking
-oportunity.
+opportunity.
 
-In \TeX, \verb|-| and \verb|\-| forbid further breaking oportunities
+In \TeX, \verb|-| and \verb|\-| forbid further breaking opportunities
 in the word. This is the desired behavior very often, but not always,
 and therefore many languages provide shorthands for these
 cases. Unfortunately, this has not been done consistently: for
 example, \verb|"-| in Dutch, Portugese, Catalan or Danish is a hard
 hyphen, while in German, Spanish, Norwegian, Slovak or Russian is a
 soft hyphen. Furthermore, some of them even redefine |\-|, so that you
-cannot insert a soft hyphen without breaking oportunities in the rest
+cannot insert a soft hyphen without breaking opportunities in the rest
 of the word.
 
 Therefore, some macros are provide with a set of basic ``hyphens''
@@ -2290,7 +2316,7 @@ Some languages sharing the same script define macros to switch it (eg,
 |\textcyrillic|), but be aware they may also set the language to a
 certain default. Even the \babel{} core defined |\textlatin|, but is
 was somewhat buggy because in some cases it messed up encodings and
-fonts (for example, if the main latin encoding was |LY1|), and
+fonts (for example, if the main Latin encoding was |LY1|), and
 therefore it has been deprecated.\footnote{But still defined for
 backwards compatibility.}
 
@@ -2315,7 +2341,7 @@ used for ``ordinary'' text (they are stored in |\BabelNonText|, used
 in some special cases when no Latin encoding is explicitly set).
 
 The foregoing rules (which are applied ``at begin document'') cover
-most of cases. No asumption is made on characters above
+most of cases. No assumption is made on characters above
 127, which may not follow the LICR conventions -- the goal is just
 to ensure most of the ASCII letters and symbols are the right ones.
 
@@ -2337,8 +2363,8 @@ differ in the way `weak' numeric characters are ordered (eg, Arabic
   A basic stable version for other engines must wait very likely until
   (Northern) Winter. This applies to text, but \textbf{graphical}
   elements, including the |picture| environment and PDF or PS based
-  graphics, are not yet correctly handled. Also, indexes and the like 
-  are under study, as well as math.
+  graphics, are not yet correctly handled (far from trivial). Also,
+  indexes and the like are under study, as well as math.
 
   An effort is being made to avoid incompatibilities in the future
   (this one of the reason currently bidi must be explicitly requested
@@ -2406,7 +2432,7 @@ _\babelprovide[import, main]{arabic}_
   mixed without explicit markup (the latter will be only necessary in
   some special cases where the Unicode algorithm fails). It is used much
   like |bidi=basic-r|, but with R text inside L text you may want to map
-  the font so that the correct features are in force. This is accomplised
+  the font so that the correct features are in force. This is accomplished
   with an option in |\babelprovide|, as illustrated:
     \begingroup
   % If you are looking at the code to see how it has been written, you
@@ -2526,7 +2552,7 @@ required by all engines.
   future); ignored in \pdftex{} or \xetex{} (which will not support a
   similar option in the short term) \New{3.18},
 
-\item[extras] is used for miscelaneous readjustments which do not fit into
+\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}
@@ -2549,7 +2575,7 @@ RTL A ltr text \thechapter{} and still ltr RTL B
 \end{verbatim}
 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 behaviour in the most usual cases — but if
+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:
 \begin{verbatim}
@@ -2625,7 +2651,7 @@ Very often, using a \textit{modifier} in a package option is better.
 Several language definition files use their own methods to set
 options. For example, \textsf{french} uses |\frenchsetup|,
 \textsf{magyar} (1.5) uses |\magyarOptions|; modifiers provided by
-|spanish| have no attribute counterparts. Macros settting
+|spanish| have no attribute counterparts. Macros setting
 options are also used (eg, |\ProsodicMarksOn| in \textsf{latin}).
 
 \subsection{Hooks}
@@ -2882,16 +2908,16 @@ some languages (kerning and spacing). Ligatures can be disabled.
 \subsection{Current and future work}
 
 Current work is focused on the so-called complex scripts in \luatex{}.
-In 8-bit engines, \babel{} provided a basic support for bidi text as part
-of the style for Hebrew, but it is somewhat unsatisfactory and
-internally replaces some hardwired commands by other hardwired
-commands (generic changes would be much better).
+In 8-bit engines, \babel{} provided a basic support for bidi text as
+part of the style for Hebrew, but it is somewhat unsatisfactory and
+internally replaces some hardwired commands by other hardwired commands
+(generic changes would be much better).
 
-It is possible now to typeset Arabic or Hebrew with numbers and L
-text.  Next on the roadmap are line breaking in Thai and the like,
-as well as “non-European” digits. Also on the roadmap are R layouts
-(lists, footnotes, tables, column order), page and section numbering,
-and maybe kashida justification.
+It is possible now to typeset Arabic or Hebrew with numbers and L text.
+Next on the roadmap are line breaking in Thai and the like. Also on the
+roadmap are better support for R layouts (lists, footnotes, tables,
+column order), page and section numbering, and maybe kashida
+justification.
 
 Useful additions would be, for example, time, currency, addresses and
 personal names.\footnote{See for example POSIX, ISO 14652 and the
@@ -2975,7 +3001,7 @@ So, for example:
 \TeX{} and most engines based on it (pdf\TeX, \xetex, $\epsilon$-\TeX,
 the main exception being \luatex) require hyphenation patterns to be
 preloaded when a format is created (eg, \LaTeX, Xe\LaTeX,
-pdf\LaTeX). \babel{} provides a tool which has become standand in many
+pdf\LaTeX). \babel{} provides a tool which has become standard in many
 distributions and based on a ``configuration file'' named
 \file{language.dat}. The exact way this file is used depends on the
 distribution, so please, read the documentation for the latter (note
@@ -3029,7 +3055,7 @@ didn't work correctly.} For example:
 german:T1 hyphenT1.ger
 german hyphen.ger
 \end{verbatim}
-With the previous settings, if the enconding when the language is
+With the previous settings, if the encoding when the language is
 selected is |T1| then the patterns in \file{hyphenT1.ger} are
 used, but otherwise use those in \file{hyphen.ger} (note the encoding
 could be set in |\extras|\m{lang}).
@@ -3079,7 +3105,7 @@ The following assumptions are made:
 \item When a language definition file is loaded, it can define
   |\l@|\langvar\ to be a dialect of |\language0| when |\l@|\langvar\
   is undefined.
-\item Language names must be all lowercase. If an unknow language is
+\item Language names must be all lowercase. If an unknown language is
   selected, \babel{} will attempt setting it after lowercasing its
   name.
 \item The semantics of modifiers is not defined (on purpose). In
@@ -3197,7 +3223,7 @@ definition files to set |\lefthyphenmin| and
 |\righthyphenmin|. This macro will check whether these parameters
 were provided by the hyphenation file before it takes any action.
 If these values have been already set, this command is ignored
-(currenty, default pattern files do \textit{not} set them).
+(currently, default pattern files do \textit{not} set them).
 
 \DescribeMacro{\captions\langvar}
 The macro |\captions|\langvar\ defines the macros that
@@ -3324,6 +3350,23 @@ explained in in sec. \ref{s:strings} (\babel{} 3.9 and later).
 \ldf at finish{<language>}
 \end{verbatim}
 
+\begin{note}
+  If for some reason you want to load a package in your style, you
+  should be aware it cannot be done directly in the \texttt{ldf} file,
+  but it can be delayed with |\AtEndOfPackage|. Macros from external
+  packages can be used \textit{inside} definitions in the \textsf{ldf}
+  itself (for example, |\extras<language>|), but if executed directly,
+  the code must be placed inside |\AtEndOfPackage|. A trivial example
+  illustrating these points is:
+\begin{verbatim}
+\AtEndOfPackage{%
+  \RequirePackage{dingbat}%       Delay package
+  \savebox{\myeye}{\eye}}%        And direct usage
+\newsavebox{\myeye}
+\newcommand\myanchor{\anchor}%    But OK inside command
+\end{verbatim}
+\end{note}
+
 \subsection{Support for active characters}
 
 In quite a number of language definition files, active characters are
@@ -3486,9 +3529,9 @@ the first one take precedence (ie, it works much like
 |\providecommand|).
 
 Encoding info is |charset=| followed by a charset, which if given sets
-how the strings should be traslated to the internal representation
+how the strings should be translated to the internal representation
 used by the engine, typically |utf8|, which is the only value
-supported currently (default is no traslations). Note |charset| is
+supported currently (default is no translations). Note |charset| is
 applied by \luatex{} and \xetex{} when reading the file, not when the
 macro or string is used in the document.
 
@@ -3507,7 +3550,7 @@ into account except those). With |strings=encoded|, strings in those
 blocks are set as default (internally, |?|). With |strings=encoded|
 strings are protected, but they are correctly expanded in
 |\MakeUppercase| and the like. If there is no key |strings|, string
-definitions are ignored, but |\SetCase|s are still honoured (in a
+definitions are ignored, but |\SetCase|s are still honored (in a
 |encoded| way).
 
 The \m{category} is either |captions|, |date| or |extras|. You must
@@ -3568,7 +3611,7 @@ A real example is:
 \end{verbatim}
 
 When used in |ldf| files, previous values of |\|\m{category}\m{language}
-are overriden, which means the old way to define strings still works
+are overridden, which means the old way to define strings still works
 and used by default (to be precise, is first set to undefined and then
 strings are added). However, when used in the preamble or in a
 package, new settings are added to the previous ones, if the language
@@ -3582,7 +3625,7 @@ as package option, then the default for the engine is used. This is
 not done by default to prevent backward incompatibilities, but if you
 are creating a new language this version is better. It's up to
 the maintainers of the current languages to decide if using it is
-appropiate.\footnote{This replaces in 3.9g a short-lived
+appropriate.\footnote{This replaces in 3.9g a short-lived
 \texttt{\string\UseStrings} which has been removed because it did
 not work.}
 
@@ -3621,7 +3664,7 @@ changes in lc/uc codes may not work). A \meta{map-list} is a series of
 macros using the internal format of |\@uclclist| (eg,
 |\bb\BB\cc\CC|). The mandatory arguments take precedence over the
 optional one. This command, unlike |\SetString|, is executed always
-(even without |strings|), and it is intented for minor readjustments
+(even without |strings|), and it is intended for minor readjustments
 only.
 
 For example, as |T1| is the default case mapping in \LaTeX, we could
@@ -3874,8 +3917,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.27>>
-%<<date=2018/11/13>>
+%<<version=3.27.1585>>
+%<<date=2019/03/19>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -8080,9 +8123,9 @@ help from Bernd Raichle, for which I am grateful.
   \@nameuse{bbl at secpost@\bbl at section}%  ends previous section
   \def\bbl at section{#1}%
   \@nameuse{bbl at secpre@\bbl at section}%   starts current section
-  \bbl at ifunset{bbl at secline@#1}%
+  \bbl at ifunset{bbl at inikv@#1}%
     {\let\bbl at inireader\bbl at iniskip}%
-    {\bbl at exp{\let\\\bbl at inireader\<bbl at secline@#1>}}}
+    {\bbl at exp{\let\\\bbl at inireader\<bbl at inikv@#1>}}}
 %    \end{macrocode}
 %
 % Reads a key=val line and stores the trimmed val in
@@ -8114,7 +8157,7 @@ help from Bernd Raichle, for which I am grateful.
 % |identification| and |typography|.
 %
 %    \begin{macrocode}
-\let\bbl at secline@identification\bbl at inikv
+\let\bbl at inikv@identification\bbl at inikv
 \def\bbl at secpost@identification{%
   \bbl at exportkey{lname}{identification.name.english}{}%
   \bbl at exportkey{lbcp}{identification.tag.bcp47}{}%
@@ -8122,9 +8165,9 @@ help from Bernd Raichle, for which I am grateful.
   \bbl at exportkey{sname}{identification.script.name}{}%
   \bbl at exportkey{sbcp}{identification.script.tag.bcp47}{}%
   \bbl at exportkey{sotf}{identification.script.tag.opentype}{DFLT}}
-\let\bbl at secline@typography\bbl at inikv
-\let\bbl at secline@characters\bbl at inikv
-\let\bbl at secline@numbers\bbl at inikv
+\let\bbl at inikv@typography\bbl at inikv
+\let\bbl at inikv@characters\bbl at inikv
+\let\bbl at inikv@numbers\bbl at inikv
 \def\bbl at after@ini{%
   \bbl at exportkey{lfthm}{typography.lefthyphenmin}{2}%
   \bbl at exportkey{rgthm}{typography.righthyphenmin}{3}%
@@ -8153,21 +8196,17 @@ help from Bernd Raichle, for which I am grateful.
 %    \end{macrocode}
 %
 % Now |captions| and |captions.licr|, depending on the engine. And
-% also for dates. They rely on a few auxilary macros.
+% below also for dates. They rely on a few auxiliary macros. It is
+% expected the ini file provides the complete set in Unicode and LICR,
+% in that order.
 %
 %    \begin{macrocode}
 \ifcase\bbl at engine
-  \bbl at csarg\def{secline at captions.licr}#1=#2\@@{%
+  \bbl at csarg\def{inikv at captions.licr}#1=#2\@@{%
     \bbl at ini@captions at aux{#1}{#2}}
-  \bbl at csarg\def{secline at date.gregorian}#1=#2\@@{%       for defaults
-    \bbl at ini@dategreg#1...\relax{#2}}
-  \bbl at csarg\def{secline at date.gregorian.licr}#1=#2\@@{%  override
-    \bbl at ini@dategreg#1...\relax{#2}}
 \else
-  \def\bbl at secline@captions#1=#2\@@{%
+  \def\bbl at inikv@captions#1=#2\@@{%
     \bbl at ini@captions at aux{#1}{#2}}
-  \bbl at csarg\def{secline at date.gregorian}#1=#2\@@{%
-    \bbl at ini@dategreg#1...\relax{#2}}
 \fi
 %    \end{macrocode}
 %
@@ -8186,22 +8225,40 @@ help from Bernd Raichle, for which I am grateful.
 %    \end{macrocode}
 %
 % But dates are more complex. The full date format is stores in
-% |date.gregorian|, so we must read it in non-Unicode engines, too.
+% |date.gregorian|, so we must read it in non-Unicode engines, too
+% (saved months are just discarded when the LICR section is reached).
+%
+% TODO. Remove copypaste pattern.
 %
 % \changes{3.16}{2018/01/02}{Fix - dates were severely broken.}
 %
 %    \begin{macrocode}
-\bbl at csarg\def{secpre at date.gregorian.licr}{%
-  \ifcase\bbl at engine\let\bbl at savedate\@empty\fi}
-\def\bbl at ini@dategreg#1.#2.#3.#4\relax#5{% TODO - ignore with 'captions'
+\bbl at csarg\def{inikv at date.gregorian}#1=#2\@@{%       for defaults
+  \bbl at inidate#1...\relax{#2}{}}
+\bbl at csarg\def{inikv at date.islamic}#1=#2\@@{%
+  \bbl at inidate#1...\relax{#2}{islamic}}
+\bbl at csarg\def{inikv at date.hebrew}#1=#2\@@{% 
+  \bbl at inidate#1...\relax{#2}{hebrew}}
+\bbl at csarg\def{inikv at date.persian}#1=#2\@@{%
+  \bbl at inidate#1...\relax{#2}{persian}}
+\bbl at csarg\def{inikv at date.indian}#1=#2\@@{% 
+  \bbl at inidate#1...\relax{#2}{indian}}
+\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
+    \ifcase\bbl at engine\let\bbl at savedate\@empty\fi}
+\fi
+% eg: 1=months, 2=wide, 3=1, 4=dummy
+\def\bbl at inidate#1.#2.#3.#4\relax#5#6{% TODO - ignore with 'captions'
   \bbl at trim@def\bbl at tempa{#1.#2}%
-  \bbl at ifsamestring{\bbl at tempa}{months.wide}%
+  \bbl at ifsamestring{\bbl at tempa}{months.wide}%      to savedate
     {\bbl at trim@def\bbl at tempa{#3}%
      \bbl at trim\toks@{#5}%
      \bbl at exp{%
       \\\bbl at add\\\bbl at savedate{%
-        \\\SetString\<month\romannumeral\bbl at tempa name>{\the\toks@}}}}%
-    {\bbl at ifsamestring{\bbl at tempa}{date.long}%
+        \\\SetString\<month\romannumeral\bbl at tempa#6name>{\the\toks@}}}}%
+    {\bbl at ifsamestring{\bbl at tempa}{date.long}%     defined now
       {\bbl at trim@def\bbl at toreplace{#5}%
        \bbl at TG@@date
        \global\bbl at csarg\let{date@\languagename}\bbl at toreplace
@@ -8220,9 +8277,10 @@ help from Bernd Raichle, for which I am grateful.
 % Dates will require some macros for the basic formatting. They may be
 % redefined by language, so ``semi-public'' names (camel case) are
 % used. Oddly enough, the CLDR places particles like “de”
-% inconsistenly in either in the date or in the month name.
+% inconsistently in either in the date or in the month name.
 %
 %    \begin{macrocode}
+\let\bbl at calendar\@empty
 \newcommand\BabelDateSpace{\nobreakspace}
 \newcommand\BabelDateDot{.\@}
 \newcommand\BabelDated[1]{{\number#1}}
@@ -8230,7 +8288,7 @@ help from Bernd Raichle, for which I am grateful.
 \newcommand\BabelDateM[1]{{\number#1}}
 \newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
 \newcommand\BabelDateMMMM[1]{{%
-  \csname month\romannumeral#1name\endcsname}}%
+  \csname month\romannumeral#1\bbl at calendar name\endcsname}}%
 \newcommand\BabelDatey[1]{{\number#1}}%
 \newcommand\BabelDateyy[1]{{%
   \ifnum#1<10 0\number#1 %
@@ -10835,16 +10893,20 @@ help from Bernd Raichle, for which I am grateful.
 \def\bbl at font@set#1#2#3{% eg \bbl at rmdflt@lang \rmdefault \rmfamily
   \bbl at xin@{<>}{#1}%
   \ifin@
-    \bbl at exp{\\\bbl at fontspec@set\\#1\expandafter\@gobbletwo#1}%
+    \bbl at exp{\\\bbl at fontspec@set\\#1\expandafter\@gobbletwo#1\\#3}%
   \fi
   \bbl at exp{%
-    \def\\#2{#1}%        eg, \rmdefault{\bbl at rmdflt@lang}
+    \def\\#2{#1}%         eg, \rmdefault{\bbl at rmdflt@lang}
     \\\bbl at ifsamestring{#2}{\f at family}{\\#3\let\\\bbl at tempa\relax}{}}}
-\def\bbl at fontspec@set#1#2#3{% eg \bbl at rmdflt@lang fnt-opt fnt-nme
+%     TODO - next should be global?, but even local does its job. I'm
+%     still not sure -- must investigate:
+\def\bbl at fontspec@set#1#2#3#4{% eg \bbl at rmdflt@lang fnt-opt fnt-nme \xxfamily
   \let\bbl at tempe\bbl at mapselect
   \let\bbl at mapselect\relax
-  \bbl at exp{% TODO - should be global, but even local does its job
-        % I'm still not sure -- must investigate 
+  \let\bbl at temp@fam#4     %  eg, '\rmfamily', to be restored below
+  \let#4\relax            %  So that can be used with \newfontfamily
+  \bbl at exp{% 
+    \let\\\bbl at temp@pfam\<\bbl at stripslash#4\space>% eg, '\rmfamily '
     \<keys_if_exist:nnF>{fontspec-opentype}%
         {Script/\bbl at cs{sname@\languagename}}%
       {\\\newfontscript{\bbl at cs{sname@\languagename}}%
@@ -10853,10 +10915,15 @@ help from Bernd Raichle, for which I am grateful.
         {Language/\bbl at cs{lname@\languagename}}%
       {\\\newfontlanguage{\bbl at cs{lname@\languagename}}%
         {\bbl at cs{lotf@\languagename}}}%
-    \<fontspec_set_family:Nnn>\\#1%
-      {\bbl at cs{lsys@\languagename},#2}}{#3}% ie \bbl at exp{..}{#3}
-  \let\bbl at mapselect\bbl at tempe
-  \bbl at toglobal#1}%
+    \\\newfontfamily\\#4%
+      [\bbl at cs{lsys@\languagename},#2]}{#3}% ie \bbl at exp{..}{#3}
+  \begingroup
+     #4%
+     \xdef#1{\f at family}%     eg, \bbl at rmdflt@lang{FreeSerif(0)}
+  \endgroup
+  \let#4\bbl at temp@fam
+  \bbl at exp{\let\<\bbl at stripslash#4\space>}\bbl at temp@pfam
+  \let\bbl at mapselect\bbl at tempe}%
 %    \end{macrocode}
 %
 % font at rst and famrst are only used when there is no global settings,
@@ -18046,6 +18113,7 @@ function Babel.bidi(head, ispar)
 
   local new_dir = false
   local first_dir = false
+  local inmath = false
 
   local last_lr
 
@@ -18131,11 +18199,13 @@ function Babel.bidi(head, ispar)
 % cases: dir node and the rest. 
 %
 %    \begin{macrocode}
-    elseif item.id == node.id'dir' then
+    elseif item.id == node.id'dir' and not inmath then
       new_dir = true
       dir = nil
+    elseif item.id == node.id'math' then
+      inmath = (item.subtype == 0)
     else
-      dir = nil          -- Not a char
+      dir = nil
     end
 %    \end{macrocode}
 %
@@ -18606,7 +18676,11 @@ function Babel.bidi(head, ispar, hdir)
       end
     else
       if d == 'an' or d == 'l' then
-        state.sim = state.sim or item
+        if nodes[q][3] then -- nil except after an explicit dir
+          state.sim = item  -- so we move sim 'inside' the group
+        else
+          state.sim = state.sim or item
+        end
         state.eim = item
       elseif d == 'r' and state.sim then
         head, state = insert_implicit(head, state, outer)
diff --git a/babel.ins b/babel.ins
index 21726ac..397ddc8 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{2018/11/13}
+\def\filedate{2019/03/19}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index bd66981..b9fa2fd 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 4744d1b..1b413a6 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2018/11/13 v3.27]
+\ProvidesFile{bbcompat.dtx}[2019/03/19 v3.27.1585]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list