[latex3-commits] [git/LaTeX3-latex3-latex2e] master: import doesn't require a value. Bidi: page numbers, better handling of neutrals. (595895c)
Javier
javier at dante.de
Sun Jul 29 12:31:34 CEST 2018
Repository : https://github.com/latex3/latex2e
On branch : master
Link : https://github.com/latex3/latex2e/commit/595895c1e400176238ded03672e117686da68da7
>---------------------------------------------------------------
commit 595895c1e400176238ded03672e117686da68da7
Author: Javier <javier at localhost>
Date: Sun Jul 29 12:30:08 2018 +0200
import doesn't require a value. Bidi: page numbers, better handling of neutrals.
>---------------------------------------------------------------
595895c1e400176238ded03672e117686da68da7
required/babel/README.md | 4 +-
required/babel/babel.dtx | 297 ++++++++++++++++++++++++++-----------------
required/babel/babel.ins | 2 +-
required/babel/babel.pdf | Bin 651826 -> 654581 bytes
required/babel/bbcompat.dtx | 2 +-
5 files changed, 181 insertions(+), 124 deletions(-)
diff --git a/required/babel/README.md b/required/babel/README.md
index bdf8ee6..40fcae9 100644
--- a/required/babel/README.md
+++ b/required/babel/README.md
@@ -1,4 +1,4 @@
-## Babel 3.22
+## Babel 3.22.1352
This package manages culturally-determined typographical (and other)
rules, and hyphenation patterns for a wide range of languages. Many
@@ -129,5 +129,5 @@ respective authors.
```
Javier Bezos
-2018/06/05
+2018/07/29
diff --git a/required/babel/babel.dtx b/required/babel/babel.dtx
index 8706a4c..d6fb19e 100644
--- a/required/babel/babel.dtx
+++ b/required/babel/babel.dtx
@@ -31,7 +31,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2018/06/05 v3.22 The Babel package]
+\ProvidesFile{babel.dtx}[2018/07/29 v3.22.1352 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -1146,7 +1146,7 @@ for auxiliary tasks).
\documentclass{book}
\usepackage{babel}
-\babelprovide[import=ka, main]{georgian}
+\babelprovide[import, main]{georgian}
\babelfont{rm}{DejaVu Sans}
@@ -1432,10 +1432,11 @@ captions):
\bigskip
In some contexts (currently |\babelfont|) an \texttt{ini} file may be
-loaded by its name. Here is the list of the names currently
-supported. With these languages, |\babelfont| loads (if not done
-before) the language and script names (even if the language is defined
-as a package option with an \textsf{ldf} file).
+loaded by its name. Here is the list of the names currently supported.
+With these languages, |\babelfont| loads (if not done before) the
+language and script names (even if the language is defined as a package
+option with an \textsf{ldf} file). These are also the names recognized
+by |\babelprovide| with a valueless |import|.
\begingroup
\bigskip\hrule\nobreak
@@ -1818,7 +1819,7 @@ Mono} \fi}
\usepackage[swedish, bidi=default]{babel}
-\babelprovide[import=he]{hebrew}
+\babelprovide[import]{hebrew}
_\babelfont{rm}{FreeSerif}_
@@ -1993,6 +1994,11 @@ and hyphenmins. For example:
Unicode engines load the UTF-8 variants, while 8-bit engines load the
LICR (ie, with macros like |\'| or |\ss|) ones.
+\New{3.23} It may be used without a value. In such a case, the |ini|
+file set in the corresponding |babel-<language>.tex| (where
+|<language>| is the last argument in |\babelprovide|) is imported. See
+the list of recognized languages above.
+
There are about 200 |ini| files, with data taken from the |ldf| files
and the CLDR provided by Unicode. Not all languages in the latter are
complete, and therefore neither are the |ini| files. A few languages
@@ -2066,9 +2072,9 @@ in, for example, page numbering).
For example:
\begin{verbatim}
-\babelprovide[import=te]{telugu} % Telugu better with XeTeX
+\babelprovide[import]{telugu} % Telugu better with XeTeX
% Or also, if you want:
- % \babelprovide[import=te, maparabic]{telugu}
+ % \babelprovide[import, maparabic]{telugu}
\babelfont{rm}{Gautami}
\begin{document}
\telugudigits{1234}
@@ -2268,13 +2274,14 @@ differ in the way `weak' numeric characters are ordered (eg, Arabic
\%123 \textit{vs} Hebrew 123\%).
\begin{warning}
- Setting bidi text has many subtleties (see for example
- <https://www.w3.org/TR/html-bidi/>). \textit{This means the \babel{}
- bidi code may take some time before it is truly stable.}\footnote{A
- basic stable version for \luatex{} is planned before (Northern)
- Summer 2018. Other engines must wait very likely until (Northern)
- Winter.} \textit{This is particularly true for graphical elements,
- including the |picture| environment and PDF or PS based graphics.}
+ The current code for \textbf{text} in \luatex{} should be considered
+ essentially stable, but, of course, it is not bug free and there
+ could 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 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.
An effort is being made to avoid incompatibilities in the future
(this one of the reason currently bidi must be explicitly requested
@@ -2292,21 +2299,22 @@ bidi mechanism is just activated (by default it is not), but every
change must by marked up. In \xetex{} and \pdftex{} this is the only
option. In \luatex, |basic-r| provides a simple and fast method for R
text, which handles numbers and unmarked L text within an R context.
-\New{3.19} Finally, |basic| suports both L and R text (see
-\ref{bidibasic}). (They are named \texttt{basic} mainly because they
-only consider the intrinsic direction of scripts and weak
-directionality.)
+\New{3.19} Finally, |basic| suports both L and R text. (They are named
+\texttt{basic} mainly because they only consider the intrinsic
+direction of scripts and weak directionality.)
+
+There are samples on GitHub, under \texttt{/required/babel/samples}.
+See particularly |lua-bidibasic.tex| and |lua-secenum.tex|.
\begin{example}
The following text comes from the Arabic Wikipedia (article about
Arabia). Copy-pasting some text from the Wikipedia is a good way to
- test this feature, which will be improved in the future. Remember
- |basic-r| is available in \luatex{} only.\footnote{At the time of
- this writing some Arabic fonts are not rendered correctly by the
- default \luatex{} font loader, with misplaced kerns inside some
- words, so double check the resulting text. It seems a fix is on the
- way, but in the meanwhile you could have a look at the workaround
- available on GitHub, under \texttt{/required/babel/samples}}
+ test this feature. Remember |basic-r| is available in \luatex{}
+ only.\footnote{At the time of this writing some Arabic fonts are not
+ rendered correctly by the default \luatex{} font loader, with
+ misplaced kerns inside some words, so double check the resulting
+ text. Have a look at the workaround available on GitHub, under
+ \texttt{/required/babel/samples}}
\begingroup
% If you are looking at the code to see how it has been written, you
% will be disappointed :-). The following example is built ad hoc to
@@ -2320,7 +2328,7 @@ directionality.)
\usepackage[_bidi=basic-r_]{babel}
-_\babelprovide[import=ar, main]{arabic}_
+_\babelprovide[import, main]{arabic}_
\babelfont{rm}{FreeSerif}
@@ -2336,6 +2344,65 @@ _\babelprovide[import=ar, main]{arabic}_
\endgroup
\end{example}
+\begin{example}
+ With |bidi=basic| \textit{both} L and R text can be
+ 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
+ with an option in |\babelprovide|, as illustrated:
+ \begingroup
+ % If you are looking at the code to see how it has been written, you
+ % will be disappointed :-). The following example is built ad hoc to
+ % emulate the final result to avoid dependencies, and therefore it's
+ % not "real" code.
+ \setmonofont[Scale=.87,Script=Arabic]{DejaVu Sans Mono} \catcode`@=13
+ \def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TRT \else
+ \bgroup\textdir TLT \pardir TLT \fi}
+ \begin{verbatim}
+ \documentclass{book}
+
+ \usepackage[english, _bidi=basic_]{babel}
+
+ \babelprovide[_mapfont=direction_]{arabic}
+
+ \babelfont{rm}{Crimson}
+ \babelfont[*arabic]{rm}{FreeSerif}
+
+ \begin{document}
+
+ Most Arabic speakers consider the two varieties to be two registers
+ of one language, although the two registers can be referred to in
+ Arabic as @1فصحى العصر@0 \textit{fuṣḥā l-ʻaṣr} (MSA) and
+ @1فصحى التراث@0 \textit{fuṣḥā t-turāth} (CA).
+
+ \end{document}
+ \end{verbatim}
+ \endgroup
+ What |mapfont=direction| means is, ‘when a character has the same
+ direction as the script for the “provided” language (|arabic| in
+ this case), then change its font to that set for this language’ (here
+ defined via |*arabic|, because Crimson does not provide Arabic
+ letters). Note Hebrew and Arabic have different directions
+ (internally ‘r’ and ‘al’, respectively).
+\end{example}
+
+\begin{note}
+ Boxes are “black boxes”. Numbers inside an |\hbox| (as for example
+ in a |\ref|) do not know anything about the surrounding chars. So,
+ |\ref{A}-\ref{B}| are not rendered in the visual order A-B, but in the
+ wrong one B-A (because the hyphen does not “see” the digits inside the
+ |\hbox|’es). If you need |\ref| ranges, the best option is to define
+ a dedicated macro like this (to avoid explicit direction changes in the
+ body; here |\texthe| must be defined to select the main language):
+ \begin{verbatim}
+ \newcommand\refrange[2]{\babelsublr{\texthe{\ref{#1}}-\texthe{\ref{#2}}}}
+ \end{verbatim}
+
+ In a future a more complete method, reading recursively boxed text, may
+ be added.
+\end{note}
+
\Describe{layout=}{\texttt{sectioning} $\string|$
\texttt{counters} $\string|$
\texttt{lists} $\string|$
@@ -2419,26 +2486,35 @@ corresponding language. For this reason, there is no |rl| counterpart.
Any |\babelsublr| in \textit{explicit} L mode is ignored. However, with
|bidi=basic| and \textit{implicit} L, it first returns to R and then
-switches to explicit L. This is by design to provide the proper behaviour
-in the most usual cases — but if you need to use |\ref| in an L text
-inside R, it must be marked up explictly.
+switches to explicit L. To clarify this point, consider, in an R
+context:
+\begin{verbatim}
+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
+you need to use |\ref| in an L text inside R, the L text must be marked
+up explictly; for example:
+\begin{verbatim}
+RTL A \foreignlanguage{english}{ltr text \thechapter{} and still ltr} RTL B
+\end{verbatim}
\Describe{\BabelPatchSection}{\marg{section-name}}
-Mainly for bidi text, but it could be useful in other
-cases. |\BabelPatchSection| and the corresponding option
-|layout=sectioning| takes a more logical approach (at least in many
-cases) because it applies the global language to the section format
-(including the |\chaptername| in |\chapter|), while the section text
-is still the current language. The latter is passed to tocs and marks,
-too, and with |sectioning| in |layout| they both reset the “global”
-language to the main one, while the text uses the “local”
-language
-
-With |layout=sectioning| all the standard sectioning
-commands are redefined, but with this command you can set them
-individually if necessary (but note then tocs and marks are not
-touched).
+Mainly for bidi text, but it could be useful in other cases.
+|\BabelPatchSection| and the corresponding option |layout=sectioning|
+takes a more logical approach (at least in many cases) because it
+applies the global language to the section format (including the
+|\chaptername| in |\chapter|), while the section text is still the
+current language. The latter is passed to tocs and marks, too,
+and with |sectioning| in |layout| they both reset the “global” language
+to the main one, while the text uses the “local” language.
+
+With |layout=sectioning| all the standard sectioning commands are
+redefined (it also “isolates” the page number in heads, for a proper
+bidi behavior), but with this command you can set them individually if
+necessary (but note then tocs and marks are not touched).
\Describe{\BabelFootnote}{\marg{cmd}\marg{local-language}%
\marg{before}\marg{after}}
@@ -2581,7 +2657,7 @@ requiring a command to switch the language. Its default value is
|toc,lof,lot|, but you may redefine it with |\renewcommand| (it's up
to you to make sure no toc type is duplicated).
-\subsection{Languages supported by \babel}
+\subsection{Languages supported by \babel{} with \textsf{ldf} files}
In the following table most of the languages supported by \babel{} with
and |.ldf| file are listed, together with the names of the option which
@@ -2656,6 +2732,23 @@ you can create a file with extension |.dn|:
Then you preprocess it with |devnag| \m{file}, which creates
\m{file}|.tex|; you can then typeset the latter with \LaTeX.
+\subsection{Some remarks on \luatex{} support}
+
+Complex scripts require not only \babel{} but also |fontspec|, which in
+turn relies on \textsf{luaotfload}. Unfortunately, at the time of this
+writing, there are some issues with the latter and its development
+seems stuck. Here is some remarks based on \TeX Live as of June 2018:
+\begin{itemize}
+\item [To be revised: With Arabic, some internal kerns are
+ misplaced...]
+\item Hebrew works, except Niqqud marks, which sometimes are misplaced.
+\item Most Devanagari fonts work, but you may need to set the OTF
+ language to \texttt{deva} (default is \texttt{dev2}).
+\item Thai fonts works, too, but \babel{} does not handle correctly
+line breaking (work in progress).
+\item
+\end{itemize}
+
\subsection{Tips, workarounds, know issues and notes}
\begin{itemize}
@@ -2767,7 +2860,7 @@ discretionary by the equivalent to ZWJ.
\usepackage{babel}
-\babelprovide[import=th, main]{thai}
+\babelprovide[import, main]{thai}
\babelfont{rm}{FreeSerif}
@@ -2820,66 +2913,6 @@ chapters), in Hungarian ``from (1)'' is ``(1)-b\H{o}l'', but ``from
``3.$^{\textrm{\scriptsize er}}$ \'{\i}tem'', and so on.
\subsection{Tentative and experimental code}
-\label{bidibasic}
-
-\textbf{Option \texttt{bidi=basic}}
-
-\New{3.19} With this package option \textit{both} L and R text can be
-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
-with an option in |\babelprovide|, as illustrated:
- \begingroup
-% If you are looking at the code to see how it has been written, you
-% will be disappointed :-). The following example is built ad hoc to
-% emulate the final result to avoid dependencies, and therefore it's
-% not "real" code.
-\setmonofont[Scale=.87,Script=Arabic]{DejaVu Sans Mono} \catcode`@=13
-\def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TRT \else
-\bgroup\textdir TLT \pardir TLT \fi}
-\begin{verbatim}
-\documentclass{book}
-
-\usepackage[english, _bidi=basic_]{babel}
-
-\babelprovide[_mapfont=direction_]{arabic}
-
-\babelfont{rm}{Crimson}
-\babelfont[*arabic]{rm}{FreeSerif}
-
-\begin{document}
-
-Most Arabic speakers consider the two varieties to be two registers
-of one language, although the two registers can be referred to in
-Arabic as @1فصحى العصر@0 \textit{fuṣḥā l-ʻaṣr} (MSA) and
- at 1فصحى التراث@0 \textit{fuṣḥā t-turāth} (CA).
-
-\end{document}
-\end{verbatim}
-\endgroup
-What |mapfont=direction| means is, ‘when a character has the same
-direction as the script for the “provided” language (|arabic| in
-this case), then change its font to that set for this language’ (here
-defined via |*arabic|, because Crimson does not provide Arabic
-letters).
-
-Boxes are “black boxes”. Numbers inside an |\hbox| (as for example
-in a |\ref|) do not know anything about the surrounding chars. So,
-|\ref{A}-\ref{B}| are not rendered in the visual order A-B, but in the
-wrong one B-A (because the hyphen does not “see” the digits inside the
-|\hbox|’es). If you need |\ref| ranges, the best option is to define
-a dedicated macro like this (to avoid explicit direction changes in the
-body; here |\texthe| must be defined to select the main language):
-\begin{verbatim}
-\newcommand\refrange[2]{\babelsublr{\texthe{\ref{#1}}-\texthe{\ref{#2}}}}
-\end{verbatim}
-
-In a future a more complete method, reading recursively boxed text, may
-be added.
-
-There are samples on GitHub, under \texttt{/required/babel/samples}:
-|lua-bidibasic.tex| and |lua-secenum.tex|.
\medskip
\textbf{Old stuff}
@@ -3859,8 +3892,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.22>>
-%<<date=2018/06/05>>
+%<<version=3.22.1352>>
+%<<date=2018/07/29>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -7733,6 +7766,14 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl at KVP@mapfont\@nil
\let\bbl at KVP@maparabic\@nil
\bbl at forkv{#1}{\bbl at csarg\def{KVP@##1}{##2}}% TODO - error handling
+ \ifx\bbl at KVP@import\@nil\else
+ \bbl at exp{\\\bbl at ifblank{\bbl at KVP@import}}%
+ {\begingroup
+ \def\BabelBeforeIni##1##2{\gdef\bbl at KVP@import{##1}\endinput}%
+ \InputIfFileExists{babel-#2.tex}{}{}%
+ \endgroup}%
+ {}%
+ \fi
\ifx\bbl at KVP@captions\@nil
\let\bbl at KVP@captions\bbl at KVP@import
\fi
@@ -7787,8 +7828,13 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\expandafter\expandafter
\bbl at setdigits\csname bbl at dgnat@\languagename\endcsname
\ifx\bbl at KVP@maparabic\@nil\else
- \expandafter\let\expandafter\@arabic
- \csname bbl at counter@\languagename\endcsname
+ \ifx\bbl at latinarabic\@undefined
+ \expandafter\let\expandafter\@arabic
+ \csname bbl at counter@\languagename\endcsname
+ \else % ie, if layout=counters, which redefines \@arabic
+ \expandafter\let\expandafter\bbl at latinarabic
+ \csname bbl at counter@\languagename\endcsname
+ \fi
\fi
\fi}%
\fi
@@ -8571,7 +8617,9 @@ help from Bernd Raichle, for which I am grateful.
\g at addto@macro\@resetactivechars{%
\set at typeset@protect
\expandafter\select at language@x\expandafter{\bbl at main@language}%
- \let\protect\noexpand}%
+ \let\protect\noexpand
+ \edef\thepage{%
+ \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}}%
\fi}
{\bbl at redefine\markright#1{%
\bbl at ifblank{#1}%
@@ -8579,7 +8627,7 @@ help from Bernd Raichle, for which I am grateful.
{\toks@{#1}%
\bbl at exp{%
\\\org at markright{\\\protect\\\foreignlanguage{\languagename}%
- {\\\protect\\\bbl at restore@actives\the\toks@}}}}}
+ {\\\protect\\\bbl at restore@actives\the\toks@}}}}}%
% \end{macrocode}
%
% \end{macro}
@@ -18100,6 +18148,9 @@ function Babel.bidi(head, ispar, hdir)
local nodes = {}
local outer_first = nil
+ local glue_d = nil
+ local glue_i = nil
+
local has_en = false
local first_et = nil
@@ -18186,10 +18237,23 @@ function Babel.bidi(head, ispar, hdir)
new_d = false
end
+ if glue_d then
+ if (d == 'l' and 'l' or 'r') ~= glue_d then
+ table.insert(nodes, {glue_i, 'on', nil})
+ end
+ glue_d = nil
+ glue_i = nil
+ end
+
elseif item.id == DIR then
d = nil
new_d = true
+ elseif item.id == node.id'glue' and item.subtype == 13 then
+ glue_d = d
+ glue_i = item
+ d = nil
+
else
d = nil
end
@@ -18249,13 +18313,6 @@ function Babel.bidi(head, ispar, hdir)
end
prev_d = d
table.insert(nodes, {item, d, outer_first})
- else
- -- Not sure about the following. Looks too 'ad hoc', but it's
- -- required for numbers, so that 89 19 becomes 19 89. It also
- -- affects n+cs/es+n.
- if prev_d == 'an' or prev_d == 'en' then
- table.insert(nodes, {item, 'on', nil})
- end
end
outer_first = nil
diff --git a/required/babel/babel.ins b/required/babel/babel.ins
index db54d17..d7b4da2 100644
--- a/required/babel/babel.ins
+++ b/required/babel/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/06/05}
+\def\filedate{2018/07/29}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/required/babel/babel.pdf b/required/babel/babel.pdf
index f623f0a..279e8e0 100644
Binary files a/required/babel/babel.pdf and b/required/babel/babel.pdf differ
diff --git a/required/babel/bbcompat.dtx b/required/babel/bbcompat.dtx
index 7e78bc2..520b010 100644
--- a/required/babel/bbcompat.dtx
+++ b/required/babel/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2018/06/05 v3.22]
+\ProvidesFile{bbcompat.dtx}[2018/07/29 v3.22.1352]
%</dtx>
%
%% File 'bbcompat.dtx'
More information about the latex3-commits
mailing list