summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/babel
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-01-04 23:39:46 +0000
committerKarl Berry <karl@freefriends.org>2018-01-04 23:39:46 +0000
commit2c16907b492b353f234ae633ea24851c0f809242 (patch)
treea639e848a1f8919ef7529c405cb447c53ab2c389 /Master/texmf-dist/source/latex/babel
parentbb83d426056841b56f02baa144b334892a340fa6 (diff)
babel (4jan18)
git-svn-id: svn://tug.org/texlive/trunk@46210 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/babel')
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.dtx1154
-rw-r--r--Master/texmf-dist/source/latex/babel/babel.ins3
-rw-r--r--Master/texmf-dist/source/latex/babel/bbcompat.dtx7
-rw-r--r--Master/texmf-dist/source/latex/babel/locale.zipbin682708 -> 682821 bytes
4 files changed, 832 insertions, 332 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index 5f068ccd945..81656027379 100644
--- a/Master/texmf-dist/source/latex/babel/babel.dtx
+++ b/Master/texmf-dist/source/latex/babel/babel.dtx
@@ -31,13 +31,13 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2017/11/03 v3.15 The Babel package]
+\ProvidesFile{babel.dtx}[2018/01/04 v3.16 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
-\setmainfont[Scale=.89]{DejaVu Serif}
-\setsansfont[Scale=.87]{DejaVu Sans}
-\setmonofont[Scale=.87]{DejaVu Sans Mono}
+\setmainfont[Scale=.88]{Noto Serif}
+\setsansfont[Scale=.88]{Noto Sans}
+\setmonofont[Scale=.88,FakeStretch=.95]{Noto Mono}
\raggedright
\addtolength{\textwidth}{25pt}
\addtolength{\textheight}{3.5cm}
@@ -47,6 +47,7 @@
\newcommand*\babel{\textsf{babel}}
\newcommand*\Babel{\textsf{Babel}}
\newcommand*\xetex{\textsf{xetex}}
+\newcommand*\pdftex{\textsf{pdftex}}
\newcommand*\luatex{\textsf{luatex}}
\newcommand*\nb[1]{}
\newcommand*\m[1]{\mbox{$\langle$\normalfont\itshape#1\/$\rangle$}}
@@ -54,7 +55,7 @@
\meta{language}\texttt{,}\meta{language}\texttt{,}...}
\newcommand*\langvar{\m{lang}}
\newcommand*\Lopt[1]{\textsf{#1}}
-\newcommand*\Lenv[1]{\textsf{#1}}
+\newcommand*\Lenv[1]{\texttt{#1}}
\newcommand*\menv[1]{\char`\{#1\char`\}}
\newcommand*\Eenv[1]{%
\quad\ldots\quad
@@ -223,11 +224,23 @@ Javier Bezos
\part{User guide}
-This user guide focuses on \LaTeX. There are also some notes on its
-use with Plain \TeX.
+\begin{itemize}
+\item This user guide focuses on \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}. The most recent features
+ could be still unstable. Please, report any issues you find.
-If you are interested in the \TeX{} multilingual support, please join the
-\textsf{kadingira} list on \texttt{http://tug.org/mailman/listinfo/kadingira}.
+\item If you are interested in the \TeX{} multilingual support, please
+ join the \textsf{kadingira} list on
+ \texttt{http://tug.org/mailman/listinfo/kadingira}. You can follow
+ the development of \babel{} on
+ \texttt{https://github.com/latex3/latex2e/tree/master/required/babel}
+ (which provides some sample files, too).
+
+\item See section \ref{contribute} for contributing a language.
+\end{itemize}
\section{The user interface}\label{U-I}
@@ -381,7 +394,8 @@ With them you can use \babel{} to localize the documents.
The Latin script is covered by default in current \LaTeX{} (provided
the document encoding is UTF-8), because the font loader is preloaded
and the font is switched to |lmroman|. Other scripts require loading
-\textsf{fontspec}.
+\textsf{fontspec}. You may want to set the font attributes with
+\textsf{fontspec}, too.
\begin{example}
The following bilingual, single script document in UTF-8 encoding
@@ -492,7 +506,7 @@ In Plain, load languages styles with |\input| and then use
\subsection{Basic language selectors}
This section describes the commands to be used in the document to
-switch the language in multilingual document. In most cases, only the
+switch the language in multilingual documents. In most cases, only the
two basic macros |\selectlanguage| and |\foreignlanguage| are
necessary. The environments |otherlanguage|, |otherlanguage*| and
|hyphenrules| are auxiliary, and described in the next section.
@@ -1035,48 +1049,15 @@ can take the following values:
really useful, but who knows.}
\end{description}
-\Describe{bidi=}{\texttt{default} $\string|$ \texttt{basic-r}}
+\Describe{bidi=}{}
\New{3.14} Selects the bidi algorithm to be used in \luatex{} and
-\xetex{}. With |default| the bidi mechanism is just activated (by default
-it is not), but every change must by marked up. In \xetex{} this is
-the only option. In \luatex, |basic-r|, provides a simple and fast
-method for R text, which handles numbers and unmarked L text within an
-R context.
+\xetex{}. See sec.~\ref{bidi}.
-\begin{example}
-The following text comes from the Arabic Wikipedia (article about
-Arabia). Copy-pasting some text from the Wikipedia is a good way to
-test this feature, which will be improved in the future. Remember
-|basic-r| is available in \luatex{} only.
- \begingroup
-% If you are looking at the code to see how it has been written, you
-% will be disappointed :-). The following example is built ad hoc to
-% emulate the final result to avoid dependencies, and therefore it's
-% not "real" code.
-\setmonofont[Scale=.87,Script=Arabic]{DejaVu Sans Mono} \catcode`@=13
-\def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TLT \else
-\bgroup\textdir TRT \pardir TRT \fi}
-\begin{verbatim}
-\documentclass{article}
-
-\usepackage[nil, _bidi=basic-r_]{babel}
-
-_\babelprovide[import=ar, main]{arabic}_
-
-\babelfont{rm}{FreeSerif}
-
-\begin{document}
-
-@9وقد عرفت شبه جزيرة العرب طيلة العصر الهيليني )الاغريقي( بـ
-@1Arabia@0 أو @1Aravia@0 )بالاغريقية @1Αραβία@0(، استخدم الرومان ثلاث
-بادئات بـ@1“Arabia”@0 على ثلاث مناطق من شبه الجزيرة العربية، إلا أنها
-حقيقةً كانت أكبر مما تعرف عليه اليوم.
+\Describe{layout=}{}
-@0\end{document}
-\end{verbatim}
-\endgroup
-\end{example}
+\New{3.16} Selects which layout elements are adapted in bidi
+documents. See sec.~\ref{bidi}.
\subsection{The \texttt{base} option}
@@ -1229,6 +1210,11 @@ captions):
\tag{fi} Finnish\hascapu\hascapl
\tag{fil} Filipino
\tag{fo} Faroese
+\tag{fr} French\hascapu\hascapl
+\tag{fr-BE} French\hascapu\hascapl
+\tag{fr-CA} French\hascapu\hascapl
+\tag{fr-CH} French\hascapu\hascapl
+\tag{fr-LU} French\hascapu\hascapl
\tag{fur} Friulian\hascapu\hascapl
\tag{fy} Western Frisian
\tag{ga} Irish\hascapu\hascapl
@@ -1409,7 +1395,7 @@ captions):
\hrule
\bigskip
-In some context (currently |\babelfont|) an \textsc{ini} file may be
+In some contexts (currently |\babelfont|) an \texttt{ini} file may be
loaded by its name. Here is the list of the names currently
supported. With these languages, |\babelfont| loads (if not done
before) the language and script names (even if the language is defined
@@ -1734,9 +1720,10 @@ zulu
\subsection{Selecting fonts}
-\New{3.15} Babel provides a high level interface on top of |fontspec| to select
-fonts. There is no need to load \textsf{fontspec} explicitly --
-\babel{} does it for you with the first |\babelfont|.
+\New{3.15} Babel provides a high level interface on top of |fontspec|
+to select fonts. There is no need to load \textsf{fontspec} explicitly
+-- \babel{} does it for you with the first |\babelfont|.\footnote{See
+also the package \textsf{combofont} for a complementary approach.}
\Describe\babelfont{\oarg{language-list}\marg{font-family}%
\oarg{font-options}\marg{font-name}}
@@ -1752,7 +1739,7 @@ will be assigned to them, overriding the default. Alternatively, you
may set a font for a script -- just precede its name (lowercase) with
a star (eg, |*devanagari|).
-\Babel{} takes care the font language and the font script when
+\Babel{} takes care of the font language and the font script when
languages are selected (as well as the writing direction); see the
recognized languages above. In most cases, you will not need
\textit{font-options}, which is the same as in \textsf{fontspec}, but
@@ -1774,7 +1761,7 @@ Mono} \fi}
\begin{verbatim}
\documentclass{article}
-\usepackage[swedish]{babel}
+\usepackage[swedish, bidi=default]{babel}
\babelprovide[import=he]{hebrew}
@@ -1805,10 +1792,22 @@ to select fonts in addition to the three basic ones.
\begin{verbatim}
\babelfont{kai}{FandolKai}
\end{verbatim}
-Now, |\kaifamily| and |\kaidefault| are at your disposal.
+ Now, |\kaifamily| and |\kaidefault|, as well as |\textkai| are at
+ your disposal.
\end{example}
\begin{note}
+ You may load \textsf{fontspec} explicitly. For example:
+\begin{verbatim}
+\usepackage{fontspec}
+\newfontscript{Devanagari}{deva}
+\babelfont[hindi]{rm}{Shobhika}
+\end{verbatim}
+ This makes sure the OpenType script for Devanagari is |deva| and not
+ |dev2|.
+\end{note}
+
+\begin{note}
Directionality is a property affecting margins, intentation, column
order, etc., not just text. Therefore, it is under the direct
control of the language, which appplies both the script and the
@@ -1820,7 +1819,7 @@ Now, |\kaifamily| and |\kaidefault| are at your disposal.
\begin{note}
|\fontspec| is not touched at all, only the preset font families
(|rm|, |sf|, |tt|, and the like). If a language is switched when an
- \textit{ad hoc} font is active, or you select the font it with this
+ \textit{ad hoc} font is active, or you select the font with this
command, neither the script nor the language are 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
@@ -1945,8 +1944,8 @@ format (\textsf{hindi}, \textsf{french}, \textsf{breton}, and
Besides |\today|, there is a |\<language>date| macro with three
arguments: year, month and day numbers. In fact, |\today| calls
-|\<language>today| which in turn calls
-|\<language>date{\year}{\month}{\day}|.
+|\<language>today|, which in turn calls
+|\<language>date{\the\year}{\the\month}{\the\day}|.
\Describe{captions=}{\meta{language-tag}}
Loads only the strings. For example:
@@ -2024,90 +2023,6 @@ respectively.
\textsf{iflang} instead of |\iflanguage| if possible.
\end{warning}
-\subsection{Hooks}
-
-\New{3.9a} A hook is a piece of code to be executed at certain
-events. Some hooks are predefined when \luatex{} and \xetex{} are
-used.
-
-\Describe\AddBabelHook{\marg{name}\marg{event}\marg{code}}
-
-The same name can be applied to several events. Hooks may be enabled
-and disabled for all defined events with
-|\EnableBabelHook|\marg{name}, |\DisableBabelHook|\marg{name}. Names
-containing the string |babel| are reserved (they are used, for
-example, by |\useshortands*| to add a hook for the event
-|afterextras|).
-
-Current events are the following; in some of them you can use one to
-three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given:
-\begin{description}
-\renewcommand\makelabel[1]{%
- \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
-\itemsep=-\parskip
-\item[adddialect] (language name, dialect name) Used by
- \file{luababel.def} to load the patterns if not preloaded.
-\item[patterns] (language name, language with encoding) Executed just
- after the |\language| has been set. The second argument has the
- patterns name actually selected (in the form of either |lang:ENC| or
- |lang|).
-\item[hyphenation] (language name, language with encoding) Executed
- locally just before exceptions given in |\babelhyphenation| are
- actually set.
-\item[defaultcommands] Used (locally) in |\StartBabelCommands|.
-\item[encodedcommands] (input, font encodings) Used (locally) in
- |\StartBabelCommands|. Both \xetex{} and \luatex{} make sure the
- encoded text is read correctly.
-\item[stopcommands] Used to reset the the above, if necessary.
-\item[write] This event comes just after the switching commands are
- written to the |aux| file.
-\item[beforeextras] Just before executing |\extras|\m{language}. This
- event and the next one should not contain language-dependent code
- (for that, add it to |\extras|\m{language}).
-\item[afterextras] Just after executing |\extras|\m{language}. For
- example, the following deactivates shorthands in all languages:
-\begin{verbatim}
-\AddBabelHook{noshort}{afterextras}{\languageshorthands{none}}
-\end{verbatim}
-\item[stringprocess] Instead of a parameter, you can manipulate the
- macro |\BabelString| containing the string to be defined with
- |\SetString|. For example, to use an expanded version of the string
- in the definition, write:
-\begin{verbatim}
-\AddBabelHook{myhook}{stringprocess}{%
- \protected@edef\BabelString{\BabelString}}
-\end{verbatim}
-\item[initiateactive] (char as active, char as other, original char)
- \New{3.9i} Executed just after a shorthand has been `initiated'. The three
- parameters are the same character with different catcodes: active,
- other (|\string|'ed) and the original one.
-\item[afterreset] \New{3.9i} Executed when selecting a language just after
- |\originalTeX| is run and reset to its base value, before executing
- |\captions|\m{language} and |\date|\m{language}.
-\end{description}
-
-Four events are used in \file{hyphen.cfg}, which are handled in a
-quite different way for efficiency reasons -- unlike the precedent
-ones, they only have a single hook and replace a default definition.
-\begin{description}
-\renewcommand\makelabel[1]{%
- \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
-\itemsep=-\parskip
-\item[everylanguage] (language) Executed before every language patterns are loaded.
-\item[loadkernel] (file) By default loads |switch.def|. It can be used
- to load a different version of this files or to load nothing.
-\item[loadpatterns] (patterns file) Loads the patterns file. Used by
- \file{luababel.def}.
-\item[loadexceptions] (exceptions file) Loads the exceptions
- file. Used by \file{luababel.def}.
-\end{description}
-
-\Describe\BabelContentsFiles{}
-\New{3.9a} This macro contains a list of ``toc'' types which
-require a command to switch the language. Its default value is
-|toc,lof,lot|, but you may redefine it with |\renewcommand| (it's up
-to you to make sure no toc type is duplicated).
-
\subsection{Hyphenation tools}
\Describe\babelhyphen{%
@@ -2126,14 +2041,14 @@ with a breaking oportunity after it. A further type is a
oportunity.
In \TeX, \verb|-| and \verb|\-| forbid further breaking oportunities
-in the word. This is the desired behaviour very often, but not
-always, and therefore many languages provide shorthands for these
+in the word. This is the desired behaviour very often, but not always,
+and therefore many languages provide shorthands for these
cases. Unfortunately, this has not been done consistently: for
-example, in Dutch, Portugese, Catalan or Danish, \verb|"-| is a hard
-hyphen, while in German, Spanish, Norwegian, Slovak or Russian, it
-is a soft hyphen. Furthermore, some of them even redefine |\-|, so
-that you cannot insert a soft hyphen without breaking oportunities
-in the rest of the word.
+example, \verb|"-| in Dutch, Portugese, Catalan or Danish is a hard
+hyphen, while in German, Spanish, Norwegian, Slovak or Russian is a
+soft hyphen. Furthermore, some of them even redefine |\-|, so that you
+cannot insert a soft hyphen without breaking oportunities in the rest
+of the word.
Therefore, some macros are provide with a set of basic ``hyphens''
which can be used by themselves, to define a user shorthand, or even
@@ -2222,8 +2137,7 @@ incomplete.\footnote{The so-called Unicode fonts do not improve the
situation either. So, a font suited for Vietnamese is not necessarily
suited for, say, the romanization of Indic languages, and the fact it
contains glyphs for Modern Greek does not mean it includes them for
-Classic Greek. As to directionality, it poses special challenges
-because it also affects individual characters and layout elements.}
+Classic Greek.}
Some languages sharing the same script define macros to switch it (eg,
|\textcyrillic|), but be aware they may also set the language to a
@@ -2233,13 +2147,6 @@ fonts (for example, if the main latin encoding was |LY1|), and
therefore it has been deprecated.\footnote{But still defined for
backwards compatibility.}
-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
-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\%).
-
\Describe{\ensureascii}{\marg{text}}
\New{3.9i} This macro makes sure \m{text} is typeset with a
@@ -2264,6 +2171,129 @@ most of cases. No asumption is made on characters above
127, which may not follow the LICR conventions -- the goal is just
to ensure most of the ASCII letters and symbols are the right ones.
+\subsection{Selecting directions}
+\label{bidi}
+
+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
+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\%).
+
+\begin{warning}
+ Setting bidi text has many subtleties (see for example
+ <https://www.w3.org/TR/html-bidi/>). This means the \babel{} bidi
+ code may take some time before it is truly stable. An effort is
+ being made to avoid incompatibilities in the future (this one of the
+ reason currently bidi must be explicitly requested as a package
+ option, with a certain bidi model).
+\end{warning}
+
+There are some package options controlling bidi writing.
+
+\Describe{bidi=}{\texttt{default} $\string|$ \texttt{basic-r}}
+
+\New{3.14} Selects the bidi algorithm to be used. With |default| the
+bidi mechanism is just activated (by default it is not), but every
+change must by marked up. In \xetex{} and \pdftex{} this is the only
+option. In \luatex, |basic-r| provides a simple and fast method for R
+text, which handles numbers and unmarked L text within an R context.
+
+\begin{example}
+ The following text comes from the Arabic Wikipedia (article about
+ Arabia). Copy-pasting some text from the Wikipedia is a good way to
+ test this feature, which will be improved in the future. Remember
+ |basic-r| is available in \luatex{} only.\footnote{At the time of
+ this writing some Arabic fonts are not rendered correctly by the
+ default \luatex{} font loader, with misplaced kerns inside some
+ words, so double check the resulting text. It seems a fix is on the
+ way.}
+ \begingroup
+% If you are looking at the code to see how it has been written, you
+% will be disappointed :-). The following example is built ad hoc to
+% emulate the final result to avoid dependencies, and therefore it's
+% not "real" code.
+\setmonofont[Scale=.87,Script=Arabic]{DejaVu Sans Mono} \catcode`@=13
+\def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TLT \else
+\bgroup\textdir TRT \pardir TRT \fi}
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage[nil, _bidi=basic-r_]{babel}
+
+_\babelprovide[import=ar, main]{arabic}_
+
+\babelfont{rm}{FreeSerif}
+
+\begin{document}
+
+@9وقد عرفت شبه جزيرة العرب طيلة العصر الهيليني )الاغريقي( بـ
+@1Arabia@0 أو @1Aravia@0 )بالاغريقية @1Αραβία@0(، استخدم الرومان ثلاث
+بادئات بـ@1“Arabia”@0 على ثلاث مناطق من شبه الجزيرة العربية، إلا أنها
+حقيقةً كانت أكبر مما تعرف عليه اليوم.
+
+@0\end{document}
+\end{verbatim}
+\endgroup
+\end{example}
+
+\Describe{layout=}{\texttt{sectioning} $\string|$
+ \texttt{counters} $\string|$
+ \texttt{lists} $\string|$
+ \texttt{contents} $\string|$
+ \texttt{columns}}
+
+\New{3.16} Selects which layout elements are adapted in bidi
+documents. This list will be expanded in future releases (footnotes,
+tables, etc.). \textit{To be expanded}. Note some options are not
+required in \luatex{}.
+
+\begin{description}
+\renewcommand\makelabel[1]{%
+ \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
+\itemsep=-\parskip
+\item[sectioning] makes sure the sectioning macros are typeset in the
+ main language, but with the title text in the current language (see
+ below for further details);
+\item[counters] required in all engines to reorder correctly section
+ numbers and the like (eg, \m{subsection}.\m{section}); required in
+ \xetex{} and \pdftex{} for counters in general, as well as in \luatex{}
+ with |bidi=default|;
+\item[lists] required in \xetex{} and \pdftex{}, but only in
+ multilingual documents in \luatex{};
+\item[contents] required in \xetex{} and \pdftex{}; in \luatex{}
+ toc entries are R by default;
+\item[columns] required in \xetex{} and \pdftex{} to reverse the
+ column order (currently only the standard two column mode); in
+ \luatex{} they are R by default (including \textsf{multicol}).
+\end{description}
+
+\Describe{\babelsublr}{\marg{lr-text}}
+
+However, digits in \pdftex{} must be marked up explicitly (unlike
+\luatex{} with |bidi=basic-r| and, usually, \xetex{}). Mainly for it
+(although available in all engines, because it can be useful), this
+command is provided to set \marg{lr-text} in L mode. It's mainly
+intended for what Unicode calls weak characters, because words are
+best set with the corresponding language. For this reason, there is
+no |rl| counterpart.
+
+\Describe{\BabelPatchSection}{\marg{section-name}}
+
+Mainly for bidi text, but it could 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 |\chaptername| in |\chapter|), while the section text
+is still the current language. The latter is passed to tocs and marks,
+too, and with |sectioning| in |layout| they both reset the “global”
+language to the main one, while the text uses the “local”
+language. With |layout=sectioning| all the standard sectioning
+commands are redefined, but with this command you can set them
+individually if necessary (but note then tocs and marks are not
+touched).
+
\subsection{Language attributes}
\DescribeMacro{\languageattribute}
@@ -2284,6 +2314,90 @@ options. For example, \textsf{french} uses |\frenchsetup|,
|spanish| have no attribute counterparts. Macros settting
options are also used (eg, |\ProsodicMarksOn| in \textsf{latin}).
+\subsection{Hooks}
+
+\New{3.9a} A hook is a piece of code to be executed at certain
+events. Some hooks are predefined when \luatex{} and \xetex{} are
+used.
+
+\Describe\AddBabelHook{\marg{name}\marg{event}\marg{code}}
+
+The same name can be applied to several events. Hooks may be enabled
+and disabled for all defined events with
+|\EnableBabelHook|\marg{name}, |\DisableBabelHook|\marg{name}. Names
+containing the string |babel| are reserved (they are used, for
+example, by |\useshortands*| to add a hook for the event
+|afterextras|).
+
+Current events are the following; in some of them you can use one to
+three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given:
+\begin{description}
+\renewcommand\makelabel[1]{%
+ \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
+\itemsep=-\parskip
+\item[adddialect] (language name, dialect name) Used by
+ \file{luababel.def} to load the patterns if not preloaded.
+\item[patterns] (language name, language with encoding) Executed just
+ after the |\language| has been set. The second argument has the
+ patterns name actually selected (in the form of either |lang:ENC| or
+ |lang|).
+\item[hyphenation] (language name, language with encoding) Executed
+ locally just before exceptions given in |\babelhyphenation| are
+ actually set.
+\item[defaultcommands] Used (locally) in |\StartBabelCommands|.
+\item[encodedcommands] (input, font encodings) Used (locally) in
+ |\StartBabelCommands|. Both \xetex{} and \luatex{} make sure the
+ encoded text is read correctly.
+\item[stopcommands] Used to reset the the above, if necessary.
+\item[write] This event comes just after the switching commands are
+ written to the |aux| file.
+\item[beforeextras] Just before executing |\extras|\m{language}. This
+ event and the next one should not contain language-dependent code
+ (for that, add it to |\extras|\m{language}).
+\item[afterextras] Just after executing |\extras|\m{language}. For
+ example, the following deactivates shorthands in all languages:
+\begin{verbatim}
+\AddBabelHook{noshort}{afterextras}{\languageshorthands{none}}
+\end{verbatim}
+\item[stringprocess] Instead of a parameter, you can manipulate the
+ macro |\BabelString| containing the string to be defined with
+ |\SetString|. For example, to use an expanded version of the string
+ in the definition, write:
+\begin{verbatim}
+\AddBabelHook{myhook}{stringprocess}{%
+ \protected@edef\BabelString{\BabelString}}
+\end{verbatim}
+\item[initiateactive] (char as active, char as other, original char)
+ \New{3.9i} Executed just after a shorthand has been `initiated'. The three
+ parameters are the same character with different catcodes: active,
+ other (|\string|'ed) and the original one.
+\item[afterreset] \New{3.9i} Executed when selecting a language just after
+ |\originalTeX| is run and reset to its base value, before executing
+ |\captions|\m{language} and |\date|\m{language}.
+\end{description}
+
+Four events are used in \file{hyphen.cfg}, which are handled in a
+quite different way for efficiency reasons -- unlike the precedent
+ones, they only have a single hook and replace a default definition.
+\begin{description}
+\renewcommand\makelabel[1]{%
+ \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
+\itemsep=-\parskip
+\item[everylanguage] (language) Executed before every language patterns are loaded.
+\item[loadkernel] (file) By default loads |switch.def|. It can be used
+ to load a different version of this files or to load nothing.
+\item[loadpatterns] (patterns file) Loads the patterns file. Used by
+ \file{luababel.def}.
+\item[loadexceptions] (exceptions file) Loads the exceptions
+ file. Used by \file{luababel.def}.
+\end{description}
+
+\Describe\BabelContentsFiles{}
+\New{3.9a} This macro contains a list of ``toc'' types
+requiring a command to switch the language. Its default value is
+|toc,lof,lot|, but you may redefine it with |\renewcommand| (it's up
+to you to make sure no toc type is duplicated).
+
\subsection{Languages supported by \babel}
In the following table most of the languages supported by \babel\ are
@@ -2708,6 +2822,40 @@ provide a standalone document suited for your needs, as well as other
files you think can be useful. A PDF and a ``readme'' are strongly
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).
+
+Of course, placing your style files in this directory is not mandatory,
+but if you want to do it, here are a few guidelines.
+
+\begin{itemize}
+\item Do not hesitate stating on the file heads you are the author and the
+ maintainer, if you actually are. There is no need to state the babel
+ maintainer(s) as authors if they have not contributed significantly
+ to your language files.
+\item Fonts are not strictly part of a language, so they are best placed
+ in the corresponding TeX tree. This includes not only \texttt{tfm}, \texttt{vf}, \texttt{ps1},
+ \texttt{otf}, \texttt{mf} files and the like, but also \texttt{fd} ones.
+\item Font and input encodings are usually best placed in the
+ corresponding tree, too, but sometimes they belong more naturally to
+ the babel style. Note you may also need to define a LICR.
+\item \Babel{} ldf files may just interface a framework, as it happens often
+ with Oriental languages/scripts. This framework is best placed in its
+ own directory.
+\end{itemize}
+
+The following page provides a starting point:
+\texttt{http://www.texnia.com/incubator.html}.
+
+If your need further assistance and technical advice in the
+development of language styles, I am willing to help you. And of
+course, you can make any suggestion you like.
+
\subsection{Basic macros}
In the core of the \babel{} system, several macros are defined for use
@@ -3175,7 +3323,7 @@ optional one. This command, unlike |\SetString|, is executed always
only.
For example, as |T1| is the default case mapping in \LaTeX, we could
-set for Turkish: % :-( Seem to be a bug in listings. Fixed with &&.
+set for Turkish:
\begin{verbatim}
\StartBabelCommands{turkish}{}[ot1enc, fontenc=OT1]
\SetCase
@@ -3419,8 +3567,8 @@ help from Bernd Raichle, for which I am grateful.
% little bit of literate programming.
%
% \begin{macrocode}
-%<<version=3.15>>
-%<<date=2017/11/03>>
+%<<version=3.16>>
+%<<date=2018/01/04>>
% \end{macrocode}
%
% \section{Tools}
@@ -3875,23 +4023,25 @@ help from Bernd Raichle, for which I am grateful.
\fi}%
\bbl@languages
\fi
-\@ifpackagewith{babel}{bidi=basic-r}{% must go before any \DeclareOption
- \let\bbl@beforeforeign\leavevmode
- \AtEndOfPackage{\EnableBabelHook{babel-bidi}}%
- \RequirePackage{luatexbase}%
- \directlua{
- require('babel-bidi.lua')
- require('babel-bidi-basic-r.lua')
- luatexbase.add_to_callback('pre_linebreak_filter',
- Babel.pre_otfload,
- 'Babel.pre_otfload',
- luatexbase.priority_in_callback('pre_linebreak_filter',
- 'luaotfload.node_processor') or nil)
- luatexbase.add_to_callback('hpack_filter',
- Babel.pre_otfload,
- 'Babel.pre_otfload',
- luatexbase.priority_in_callback('hpack_filter',
- 'luaotfload.node_processor') or nil)}}{}
+\ifodd\bbl@engine
+ \@ifpackagewith{babel}{bidi=basic-r}{% must go before any \DeclareOption
+ \let\bbl@beforeforeign\leavevmode
+ \AtEndOfPackage{\EnableBabelHook{babel-bidi}}%
+ \RequirePackage{luatexbase}%
+ \directlua{
+ require('babel-bidi.lua')
+ require('babel-bidi-basic-r.lua')
+ luatexbase.add_to_callback('pre_linebreak_filter',
+ Babel.pre_otfload,
+ 'Babel.pre_otfload',
+ luatexbase.priority_in_callback('pre_linebreak_filter',
+ 'luaotfload.node_processor') or nil)
+ luatexbase.add_to_callback('hpack_filter',
+ Babel.pre_otfload,
+ 'Babel.pre_otfload',
+ luatexbase.priority_in_callback('hpack_filter',
+ 'luaotfload.node_processor') or nil)}}{}
+\fi
% \end{macrocode}
%
% Now the \texttt{base} option. With it we can define (and load, with
@@ -3922,7 +4072,7 @@ help from Bernd Raichle, for which I am grateful.
% and assigned to |\BabelModifiers| at |\bbl@load@language|; when
% no modifiers have been given, the former is |\relax|. How
% modifiers are handled are left to language styles; they can use
-% |\in@|, loop them with |\@for| or load |keyval|, for example).
+% |\in@|, loop them with |\@for| or load |keyval|, for example.
%
% \changes{babel~3.9e}{2013/04/15}{Bug fixed - a dot was added in
% key=value pairs}
@@ -3947,11 +4097,11 @@ help from Bernd Raichle, for which I am grateful.
\expandafter\let\csname opt@babel.sty\endcsname\bbl@tempc
% \end{macrocode}
%
-% The next option tells \babel\ to leave shorthand characters
-% active at the end of processing the package. This is \emph{not}
-% the default as it can cause problems with other packages, but for
-% those who want to use the shorthand characters in the preamble of
-% their documents this can help.
+% The next option tells \babel\ to leave shorthand characters active
+% at the end of processing the package. This is \emph{not} the default
+% as it can cause problems with other packages, but for those who want
+% to use the shorthand characters in the preamble of their documents
+% this can help.
%
% \changes{babel~3.9a}{2012/08/14}{Implemented the \texttt{noconfigs}
% option}
@@ -3987,6 +4137,7 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@opt@config\@nnil
\let\bbl@opt@main\@nnil
\let\bbl@opt@headfoot\@nnil
+\let\bbl@opt@layout\@nnil
% \end{macrocode}
%
% The following tool is defined temporarily to store the values of
@@ -4001,15 +4152,15 @@ help from Bernd Raichle, for which I am grateful.
Bad option `#1=#2'. Either you have misspelled the\\%
key or there is a previous setting of `#1'}{%
Valid keys are `shorthands', `config', `strings', `main',\\%
- `headfoot', `safe', `math'}
+ `headfoot', `safe', `math', among others.}
\fi}
% \end{macrocode}
%
-% Now the option list is processed, taking into account only
-% currently declared options (including those declared with a |=|),
-% and |<key>=<value>| options (the former take precedence).
-% Unrecognized options are saved in |\bbl@language@opts|, because
-% they are language options.
+% Now the option list is processed, taking into account only currently
+% declared options (including those declared with a |=|), and
+% |<key>=<value>| options (the former take precedence). Unrecognized
+% options are saved in |\bbl@language@opts|, because they are language
+% options.
%
% \begin{macrocode}
\let\bbl@language@opts\@empty
@@ -4120,6 +4271,26 @@ help from Bernd Raichle, for which I am grateful.
\fi
% \end{macrocode}
%
+% For |layout| an auxiliary macro is provided, available for packages
+% and language styles.
+%
+% \changes{babel~3.16}{2018/01/02}{Added the basic layout stuff and the
+% macro \cs{IfBabelLayout}}
+%
+% \begin{macrocode}
+\ifx\bbl@opt@layout\@nnil
+ \newcommand\IfBabelLayout[3]{#3}%
+\else
+ \newcommand\IfBabelLayout[1]{%
+ \@expandtwoargs\in@{.#1.}{.\bbl@opt@layout.}%
+ \ifin@
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+\fi
+% \end{macrocode}
+%
% \subsection{Language options}
%
% \changes{babel~3.9a}{2012/06/15}{Rewritten the loading mechanism, so
@@ -4816,11 +4987,13 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% We also have to make sure that some code gets executed at the
-% beginning of the document.
+% beginning of the document. Languages does not set |\pagedir|, so
+% we set here for the whole document to the main |\bodydir|.
%
% \begin{macrocode}
\AtBeginDocument{%
- \expandafter\selectlanguage\expandafter{\bbl@main@language}}
+ \expandafter\selectlanguage\expandafter{\bbl@main@language}%
+ \ifcase\bbl@engine\or\pagedir\bodydir\fi} % TODO - a better place
% \end{macrocode}
%
% \end{macro}
@@ -6879,6 +7052,12 @@ help from Bernd Raichle, for which I am grateful.
%
% Shorthands are provided for a number of different quotation
% marks, which make them usable both outside and inside mathmode.
+% They are defined with |\ProvideTextCommandDefault|, but this is
+% very likely not required because their definitions are based on
+% encoding dependent macros.
+%
+% \changes{babel~3.16}{2018/01/02}{Adapted to TU and refactored -
+% redundant code.}
%
% \begin{macro}{\glq}
% \begin{macro}{\grq}
@@ -6889,11 +7068,8 @@ help from Bernd Raichle, for which I am grateful.
% The `german' single quotes.
%
% \begin{macrocode}
-\ProvideTextCommand{\glq}{OT1}{%
+\ProvideTextCommandDefault{\glq}{%
\textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
-\ProvideTextCommand{\glq}{T1}{%
- \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
-\ProvideTextCommandDefault{\glq}{\UseTextSymbol{OT1}\glq}
% \end{macrocode}
%
% The definition of |\grq| depends on the fontencoding. With
@@ -6902,10 +7078,12 @@ help from Bernd Raichle, for which I am grateful.
% \begin{macrocode}
\ProvideTextCommand{\grq}{T1}{%
\textormath{\textquoteleft}{\mbox{\textquoteleft}}}
+\ProvideTextCommand{\grq}{TU}{%
+ \textormath{\textquoteleft}{\mbox{\textquoteleft}}}
\ProvideTextCommand{\grq}{OT1}{%
- \save@sf@q{\kern-.0125em%
- \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
- \kern.07em\relax}}
+ \save@sf@q{\kern-.0125em
+ \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
+ \kern.07em\relax}}
\ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
% \end{macrocode}
%
@@ -6921,23 +7099,22 @@ help from Bernd Raichle, for which I am grateful.
% The `german' double quotes.
%
% \begin{macrocode}
-\ProvideTextCommand{\glqq}{OT1}{%
+\ProvideTextCommandDefault{\glqq}{%
\textormath{\quotedblbase}{\mbox{\quotedblbase}}}
-\ProvideTextCommand{\glqq}{T1}{%
- \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
-\ProvideTextCommandDefault{\glqq}{\UseTextSymbol{OT1}\glqq}
% \end{macrocode}
%
-% The definition of |\grqq| depends on the % fontencoding. With
+% The definition of |\grqq| depends on the fontencoding. With
% \texttt{T1} encoding no extra kerning is needed.
%
% \begin{macrocode}
\ProvideTextCommand{\grqq}{T1}{%
\textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
+\ProvideTextCommand{\grqq}{TU}{%
+ \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
\ProvideTextCommand{\grqq}{OT1}{%
- \save@sf@q{\kern-.07em%
- \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
- \kern.07em\relax}}
+ \save@sf@q{\kern-.07em
+ \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
+ \kern.07em\relax}}
\ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
% \end{macrocode}
%
@@ -6953,19 +7130,10 @@ help from Bernd Raichle, for which I am grateful.
% The `french' single guillemets.
%
% \begin{macrocode}
-\ProvideTextCommand{\flq}{OT1}{%
+\ProvideTextCommandDefault{\flq}{%
\textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
-\ProvideTextCommand{\flq}{T1}{%
- \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
-\ProvideTextCommandDefault{\flq}{\UseTextSymbol{OT1}\flq}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\ProvideTextCommand{\frq}{OT1}{%
+\ProvideTextCommandDefault{\frq}{%
\textormath{\guilsinglright}{\mbox{\guilsinglright}}}
-\ProvideTextCommand{\frq}{T1}{%
- \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
-\ProvideTextCommandDefault{\frq}{\UseTextSymbol{OT1}\frq}
% \end{macrocode}
%
% \end{macro}
@@ -6980,19 +7148,10 @@ help from Bernd Raichle, for which I am grateful.
% The `french' double guillemets.
%
% \begin{macrocode}
-\ProvideTextCommand{\flqq}{OT1}{%
- \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
-\ProvideTextCommand{\flqq}{T1}{%
+\ProvideTextCommandDefault{\flqq}{%
\textormath{\guillemotleft}{\mbox{\guillemotleft}}}
-\ProvideTextCommandDefault{\flqq}{\UseTextSymbol{OT1}\flqq}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\ProvideTextCommand{\frqq}{OT1}{%
- \textormath{\guillemotright}{\mbox{\guillemotright}}}
-\ProvideTextCommand{\frqq}{T1}{%
+\ProvideTextCommandDefault{\frqq}{%
\textormath{\guillemotright}{\mbox{\guillemotright}}}
-\ProvideTextCommandDefault{\frqq}{\UseTextSymbol{OT1}\frqq}
% \end{macrocode}
%
% \end{macro}
@@ -7119,10 +7278,52 @@ help from Bernd Raichle, for which I am grateful.
\main@language{english}
% \end{macrocode}
%
+% \subsection{Layout}
+%
+% \textbf{Work in progress}.
+%
+% Layout is mainly intended to set bidi documents, but there is at
+% least a tool useful in general.
+%
+% \begin{macrocode}
+\providecommand\IfBabelLayout[3]{#3}%
+\newcommand\BabelPatchSection[1]{%
+ \@ifundefined{#1}{}{%
+ \bbl@exp{\let\<bbl@ss@#1>\<#1>}%
+ \@namedef{#1}{%
+ \@ifstar{\bbl@presec@s{#1}}%
+ {\@dblarg{\bbl@presec@x{#1}}}}}}
+\def\bbl@presec@x#1[#2]#3{%
+ \bbl@exp{%
+ \\\select@language@x{\bbl@main@language}%
+ \\\@nameuse{bbl@ss@#1}%
+ [\\\foreignlanguage{\languagename}{\unexpanded{#2}}]%
+ {\\\foreignlanguage{\languagename}{\unexpanded{#3}}}%
+ \\\select@language@x{\languagename}}}
+\def\bbl@presec@s#1#2{%
+ \bbl@exp{%
+ \\\select@language@x{\bbl@main@language}%
+ \\\@nameuse{bbl@ss@#1}*%
+ {\\\foreignlanguage{\languagename}{\unexpanded{#2}}}%
+ \\\select@language@x{\languagename}}}
+\IfBabelLayout{sectioning}% at begin document ???
+ {\BabelPatchSection{part}%
+ \BabelPatchSection{chapter}%
+ \BabelPatchSection{section}%
+ \BabelPatchSection{subsection}%
+ \BabelPatchSection{subsubsection}%
+ \BabelPatchSection{paragraph}%
+ \BabelPatchSection{subparagraph}%
+ \def\babel@toc#1{%
+ \select@language@x{\bbl@main@language}}}{}
+% \end{macrocode}
+%
% Now we load definition files for engines.
%
% \begin{macrocode}
-\ifcase\bbl@engine\or
+\ifcase\bbl@engine
+ \input txtbabel.def
+\or
\input luababel.def
\or
\input xebabel.def
@@ -7168,6 +7369,8 @@ help from Bernd Raichle, for which I am grateful.
% \changes{3.13}{2017/08/30}{Added \cs{import}, which also reads
% dates. Some refactoring in the ini reader.}
% \changes{3.15}{2017/10/30}{New keys script, language}
+% \changes{3.16}{2018/01/02}{Make sure ensuring works even before
+% the language is selected}
%
%
% \begin{macrocode}
@@ -7196,6 +7399,12 @@ help from Bernd Raichle, for which I am grateful.
{Use this macro as documented}}%
{\bbl@provide@renew{#2}}}%
\bbl@exp{\\\babelensure[exclude=\\\today]{#2}}%
+ \bbl@ifunset{bbl@ensure@\languagename}%
+ {\bbl@exp{%
+ \\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{%
+ \\\foreignlanguage{\languagename}%
+ {####1}}}}%
+ {}%
\ifx\bbl@KVP@script\@nil\else
\bbl@csarg\edef{sname@#2}{\bbl@KVP@script}%
\fi
@@ -7317,10 +7526,10 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@inireader\bbl@iniskip
\bbl@info{Importing data from babel-#1.ini for \languagename}%
\loop
+ \if T\ifeof1F\fi T\relax % Trick, because inside \loop
\endlinechar\m@ne
\read1 to \bbl@line
\endlinechar`\^^M
- \if T\ifeof1F\fi T\relax % Trick, because inside \loop
\ifx\bbl@line\@empty\else
\expandafter\bbl@iniline\bbl@line\bbl@iniline
\fi
@@ -7434,6 +7643,8 @@ help from Bernd Raichle, for which I am grateful.
%
% But dates are more complex. The full date format is stores in
% |date.gregorian|, so we must read it in non-Unicode engines, too.
+%
+% \changes{3.16}{2018/01/02}{Fix - dates were severely broken.}
%
% \begin{macrocode}
\bbl@csarg\def{secpre@date.gregorian.licr}{%
@@ -7451,12 +7662,14 @@ help from Bernd Raichle, for which I am grateful.
\bbl@TG@@date
\global\bbl@csarg\let{date@\languagename}\bbl@toreplace
\bbl@exp{%
- \gdef\<\languagename date>####1####2####3{%
+ \gdef\<\languagename date>{\\\protect\<\languagename date >}%
+ \gdef\<\languagename date >####1####2####3{%
+ \\\bbl@usedategrouptrue
\<bbl@ensure@\languagename>{%
\<bbl@date@\languagename>{####1}{####2}{####3}}}%
\\\bbl@add\\\bbl@savetoday{%
\\\SetString\\\today{%
- \<\languagename date>{\year}{\month}{\day}}}}}}%
+ \<\languagename date>{\\\the\year}{\\\the\month}{\\\the\day}}}}}}%
{}}
% \end{macrocode}
%
@@ -7466,14 +7679,14 @@ help from Bernd Raichle, for which I am grateful.
% inconsistenly in either in the date or in the month name.
%
% \begin{macrocode}
-\newcommand\BabelDateSpace{\nobreakspace{}}
+\newcommand\BabelDateSpace{\nobreakspace}
\newcommand\BabelDateDot{.\@}
\newcommand\BabelDated[1]{{\number#1}}
\newcommand\BabelDatedd[1]{{\ifnum#1<10 0\fi\number#1}}
\newcommand\BabelDateM[1]{{\number#1}}
\newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
\newcommand\BabelDateMMMM[1]{{%
- \csname month\romannumeral\month name\endcsname}}%
+ \csname month\romannumeral#1name\endcsname}}%
\newcommand\BabelDatey[1]{{\number#1}}%
\newcommand\BabelDateyy[1]{{%
\ifnum#1<10 0\number#1 %
@@ -7505,6 +7718,49 @@ help from Bernd Raichle, for which I am grateful.
\bbl@replace@finish@iii\bbl@toreplace}
% \end{macrocode}
%
+% Language and Script values to be used when defining a font or
+% setting the direction are set with the following macros.
+%
+% \begin{macrocode}
+\def\bbl@provide@lsys#1{%
+ \bbl@ifunset{bbl@lname@#1}%
+ {\bbl@ini@ids{#1}}%
+ {}%
+ \bbl@csarg\let{lsys@#1}\@empty
+ \bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}%
+ \bbl@ifunset{bbl@sotf#1}{\bbl@csarg\gdef{sotf@#1}{DFLT}}{}%
+ \bbl@csarg\bbl@add@list{lsys@#1}{Script=\bbl@cs{sname@#1}}%
+ \bbl@ifunset{bbl@lname@#1}{}%
+ {\bbl@csarg\bbl@add@list{lsys@#1}{Language=\bbl@cs{lname@#1}}}%
+ \bbl@csarg\bbl@toglobal{lsys@#1}}%
+ % \bbl@exp{% TODO - should be global
+ % \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl@cs{sname@#1}}%
+ % {\\\newfontscript{\bbl@cs{sname@#1}}{\bbl@cs{sotf@#1}}}%
+ % \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl@cs{lname@#1}}%
+ % {\\\newfontlanguage{\bbl@cs{lname@#1}}{\bbl@cs{lotf@#1}}}}}
+% \end{macrocode}
+%
+% The following |ini| reader ignores everything but the
+% |identification| section. It is called when a font is defined (ie,
+% when the language is first selected) to know which script/language
+% must be enabled. This means we must make sure a few characters are
+% not active. The |ini| is not read directly, but with a proxy |tex|
+% file named as the language.
+%
+% \changes{3.16}{2018/01/02}{Load ids inside a box, to prevent extra
+% spaces.}
+%
+% \begin{macrocode}
+\def\bbl@ini@ids#1{%
+ \def\BabelBeforeIni##1##2{%
+ \begingroup
+ \bbl@add\bbl@secpost@identification{\closein1 }%
+ \catcode`\[=12 \catcode`\]=12 \catcode`\==12
+ \bbl@read@ini{##1}%
+ \endgroup}% boxed, to avoid extra spaces:
+ {\setbox\z@\hbox{\InputIfFileExists{babel-#1.tex}{}{}}}}
+% \end{macrocode}
+%
% \subsection{Cross referencing macros}
%
% The \LaTeX\ book states:
@@ -7860,13 +8116,20 @@ help from Bernd Raichle, for which I am grateful.
% \cs{@safe@activestrue} is in effect.
%
% \begin{macrocode}
-\bbl@redefine\markright#1{%
- \bbl@ifblank{#1}%
- {\org@markright{}}%
- {\toks@{#1}%
- \bbl@exp{%
- \\\org@markright{\\\protect\\\foreignlanguage{\languagename}%
- {\\\protect\\\bbl@restore@actives\the\toks@}}}}}
+\IfBabelLayout{sectioning}
+ {\ifx\bbl@opt@headfoot\@nnil
+ \g@addto@macro\@resetactivechars{%
+ \set@typeset@protect
+ \expandafter\select@language@x\expandafter{\bbl@main@language}%
+ \let\protect\noexpand}%
+ \fi}
+ {\bbl@redefine\markright#1{%
+ \bbl@ifblank{#1}%
+ {\org@markright{}}%
+ {\toks@{#1}%
+ \bbl@exp{%
+ \\\org@markright{\\\protect\\\foreignlanguage{\languagename}%
+ {\\\protect\\\bbl@restore@actives\the\toks@}}}}}
% \end{macrocode}
%
% \end{macro}
@@ -7891,32 +8154,32 @@ help from Bernd Raichle, for which I am grateful.
% 3826)}
%
% \begin{macrocode}
-\ifx\@mkboth\markboth
- \def\bbl@tempc{\let\@mkboth\markboth}
-\else
- \def\bbl@tempc{}
-\fi
+ \ifx\@mkboth\markboth
+ \def\bbl@tempc{\let\@mkboth\markboth}
+ \else
+ \def\bbl@tempc{}
+ \fi
% \end{macrocode}
%
% Now we can start the new definition of |\markboth|
%
% \begin{macrocode}
-\bbl@redefine\markboth#1#2{%
- \protected@edef\bbl@tempb##1{%
- \protect\foreignlanguage{\languagename}{\protect\bbl@restore@actives##1}}%
- \bbl@ifblank{#1}%
- {\toks@{}}%
- {\toks@\expandafter{\bbl@tempb{#1}}}%
- \bbl@ifblank{#2}%
- {\@temptokena{}}%
- {\@temptokena\expandafter{\bbl@tempb{#2}}}%
- \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}
+ \bbl@redefine\markboth#1#2{%
+ \protected@edef\bbl@tempb##1{%
+ \protect\foreignlanguage{\languagename}{\protect\bbl@restore@actives##1}}%
+ \bbl@ifblank{#1}%
+ {\toks@{}}%
+ {\toks@\expandafter{\bbl@tempb{#1}}}%
+ \bbl@ifblank{#2}%
+ {\@temptokena{}}%
+ {\@temptokena\expandafter{\bbl@tempb{#2}}}%
+ \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}
% \end{macrocode}
%
% and copy it to |\@mkboth| if necessary.
%
% \begin{macrocode}
-\bbl@tempc
+ \bbl@tempc} % end \IfBabelLayout
% \end{macrocode}
%
% \end{macro}
@@ -8322,15 +8585,15 @@ help from Bernd Raichle, for which I am grateful.
% set left-to-right and right-to-left page layouts. As Lua\TeX-ja
% shows, vertical typesetting is posible, too. Its main drawback
% is font handling is often considered to be less mature than
-% \xetex.\footnote{Although in my [JBL] experience problems are
-% in fact minimal.}
+% \xetex{}, mainly in Indic scripts (but there are steps to make
+% HarfBuzz, the \xetex{} font engine, available in \luatex{}; see
+% <https://github.com/tatzetwerk/luatex-harfbuzz>).
% \end{itemize}
%
% \changes{3.15}{2017/10/30}{Use an attribute instead of tex language
% (reserved for hyphenation).}
% \changes{3.15}{2017/10/30}{Store direction in @wdir@<lang>.}
%
-%
% \begin{macrocode}
\def\bbl@alscripts{,Arabic,Syriac,Thaana,}
\def\bbl@rscripts{%
@@ -8352,17 +8615,16 @@ help from Bernd Raichle, for which I am grateful.
\global\bbl@csarg\chardef{wdir@#1}\z@
\fi}
\def\bbl@switchdir{%
+ \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
\bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
\bbl@exp{\\\bbl@setdirs\bbl@cs{wdir@\languagename}}}
\def\bbl@setdirs#1{% TODO - math
\ifcase\bbl@select@type % TODO - strictly, not the right test
- \bbl@pagedir{#1}%
\bbl@bodydir{#1}%
\bbl@pardir{#1}%
\fi
\bbl@textdir{#1}}
-\ifcase\bbl@engine
-\or
+\ifodd\bbl@engine % luatex=1
\AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
\DisableBabelHook{babel-bidi}
\def\bbl@getluadir#1{%
@@ -8389,7 +8651,7 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@bodydir{\bbl@setdir{body}\bodydir}
\def\bbl@pagedir{\bbl@setdir{page}\pagedir}
\def\bbl@dirparastext{\pardir\the\textdir\relax}% %%%%
-\or
+\else % pdftex=0, xetex=2
\AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
\DisableBabelHook{babel-bidi}
\newcount\bbl@dirlevel
@@ -8440,23 +8702,35 @@ help from Bernd Raichle, for which I am grateful.
% The following command is executed only if there is a right-to-left
% script (once). It activates the |\everypar| hack for \xetex, to
% properly handle the par direction. Note text and par dirs are
-% decoupled.
+% decoupled to some extent (although not completely).
+%
+% \changes{3.16}{2018/01/02}{Fix - the direction prevented the removal
+% of the indent to be re-placed}
%
% \begin{macrocode}
\def\bbl@xebidipar{%
\let\bbl@xebidipar\relax
\TeXXeTstate\@ne
\def\bbl@xeeverypar{%
- \ifcase\bbl@thepardir\else
- {\setbox\z@\lastbox\beginR\box\z@}%
- \fi
- \ifcase\bbl@thetextdir\else\beginR\fi}%
+ \ifcase\bbl@thepardir
+ \ifcase\bbl@thetextdir\else\beginR\fi
+ \else
+ {\setbox\z@\lastbox\beginR\box\z@}%
+ \fi}%
\let\bbl@severypar\everypar
\newtoks\everypar
\everypar=\bbl@severypar
\bbl@severypar{\bbl@xeeverypar\the\everypar}}
\fi
% \end{macrocode}
+%
+% A tool for weak L (mainly digits).
+%
+% \changes{3.16}{2018/01/02}{New macro \cs{babelsublr}}
+%
+% \begin{macrocode}
+\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}}
+% \end{macrocode}
%
% \subsection{Local Language Configuration}
%
@@ -8766,6 +9040,8 @@ help from Bernd Raichle, for which I am grateful.
% \changes{babel~3.9a}{2013/03/08}{Don't write to aux if language is
% unknown}
% \changes{babel~3.9h}{2013/11/20}{Error with a more helpful text }
+% \changes{babel~3.16}{2018/01/02}{New mechanism to pass the language
+% to aux, toc, etc.}
%
% \begin{macrocode}
\def\BabelContentsFiles{toc,lof,lot}
@@ -8776,9 +9052,7 @@ help from Bernd Raichle, for which I am grateful.
\select@language{\languagename}%
\expandafter\ifx\csname date\languagename\endcsname\relax\else
\if@filesw
- \protected@write\@auxout{}{\string\select@language{\languagename}}%
- \bbl@foreach\BabelContentsFiles{%
- \addtocontents{##1}{\xstring\select@language{\languagename}}}%
+ \protected@write\@auxout{}{\string\babel@aux{\languagename}{}}%
\bbl@usehooks{write}{}%
\fi
\fi}
@@ -8798,6 +9072,12 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@select@type\z@
\expandafter\bbl@switch\expandafter{\languagename}%
\fi}}
+\def\babel@aux#1#2{%
+ \select@language{#1}%
+ \bbl@foreach\BabelContentsFiles{%
+ \@writefile{##1}{\babel@toc{#1}{#2}}}} %% TODO - ok in plain?
+\def\babel@toc#1#2{%
+ \select@language{#1}}
% \end{macrocode}
%
% A bit of optimization. Select in heads/foots the language only if
@@ -8857,6 +9137,7 @@ help from Bernd Raichle, for which I am grateful.
% \changes{3.15}{2017/10/30}{Remove spaces inside captions and date.}
%
% \begin{macrocode}
+\newif\ifbbl@usedategroup
\def\bbl@switch#1{%
\originalTeX
\expandafter\def\expandafter\originalTeX\expandafter{%
@@ -8875,7 +9156,16 @@ help from Bernd Raichle, for which I am grateful.
\csname captions#1\endcsname\relax
\csname date#1\endcsname\relax
\fi
- \fi
+ \else\ifbbl@usedategroup
+ \bbl@usedategroupfalse
+ \ifhmode
+ \hskip\z@skip % trick to ignore spaces
+ \csname date#1\endcsname\relax
+ \loop\ifdim\lastskip>\z@\unskip\repeat\unskip
+ \else
+ \csname date#1\endcsname\relax
+ \fi
+ \fi\fi
\bbl@usehooks{beforeextras}{}%
\csname extras#1\endcsname\relax
\bbl@usehooks{afterextras}{}%
@@ -9803,18 +10093,33 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
%<<*More package options>>
-\DeclareOption{bidi=basic-r}%
- {\newattribute\bbl@attr@dir
- \let\bbl@beforeforeign\leavevmode
- \AtEndOfPackage{\EnableBabelHook{babel-bidi}}}
+\ifodd\bbl@engine
+ \DeclareOption{bidi=basic-r}%
+ {\let\bbl@beforeforeign\leavevmode
+ \newattribute\bbl@attr@dir
+ \bbl@exp{\output{\bodydir\pagedir\the\output}}%
+ \AtEndOfPackage{\EnableBabelHook{babel-bidi}}}
+\else
+ \DeclareOption{bidi=basic-r}%
+ {\bbl@error
+ {The bidi method `basic-r' is available only in\\%
+ luatex. I'll continue with `bidi=default', so\\%
+ expect wrong results}%
+ {See the manual for further details.}%
+ \let\bbl@beforeforeign\leavevmode
+ \AtEndOfPackage{%
+ \EnableBabelHook{babel-bidi}%
+ \bbl@xebidipar}}
+\fi
\DeclareOption{bidi=default}%
{\let\bbl@beforeforeign\leavevmode
- \ifcase\bbl@engine\or
+ \ifodd\bbl@engine
\newattribute\bbl@attr@dir
+ \bbl@exp{\output{\bodydir\pagedir\the\output}}%
\fi
\AtEndOfPackage{%
\EnableBabelHook{babel-bidi}%
- \ifcase\bbl@engine\or\or
+ \ifodd\bbl@engine\else
\bbl@xebidipar
\fi}}
%<</More package options>>
@@ -9919,47 +10224,6 @@ help from Bernd Raichle, for which I am grateful.
\bbl@toglobal#1}%
% \end{macrocode}
%
-% Language and Script values to be used when defining a font are set
-% with the following macros.
-%
-% \begin{macrocode}
-\def\bbl@provide@lsys#1{%
- \bbl@ifunset{bbl@lname@#1}%
- {\bbl@ini@ids{#1}}%
- {}%
- \bbl@csarg\let{lsys@#1}\@empty
- \bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}%
- \bbl@ifunset{bbl@sotf#1}{\bbl@csarg\gdef{sotf@#1}{DFLT}}{}%
- \bbl@csarg\bbl@add@list{lsys@#1}{Script=\bbl@cs{sname@#1}}%
- \bbl@ifunset{bbl@lname@#1}{}%
- {\bbl@csarg\bbl@add@list{lsys@#1}{Language=\bbl@cs{lname@#1}}}%
- \bbl@csarg\bbl@toglobal{lsys@#1}}%
- % \bbl@exp{% TODO - should be global
- % \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl@cs{sname@#1}}%
- % {\\\newfontscript{\bbl@cs{sname@#1}}{\bbl@cs{sotf@#1}}}%
- % \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl@cs{lname@#1}}%
- % {\\\newfontlanguage{\bbl@cs{lname@#1}}{\bbl@cs{lotf@#1}}}}}
-% \end{macrocode}
-%
-% The following |ini| reader ignores everything but the
-% |identification| section. It is called when a font is defined (ie,
-% when the language is first selected) to know which script/language
-% must be enabled. This means we must make sure a few characters are
-% not active. The |ini| is not read directly, but with a proxy |tex|
-% file named as the language.
-%
-% \begin{macrocode}
-\def\bbl@ini@ids#1{%
- \def\BabelBeforeIni##1##2{%
- \begingroup
- \bbl@add\bbl@secpost@identification{%
- \def\bbl@iniline########1\bbl@iniline{}}%
- \catcode`\[=12 \catcode`\]=12 \catcode`\==12
- \bbl@read@ini{##1}%
- \endgroup}
- \InputIfFileExists{babel-#1.tex}{}{}}
-% \end{macrocode}
-%
% font@rst and famrst are only used when there is no global settings,
% to save and restore de previous families. Not really necessary, but
% done for optimization.
@@ -10101,9 +10365,168 @@ help from Bernd Raichle, for which I am grateful.
\AddBabelHook{babel-fontspec}{afterextras}{\bbl@switchfont}
\DisableBabelHook{babel-fontspec}
<@Font selection@>
+\input txtbabel.def
%</xetex>
% \end{macrocode}
%
+% \subsection{Layout}
+%
+% \changes{babel~3.16}{2018/01/02}{Option layout - first available options:
+% sectioning, counters, lists, columns, contents}
+%
+% In progress.
+%
+% Unfortunately, for proper support for \xetex{} lots of macros and
+% packages must be patched somehow. At least at this stage, \babel{}
+% will not do it and therefore a package similar to \textsf{bidi} will
+% be required. Any help in making \babel{} and \textsf{bidi}
+% collaborate will be welcome. Note as well, elements like headlines
+% and margins can be modified easily with packages like
+% \textsf{fancyhdr}, \textsf{typearea} or \textsf{titleps}, and
+% \textsf{geometry}.
+%
+% |\bbl@startskip| and |\bbl@endskip| are available to package
+% authors. Thanks to the \TeX{} expansion mechanism the following
+% constructs are valid: |\adim\bbl@startskip|,
+% |\advance\bbl@startskip\adim|, |\bbl@startskip\adim|.
+%
+% Consider |txtbabel| as a shorthand for \textit{tex--xet babel},
+% which the bidi model in both \pdftex{} and \xetex{}.
+%
+% \begin{macrocode}
+%<*texxet>
+\ifx\bbl@opt@layout\@nnil\endinput\fi % No layout
+\def\bbl@startskip{\ifcase\bbl@thepardir\leftskip\else\rightskip\fi}
+\def\bbl@endskip{\ifcase\bbl@thepardir\rightskip\else\leftskip\fi}
+\ifx\bbl@beforeforeign\leavevmode % A poor test for bidi=
+ \def\@hangfrom#1{%
+ \setbox\@tempboxa\hbox{{#1}}%
+ \hangindent\ifcase\bbl@thepardir\wd\@tempboxa\else-\wd\@tempboxa\fi
+ \noindent\box\@tempboxa}
+ \def\raggedright{%
+ \let\\\@centercr
+ \bbl@startskip\z@skip
+ \@rightskip\@flushglue
+ \bbl@endskip\@rightskip
+ \parindent\z@
+ \parfillskip\bbl@startskip}
+ \def\raggedleft{%
+ \let\\\@centercr
+ \bbl@startskip\@flushglue
+ \bbl@endskip\z@skip
+ \parindent\z@
+ \parfillskip\bbl@endskip}
+\fi
+\IfBabelLayout{lists}
+ {\def\list#1#2{%
+ \ifnum \@listdepth >5\relax
+ \@toodeep
+ \else
+ \global\advance\@listdepth\@ne
+ \fi
+ \rightmargin\z@
+ \listparindent\z@
+ \itemindent\z@
+ \csname @list\romannumeral\the\@listdepth\endcsname
+ \def\@itemlabel{#1}%
+ \let\makelabel\@mklab
+ \@nmbrlistfalse
+ #2\relax
+ \@trivlist
+ \parskip\parsep
+ \parindent\listparindent
+ \advance\linewidth-\rightmargin
+ \advance\linewidth-\leftmargin
+ \advance\@totalleftmargin
+ \ifcase\bbl@thepardir\leftmargin\else\rightmargin\fi
+ \parshape\@ne\@totalleftmargin\linewidth
+ \ignorespaces}%
+ \def\labelenumii{)\theenumii(}%
+ \def\p@enumiii{\p@enumii)\theenumii(}}
+ {}
+\IfBabelLayout{contents}
+ {\def\@dottedtocline#1#2#3#4#5{%
+ \ifnum#1>\c@tocdepth\else
+ \vskip \z@ \@plus.2\p@
+ {\bbl@startskip#2\relax
+ \bbl@endskip\@tocrmarg
+ \parfillskip-\bbl@endskip
+ \parindent#2\relax
+ \@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima#3\relax
+ \advance\bbl@startskip\@tempdima
+ \null\nobreak\hskip-\bbl@startskip
+ {#4}\nobreak
+ \leaders\hbox{%
+ $\m@th\mkern\@dotsep mu\hbox{.}\mkern\@dotsep mu$}%
+ \hfill\nobreak
+ \hb@xt@\@pnumwidth{\hfil\normalfont\normalcolor#5}%
+ \par}%
+ \fi}}
+ {}
+\IfBabelLayout{columns}
+ {\def\@outputdblcol{%
+ \if@firstcolumn
+ \global\@firstcolumnfalse
+ \global\setbox\@leftcolumn\copy\@outputbox
+ \splitmaxdepth\maxdimen
+ \vbadness\maxdimen
+ \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
+ \setbox\@outputbox\vsplit\@outputbox to\maxdimen
+ \toks@\expandafter{\topmark}%
+ \xdef\@firstcoltopmark{\the\toks@}%
+ \toks@\expandafter{\splitfirstmark}%
+ \xdef\@firstcolfirstmark{\the\toks@}%
+ \ifx\@firstcolfirstmark\@empty
+ \global\let\@setmarks\relax
+ \else
+ \gdef\@setmarks{%
+ \let\firstmark\@firstcolfirstmark
+ \let\topmark\@firstcoltopmark}%
+ \fi
+ \else
+ \global\@firstcolumntrue
+ \setbox\@outputbox\vbox{%
+ \hb@xt@\textwidth{%
+ \hskip\columnwidth
+ \hfil
+ {\normalcolor\vrule \@width\columnseprule}%
+ \hfil
+ \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
+ \hskip-\textwidth
+ \hb@xt@\columnwidth{\box\@outputbox \hss}%
+ \hskip\columnsep
+ \hskip\columnwidth}}%
+ \@combinedblfloats
+ \@setmarks
+ \@outputpage
+ \begingroup
+ \@dblfloatplacement
+ \@startdblcolumn
+ \@whilesw\if@fcolmade \fi{\@outputpage
+ \@startdblcolumn}%
+ \endgroup
+ \fi}}%
+ {}
+% \end{macrocode}
+%
+% Implicitly reverses sectioning labels in bidi=basic-r, because
+% the full stop is not in contact with L numbers any more. A
+% think there must be a better way.
+%
+% \begin{macrocode}
+\IfBabelLayout{counters}% Global or language dependent? At begin doc?
+ {\let\bbl@latinarabic=\@arabic
+ \def\@arabic#1{\babelsublr{\bbl@latinarabic#1}}%
+ \let\bbl@asciiroman=\@roman
+ \def\@roman#1{\babelsublr{\ensureascii{\bbl@asciiroman#1}}}%
+ \let\bbl@asciiRoman=\@Roman
+ \def\@Roman#1{\babelsublr{\ensureascii{\bbl@asciiRoman#1}}}}{}
+%</texxet>
+% \end{macrocode}
+%
% \subsection{LuaTeX}
%
% The new loader for luatex is based solely on |language.dat|, which
@@ -10473,16 +10896,93 @@ help from Bernd Raichle, for which I am grateful.
\AddBabelHook{babel-fontspec}{afterextras}{\bbl@switchfont}
\DisableBabelHook{babel-fontspec}
<@Font selection@>
+% \end{macrocode}
+%
+% \subsection{Layout}
+%
+% \textbf{Work in progress}.
+%
+% Unlike \xetex{}, \luatex{} requires only minimal changes for
+% right-to-left layouts, particularly in monolingual documents (the
+% engine itself reverses boxes -- including column order or headings
+% --, margins, etc.) and with |bidi=basic-r|, without having to patch
+% almost any macro where text direction is relevant.
+%
+% |\@hangfrom| is useful in many contexts and it is redefined always
+% with the |layout| option.
+%
+% There are, however, a number of issues when the text direction is
+% not the same as the box direction (as set by |\bodydir|), and when
+% |\parbox| and |\hangindent| are involved. Fortunately, latest
+% releases of \luatex{} simplify a lot the solution with |\shapemode|.
+%
+% \begin{macrocode}
+\ifx\bbl@opt@layout\@nnil\endinput\fi % if no layout
+\ifx\bbl@beforeforeign\leavevmode % A poor test for bidi=
+ \def\@hangfrom#1{%
+ \setbox\@tempboxa\hbox{{#1}}%
+ \hangindent\wd\@tempboxa
+ \ifnum\bbl@getluadir{page}=\bbl@getluadir{par}\else
+ \shapemode\@ne
+ \fi
+ \noindent\box\@tempboxa}
+\fi
+\IfBabelLayout{lists}
+ {\def\list#1#2{%
+ \ifnum \@listdepth >5\relax
+ \@toodeep
+ \else
+ \global\advance\@listdepth\@ne
+ \fi
+ \rightmargin\z@
+ \listparindent\z@
+ \itemindent\z@
+ \csname @list\romannumeral\the\@listdepth\endcsname
+ \def\@itemlabel{#1}%
+ \let\makelabel\@mklab
+ \@nmbrlistfalse
+ #2\relax
+ \@trivlist
+ \parskip\parsep
+ \parindent\listparindent
+ \advance\linewidth -\rightmargin
+ \advance\linewidth -\leftmargin
+ \advance\@totalleftmargin \leftmargin
+ \parshape \@ne
+ \@totalleftmargin \linewidth
+ \ifnum\bbl@getluadir{page}=\bbl@getluadir{par}\else
+ \shapemode\tw@
+ \fi
+ \ignorespaces}}
+ {}
+% \end{macrocode}
+%
+% Implicitly reverses sectioning labels in bidi=basic-r, because
+% the full stop is not in contact with L numbers any more. I
+% think there must be a better way. Assumes |bidi=basic-r|, but
+% there are some additional readjustments for |bidi=default|.
+%
+% \begin{macrocode}
+\IfBabelLayout{counters}% Global or language dependent? At begin doc?
+ {\let\bbl@latinarabic=\@arabic
+ \def\@arabic#1{\babelsublr{\bbl@latinarabic#1}}%
+ \@ifpackagewith{babel}{bidi=default}
+ {\let\bbl@asciiroman=\@roman
+ \def\@roman#1{\babelsublr{\ensureascii{\bbl@asciiroman#1}}}%
+ \let\bbl@asciiRoman=\@Roman
+ \def\@Roman#1{\babelsublr{\ensureascii{\bbl@asciiRoman#1}}}%
+ \def\labelenumii{)\theenumii(}%
+ \def\p@enumiii{\p@enumii)\theenumii(}}}{}
%</luatex>
% \end{macrocode}
%
-% \section{Bidi support in \luatex}
+% \subsection{Auto bidi with \texttt{basic-r}}
%
% \changes{3.14}{2017/09/30}{LuaTeX - support for R/AL texts - basic-r}
%
-% \textbf{Work in progress}. The file \textsf{babel-bidi.lua}
-% currently only contains data. It's a large and boring file and it's
-% not shown here. See the generated file.
+% The file \textsf{babel-bidi.lua} currently only contains data. It is
+% a large and boring file and it's not shown here. See the generated
+% file.
%\iffalse
% \begin{macrocode}
%<*bidi>
@@ -16690,7 +17190,6 @@ function Babel.pre_otfload(head)
attr_dir = at.value
end
end
- texio.write_nl(attr_dir)
if attr_dir == 1 then
strong = 'r'
elseif attr_dir == 2 then
@@ -16702,6 +17201,7 @@ function Babel.pre_otfload(head)
outer = strong_lr
new_dir = false
end
+
if dir == 'nsm' then dir = strong end -- W1
% \end{macrocode}
%
diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins
index 21148e69505..024b1b80ad8 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{2017/11/03}
+\def\filedate{2018/01/04}
\def\batchfile{babel.ins}
\input docstrip.tex
@@ -137,6 +137,7 @@
\file{nil.ldf}{\from{babel.dtx}{nil}}
\file{xebabel.def}{\from{babel.dtx}{xetex}}
\file{luababel.def}{\from{babel.dtx}{luatex}}
+ \file{txtbabel.def}{\from{babel.dtx}{texxet}}
}
% Support for plain users
diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx
index 55e0ae6e0e3..f5689891895 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}[2017/11/03 v3.15]
+\ProvidesFile{bbcompat.dtx}[2018/01/04 v3.16]
%</dtx>
%
%% File 'bbcompat.dtx'
@@ -185,9 +185,8 @@
%<+estonian>\input estonian.ldf\relax
%<+finnish>\def\CurrentOption{finnish}
%<+finnish>\input finnish.ldf\relax
-%<+francais>\def\CurrentOption{francais}
-%<+french>\def\CurrentOption{french}
-%<+francais|french>\input frenchb.ldf\relax
+%<+francais>\def\CurrentOption{french}
+%<+francais>\input french.ldf\relax
%<+galician>\def\CurrentOption{galician}
%<+galician>\input galician.ldf\relax
%<+austrian>\def\CurrentOption{austrian}
diff --git a/Master/texmf-dist/source/latex/babel/locale.zip b/Master/texmf-dist/source/latex/babel/locale.zip
index b1a5b9dbfe2..d558310aa68 100644
--- a/Master/texmf-dist/source/latex/babel/locale.zip
+++ b/Master/texmf-dist/source/latex/babel/locale.zip
Binary files differ