diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/babel.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/babel.def | 333 |
1 files changed, 166 insertions, 167 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index d7a24d8540c..bef836d3966 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -32,7 +32,6 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension |.ins|) which are part of the distribution. %% - \ifx\ldf@quit\@undefined\else \endinput\fi % Same line! \ifx\ProvidesFile\@undefined @@ -40,8 +39,8 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2024/06/02 v24.6 Babel common definitions] -\ifx\AtBeginDocument\@undefined % TODO. change test. +\ProvidesFile{babel.def}[2024/11/08 v24.13 Babel common definitions] +\ifx\AtBeginDocument\@undefined \def\@empty{} \def\loadlocalcfg#1{% \openin0#1.cfg @@ -596,8 +595,8 @@ \toks@\expandafter{\bbl@tempc#3}% \expandafter\edef\csname extras\languagename\endcsname{\the\toks@}% \fi} -\def\bbl@version{24.6} -\def\bbl@date{2024/06/02} +\def\bbl@version{24.13} +\def\bbl@date{2024/11/08} \ifx\language\@undefined \csname newcount\endcsname\language \fi @@ -722,10 +721,9 @@ \edef\bbl@id@last{\the\count@}% \ifcase\bbl@engine\or \directlua{ - Babel = Babel or {} - Babel.locale_props = Babel.locale_props or {} Babel.locale_props[\bbl@id@last] = {} Babel.locale_props[\bbl@id@last].name = '\languagename' + Babel.locale_props[\bbl@id@last].vars = {} }% \fi}% {}% @@ -738,30 +736,8 @@ \let\endselectlanguage\relax \def\BabelContentsFiles{toc,lof,lot} \def\bbl@set@language#1{% from selectlanguage, pop@ - % The old buggy way. Preserved for compatibility. - \edef\languagename{% - \ifnum\escapechar=\expandafter`\string#1\@empty - \else\string#1\@empty\fi}% - \ifcat\relax\noexpand#1% - \expandafter\ifx\csname date\languagename\endcsname\relax - \edef\languagename{#1}% - \let\localename\languagename - \else - \bbl@info{Using '\string\language' instead of 'language' is\\% - deprecated. If what you want is to use a\\% - macro containing the actual locale, make\\% - sure it does not not match any language.\\% - Reported}% - \ifx\scantokens\@undefined - \def\localename{??}% - \else - \scantokens\expandafter{\expandafter - \def\expandafter\localename\expandafter{\languagename}}% - \fi - \fi - \else - \def\localename{#1}% This one has the correct catcodes - \fi + % The old buggy way. Preserved for compatibility, but simplified + \edef\languagename{\expandafter\string#1\@empty}% \select@language{\languagename}% % write to auxs \expandafter\ifx\csname date\languagename\endcsname\relax\else @@ -776,18 +752,21 @@ \fi} \let\bbl@restorelastskip\relax \let\bbl@savelastskip\relax -\newif\ifbbl@bcpallowed -\bbl@bcpallowedfalse -\def\select@language#1{% from set@, babel@aux +\def\select@language#1{% from set@, babel@aux, babel@toc \ifx\bbl@selectorname\@empty \def\bbl@selectorname{select}% - % set hymap \fi + % set hymap \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi - % set name + % set name (when coming from babel@aux) \edef\languagename{#1}% \bbl@fixname\languagename - % TODO. name@map must be here? + % define \localename when coming from set@, with a trick + \ifx\scantokens\@undefined + \def\localename{??}% + \else + \bbl@exp{\\\scantokens{\def\\\localename{\languagename}\\\noexpand}\relax}% + \fi \bbl@provide@locale \bbl@iflanguage\languagename{% \let\bbl@select@type\z@ @@ -795,7 +774,7 @@ \def\babel@aux#1#2{% \select@language{#1}% \bbl@foreach\BabelContentsFiles{% \relax -> don't assume vertical mode - \@writefile{##1}{\babel@toc{#1}{#2}\relax}}}% TODO - plain? + \@writefile{##1}{\babel@toc{#1}{#2}\relax}}}% \def\babel@toc#1#2{% \select@language{#1}} \newif\ifbbl@usedategroup @@ -824,7 +803,7 @@ \csname captions#1\endcsname\relax \fi \bbl@xin@{,date,}{,\bbl@select@opts,}% - \ifin@ % if \foreign... within \<lang>date + \ifin@ % if \foreign... within \<language>date \csname date#1\endcsname\relax \fi \fi @@ -864,6 +843,12 @@ \ifin@\else\bbl@xin@{/k}{/\bbl@tempa}\fi % only kashida \ifin@\else\bbl@xin@{/p}{/\bbl@tempa}\fi % padding (eg, Tibetan) \ifin@\else\bbl@xin@{/v}{/\bbl@tempa}\fi % variable font + % hyphenation - save mins + \babel@savevariable\lefthyphenmin + \babel@savevariable\righthyphenmin + \ifnum\bbl@engine=\@ne + \babel@savevariable\hyphenationmin + \fi \ifin@ % unhyphenated/kashida/elongated/padding = allow stretching \language\l@unhyphenated @@ -875,16 +860,18 @@ % other = select patterns \bbl@patterns{#1}% \fi - % hyphenation - mins - \babel@savevariable\lefthyphenmin - \babel@savevariable\righthyphenmin + % hyphenation - set mins \expandafter\ifx\csname #1hyphenmins\endcsname\relax \set@hyphenmins\tw@\thr@@\relax + \@nameuse{bbl@hyphenmins@}% \else \expandafter\expandafter\expandafter\set@hyphenmins \csname #1hyphenmins\endcsname\relax \fi - % reset selector name + \@nameuse{bbl@hyphenmins@}% + \@nameuse{bbl@hyphenmins@\languagename}% + \@nameuse{bbl@hyphenatmin@}% + \@nameuse{bbl@hyphenatmin@\languagename}% \let\bbl@selectorname\@empty} \long\def\otherlanguage#1{% \def\bbl@selectorname{other}% @@ -928,6 +915,9 @@ \BabelText{#2}% Still in vertical mode! {\par}% \endgroup} +\providecommand\BabelWrapText[1]{% + \def\bbl@tempa{\def\BabelText####1}% + \expandafter\bbl@tempa\expandafter{\BabelText{#1}}} \def\foreign@language#1{% % set name \edef\languagename{#1}% @@ -936,6 +926,7 @@ \bbl@usedategroupfalse \fi \bbl@fixname\languagename + \let\localename\languagename % TODO. name@map here? \bbl@provide@locale \bbl@iflanguage\languagename{% @@ -1054,13 +1045,91 @@ preloaded for \bbl@nulllanguage\space instead}} \let\bbl@usehooks\@gobbletwo \ifx\bbl@onlyswitch\@empty\endinput\fi - % Here ended switch.def +\bbl@trace{Defining babelensure} +\newcommand\babelensure[2][]{% + \AddBabelHook{babel-ensure}{afterextras}{% + \ifcase\bbl@select@type + \bbl@cl{e}% + \fi}% + \begingroup + \let\bbl@ens@include\@empty + \let\bbl@ens@exclude\@empty + \def\bbl@ens@fontenc{\relax}% + \def\bbl@tempb##1{% + \ifx\@empty##1\else\noexpand##1\expandafter\bbl@tempb\fi}% + \edef\bbl@tempa{\bbl@tempb#1\@empty}% + \def\bbl@tempb##1=##2\@@{\@namedef{bbl@ens@##1}{##2}}% + \bbl@foreach\bbl@tempa{\bbl@tempb##1\@@}% + \def\bbl@tempc{\bbl@ensure}% + \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{% + \expandafter{\bbl@ens@include}}% + \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{% + \expandafter{\bbl@ens@exclude}}% + \toks@\expandafter{\bbl@tempc}% + \bbl@exp{% + \endgroup + \def\<bbl@e@#2>{\the\toks@{\bbl@ens@fontenc}}}} +\def\bbl@ensure#1#2#3{% 1: include 2: exclude 3: fontenc + \def\bbl@tempb##1{% elt for (excluding) \bbl@captionslist list + \ifx##1\@undefined % 3.32 - Don't assume the macro exists + \edef##1{\noexpand\bbl@nocaption + {\bbl@stripslash##1}{\languagename\bbl@stripslash##1}}% + \fi + \ifx##1\@empty\else + \in@{##1}{#2}% + \ifin@\else + \bbl@ifunset{bbl@ensure@\languagename}% + {\bbl@exp{% + \\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{% + \\\foreignlanguage{\languagename}% + {\ifx\relax#3\else + \\\fontencoding{#3}\\\selectfont + \fi + ########1}}}}% + {}% + \toks@\expandafter{##1}% + \edef##1{% + \bbl@csarg\noexpand{ensure@\languagename}% + {\the\toks@}}% + \fi + \expandafter\bbl@tempb + \fi}% + \expandafter\bbl@tempb\bbl@captionslist\today\@empty + \def\bbl@tempa##1{% elt for include list + \ifx##1\@empty\else + \bbl@csarg\in@{ensure@\languagename\expandafter}\expandafter{##1}% + \ifin@\else + \bbl@tempb##1\@empty + \fi + \expandafter\bbl@tempa + \fi}% + \bbl@tempa#1\@empty} +\def\bbl@captionslist{% + \prefacename\refname\abstractname\bibname\chaptername\appendixname + \contentsname\listfigurename\listtablename\indexname\figurename + \tablename\partname\enclname\ccname\headtoname\pagename\seename + \alsoname\proofname\glossaryname} +\bbl@trace{Short tags} +\newcommand\babeltags[1]{% + \edef\bbl@tempa{\zap@space#1 \@empty}% + \def\bbl@tempb##1=##2\@@{% + \edef\bbl@tempc{% + \noexpand\newcommand + \expandafter\noexpand\csname ##1\endcsname{% + \noexpand\protect + \expandafter\noexpand\csname otherlanguage*\endcsname{##2}} + \noexpand\newcommand + \expandafter\noexpand\csname text##1\endcsname{% + \noexpand\foreignlanguage{##2}}} + \bbl@tempc}% + \bbl@for\bbl@tempa\bbl@tempa{% + \expandafter\bbl@tempb\bbl@tempa\@@}} +\bbl@trace{Compatibility with language.def} \ifx\directlua\@undefined\else \ifx\bbl@luapatterns\@undefined \input luababel.def \fi \fi -\bbl@trace{Compatibility with language.def} \ifx\bbl@languages\@undefined \ifx\directlua\@undefined \openin1 = language.def % TODO. Remove hardcoded number @@ -1093,28 +1162,6 @@ \xdef#1{\the\toks@}}% \fi \fi} -\def\bbl@withactive#1#2{% - \begingroup - \lccode`~=`#2\relax - \lowercase{\endgroup#1~}} -\def\bbl@redefine#1{% - \edef\bbl@tempa{\bbl@stripslash#1}% - \expandafter\let\csname org@\bbl@tempa\endcsname#1% - \expandafter\def\csname\bbl@tempa\endcsname} -\@onlypreamble\bbl@redefine -\def\bbl@redefine@long#1{% - \edef\bbl@tempa{\bbl@stripslash#1}% - \expandafter\let\csname org@\bbl@tempa\endcsname#1% - \long\expandafter\def\csname\bbl@tempa\endcsname} -\@onlypreamble\bbl@redefine@long -\def\bbl@redefinerobust#1{% - \edef\bbl@tempa{\bbl@stripslash#1}% - \bbl@ifunset{\bbl@tempa\space}% - {\expandafter\let\csname org@\bbl@tempa\endcsname#1% - \bbl@exp{\def\\#1{\\\protect\<\bbl@tempa\space>}}}% - {\bbl@exp{\let\<org@\bbl@tempa>\<\bbl@tempa\space>}}% - \@namedef{\bbl@tempa\space}} -\@onlypreamble\bbl@redefinerobust \bbl@trace{Hooks} \newcommand\AddBabelHook[3][]{% \bbl@ifunset{bbl@hk@#2}{\EnableBabelHook{#2}}{}% @@ -1148,70 +1195,8 @@ \def\bbl@tempa#1=#2\@@{\NewHook{babel/#1}} \bbl@foreach\bbl@evargs{\bbl@tempa#1\@@} \fi -\bbl@trace{Defining babelensure} -\newcommand\babelensure[2][]{% - \AddBabelHook{babel-ensure}{afterextras}{% - \ifcase\bbl@select@type - \bbl@cl{e}% - \fi}% - \begingroup - \let\bbl@ens@include\@empty - \let\bbl@ens@exclude\@empty - \def\bbl@ens@fontenc{\relax}% - \def\bbl@tempb##1{% - \ifx\@empty##1\else\noexpand##1\expandafter\bbl@tempb\fi}% - \edef\bbl@tempa{\bbl@tempb#1\@empty}% - \def\bbl@tempb##1=##2\@@{\@namedef{bbl@ens@##1}{##2}}% - \bbl@foreach\bbl@tempa{\bbl@tempb##1\@@}% - \def\bbl@tempc{\bbl@ensure}% - \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{% - \expandafter{\bbl@ens@include}}% - \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{% - \expandafter{\bbl@ens@exclude}}% - \toks@\expandafter{\bbl@tempc}% - \bbl@exp{% - \endgroup - \def\<bbl@e@#2>{\the\toks@{\bbl@ens@fontenc}}}} -\def\bbl@ensure#1#2#3{% 1: include 2: exclude 3: fontenc - \def\bbl@tempb##1{% elt for (excluding) \bbl@captionslist list - \ifx##1\@undefined % 3.32 - Don't assume the macro exists - \edef##1{\noexpand\bbl@nocaption - {\bbl@stripslash##1}{\languagename\bbl@stripslash##1}}% - \fi - \ifx##1\@empty\else - \in@{##1}{#2}% - \ifin@\else - \bbl@ifunset{bbl@ensure@\languagename}% - {\bbl@exp{% - \\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{% - \\\foreignlanguage{\languagename}% - {\ifx\relax#3\else - \\\fontencoding{#3}\\\selectfont - \fi - ########1}}}}% - {}% - \toks@\expandafter{##1}% - \edef##1{% - \bbl@csarg\noexpand{ensure@\languagename}% - {\the\toks@}}% - \fi - \expandafter\bbl@tempb - \fi}% - \expandafter\bbl@tempb\bbl@captionslist\today\@empty - \def\bbl@tempa##1{% elt for include list - \ifx##1\@empty\else - \bbl@csarg\in@{ensure@\languagename\expandafter}\expandafter{##1}% - \ifin@\else - \bbl@tempb##1\@empty - \fi - \expandafter\bbl@tempa - \fi}% - \bbl@tempa#1\@empty} -\def\bbl@captionslist{% - \prefacename\refname\abstractname\bibname\chaptername\appendixname - \contentsname\listfigurename\listtablename\indexname\figurename - \tablename\partname\enclname\ccname\headtoname\pagename\seename - \alsoname\proofname\glossaryname} +\providecommand\PassOptionsToLocale[2]{% + \bbl@csarg\bbl@add@list{passto@#2}{#1}} \bbl@trace{Macros for setting language files up} \def\bbl@ldfinit{% \let\bbl@screset\@empty @@ -1244,7 +1229,7 @@ \catcode`\@=\atcatcode \let\atcatcode\relax \catcode`\==\eqcatcode \let\eqcatcode\relax \endinput} -\def\bbl@afterldf#1{% TODO. Merge into the next macro? Unused elsewhere +\def\bbl@afterldf#1{% \bbl@afterlang \let\bbl@afterlang\relax \let\BabelModifiers\relax @@ -1260,11 +1245,14 @@ \@onlypreamble\ldf@finish \def\main@language#1{% \def\bbl@main@language{#1}% - \let\languagename\bbl@main@language % TODO. Set localename + \let\languagename\bbl@main@language + \let\localename\bbl@main@language + \let\mainlocalename\bbl@main@language \bbl@id@assign \bbl@patterns{\languagename}} \def\bbl@beforestart{% \def\@nolanerr##1{% + \bbl@carg\chardef{l@##1}\z@ \bbl@warning{Undefined language '##1' in aux.\\Reported}}% \bbl@usehooks{beforestart}{}% \global\let\bbl@beforestart\relax} @@ -1272,8 +1260,8 @@ {\@nameuse{bbl@beforestart}}% Group! \if@filesw \providecommand\babel@aux[2]{}% - \immediate\write\@mainaux{% - \string\providecommand\string\babel@aux[2]{}}% + \immediate\write\@mainaux{\unexpanded{% + \providecommand\babel@aux[2]{\global\let\babel@toc\@gobbletwo}}}% \immediate\write\@mainaux{\string\@nameuse{bbl@beforestart}}% \fi \expandafter\selectlanguage\expandafter{\bbl@main@language}% @@ -1283,7 +1271,7 @@ \global\let\babel@aux\@gobbletwo % Also as flag \fi} \ifcase\bbl@engine\or - \AtBeginDocument{\pagedir\bodydir} % TODO - a better place + \AtBeginDocument{\pagedir\bodydir} \fi \def\select@language@x#1{% \ifcase\bbl@select@type @@ -1292,6 +1280,10 @@ \select@language{#1}% \fi} \bbl@trace{Shorhands} +\def\bbl@withactive#1#2{% + \begingroup + \lccode`~=`#2\relax + \lowercase{\endgroup#1~}} \def\bbl@add@special#1{% 1:a macro like \", \?, etc. \bbl@add\dospecials{\do#1}% test @sanitize = \relax, for back. compat. \bbl@ifunset{@sanitize}{}{\bbl@add\@sanitize{\@makeother#1}}% @@ -1306,18 +1298,6 @@ \endgroup \fi \fi} -\def\bbl@remove@special#1{% - \begingroup - \def\x##1##2{\ifnum`#1=`##2\noexpand\@empty - \else\noexpand##1\noexpand##2\fi}% - \def\do{\x\do}% - \def\@makeother{\x\@makeother}% - \edef\x{\endgroup - \def\noexpand\dospecials{\dospecials}% - \expandafter\ifx\csname @sanitize\endcsname\relax\else - \def\noexpand\@sanitize{\@sanitize}% - \fi}% - \x} \def\bbl@active@def#1#2#3#4{% \@namedef{#3#1}{% \expandafter\ifx\csname#2@sh@#1@\endcsname\relax @@ -1420,7 +1400,7 @@ \bbl@afterfi\csname#1@sh@#2@sel\endcsname \fi} \begingroup -\bbl@ifunset{ifincsname}% TODO. Ugly. Correct? Only Plain? +\bbl@ifunset{ifincsname}% {\gdef\active@prefix#1{% \ifx\protect\@typeset@protect \else @@ -1461,7 +1441,6 @@ \csname bbl@normal@\string#1\endcsname} \def\bbl@firstcs#1#2{\csname#1\endcsname} \def\bbl@scndcs#1#2{\csname#2\endcsname} - \def\babel@texpdf#1#2#3#4{% \ifx\texorpdfstring\@undefined \textormath{#1}{#3}% @@ -1502,7 +1481,7 @@ \expandafter\@firstoftwo \fi} \def\user@group{user} -\def\language@group{english} % TODO. I don't like defaults +\def\language@group{english} \def\system@group{system} \def\useshorthands{% \@ifstar\bbl@usesh@s{\bbl@usesh@x{}}} @@ -1717,6 +1696,24 @@ \def\babel@savevariable#1{% \toks@\expandafter{\originalTeX #1=}% \bbl@exp{\def\\\originalTeX{\the\toks@\the#1\relax}}} +\def\bbl@redefine#1{% + \edef\bbl@tempa{\bbl@stripslash#1}% + \expandafter\let\csname org@\bbl@tempa\endcsname#1% + \expandafter\def\csname\bbl@tempa\endcsname} +\@onlypreamble\bbl@redefine +\def\bbl@redefine@long#1{% + \edef\bbl@tempa{\bbl@stripslash#1}% + \expandafter\let\csname org@\bbl@tempa\endcsname#1% + \long\expandafter\def\csname\bbl@tempa\endcsname} +\@onlypreamble\bbl@redefine@long +\def\bbl@redefinerobust#1{% + \edef\bbl@tempa{\bbl@stripslash#1}% + \bbl@ifunset{\bbl@tempa\space}% + {\expandafter\let\csname org@\bbl@tempa\endcsname#1% + \bbl@exp{\def\\#1{\\\protect\<\bbl@tempa\space>}}}% + {\bbl@exp{\let\<org@\bbl@tempa>\<\bbl@tempa\space>}}% + \@namedef{\bbl@tempa\space}} +\@onlypreamble\bbl@redefinerobust \def\bbl@frenchspacing{% \ifnum\the\sfcode`\.=\@m \let\bbl@nonfrenchspacing\relax @@ -1753,21 +1750,6 @@ \fi}% \bbl@fs@chars \fi\fi\fi} -\bbl@trace{Short tags} -\def\babeltags#1{% - \edef\bbl@tempa{\zap@space#1 \@empty}% - \def\bbl@tempb##1=##2\@@{% - \edef\bbl@tempc{% - \noexpand\newcommand - \expandafter\noexpand\csname ##1\endcsname{% - \noexpand\protect - \expandafter\noexpand\csname otherlanguage*\endcsname{##2}} - \noexpand\newcommand - \expandafter\noexpand\csname text##1\endcsname{% - \noexpand\foreignlanguage{##2}}} - \bbl@tempc}% - \bbl@for\bbl@tempa\bbl@tempa{% - \expandafter\bbl@tempb\bbl@tempa\@@}} \bbl@trace{Hyphens} \@onlypreamble\babelhyphenation \AtEndOfPackage{% @@ -1794,6 +1776,23 @@ {\csname bbl@hyphenation@\bbl@tempa\endcsname\space}% #2}}}% \fi}} +\ifx\NewDocumentCommand\@undefined\else + \NewDocumentCommand\babelhyphenmins{sommo}{% + \IfNoValueTF{#2}% + {\protected@edef\bbl@hyphenmins@{\set@hyphenmins{#3}{#4}}% + \IfValueT{#5}{% + \protected@edef\bbl@hyphenatmin@{\hyphenationmin=#5\relax}}% + \IfBooleanT{#1}{% + \lefthyphenmin=#3\relax + \righthyphenmin=#4\relax + \IfValueT{#5}{\hyphenationmin=#5\relax}}}% + {\edef\bbl@tempb{\zap@space#2 \@empty}% + \bbl@for\bbl@tempa\bbl@tempb{% + \@namedef{bbl@hyphenmins@\bbl@tempa}{\set@hyphenmins{#3}{#4}}% + \IfValueT{#5}{% + \@namedef{bbl@hyphenatmin@\bbl@tempa}{\hyphenationmin=#5\relax}}}% + \IfBooleanT{#1}{\bbl@error{hyphenmins-args}{}{}{}}}} +\fi \def\bbl@allowhyphens{\ifvmode\else\nobreak\hskip\z@skip\fi} \def\bbl@t@one{T1} \def\allowhyphens{\ifx\cf@encoding\bbl@t@one\else\bbl@allowhyphens\fi} @@ -2026,7 +2025,7 @@ \bbl@xin@{,}{\bbl@language@opts}% \chardef\bbl@opt@hyphenmap\ifin@4\else\@ne\fi \fi} -\newcommand\setlocalecaption{% TODO. Catch typos. +\newcommand\setlocalecaption{% \@ifstar\bbl@setcaption@s\bbl@setcaption@x} \def\bbl@setcaption@x#1#2#3{% language caption-name string \bbl@trim@def\bbl@tempa{#2}% |