summaryrefslogtreecommitdiff
path: root/macros/latex/required/babel/base/babel.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/required/babel/base/babel.dtx')
-rw-r--r--macros/latex/required/babel/base/babel.dtx261
1 files changed, 171 insertions, 90 deletions
diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx
index 45b916160f..980ab2b11e 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/02/26 v3.73 The Babel package]
+\ProvidesFile{babel.dtx}[2022/04/30 v3.74 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -2752,7 +2752,10 @@ which is not recommended).
font.
\end{note}
-\New{4.41} Many `ini` locale files has been extended with information
+\Describe{\localenumeral}{\marg{style}\marg{number}}
+\DescribeOther{\localecounterl}{\marg{style}\marg{counter}}
+
+\New{3.41} Many `ini` locale files has been extended with information
about non-positional numerical systems, based on those predefined in
CSS. They only work with \xetex{} and \luatex{} and are fully
expendable (even inside an unprotected |\edef|). Currently, they are
@@ -2784,33 +2787,47 @@ The styles are:
\item[Arabic] |abjad|, |maghrebi.abjad|
-\item[Belarusan, Bulgarian, Macedonian, Serbian] |lower|, |upper|
+\item[Armenian] |lower.letter|, |upper.letter|
+
+\item[Belarusan, Bulgarian, Church Slavic, Macedonian, Serbian] |lower|, |upper|
\item[Bengali] |alphabetic|
-\item[Coptic] |epact|,|lower.letters|
+\item[Central Kurdish] |alphabetic|
-\item[Hebrew] |letters| (neither geresh nor gershayim yet)
+\item[Chinese] |cjk-earthly-branch|, |cjk-heavenly-stem|,
+|circled.ideograph|, |parenthesized.ideograph|,
+|fullwidth.lower.alpha|, |fullwidth.upper.alpha|
-\item[Hindi] |alphabetic|
+\item[Church Slavic (Glagolitic)] |letters|
-\item[Armenian] |lower.letter|, |upper.letter|
+\item[Coptic] |epact|, |lower.letters|
-\item[Japanese] |hiragana|, |hiragana.iroha|, |katakana|,
-|katakana.iroha|, |circled.katakana|, |informal|, |formal|,
-|cjk-earthly-branch|, |cjk-heavenly-stem|, f|ullwidth.lower.alpha|,
-|fullwidth.upper.alpha|
+\item[French] |date.day| (mainly for internal use).
\item[Georgian] |letters|
\item[Greek] |lower.modern|, |upper.modern|, |lower.ancient|,
|upper.ancient| (all with keraia)
+\item[Hebrew] |letters| (neither geresh nor gershayim yet)
+
+\item[Hindi] |alphabetic|
+
+\item[Italian] |lower.legal|, |upper.legal|
+
+\item[Japanese] |hiragana|, |hiragana.iroha|, |katakana|,
+|katakana.iroha|, |circled.katakana|, |informal|, |formal|,
+|cjk-earthly-branch|, |cjk-heavenly-stem|, |circled.ideograph|,
+|parenthesized.ideograph|, |fullwidth.lower.alpha|,
+|fullwidth.upper.alpha|
+
\item[Khmer] |consonant|
-\item[Korean] |consonant|, |syllabe|, |hanja.informal|,
-|hanja.formal|, |hangul.formal|, |cjk-earthly-branch|,
-|cjk-heavenly-stem|, |fullwidth.lower.alpha|, |fullwidth.upper.alpha|
+\item[Korean] |consonant|, |syllabe|, |hanja.informal|, |hanja.formal|,
+|hangul.formal|, |cjk-earthly-branch|, |cjk-heavenly-stem|,
+|circled.ideograph|, |parenthesized.ideograph|,
+|fullwidth.lower.alpha|, |fullwidth.upper.alpha|
\item[Marathi] |alphabetic|
@@ -2825,9 +2842,6 @@ The styles are:
\item[Thai] |alphabetic|
\item[Ukrainian] |lower| , |lower.full|, |upper| , |upper.full|
-
-\item[Chinese] |cjk-earthly-branch|, |cjk-heavenly-stem|,
-|fullwidth.lower.alpha|, |fullwidth.upper.alpha|
\end{description}
\New{3.45} In addition, native digits (in languages defining them) may
@@ -2922,33 +2936,31 @@ If the key does not exist, the macro is set to |\relax| and an error is
raised. \New{3.47} With the starred version no error is raised, so that
you can take your own actions with undefined properties.
+\Describe{\localeid}{}
+Each language in the \babel{} sense has its own unique numeric
+identifier, which can be retrieved with |\localeid|.
+
+The |\localeid| is not the same as the |\language| identifier, which
+refers to a set of hyphenation patters (which, in turn, is just a
+component of the line breaking algorithm described in the next
+section). The data about preloaded patterns are store in an internal
+macro named |\bbl@languages| (see the code for further details), but
+note several locales may share a single |\language|, so they are
+separated concepts. In \luatex, the |\localeid| is saved in each node
+(when it makes sense) as an attribute, too.
+
+\Describe{\LocaleForEach}{\marg{code}}
\Babel{} remembers which |ini| files have been loaded. There is a loop
named |\LocaleForEach| to traverse the list, where |#1| is the name of
the current item, so that |\LocaleForEach{\message{ **#1** }}| just
shows the loaded |ini|’s.
-\begin{note}
+\Describe{\BabelEnsureInfo}{}
|ini| files are loaded with |\babelprovide| and also when languages are
-selected if there is a |\babelfont|. To ensure the |ini| files are
-loaded (and therefore the corresponding data) even if these two
-conditions are not met, write |\BabelEnsureInfo| in the preamble.
-\end{note}
-
-\Describe{\localeid}{}
-
-Each language in the \babel{} sense has its own unique numeric
-identifier, which can be retrieved with |\localeid|.
-
-\begin{note}
- The |\localeid| is not the same as the |\language| identifier, which
- refers to a set of hyphenation patters (which, in turn, is just a
- component of the line breaking algorithm described in the next
- section). The data about preloaded patterns are store in an internal
- macro named |\bbl@languages| (see the code for further details), but
- note several locales may share a single |\language|, so they are
- separated concepts. In \luatex, the |\localeid| is saved in each node
- (where it makes sense) as an attribute, too.
-\end{note}
+selected if there is a |\babelfont| or they have not been explicitly
+declared. To ensure the |ini| files are loaded (and therefore the
+corresponding data) even if these two conditions are not met, write
+|\BabelEnsureInfo| in the preamble.
\subsection{Hyphenation and line breaking}
@@ -5104,8 +5116,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.73>>
-%<<date=2022/02/26>>
+%<<version=3.74>>
+%<<date=2022/04/30>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -11156,6 +11168,8 @@ help from Bernd Raichle, for which I am grateful.
\DeclareOption{safe=none}{\let\bbl@opt@safe\@empty}
\DeclareOption{safe=bib}{\def\bbl@opt@safe{B}}
\DeclareOption{safe=ref}{\def\bbl@opt@safe{R}}
+\DeclareOption{safe=refbib}{\def\bbl@opt@safe{BR}}
+\DeclareOption{safe=bibref}{\def\bbl@opt@safe{BR}}
%<</More package options>>
% \end{macrocode}
%
@@ -11168,7 +11182,7 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\bbl@trace{Cross referencing macros}
-\ifx\bbl@opt@safe\@empty\else
+\ifx\bbl@opt@safe\@empty\else % ie, if 'ref' and/or 'bib'
\def\@newl@bel#1#2#3{%
{\@safe@activestrue
\bbl@ifunset{#1@#2}%
@@ -11235,10 +11249,24 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macrocode}
\bbl@xin@{R}\bbl@opt@safe
\ifin@
- \bbl@redefinerobust\ref#1{%
- \@safe@activestrue\org@ref{#1}\@safe@activesfalse}
- \bbl@redefinerobust\pageref#1{%
- \@safe@activestrue\org@pageref{#1}\@safe@activesfalse}
+ \edef\bbl@tempc{\expandafter\string\csname ref code\endcsname}%
+ \bbl@xin@{\expandafter\strip@prefix\meaning\bbl@tempc}%
+ {\expandafter\strip@prefix\meaning\ref}%
+ \ifin@
+ \bbl@redefine\@kernel@ref#1{%
+ \@safe@activestrue\org@@kernel@ref{#1}\@safe@activesfalse}
+ \bbl@redefine\@kernel@pageref#1{%
+ \@safe@activestrue\org@@kernel@pageref{#1}\@safe@activesfalse}
+ \bbl@redefine\@kernel@sref#1{%
+ \@safe@activestrue\org@@kernel@sref{#1}\@safe@activesfalse}
+ \bbl@redefine\@kernel@spageref#1{%
+ \@safe@activestrue\org@@kernel@spageref{#1}\@safe@activesfalse}
+ \else
+ \bbl@redefinerobust\ref#1{%
+ \@safe@activestrue\org@ref{#1}\@safe@activesfalse}
+ \bbl@redefinerobust\pageref#1{%
+ \@safe@activestrue\org@pageref{#1}\@safe@activesfalse}
+ \fi
\else
\let\org@ref\ref
\let\org@pageref\pageref
@@ -11502,28 +11530,30 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\bbl@trace{Preventing clashes with other packages}
-\bbl@xin@{R}\bbl@opt@safe
-\ifin@
- \AtBeginDocument{%
- \@ifpackageloaded{ifthen}{%
- \bbl@redefine@long\ifthenelse#1#2#3{%
- \let\bbl@temp@pref\pageref
- \let\pageref\org@pageref
- \let\bbl@temp@ref\ref
- \let\ref\org@ref
- \@safe@activestrue
- \org@ifthenelse{#1}%
- {\let\pageref\bbl@temp@pref
- \let\ref\bbl@temp@ref
- \@safe@activesfalse
- #2}%
- {\let\pageref\bbl@temp@pref
- \let\ref\bbl@temp@ref
- \@safe@activesfalse
- #3}%
- }%
- }{}%
- }
+\ifx\org@ref\@undefined\else
+ \bbl@xin@{R}\bbl@opt@safe
+ \ifin@
+ \AtBeginDocument{%
+ \@ifpackageloaded{ifthen}{%
+ \bbl@redefine@long\ifthenelse#1#2#3{%
+ \let\bbl@temp@pref\pageref
+ \let\pageref\org@pageref
+ \let\bbl@temp@ref\ref
+ \let\ref\org@ref
+ \@safe@activestrue
+ \org@ifthenelse{#1}%
+ {\let\pageref\bbl@temp@pref
+ \let\ref\bbl@temp@ref
+ \@safe@activesfalse
+ #2}%
+ {\let\pageref\bbl@temp@pref
+ \let\ref\bbl@temp@ref
+ \@safe@activesfalse
+ #3}%
+ }%
+ }{}%
+ }
+\fi
% \end{macrocode}
%
% \end{macro}
@@ -11575,7 +11605,6 @@ help from Bernd Raichle, for which I am grateful.
%
% \subsubsection{\pkg{hhline}}
%
-%
% \begin{macro}{\hhline}
%
% Delaying the activation of the shorthand characters has introduced
@@ -14283,6 +14312,7 @@ end
\catcode`\~=12
\catcode`\%=12
\catcode`\&=14
+\catcode`\|=12
\gdef\babelprehyphenation{&%
\@ifnextchar[{\bbl@settransform{0}}{\bbl@settransform{0}[]}}
\gdef\babelposthyphenation{&%
@@ -14541,38 +14571,80 @@ end
%
% \begin{macrocode}
\bbl@trace{Redefinitions for bidi layout}
+%
+%<<*More package options>>
+\chardef\bbl@eqnpos\z@
+\DeclareOption{leqno}{\chardef\bbl@eqnpos\@ne}
+\DeclareOption{fleqn}{\chardef\bbl@eqnpos\tw@}
+%<</More package options>>
+%
\def\BabelNoAMSMath{\let\bbl@noamsmath\relax}
\ifnum\bbl@bidimode>\z@
+ \ifx\matheqdirmode\@undefined\else
+ \matheqdirmode\@ne
+ \fi
\let\bbl@eqnodir\relax
-% \ifx\matheqdirmode\@undefined\else
-% \matheqdirmode\@ne
-% \fi
+ \def\bbl@eqdel{()}
+ \def\bbl@eqnum{%
+ {\normalfont\normalcolor
+ \expandafter\@firstoftwo\bbl@eqdel
+ \theequation
+ \expandafter\@secondoftwo\bbl@eqdel}}
+ \def\bbl@puteqno#1{\eqno\hbox{#1}}
+ \def\bbl@putleqno#1{\leqno\hbox{#1}}
+ \def\bbl@eqno@flip#1{%
+ \ifdim\predisplaysize=-\maxdimen
+ \eqno
+ \hb@xt@.01pt{\hb@xt@\displaywidth{\hss{#1}}\hss}%
+ \else
+ \leqno\hbox{#1}%
+ \fi}
+ \def\bbl@leqno@flip#1{%
+ \ifdim\predisplaysize=-\maxdimen
+ \leqno
+ \hb@xt@.01pt{\hss\hb@xt@\displaywidth{{#1}\hss}}%
+ \else
+ \eqno\hbox{#1}%
+ \fi}
\AtBeginDocument{%
\ifx\maketag@@@\@undefined % Normal equation, eqnarray
- \AddToHook{env/eqnarray/begin}{%
+ \AddToHook{env/equation/begin}{%
\ifnum\bbl@thetextdir>\z@
+ \let\@eqnnum\bbl@eqnum
\edef\bbl@eqnodir{\noexpand\bbl@textdir{\the\bbl@thetextdir}}%
\chardef\bbl@thetextdir\z@
\bbl@add\normalfont{\bbl@eqnodir}%
+ \ifcase\bbl@eqnpos
+ \let\bbl@puteqno\bbl@eqno@flip
+ \or
+ \let\bbl@puteqno\bbl@leqno@flip
+ \fi
\fi}%
- \AddToHook{env/equation/begin}{%
+ \ifnum\bbl@eqnpos=\tw@\else
+ \def\endequation{\bbl@puteqno{\@eqnnum}$$\@ignoretrue}%
+ \fi
+ \AddToHook{env/eqnarray/begin}{%
\ifnum\bbl@thetextdir>\z@
\edef\bbl@eqnodir{\noexpand\bbl@textdir{\the\bbl@thetextdir}}%
\chardef\bbl@thetextdir\z@
\bbl@add\normalfont{\bbl@eqnodir}%
- \pardir TLT % dir for \eqno is \pardir!
- \fi}%
- \bbl@xin@{,leqno,}{,\@classoptionslist,}%
- \ifin@
- \def\@eqnnum{%
- \setbox\z@\hbox{\normalfont\normalcolor(\theequation)}%
- \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
- \fi
+ \ifnum\bbl@eqnpos=\@ne
+ \def\@eqnnum{%
+ \setbox\z@\hbox{\bbl@eqnum}%
+ \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
+ \else
+ \let\@eqnnum\bbl@eqnum
+ \fi
+ \fi}
+ % Hack. YA luatex bug?:
+ \expandafter\bbl@sreplace\csname] \endcsname{$$}{\eqno\kern.001pt$$}%
\else % amstex
\ifx\bbl@noamsmath\@undefined
- \@ifpackagewith{amsmath}{leqno}%
- {\let\bbl@ams@lap\hbox}% = leqno
- {\let\bbl@ams@lap\llap}% = default
+ \ifnum\bbl@eqnpos=\@ne
+ \let\bbl@ams@lap\hbox
+ \else
+ \let\bbl@ams@lap\llap
+ \fi
\ExplSyntaxOn
\bbl@sreplace\intertext@{\normalbaselines}%
{\normalbaselines
@@ -14592,12 +14664,21 @@ end
\bbl@sreplace\textdef@{\hbox}{\bbl@ams@tagbox\hbox}%
\bbl@sreplace\maketag@@@{\hbox}{\bbl@ams@tagbox#1}%
\fi}%
- \AddToHook{env/equation/begin}{%
- \ifnum\bbl@thetextdir>\z@
- \ifx\bbl@ams@lap\llap\hrule\@height\z@\fi
- \bbl@ams@preset\bbl@ams@flip
- \fi}%
- \AddToHook{env/equation*/begin}{\bbl@ams@preset\bbl@ams@flip}%
+ \ifnum\bbl@eqnpos=\tw@\else
+ \def\bbl@ams@equation{%
+ \ifnum\bbl@thetextdir>\z@
+ \edef\bbl@eqnodir{\noexpand\bbl@textdir{\the\bbl@thetextdir}}%
+ \chardef\bbl@thetextdir\z@
+ \bbl@add\normalfont{\bbl@eqnodir}%
+ \ifcase\bbl@eqnpos
+ \def\veqno##1##2{\bbl@eqno@flip{##1##2}}%
+ \or
+ \def\veqno##1##2{\bbl@leqno@flip{##1##2}}%
+ \fi
+ \fi}%
+ \AddToHook{env/equation/begin}{\bbl@ams@equation}%
+ \AddToHook{env/equation*/begin}{\bbl@ams@equation}%
+ \fi
\AddToHook{env/cases/begin}{\bbl@ams@preset\bbl@ams@lap}%
\AddToHook{env/multline/begin}{\bbl@ams@preset\hbox}%
\AddToHook{env/gather/begin}{\bbl@ams@preset\bbl@ams@lap}%