[latex3-commits] [git/LaTeX3-latex3-babel] master: Compatibility \set..font vs \babelfont improved. (8156de3)

Javier jbezos at dante.de
Sun Jul 28 12:40:50 CEST 2019


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

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

commit 8156de317f764f121396768264ba6c5344635f2b
Author: Javier <jbezos at localhost>
Date:   Sun Jul 28 12:40:50 2019 +0200

    Compatibility \set..font vs \babelfont improved.
    
    Also:
    * Extended \bbl at sreplace to take prefixes into account
    * Experimental readjusting of ini values with \babelprovide


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

8156de317f764f121396768264ba6c5344635f2b
 README.md    |   4 ++-
 babel.dtx    | 113 ++++++++++++++++++++++++++++++++++++++---------------------
 babel.ins    |   2 +-
 babel.pdf    | Bin 693345 -> 696779 bytes
 bbcompat.dtx |   2 +-
 5 files changed, 78 insertions(+), 43 deletions(-)

diff --git a/README.md b/README.md
index 40ce729..3d8ff3b 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.33
+## Babel 3.33.1716
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages.  Many
@@ -51,6 +51,8 @@ respective authors.
 ### Latest changes
 
 ```
+3.34   ---
+       - Improved compatibility for \babelfont vs \setmainfont
 3.33   2019-07-19
        - \prehyphenchar set to 0 in languages requiring it: kannada,
          marathi, tamil, etc. (lua).
diff --git a/babel.dtx b/babel.dtx
index c26a20a..fffadda 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2019/07/19 v3.33 The Babel package]
+\ProvidesFile{babel.dtx}[2019/07/28 v3.33.1716 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -349,9 +349,10 @@ Package babel Warning: No hyphenation patterns were preloaded for
 
 \subsection{Multilingual documents}
 
-In multilingual documents, just use several options. The last one is
-considered the main language, activated by default. Sometimes, the
-main language changes the document layout (eg, |spanish| and |french|).
+In multilingual documents, just use list the required languages as
+package options. The last one is considered the main language,
+activated by default. Sometimes, the main language changes the document
+layout (eg, |spanish| and |french|).
 
 \begin{example}
   In \LaTeX, the preamble of the document:
@@ -364,12 +365,15 @@ main language changes the document layout (eg, |spanish| and |french|).
   language in use, and the main one.
 \end{example}
 
-You can also set the main language explicitly:
+You can also set the main language explicitly, but it is discouraged
+except if there a real reason to do so:
 \begin{verbatim}
 \documentclass{article}
 \usepackage[_main=english_,dutch]{babel}
 \end{verbatim}
 
+Examples of cases where |main| is useful are the following.
+
 \begin{note}
 Some classes load \babel{} with a hardcoded language option. Sometimes,
 the main language could be overridden with something like that before
@@ -1993,7 +1997,8 @@ to select fonts in addition to the three basic families.
   no-op). Of course, both methods are incompatible, and if you use
   |\set|\textit{xxxx}|font|, font switching with |\babelfont| just
   does \textit{not} work (nor the standard |\|\textit{xx}|default|,
-  for that matter).
+  for that matter). As of \New{3.34} there is an attempt to make them
+  compatible, but the language system will not be set by \babel.
 \end{warning}
 
 \begin{troubleshooting}
@@ -4046,8 +4051,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.33>>
-%<<date=2019/07/19>>
+%<<version=3.33.1716>>
+%<<date=2019/07/28>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -4134,6 +4139,25 @@ help from Bernd Raichle, for which I am grateful.
 %  \end{macro}
 %  \end{macro}
 %
+% \begin{macro}{\bbl at exp}
+%
+%   Now, just syntactical sugar, but it makes partial expansion of
+%   some code a lot more simple and readable. Here |\\| stands for
+%   |\noexpand| and |\<..>| for |\noexpand| applied to a built macro
+%   name (the latter does not define the macro if undefined to
+%   |\relax|, because it is created locally). The result may be
+%   followed by extra arguments, if necessary.
+%
+%    \begin{macrocode}
+\def\bbl at exp#1{%
+  \begingroup
+    \let\\\noexpand
+    \def\<##1>{\expandafter\noexpand\csname##1\endcsname}%
+    \edef\bbl at exp@aux{\endgroup#1}%
+  \bbl at exp@aux}
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\bbl at trim}
 %   The following piece of code is stolen (with some changes) from
 %   \textsf{keyval}, by David Carlisle. It defines two macros:
@@ -4257,12 +4281,18 @@ help from Bernd Raichle, for which I am grateful.
 % |ho|, then |\relax| becomes |\rho|). No checking is done at all,
 % because it is not a general purpose macro, and it is used by \babel{}
 % only when it works (an example where it does \textit{not} work is in
-% |\bbl at TG@@date|). It may change! (to add new features).
+% |\bbl at TG@@date|). It may change! (I'm not sure ckecking the
+% replacement is really necessary or just paranoia).
+% 
+% \changes{babel~3.34}{2019/07/23}{Take into account prefixes like
+%   \cs{long} and macros with trailing spaces. Don't touch original if
+%   not necessary.}
 % 
 %    \begin{macrocode}
-\expandafter\def\expandafter\bbl at parsedef\detokenize{macro:}#1->#2\relax{%
+\bbl at exp{\def\\\bbl at parsedef##1\detokenize{macro:}}#2->#3\relax{%
   \def\bbl at tempa{#1}%
-  \def\bbl at tempb{#2}}
+  \def\bbl at tempb{#2}%
+  \def\bbl at tempe{#3}}
 \def\bbl at sreplace#1#2#3{%
   \begingroup
     \expandafter\bbl at parsedef\meaning#1\relax
@@ -4270,31 +4300,20 @@ help from Bernd Raichle, for which I am grateful.
     \edef\bbl at tempc{\expandafter\strip at prefix\meaning\bbl at tempc}%
     \def\bbl at tempd{#3}%
     \edef\bbl at tempd{\expandafter\strip at prefix\meaning\bbl at tempd}%
-    \bbl at exp{\\\bbl at replace\\\bbl at tempb{\bbl at tempc}{\bbl at tempd}}%
-    \bbl at exp{%
+    \bbl at xin@{\bbl at tempc}{\bbl at tempe}% If not in macro, do nothing
+    \ifin@
+      \bbl at exp{\\\bbl at replace\\\bbl at tempe{\bbl at tempc}{\bbl at tempd}}%
+      \def\bbl at tempc{%     Expanded an executed below as 'uplevel'
+         \\\makeatletter % "internal" macros with @ are assumed
+         \\\scantokens{%
+           \bbl at tempa\\\@namedef{\bbl at stripslash#1}\bbl at tempb{\bbl at tempe}}%
+         \catcode64=\the\catcode64\relax}%  Restore @
+    \else
+      \let\bbl at tempc\@empty  % Not \relax
+    \fi
+    \bbl at exp{%      For the 'uplevel' assignments
   \endgroup
-  \\\makeatletter % "internal" macros with @ are assumed
-  \\\scantokens{\def\\#1\bbl at tempa{\bbl at tempb}}%
-  \catcode64=\the\catcode64\relax}} % Restore @
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\bbl at exp}
-%
-%   Now, just syntactical sugar, but it makes partial expansion of
-%   some code a lot more simple and readable. Here |\\| stands for
-%   |\noexpand| and |\<..>| for |\noexpand| applied to a built macro
-%   name (the latter does not define the macro if undefined to
-%   |\relax|, because it is created locally). The result may be
-%   followed by extra arguments, if necessary.
-%
-%    \begin{macrocode}
-\def\bbl at exp#1{%
-  \begingroup
-    \let\\\noexpand
-    \def\<##1>{\expandafter\noexpand\csname##1\endcsname}%
-    \edef\bbl at exp@aux{\endgroup#1}%
-  \bbl at exp@aux}
+    \bbl at tempc}}  % empty or expand to set #1 with changes 
 %    \end{macrocode}
 % \end{macro}
 %
@@ -8359,6 +8378,15 @@ help from Bernd Raichle, for which I am grateful.
     \let\bbl at savestrings\@empty
     \let\bbl at savetoday\@empty
     \let\bbl at savedate\@empty
+    \def\bbl at inipreread##1=##2\@@{%
+      \bbl at trim@def\bbl at tempa{##1}% Redundant below !!
+      % Move trims here ??
+      \bbl at ifunset{bbl at KVP@\bbl at section.\bbl at tempa}%
+        {\expandafter\bbl at inireader\bbl at tempa=##2\@@}%
+        {\def\bbl at tempc{\expandafter\bbl at inireader\bbl at tempa=}%
+         \expandafter\expandafter\expandafter
+         \bbl at tempc\csname bbl at KVP@\bbl at section.\bbl at tempa\endcsname\@@}%
+         \global\bbl at csarg\let{KVP@\bbl at section.\bbl at tempa}\relax}%
     \let\bbl at inireader\bbl at iniskip
     \bbl at info{Importing data from babel-#1.ini for \languagename}%
     \loop
@@ -8372,7 +8400,7 @@ help from Bernd Raichle, for which I am grateful.
     \repeat
   \fi}
 \def\bbl at iniline#1\bbl at iniline{%
-  \@ifnextchar[\bbl at inisec{\@ifnextchar;\bbl at iniskip\bbl at inireader}#1\@@}% ]
+  \@ifnextchar[\bbl at inisec{\@ifnextchar;\bbl at iniskip\bbl at inipreread}#1\@@}% ]
 %    \end{macrocode}
 %
 % The special cases for comment lines and sections are handled by the
@@ -11141,7 +11169,11 @@ help from Bernd Raichle, for which I am grateful.
   \EnableBabelHook{babel-fontspec}% Just calls \bbl at switchfont
   \bbl at bblfont}
 \newcommand\bbl at bblfont[2][]{% 1=features 2=fontname
-  \bbl at ifunset{\bbl at tempb family}{\bbl at providefam{\bbl at tempb}}{}%
+  \bbl at ifunset{\bbl at tempb family}%
+    {\bbl at providefam{\bbl at tempb}}%
+    {\bbl at exp{%
+      \\\bbl at sreplace\<\bbl at tempb family >%
+        {\@nameuse{\bbl at tempb default}}{\<\bbl at tempb default>}}}%
   % For the default font, just in case:
   \bbl at ifunset{bbl at lsys@\languagename}{\bbl at provide@lsys{\languagename}}{}%
   \expandafter\bbl at ifblank\expandafter{\bbl at tempa}%
@@ -11189,9 +11221,10 @@ help from Bernd Raichle, for which I am grateful.
                        \<bbl@##1dflt@*\bbl at tempa>}}}%
       {}}%                               1=T - language, already defined
   \def\bbl at tempa{%
-    \bbl at warning{The current font is not a standard family:\\%
+    \bbl at warning{The current font is not a babel standard family:\\%
       \fontname\font\\%
-      Script and Language are not applied. Consider\\%
+      There is nothing intrinsically wrong with it, but\\%
+      script and Language will not be applied. Consider\\%
       defining a new family with \string\babelfont.\\%
       Reported}}%
   \bbl at foreach\bbl at font@fams{%     don't gather with prev for
@@ -11478,7 +11511,7 @@ help from Bernd Raichle, for which I am grateful.
 % Consider |txtbabel| as a shorthand for \textit{tex--xet babel},
 % which is the bidi model in both \pdftex{} and \xetex{}.
 %
-% \changes{3.33}{2019/05/04}{\cs{@tabular}, \cs{list}, etc., are
+% \changes{3.32}{2019/05/04}{\cs{@tabular}, \cs{list}, etc., are
 %   patched, instead of redefined.}
 %
 %    \begin{macrocode}
diff --git a/babel.ins b/babel.ins
index ea54bbb..2944ef8 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/07/19}
+\def\filedate{2019/07/28}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index 1fc1702..d34ab8e 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 063767e..499fe10 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2019/07/19 v3.33]
+\ProvidesFile{bbcompat.dtx}[2019/07/28 v3.33.1716]
 %</dtx>
 %
 %% File 'bbcompat.dtx'





More information about the latex3-commits mailing list