diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-23 20:40:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-23 20:40:46 +0000 |
commit | b2bf3fb1c009f5b7ca8e293dba0eff5ac2e0b15a (patch) | |
tree | fd7a69e1ef320cc85ec03ecdea1c85a6d814920a /Master/texmf-dist/source/latex/babel/babel.dtx | |
parent | e6d9042f87c853bdb51128b143b354976be349c2 (diff) |
babel (23oct22)
git-svn-id: svn://tug.org/texlive/trunk@64795 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/babel/babel.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.dtx | 205 |
1 files changed, 107 insertions, 98 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index 3d8eddc5055..44ed19a8f24 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -32,7 +32,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2022/10/04 v3.81 The Babel package] +\ProvidesFile{babel.dtx}[2022/10/23 v3.82 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -1232,18 +1232,6 @@ are incompatibilities with other packages. written to the log file.\footnote{You can use alternatively the package \textsf{silence}.} -\Describe{strings=}{\texttt{generic} $\string|$ \texttt{unicode} -$\string|$ \texttt{encoded} $\string|$ \meta{label} $\string|$ -\meta{font encoding}} Selects the encoding of strings in languages -supporting this feature. Predefined labels are |generic| (for -traditional \TeX, LICR and ASCII strings), |unicode| (for engines like -\xetex{} and \luatex) and |encoded| (for special cases requiring mixed -encodings). Other allowed values are font encoding codes (|T1|, |T2A|, -|LGR|, |L7X|...), but only in languages supporting them. Be aware with -|encoded| captions are protected, but they work in |\MakeUppercase| -and the like (this feature misuses some internal \LaTeX\ tools, so use -it only as a last resort). - \Describe{hyphenmap=}{\texttt{off} $\string|$ \texttt{first} $\string|$ \texttt{select} $\string|$ \texttt{other} $\string|$ \texttt{other*}} @@ -2503,11 +2491,11 @@ If the language has been loaded as an argument in |\documentclass| or 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. So, the previous example can -be written: +\New{3.23} It may be used without a value, and that is often the +recommended option. 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. So, the previous example is best written as: \begin{verbatim} \babelprovide[_import_]{hungarian} \end{verbatim} @@ -2616,8 +2604,7 @@ it acts on characters, not on spaces). There are currently two ‘actions’, which can be used at the same time (separated by a space): with |ids| the |\language| and the |\localeid| are set to the values of this locale; with |fonts|, the fonts are changed to those of this -locale (as set with |\babelfont|). This option is not compatible with -|mapfont|. Characters can be added or modified with +locale (as set with |\babelfont|). Characters can be added or modified with |\babelcharproperty|. \New{3.81} Option |letters| restricts the ‘actions’ to letters, in the @@ -2665,16 +2652,6 @@ It’s still somewhat experimental. Again, there is an explanation in the \Describe{linebreaking=}{} \New{3.59} Just a synonymous for \texttt{justification}. -\Describe{mapfont=}{\texttt{direction}} -Assigns the font for the writing direction of this language (only with -|bidi=basic|). Whenever possible, instead of this option use |onchar|, -based on the script, which usually makes more sense. More precisely, -what |mapfont=direction| means is, ‘when a character has the same -direction as the script for the “provided” language, then change its -font to that set for this language’. There are 3 directions, following -the bidi Unicode algorithm, namely, Arabic-like, Hebrew-like and left -to right. So, there should be at most 3 directives of this kind. - \begin{note} (1) If you need shorthands, you can define them with |\useshorthands| and |\defineshorthand| as described above. (2) Captions and |\today| @@ -5176,8 +5153,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<<version=3.81>> -%<<date=2022/10/04>> +%<<version=3.82>> +%<<date=2022/10/23>> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -5202,6 +5179,10 @@ help from Bernd Raichle, for which I am grateful. {\def#1{#2}}% {\expandafter\def\expandafter#1\expandafter{#1#2}}} \def\bbl@xin@{\@expandtwoargs\in@} +\def\bbl@carg#1#2{\expandafter#1\csname#2\endcsname}% +\def\bbl@ncarg#1#2#3{\expandafter#1\expandafter#2\csname#3\endcsname}% +\def\bbl@ccarg#1#2#3{% + \expandafter#1\csname#2\expandafter\endcsname\csname#3\endcsname}% \def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% \def\bbl@cs#1{\csname bbl@#1\endcsname} \def\bbl@cl#1{\csname bbl@#1@\languagename\endcsname} @@ -5340,8 +5321,8 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@ifblank#1{% \bbl@ifblank@i#1\@nil\@nil\@secondoftwo\@firstoftwo\@nil} \long\def\bbl@ifblank@i#1#2\@nil#3#4#5\@nil{#4} -\def\bbl@ifset#1#2#3{% - \bbl@ifunset{#1}{#3}{\bbl@exp{\\\bbl@ifblank{#1}}{#3}{#2}}} +\def\bbl@ifset#1#2#3{% + \bbl@ifunset{#1}{#3}{\bbl@exp{\\\bbl@ifblank{\@nameuse{#1}}}{#3}{#2}}} % \end{macrocode} % \end{macro} % @@ -7054,7 +7035,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@redefine@long#1{% \edef\bbl@tempa{\bbl@stripslash#1}% \expandafter\let\csname org@\bbl@tempa\endcsname#1% - \expandafter\long\expandafter\def\csname\bbl@tempa\endcsname} + \long\expandafter\def\csname\bbl@tempa\endcsname} \@onlypreamble\bbl@redefine@long % \end{macrocode} % @@ -7631,7 +7612,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@csarg\edef{normal@#2}{% \noexpand\active@prefix\noexpand#1% \expandafter\noexpand\csname normal@char#2\endcsname}% - \expandafter\let\expandafter#1\csname bbl@normal@#2\endcsname + \bbl@ncarg\let#1{bbl@normal@#2}% % \end{macrocode} % % The next level of the code checks whether a user has defined a @@ -8018,10 +7999,8 @@ help from Bernd Raichle, for which I am grateful. \@notshorthand{#2}% \else \initiate@active@char{#2}% - \expandafter\let\csname active@char\string#2\expandafter\endcsname - \csname active@char\string#1\endcsname - \expandafter\let\csname normal@char\string#2\expandafter\endcsname - \csname normal@char\string#1\endcsname + \bbl@ccarg\let{active@char\string#2}{active@char\string#1}% + \bbl@ccarg\let{normal@char\string#2}{normal@char\string#1}% \bbl@activate{#2}% \fi \fi}% @@ -8714,22 +8693,46 @@ help from Bernd Raichle, for which I am grateful. % A temporary hack: \ifx\BabelCaseHack\@undefined \AtBeginDocument{% - \bbl@exp{% - \\\in@{\string\@uclclist}% - {\expandafter\meaning\csname MakeUppercase \endcsname}}% + \bbl@xin@{\string\@uclclist}% + {\bbl@carg\meaning{MakeUppercase }}% \ifin@\else - \expandafter\let\expandafter\bbl@newuc\csname MakeUppercase \endcsname + \chardef\bbl@ulflag\z@ + \bbl@ncarg\let\bbl@newuc{MakeUppercase }% \protected\@namedef{MakeUppercase }#1{{% - \def\reserved@a##1##2{\let##1##2\reserved@a}% - \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}% - \protected@edef\reserved@a{\bbl@newuc{#1}}\reserved@a}}% - \expandafter\let\expandafter\bbl@newlc\csname MakeLowercase \endcsname + \chardef\bbl@ulflag\@ne + \ifx\bbl@uclc\@undefined + \bbl@newuc{#1}% + \else + \bbl@ifunset{\languagename @bbl@uclc}% + {\bbl@newuc{#1}}% + {\def\reserved@a##1##2{\let##1##2\reserved@a}% + \bbl@uclc\reserved@a\reserved@b{\reserved@b\@gobble}% + \protected@edef\reserved@a{\bbl@newuc{#1}}% Pre-expand + \reserved@a}% + \fi}}% + \bbl@ncarg\let\bbl@newlc{MakeLowercase }% \protected\@namedef{MakeLowercase }#1{{% - \def\reserved@a##1##2{\let##2##1\reserved@a}% - \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}% - \protected@edef\reserved@a{\bbl@newlc{#1}}\reserved@a}}% + \chardef\bbl@ulflag\tw@ + \ifx\bbl@uclc\@undefined + \bbl@newlc{#1}% + \else + \bbl@ifunset{\languagename @bbl@uclc}% + {\bbl@newlc{#1}}% + {\def\reserved@a##1##2{\let##2##1\reserved@a}% + \bbl@uclc\reserved@a\reserved@b{\reserved@b\@gobble}% + \protected@edef\reserved@a{\bbl@newlc{#1}}% Pre-expand + \reserved@a}% + \fi}}% + \def\bbl@cased{% + \ifcase\bbl@ulflag + \expandafter\@firstofone + \or + \expandafter\MakeUppercase + \or + \expandafter\MakeLowercase + \fi}% \fi} -\fi +\fi % \end{macrocode} % % \begin{macrocode} @@ -9012,12 +9015,9 @@ help from Bernd Raichle, for which I am grateful. \newcommand\SetCase[3][]{% \bbl@patchuclc \bbl@forlang\bbl@tempa{% - \expandafter\bbl@encstring - \csname\bbl@tempa @bbl@uclc\endcsname{\bbl@tempa##1}% - \expandafter\bbl@encstring - \csname\bbl@tempa @bbl@uc\endcsname{##2}% - \expandafter\bbl@encstring - \csname\bbl@tempa @bbl@lc\endcsname{##3}}}% + \bbl@carg\bbl@encstring{\bbl@tempa @bbl@uclc}{\bbl@tempa##1}% + \bbl@carg\bbl@encstring{\bbl@tempa @bbl@uc}{##2}% + \bbl@carg\bbl@encstring{\bbl@tempa @bbl@lc}{##3}}}% %<</Macros local to BabelCommands>> % \end{macrocode} % @@ -9520,7 +9520,7 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\umlauthigh{% \def\bbl@umlauta##1{\leavevmode\bgroup% - \expandafter\accent\csname\f@encoding dqpos\endcsname + \accent\csname\f@encoding dqpos\endcsname ##1\bbl@allowhyphens\egroup}% \let\bbl@umlaute\bbl@umlauta} \def\umlautlow{% @@ -9566,10 +9566,10 @@ help from Bernd Raichle, for which I am grateful. \leavevmode\bgroup \U@D 1ex% {\setbox\z@\hbox{% - \expandafter\char\csname\f@encoding dqpos\endcsname}% + \char\csname\f@encoding dqpos\endcsname}% \dimen@ -.45ex\advance\dimen@\ht\z@ \ifdim 1ex<\dimen@ \fontdimen5\font\dimen@ \fi}% - \expandafter\accent\csname\f@encoding dqpos\endcsname + \accent\csname\f@encoding dqpos\endcsname \fontdimen5\font\U@D #1% \egroup} % \end{macrocode} @@ -9953,7 +9953,7 @@ help from Bernd Raichle, for which I am grateful. \ifin@\else\bbl@xin@{/k}{/\bbl@cl{lnbrk}}\fi \ifin@\bbl@arabicjust\fi \bbl@xin@{/p}{/\bbl@cl{lnbrk}}% - \ifin@\AtBeginDocument{\bbl@tibetanjust}\fi + \ifin@\AtBeginDocument{\@nameuse{bbl@tibetanjust}}\fi % == Line breaking: hyphenate.other.(locale|script) == \ifx\bbl@lbkflag\@empty \bbl@ifunset{bbl@hyotl@\languagename}{}% @@ -10104,8 +10104,20 @@ help from Bernd Raichle, for which I am grateful. {\bbl@pre@fs}% {\bbl@post@fs}% \fi - % == Release saved transforms == - \bbl@release@transforms\relax % \relax closes the last item. + % == 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 % == main == \ifx\bbl@KVP@main\@nnil % Restore only if not 'main' \let\languagename\bbl@savelangname @@ -10911,44 +10923,40 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \let\bbl@release@transforms\@empty -\@namedef{bbl@inikv@transforms.prehyphenation}{% - \bbl@transforms\babelprehyphenation} -\@namedef{bbl@inikv@transforms.posthyphenation}{% - \bbl@transforms\babelposthyphenation} +\bbl@csarg\let{inikv@transforms.prehyphenation}\bbl@inikv +\bbl@csarg\let{inikv@transforms.posthyphenation}\bbl@inikv \def\bbl@transforms@aux#1#2#3#4,#5\relax{% #1[#2]{#3}{#4}{#5}} \begingroup % A hack. TODO. Don't require an specific order \catcode`\%=12 \catcode`\&=14 \gdef\bbl@transforms#1#2#3{&% - \ifx\bbl@KVP@transforms\@nnil\else - \directlua{ - local str = [==[#2]==] - str = str:gsub('%.%d+%.%d+$', '') - tex.print([[\def\string\babeltempa{]] .. str .. [[}]]) - }&% - \bbl@xin@{,\babeltempa,}{,\bbl@KVP@transforms,}&% + \directlua{ + local str = [==[#2]==] + str = str:gsub('%.%d+%.%d+$', '') + tex.print([[\def\string\babeltempa{]] .. str .. [[}]]) + }&% + \bbl@xin@{,\babeltempa,}{,\bbl@KVP@transforms,}&% + \ifin@ + \in@{.0$}{#2$}&% \ifin@ - \in@{.0$}{#2$}&% - \ifin@ - \directlua{ - local str = string.match([[\bbl@KVP@transforms]], - '%(([^%(]-)%)[^%)]-\babeltempa') - if str == nil then - tex.print([[\def\string\babeltempb{}]]) - else - tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]]) - end - } - \toks@{#3}&% - \bbl@exp{&% - \\\g@addto@macro\\\bbl@release@transforms{&% - \relax &% Closes previous \bbl@transforms@aux - \\\bbl@transforms@aux - \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&% - \else - \g@addto@macro\bbl@release@transforms{, {#3}}&% - \fi + \directlua{&% (\attribute) syntax + local str = string.match([[\bbl@KVP@transforms]], + '%(([^%(]-)%)[^%)]-\babeltempa') + if str == nil then + tex.print([[\def\string\babeltempb{}]]) + else + tex.print([[\def\string\babeltempb{,attribute=]] .. str .. [[}]]) + end + } + \toks@{#3}&% + \bbl@exp{&% + \\\g@addto@macro\\\bbl@release@transforms{&% + \relax &% Closes previous \bbl@transforms@aux + \\\bbl@transforms@aux + \\#1{label=\babeltempa\babeltempb}{\languagename}{\the\toks@}}}&% + \else + \g@addto@macro\bbl@release@transforms{, {#3}}&% \fi \fi} \endgroup @@ -10996,7 +11004,8 @@ help from Bernd Raichle, for which I am grateful. in the current font, and therefore the hyphen\\% will be printed. Try changing the fontspec's\\% 'HyphenChar' to another value, but be aware\\% - this setting is not safe (see the manual)}% + this setting is not safe (see the manual).\\% + Reported}% \hyphenchar\font\defaulthyphenchar \fi\fi \fi}% @@ -12369,7 +12378,7 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \ifx\bbl@opt@main\@nnil\else - \bbl@csarg\let{loadmain\expandafter}\csname ds@\bbl@opt@main\endcsname + \bbl@ncarg\let\bbl@loadmain{ds@\bbl@opt@main}% \expandafter\let\csname ds@\bbl@opt@main\endcsname\relax \fi % \end{macrocode} @@ -13246,7 +13255,7 @@ help from Bernd Raichle, for which I am grateful. \<bbl@xeipn@\languagename>}% \\\bbl@toglobal\<extras\languagename>% \\\bbl@add\<noextras\languagename>{% - \XeTeXlinebreaklocale "en"}% + \XeTeXlinebreaklocale ""}% \\\bbl@toglobal\<noextras\languagename>}% \ifx\bbl@ispacesize\@undefined \gdef\bbl@ispacesize{\bbl@cl{xeisp}}% |