diff options
author | Norbert Preining <norbert@preining.info> | 2023-12-07 03:00:45 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-12-07 03:00:45 +0000 |
commit | d1c8f933dea4fce5c8b5628fe829cadf0b33b43d (patch) | |
tree | 5b152bf88f12fcde263af23542df43d609a18aa9 /macros/latex/required | |
parent | 517bc0ad712becd89c09bdc30e6b5cdb135fcd83 (diff) |
CTAN sync 202312070300
Diffstat (limited to 'macros/latex/required')
-rw-r--r-- | macros/latex/required/babel/base/README.md | 19 | ||||
-rw-r--r-- | macros/latex/required/babel/base/babel-code.pdf | bin | 641895 -> 642032 bytes | |||
-rw-r--r-- | macros/latex/required/babel/base/babel.dtx | 440 | ||||
-rw-r--r-- | macros/latex/required/babel/base/babel.ins | 2 | ||||
-rw-r--r-- | macros/latex/required/babel/base/babel.pdf | bin | 417319 -> 417807 bytes | |||
-rw-r--r-- | macros/latex/required/babel/base/bbcompat.dtx | 2 | ||||
-rw-r--r-- | macros/latex/required/babel/base/bbidxglo.dtx | 4 |
7 files changed, 265 insertions, 202 deletions
diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md index 2957d780bb..b55e1bf964 100644 --- a/macros/latex/required/babel/base/README.md +++ b/macros/latex/required/babel/base/README.md @@ -1,6 +1,6 @@ -## Babel 3.97 +## Babel 3.98 -2023-11-11 +2023-12-06 This package manages culturally-determined typographical (and other) rules, and hyphenation patterns for a wide range of languages. Many @@ -10,9 +10,9 @@ is a set of ini files for about 275 languages. The latest stable version is available on <https://ctan.org/pkg/babel>. -Changes in version 3.97 are described in: +Changes in version 3.98 are described in: -https://latex3.github.io/babel/news/whats-new-in-babel-3.97.html +https://latex3.github.io/babel/news/whats-new-in-babel-3.98.html Apart from the manual, you can find information on some aspects of babel at: @@ -48,9 +48,14 @@ respective authors. ### Summary of latest changes ``` -3.97 2023-11-11 - * Support for 'interchar' (xetex). - * New locale for Buriat, thanks to J. Khaganov. +3.98 2023-12-06 + * Case mappings in ini files, with new casing variants in the + Latin locales. + * New: \ShowLocaleProperties. + * Improved Persian/Farsi, thanks to Farshad Rasuli + (@farshadrasuli). + * In some languages and xetex, the language name was printed with + the first \foreignlanguage. ``` ### Previous changes diff --git a/macros/latex/required/babel/base/babel-code.pdf b/macros/latex/required/babel/base/babel-code.pdf Binary files differindex 130befcb9e..f319285ed3 100644 --- a/macros/latex/required/babel/base/babel-code.pdf +++ b/macros/latex/required/babel/base/babel-code.pdf diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx index 4345b09198..afe17f79c5 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}[2023/11/11 v3.97 The Babel package] +\ProvidesFile{babel.dtx}[2023/12/06 v3.98 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -582,6 +582,16 @@ _\usepackage[vietnamese,danish]{babel}_ BCP47 tag. See section \ref{bcp47} for further details. \end{note} +\begin{note} + Documents with several input encodings are not frequent, but + sometimes are useful. You can set different encodings for different + languages as the following example shows: +\begin{verbatim} +\addto\extrasfrench{\inputencoding{latin1}} +\addto\extrasrussian{\inputencoding{koi8-r}} +\end{verbatim} +\end{note} + \subsection{Mostly monolingual documents} \label{mostlymono} @@ -1438,7 +1448,7 @@ Or also: corresponding behavior is not always implemented. Also, there are some limitations in the engines. A few remarks follow (which could no longer be valid when you read this manual, if the packages involved - han been updated). The Harfbuzz renderer has still some issues, so as + have been updated). The Harfbuzz renderer still has some issues, so as a rule of thumb prefer the default renderer, and resort to Harfbuzz only if the former does not work for you. Fortunately, fonts can be loaded twice with different renderers; for example: @@ -1562,6 +1572,7 @@ captions): \tag{bs-Cyrl} Bosnian \tag{bs-Latn} Bosnian\hascapu\hascapl \tag{bs} Bosnian\hascapu\hascapl +\tag{bua} Buriat\hascapu\hascapl \tag{byn} Blin \tag{ca} Catalan\hascapu\hascapl \tag{cch} Atsam @@ -1936,6 +1947,7 @@ breton\\ british\\ britishenglish\\ bulgarian\\ +buriat\\ burmese\\ canadian\\ canadianenglish\\ @@ -2309,7 +2321,7 @@ Many locale templates are quite useable, provided captions and dates are not required (which is a very frequent case, particularly in ancient languages). So, they will be included in the default \babel{} distribution. This can serve to encourage contributions, too. A warning will remember -they are ‘bare minumum locales’. The locales are currently +they are ‘bare minimum locales’. The locales are currently the following: \begin{multicols}{4} \small @@ -2615,23 +2627,25 @@ something like: first loads |danish.ldf|, and then redefines the captions for \texttt{danish} (as provided by the |ini| file) and prevents hyphenation. The rest of the language definitions are not touched. -Without the optional argument it just loads some aditional tools if +Without the optional argument it just loads some additional tools if provided by the |ini| file, like extra counters. \Describe{\BabelUppercaseMapping} {\marg{locale-name}\marg{codepoint}\marg{output}} \DescribeOther{\BabelLowercaseMapping} {\marg{locale-name}\marg{codepoint}\marg{output}} +\DescribeOther{\BabelTitlecaseMapping} + {\marg{locale-name}\marg{codepoint}\marg{output}} \New{3.90} These macros are devised as a high level interface for declaring case mappings, based on the locale name as declared by or -with \babel. They are the equivalent of |\DeclareUppercaseMapping| and -|\DeclareLowercaseMapping| (see \textsf{usrguide.pdf}). The purpose is -twofold: (1) a user-friendly way to declare them, because -often BCP 47 tags are not known (and sometimes can be complex); -(2) if for some reason the tag changes (eg, you decide to tag -|english| as |en-001| instead of |en-US|), the new mappings will be -still assigned to that language. +with \babel. They are the equivalent of |\DeclareUppercaseMapping|, +|\DeclareLowercaseMapping|, and |\DeclareTitlecaseMapping| (see +\textsf{usrguide.pdf}). The purpose is twofold: (1) a user-friendly way +to declare them, because often BCP 47 tags are not known (and sometimes +can be complex); (2) if for some reason the tag changes (eg, you decide +to tag |english| as |en-001| instead of |en-US|), the new mappings will +be still assigned to that language. \begin{example} For Classical Latin (no need to know the tag is \texttt{la-x-classic}): @@ -2832,14 +2846,19 @@ See the next section. \Describe{Alph=}{\meta{counter-name}} Same for |\Alph|. \Describe{casing}{\meta{rules}} \New{3.90} Selects the casing rules in a few -languages. They are (from \textsf{interface3.pdf}): +languages. The first ones are predefined by \LaTeX{} (see +\textsf{interface3.pdf}), while the following are defined by \babel: \begin{description} - \item[Armenian] |yiwn|, which maps U+0587 to capital ech and yiwn on + \item[Armenian] |yiwn| maps U+0587 to capital ech and yiwn on uppercasing. - \item[German] |eszett|, which maps the lowercase \textit{Eszett} to a + \item[German] |eszett| maps the lowercase \textit{Eszett} to a \textit{großes Eszett}. - \item[Greek] |iota|, which converts the \textit{ypogegrammeni} (subscript muted + \item[Greek] |iota| converts the \textit{ypogegrammeni} (subscript muted iota) to capital iota when uppercasing. + \item[Latin] |nouv| in |classicallatin| and |medievallatin| reverts + the default rules, which maps u ↔ V; |uv| in |ecclesianticallatin| + and the basic |latin| locale applies the map u ↔ V (by default it’s + u ↔ U and v ↔ V). \end{description} \begin{example} For the latter: @@ -3048,7 +3067,7 @@ CSS. They only work with \xetex{} and \luatex{} and are fully expandable (even inside an unprotected |\edef|). Currently, they are limited to numbers below 10000. -There are several ways to use them (for the availabe styles in each +There are several ways to use them (for the available styles in each language, see the list below): \begin{itemize} @@ -3327,6 +3346,10 @@ 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{\ShowLocaleProporties}{\marg{language}} +\New{3.98} Prints to the |log| file all the key/value pairs declared in +the |ini| locale file for \meta{language}. + \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 @@ -3498,6 +3521,22 @@ Unicode engines, spacing is based on the ``current'' em unit (the size of the previous char in \luatex, and the font size set by the last |\selectfont| in \xetex). +\begin{note} + With Unicode engines, a line break can happen just before an explicit + combining char (eg, \textit{\~{g}}, used in Guarani and Filipino, is + not included as a combined char and it’s represented in Unicode as + |U+0067|~|U+0303|. This issue is not directly related to \babel, but + to the hyphenation patterns and/or the font renderer. However, at + least with \luatex{} there is a workaround (change the language name + to what you are using): +\begin{verbatim} +\babelposthyphenation{guarani}{ | [{0300}-{036F}] }{ remove, {} } +\end{verbatim} +The Lua pattern means ‘a discretionary followed by a character in the +range |U+0300|--|U+0367| (which contains combining chars)’. An +alternative to a transform is |\babelpatterns|. +\end{note} + \subsection{Transforms} \label{transforms} @@ -3514,7 +3553,7 @@ It currently embraces |\babelprehyphenation| and \New{3.57} Several \textsf{ini} files predefine some transforms. They are activated with the key |transforms| in |\babelprovide|, either if the locale is being defined with this macro or the languages has been -previouly loaded as a class or package option, as the following example +previously loaded as a class or package option, as the following example illustrates: \begin{verbatim} \usepackage[hungarian]{babel} @@ -3798,7 +3837,7 @@ future release). \marg{class-first} and \marg{class-second} can be comma separated lists of char classes, and all combinations are defined (so that 2 first classes with 2 second classes, define 4 combinations). In the -\marg{options} field a key named |label| is available, which allows to +\meta{options} field a key named |label| is available, which allows to enable or to disable the rule with the following two commands. Like prehyphenation transforms in \luatex{}, interchars are not applied if the current hyphenation rules are |nohyphenation|. @@ -3832,7 +3871,7 @@ current language. \begin{warning} Keep in mind two points: (1) a character can be assigned a single - class; this is a limitation in the interchar mechanims that often + class; this is a limitation in the interchar mechanisms that often leads to incompatibilities; (2) since the character classes set with |\babelcharclass| are saved (so that they can be restored), there is a limit in the number of characters in the \marg{char-list} (which, @@ -4610,7 +4649,7 @@ layout.lists The first four are documented elsewhere. The following are by default |on|, but with |off| can disable some features: |bidi.math| (only preamble) changes for math or \textsf{amsmath}, |linebreak.sea|, -|linebreak.sea| and |justify.arabic| the corresponding algorithms, +|linebreak.cjk| and |justify.arabic| the corresponding algorithms, |layout.tabular| and |layout.lists| changes for tabular and lists. Some of the are reverted only to some extent. @@ -4657,18 +4696,11 @@ options (like paragraph direction with |bidi.text|). \end{verbatim} \textit{before} loading babel. This way, when the document begins the sequence is (1) make \verb/|/ active (\textsf{ltxdoc}); (2) make - it unactive (your settings); (3) make babel shorthands active + it inactive (your settings); (3) make babel shorthands active (\textsf{babel)}; (4) reload \textsf{hhline} (\textsf{babel}, now with the correct catcodes for \verb/|/ and \verb|:|).\catcode`\|=\active -\item Documents with several input encodings are not frequent, but - sometimes are useful. You can set different encodings for different - languages as the following example shows: -\begin{verbatim} -\addto\extrasfrench{\inputencoding{latin1}} -\addto\extrasrussian{\inputencoding{koi8-r}} -\end{verbatim} \item For the hyphenation to work correctly, lccodes cannot change, because \TeX{} only takes into account the values when the paragraph is hyphenated, i.e., when it has been @@ -4934,8 +4966,8 @@ recommended. \label{contribute} Currently, the easiest way to contribute a new language is by taking -one the the 500 or so |ini| templates available on GitHub as a basis. -Just make a pull request o dowonload it and then, after filling the +one of the 500 or so |ini| templates available on GitHub as a basis. +Just make a pull request or download it and then, after filling the fields, sent it to me. Fell free to ask for help or to make feature requests. @@ -5180,7 +5212,7 @@ The \TeX book states: ``Plain \TeX\ includes a macro called all characters that have a special category code.'' \cite[p.~380]{DEK} It is used to set text `verbatim'. To make this work if more characters get a special category code, you have to add this character -to the macro |\dospecial|. \LaTeX\ adds another macro called +to the macro |\dospecials|. \LaTeX\ adds another macro called |\@sanitize| representing the same character set, but without the curly braces. The macros |\bbl@add@special|\meta{char} and |\bbl@remove@special|\meta{char} add and remove the character @@ -5440,13 +5472,6 @@ to define |\abmoniname|, |\abmoniiname|, etc. (and similarly with \end{verbatim} |#1| is replaced by the roman numeral. -\Describe\SetCase{\oarg{map-list}\marg{toupper-code}\marg{tolower-code}\qquad\textit{Deprecated}} - -\begin{warning} -This feature doesn’t work any longer after some changes in the \LaTeX{} -kernel. It’s now deprecated and an alternative is on the way. -\end{warning} - \Describe{\SetHyphenMap}{\marg{to-lower-macros}} \New{3.9g} Case mapping for hyphenation is handled with |\SetHyphenMap| and controlled with the package option |hyphenmap|. @@ -5600,7 +5625,7 @@ wouldn’t exist. % % The \babel{} installer extends \textsf{docstrip} with a few % ``pseudo-guards'' to set ``variables'' used at installation time. -% They are used with |<||@name@>| at the appropiated places in the +% They are used with |<||@name@>| at the appropriate places in the % source code and defined with either % $\langle\langle$\textit{name}=\textit{value}$\rangle\rangle$, or with % a series of lines between @@ -5630,8 +5655,8 @@ wouldn’t exist. % \section{Tools} % % \begin{macrocode} -%<<version=3.97>> -%<<date=2023/11/11>> +%<<version=3.98>> +%<<date=2023/12/06>> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -5858,14 +5883,14 @@ wouldn’t exist. \edef#1{\the\toks@}} % \end{macrocode} % -% An extensison to the previous macro. It takes into account the +% An extension to the previous macro. It takes into account the % parameters, and it is string based (ie, if you replace |elax| by % |ho|, then |\relax| becomes |\rho|). No checking is done at all, % because it is not a general purpose macro, and it is used by \babel{} % only when it works (an example where it does \textit{not} work is in % |\bbl@TG@@date|, and also fails if there are macros with spaces, % because they are retokenized). It may change! (or even merged with -% |\bbl@replace|; I'm not sure ckecking the replacement is really +% |\bbl@replace|; I'm not sure checking the replacement is really % necessary or just paranoia). % % \begin{macrocode} @@ -6100,7 +6125,7 @@ wouldn’t exist. % \end{macrocode} % % This file also takes care of a number of compatibility issues with -% other packages an defines a few aditional package options. Apart from +% other packages an defines a few additional package options. Apart from % all the language options below we also have a few options that % influence the behavior of language definition files. % @@ -6124,7 +6149,7 @@ wouldn’t exist. % % If the format created a list of loaded languages (in % |\bbl@languages|), get the name of the 0-th to show the actual -% language used. Also avaliable with |base|, because it just shows +% language used. Also available with |base|, because it just shows % info. % % \begin{macrocode} @@ -6156,7 +6181,7 @@ wouldn’t exist. % it exits. % % Now the \texttt{base} option. With it we can define (and load, with -% \luatex) hyphenation patterns, even if we are not interesed in the +% \luatex) hyphenation patterns, even if we are not interested in the % rest of babel. % % \begin{macrocode} @@ -6376,7 +6401,7 @@ wouldn’t exist. % \end{macrocode} % % The following is ignored with |shorthands=off|, since it is -% intended to take some aditional actions for certain chars. +% intended to take some additional actions for certain chars. % % \begin{macrocode} \bbl@ifshorthand{'}% @@ -6815,7 +6840,7 @@ wouldn’t exist. % % The macro |\bbl@set@language| takes care of switching the language % environment \emph{and} of writing entries on the auxiliary files. -% For historial reasons, language names can be either |language| of +% For historical reasons, language names can be either |language| of % |\language|. To catch either form a trick is used, but % unfortunately as a side effect the catcodes of letters in % |\languagename| are messed up. This is a bug, but preserved for @@ -8011,7 +8036,7 @@ wouldn’t exist. % % The very first thing to do is saving the original catcode and the % original definition, even if not active, which is possible -% (undefined characters require a special treatement to avoid +% (undefined characters require a special treatment to avoid % making them |\relax| and preserving some degree of protection). % % \begin{macrocode} @@ -8450,14 +8475,14 @@ wouldn’t exist. % % \begin{macro}{\defineshorthand} % -% Currently we only support two groups of user level shorthands, -% named internally |user| and |user@<lang>| (language-dependent -% user shorthands). By default, only the first one is taken into -% account, but if the former is also used (in the optional argument -% of |\defineshorthand|) a new level is inserted for it -% (|user@generic|, done by |\bbl@set@user@generic|); we make also -% sure |{}| and |\protect| are taken into account in this new top -% level. +% Currently we only support two groups of user level shorthands, +% named internally |user| and |user@<lang>| (language-dependent +% user shorthands). By default, only the first one is taken into +% account, but if the former is also used (in the optional argument +% of |\defineshorthand|) a new level is inserted for it +% (|user@generic|, done by |\bbl@set@user@generic|); we make also +% sure |{}| and |\protect| are taken into account in this new top +% level. % % \begin{macrocode} \def\user@language@group{user@\language@group} @@ -8485,12 +8510,12 @@ wouldn’t exist. % % \begin{macro}{\languageshorthands} % -% A user level command to change the language from which shorthands -% are used. Unfortunately, \babel{} currently does not keep track -% of defined groups, and therefore there is no way to catch a -% possible change in casing to fix it in the same way languages names -% are fixed. [TODO]. -% +% A user level command to change the language from which shorthands +% are used. Unfortunately, \babel{} currently does not keep track +% of defined groups, and therefore there is no way to catch a +% possible change in casing to fix it in the same way languages names +% are fixed. [TODO]. +% % % \begin{macrocode} \def\languageshorthands#1{\def\language@group{#1}} % \end{macrocode} @@ -8498,11 +8523,12 @@ wouldn’t exist. % \end{macro} % % \begin{macro}{\aliasshorthand} -% \textit{Deprecated}. First the new shorthand needs to be -% initialized. Then, we define the new shorthand in terms of the -% original one, but note with |\aliasshorthands{"}{/}| is -% |\active@prefix /\active@char/|, so we still need to let the -% lattest to |\active@char"|. +% +% \textit{Deprecated}. First the new shorthand needs to be +% initialized. Then, we define the new shorthand in terms of the +% original one, but note with |\aliasshorthands{"}{/}| is +% |\active@prefix /\active@char/|, so we still need to let the +% latter to |\active@char"|. % % \begin{macrocode} \def\aliasshorthand#1#2{% @@ -8541,9 +8567,10 @@ wouldn’t exist. % % \begin{macro}{\shorthandon} % \begin{macro}{\shorthandoff} -% The first level definition of these macros just passes the -% argument on to |\bbl@switch@sh|, adding |\@nil| at the end to -% denote the end of the list of characters. +% +% The first level definition of these macros just passes the +% argument on to |\bbl@switch@sh|, adding |\@nil| at the end to +% denote the end of the list of characters. % % \begin{macrocode} \newcommand*\shorthandon[1]{\bbl@switch@sh\@ne#1\@nnil} @@ -8554,19 +8581,19 @@ wouldn’t exist. % % \begin{macro}{\bbl@switch@sh} % -% The macro |\bbl@switch@sh| takes the list of characters apart one -% by one and subsequently switches the category code of the -% shorthand character according to the first argument of -% |\bbl@switch@sh|. +% The macro |\bbl@switch@sh| takes the list of characters apart one +% by one and subsequently switches the category code of the +% shorthand character according to the first argument of +% |\bbl@switch@sh|. % -% But before any of this switching takes place we make sure that the -% character we are dealing with is known as a shorthand character. -% If it is, a macro such as |\active@char"| should exist. +% But before any of this switching takes place we make sure that the +% character we are dealing with is known as a shorthand character. +% If it is, a macro such as |\active@char"| should exist. % -% Switching off and on is easy -- we just set the category code to -% `other' (12) and |\active|. With the starred version, the original -% catcode and the original definition, saved in -% |@initiate@active@char|, are restored. +% Switching off and on is easy -- we just set the category code to +% `other' (12) and |\active|. With the starred version, the original +% catcode and the original definition, saved in +% |@initiate@active@char|, are restored. % % \begin{macrocode} \def\bbl@switch@sh#1#2{% @@ -8605,8 +8632,8 @@ wouldn’t exist. % \end{macro} % \end{macro} % -% Note the value is that at the expansion time; eg, in the preample -% shorhands are usually deactivated. +% Note the value is that at the expansion time; eg, in the preamble +% shorthands are usually deactivated. % % \begin{macrocode} \def\babelshorthand{\active@prefix\babelshorthand\bbl@putsh} @@ -8678,15 +8705,15 @@ wouldn’t exist. % \end{macro} % \end{macro} % -% Usually the |~| is active and expands to \verb*=\penalty\@M\ =. -% When it is written to the \file{.aux} file it is written -% expanded. To prevent that and to be able to use the character |~| -% as a start character for a shorthand, it is redefined here as a -% one character shorthand on system level. The system declaration -% is in most cases redundant (when |~| is still a non-break space), -% and in some cases is inconvenient (if |~| has been redefined); -% however, for backward compatibility it is maintained (some -% existing documents may rely on the \babel{} value). +% Usually the |~| is active and expands to \verb*=\penalty\@M\ =. +% When it is written to the \file{.aux} file it is written +% expanded. To prevent that and to be able to use the character |~| +% as a start character for a shorthand, it is redefined here as a +% one character shorthand on system level. The system declaration +% is in most cases redundant (when |~| is still a non-break space), +% and in some cases is inconvenient (if |~| has been redefined); +% however, for backward compatibility it is maintained (some +% existing documents may rely on the \babel{} value). % % \begin{macrocode} \initiate@active@char{~} @@ -8723,6 +8750,7 @@ wouldn’t exist. % Language attributes provide a means to give the user control over % which features of the language definition files he wants to % enable. +% % \begin{macro}{\languageattribute} % % The macro |\languageattribute| checks whether its arguments are @@ -8739,10 +8767,10 @@ wouldn’t exist. \bbl@vforeach{#2}{% % \end{macrocode} % -% We want to make sure that each attribute is selected only once; -% therefore we store the already selected attributes in -% |\bbl@known@attribs|. When that control sequence is not yet -% defined this attribute is certainly not selected before. +% To make sure each attribute is selected only once, we store the +% already selected attributes in |\bbl@known@attribs|. When that +% control sequence is not yet defined this attribute is certainly +% not selected before. % % \begin{macrocode} \ifx\bbl@known@attribs\@undefined @@ -8757,9 +8785,9 @@ wouldn’t exist. \else % \end{macrocode} % -% When we end up here the attribute is not selected before. So, we -% add it to the list of selected attributes and execute the -% associated \TeX-code. +% When we end up here the attribute is not selected before. So, we +% add it to the list of selected attributes and execute the +% associated \TeX-code. % % \begin{macrocode} \bbl@exp{% @@ -9166,7 +9194,7 @@ wouldn’t exist. % % \subsection{Multiencoding strings} % -% The aim following commands is to provide a commom interface for +% The aim following commands is to provide a common interface for % strings in several encodings. They also contains several hooks which % can be used by \luatex{} and \xetex. The code is organized here with % pseudo-guards, so we start with the basic commands. @@ -9181,37 +9209,8 @@ wouldn’t exist. \def\bbl@toglobal#1{\global\let#1#1} % \end{macrocode} % -% The second one. We need to patch |\@uclclist|, but it is done once -% and only if |\SetCase| is used or if strings are encoded. The code -% is far from satisfactory for several reasons, including the fact -% |\@uclclist| is not a list any more. Therefore a package option is -% added to ignore it. Instead of gobbling the macro -% getting the next two elements (usually |\reserved@a|), we pass it as -% argument to |\bbl@uclc|. The parser is restarted inside -% |\|\m{lang}|@bbl@uclc| because we do not know how many expansions -% are necessary (depends on whether strings are encoded). The last -% part is tricky -- when uppercasing, we have: -%\begin{verbatim} -% \let\bbl@tolower\@empty\bbl@toupper\@empty -%\end{verbatim} -% and starts over (and similarly when lowercasing). -% -% \begin{macrocode} -\@ifpackagewith{babel}{nocase}% - {\let\bbl@patchuclc\relax}% - {\def\bbl@patchuclc{% TODO. Delete. Doesn’t work any more. - \global\let\bbl@patchuclc\relax - \g@addto@macro\@uclclist{\reserved@b{\reserved@b\bbl@uclc}}% - \gdef\bbl@uclc##1{% - \let\bbl@encoded\bbl@encoded@uclc - \bbl@ifunset{\languagename @bbl@uclc}% and resumes it - {##1}% - {\let\bbl@tempa##1\relax % Used by LANG@bbl@uclc - \csname\languagename @bbl@uclc\endcsname}% - {\bbl@tolower\@empty}{\bbl@toupper\@empty}}% - \gdef\bbl@tolower{\csname\languagename @bbl@lc\endcsname}% - \gdef\bbl@toupper{\csname\languagename @bbl@uc\endcsname}}} -% \end{macrocode} +% The following option is currently no-op. It was meant for the +% deprecated |\SetCase|. % % \begin{macrocode} %<<*More package options>> @@ -9280,7 +9279,7 @@ wouldn’t exist. % % Parse the encoding info to get the label, input, and font parts. % -% Select the behavior of |\SetString|. Thre are two main cases, +% Select the behavior of |\SetString|. There are two main cases, % depending of if there is an optional argument: without it and % |strings=encoded|, strings are defined % always; otherwise, they are set only if they are still undefined @@ -9426,31 +9425,12 @@ wouldn’t exist. \csname\bbl@LC\expandafter\endcsname\expandafter{\BabelString}}} % \end{macrocode} % -% Now, some addtional stuff to be used when encoded strings are -% used. Captions then include |\bbl@encoded| for string to be -% expanded in case transformations. It is |\relax| by default, but -% in |\MakeUppercase| and |\MakeLowercase| its value is a modified -% expandable |\@changed@cmd|. +% A little auxiliary command sets the string. TODO: Formerly used with +% casing. Very likely no longer necessary, although it’s used in +% |\setlocalecaption|. % % \begin{macrocode} -\ifx\bbl@opt@strings\relax - \def\bbl@scset#1#2{\def#1{\bbl@encoded#2}} - \bbl@patchuclc - \let\bbl@encoded\relax - \def\bbl@encoded@uclc#1{% - \@inmathwarn#1% - \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax - \expandafter\ifx\csname ?\string#1\endcsname\relax - \TextSymbolUnavailable#1% - \else - \csname ?\string#1\endcsname - \fi - \else - \csname\cf@encoding\string#1\endcsname - \fi} -\else - \def\bbl@scset#1#2{\def#1{#2}} -\fi +\def\bbl@scset#1#2{\def#1{#2}} % \end{macrocode} % % Define |\SetStringLoop|, which is actually set inside @@ -9484,18 +9464,24 @@ wouldn’t exist. % % \paragraph{Case mapping} % -% The command |\SetCase| provides a way to change the behavior of -% |\MakeUppercase| and |\MakeLowercase|. |\bbl@tempa| is set by the -% patched |\@uclclist| to the parsing command. \textit{Deprecated.} +% The command |\SetCase| is deprecated. Currently it consists in a +% definition with a hack just for backward compatibility in the macro +% mapping. % % \begin{macrocode} %<<*Macros local to BabelCommands>> \newcommand\SetCase[3][]{% - \bbl@patchuclc - \bbl@forlang\bbl@tempa{% - \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}}}% + \def\bbl@tempa####1####2{% + \ifx####1\@empty\else + \bbl@carg\bbl@add{extras\CurrentOption}{% + \bbl@carg\babel@save{c__text_uppercase_\string####1_tl}% + \bbl@carg\def{c__text_uppercase_\string####1_tl}{####2}% + \bbl@carg\babel@save{c__text_lowercase_\string####2_tl}% + \bbl@carg\def{c__text_lowercase_\string####2_tl}{####1}}% + \expandafter\bbl@tempa + \fi}% + \bbl@tempa##1\@empty\@empty + \bbl@carg\bbl@toglobal{extras\CurrentOption}} %<</Macros local to BabelCommands>> % \end{macrocode} % @@ -10175,7 +10161,7 @@ wouldn’t exist. % % |\babelprovide| is a general purpose tool for creating and modifying % languages. It creates the language infrastructure, and loads, if -% requested, an |ini| file. It may be used in conjunction to previouly +% requested, an |ini| file. It may be used in conjunction to previously % loaded |ldf| files. % % \begin{macrocode} @@ -10196,6 +10182,7 @@ wouldn’t exist. Alph,labels,labels*,calendar,date,casing}% {\bbl@csarg\let{KVP@##1}\@nnil}% \global\let\bbl@release@transforms\@empty + \global\let\bbl@release@casing\@empty \let\bbl@calendars\@empty \global\let\bbl@inidata\@empty \global\let\bbl@extend@ini\@gobble @@ -10508,9 +10495,10 @@ wouldn’t exist. \let\\\@Alph\<bbl@cntr@\bbl@KVP@Alph @\languagename>}}% \fi % == Casing == + \bbl@release@casing \ifx\bbl@KVP@casing\@nnil\else \bbl@csarg\xdef{casing@\languagename}% - {\@nameuse{bbl@casing@\languagename}-x-\bbl@KVP@casing}% + {\@nameuse{bbl@casing@\languagename}\bbl@maybextx\bbl@KVP@casing}% \fi % == Calendars == \ifx\bbl@KVP@calendar\@nnil @@ -10958,6 +10946,7 @@ wouldn’t exist. Reported }}} % \let\bbl@release@transforms\@empty +\let\bbl@release@casing\@empty \def\bbl@ini@exports#1{% % Identification always exported \bbl@iniwarning{}% @@ -10973,7 +10962,7 @@ wouldn’t exist. \bbl@exp{\\\bbl@exportkey{lname}{identification.name.opentype}% {\csname bbl@elname@\languagename\endcsname}}% \bbl@exportkey{tbcp}{identification.tag.bcp47}{}% - % Somewhat hackish. TODO + % Somewhat hackish. TODO: \bbl@exportkey{casing}{identification.tag.bcp47}{}% \bbl@exportkey{lbcp}{identification.language.tag.bcp47}{}% \bbl@exportkey{lotf}{identification.tag.opentype}{dflt}% @@ -11036,10 +11025,33 @@ wouldn’t exist. \let\bbl@inikv@identification\bbl@inikv \let\bbl@inikv@date\bbl@inikv \let\bbl@inikv@typography\bbl@inikv -\let\bbl@inikv@characters\bbl@inikv \let\bbl@inikv@numbers\bbl@inikv % \end{macrocode} % +% The |characters| section also stores the values, but |casing| is +% treated in a different fashion. Much like transforms, a set of +% commands calling the parser are stored in |\bbl@release@casing|, +% which is executed in |\babelprovide|. +% +% \begin{macrocode} +\def\bbl@maybextx{-\bbl@csarg\ifx{extx@\languagename}\@empty x-\fi} +\def\bbl@inikv@characters#1#2{% + \bbl@ifsamestring{#1}{casing}% eg, casing = uV + {\bbl@exp{% + \\\g@addto@macro\\\bbl@release@casing{% + \\\bbl@casemapping{}{\languagename}{\unexpanded{#2}}}}}% + {\in@{$casing.}{$#1}% eg, casing.Uv = uV + \ifin@ + \lowercase{\def\bbl@tempb{#1}}% + \bbl@replace\bbl@tempb{casing.}{}% + \bbl@exp{\\\g@addto@macro\\\bbl@release@casing{% + \\\bbl@casemapping + {\\\bbl@maybextx\bbl@tempb}{\languagename}{\unexpanded{#2}}}}% + \else + \bbl@inikv{#1}{#2}% + \fi}} +% \end{macrocode} +% % Additive numerals require an additional definition. When |.1| is % found, two macros are defined -- the basic one, without |.1| called % by |\localenumeral|, and another one preserving the trailing |.1| for @@ -11374,7 +11386,6 @@ wouldn’t exist. % \textbf{Transforms.} % % \begin{macrocode} -\let\bbl@release@transforms\@empty \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{% @@ -11456,7 +11467,7 @@ wouldn’t exist. \fi \AtBeginDocument{% \bbl@patchfont{\bbl@xenohyph}% - \expandafter\select@language\expandafter{\languagename}}% + {\expandafter\select@language\expandafter{\languagename}}}% \fi}}% \fi \bbl@csarg\bbl@toglobal{lsys@#1}} @@ -11571,7 +11582,7 @@ wouldn’t exist. \def\bbl@alphnumeral#1#2{% \expandafter\bbl@alphnumeral@i\number#2 76543210\@@{#1}} \def\bbl@alphnumeral@i#1#2#3#4#5#6#7#8\@@#9{% - \ifcase\@car#8\@nil\or % Currenty <10000, but prepared for bigger + \ifcase\@car#8\@nil\or % Currently <10000, but prepared for bigger \bbl@alphnumeral@ii{#9}000000#1\or \bbl@alphnumeral@ii{#9}00000#1#2\or \bbl@alphnumeral@ii{#9}0000#1#2#3\or @@ -11637,6 +11648,13 @@ wouldn’t exist. % singletons may change. % % \begin{macrocode} +\ifcase\bbl@engine % Converts utf8 to its code (expandable) + \def\bbl@utftocode#1{\the\numexpr\decode@UTFviii#1\relax} +\else + \def\bbl@utftocode#1{\expandafter`\string#1} +\fi +% Still somewhat hackish. WIP. Note |\str_if_eq:nnTF| is fully +% expandable (|\bbl@ifsamestring| isn’t). \providecommand\BCPdata{} \ifx\renewcommand\@undefined\else % For plain. TODO. It’s a quick fix \renewcommand\BCPdata[1]{\bbl@bcpdata@i#1\@empty} @@ -11652,18 +11670,52 @@ wouldn’t exist. {\bbl@ifunset{bbl@\csname bbl@info@#1.tag.bcp47\endcsname @#2}{}% {\bbl@cs{\csname bbl@info@#1.tag.bcp47\endcsname @#2}}}} \fi -% Still somewhat hackish. WIP. \@namedef{bbl@info@casing.tag.bcp47}{casing} \newcommand\BabelUppercaseMapping[3]{% - \let\bbl@tempx\languagename - \edef\languagename{#1}% - \DeclareUppercaseMapping[\BCPdata{casing}]{#2}{#3}% - \let\languagename\bbl@tempx} + \DeclareUppercaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}} +\newcommand\BabelTitlecaseMapping[3]{% + \DeclareTitlecaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}} \newcommand\BabelLowercaseMapping[3]{% - \let\bbl@tempx\languagename - \edef\languagename{#1}% - \DeclareLowercaseMapping[\BCPdata{casing}]{#2}{#3}% - \let\languagename\bbl@tempx} + \DeclareLowercaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}} +% \end{macrocode} +% +% The parser for |casing| and |casing.|\meta{variant}. +% +% \begin{macrocode} +\def\bbl@casemapping#1#2#3{% 1:variant + \def\bbl@tempa##1 ##2{% Loop + \bbl@casemapping@i{##1}% + \ifx\@empty##2\else\bbl@afterfi\bbl@tempa##2\fi}% + \edef\bbl@templ{\@nameuse{bbl@casing@#2}#1}% Language code + \def\bbl@tempe{0}% Mode (upper/lower...) + \def\bbl@tempc{#3 }% Casing list + \expandafter\bbl@tempa\bbl@tempc\@empty} +\def\bbl@casemapping@i#1{% + \def\bbl@tempb{#1}% + \ifcase\bbl@engine % Handle utf8 in pdftex, by surrounding chars with {} + \@nameuse{regex_replace_all:nnN}% + {[\x{c0}-\x{ff}][\x{80}-\x{bf}]*}{{\0}}\bbl@tempb + \else + \@nameuse{regex_replace_all:nnN}{.}{{\0}}\bbl@tempb % TODO. needed? + \fi + \expandafter\bbl@casemapping@ii\bbl@tempb\@@} +\def\bbl@casemapping@ii#1#2#3\@@{% + \in@{#1#3}{<>}% ie, if <u>, <l>, <t> + \ifin@ + \edef\bbl@tempe{% + \if#2u1 \else\if#2l2 \else\if#2t3 \fi\fi\fi}% + \else + \ifcase\bbl@tempe\relax + \DeclareUppercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}% + \DeclareLowercaseMapping[\bbl@templ]{\bbl@utftocode{#2}}{#1}% + \or + \DeclareUppercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}% + \or + \DeclareLowercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}% + \or + \DeclareTitlecaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}% + \fi + \fi} % \end{macrocode} % % With version 3.75 |\BabelEnsureInfo| is executed always, but there is @@ -11715,11 +11767,17 @@ wouldn’t exist. \fi} \let\bbl@ini@loaded\@empty \newcommand\LocaleForEach{\bbl@foreach\bbl@ini@loaded} +\def\ShowLocaleProperties#1{% + \typeout{}% + \typeout{*** Properties for language '#1' ***} + \def\bbl@elt##1##2##3{\typeout{##1/##2 = ##3}}% + \@nameuse{bbl@inidata@#1}% + \typeout{*******}} % \end{macrocode} % % \section{Adjusting the Babel bahavior} % -% A generic high level inteface is provided to adjust some global +% A generic high level interface is provided to adjust some global % and general settings. % % \begin{macrocode} @@ -12774,7 +12832,7 @@ wouldn’t exist. % \textit{except} if a |main| language has been set. In such a % case, it is not loaded until all options has been processed. % The following macro inputs the ldf file and does some additional -% checks (|\input| works, too, but possible errors are not catched). +% checks (|\input| works, too, but possible errors are not caught). % % \begin{macrocode} \bbl@trace{Language options} @@ -12899,7 +12957,7 @@ wouldn’t exist. % % Now define the corresponding loaders. With package options, assume % the language exists. With class options, check if the option is a -% language by checking if the correspondin file exists. +% language by checking if the corresponding file exists. % % \begin{macrocode} \bbl@foreach\bbl@language@opts{% @@ -13608,10 +13666,10 @@ wouldn’t exist. % For historical reasons, \LaTeX{} can select two different series % (|bx| and |b|), for what is conceptually a single one. This can % lead to problems when a single family requires several fonts, -% depending on the language, mainly because ‘subtitutions’ with some +% depending on the language, mainly because ‘substitutions’ with some % combinations are not done consistently -- sometimes |bx/sc| is the % correct font, but sometimes points to |b/n|, even if |b/sc| exists. -% So, some subtitutions are redefined (in a somewhat hackish way, by +% So, some substitutions are redefined (in a somewhat hackish way, by % inspecting if the variant declaration contains |>ssub*|). % % \begin{macrocode} @@ -14630,7 +14688,7 @@ end % \subsection{CJK line breaking} % % Minimal line breaking for CJK scripts, mainly intended for simple -% documents and short texts as a secundary language. Only line +% documents and short texts as a secondary language. Only line % breaking, with a little stretching for justification, without any % attempt to adjust the spacing. It is based on (but does not strictly % follow) the Unicode algorithm. @@ -14789,7 +14847,7 @@ end \catcode`_=11 \catcode`:=11 \gdef\bblar@nofswarn{\gdef\msg_warning:nnx##1##2##3{}} \endgroup -\gdef\bbl@arabicjust{% TODO. Allow for serveral locales. +\gdef\bbl@arabicjust{% TODO. Allow for several locales. \let\bbl@arabicjust\relax \newattribute\bblar@kashida \directlua{ Babel.attr_kashida = luatexbase.registernumber'bblar@kashida' }% @@ -24652,7 +24710,7 @@ Babel.cjk_breaks = { \@onlypreamble\@onlypreamble % \end{macrocode} % -% Mimick \LaTeX's |\AtBeginDocument|; for this to work the user +% Mimic \LaTeX's |\AtBeginDocument|; for this to work the user % needs to add |\begindocument| to his file. % % \begin{macrocode} @@ -24672,7 +24730,7 @@ Babel.cjk_breaks = { \def\AtBeginDocument{\g@addto@macro\@begindocumenthook} % \end{macrocode} % -% We also have to mimick \LaTeX's |\AtEndOfPackage|. Our +% We also have to mimic \LaTeX's |\AtEndOfPackage|. Our % replacement macro is much simpler; it stores its argument in % |\@endofldf|. % @@ -24699,7 +24757,7 @@ Babel.cjk_breaks = { \catcode`\&=4 % \end{macrocode} % -% Mimick \LaTeX's commands to define control sequences. +% Mimic \LaTeX's commands to define control sequences. % % \begin{macrocode} \def\newcommand{\@star@or@long\new@command} @@ -25016,7 +25074,7 @@ Babel.cjk_breaks = { % % For a couple of languages we need the \LaTeX-control sequence % |\scriptsize| to be available. Because plain \TeX\ doesn't have such -% a sofisticated font mechanism as \LaTeX\ has, we just |\let| it to +% a sophisticated font mechanism as \LaTeX\ has, we just |\let| it to % |\sevenrm|. % % \begin{macrocode} diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins index b47775f117..88446a4ef6 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{2023/11/11} +\def\filedate{2023/12/06} \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 Binary files differindex da4b04f928..bbf0f874f9 100644 --- a/macros/latex/required/babel/base/babel.pdf +++ b/macros/latex/required/babel/base/babel.pdf diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx index 61e273e2f5..48667a55a2 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}[2023/11/11 v3.97] +\ProvidesFile{bbcompat.dtx}[2023/12/06 v3.98] %</dtx> % %% File 'bbcompat.dtx' diff --git a/macros/latex/required/babel/base/bbidxglo.dtx b/macros/latex/required/babel/base/bbidxglo.dtx index 58a43d9adb..37dbd9505a 100644 --- a/macros/latex/required/babel/base/bbidxglo.dtx +++ b/macros/latex/required/babel/base/bbidxglo.dtx @@ -46,7 +46,7 @@ % \end{macrocode} % % \fi -% \title{Generating the index and chage log for the Babel system} +% \title{Generating the index and change log for the Babel system} % \author{Johannes Braams} % \date{\filedate} % \maketitle @@ -73,7 +73,7 @@ level '>' % % Because the \babel\ system consists of so many files the default % codeline numbering scheme of the \Lopt{doc} package has been -% adapted. The line numbers consist of two parts seperated with a +% adapted. The line numbers consist of two parts separated with a % dot. This has to made known to the \mkidx\ program when it % produces the index. % |