summaryrefslogtreecommitdiff
path: root/macros/latex/required/babel/base
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/required/babel/base')
-rw-r--r--macros/latex/required/babel/base/README.md23
-rw-r--r--macros/latex/required/babel/base/babel.dtx420
-rw-r--r--macros/latex/required/babel/base/babel.ins2
-rw-r--r--macros/latex/required/babel/base/babel.pdfbin897584 -> 902955 bytes
-rw-r--r--macros/latex/required/babel/base/bbcompat.dtx2
5 files changed, 301 insertions, 146 deletions
diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md
index d3e4b75425..7efdf6d9b1 100644
--- a/macros/latex/required/babel/base/README.md
+++ b/macros/latex/required/babel/base/README.md
@@ -1,4 +1,4 @@
-## Babel 3.83
+## Babel 3.84
This package manages culturally-determined typographical (and other)
rules, and hyphenation patterns for a wide range of languages. Many
@@ -8,9 +8,9 @@ is a set of ini files for about 250 languages.
The latest stable version is available on <https://ctan.org/pkg/babel>.
-Changes in version 3.83 are described in:
+Changes in version 3.84 are described in:
-https://latex3.github.io/babel/news/whats-new-in-babel-3.83.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.84.html
Apart from the manual, you can find information on some aspects of babel at:
@@ -46,17 +46,14 @@ respective authors.
### Summary of latest changes
```
-3.83 2022-11-30
- * Improved Punjabi, thanks to Arvinder Singh (@punjab).
- * Compatibility with 'lscape', thanks to Salim Bou (@seloumi).
- * New locale files: Kaingang, Nheengatu, Sardinian.
- * Better handling of `leqno` with `amsmath`.
+3.84 2022-12-26
+ * Automatic selection of encodings with \babelprovide and pdftex.
* Fixes:
- - Wrong date format for Australian in babel-en-AU.ini (#195)
- - Option handling was broken with braces (#198)
- - Stray punctuation with tikz lead to lua error (#197)
- - Hungarian as a secondary language reordered some captions
- (#203).
+ - With 'select.write = omit' the main language wasn’t selected
+ in the aux file.
+ - Incorrect link box in end of line if it is preceded by a
+ non-Arabic character (#207)
+ - New option counters* the pre-expand \thepage. See #26.
```
### Previous changes
diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx
index 792605685a..fe81253e4f 100644
--- a/macros/latex/required/babel/base/babel.dtx
+++ b/macros/latex/required/babel/base/babel.dtx
@@ -32,7 +32,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2022/11/30 v3.83 The Babel package]
+\ProvidesFile{babel.dtx}[2022/12/26 v3.84 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -587,6 +587,13 @@ language (eg, |lu| can be the locale name with tag |khb| or the tag for
|lubakatanga|). See section \ref{bcp47} for further details.
\end{note}
+\New{3.84} With \pdftex, when a language is loaded on the fly
+(actually, with |\babelprovide|) selectors now set the font encoding
+based on the list provided when loading |fontenc|. Not all scripts have
+an associated encoding, so this feature works only with Latin,
+Cyrillic, Greek, Arabic, Hebrew, Cherokee, Armenian, and Georgian,
+provided a suitable font is found.
+
\subsection{Modifiers}
\New{3.9c} The basic behavior of some languages can be modified when
@@ -839,12 +846,6 @@ text
|\begin{finnish}|).
\end{note}
-\begin{note}
- Actually, there may be another advantage in the ‘short’ syntax
- |\text|\m{tag}, namely, it is not affected by |\MakeUppercase| (while
- |\foreignlanguage| is).
-\end{note}
-
\Describe{\babelensure}{|[include=|\m{commands}|,exclude=|\m{commands}%
|,fontenc=|\m{encoding}|]|\marg{language}}
@@ -2559,8 +2560,8 @@ for example:
In other engines it just suppresses hyphenation (because the pattern
list is empty).
-\New{3.58} Another special value is |unhyphenated|, which activates a
-line breking mode that allows spaces to be stretched to arbitrary amounts.
+\New{3.58} Another special value is |unhyphenated|, which is an
+alternative to |justification=unhyphenated|.
\Describe{main}{} This valueless option makes the language the main one
(thus overriding that set when \babel\ is loaded). Only in newly defined
@@ -2668,14 +2669,27 @@ Currently used only in Southeast Asian scrips, like Thai. Ignored if 0
\Describe{transforms=}{\meta{transform-list}}
See section~\ref{transforms}.
-\Describe{justification=}{\texttt{kashida} $\string|$
-\texttt{elongated} $\string|$ \texttt{unhyphenated}
-$\string|$ \texttt{padding}}
-\New{3.59} There are currently three options, mainly for the Arabic
-script. It sets the linebreaking and justification method, which can be
-based on the the \textsc{arabic tatweel} character or in the
-‘justification alternatives’ OpenType table (\texttt{jalt}). For an
-explanation see the
+\Describe{justification=}{\texttt{unhyphenated} $\string|$
+\texttt{kashida} $\string|$ \texttt{elongated} $\string|$
+\texttt{padding}}
+\New{3.59} There are currently 4 options. Note they are language
+dependent, so that they will not be applied to other languages.
+
+The first one (|unhyphenated|) activates a line breaking mode that
+allows spaces to be stretched to arbitrary amounts. Although for
+European standards the result may look odd, in some writing systems,
+like Malayalam and other Indic scripts, this has been the customary
+(although not always the desired) practice. Because of that, no locale
+sets currently this mode by default (Amharic is an exception). Unlike
+|\sloppy|, the |\hfuzz| and the |\vfuzz| are not changed, because this
+line breaking mode is not really ‘sloppy’ (in other words, overfull
+boxes are reported as usual).
+
+The second and the third are for the Arabic script. It sets the
+linebreaking and justification method, which can be based on the the
+\textsc{arabic tatweel} character or in the ‘justification
+alternatives’ OpenType table (\texttt{jalt}). For an explanation see
+the
\href{https://latex3.github.io/babel/news/whats-new-in-babel-3.59.html}%
{\babel\ site}.
@@ -2895,8 +2909,18 @@ date in the way users would expect in their own culture. Currently,
\textsf{ini} locale file has been imported), but year, month and day
had to be entered by hand, which is very inconvenient. With this macro,
the current date is converted and stored in the three last arguments,
-which must be macros: allowed calendars are |buddhist|, |coptic|,
-|hebrew|, |islamic-civil|, |islamic-umalqura|, |persian|. The optional
+which must be macros.
+Allowed calendars are
+\begin{multicols}{4}
+ |buddhist|\\
+ |coptic|\\
+ |ethiopic|\\
+ |hebrew|\\
+ |islamic-civil|\\
+ |islamic-umalqura|\\
+ |persian|
+\end{multicols}
+The optional
argument converts the given date, in the form
‘\m{year}-\m{month}-\m{day}’. Please, refer to the page on the news for
3.76 in the \babel{} site for further details.
@@ -2974,7 +2998,7 @@ in an expandable way even if something went wrong (for example, the
locale currently active is undefined). For these cases, |localeinfo*|
just returns an empty string instead of raising an error. Bear in mind
that \babel{}, following the CLDR, may leave the region unset, which
-means |\getlanguageproperty*|, described below, is the preferred
+means |\getlocaleproperty*|, described below, is the preferred
command, so that the existence of a field can be checked before. This
also means building a string with the language and the region with
|\localeinfo*{language.tab.bcp47}|\allowbreak |-|\allowbreak
@@ -3278,7 +3302,7 @@ four characters: \textit{!?:;}\,.}
\trans{Indic scripts}{danda.nobreak}{Prevents a line break before a
danda or double danda if there is a space. For Assamese, Bengali,
-Gujarati, Hindi, Kannada, Malayalam, Marathi, Oriya, Tamil, Telugu.}
+Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Tamil, Telugu.}
\trans{Latin}{digraphs.ligatures}{Replaces the groups \textit{ae},
\textit{AE}, \textit{oe}, \textit{OE} with \textit{æ}, \textit{Æ},
@@ -3487,7 +3511,7 @@ corresponding language tags as selector names with:
(You can deactivate it with |off|.) So, if |dutch| is one of the
package (or class) options, you can write |\selectlanguage{nl}|. Note
the language name does not change (in this example is still |dutch|),
-but you can get it with |\localeinfo| or |\getlanguageproperty|. It
+but you can get it with |\localeinfo| or |\getlocaleproperty|. It
must be turned on explicitly for similar reasons to those explained
above.
@@ -3732,8 +3756,11 @@ required by all engines.
rendered in that order with |bidi=basic| (as a decimal number), in
|\arabic{c1}.\arabic{c2}| the visual order is \textit{c2.c1}. Of
course, you may always adjust the order by changing the language, if
- necessary.\footnote{Next on the roadmap are counters and numeral
- systems in general. Expect some minor readjustments.}
+ necessary.
+
+ \New{3.84} Since |\thepage| is (indirectly) redefined, |makeindex|
+ will reject many entries as invalid. With |counters*| \babel{}
+ attempts to remove the conflicting macros.
\item[lists] required in \xetex{} and \pdftex{}, but only in
bidirectional (with both R and L paragraphs) documents in \luatex{}.
@@ -4131,14 +4158,37 @@ empty, removes them. The last argument is the locale name:
\Describe{\babeladjust}{\marg{key-value-list}}
\New{3.36} Sometimes you might need to disable some \babel{} features.
-Currently this macro understands the following keys (and only for
-\textsf{luatex}), with values |on| or |off|: |bidi.text|,
-|bidi.mirroring|, |bidi.mapdigits|, |layout.lists|, |layout.tabular|,
-|linebreak.sea|, |linebreak.cjk|, |justify.arabic|. For example, you can set
-|\babeladjust{bidi.text=off}| if you are using an alternative algorithm
-or with large sections not requiring it. Use with care, because these
-options do not deactivate other related options (like paragraph
-direction with |bidi.text|).
+Currently this macro understands the following keys [to be documented],
+with values |on| or |off|:
+\begin{multicols}{3}
+\ttfamily
+bidi.mirroring\\
+bidi.text\\
+% bidi.mapdigits\\
+linebreak.sea\\
+linebreak.cjk\\
+justify.arabic\\
+layout.tabular\\
+layout.lists\\
+autoload.bcp47\\
+bcp47.toname
+\end{multicols}
+
+Other keys [to be documented] are:
+\begin{multicols}{3}
+\ttfamily
+autoload.options\\
+autoload.bcp47.prefix\\
+autoload.bcp47.options\\
+prehyphenation.disable\\
+select.write\\
+select.encoding\\
+\end{multicols}
+
+For example, you can set |\babeladjust{bidi.text=off}| if you are using
+an alternative algorithm or with large sections not requiring it. Use
+with care, because these options do not deactivate other related
+options (like paragraph direction with |bidi.text|).
\subsection{Tips, workarounds, known issues and notes}
@@ -4415,8 +4465,8 @@ Some recommendations:
also use the new tools for encoded strings, described below.
\item Avoid adding things to |\noextras|\m{lang} except for umlauthigh
and friends, |\bbl@deactivate|, |\bbl@(non)frenchspacing|, and
- language-specific macros. Use always, if possible, |\bbl@save| and
- |\bbl@savevariable| (except if you still want to have access to the
+ language-specific macros. Use always, if possible, |\babel@save| and
+ |\babel@savevariable| (except if you still want to have access to the
previous value). Do not reset a macro or a setting to a hardcoded
value. Never. Instead save its value in |\extras|\m{lang}.
\item Do not switch scripts. If you want to make sure a set of glyphs
@@ -5188,8 +5238,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.83>>
-%<<date=2022/11/30>>
+%<<version=3.84>>
+%<<date=2022/12/26>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5520,16 +5570,6 @@ help from Bernd Raichle, for which I am grateful.
\fi}
% \end{macrocode}
%
-% An alternative to |\IfFormatAtLeastTF| for old versions. Temporary.
-%
-% \begin{macrocode}
-\ifx\IfFormatAtLeastTF\@undefined
- \def\bbl@ifformatlater{\@ifl@t@r\fmtversion}
-\else
- \let\bbl@ifformatlater\IfFormatAtLeastTF
-\fi
-% \end{macrocode}
-%
% The following adds some code to |\extras...| both before and after,
% while avoiding doing it twice. It's somewhat convoluted, to deal with
% |#|'s. Used to deal with alph, Alph and frenchspacing when there are
@@ -6483,6 +6523,7 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\newif\ifbbl@usedategroup
+\let\bbl@savedextras\@empty
\def\bbl@switch#1{% from select@, foreign@
% make sure there is info for the language if so requested
\bbl@ensureinfo{#1}%
@@ -6515,6 +6556,7 @@ help from Bernd Raichle, for which I am grateful.
\fi
\bbl@esphack
% switch extras
+ \csname bbl@preextras@#1\endcsname
\bbl@usehooks{beforeextras}{}%
\csname extras#1\endcsname\relax
\bbl@usehooks{afterextras}{}%
@@ -6522,6 +6564,7 @@ help from Bernd Raichle, for which I am grateful.
% > babel-sh-<short>
% > babel-bidi
% > babel-fontspec
+ \let\bbl@savedextras\@empty
% hyphenation - case mapping
\ifcase\bbl@opt@hyphenmap\or
\def\BabelLower##1##2{\lccode##1=##2\relax}%
@@ -8440,15 +8483,23 @@ help from Bernd Raichle, for which I am grateful.
% are appended to |\originalTeX| and the counter is incremented. The
% macro |\babel@savevariable|\meta{variable} saves the value of the
% variable. \meta{variable} can be anything allowed after the |\the|
-% primitive.
+% primitive. To avoid messing saved definitions up, they are saved only
+% the very first time.
%
% \begin{macrocode}
\def\babel@save#1{%
- \expandafter\let\csname babel@\number\babel@savecnt\endcsname#1\relax
- \toks@\expandafter{\originalTeX\let#1=}%
- \bbl@exp{%
- \def\\\originalTeX{\the\toks@\<babel@\number\babel@savecnt>\relax}}%
- \advance\babel@savecnt\@ne}
+ \def\bbl@tempa{{,#1,}}% Clumsy, for Plain
+ \expandafter\bbl@add\expandafter\bbl@tempa\expandafter{%
+ \expandafter{\expandafter,\bbl@savedextras,}}%
+ \expandafter\in@\bbl@tempa
+ \ifin@\else
+ \bbl@add\bbl@savedextras{,#1,}%
+ \bbl@carg\let{babel@\number\babel@savecnt}#1\relax
+ \toks@\expandafter{\originalTeX\let#1=}%
+ \bbl@exp{%
+ \def\\\originalTeX{\the\toks@\<babel@\number\babel@savecnt>\relax}}%
+ \advance\babel@savecnt\@ne
+ \fi}
\def\babel@savevariable#1{%
\toks@\expandafter{\originalTeX #1=}%
\bbl@exp{\def\\\originalTeX{\the\toks@\the#1\relax}}}
@@ -10010,62 +10061,18 @@ help from Bernd Raichle, for which I am grateful.
\fi}%
\fi
% == Counters: mapdigits ==
- % Native digits (lua level).
- \ifodd\bbl@engine
- \ifx\bbl@KVP@mapdigits\@nnil\else
- \bbl@ifunset{bbl@dgnat@\languagename}{}%
- {\RequirePackage{luatexbase}%
- \bbl@activate@preotf
- \directlua{
- Babel = Babel or {} %%% -> presets in luababel
- Babel.digits_mapped = true
- Babel.digits = Babel.digits or {}
- Babel.digits[\the\localeid] =
- table.pack(string.utfvalue('\bbl@cl{dgnat}'))
- if not Babel.numbers then
- function Babel.numbers(head)
- local LOCALE = Babel.attr_locale
- local GLYPH = node.id'glyph'
- local inmath = false
- for item in node.traverse(head) do
- if not inmath and item.id == GLYPH then
- local temp = node.get_attribute(item, LOCALE)
- if Babel.digits[temp] then
- local chr = item.char
- if chr > 47 and chr < 58 then
- item.char = Babel.digits[temp][chr-47]
- end
- end
- elseif item.id == node.id'math' then
- inmath = (item.subtype == 0)
- end
- end
- return head
- end
- end
- }}%
- \fi
- \fi
+ % > luababel.def
% == Counters: alph, Alph ==
- % What if extras<lang> contains a \babel@save\@alph? It won't be
- % restored correctly when exiting the language, so we ignore
- % this change with the \bbl@alph@saved trick.
\ifx\bbl@KVP@alph\@nnil\else
- \bbl@extras@wrap{\\\bbl@alph@saved}%
- {\let\bbl@alph@saved\@alph}%
- {\let\@alph\bbl@alph@saved
- \babel@save\@alph}%
\bbl@exp{%
- \\\bbl@add\<extras\languagename>{%
+ \\\bbl@add\<bbl@preextras@\languagename>{%
+ \\\babel@save\\\@alph
\let\\\@alph\<bbl@cntr@\bbl@KVP@alph @\languagename>}}%
\fi
\ifx\bbl@KVP@Alph\@nnil\else
- \bbl@extras@wrap{\\\bbl@Alph@saved}%
- {\let\bbl@Alph@saved\@Alph}%
- {\let\@Alph\bbl@Alph@saved
- \babel@save\@Alph}%
\bbl@exp{%
- \\\bbl@add\<extras\languagename>{%
+ \\\bbl@add\<bbl@preextras@\languagename>{%
+ \\\babel@save\\\@Alph
\let\\\@Alph\<bbl@cntr@\bbl@KVP@Alph @\languagename>}}%
\fi
% == Calendars ==
@@ -10086,6 +10093,9 @@ help from Bernd Raichle, for which I am grateful.
\ifx\bbl@tempb\@empty\else
,variant=\bbl@tempb
\fi}%
+ % == engine specific extensions ==
+ % Defined in XXXbabel.def
+ \bbl@provide@extra{#2}%
% == require.babel in ini ==
% To load or reaload the babel-*.tex, if require.babel in ini
\ifx\bbl@beforestart\relax\else % But not in doc aux or body
@@ -10117,19 +10127,7 @@ help from Bernd Raichle, for which I am grateful.
{\bbl@post@fs}%
\fi
% == transforms ==
- \ifodd\bbl@engine
- \ifx\bbl@KVP@transforms\@nnil\else
- \def\bbl@elt##1##2##3{%
- \in@{$transforms.}{$##1}%
- \ifin@
- \def\bbl@tempa{##1}%
- \bbl@replace\bbl@tempa{transforms.}{}%
- \bbl@carg\bbl@transforms{babel\bbl@tempa}{##2}{##3}%
- \fi}%
- \csname bbl@inidata@\languagename\endcsname
- \bbl@release@transforms\relax % \relax closes the last item.
- \fi
- \fi
+ % > luababel.def
% == main ==
\ifx\bbl@KVP@main\@nnil % Restore only if not 'main'
\let\languagename\bbl@savelangname
@@ -10248,6 +10246,11 @@ help from Bernd Raichle, for which I am grateful.
{}%
{\bbl@exp{\let\bbl@tempa\<l@##1>}}%
\fi}%
+ \ifx\bbl@tempa\relax
+ \bbl@warning{%
+ Requested 'hyphenrules=' for '\languagename' not found.\\%
+ Using the default value. Reported}%
+ \fi
\fi
\ifx\bbl@tempa\relax % if no opt or no language in opt found
\ifx\bbl@KVP@import\@nnil
@@ -11294,8 +11297,6 @@ help from Bernd Raichle, for which I am grateful.
\bbl@adjust@layout{\let\list\bbl@NL@list}}
\@namedef{bbl@ADJ@layout.lists@off}{%
\bbl@adjust@layout{\let\list\bbl@OL@list}}
-\@namedef{bbl@ADJ@hyphenation.extra@on}{%
- \bbl@activateposthyphen}
%
\@namedef{bbl@ADJ@autoload.bcp47@on}{%
\bbl@bcpallowedtrue}
@@ -11341,8 +11342,12 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@restorelastskip\relax
\let\bbl@savelastskip\relax}
\@namedef{bbl@ADJ@select.write@omit}{%
+ \AddBabelHook{babel-select}{beforestart}{%
+ \expandafter\babel@aux\expandafter{\bbl@main@language}{}}%
\let\bbl@restorelastskip\relax
\def\bbl@savelastskip##1\bbl@restorelastskip{}}
+\@namedef{bbl@ADJ@select.encoding@off}{%
+ \let\bbl@encoding@select@off\@empty}
% \end{macrocode}
%
% As the final task, load the code for lua. TODO: use babel name, override
@@ -11695,9 +11700,9 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\ifx\@mkboth\markboth
- \def\bbl@tempc{\let\@mkboth\markboth}
+ \def\bbl@tempc{\let\@mkboth\markboth}%
\else
- \def\bbl@tempc{}
+ \def\bbl@tempc{}%
\fi
\bbl@ifunset{markboth }\bbl@redefine\bbl@redefinerobust
\markboth#1#2{%
@@ -11710,7 +11715,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@ifblank{#2}%
{\@temptokena{}}%
{\@temptokena\expandafter{\bbl@tempb{#2}}}%
- \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}
+ \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}%
\bbl@tempc
\fi} % end ifbbl@single, end \IfBabelLayout
% \end{macrocode}
@@ -12516,8 +12521,8 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macrocode}
\ifx\bbl@main@language\@undefined
\bbl@info{%
- You haven't specified a language. I'll use 'nil'\\%
- as the main language. Reported}
+ You haven't specified a language as a class or package\\%
+ option. I'll load 'nil'. Reported}
\bbl@load@language{nil}
\fi
%</package>
@@ -13289,14 +13294,12 @@ help from Bernd Raichle, for which I am grateful.
\AddBabelHook{babel-fontspec}{beforestart}{\bbl@ckeckstdfonts}
\DisableBabelHook{babel-fontspec}
<@Font selection@>
-\input txtbabel.def
+\def\bbl@provide@extra#1{}
%</xetex>
% \end{macrocode}
%
% \subsection{Layout}
%
-% \textit{In progress.}
-%
% Note elements like headlines and margins can be modified easily with
% packages like \textsf{fancyhdr}, \textsf{typearea} or
% \textsf{titleps}, and \textsf{geometry}.
@@ -13310,12 +13313,12 @@ help from Bernd Raichle, for which I am grateful.
% which is the bidi model in both \pdftex{} and \xetex{}.
%
% \begin{macrocode}
-%<*texxet>
+%<*xetex|texxet>
\providecommand\bbl@provide@intraspace{}
\bbl@trace{Redefinitions for bidi layout}
\def\bbl@sspre@caption{%
\bbl@exp{\everyhbox{\\\bbl@textdir\bbl@cs{wdir@\bbl@main@language}}}}
-\ifx\bbl@opt@layout\@nnil\endinput\fi % No layout
+\ifx\bbl@opt@layout\@nnil\else % if layout=..
\def\bbl@startskip{\ifcase\bbl@thepardir\leftskip\else\rightskip\fi}
\def\bbl@endskip{\ifcase\bbl@thepardir\rightskip\else\leftskip\fi}
\ifx\bbl@beforeforeign\leavevmode % A poor test for bidi=
@@ -13385,6 +13388,16 @@ help from Bernd Raichle, for which I am grateful.
% think there must be a better way.
%
% \begin{macrocode}
+\IfBabelLayout{counters*}%
+ {\bbl@add\bbl@opt@layout{.counters.}%
+ \AddToHook{shipout/before}{%
+ \let\bbl@tempa\babelsublr
+ \let\babelsublr\@firstofone
+ \let\bbl@save@thepage\thepage
+ \protected@edef\thepage{\thepage}%
+ \let\babelsublr\bbl@tempa}%
+ \AddToHook{shipout/after}{%
+ \let\thepage\bbl@save@thepage}}{}
\IfBabelLayout{counters}%
{\let\bbl@latinarabic=\@arabic
\def\@arabic#1{\babelsublr{\bbl@latinarabic#1}}%
@@ -13392,6 +13405,53 @@ help from Bernd Raichle, for which I am grateful.
\def\@roman#1{\babelsublr{\ensureascii{\bbl@asciiroman#1}}}%
\let\bbl@asciiRoman=\@Roman
\def\@Roman#1{\babelsublr{\ensureascii{\bbl@asciiRoman#1}}}}{}
+\fi % end if layout
+%</xetex|texxet>
+% \end{macrocode}
+%
+% \subsection{8-bit TeX}
+%
+% Which start just above, because some code is shared with \xetex. Now,
+% 8-bit specific stuff.
+%
+% \begin{macrocode}
+%<*texxet>
+\def\bbl@provide@extra#1{%
+ % == auto-select encoding ==
+ \ifx\bbl@encoding@select@off\@empty\else
+ \bbl@ifunset{bbl@encoding@#1}%
+ {\def\@elt##1{,##1,}%
+ \edef\bbl@tempe{\expandafter\@gobbletwo\@fontenc@load@list}%
+ \count@\z@
+ \bbl@foreach\bbl@tempe{%
+ \def\bbl@tempd{##1}% Save last declared
+ \advance\count@\@ne}%
+ \ifnum\count@>\@ne
+ \getlocaleproperty*\bbl@tempa{#1}{identification/encodings}%
+ \ifx\bbl@tempa\relax \let\bbl@tempa\@empty \fi
+ \bbl@replace\bbl@tempa{ }{,}%
+ \global\bbl@csarg\let{encoding@#1}\@empty
+ \bbl@xin@{,\bbl@tempd,}{,\bbl@tempa,}%
+ \ifin@\else % if main encoding included in ini, do nothing
+ \let\bbl@tempb\relax
+ \bbl@foreach\bbl@tempa{%
+ \ifx\bbl@tempb\relax
+ \bbl@xin@{,##1,}{,\bbl@tempe,}%
+ \ifin@\def\bbl@tempb{##1}\fi
+ \fi}%
+ \ifx\bbl@tempb\relax\else
+ \bbl@exp{%
+ \global\<bbl@add>\<bbl@preextras@#1>{\<bbl@encoding@#1>}%
+ \gdef\<bbl@encoding@#1>{%
+ \\\babel@save\\\f@encoding
+ \\\bbl@add\\\originalTeX{\\\selectfont}%
+ \\\fontencoding{\bbl@tempb}%
+ \\\selectfont}}%
+ \fi
+ \fi
+ \fi}%
+ {}%
+ \fi}
%</texxet>
% \end{macrocode}
%
@@ -13704,6 +13764,14 @@ help from Bernd Raichle, for which I am grateful.
Babel.script_blocks[script], {tonumber(s,16), tonumber(e,16)})
end
end
+ function Babel.discard_sublr(str)
+ if str:find( [[\string\indexentry]] ) and
+ str:find( [[\string\babelsublr]] ) then
+ str = str:gsub( [[\string\babelsublr%s*(%b{})]],
+ function(m) return m:sub(2,-2) end )
+ end
+ return str
+end
}
\endgroup
\ifx\newattribute\@undefined\else
@@ -14826,10 +14894,10 @@ end
\bbl@add\normalfont{\bbl@eqnodir}%
\ifnum\bbl@eqnpos=\@ne
\def\@eqnnum{%
- \setbox\z@\hbox{\bbl@eqnum}%
- \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
+ \setbox\z@\hbox{\bbl@eqnum}%
+ \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
\else
- \let\@eqnnum\bbl@eqnum
+ \let\@eqnnum\bbl@eqnum
\fi
\fi}
% Hack. YA luatex bug?:
@@ -14904,7 +14972,56 @@ end
\fi
\fi}
\fi
+\def\bbl@provide@extra#1{%
+ % == Counters: mapdigits ==
+ % Native digits
+ \ifx\bbl@KVP@mapdigits\@nnil\else
+ \bbl@ifunset{bbl@dgnat@\languagename}{}%
+ {\RequirePackage{luatexbase}%
+ \bbl@activate@preotf
+ \directlua{
+ Babel = Babel or {} %%% -> presets in luababel
+ Babel.digits_mapped = true
+ Babel.digits = Babel.digits or {}
+ Babel.digits[\the\localeid] =
+ table.pack(string.utfvalue('\bbl@cl{dgnat}'))
+ if not Babel.numbers then
+ function Babel.numbers(head)
+ local LOCALE = Babel.attr_locale
+ local GLYPH = node.id'glyph'
+ local inmath = false
+ for item in node.traverse(head) do
+ if not inmath and item.id == GLYPH then
+ local temp = node.get_attribute(item, LOCALE)
+ if Babel.digits[temp] then
+ local chr = item.char
+ if chr > 47 and chr < 58 then
+ item.char = Babel.digits[temp][chr-47]
+ end
+ end
+ elseif item.id == node.id'math' then
+ inmath = (item.subtype == 0)
+ end
+ end
+ return head
+ end
+ end
+ }}%
+ \fi
+ % == transforms ==
+ \ifx\bbl@KVP@transforms\@nnil\else
+ \def\bbl@elt##1##2##3{%
+ \in@{$transforms.}{$##1}%
+ \ifin@
+ \def\bbl@tempa{##1}%
+ \bbl@replace\bbl@tempa{transforms.}{}%
+ \bbl@carg\bbl@transforms{babel\bbl@tempa}{##2}{##3}%
+ \fi}%
+ \csname bbl@inidata@\languagename\endcsname
+ \bbl@release@transforms\relax % \relax closes the last item.
+ \fi}
\ifx\bbl@opt@layout\@nnil\endinput\fi % if no layout
+%
\ifnum\bbl@bidimode>\z@
\def\bbl@nextfake#1{% non-local changes, use always inside a group!
\bbl@exp{%
@@ -15045,6 +15162,12 @@ end
% there are some additional readjustments for |bidi=default|.
%
% \begin{macrocode}
+\IfBabelLayout{counters*}%
+ {\bbl@add\bbl@opt@layout{.counters.}%
+ \directlua{
+ luatexbase.add_to_callback("process_output_buffer",
+ Babel.discard_sublr , "Babel.discard_sublr") }%
+ }{}
\IfBabelLayout{counters}%
{\let\bbl@OL@@textsuperscript\@textsuperscript
\bbl@sreplace\@textsuperscript{\m@th}{\m@th\mathdir\pagedir}%
@@ -22089,6 +22212,8 @@ function Babel.bidi(head, ispar, hdir)
local has_en = false
local first_et = nil
+ local has_hyperlink = false
+
local ATDIR = Babel.attr_dir
local save_outer
@@ -22200,7 +22325,10 @@ function Babel.bidi(head, ispar, hdir)
d = nil
elseif item.id == node.id'math' then
- inmath = (item.subtype == 0)
+ inmath = (item.subtype == 0)
+
+ elseif item.id == 8 and item.subtype == 19 then
+ has_hyperlink = true
else
d = nil
@@ -22400,7 +22528,37 @@ function Babel.bidi(head, ispar, hdir)
end
- return node.prev(head) or head
+ head = node.prev(head) or head
+
+ -------------- FIX HYPERLINKS ----------------
+
+ if has_hyperlink then
+ local flag, linking = 0, 0
+ for item in node.traverse(head) do
+ if item.id == DIR then
+ if item.dir == '+TRT' or item.dir == '+TLT' then
+ flag = flag + 1
+ elseif item.dir == '-TRT' or item.dir == '-TLT' then
+ flag = flag - 1
+ end
+ elseif item.id == 8 and item.subtype == 19 then
+ linking = flag
+ elseif item.id == 8 and item.subtype == 20 then
+ if linking > 0 then
+ if item.prev.id == DIR and
+ (item.prev.dir == '-TRT' or item.prev.dir == '-TLT') then
+ d = node.new(DIR)
+ d.dir = item.prev.dir
+ node.remove(head, item.prev)
+ node.insert_after(head, item, d)
+ end
+ end
+ linking = 0
+ end
+ end
+ end
+
+ return head
end
%</basic>
% \end{macrocode}
diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins
index dddb4bc51f..fde40b7087 100644
--- a/macros/latex/required/babel/base/babel.ins
+++ b/macros/latex/required/babel/base/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{2022/11/30}
+\def\filedate{2022/12/26}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf
index 57211aa2fd..7f740c3fde 100644
--- a/macros/latex/required/babel/base/babel.pdf
+++ b/macros/latex/required/babel/base/babel.pdf
Binary files differ
diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx
index e84432d1ba..1fc18c4393 100644
--- a/macros/latex/required/babel/base/bbcompat.dtx
+++ b/macros/latex/required/babel/base/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/11/30 v3.83]
+\ProvidesFile{bbcompat.dtx}[2022/12/26 v3.84]
%</dtx>
%
%% File 'bbcompat.dtx'