diff options
author | Karl Berry <karl@freefriends.org> | 2021-01-26 21:47:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-01-26 21:47:29 +0000 |
commit | b160cf306d45454709fdbedefdd5bb3be65ad28c (patch) | |
tree | 3244de238f0f015e88ca4fbd274edbadac3a7d94 /Master/texmf-dist/source/latex | |
parent | eb7f2b3abbc0b1da0f7eb6e28319387ff7637b7a (diff) |
babel (26jan21)
git-svn-id: svn://tug.org/texlive/trunk@57530 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.dtx | 455 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/bbcompat.dtx | 2 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/locale.zip | bin | 777806 -> 778055 bytes |
4 files changed, 256 insertions, 205 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index ee0f127c4e1..1a19d9f2d35 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -1,7 +1,7 @@ % \iffalse % This document requires lualatex %% -%% Copyright (C) 2012-2020 Javier Bezos and Johannes L. Braams. +%% Copyright (C) 2012-2021 Javier Bezos and Johannes L. Braams. %% Copyright (C) 1989-2012 Johannes L. Braams and %% any individual authors listed elsewhere in this file. %% All rights reserved. @@ -31,7 +31,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2020/12/16 v3.52 The Babel package] +\ProvidesFile{babel.dtx}[2021/01/26 v3.53 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -202,13 +202,14 @@ Version \csname @gobble\expandafter\endcsname\fileversion\newline \filedate -\vspace{1cm} -\textit{Original author}\newline -Johannes L. Braams +\LARGE +\vspace{1.2cm} +Johannes L. Braams\\[-.5ex] +{\large Original author} \vspace{.3cm} -\textit{Current maintainer}\newline -Javier Bezos +Javier Bezos\\[-.5ex] +{\large Current maintainer} \end{minipage} &\cellcolor[rgb]{.92, .86, .73} \vspace{2cm} @@ -296,7 +297,7 @@ other packages detect and use it. This is the standard way in \LaTeX{} for an option – in this case a language – to be recognized by several packages. -Many languages are compatible with \textsf{xetex} and \textsf{luatex},. +Many languages are compatible with \textsf{xetex} and \textsf{luatex}. With them you can use \babel{} to localize the documents. When these engines are used, the Latin script is covered by default in current \LaTeX{} (provided the document encoding is UTF-8), because the font @@ -308,15 +309,13 @@ attributes with \textsf{fontspec}, too. Here is a simple full example for “traditional” \TeX{} engines (see below for \xetex{} and \luatex{}). The packages |fontenc| and |inputenc| do not belong to \babel, but they are included in the - example because typically you will need them (however, the package - \textsf{inputenc} may be omitted with \LaTeX{} $\ge$ 2018-04-01 if - the encoding is UTF-8): + example because typically you will need them. It assumes UTF-8, the + default encoding: \setengine{pdftex} \begin{verbatim} \documentclass{article} \usepackage[T1]{fontenc} -% \usepackage[utf8]{inputenc} % Uncomment if LaTeX < 2018-04-01 _\usepackage[french]{babel}_ @@ -487,15 +486,13 @@ detail: |\selectlanguage| is used for blocks of text, while |\foreignlanguage| is for chunks of text inside paragraphs. \begin{example} -A full bilingual document follows. The main language is |french|, which -is activated when the document begins. The package \textsf{inputenc} -may be omitted with \LaTeX{} $\ge$ 2018-04-01 if the encoding is UTF-8. +A full bilingual document with \pdftex{} follows. The main language is +|french|, which is activated when the document begins. It assumes UTF-8: \setengine{pdftex} \begin{verbatim} \documentclass{article} \usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} _\usepackage[english,french]{babel}_ @@ -557,18 +554,19 @@ 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: + A trivial document with the default font in English and Spanish, and + FreeSerif in Russian is: \setengine{luatex/xetex} \begin{verbatim} \documentclass[english]{article} \usepackage{babel} -\babelfont[russian]{rm}{FreeSerif} +_\babelfont[russian]{rm}{FreeSerif}_ \begin{document} -English. \foreignlanguage{russian}{Русский}. -\foreignlanguage{spanish}{Español} +English. _\foreignlanguage{russian}{Русский}_. +_\foreignlanguage{spanish}{Español}_. \end{document} \end{verbatim} @@ -712,7 +710,7 @@ can write: \foreignlanguage[date]{polish}{\today} \end{verbatim} In addition, captions can be switched with |captions| (or both, of -course, with |date, captions|). Until 3.43 you had to write something +course, with |date,| |captions|). Until 3.43 you had to write something like |{\selectlanguage{..} ..}|, which was not always the most convenient way. @@ -761,11 +759,11 @@ for instance be used to select `nohyphenation', provided that in loading \file{zerohyph.tex}. It deactivates language shorthands, too (but not user shorthands). -Except for these simple uses, |hyphenrules| is discouraged and -|otherlanguage*| (the starred version) is preferred, as the former does -not take into account possible changes in encodings of characters like, -say, |'| done by some languages (eg, \textsf{italian}, \textsf{french}, -\textsf{ukraineb}). To set hyphenation exceptions, use +Except for these simple uses, |hyphenrules| is deprecated and +|otherlanguage*| (the starred version) is preferred, because the former +does not take into account possible changes in encodings of characters +like, say, |'| done by some languages (eg, \textsf{italian}, +\textsf{french}, \textsf{ukraineb}). To set hyphenation exceptions, use |\babelhyphenation| (see below). \subsection{More on selection} @@ -782,6 +780,17 @@ It defines |\text|\m{tag1}\marg{text} to be to be |\begin{otherlanguage*}|\marg{language1}, and so on. Note |\|\m{tag1} is also allowed, but remember to set it locally inside a group. + +\begin{warning} + There is a clear drawback to this feature, namely, the ‘prefix’ + |\text...| is heavily overloaded in \LaTeX{} and conflicts with + existing macros may arise (|\textlatin|, |\textbar|, |\textit|, + |\textcolor| and many others). The same applies to environments, + because |arabic| conflicts with |\arabic|. Except if there is a + reason for this ‘syntactical sugar’, the best option is to stick to + the default selectors or to define your own alternatives. +\end{warning} + \begin{example} With \begin{verbatim} @@ -834,7 +843,7 @@ language to wrap them with a selector: By default only the basic captions and |\today| are redefined, but you can add further macros with the key |include| in the optional argument (without commas). Macros not to be modified are listed in -|exclude|. You can also enforce a font encoding with +|exclude|. You can also enforce a font encoding with the option |fontenc|.\footnote{With it, encoded strings may not work as expected.} A couple of examples: \begin{verbatim} @@ -854,7 +863,7 @@ With |ini| files (see below), captions are ensured by default. A \textit{shorthand} is a sequence of one or two characters that expands to arbitrary \TeX{} code. -Shorthands can be used for different kinds of things, for example: +Shorthands can be used for different kinds of things; for example: (1) in some languages shorthands such as |"a| are defined to be able to hyphenate the word if the encoding is |OT1|; (2) in some languages shorthands such as |!| are used to insert the right amount of white @@ -869,22 +878,20 @@ Unicode characters). As to the point 2, now \textsf{pdfTeX} provides |\knbccode|, and \luatex{} can manipulate the glyph list. Tools for point 3 can be still very useful in general. -There are three levels of shorthands: \textit{user}, -\textit{language}, and \textit{system} (by order of -precedence). Version 3.9 introduces the \textit{language user} level -on top of the user level, as described below. In most cases, you will -use only shorthands provided by languages. +There are four levels of shorthands: \textit{user}, \textit{language}, +\textit{system}, and \textit{language user} (by order of precedence). +In most cases, you will use only shorthands provided by languages. -\begin{note} Note the following: +\begin{note} Keep in mind the following: \begin{enumerate} \item Activated chars used for two-char shorthands cannot be followed by a closing brace |}| and the spaces following are gobbled. With one-char shorthands (eg,~|:|), they are preserved. -\item If on a certain level (system, language, user) there is a - one-char shorthand, two-char ones starting with that - char and on the same level are ignored. +\item If on a certain level (system, language, user, language user) + there is a one-char shorthand, two-char ones starting with that char + and on the same level are ignored. \item Since they are active, a shorthand cannot contain the same - character in its definition (except if it is deactivated with, eg, + character in its definition (except if deactivated with, eg, |\string|). \end{enumerate} \end{note} @@ -1392,12 +1399,11 @@ Or also: \begin{description} \itemsep=-\parskip \item[Arabic] Monolingual documents mostly work in \luatex, but it must - be fine tuned, and a recent version of - \textsf{fontspec}/\textsf{loaotfload} is required. In \xetex{} + be fine tuned, particularly graphical elements like |picture|. In \xetex{} \babel{} resorts to the \textsf{bidi} package, which seems to work. -\item[Hebrew] Niqqud marks seem to work in both engines, but - cantillation marks are misplaced (\xetex{} or \luatex{} with Harfbuzz - seems better, but still problematic). +\item[Hebrew] Niqqud marks seem to work in both engines, but depending + on the font cantillation marks might be misplaced (\xetex{} or + \luatex{} with Harfbuzz seems better, but still problematic). \item[Devanagari] In \luatex{} and the the default renderer many fonts work, but some others do not, the main issue being the ‘ra’. You may need to set explicitly the script to either |deva| or |dev2|, eg: @@ -1406,8 +1412,8 @@ need to set explicitly the script to either |deva| or |dev2|, eg: \end{verbatim} Other Indic scripts are still under development in the default \luatex{} renderer, but should work with |Renderer=Harfbuzz|. They - also work with \xetex{}, although fine tuning the font behavior is - not always possible. + also work with \xetex{}, although unlike with \luatex{} fine tuning + the font behavior is not always possible. \item[Southeast scripts] Thai works in both \luatex{} and \xetex{}, but line breaking differs (rules can be modified in \luatex; they are hard-coded in \xetex). Lao seems to work, too, but there are no @@ -2232,8 +2238,8 @@ 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 can be problematic, and also a “lower-level” - font selection is useful. + for several of them can be problematic, and also preserving a + “lower-level” font selection is useful. \end{note} \begin{note} @@ -2368,11 +2374,13 @@ is by means of |\babelprovide|, described below in depth. So, something like: \begin{verbatim} \usepackage[danish]{babel} -\babelprovide[captions=da,hyphenrules=nohyphenation]{danish} +\babelprovide[captions=da, hyphenrules=nohyphenation]{danish} \end{verbatim} first loads |danish.ldf|, and then redefines the captions for \texttt{danish} (as provided by the |ini| file) and prevents hyphenation. The rest of the language definitions are not touched. +Without the optional argument it just loads some aditional tools if +provided by the |ini| file, like extra counters. \subsection{Creating a language} @@ -2402,8 +2410,9 @@ you will find alerts like that in the |log| file: \begin{verbatim} Package babel Warning: \mylangchaptername not set. Please, define it (babel) after the language has been loaded (typically -(babel) in the preamble) with something like: -(babel) \renewcommand\maylangchaptername{..} +(babel) in the preamble) with the help of +(babel) \setlocalecaption. An example is: +(babel) \setlocalecaption{mylang}{chapter}{..} (babel) Reported on input line 18. \end{verbatim} @@ -2415,8 +2424,8 @@ languages loaded on the fly are not yet available in the preamble. \begin{verbatim} \usepackage[danish]{babel} \babelprovide{arhinish} -\renewcommand\arhinishchaptername{Chapitula} -\renewcommand\arhinishrefname{Refirenke} +\setlocalecaption{arhinish}{chapter}{Chapitula} +\setlocalecaption{arhinish}{refname}{Refirenke} \renewcommand\arhinishhyphenmins{22} \end{verbatim} \end{example} @@ -2512,6 +2521,10 @@ languages. \usepackage[italian]{babel} \babelprovide[import, main]{polytonicgreek} \end{verbatim} +Remerber there is an alternative syntax for the latter: +\begin{verbatim} +\usepackage[italian, polytonicgreek, provide=*]{babel} +\end{verbatim} \end{example} \Describe{script=}{\meta{script-name}} @@ -3031,7 +3044,7 @@ future implementation may alternatively accept \textsf{lpeg}. \marg{lua-pattern}\marg{replacement}} \New{3.44-3-52} This command is not strictly about hyphenation, but -it is include here because it is a clear counterpart of +it is included here because it is a clear counterpart of |\babelposthyphenation|. It is similar to the latter, but (as its name implies) applied before hyphenation. There are other differences: (1) the first argument is the locale instead the name of hyphenation @@ -3042,7 +3055,7 @@ discretionaries are not accepted. It handles glyphs and spaces (but you can not insert spaces). Performance is still somewhat poor in some cases, but it is fast in the -most the typical ones. +typical ones. This feature is activated with the first |\babelposthyphenation| or |\babelprehyphenation|. @@ -3102,16 +3115,16 @@ Here is a minimal example: \usepackage[danish]{babel} -\babeladjust{ - autoload.bcp47 = on, - autoload.bcp47.options = import -} +_\babeladjust{_ +_ autoload.bcp47 = on,_ +_ autoload.bcp47.options = import_ +_}_ \begin{document} Chapter in Danish: \chaptername. -\selectlanguage{de-AT} +_\selectlanguage{de-AT}_ \localedate{2020}{1}{30} @@ -3128,7 +3141,7 @@ options make sense depending on the particular needs of each document The behaviour is adjusted with |\babeladjust| with the following parameters: \begin{description} -\item \texttt{autoload.bcp47} with values on and off. +\item \texttt{autoload.bcp47} with values |on| and |off|. \item \texttt{autoload.bcp47.options}, which are passed to |\babelprovide|; empty by default, but you may add \texttt{import} (features defined in the corresponding |babel-...tex| file might not @@ -3800,7 +3813,6 @@ deactivate other related options (like paragraph direction with \addto\extrasfrench{\inputencoding{latin1}} \addto\extrasrussian{\inputencoding{koi8-r}} \end{verbatim} - (A recent version of \textsf{inputenc} is required.) \item For the hyphenation to work correctly, lccodes cannot change, because \TeX{} only takes into account the values when the paragraph is hyphenated, i.e., when it has been @@ -4753,6 +4765,8 @@ help from Bernd Raichle, for which I am grateful. % % \part{Source code} % +% \small +% % \babel{} is being developed incrementally, which means parts of the % code are under development and therefore incomplete. Only documented % features are considered complete. In other words, use \babel{} only @@ -4837,8 +4851,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<<version=3.52>> -%<<date=2020/12/16>> +%<<version=3.53>> +%<<date=2021/01/26>> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -5287,11 +5301,12 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname \global\@namedef{#2}{\textbf{?#1?}}% \@nameuse{#2}% - \bbl@warning{% + \bbl@warning{% TODO. \@backslashchar#2 not set. Please, define it\\% after the language has been loaded (typically\\% - in the preamble) with something like:\\% - \string\renewcommand\@backslashchar#2{..}\\% + in the preamble) with the help of\\% + \string\setlocalecaption. An example is:\\% + \string\setlocalecaption{mylang}{chapter}{..}\\ Reported}} \def\bbl@tentative{\protect\bbl@tentative@i} \def\bbl@tentative@i#1{% @@ -7385,12 +7400,28 @@ help from Bernd Raichle, for which I am grateful. \expandafter\ifx\csname date\languagename\endcsname\relax\else \if@filesw \ifx\babel@aux\@gobbletwo\else % Set if single in the first, redundant + % \bbl@savelastskip \protected@write\@auxout{}{\string\babel@aux{\bbl@auxname}{}}% + % \bbl@restorelastskip \fi \bbl@usehooks{write}{}% \fi \fi} -% +% The following is used above to deal with skips before the write +% whatsit. Adapted from hyperref, but it might fail, so for the moment +% it's not activated. TODO. +\def\bbl@savelastskip{% + \let\bbl@restorelastskip\relax + \ifvmode + \ifdim\lastskip=\z@ + \let\bbl@restorelastskip\nobreak + \else + \bbl@exp{% + \def\\\bbl@restorelastskip{% + \skip@=\the\lastskip + \\\nobreak \vskip-\skip@ \vskip\skip@}}% + \fi + \fi} \newif\ifbbl@bcpallowed \bbl@bcpallowedfalse \def\select@language#1{% from set@, babel@aux @@ -7910,8 +7941,9 @@ help from Bernd Raichle, for which I am grateful. \bbl@warning{% \@backslashchar#2 not set. Please, define it\\% after the language has been loaded (typically\\% - in the preamble) with something like:\\% - \string\renewcommand\@backslashchar#2{..}\\% + in the preamble) with the help of\\% + \string\setlocalecaption. An example is\\% + \string\setlocalecaption{mylang}{chapter}{..}\\ Reported}} \def\bbl@tentative{\protect\bbl@tentative@i} \def\bbl@tentative@i#1{% @@ -8236,7 +8268,7 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \bbl@trace{Macros for setting language files up} -\def\bbl@ldfinit{% TODO. Merge into the next macro? Unused elsewhere +\def\bbl@ldfinit{% \let\bbl@screset\@empty \let\BabelStrings\bbl@opt@string \let\BabelOptions\@empty @@ -10027,53 +10059,58 @@ help from Bernd Raichle, for which I am grateful. \newcommand\setlocalecaption{% TODO. Catch typos. What about ensure? \@ifstar\bbl@setcaption@s\bbl@setcaption@x} \def\bbl@setcaption@x#1#2#3{% language caption-name string - \edef\bbl@tempa{#1}% - \edef\bbl@tempd{% - \expandafter\expandafter\expandafter - \strip@prefix\expandafter\meaning\csname captions#1\endcsname}% - \bbl@xin@ - {\expandafter\string\csname #2name\endcsname}% - {\bbl@tempd}% - \ifin@ % Renew caption - \bbl@xin@{\string\bbl@scset}{\bbl@tempd}% - \ifin@ - \bbl@exp{% - \\\bbl@ifsamestring{\bbl@tempa}{\languagename}% - {\\\bbl@scset\<#2name>\<#1#2name>}% - {}}% - \else % Old way converts to new way - \bbl@ifunset{#1#2name}% - {\bbl@exp{% - \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}% + \bbl@trim@def\bbl@tempa{#2}% + \bbl@xin@{.template}{\bbl@tempa}% + \ifin@ + \bbl@ini@captions@template{#3}{#1}% + \else + \edef\bbl@tempd{% + \expandafter\expandafter\expandafter + \strip@prefix\expandafter\meaning\csname captions#1\endcsname}% + \bbl@xin@ + {\expandafter\string\csname #2name\endcsname}% + {\bbl@tempd}% + \ifin@ % Renew caption + \bbl@xin@{\string\bbl@scset}{\bbl@tempd}% + \ifin@ + \bbl@exp{% + \\\bbl@ifsamestring{\bbl@tempa}{\languagename}% + {\\\bbl@scset\<#2name>\<#1#2name>}% + {}}% + \else % Old way converts to new way + \bbl@ifunset{#1#2name}% + {\bbl@exp{% + \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}% + \\\bbl@ifsamestring{\bbl@tempa}{\languagename}% + {\def\<#2name>{\<#1#2name>}}% + {}}}% + {}% + \fi + \else + \bbl@xin@{\string\bbl@scset}{\bbl@tempd}% New + \ifin@ % New way + \bbl@exp{% + \\\bbl@add\<captions#1>{\\\bbl@scset\<#2name>\<#1#2name>}% + \\\bbl@ifsamestring{\bbl@tempa}{\languagename}% + {\\\bbl@scset\<#2name>\<#1#2name>}% + {}}% + \else % Old way, but defined in the new way + \bbl@exp{% + \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}% \\\bbl@ifsamestring{\bbl@tempa}{\languagename}% {\def\<#2name>{\<#1#2name>}}% - {}}}% - {}% + {}}% + \fi% + \fi + \@namedef{#1#2name}{#3}% + \toks@\expandafter{\bbl@captionslist}% + \bbl@exp{\\\in@{\<#2name>}{\the\toks@}}% + \ifin@\else + \bbl@exp{\\\bbl@add\\\bbl@captionslist{\<#2name>}}% + \bbl@toglobal\bbl@captionslist \fi - \else - \bbl@xin@{\string\bbl@scset}{\bbl@tempd}% New - \ifin@ % New way - \bbl@exp{% - \\\bbl@add\<captions#1>{\\\bbl@scset\<#2name>\<#1#2name>}% - \\\bbl@ifsamestring{\bbl@tempa}{\languagename}% - {\\\bbl@scset\<#2name>\<#1#2name>}% - {}}% - \else % Old way, but defined in the new way - \bbl@exp{% - \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}% - \\\bbl@ifsamestring{\bbl@tempa}{\languagename}% - {\def\<#2name>{\<#1#2name>}}% - {}}% - \fi% - \fi - \@namedef{#1#2name}{#3}% - \toks@\expandafter{\bbl@captionslist}% - \bbl@exp{\\\in@{\<#2name>}{\the\toks@}}% - \ifin@\else - \bbl@exp{\\\bbl@add\\\bbl@captionslist{\<#2name>}}% - \bbl@toglobal\bbl@captionslist \fi} -% \def\bbl@setcaption@s#1#2#3{} % Not yet implemented +% \def\bbl@setcaption@s#1#2#3{} % TODO. Not yet implemented % \end{macrocode} % % \subsection{Macros common to a number of languages} @@ -10637,6 +10674,20 @@ help from Bernd Raichle, for which I am grateful. \else \bbl@csarg\def{KVP@##1}{##2}% \fi}% + % == init == + \ifx\bbl@screset\@undefined + \bbl@ldfinit + \fi + % == + \let\bbl@lbkflag\relax % \@empty = do setup linebreak + \bbl@ifunset{date#2}% + {\let\bbl@lbkflag\@empty}% new + {\ifx\bbl@KVP@hyphenrules\@nil\else + \let\bbl@lbkflag\@empty + \fi + \ifx\bbl@KVP@import\@nil\else + \let\bbl@lbkflag\@empty + \fi}% % == import, captions == \ifx\bbl@KVP@import\@nil\else \bbl@exp{\\\bbl@ifblank{\bbl@KVP@import}}% @@ -10657,30 +10708,31 @@ help from Bernd Raichle, for which I am grateful. \bbl@ifunset{date#2}% {\bbl@provide@new{#2}}% {\bbl@ifblank{#1}% - {\bbl@error - {If you want to modify `#2' you must tell how in\\% - the optional argument. See the manual for the\\% - available options.}% - {Use this macro as documented}}% + {}% With \bbl@load@basic below {\bbl@provide@renew{#2}}}% % Post tasks - \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]{% - \\\foreignlanguage{\languagename}% - {####1}}}}% - {}% - \bbl@exp{% - \\\bbl@toglobal\<bbl@ensure@\languagename>% - \\\bbl@toglobal\<bbl@ensure@\languagename\space>}% + % ---------- + % == ensure captions == + \ifx\bbl@KVP@captions\@nil\else + \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]{% + \\\foreignlanguage{\languagename}% + {####1}}}}% + {}% + \bbl@exp{% + \\\bbl@toglobal\<bbl@ensure@\languagename>% + \\\bbl@toglobal\<bbl@ensure@\languagename\space>}% + \fi + % == % At this point all parameters are defined if 'import'. Now we % execute some code depending on them. But what about if nothing was - % imported? We just load the very basic parameters. + % imported? We just set the very basic parameters. \bbl@load@basic{#2}% % == script, language == % Override the values from ini or defines them @@ -10777,30 +10829,31 @@ help from Bernd Raichle, for which I am grateful. \bbl@csarg\edef{intsp@#2}{\bbl@KVP@intraspace}% \fi \bbl@provide@intraspace - % == Line breaking: hyphenate.other.locale == - \bbl@ifunset{bbl@hyotl@\languagename}{}% - {\bbl@csarg\bbl@replace{hyotl@\languagename}{ }{,}% - \bbl@startcommands*{\languagename}{}% - \bbl@csarg\bbl@foreach{hyotl@\languagename}{% + % == Line breaking: hyphenate.other.locale/.script== + \ifx\bbl@lbkflag\@empty + \bbl@ifunset{bbl@hyotl@\languagename}{}% + {\bbl@csarg\bbl@replace{hyotl@\languagename}{ }{,}% + \bbl@startcommands*{\languagename}{}% + \bbl@csarg\bbl@foreach{hyotl@\languagename}{% + \ifcase\bbl@engine + \ifnum##1<257 + \SetHyphenMap{\BabelLower{##1}{##1}}% + \fi + \else + \SetHyphenMap{\BabelLower{##1}{##1}}% + \fi}% + \bbl@endcommands}% + \bbl@ifunset{bbl@hyots@\languagename}{}% + {\bbl@csarg\bbl@replace{hyots@\languagename}{ }{,}% + \bbl@csarg\bbl@foreach{hyots@\languagename}{% \ifcase\bbl@engine \ifnum##1<257 - \SetHyphenMap{\BabelLower{##1}{##1}}% + \global\lccode##1=##1\relax \fi \else - \SetHyphenMap{\BabelLower{##1}{##1}}% - \fi}% - \bbl@endcommands}% - % == Line breaking: hyphenate.other.script == - \bbl@ifunset{bbl@hyots@\languagename}{}% - {\bbl@csarg\bbl@replace{hyots@\languagename}{ }{,}% - \bbl@csarg\bbl@foreach{hyots@\languagename}{% - \ifcase\bbl@engine - \ifnum##1<257 \global\lccode##1=##1\relax - \fi - \else - \global\lccode##1=##1\relax - \fi}}% + \fi}}% + \fi % == Counters: maparabic == % Native digits, if provided in ini (TeX level, xe and lua) \ifcase\bbl@engine\else @@ -10990,7 +11043,9 @@ help from Bernd Raichle, for which I am grateful. \EndBabelCommands \fi % == hyphenrules == - \bbl@provide@hyphens{#1}} + \ifx\bbl@lbkflag\@empty + \bbl@provide@hyphens{#1}% + \fi} % Load the basic parameters (ids, typography, counters, and a few % more), while captions and dates are left out. But it may happen some % data has been loaded before automatically, so we first discard the @@ -11049,10 +11104,10 @@ help from Bernd Raichle, for which I am grateful. {\bbl@exp{\let\bbl@tempa\<l@##1>}}% \fi}% \fi - \ifx\bbl@tempa\relax % if no opt or no language in opt found + \ifx\bbl@tempa\relax % if no opt or no language in opt found \ifx\bbl@KVP@import\@nil \ifx\bbl@initoload\relax\else - \bbl@exp{% and hyphenrules is not empty + \bbl@exp{% and hyphenrules is not empty \\\bbl@ifblank{\bbl@cs{hyphr@#1}}% {}% {\let\\\bbl@tempa\<l@\bbl@cl{hyphr}>}}% @@ -11069,7 +11124,6 @@ help from Bernd Raichle, for which I am grateful. {\bbl@exp{\\\adddialect\<l@#1>\language}}% {}}% so, l@<lang> is ok - nothing to do {\bbl@exp{\\\adddialect\<l@#1>\bbl@tempa}}}% found in opt list or ini - % \end{macrocode} % % The reader of |ini| files. There are 3 possible cases: a section name @@ -11338,37 +11392,29 @@ help from Bernd Raichle, for which I am grateful. % The auxiliary macro for captions define |\<caption>name|. % % \begin{macrocode} +\def\bbl@ini@captions@template#1#2{% string language tempa=capt-name + \bbl@replace\bbl@tempa{.template}{}% + \def\bbl@toreplace{#1{}}% + \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,appendix,part,}% + \ifin@ + \@nameuse{bbl@patch\bbl@tempa}% + \global\bbl@csarg\let{\bbl@tempa fmt@#2}\bbl@toreplace + \fi + \bbl@xin@{,\bbl@tempa,}{,figure,table,}% + \ifin@ + \toks@\expandafter{\bbl@toreplace}% + \bbl@exp{\gdef\<fnum@\bbl@tempa>{\the\toks@}}% + \fi} \def\bbl@ini@captions@aux#1#2{% \bbl@trim@def\bbl@tempa{#1}% \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 + \bbl@ini@captions@template{#2}\languagename \else \bbl@ifblank{#2}% {\bbl@exp{% @@ -11457,7 +11503,7 @@ help from Bernd Raichle, for which I am grateful. % but not all. Actually, the following lines are somewhat tentative. % % \begin{macrocode} -\def\bbl@chaptype{chap} +\def\bbl@chaptype{chapter} \ifx\@makechapterhead\@undefined \let\bbl@patchchapter\relax \else\ifx\thechapter\@undefined @@ -11467,7 +11513,7 @@ help from Bernd Raichle, for which I am grateful. \else \def\bbl@patchchapter{% \global\let\bbl@patchchapter\relax - \bbl@add\appendix{\def\bbl@chaptype{appx}}% Not harmful, I hope + \bbl@add\appendix{\def\bbl@chaptype{appendix}}% Not harmful, I hope \bbl@toglobal\appendix \bbl@sreplace\ps@headings {\@chapapp\ \thechapter}% @@ -11485,6 +11531,7 @@ help from Bernd Raichle, for which I am grateful. \bbl@ifunset{bbl@\bbl@chaptype fmt@\languagename}% {\@chapapp\space\thechapter} {\@nameuse{bbl@\bbl@chaptype fmt@\languagename}}}} + \let\bbl@patchappendix\bbl@patchchapter \fi\fi\fi \ifx\@part\@undefined \let\bbl@patchpart\relax @@ -13230,10 +13277,10 @@ help from Bernd Raichle, for which I am grateful. % First, some general code for line breaking, used by % |\babelposthyphenation|. % -% \textit{In progress.} Replace regular (ie, implicit) discretionaries -% by spaceskips, based on the previous glyph (which I think makes -% sense, because the hyphen and the previous char go always together). -% Other discretionaries are not touched. See Unicode UAX 14. +% Replace regular (ie, implicit) discretionaries by spaceskips, based +% on the previous glyph (which I think makes sense, because the hyphen +% and the previous char go always together). Other discretionaries are +% not touched. See Unicode UAX 14. % % \begin{macrocode} % TODO - to a lua file @@ -13486,6 +13533,7 @@ help from Bernd Raichle, for which I am grateful. % TODO - to a lua file \directlua{ Babel.script_blocks = { + ['dflt'] = {}, ['Arab'] = {{0x0600, 0x06FF}, {0x08A0, 0x08FF}, {0x0750, 0x077F}, {0xFE70, 0xFEFF}, {0xFB50, 0xFDFF}, {0x1EE00, 0x1EEFF}}, ['Armn'] = {{0x0530, 0x058F}}, @@ -14224,26 +14272,23 @@ end {} \IfBabelLayout{graphics} {\let\bbl@pictresetdir\relax - \def\bbl@pictsetdir{% + \def\bbl@pictsetdir#1{% \ifcase\bbl@thetextdir \let\bbl@pictresetdir\relax \else - \textdir TLT\relax - \def\bbl@pictresetdir{\textdir TRT\relax}% + \bodydir TLT + % \(text|par)dir required in pgf: + \def\bbl@pictresetdir{\bodydir TRT\pardir TRT\textdir TRT\relax}% \fi}% - \let\bbl@OL@@picture\@picture - \let\bbl@OL@put\put - \bbl@sreplace\@picture{\hskip-}{\bbl@pictsetdir\hskip-}% - \def\put(#1,#2)#3{% Not easy to patch. Better redefine. - \@killglue - \raise#2\unitlength - \hb@xt@\z@{\kern#1\unitlength{\bbl@pictresetdir#3}\hss}}% + \ifx\AddToHook\@undefined\else + \AddToHook{env/picture/begin}{\bbl@pictsetdir\z@}% + \fi \AtBeginDocument {\ifx\tikz@atbegin@node\@undefined\else \let\bbl@OL@pgfpicture\pgfpicture \bbl@sreplace\pgfpicture{\pgfpicturetrue}% - {\bbl@pictsetdir\pgfpicturetrue}% - \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir}% + {\bbl@pictsetdir\@ne\pgfpicturetrue}% + \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir\@ne}% \bbl@add\tikz@atbegin@node{\bbl@pictresetdir}% \fi}} {} @@ -20950,7 +20995,13 @@ function Babel.bidi(head, ispar, hdir) first_et = nil has_en = false end - + + -- Force mathdir in math if ON (currently works as expected only + -- with 'l') + if inmath and d == 'on' then + d = ('TRT' == tex.mathdir) and 'r' or 'l' + end + if d then if d == 'al' then d = 'r' diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins index b362ca94e91..cd1597a837a 100644 --- a/Master/texmf-dist/source/latex/babel/babel.ins +++ b/Master/texmf-dist/source/latex/babel/babel.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 2012-2020 Javier Bezos and Johannes L. Braams. +%% Copyright 2012-2021 Javier Bezos and Johannes L. Braams. %% Copyright 1989-2008 Johannes L. Braams and any individual authors %% listed elsewhere in this file. All rights reserved. %% @@ -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{2020/12/16} +\def\filedate{2021/01/26} \def\batchfile{babel.ins} \input docstrip.tex diff --git a/Master/texmf-dist/source/latex/babel/bbcompat.dtx b/Master/texmf-dist/source/latex/babel/bbcompat.dtx index fb1977f094a..84c388a78cc 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}[2020/12/16 v3.52] +\ProvidesFile{bbcompat.dtx}[2021/01/26 v3.53] %</dtx> % %% File 'bbcompat.dtx' diff --git a/Master/texmf-dist/source/latex/babel/locale.zip b/Master/texmf-dist/source/latex/babel/locale.zip Binary files differindex e90a725a782..a04b7bdfeb7 100644 --- a/Master/texmf-dist/source/latex/babel/locale.zip +++ b/Master/texmf-dist/source/latex/babel/locale.zip |