summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/babel
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-11-11 21:12:10 +0000
committerKarl Berry <karl@freefriends.org>2023-11-11 21:12:10 +0000
commit501719bfed98b8d0f17c48707c4e58999f742f0f (patch)
tree021ce3a271666aa6f434c49ef59453797c26e066 /Master/texmf-dist/source/latex/babel
parent3ea7d20391c1e2a566cd37f1ae577632beaaf774 (diff)
babel (11nov23)
git-svn-id: svn://tug.org/texlive/trunk@68816 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/babel')
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.dtx240
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.ins2
-rw-r--r--Master/texmf-dist/source/latex/babel/bbcompat.dtx2
-rw-r--r--Master/texmf-dist/source/latex/babel/locale.zipbin1033891 -> 1036974 bytes
4 files changed, 225 insertions, 19 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index 8346f33f4bb..4345b09198a 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}[2023/10/25 v3.96 The Babel package]
+\ProvidesFile{babel.dtx}[2023/11/11 v3.97 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -271,10 +271,11 @@ are also some notes on its use with e-Plain and pdf-Plain \TeX.
\item[\sffamily\color{messages}What if I’m interested only in the
latest changes?] Changes and new features with relation to version 3.8
-are highlighted with \New{X.XX}\hspace{-.5em}, and there are some notes
-for the latest versions in
-\href{https://latex3.github.io/babel/}{the
-\babel{} site}. The most recent features can be still unstable.
+are highlighted with \New{X.XX}\hspace{-.5em}
+(\raisebox{.15ex}{$\oplus$} is a link to the \babel{} site), and there
+are some notes for the latest versions in
+\href{https://latex3.github.io/babel/}{the \babel{} site}. The most
+recent features can be still unstable.
\item[\sffamily\color{messages}Can I help?] Sure! If you are interested
in the \TeX{} multilingual support, please join the
@@ -2852,7 +2853,6 @@ languages. They are (from \textsf{interface3.pdf}):
\makebox[\linewidth][c]{*\qquad*\qquad*}
\smallskip
-
A few options (only \luatex) set some properties of the writing system
used by the language. These properties are \textit{always} applied to
the script, no matter which language is active. Although somewhat
@@ -3772,6 +3772,73 @@ This feature is activated with the first |\babelposthyphenation| or
\New{3.85} Enables and disables the transform with the given label in
the current language.
+\subsection{Support for \xetex{} interchar}
+
+\New{3.97} A few macros are provided to deal with locale dependent
+inter-character rules (aka ‘interchar’).
+
+\Describe{\babelcharclass}{\marg{locale}\marg{name}\marg{char-list}}
+
+Declares a new character class, which is assigned to the characters in
+\marg{char-list}, entered either as characters or in macro form
+(eg,~|\}|). If you need to enter them by their numeric value, use the
+\TeX{} |^|-notation (eg,~|^^^^1fa0|). Ranges are allowed, with a
+hyphen (eg,~|.,;a-zA-Z|). If you need the hyphen to be assigned a
+class, write it at the very beginning of the list.
+
+There are several predefined ‘global’ classes, namely
+|default|, |cjkideogram|, |cjkleftpunctuation|, |cjkrightpunctuation|,
+|boundary|, and |ignore|, which are described in the \xetex{} manual
+(currently CJK classes are ‘empty’, but they will be assigned in a
+future release).
+
+\Describe{\babelinterchar}{\oarg{options}\marg{locale}
+ \marg{class-first}\marg{class-second}\marg{code}}
+
+\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
+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|.
+
+\Describe{\enablelocaleinterchar}{\marg{label}}
+\DescribeOther{\disablelocaleinterchar}{\marg{label}}
+
+Enable or disable the interchar rules with the given label for the
+current language.
+
+\begin{example}
+ Not very useful, but illustrative (taken from the unfortunately
+ obsolete \textsf{interchar} package, by Zou Ho), to colorize the
+ letters ‘x’ and ‘y’ (this way to group text is usually not a
+ good idea, however).
+\begin{verbatim}
+\usepackage{color}
+\babelcharclass{english}{colored}{xy}
+\babelinterchar{english}{default, boundary}{colored}{\bgroup\color{red}}
+\babelinterchar{english}{colored}{default, boundary}{\egroup}
+\end{verbatim}
+ A more realistic example follows, which inserts a thin space
+ between a digit and a percent sign. Note the former is entered as a
+ range, and the latter in command form:
+\begin{verbatim}
+\babelcharclass{english}{digit}{0-9}
+\babelcharclass{english}{percent}{\%}
+\babelinterchar[label=percent]{english}{digit}{percent}{\,}
+\end{verbatim}
+\end{example}
+
+\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
+ 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,
+ however, must be large enough for many uses).
+\end{warning}
+
\subsection{Selection based on BCP 47 tags}
\label{bcp47}
@@ -4462,7 +4529,7 @@ ibygreek, bgreek, serbianc, frenchle, ethiop} and \textsf{friulan}.
(\textsf{portuguese}), \textsf{brazil} (\textsf{brazilian}),
\textsf{russianb} (\textsf{russian}), \textsf{usorbian}
(\textsf{uppersorbian}), \textsf{vietnam} (\textsf{vietnamese}),
- \textsf{northernsami} (\textsf{samin}), \textsf{ukraineb}
+ \textsf{samin} (\textsf{northernsami}), \textsf{ukraineb}
(\textsf{ukrainian}). Deprecated names come in many cases from the
times when they had to be shortened to 8 characters.
\end{note}
@@ -5563,8 +5630,8 @@ wouldn’t exist.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.96>>
-%<<date=2023/10/25>>
+%<<version=3.97>>
+%<<date=2023/11/11>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5757,7 +5824,7 @@ wouldn’t exist.
\bbl@trim{\expandafter\bbl@kvcmd\expandafter{\bbl@forkv@a}}{#2}{#4}}
% \end{macrocode}
%
-% A \textit{for} loop. Each item (trimmed), is |#1|. It cannot be
+% A \textit{for} loop. Each item (trimmed) is |#1|. It cannot be
% nested (it's doable, but we don't need it).
%
% \begin{macrocode}
@@ -13626,9 +13693,9 @@ wouldn’t exist.
%
% \subsection{XeTeX}
%
-% Unfortunately, the current encoding cannot be retrieved and
-% therefore it is reset always to |utf8|, which seems a sensible
-% default.
+% Unfortunately, the current encoding cannot be retrieved and
+% therefore it is reset always to |utf8|, which seems a sensible
+% default.
%
% \begin{macrocode}
%<<*Footnote changes>>
@@ -13747,6 +13814,145 @@ wouldn’t exist.
\DisableBabelHook{babel-fontspec}
<@Font selection@>
\def\bbl@provide@extra#1{}
+% \end{macrocode}
+%
+% \section{Support for interchar}
+%
+% \xetex{} reserves some values for CJK (although they are not set in
+% \textsc{xelatex}), so we make sure they are skipped. Define some user
+% names for the global classes, too.
+%
+% \begin{macrocode}
+\ifnum\xe@alloc@intercharclass<\thr@@
+ \xe@alloc@intercharclass\thr@@
+\fi
+\chardef\bbl@xeclass@default@=\z@
+\chardef\bbl@xeclass@cjkideogram@=\@ne
+\chardef\bbl@xeclass@cjkleftpunctuation@=\tw@
+\chardef\bbl@xeclass@cjkrightpunctuation@=\thr@@
+\chardef\bbl@xeclass@boundary@=4095
+\chardef\bbl@xeclass@ignore@=4096
+% \end{macrocode}
+%
+% The machinery is activated with a hook (enabled only if actually
+% used). Here |\bbl@tempc| is pre-set with |\bbl@usingxeclass|, defined
+% below. The standard mechanism based on |\originalTeX| to save, set
+% and restore values is used. |\count@| stores the previous char to be
+% set, except at the beginning (0) and after |\bbl@upto|, which is the
+% previous char negated, as a flag to mark a range.
+%
+% \begin{macrocode}
+\AddBabelHook{babel-interchar}{beforeextras}{%
+ \@nameuse{bbl@xechars@\languagename}}
+\DisableBabelHook{babel-interchar}
+\protected\def\bbl@charclass#1{%
+ \ifnum\count@<\z@
+ \count@-\count@
+ \loop
+ \bbl@exp{%
+ \\\babel@savevariable{\XeTeXcharclass`\Uchar\count@}}%
+ \XeTeXcharclass\count@ \bbl@tempc
+ \ifnum\count@<`#1\relax
+ \advance\count@\@ne
+ \repeat
+ \else
+ \babel@savevariable{\XeTeXcharclass`#1}%
+ \XeTeXcharclass`#1 \bbl@tempc
+ \fi
+ \count@`#1\relax}
+% \end{macrocode}
+%
+% Now the two user macros. Char classes are declared implicitly, and
+% then the macro to be executed at the |babel-interchar| hook is
+% created. The list of chars to be handled by the hook defined above
+% has internally the form
+% |\bbl@usingxeclass\bbl@xeclass@punct@english||\bbl@charclass{.}|%
+% |\bbl@charclass{,}| (etc.), where |\bbl@usingxeclass| stores the class to be
+% applied to the subsequent characters. The \cs{ifcat} part deals with
+% the alternative way to enter characters as macros (eg, |\}|). As a
+% special case, hyphens are stored as |\bbl@upto|, to deal with ranges.
+%
+% \begin{macrocode}
+\newcommand\babelcharclass[3]{%
+ \EnableBabelHook{babel-interchar}%
+ \bbl@csarg\newXeTeXintercharclass{xeclass@#2@#1}%
+ \def\bbl@tempb##1{%
+ \ifx##1\@empty\else
+ \ifx##1-%
+ \bbl@upto
+ \else
+ \bbl@charclass{%
+ \ifcat\noexpand##1\relax\bbl@stripslash##1\else\string##1\fi}%
+ \fi
+ \expandafter\bbl@tempb
+ \fi}%
+ \bbl@ifunset{bbl@xechars@#1}%
+ {\toks@{%
+ \babel@savevariable\XeTeXinterchartokenstate
+ \XeTeXinterchartokenstate\@ne
+ }}%
+ {\toks@\expandafter\expandafter\expandafter{%
+ \csname bbl@xechars@#1\endcsname}}%
+ \bbl@csarg\edef{xechars@#1}{%
+ \the\toks@
+ \bbl@usingxeclass\csname bbl@xeclass@#2@#1\endcsname
+ \bbl@tempb#3\@empty}}
+\protected\def\bbl@usingxeclass#1{\count@\z@ \let\bbl@tempc#1}
+\protected\def\bbl@upto{%
+ \ifnum\count@>\z@
+ \advance\count@\@ne
+ \count@-\count@
+ \else\ifnum\count@=\z@
+ \bbl@charclass{-}%
+ \else
+ \bbl@error{Double hyphens aren't allowed in \string\babelcharclass\\%
+ because it's potentially ambiguous}%
+ {See the manual for further info}%
+ \fi\fi}
+% \end{macrocode}
+%
+% And finally, the command with the code to be inserted. If the language
+% doesn’t define a class, then use the global one, as defined above.
+% For the definition there is a intermediate macro, which can be
+% ‘disabled’ with |\bbl@ic@<label>@<lang>|.
+%
+% \begin{macrocode}
+\newcommand\babelinterchar[5][]{%
+ \let\bbl@kv@label\@empty
+ \bbl@forkv{#1}{\bbl@csarg\edef{kv@##1}{##2}}%
+ \@namedef{\zap@space bbl@xeinter@\bbl@kv@label @#3@#4@#2 \@empty}%
+ {\ifnum\language=\l@nohyphenation
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {#5}}%
+ \bbl@csarg\let{ic@\bbl@kv@label @#2}\@firstofone
+ \bbl@exp{\\\bbl@for\\\bbl@tempa{\zap@space#3 \@empty}}{%
+ \bbl@exp{\\\bbl@for\\\bbl@tempb{\zap@space#4 \@empty}}{%
+ \XeTeXinterchartoks
+ \@nameuse{bbl@xeclass@\bbl@tempa @%
+ \bbl@ifunset{bbl@xeclass@\bbl@tempa @#2}{}{#2}}
+ \@nameuse{bbl@xeclass@\bbl@tempb @%
+ \bbl@ifunset{bbl@xeclass@\bbl@tempb @#2}{}{#2}}
+ = \expandafter{%
+ \csname bbl@ic@\bbl@kv@label @#2\expandafter\endcsname
+ \csname\zap@space bbl@xeinter@\bbl@kv@label
+ @#3@#4@#2 \@empty\endcsname}}}}
+\DeclareRobustCommand\enablelocaleinterchar[1]{%
+ \bbl@ifunset{bbl@ic@#1@\languagename}%
+ {\bbl@error
+ {'#1' for '\languagename' cannot be enabled.\\%
+ Maybe there is a typo.}%
+ {See the manual for further details.}}%
+ {\bbl@csarg\let{ic@#1@\languagename}\@firstofone}}
+\DeclareRobustCommand\disablelocaleinterchar[1]{%
+ \bbl@ifunset{bbl@ic@#1@\languagename}%
+ {\bbl@error
+ {'#1' for '\languagename' cannot be disabled.\\%
+ Maybe there is a typo.}%
+ {See the manual for further details.}}%
+ {\bbl@csarg\let{ic@#1@\languagename}\@gobble}}
%</xetex>
% \end{macrocode}
%
@@ -14227,7 +14433,7 @@ wouldn’t exist.
end
}
\endgroup
-\ifx\newattribute\@undefined\else
+\ifx\newattribute\@undefined\else % Test for plain
\newattribute\bbl@attr@locale
\directlua{ Babel.attr_locale = luatexbase.registernumber'bbl@attr@locale' }
\AddBabelHook{luatex}{beforeextras}{%
@@ -14779,7 +14985,7 @@ function Babel.arabic.justify_hlist(head, line, gc, size, pack)
width = node.dimensions(line.head) % The 'natural' width
k_curr = #k_list % Traverse backwards, from the end
wt_pos = 1
-
+
while width < goal do
subst_done = true
k_item = k_list[k_curr].node
@@ -15007,14 +15213,14 @@ end
\else
\bbl@error{\string\babelcharproperty\space can be used only in\\%
vertical mode (preamble or between paragraphs)}%
- {See the manual for futher info}%
+ {See the manual for further info}%
\fi}
\newcommand\bbl@chprop[3][\the\count@]{%
\@tempcnta=#1\relax
\bbl@ifunset{bbl@chprop@#2}%
{\bbl@error{No property named '#2'. Allowed values are\\%
direction (bc), mirror (bmg), and linebreak (lb)}%
- {See the manual for futher info}}%
+ {See the manual for further info}}%
{}%
\loop
\bbl@cs{chprop@#2}{#3}%
diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins
index b08918afa20..b47775f1173 100644
--- a/Master/texmf-dist/source/latex/babel/babel.ins
+++ b/Master/texmf-dist/source/latex/babel/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/10/25}
+\def\filedate{2023/11/11}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx
index e534dab18fc..61e273e2f5a 100644
--- a/Master/texmf-dist/source/latex/babel/bbcompat.dtx
+++ b/Master/texmf-dist/source/latex/babel/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2023/10/25 v3.96]
+\ProvidesFile{bbcompat.dtx}[2023/11/11 v3.97]
%</dtx>
%
%% File 'bbcompat.dtx'
diff --git a/Master/texmf-dist/source/latex/babel/locale.zip b/Master/texmf-dist/source/latex/babel/locale.zip
index 1e3c1a842c1..0c241c10289 100644
--- a/Master/texmf-dist/source/latex/babel/locale.zip
+++ b/Master/texmf-dist/source/latex/babel/locale.zip
Binary files differ