summaryrefslogtreecommitdiff
path: root/macros/latex/required/babel/base/babel.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-02 03:03:35 +0000
committerNorbert Preining <norbert@preining.info>2020-09-02 03:03:35 +0000
commit66aedee32b96d68acc7b854602552c75ef261973 (patch)
treee2695c9462f5e3202dd827cea9648463f933b80e /macros/latex/required/babel/base/babel.dtx
parenta9726d029d99c128a7abb22e73074ba0a1ce838e (diff)
CTAN sync 202009020303
Diffstat (limited to 'macros/latex/required/babel/base/babel.dtx')
-rw-r--r--macros/latex/required/babel/base/babel.dtx424
1 files changed, 317 insertions, 107 deletions
diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx
index acc0b3953c..51153eb550 100644
--- a/macros/latex/required/babel/base/babel.dtx
+++ b/macros/latex/required/babel/base/babel.dtx
@@ -31,7 +31,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2020/07/13 v3.47 The Babel package]
+\ProvidesFile{babel.dtx}[2020/09/01 v3.48 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -79,7 +79,7 @@
\usepackage{framed}
\usepackage{multicol}
\usepackage{color,colortbl}
-\usepackage[linkbordercolor={.9 .7 .5}]{hyperref}
+\usepackage[linkcolor=blue,urlcolor=blue,colorlinks=true]{hyperref}
\newcommand\New[1]{%
\colorbox[rgb]{.92, .86, .73}{New #1}\enspace\ignorespaces}
\definecolor{thered} {rgb}{0.65,0.04,0.07}
@@ -234,35 +234,51 @@ Xe\largetex
\part{User guide}
-\begin{itemize}
-\item This user guide focuses on internationalization and localization
- with \LaTeX. There are also some notes on its use with Plain \TeX.
-
-\item 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
+\begin{description}
+\item[\sffamily\color{messages}What is this document about?] This user
+guide focuses on internationalization and localization with \LaTeX{}
+and \pdftex, \xetex{} and \luatex{} with the \babel{} package. There are
+also some notes on its use with Plain \TeX. Part II describes the code,
+and usually it can be ignored.
+
+\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://github.com/latex3/babel/wiki}{the \babel{} wiki}. The
- most recent features could be still unstable. Please, report any
- issues you find in
- \href{https://github.com/latex3/babel/issues}{GitHub}, which is
- better than just complaining on an e-mail list or a web forum.
-
-\item If you are interested in the \TeX{} multilingual support, please
- join the \href{http://tug.org/mailman/listinfo/kadingira}{kadingira
- mail list}. You can follow the development of \babel{} in
- \href{https://github.com/latex3/babel}{GitHub} (which provides many
+ 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
+\href{http://tug.org/mailman/listinfo/kadingira}{kadingira mail list}.
+You can follow the development of \babel{} in
+\href{https://github.com/latex3/babel}{GitHub} and make suggestions; feel
+free to fork it and make pull requests. If you are the author of a
+package, send to me a few test files which I'll add to mine, so that
+possible issues can be caught in the development phase.
+
+\item[\sffamily\color{messages}It doesn't work for me!] You can ask for
+help in some forums like \textsf{tex.stackexchange}, but if you have
+found a bug, I strongly beg you to report it in
+\href{https://github.com/latex3/babel/issues}{GitHub}, which is much
+better than just complaining on an e-mail list or a web forum.
+
+\item[\sffamily\color{messages}How can I contribute a new
+language?] See section \ref{contribute} for contributing a language.
+
+\item[\sffamily\color{messages}I only need learn the most basic
+features.] The first subsections (1.1-1.3) describe the traditional way
+of loading a language (with |ldf| files), which is usually all you need.
+The alternative way based on |ini| files, which complements the
+previous one (it does \textit{not} replace it, although it is still
+necessary in some languages), is described below; go to \ref{inifiles}.
+
+\item[\sffamily\color{messages}I don’t like manuals. I prefer sample
+ files.] This manual contains lots of examples and tips, but in GitHub
+ there are many
\href{https://github.com/latex3/babel/tree/master/samples}{sample
- files}, too). If you are the author of a package, feel free to send
- to me a few test files which I'll add to mine, so that possible
- issues could be caught in the development phase.
-
-\item See section \ref{contribute} for contributing a language.
-
-\item The first sections describe the traditional way of loading a
- language (with |ldf| files). The alternative way based on |ini|
- files, which complements the previous one (it does \textit{not}
- replace it), is described below.
-\end{itemize}
+ files}.
+\end{description}
\section{The user interface}\label{U-I}
@@ -335,7 +351,7 @@ _\usepackage[russian]{babel}_
\trouble{Paragraph ended before \textbackslash UTFviii@three@octets
was complete}
A common source of trouble is a wrong setting of the input encoding.
-Depending on the \LaTeX{} version you could get the following somewhat
+Depending on the \LaTeX{} version you can get the following somewhat
cryptic error:
\begin{verbatim}
! Paragraph ended before \UTFviii@three@octets was complete.
@@ -428,7 +444,7 @@ Examples of cases where |main| is useful are the following.
\begin{note}
Some classes load \babel{} with a hardcoded language option. Sometimes,
-the main language could be overridden with something like that before
+the main language can be overridden with something like that before
|\documentclass|:
\begin{verbatim}
\PassOptionsToPackage{main=english}{babel}
@@ -506,6 +522,11 @@ _\usepackage[vietnamese,danish]{babel}_
\end{verbatim}
\end{example}
+\begin{note}
+ Once loaded a language, you can select it with the corresponding
+ BCP47 tag. See section \ref{bcp47} for further details.
+\end{note}
+
\subsection{Mostly monolingual documents}
\New{3.39} Very often, multilingual documents consist of a main
@@ -519,8 +540,8 @@ also when provided in the optional argument of |\babelfont|, if used.)
This is particularly useful, too, when there are short texts of this
kind coming from an external source whose contents are not known on
beforehand (for example, titles in a bibliography). At this regard, it
-is worth remembering that |\babelfont| does not load any font until
-required, so that it can be used just in case.
+is worth remembering that |\babelfont| does \textit{not} load any font
+until required, so that it can be used just in case.
\begin{example}
A trivial document is:
@@ -540,6 +561,13 @@ English. \foreignlanguage{russian}{Русский}.
\end{verbatim}
\end{example}
+\begin{note}
+ Instead of its name, you may prefer to select the language with the
+corresponding BCP47 tag. This alternative, however, must be activated
+explicitly, because a two- or tree-letter word is a valid name for a
+language (eg, |yi|). See section \ref{bcp47} for further details.
+\end{note}
+
\subsection{Modifiers}
\New{3.9c} The basic behavior of some languages can be modified when
@@ -933,7 +961,7 @@ system shorthands. Language-dependent user shorthands (new in
\begin{example}
Let's assume you want a unified set of shorthand for discretionaries
(languages do not define shorthands consistently, and |"-|, |\-|,
- |"=| have different meanings). You could start with, say:
+ |"=| have different meanings). You can start with, say:
\begin{verbatim}
\useshorthands*{"}
\defineshorthand{"*}{\babelhyphen{soft}}
@@ -941,7 +969,7 @@ system shorthands. Language-dependent user shorthands (new in
\end{verbatim}
However, the behavior of hyphens is language-dependent. For example, in
languages like Polish and Portuguese, a hard hyphen inside compound
- words are repeated at the beginning of the next line. You could then
+ words are repeated at the beginning of the next line. You can then
set:
\begin{verbatim}
\defineshorthand[*polish,*portuguese]{"-}{\babelhyphen{repeat}}
@@ -1256,6 +1284,7 @@ be the same as the option name as set in |\usepackage|!).
\end{warning}
\subsection{\texttt{ini} files}
+\label{inifiles}
An alternative approach to define a language (or, more precisely, a
\textit{locale}) is by means of an \texttt{ini} file. Currently
@@ -1342,7 +1371,7 @@ need to set explicitly the script to either |deva| or |dev2|, eg:
hard-coded in \xetex). Lao seems to work, too, but there are no
patterns for the latter in \luatex{}. Khemer clusters are rendered
wrongly with the default renderer. The comment about Indic scripts
- and \textsf{lualatex} also applies here. Some quick patterns could
+ and \textsf{lualatex} also applies here. Some quick patterns can
help, with something similar to:
\begingroup
\setmonofont[Script=Lao,Scale=MatchLowercase]{DejaVu Sans Mono}
@@ -2107,7 +2136,7 @@ Svenska \foreignlanguage{hebrew}{@2עִבְרִית@0} svenska.
\end{verbatim}
\endgroup
-If on the other hand you have to resort to different fonts, you could
+If on the other hand you have to resort to different fonts, you can
replace the red line above with, say:
\setengine{luatex/xetex}
\begin{verbatim}
@@ -2161,7 +2190,7 @@ to select fonts in addition to the three basic families.
command, neither the script nor the language is passed. You must
add them by hand. This is by design, for several reasons —for
example, each font has its own set of features and a generic setting
- for several of them could be problematic, and also a “lower-level”
+ for several of them can be problematic, and also a “lower-level”
font selection is useful.
\end{note}
@@ -2188,7 +2217,7 @@ to select fonts in addition to the three basic families.
font 'FONT' with script 'SCRIPT' 'Default' language used instead'}.
\textbf{This is \textit{not} and error.} This warning is shown by
- \textsf{fontspec}, not by \babel. It could be irrelevant for English,
+ \textsf{fontspec}, not by \babel. It can be irrelevant for English,
but not for many other languages, including Urdu and Turkish. This is
a useful and harmless warning, and if everything is fine with your
document the best thing you can do is just to ignore it altogether.
@@ -2355,7 +2384,7 @@ 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 could
+the list of recognized languages above. So, the previous example can
be written:
\begin{verbatim}
\babelprovide[_import_]{hungarian}
@@ -2411,7 +2440,7 @@ languages.
\begin{verbatim}
\usepackage[italian, greek.polutonic]{babel}
\end{verbatim}
- But if, say, accents in Greek are not shown correctly, you could try:
+ But if, say, accents in Greek are not shown correctly, you can try:
\begin{verbatim}
\usepackage[italian]{babel}
\babelprovide[import, main]{polytonicgreek}
@@ -2458,7 +2487,7 @@ with |mapfont|. Characters can be added with |\babelcharproperty|.
An alternative approach with \luatex{} and Harfbuzz is the font
option |RawFeature={multiscript=auto}|. It does not switch the
\babel{} language and therefore the line breaking rules, but in many
- cases it could be enough.
+ cases it can be enough.
\end{note}
\Describe{mapfont=}{\texttt{direction}}
@@ -2559,6 +2588,11 @@ bidi and fonts are processed (ie, to the node list as generated by the
bidirectional behavior (unlike |Numbers=Arabic| in \textsf{fontspec},
which is not recommended).
+\begin{note}
+ With \xetex{} you can use the option |Mapping| when defining a
+ font.
+\end{note}
+
\New{4.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
@@ -2937,6 +2971,7 @@ additional replacement type with the key |string|.
\end{example}
\subsection{Selection based on BCP 47 tags}
+\label{bcp47}
\New{3.43} The recommended way to select languages is that described at
the beginning of this document. However, BCP 47 tags are becoming
@@ -2964,15 +2999,18 @@ Here is a minimal example:
\usepackage[danish]{babel}
-\babeladjust{ autoload.bcp47 = on }
+\babeladjust{
+ autoload.bcp47 = on,
+ autoload.bcp47.options = import
+}
\begin{document}
-\today
+Chapter in Danish: \chaptername.
-\selectlanguage{fr-CA}
+\selectlanguage{de-AT}
-\today
+\localedate{2020}{1}{30}
\end{document}
\end{verbatim}
@@ -3061,7 +3099,7 @@ to ensure most of the ASCII letters and symbols are the right ones.
No macros to select the writing direction are provided, either --
writing direction is intrinsic to each script and therefore it is best
-set by the language (which could be a dummy one). Furthermore, there
+set by the language (which can be a dummy one). Furthermore, there
are in fact two right-to-left modes, depending on the language, which
differ in the way `weak' numeric characters are ordered (eg, Arabic
\%123 \textit{vs} Hebrew 123\%).
@@ -3069,7 +3107,7 @@ differ in the way `weak' numeric characters are ordered (eg, Arabic
\begin{warning}
The current code for \textbf{text} in \luatex{} should be considered
essentially stable, but, of course, it is not bug-free and there
- could be improvements in the future, because setting bidi text has
+ can be improvements in the future, because setting bidi text has
many subtleties (see for example <https://www.w3.org/TR/html-bidi/>).
A basic stable version for other engines must wait. This applies to
text; there is a basic support for \textbf{graphical} elements,
@@ -3242,7 +3280,7 @@ required by all engines.
counters in general, as well as in \luatex{} with |bidi=default|;
required in \luatex{} for numeric footnote marks $>$9 with
|bidi=basic-r| (but \textit{not} with |bidi=basic|); note, however,
- it could depend on the counter format.
+ it can depend on the counter format.
With |counters|, |\arabic| is not only considered L text always (with
|\babelsublr|, see below), but also an ``isolated'' block which does
@@ -3335,7 +3373,7 @@ RTL A \foreignlanguage{english}{ltr text \thechapter{} and still ltr} RTL B
\Describe{\BabelPatchSection}{\marg{section-name}}
-Mainly for bidi text, but it could be useful in other cases.
+Mainly for bidi text, but it can be useful in other cases.
|\BabelPatchSection| and the corresponding option |layout=sectioning|
takes a more logical approach (at least in many cases) because it
applies the global language to the section format (including the
@@ -3631,7 +3669,7 @@ deactivate other related options (like paragraph direction with
\item If you use the document class \cls{book} \emph{and} you use
|\ref| inside the argument of |\chapter| (or just use |\ref| inside
|\MakeUppercase|), \LaTeX\ will keep complaining about an undefined
- label. To prevent such problems, you could revert to using
+ label. To prevent such problems, you can revert to using
uppercase labels, you can use |\lowercase{\ref{foo}}| inside the
argument of |\chapter|, or, if you will not use shorthands in
labels, set the |safe| option to |none| or |bib|.
@@ -3750,6 +3788,14 @@ version of |\foreignlanguage|).
For old an deprecated functions, see the wiki.
\medskip
+\textbf{Labels}
+
+\New{3.48} There is some work in progress for \babel{} to deal with
+labels, both with the relation to captions (chapters, part), and how
+counters are used to define them. It is still somewhat tentative
+because it is far from trivial -- see the wiki for further details.
+
+\medskip
\textbf{\string\babelprehyphenation}
\New{3.44} Note it is tentative, but the current behavior for glyphs
@@ -3831,7 +3877,7 @@ german hyphen.ger
With the previous settings, if the encoding when the language is
selected is |T1| then the patterns in \file{hyphenT1.ger} are
used, but otherwise use those in \file{hyphen.ger} (note the encoding
-could be set in |\extras|\m{lang}).
+can be set in |\extras|\m{lang}).
A typical error when using \babel{} is the following:
\begin{verbatim}
@@ -3924,10 +3970,17 @@ recommended.
\subsection{Guidelines for contributed languages}
\label{contribute}
-Now language files are “outsourced” and are located in a separate
-directory (\texttt{/macros/latex/contrib/babel-contrib}), so that they
-are contributed directly to CTAN (please, do not send to me language
-styles just to upload them to CTAN).
+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
+fields, sent it to me. Fell free to ask for help or to make feature
+requests.
+
+As to \texttt{ldf} files, now language files are “outsourced” and are
+located in a separate directory
+(\texttt{/macros/latex/contrib/babel-contrib}), so that they are
+contributed directly to CTAN (please, do not send to me language styles
+just to upload them to CTAN).
Of course, placing your style files in this directory is not mandatory,
but if you want to do it, here are a few guidelines.
@@ -3949,7 +4002,7 @@ but if you want to do it, here are a few guidelines.
own directory.
\end{itemize}
-The following page provides a starting point:
+The following page provides a starting point for \texttt{ldf} files:
\texttt{http://www.texnia.com/incubator.html}. See also
\texttt{https://github.com/latex3/babel/wiki/List-of-locale-templates}.
@@ -3992,11 +4045,11 @@ two parameters. For example:
\DescribeMacro{\providehyphenmins}
The macro |\providehyphenmins| should be used in the language
-definition files to set |\lefthyphenmin| and
-|\righthyphenmin|. This macro will check whether these parameters
-were provided by the hyphenation file before it takes any action.
-If these values have been already set, this command is ignored
-(currently, default pattern files do \textit{not} set them).
+definition files to set |\lefthyphenmin| and |\righthyphenmin|. This
+macro will check whether these parameters were provided by the
+hyphenation file before it takes any action. If these values have been
+already set, this command is ignored (currently, default pattern files
+do \textit{not} set them).
\DescribeMacro{\captions\langvar}
The macro |\captions|\langvar\ defines the macros that
@@ -4210,7 +4263,7 @@ instance, be used in adding instructions to a macro like
|\extrasenglish|.
Be careful when using this macro, because depending on the case the
-assignment could be either global (usually) or local (sometimes). That
+assignment can be either global (usually) or local (sometimes). That
does not seem very consistent, but this behavior is preserved for
backward compatibility. If you are using \pkg{etoolbox}, by Philipp
Lehman, consider using the tools provided by this package instead of
@@ -4438,7 +4491,7 @@ optional one. This command, unlike |\SetString|, is executed always
(even without |strings|), and it is intended for minor readjustments
only.
-For example, as |T1| is the default case mapping in \LaTeX, we could
+For example, as |T1| is the default case mapping in \LaTeX, we can
set for Turkish:
\begin{verbatim}
\StartBabelCommands{turkish}{}[ot1enc, fontenc=OT1]
@@ -4522,7 +4575,7 @@ corresponding place. A selective list follows:
selected.
\item |'| (with |activeacute|) had the original value when writing to an
- auxiliary file, and things like an infinite loop could happen. It
+ auxiliary file, and things like an infinite loop can happen. It
worked incorrectly with |^| (if activated) and also if deactivated.
\item Active chars where not reset at the end of language options, and
@@ -4691,8 +4744,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.47>>
-%<<date=2020/07/13>>
+%<<version=3.48>>
+%<<date=2020/09/01>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5122,7 +5175,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@warning{%
Some functions for '#1' are tentative.\\%
They might not work as expected and their behavior\\%
- could change in the future.\\%
+ may change in the future.\\%
Reported}}
\def\@nolanerr#1{%
\bbl@error
@@ -5714,8 +5767,10 @@ help from Bernd Raichle, for which I am grateful.
\set@typeset@protect
\expandafter\select@language@x\expandafter{\bbl@main@language}%
\let\protect\noexpand
- \edef\thepage{% TODO. Only with bidi. See also above
- \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}}%
+ \ifcase\bbl@bidimode\else % Only with bidi. See also above
+ \edef\thepage{%
+ \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}%
+ \fi}%
\fi}
{\ifbbl@single\else
\bbl@ifunset{markright }\bbl@redefine\bbl@redefinerobust
@@ -5905,13 +5960,13 @@ help from Bernd Raichle, for which I am grateful.
% but it broke bookmarks. This was quickly fixed in \pkg{hyperref},
% which essentially made it no-op. However, it will not removed for
% the moment because \pkg{hyperref} is expecting it. TODO. Still
-% true?
+% true? Commented out in 2020/07/27.
%
% \begin{macrocode}
-\AtBeginDocument{%
- \ifx\pdfstringdefDisableCommands\@undefined\else
- \pdfstringdefDisableCommands{\languageshorthands{system}}%
- \fi}
+% \AtBeginDocument{%
+% \ifx\pdfstringdefDisableCommands\@undefined\else
+% \pdfstringdefDisableCommands{\languageshorthands{system}}%
+% \fi}
% \end{macrocode}
%
% \end{macro}
@@ -7018,11 +7073,12 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macro}{\bbl@pop@lang}
% This macro stores its first element (which is delimited by the
% `+'-sign) in |\languagename| and stores the rest of the string
-% (delimited by `-') in its third argument.
+% in |\bbl@language@stack|.
%
% \begin{macrocode}
-\def\bbl@pop@lang#1+#2&#3{%
- \edef\languagename{#1}\xdef#3{#2}}
+\def\bbl@pop@lang#1+#2\@@{%
+ \edef\languagename{#1}%
+ \xdef\bbl@language@stack{#2}}
% \end{macrocode}
%
% \end{macro}
@@ -7033,13 +7089,12 @@ help from Bernd Raichle, for which I am grateful.
% result of that is that the argument string of |\bbl@pop@lang|
% contains one or more language names, each followed by a `+'-sign
% (zero language names won't occur as this macro will only be
-% called after something has been pushed on the stack) followed by
-% the `\&'-sign and finally the reference to the stack.
+% called after something has been pushed on the stack).
%
% \begin{macrocode}
\let\bbl@ifrestoring\@secondoftwo
\def\bbl@pop@language{%
- \expandafter\bbl@pop@lang\bbl@language@stack&\bbl@language@stack
+ \expandafter\bbl@pop@lang\bbl@language@stack\@@
\let\bbl@ifrestoring\@firstoftwo
\expandafter\bbl@set@language\expandafter{\languagename}%
\let\bbl@ifrestoring\@secondoftwo}
@@ -7226,13 +7281,13 @@ help from Bernd Raichle, for which I am grateful.
% set the locale id
\bbl@id@assign
% switch captions, date
- \ifcase\bbl@select@type
- \bbl@bsphack
+ % No text is supposed to be added here, so we remove any
+ % spurious spaces.
+ \bbl@bsphack
+ \ifcase\bbl@select@type
\csname captions#1\endcsname\relax
\csname date#1\endcsname\relax
- \bbl@esphack
- \else
- \bbl@bsphack
+ \else
\bbl@xin@{,captions,}{,\bbl@select@opts,}%
\ifin@
\csname captions#1\endcsname\relax
@@ -7241,8 +7296,8 @@ help from Bernd Raichle, for which I am grateful.
\ifin@ % if \foreign... within \<lang>date
\csname date#1\endcsname\relax
\fi
- \bbl@esphack
- \fi
+ \fi
+ \bbl@esphack
% switch extras
\bbl@usehooks{beforeextras}{}%
\csname extras#1\endcsname\relax
@@ -8817,7 +8872,7 @@ help from Bernd Raichle, for which I am grateful.
{\bbl@putsh@i#1\@empty\@nnil}%
{\csname bbl@active@\string#1\endcsname}}
\def\bbl@putsh@i#1#2\@nnil{%
- \csname\languagename @sh@\string#1@%
+ \csname\language@group @sh@\string#1@%
\ifx\@empty#2\else\string#2@\fi\endcsname}
\ifx\bbl@opt@shorthands\@nnil\else
\let\bbl@s@initiate@active@char\initiate@active@char
@@ -10213,8 +10268,6 @@ help from Bernd Raichle, for which I am grateful.
%
% \subsection{Layout}
%
-% \textbf{Work in progress}.
-%
% Layout is mainly intended to set bidi documents, but there is at
% least a tool useful in general.
%
@@ -10336,7 +10389,11 @@ help from Bernd Raichle, for which I am grateful.
{Use this macro as documented}}%
{\bbl@provide@renew{#2}}}%
% Post tasks
- \bbl@exp{\\\babelensure[exclude=\\\today]{#2}}%
+ \bbl@ifunset{bbl@extracaps@#2}%
+ {\bbl@exp{\\\babelensure[exclude=\\\today]{#2}}}%
+ {\toks@\expandafter\expandafter\expandafter
+ {\csname bbl@extracaps@#2\endcsname}%
+ \bbl@exp{\\\babelensure[exclude=\\\today,include=\the\toks@}]{#2}}%
\bbl@ifunset{bbl@ensure@\languagename}%
{\bbl@exp{%
\\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{%
@@ -11002,16 +11059,169 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macrocode}
\def\bbl@ini@captions@aux#1#2{%
\bbl@trim@def\bbl@tempa{#1}%
- \bbl@ifblank{#2}%
- {\bbl@exp{%
- \toks@{\\\bbl@nocaption{\bbl@tempa}{\languagename\bbl@tempa name}}}}%
- {\bbl@trim\toks@{#2}}%
- \bbl@exp{%
- \\\bbl@add\\\bbl@savestrings{%
- \\\SetString\<\bbl@tempa name>{\the\toks@}}}}
+ \bbl@xin@{.template}{\bbl@tempa}%
+ \ifin@
+ \bbl@replace\bbl@tempa{.template}{}%
+ \def\bbl@toreplace{#2}%
+ \bbl@replace\bbl@toreplace{[ ]}{\nobreakspace{}}%
+ \bbl@replace\bbl@toreplace{[[}{\csname}%
+ \bbl@replace\bbl@toreplace{[}{\csname the}%
+ \bbl@replace\bbl@toreplace{]]}{name\endcsname{}}%
+ \bbl@replace\bbl@toreplace{]}{\endcsname{}}%
+ \bbl@xin@{,\bbl@tempa,}{,chapter,}%
+ \ifin@
+ \bbl@patchchapter
+ \global\bbl@csarg\let{chapfmt@\languagename}\bbl@toreplace
+ \fi
+ \bbl@xin@{,\bbl@tempa,}{,appendix,}%
+ \ifin@
+ \bbl@patchchapter
+ \global\bbl@csarg\let{appxfmt@\languagename}\bbl@toreplace
+ \fi
+ \bbl@xin@{,\bbl@tempa,}{,part,}%
+ \ifin@
+ \bbl@patchpart
+ \global\bbl@csarg\let{partfmt@\languagename}\bbl@toreplace
+ \fi
+ \bbl@xin@{,\bbl@tempa,}{,figure,table,}%
+ \ifin@
+ \toks@\expandafter{\bbl@toreplace}%
+ \bbl@exp{\gdef\<fnum@\bbl@tempa>{\the\toks@}}%
+ \fi
+ \else
+ \bbl@ifblank{#2}%
+ {\bbl@exp{%
+ \toks@{\\\bbl@nocaption{\bbl@tempa}{\languagename\bbl@tempa name}}}}%
+ {\bbl@trim\toks@{#2}}%
+ \bbl@exp{%
+ \\\bbl@add\\\bbl@savestrings{%
+ \\\SetString\<\bbl@tempa name>{\the\toks@}}}%
+ \toks@\expandafter{\bbl@captionslist}%
+ \bbl@exp{\\\in@{\<\bbl@tempa name>}{\the\toks@}}%
+ \ifin@\else
+ \bbl@exp{%
+ \\\bbl@add\<bbl@extracaps@\languagename>{\<\bbl@tempa name>}%
+ \\\bbl@toglobal\<bbl@extracaps@\languagename>}%
+ \fi
+ \fi}
+% \end{macrocode}
+%
+% \textbf{Labels.} Captions must contain just strings, no
+% format at all, so there is new group in ini files.
+%
+% \begin{macrocode}
+\def\bbl@list@the{%
+ part,chapter,section,subsection,subsubsection,paragraph,%
+ subparagraph,enumi,enumii,enumiii,enumiv,equation,figure,%
+ table,page,footnote,mpfootnote,mpfn}
+\def\bbl@map@cnt#1{% #1:roman,etc, // #2:enumi,etc
+ \bbl@ifunset{bbl@map@#1@\languagename}%
+ {\@nameuse{#1}}%
+ {\@nameuse{bbl@map@#1@\languagename}}}
+\def\bbl@inikv@labels#1=#2\@@{%
+ \in@{.map}{#1}%
+ \ifin@
+ \ifx\bbl@KVP@labels\@nil\else
+ \bbl@xin@{ map }{ \bbl@KVP@labels\space}%
+ \ifin@
+ \def\bbl@tempc{#1}%
+ \bbl@replace\bbl@tempc{.map}{}%
+ \in@{,#2,}{,arabic,roman,Roman,alph,Alph,fnsymbol,}%
+ \bbl@exp{%
+ \gdef\<bbl@map@\bbl@tempc @\languagename>%
+ {\ifin@\<#2>\else\\\localecounter{#2}\fi}}%
+ \bbl@foreach\bbl@list@the{%
+ \bbl@ifunset{the##1}{}%
+ {\bbl@exp{\let\\\bbl@tempd\<the##1>}%
+ \bbl@exp{%
+ \\\bbl@sreplace\<the##1>%
+ {\<\bbl@tempc>{##1}}{\\\bbl@map@cnt{\bbl@tempc}{##1}}%
+ \\\bbl@sreplace\<the##1>%
+ {\<\@empty @\bbl@tempc>\<c@##1>}{\\\bbl@map@cnt{\bbl@tempc}{##1}}}%
+ \expandafter\ifx\csname the##1\endcsname\bbl@tempd\else
+ \toks@\expandafter\expandafter\expandafter{%
+ \csname the##1\endcsname}%
+ \expandafter\xdef\csname the##1\endcsname{{\the\toks@}}%
+ \fi}}%
+ \fi
+ \fi
+ %
+ \else
+ %
+ % The following code is still under study. You can test it and make
+ % suggestions. Eg, enumerate.2 = ([enumi]).([enumii]). It's
+ % language dependent.
+ \in@{enumerate.}{#1}%
+ \ifin@
+ \def\bbl@tempa{#1}%
+ \bbl@replace\bbl@tempa{enumerate.}{}%
+ \def\bbl@toreplace{#2}%
+ \bbl@replace\bbl@toreplace{[ ]}{\nobreakspace{}}%
+ \bbl@replace\bbl@toreplace{[}{\csname the}%
+ \bbl@replace\bbl@toreplace{]}{\endcsname{}}%
+ \toks@\expandafter{\bbl@toreplace}%
+ \bbl@exp{%
+ \\\bbl@add\<extras\languagename>{%
+ \\\babel@save\<labelenum\romannumeral\bbl@tempa>%
+ \def\<labelenum\romannumeral\bbl@tempa>{\the\toks@}}%
+ \\\bbl@toglobal\<extras\languagename>}%
+ \fi
+ \fi}
+% \end{macrocode}
+%
+% To show correctly some captions in a few languages, we need to patch
+% some internal macros, because the order is hardcoded. For example, in
+% Japanese the chapter number is surrounded by two string, while in
+% Hungarian is placed after. These replacement works in many classes,
+% but not all. Actually, the following lines are somewhat tentative.
+%
+% \begin{macrocode}
+\def\bbl@chaptype{chap}
+\ifx\@makechapterhead\@undefined
+ \let\bbl@patchchapter\relax
+\else\ifx\thechapter\@undefined
+ \let\bbl@patchchapter\relax
+\else\ifx\ps@headings\@undefined
+ \let\bbl@patchchapter\relax
+\else
+ \def\bbl@patchchapter{%
+ \global\let\bbl@patchchapter\relax
+ \bbl@add\appendix{\def\bbl@chaptype{appx}}% Not harmful, I hope
+ \bbl@toglobal\appendix
+ \bbl@sreplace\ps@headings
+ {\@chapapp\ \thechapter}%
+ {\bbl@chapterformat}%
+ \bbl@toglobal\ps@headings
+ \bbl@sreplace\chaptermark
+ {\@chapapp\ \thechapter}%
+ {\bbl@chapterformat}%
+ \bbl@toglobal\chaptermark
+ \bbl@sreplace\@makechapterhead
+ {\@chapapp\space\thechapter}%
+ {\bbl@chapterformat}%
+ \bbl@toglobal\@makechapterhead
+ \gdef\bbl@chapterformat{%
+ \bbl@ifunset{bbl@\bbl@chaptype fmt@\languagename}%
+ {\@chapapp\space\thechapter}
+ {\@nameuse{bbl@\bbl@chaptype fmt@\languagename}}}}
+\fi\fi\fi
+\ifx\@part\@undefined
+ \let\bbl@patchpart\relax
+\else
+ \def\bbl@patchpart{%
+ \global\let\bbl@patchpart\relax
+ \bbl@sreplace\@part
+ {\partname\nobreakspace\thepart}%
+ {\bbl@partformat}%
+ \bbl@toglobal\@part
+ \gdef\bbl@partformat{%
+ \bbl@ifunset{bbl@partfmt@\languagename}%
+ {\partname\nobreakspace\thepart}
+ {\@nameuse{bbl@partfmt@\languagename}}}}
+\fi
% \end{macrocode}
%
-% TODO. Document
+% \textbf{Date.} TODO. Document
%
% \begin{macrocode}
% Arguments are _not_ protected.
@@ -11082,9 +11292,9 @@ help from Bernd Raichle, for which I am grateful.
{}}}
% \end{macrocode}
%
-% Dates will require some macros for the basic formatting. They may be
-% redefined by language, so ``semi-public'' names (camel case) are
-% used. Oddly enough, the CLDR places particles like “de”
+% \textbf{Dates} will require some macros for the basic formatting.
+% They may be redefined by language, so ``semi-public'' names (camel
+% case) are used. Oddly enough, the CLDR places particles like “de”
% inconsistently in either in the date or in the month name.
%
% \begin{macrocode}
@@ -11174,12 +11384,12 @@ help from Bernd Raichle, for which I am grateful.
\else\iffontchar\font"200B
\hyphenchar\font"200B
\else
- \bbl@error
+ \bbl@warning
{Neither 0 nor ZERO WIDTH SPACE are available\\%
in the current font, and therefore the hyphen\\%
- will be printed. Try with 'HyphenChar', but be\\%
- aware this setting is not safe (see the manual).}%
- {See the manual.}%
+ will be printed. Try changing the fontspec's\\%
+ 'HyphenChar' to another value, but be aware\\%
+ this setting is not safe (see the manual)}%
\hyphenchar\font\defaulthyphenchar
\fi\fi
\fi}%