From 7bed24813daab3ed3c3064781cb74cf8081adb4d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 27 Sep 2019 21:26:38 +0000 Subject: babel (27sep19) git-svn-id: svn://tug.org/texlive/trunk@52194 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/babel/README.md | 32 +- Master/texmf-dist/doc/latex/babel/babel.pdf | Bin 693345 -> 701228 bytes Master/texmf-dist/source/latex/babel/babel.dtx | 552 +++++++++++++-------- Master/texmf-dist/source/latex/babel/babel.ins | 2 +- Master/texmf-dist/source/latex/babel/bbcompat.dtx | 2 +- Master/texmf-dist/source/latex/babel/locale.zip | Bin 712101 -> 712099 bytes Master/texmf-dist/tex/generic/babel/babel.def | 125 +++-- Master/texmf-dist/tex/generic/babel/babel.sty | 39 +- Master/texmf-dist/tex/generic/babel/hyphen.cfg | 2 +- .../tex/generic/babel/locale/tr/babel-turkish.tex | 2 +- Master/texmf-dist/tex/generic/babel/luababel.def | 83 +++- Master/texmf-dist/tex/generic/babel/nil.ldf | 2 +- Master/texmf-dist/tex/generic/babel/switch.def | 10 +- Master/texmf-dist/tex/generic/babel/xebabel.def | 59 ++- 14 files changed, 593 insertions(+), 317 deletions(-) diff --git a/Master/texmf-dist/doc/latex/babel/README.md b/Master/texmf-dist/doc/latex/babel/README.md index 40ce729ea67..5c1718d7638 100644 --- a/Master/texmf-dist/doc/latex/babel/README.md +++ b/Master/texmf-dist/doc/latex/babel/README.md @@ -1,4 +1,4 @@ -## Babel 3.33 +## Babel 3.34 This package manages culturally-determined typographical (and other) rules, and hyphenation patterns for a wide range of languages. Many @@ -51,12 +51,18 @@ respective authors. ### Latest changes ``` +3.34 2019-09-27 + - Improved compatibility for \babelfont vs \setmainfont. + - Fix - active ' entered in an infinite loop with lua. + - Fix - main in \babelprovide was not set until begin document. + 3.33 2019-07-19 - \prehyphenchar set to 0 in languages requiring it: kannada, marathi, tamil, etc. (lua). - \AddBabelHook can be set for specific languages. - Fix - !\grq in T1 behaved like the ligature !`. - Minimal preliminary support for the experimental harftex. + 3.32 2019-06-03 - CJK line breaking is now disabled in verbatim (lua). - New - \babelcharproperty, to change the direction, mirroring @@ -119,30 +125,6 @@ respective authors. - Set the \thepage bidi bahavior in foots/heads. - Fix - Undefined \bbl@stripslash in Plain. -3.22 2018-06-05 - - Fix - Error with \chapter if empty in ini - - Prelimimary support for Sanskrit - - Unknown languages in aux files do not raise an error - any more (only show a warning). - -3.21 2018-05-10 - - Fix - equation numbers raised an error. - - Two minor changes: if no language is requested load nil - instead of raising an error, and the message 'babel ...' - is not printed to the log any more. - -3.20 2018-05-02 - - ini files with the field digits.native define - \digits and \counters. \arabic can be - redefined to use native digits. - - Fix - mapfont in bidi=basic didn't take into account combining - marks (eg, Arabic vowels). - - Fix - A bug introduced in 3.19, which sometimes reversed text - in \hbox'es. - - Fix for luatex 1.07 - An internal change in luatex broke - bidi at 'automatic' hyphens. - - Fix for latest latex - babel.ins raised an error. - ``` Javier Bezos diff --git a/Master/texmf-dist/doc/latex/babel/babel.pdf b/Master/texmf-dist/doc/latex/babel/babel.pdf index 1fc17020fd4..5d548ccc3ef 100644 Binary files a/Master/texmf-dist/doc/latex/babel/babel.pdf and b/Master/texmf-dist/doc/latex/babel/babel.pdf differ diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index c26a20a7483..86d4890e348 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -31,7 +31,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2019/07/19 v3.33 The Babel package] +\ProvidesFile{babel.dtx}[2019/09/27 v3.34 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -267,7 +267,7 @@ Javier Bezos \subsection{Monolingual documents} In most cases, a single language is required, and then all you need in -\LaTeX{} is to load the package using its standand mechanism for this +\LaTeX{} is to load the package using its standard mechanism for this purpose, namely, passing that language as an optional argument. In addition, you may want to set the font and input encodings. @@ -282,7 +282,7 @@ addition, you may want to set the font and input encodings. \documentclass{article} \usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} +% \usepackage[utf8]{inputenc} % Uncomment if LaTeX < 2018-04-01 _\usepackage[french]{babel}_ @@ -349,9 +349,10 @@ Package babel Warning: No hyphenation patterns were preloaded for \subsection{Multilingual documents} -In multilingual documents, just use several options. The last one is -considered the main language, activated by default. Sometimes, the -main language changes the document layout (eg, |spanish| and |french|). +In multilingual documents, just use a list of the required languages as +package or class options. The last language is considered the main one, +activated by default. Sometimes, the main language changes the document +layout (eg, |spanish| and |french|). \begin{example} In \LaTeX, the preamble of the document: @@ -364,12 +365,15 @@ main language changes the document layout (eg, |spanish| and |french|). language in use, and the main one. \end{example} -You can also set the main language explicitly: +You can also set the main language explicitly, but it is discouraged +except if there a real reason to do so: \begin{verbatim} \documentclass{article} \usepackage[_main=english_,dutch]{babel} \end{verbatim} +Examples of cases where |main| is useful are the following. + \begin{note} Some classes load \babel{} with a hardcoded language option. Sometimes, the main language could be overridden with something like that before @@ -432,7 +436,7 @@ _\foreignlanguage{french}{français}_. loading \babel{} by means of \textit{modifiers}. They are set after the language name, and are prefixed with a dot (only when the language is set as package option -- neither global options nor the |main| key -accept them). An example is (spaces are not significant and they can +accepts them). An example is (spaces are not significant and they can be added or removed):\footnote{No predefined ``axis'' for modifiers are provided because languages and their scripts have quite different needs.} @@ -442,7 +446,7 @@ needs.} Attributes (described below) are considered modifiers, ie, you can set an attribute by including it in the list of modifiers. However, -modifiers is a more general mechanism. +modifiers are a more general mechanism. \subsection{\textsf{xelatex} and \textsf{lualatex}} @@ -607,7 +611,7 @@ compatibility). \Describe{\begin\menv{otherlanguage}}{\marg{language}\Eenv{otherlanguage}} The environment \Lenv{otherlanguage} does basically the same as -|\selectlanguage|, except the language change is (mostly) local to +|\selectlanguage|, except that language change is (mostly) local to the environment. Actually, there might be some non-local changes, as this environment @@ -659,7 +663,7 @@ say, |'| done by some languages (eg, \textsf{italian}, \textsf{french}, \Describe{\babeltags}{\char`\{\m{tag1} \texttt{=} \m{language1}, \m{tag2} \texttt{=} \m{language2}, \dots\char`\}} -\New{3.9i} In multilingual documents with many language switches the +\New{3.9i} In multilingual documents with many language-switches the commands above can be cumbersome. With this tool shorter names can be defined. It adds nothing really new -- it is just syntactical sugar. @@ -740,14 +744,14 @@ 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, as 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 space; (3) several kinds of discretionaries and breaks can be inserted easily with |"-|, |"=|, etc. -The package \textsf{inputenc} as well as \xetex{} an \luatex{} have +The package \textsf{inputenc} as well as \xetex{} and \luatex{} have alleviated entering non-ASCII characters, but minority languages and some kinds of text can still require characters not directly available on the keyboards (and sometimes not even as separated or precomposed @@ -860,7 +864,7 @@ system shorthands. Language-dependent user shorthands (new in \defineshorthand{"*}{\babelhyphen{soft}} \defineshorthand{"-}{\babelhyphen{hard}} \end{verbatim} - However, behavior of hyphens is language dependent. For example, in + However, the behavior of hyphens is language-dependent. For example, in languages like Polish and Portuguese, a hard hyphen inside compound words are repeated at the beginning of the next line. You could then set: @@ -870,7 +874,7 @@ system shorthands. Language-dependent user shorthands (new in Here, options with |*| set a language-dependent user shorthand, which means the generic one above only applies for the rest of languages; without |*| they would (re)define the language shorthands - instead, which are overriden by user ones. + instead, which are overridden by user ones. Now, you have a single unified shorthand (|"-|), with a content-based meaning (`compound word hyphen') whose visual behavior @@ -924,7 +928,7 @@ in \textsf{english} the shorthands defined by \textsf{ngerman} with with, for example, |\useshorthands| or |\useshorthands*|.) Very often, this is a more convenient way to deactivate shorthands -than |\shorthandoff|, as for example if you want to define a macro +than |\shorthandoff|, for example if you want to define a macro to easy typing phonetic characters with \textsf{tipa}: \begin{verbatim} \newcommand{\myipa}[1]{{\languageshorthands{none}\tipaencoding#1}} @@ -937,7 +941,7 @@ language are taken into account, ie, not user shorthands), (2) turned off with |\shorthandoff| or (3) deactivated with the internal |\bbl@deactivate|; for example, \verb|\babelshorthand{"u}| or \verb|\babelshorthand{:}|. (You can conveniently define your own -macros, or even you own user shorthands provided they do not ovelap.) +macros, or even your own user shorthands provided they do not overlap.) For your records, here is a list of shorthands, but you must double check them, as they may change:\footnote{Thanks to Enrico Gregorio} @@ -1029,7 +1033,7 @@ this is not a real problem (just use ``allowed'' characters). Shorthands are mainly intended for text, not for math. By setting this option with the value |normal| they are deactivated in math mode (default is |active|) and things like |${a'}$| (a closing brace after -a shorthand) are not a source of trouble any more. +a shorthand) are not a source of trouble anymore. \Describe{config=}{\meta{file}} Load \meta{file}\texttt{.cfg} instead of the default config file |bblopts.cfg| (the file is loaded even @@ -1041,8 +1045,8 @@ package or global option, it is added to the list of requested languages. \Describe{headfoot=}{\meta{language}} By default, headlines and -footlines are not touched (only marks), and if they contain language -dependent macros (which is not usual) there may be unexpected +footlines are not touched (only marks), and if they contain +language-dependent macros (which is not usual) there may be unexpected results. With this option you may set the language in heads and foots. \Describe{noconfigs}{} Global and language default config files are @@ -1100,7 +1104,7 @@ can take the following values: options have been stated. The option |first| can be regarded as an optimized version of \texttt{other*} for monolingual documents.\footnote{Providing |foreign| is pointless, because the - case mapping applied is that at the end of paragraph, but if either + case mapping applied is that at the end of the paragraph, but if either \xetex{} or \luatex{} change this behavior it might be added. On the other hand, |other| is provided even if I [JBL] think it isn't really useful, but who knows.} @@ -1122,11 +1126,11 @@ documents. See sec.~\ref{bidi}. With this package option \babel{} just loads some basic macros (those in |switch.def|), defines |\AfterBabelLanguage| and exits. It also -selects the hyphenations patterns for the last language passed as +selects the hyphenation patterns for the last language passed as option (by its name in |language.dat|). There are two main uses: classes and packages, and as a last resort in case there are, for some reason, incompatible languages. It can be used if you just want to -select the hyphenations patterns of a single language, too. +select the hyphenation patterns of a single language, too. % TODO: example \Describe\AfterBabelLanguage{\marg{option-name}\marg{code}} @@ -1945,8 +1949,8 @@ to select fonts in addition to the three basic families. This makes sure the OpenType script for Devanagari is |deva| and not |dev2| (\luatex{} does not detect automatically the correct script\footnote{And even with the correct code some fonts could be - rendered incorrectly by \textsf{fontspec}, so double check the - results. \xetex{} fares better, but some font are still + rendered incorrectly by \textsf{fontspec}, so double-check the + results. \xetex{} fares better, but some fonts are still problematic.}). You may also pass some options to \textsf{fontspec}: with |silent|, the warnings about unavailable scripts or languages are not shown (they are only really useful when the document format @@ -1966,10 +1970,10 @@ to select fonts in addition to the three basic families. |\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 with this - command, neither the script nor the language are passed. You must + command, neither the script nor the language is passed. You must add them by hand. This is by design, for several reasons (for example, each font has its own set of features and a generic setting - for several of them could be problematic, and also a “lower level” + for several of them could be problematic, and also a “lower-level” font selection is useful). \end{note} @@ -1993,7 +1997,9 @@ to select fonts in addition to the three basic families. no-op). Of course, both methods are incompatible, and if you use |\set|\textit{xxxx}|font|, font switching with |\babelfont| just does \textit{not} work (nor the standard |\|\textit{xx}|default|, - for that matter). + for that matter). As of \New{3.34} there is an attempt to make them + compatible, but the language system will not be set by \babel and + should be set with |fontspec| if necessary. \end{warning} \begin{troubleshooting} @@ -2038,6 +2044,14 @@ There is a counterpart for code to be run when a language is unselected: |\noextras|\m{lang}. \end{itemize} +\begin{note} Do \textit{not} redefine a caption in the following way: +\begin{verbatim} +\AtBeginDocument{\renewcommand\contentsname{Foo}} +\end{verbatim} +The changes may be discarded with a language selector, and the original +value restored. +\end{note} + \begin{note} These macros (|\captions|\m{lang}, |\extras|\m{lang}) may be redefined, but \textit{must not} be used as such -- they just pass @@ -2064,11 +2078,14 @@ existing language, too, as explained in the previous subsection). \Describe{\babelprovide}{\oarg{options}\marg{language-name}} -Defines the internal structure of the language with some defaults: the -hyphen rules, if not available, are set to the current ones, left and -right hyphen mins are set to 2 and 3, but captions and date are not -defined. Conveniently, \babel{} warns you about what to do. Very -likely you will find alerts like that in the |log| file: +If the language |\marg{language-name}| has not been defined and there +are no options, it creates an “empty” one in the following way: defines +the internal structure of the language with some defaults: the hyphen +rules, if not available, are set to the current ones, left and right +hyphen mins are set to 2 and 3, but captions and date are not defined. +Conveniently, some options allow to fill the language, and \babel{} +warns you about what to do if there is a missing string. Very likely +you will find alerts like that in the |log| file: \begin{verbatim} Package babel Warning: \mylangchaptername not set. Please, define (babel) it in the preamble with something like: @@ -2187,7 +2204,7 @@ is, ‘when a character has the same direction as the script for the “provided” language, then change its font to that set for this language’. There are 3 directions, following the bidi Unicode algorithm, namely, Arabic-like, Hebrew-like and left to -right.\footnote{In future releases an new value (\texttt{script}) will +right.\footnote{In future releases a new value (\texttt{script}) will be added.} So, there should be at most 3 directives of this kind. \Describe{intraspace=}{\meta{base} \meta{shrink} \meta{stretch}} @@ -2295,13 +2312,13 @@ In \TeX, \verb|-| and \verb|\-| forbid further breaking opportunities in the word. This is the desired behavior very often, but not always, and therefore many languages provide shorthands for these cases. Unfortunately, this has not been done consistently: for -example, \verb|"-| in Dutch, Portugese, Catalan or Danish is a hard +example, \verb|"-| in Dutch, Portuguese, 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 opportunities in the rest of the word. -Therefore, some macros are provide with a set of basic ``hyphens'' +Therefore, some macros are provided with a set of basic ``hyphens'' which can be used by themselves, to define a user shorthand, or even in language files. \begin{itemize} @@ -2309,16 +2326,16 @@ in language files. explanatory. \item |\babelhyphen{repeat}| inserts a hard hyphen which is repeated at the beginning of the next line, as done in languages like - Polish, Portugese and Spanish. + Polish, Portuguese and Spanish. \item |\babelhyphen{nobreak}| inserts a hard hyphen without a break after it (even if a space follows). -\item |\babelhyphen{empty}| inserts a break oportunity without +\item |\babelhyphen{empty}| inserts a break opportunity without a hyphen at all. \item |\babelhyphen|\marg{text} is a hard ``hyphen'' using \m{text} instead. A typical case is |\babelhyphen{/}|. \end{itemize} -With all of them hyphenation in the rest of the word is enabled. If -you don't want enabling it, there is a starred counterpart: +With all of them, hyphenation in the rest of the word is enabled. If +you don't want to enable it, there is a starred counterpart: |\babelhyphen*{soft}| (which in most cases is equivalent to the original |\-|), |\babelhyphen*{hard}|, etc. @@ -2345,7 +2362,7 @@ documents). Language exceptions take precedence over global ones. It can be used only in the preamble, and exceptions are set when the language is first selected, thus taking into account changes of -|\lccodes|'s done in |\extras|\m{lang} as well as the language specific +|\lccodes|'s done in |\extras|\m{lang} as well as the language-specific encoding (not set in the preamble by default). Multiple |\babelhyphenation|'s are allowed. For example: \begin{verbatim} @@ -2359,7 +2376,7 @@ font encodings are the same, like in Unicode based engines. \begin{note} Using |\babelhyphenation| with Southeast Asian scripts is mostly pointless. But with |\babelpatterns| (below) you may fine-tune line - breaking (only \luatex). Even if there are no pattern for the + breaking (only \luatex). Even if there are no patterns for the language, you can add at least some typical cases. \end{note} @@ -2376,7 +2393,7 @@ combination already exists, it gets replaced by the new one. It can be used only in the preamble, and patterns are added when the language is first selected, thus taking into account changes of -|\lccodes|'s done in |\extras|\m{lang} as well as the language specific +|\lccodes|'s done in |\extras|\m{lang} as well as the language-specific encoding (not set in the preamble by default). Multiple |\babelpatterns|'s are allowed. @@ -2402,7 +2419,7 @@ of the previous char in \luatex, and the font size set by the last Currently \babel{} provides no standard interface to select scripts, because they are best selected with either |\fontencoding| -(low level) or a language name (high level). Even the Latin script may +(low-level) or a language name (high-level). Even the Latin script may require different encodings (ie, sets of glyphs) depending on the language, and therefore such a switch would be in a sense incomplete.\footnote{The so-called Unicode fonts do not improve the @@ -2440,7 +2457,7 @@ used for ``ordinary'' text (they are stored in |\BabelNonText|, used in some special cases when no Latin encoding is explicitly set). The foregoing rules (which are applied ``at begin document'') cover -most of cases. No assumption is made on characters above +most of the cases. No assumption 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. @@ -2456,14 +2473,14 @@ differ in the way `weak' numeric characters are ordered (eg, Arabic \begin{warning} The current code for \textbf{text} in \luatex{} should be considered - essentially stable, but, of course, it is not bug free and there + essentially stable, but, of course, it is not bug-free and there could be improvements in the future, because setting bidi text has many subtleties (see for example ). A basic stable version for other engines must wait. This applies to text; there is a basic support for \textbf{graphical} elements, including the |picture| environment (with \textsf{pict2e}) and \textsf{pfg/tikz}. Also, indexes and the like are under study, as - well as math (there are progresses in the latter, too, but for + well as math (there is progress in the latter, too, but for example |cases| may fail). An effort is being made to avoid incompatibilities in the future @@ -2480,7 +2497,7 @@ There are some package options controlling bidi writing. \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 +change must be marked up. In \xetex{} and \pdftex{} this is the only option. In \luatex, |basic-r| provides a simple and fast method for R text, @@ -2580,7 +2597,7 @@ Arabic as @1فصحى العصر@0 \textit{fuṣḥā l-ʻaṣr} (MSA) and \end{example} \begin{note} - Boxes are “black boxes”. Numbers inside an |\hbox| (as for example + Boxes are “black boxes”. Numbers inside an |\hbox| (for example in a |\ref|) do not know anything about the surrounding chars. So, |\ref{A}-\ref{B}| are not rendered in the visual order A-B, but in the wrong one B-A (because the hyphen does not “see” the digits inside the @@ -2591,7 +2608,7 @@ Arabic as @1فصحى العصر@0 \textit{fuṣḥā l-ʻaṣr} (MSA) and \newcommand\refrange[2]{\babelsublr{\texthe{\ref{#1}}-\texthe{\ref{#2}}}} \end{verbatim} - In a future a more complete method, reading recursively boxed text, may + In the future a more complete method, reading recursively boxed text, may be added. \end{note} @@ -2654,14 +2671,14 @@ bidirectional (with both R and L paragraphs) documents in \luatex{}. toc entries are R by default if the main language is R. \item[columns] required in \xetex{} and \pdftex{} to reverse the - column order (currently only the standard two column mode); in + column order (currently only the standard two-column mode); in \luatex{} they are R by default if the main language is R (including \textsf{multicol}). \item[footnotes] not required in monolingual documents, but it may be useful in bidirectional documents (with both R and L paragraphs) in all engines; you may use alternatively |\BabelFootnote| described below - (what this options does exactly is also explained there). + (what this option does exactly is also explained there). \item[captions] is similar to |sectioning|, but for |\caption|; not required in monolingual documents with \luatex{}, but may be @@ -2803,8 +2820,8 @@ 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|). \New{3.33} They may be also applied to an -specific language with the optional argument; language specific +for the event |afterextras|). \New{3.33} They may be also applied to a +specific language with the optional argument; language-specific settings are executed after global ones. Current events are the following; in some of them you can use one to @@ -2826,7 +2843,7 @@ three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given: \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[stopcommands] Used to reset 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 @@ -2852,6 +2869,13 @@ three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given: \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}. +% STILL UNDER STUDY: +% \item[beforestart] \New{3.34} Executed either at the beginning of the +% |aux| file (when read at the start of the document), or else at begin +% document. In other words, it makes sure the code is executed always +% and executed once. But be aware it is a somewhat dangerous, because +% the scope in the first case is local, while in the second case is +% global, so be careful with assignments. \end{description} Four events are used in \file{hyphen.cfg}, which are handled in a @@ -2864,7 +2888,7 @@ ones, they only have a single hook and replace a default definition. \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. + to load a different version of this file or to load nothing. \item[loadpatterns] (patterns file) Loads the patterns file. Used by \file{luababel.def}. \item[loadexceptions] (exceptions file) Loads the exceptions @@ -2959,7 +2983,8 @@ Then you preprocess it with |devnag| \m{file}, which creates script-specific features based on some properties. Currently, they are 3, namely, direction (ie, bidi class), mirroring glyphs, and line breaking for CJK scripts. These properties are stored in \textsf{lua} -tables, which you can modify with the following macro. +tables, which you can modify with the following macro (for example, +to set them for glyphs in the PUA). \Describe{\babelcharproperty}{\marg{char-code}\oarg{to-char-code}% \marg{propertry}\marg{value}} @@ -2979,7 +3004,7 @@ For example: This command is allowed only in vertical mode (the preamble or between paragraphs). -\subsection{Tips, workarounds, know issues and notes} +\subsection{Tips, workarounds, known issues and notes} \begin{itemize} \item If you use the document class \cls{book} \emph{and} you use @@ -3066,7 +3091,7 @@ some languages (kerning and spacing). Ligatures can be disabled. \subsection{Current and future work} -Current work is focused on the so-called complex scripts in \luatex{}. +The current work is focused on the so-called complex scripts in \luatex{}. In 8-bit engines, \babel{} provided a basic support for bidi text as part of the style for Hebrew, but it is somewhat unsatisfactory and internally replaces some hardwired commands by other hardwired commands @@ -3074,7 +3099,7 @@ internally replaces some hardwired commands by other hardwired commands Useful additions would be, for example, time, currency, addresses and personal names.\footnote{See for example POSIX, ISO 14652 and the -Unicode Common Locale Data Repository (CLDR). Those system, however, +Unicode Common Locale Data Repository (CLDR). Those systems, however, have limited application to \TeX\ because their aim is just to display information and not fine typesetting.}. But that is the easy part, because they don't require modifying the \LaTeX{} internals. @@ -3177,7 +3202,7 @@ german hyphen.ger You may also set the font encoding the patterns are intended for by following the language name by a colon and the encoding -code.\footnote{This in not a new feature, but in former versions it +code.\footnote{This is not a new feature, but in former versions it didn't work correctly.} For example: \begin{verbatim} german:T1 hyphenT1.ger @@ -3251,19 +3276,19 @@ Some recommendations: ancient language). Note however |=|, |<|, |>|, |:| and the like can be dangerous, because they may be used as part of the syntax of some elements (numeric expressions, key/value pairs, etc.). -\item Captions should not contain shorthands or encoding dependent +\item Captions should not contain shorthands or encoding-dependent commands (the latter is not always possible, but should be clearly documented). They should be defined using the LICR. You may also use the new tools for encoded strings, described below. \item Avoid adding things to |\noextras|\m{lang} except for umlauthigh and friends, |\bbl@deactivate|, |\bbl@(non)frenchspacing|, and - language specific macros. Use always, if possible, |\bbl@save| and + language-specific macros. Use always, if possible, |\bbl@save| and |\bbl@savevariable| (except if you still want to have access to the previous value). Do not reset a macro or a setting to a hardcoded value. Never. Instead save its value in |\extras|\m{lang}. \item Do not switch scripts. If you want to make sure a set of glyphs - is used, switch either the font encoding (low level) or the language - (high level, which in turn may switch the font encoding). Usage of things + is used, switch either the font encoding (low-level) or the language + (high-level, which in turn may switch the font encoding). Usage of things like |\latintext| is deprecated.\footnote{But not removed, for backward compatibility.} \item Please, for ``private'' internal macros do not use the |\bbl@| @@ -3307,7 +3332,7 @@ but if you want to do it, here are a few guidelines. The following page provides a starting point: \texttt{http://www.texnia.com/incubator.html}. -If your need further assistance and technical advice in the +If you 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. @@ -3429,7 +3454,7 @@ first family in the given encoding seems to be needed. Here is the basic structure of an |ldf| file, with a language, a dialect and an attribute. Strings are best defined using the method -explained in in sec. \ref{s:strings} (\babel{} 3.9 and later). +explained in sec. \ref{s:strings} (\babel{} 3.9 and later). \begin{verbatim} \ProvidesLanguage{} @@ -3651,7 +3676,7 @@ key |strings| has also other two special values: |generic| and |encoded|). If a string is set several times (because several blocks are read), -the first one take precedence (ie, it works much like +the first one takes precedence (ie, it works much like |\providecommand|). Encoding info is |charset=| followed by a charset, which if given sets @@ -3784,7 +3809,7 @@ to define |\abmoniname|, |\abmoniiname|, etc. (and similarly with \Describe\SetCase{\oarg{map-list}\marg{toupper-code}\marg{tolower-code}} Sets globally code to be executed at |\MakeUppercase| and -|\MakeLowercase|. The code would be typically things like |\let\BB\bb| +|\MakeLowercase|. The code would typically be things like |\let\BB\bb| and |\uccode| or |\lccode| (although for the reasons explained above, changes in lc/uc codes may not work). A \meta{map-list} is a series of macros using the internal format of |\@uclclist| (eg, @@ -3856,7 +3881,7 @@ assignment is wrong, fix it directly. \subsection{Changes in \babel\ version 3.9} -Most of changes in version 3.9 were related to bugs, either to fix them +Most of the changes in version 3.9 were related to bugs, either to fix them (there were lots), or to provide some alternatives. Even new features like |\babelhyphen| are intended to solve a certain problem (in this case, the lacking of a uniform syntax and behavior for shorthands @@ -4046,8 +4071,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<> -%<> +%<> +%<> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -4134,6 +4159,25 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % \end{macro} % +% \begin{macro}{\bbl@exp} +% +% Now, just syntactical sugar, but it makes partial expansion of +% some code a lot more simple and readable. Here |\\| stands for +% |\noexpand| and |\<..>| for |\noexpand| applied to a built macro +% name (the latter does not define the macro if undefined to +% |\relax|, because it is created locally). The result may be +% followed by extra arguments, if necessary. +% +% \begin{macrocode} +\def\bbl@exp#1{% + \begingroup + \let\\\noexpand + \def\<##1>{\expandafter\noexpand\csname##1\endcsname}% + \edef\bbl@exp@aux{\endgroup#1}% + \bbl@exp@aux} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\bbl@trim} % The following piece of code is stolen (with some changes) from % \textsf{keyval}, by David Carlisle. It defines two macros: @@ -4257,12 +4301,20 @@ help from Bernd Raichle, for which I am grateful. % |ho|, then |\relax| becomes |\rho|). No checking is done at all, % because it is not a general purpose macro, and it is used by \babel{} % only when it works (an example where it does \textit{not} work is in -% |\bbl@TG@@date|). It may change! (to add new features). -% +% |\bbl@TG@@date|, and also fails if there are macros with spaces, +% because they retokenized). It may change! (or even merged with +% |\bbl@replace|; I'm not sure ckecking the replacement is really +% necessary or just paranoia). +% +% \changes{babel~3.34}{2019/07/23}{Take into account prefixes like +% \cs{long} and macros with trailing spaces. Don't touch original if +% not necessary.} +% % \begin{macrocode} -\expandafter\def\expandafter\bbl@parsedef\detokenize{macro:}#1->#2\relax{% +\bbl@exp{\def\\\bbl@parsedef##1\detokenize{macro:}}#2->#3\relax{% \def\bbl@tempa{#1}% - \def\bbl@tempb{#2}} + \def\bbl@tempb{#2}% + \def\bbl@tempe{#3}} \def\bbl@sreplace#1#2#3{% \begingroup \expandafter\bbl@parsedef\meaning#1\relax @@ -4270,31 +4322,20 @@ help from Bernd Raichle, for which I am grateful. \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}% \def\bbl@tempd{#3}% \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}% - \bbl@exp{\\\bbl@replace\\\bbl@tempb{\bbl@tempc}{\bbl@tempd}}% - \bbl@exp{% + \bbl@xin@{\bbl@tempc}{\bbl@tempe}% If not in macro, do nothing + \ifin@ + \bbl@exp{\\\bbl@replace\\\bbl@tempe{\bbl@tempc}{\bbl@tempd}}% + \def\bbl@tempc{% Expanded an executed below as 'uplevel' + \\\makeatletter % "internal" macros with @ are assumed + \\\scantokens{% + \bbl@tempa\\\@namedef{\bbl@stripslash#1}\bbl@tempb{\bbl@tempe}}% + \catcode64=\the\catcode64\relax}% Restore @ + \else + \let\bbl@tempc\@empty % Not \relax + \fi + \bbl@exp{% For the 'uplevel' assignments \endgroup - \\\makeatletter % "internal" macros with @ are assumed - \\\scantokens{\def\\#1\bbl@tempa{\bbl@tempb}}% - \catcode64=\the\catcode64\relax}} % Restore @ -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\bbl@exp} -% -% Now, just syntactical sugar, but it makes partial expansion of -% some code a lot more simple and readable. Here |\\| stands for -% |\noexpand| and |\<..>| for |\noexpand| applied to a built macro -% name (the latter does not define the macro if undefined to -% |\relax|, because it is created locally). The result may be -% followed by extra arguments, if necessary. -% -% \begin{macrocode} -\def\bbl@exp#1{% - \begingroup - \let\\\noexpand - \def\<##1>{\expandafter\noexpand\csname##1\endcsname}% - \edef\bbl@exp@aux{\endgroup#1}% - \bbl@exp@aux} + \bbl@tempc}} % empty or expand to set #1 with changes % \end{macrocode} % \end{macro} % @@ -4688,6 +4729,9 @@ help from Bernd Raichle, for which I am grateful. \DeclareOption{silent}{} \DeclareOption{mono}{} \DeclareOption{shorthands=off}{\bbl@tempa shorthands=\bbl@tempa} +% Don't use. Experimental: +\newif\ifbbl@single +\DeclareOption{selectors=off}{\bbl@singletrue} <@More package options@> % \end{macrocode} % @@ -4964,7 +5008,7 @@ help from Bernd Raichle, for which I am grateful. % defined explicitly. So, package options not yet taken into % account and stored in |bbl@language@opts| are assumed to be % languages (note this list also contains the language given with -% |main|). If not declared above, the name of the option and the +% |main|). If not declared above, the names of the option and the % file are the same. % % \begin{macrocode} @@ -5056,7 +5100,7 @@ help from Bernd Raichle, for which I am grateful. {Too late for \string\AfterBabelLanguage}% {Languages have been loaded, so I can do nothing}} % \end{macrocode} -% +% % In order to catch the case where the user forgot to specify a % language we check whether |\bbl@main@language|, has become % defined. If not, no language has been loaded and an error @@ -5083,7 +5127,7 @@ help from Bernd Raichle, for which I am grateful. % The kernel of the \babel\ system is stored in either % \file{hyphen.cfg} or \file{switch.def} and \file{babel.def}. The % file \file{babel.def} contains most of the code, while -% \file{switch.def} defines the language switching commands; both can +% \file{switch.def} defines the language-switching commands; both can % be read at run time. The file \file{hyphen.cfg} is a file that can % be loaded into the format, which is necessary when you want to be % able to switch hyphenation patterns (by default, it also inputs @@ -5162,6 +5206,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@opt@safe{BR} \ifx\@uclclist\@undefined\let\@uclclist\@empty\fi \ifx\bbl@trace\@undefined\def\bbl@trace#1{}\fi + \expandafter\newif\csname ifbbl@single\endcsname \fi % \end{macrocode} % @@ -5358,7 +5403,8 @@ help from Bernd Raichle, for which I am grateful. everylanguage=1,loadkernel=1,loadpatterns=1,loadexceptions=1,% adddialect=2,patterns=2,defaultcommands=0,encodedcommands=2,write=0,% beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,% - hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0} + hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,% + beforestart=0} % \end{macrocode} % % \begin{macro}{\babelensure} @@ -5602,12 +5648,28 @@ 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. Languages does not set |\pagedir|, so +% beginning of the document. Languages do not set |\pagedir|, so % we set here for the whole document to the main |\bodydir|. % +% \changes{babel~3.34}{2019/09/20}{New hook beforestart.} +% % \begin{macrocode} +\def\bbl@beforestart{% + \bbl@usehooks{beforestart}{}% + \global\let\bbl@beforestart\relax} \AtBeginDocument{% + \bbl@beforestart + \if@filesw + \immediate\write\@mainaux{% + % \let\string\bbl@nostdfont\string\@gobble + \string\bbl@beforestart}% + \fi \expandafter\selectlanguage\expandafter{\bbl@main@language}% + \ifbbl@single % must go after the line above + \renewcommand\selectlanguage[1]{}% + \renewcommand\foreignlanguage[2]{#2}% + \global\let\babel@aux\@gobbletwo % Also as flag + \fi \ifcase\bbl@engine\or\pagedir\bodydir\fi} % TODO - a better place % \end{macrocode} % @@ -5641,7 +5703,7 @@ help from Bernd Raichle, for which I am grateful. % the original catcode. It does not hurt, but should be fixed. It's % already done with |\nfss@catcodes|, added in 3.10. % -% \changes{3.10}{2017/05/14}{Refactored. Add to \cs{nfss@catcodes} too.} +% \changes{babel~3.10}{2017/05/14}{Refactored. Add to \cs{nfss@catcodes} too.} % % \begin{macrocode} \bbl@trace{Shorhands} @@ -5767,6 +5829,8 @@ help from Bernd Raichle, for which I am grateful. % too} % \changes{babel~3.9a}{2012/12/27}{Take into account mathematically % active chars, to avoid infinite loops} +% \changes{babel~3.34}{2019/09/23}{Math active in lua has a different +% value} % % The very first thing to do is saving the original catcode and the % original definition, even if not active, which is possible @@ -5800,7 +5864,7 @@ help from Bernd Raichle, for which I am grateful. \expandafter\let\csname normal@char#2\endcsname#3% \else \bbl@info{Making #2 an active character}% - \ifnum\mathcode`#2="8000 + \ifnum\mathcode`#2=\ifodd\bbl@engine"1000000 \else"8000 \fi \@namedef{normal@char#2}{% \textormath{#3}{\csname bbl@oridef@@#2\endcsname}}% \else @@ -6931,11 +6995,11 @@ help from Bernd Raichle, for which I am grateful. % The following two commands are used to wrap the ``hyphen'' and % set the behavior of the rest of the word -- the version with a % single |@| is used when further hyphenation is allowed, while -% that with |@@| if no more hyphen are allowed. In both cases, if +% that with |@@| if no more hyphens are allowed. In both cases, if % the hyphen is preceded by a positive space, breaking after the % hyphen is disallowed. % -% There should not be a discretionaty after a hyphen at the +% There should not be a discretionary after a hyphen at the % beginning of a word, so it is prevented if preceded by a % skip. Unfortunately, this does handle cases like ``(-suffix)''. % |\nobreak| is always preceded by |\leavevmode|, in case the @@ -7622,7 +7686,7 @@ help from Bernd Raichle, for which I am grateful. % \texttt{OT1} encoding by default. % % Some code to construct these glyphs for the \texttt{OT1} encoding -% was made available to me by Stipcevic Mario, +% was made available to me by Stipčević Mario, % (\texttt{stipcevic@olimp.irb.hr}). % % \begin{macrocode} @@ -7678,7 +7742,7 @@ help from Bernd Raichle, for which I am grateful. % 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. +% encoding-dependent macros. % % \changes{babel~3.16}{2018/01/02}{Adapted to TU and refactored - % redundant code.} @@ -7952,11 +8016,11 @@ help from Bernd Raichle, for which I am grateful. % requested, an |ini| file. It may be used in conjunction to previouly % loaded |ldf| files. % -% \changes{3.10}{2017/05/19}{Added \cs{babelprovide}} -% \changes{3.13}{2017/08/30}{Added \cs{import}, which also reads +% \changes{babel~3.10}{2017/05/19}{Added \cs{babelprovide}} +% \changes{babel~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 +% \changes{babel~3.15}{2017/10/30}{New keys script, language} +% \changes{babel~3.16}{2018/01/02}{Make sure ensuring works even before % the language is selected} % \changes{babel~3.19}{2018/04/23}{New option - mapfont. Currently % only with direction} @@ -7965,13 +8029,15 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.23}{2018/09/01}{Valueless import} % \changes{babel~3.26}{2018/10/16}{Quick fix for xetex - test the % script for intraspace} -% \changes{3.30}{2019/04/22}{Read some basic parameters from ini +% \changes{babel~3.30}{2019/04/22}{Read some basic parameters from ini % even without import.} -% \changes{3.30}{2019/04/22}{Native digits (lua level).} -% \changes{3.30}{2019/04/22}{New attribute in luatex for `locale'. Also +% \changes{babel~3.30}{2019/04/22}{Native digits (lua level).} +% \changes{babel~3.30}{2019/04/22}{New attribute in luatex for `locale'. Also % \cs{localeid}} -% \changes{3.32}{2019/05/30}{Activate CJK line breaking with an explicit +% \changes{babel~3.32}{2019/05/30}{Activate CJK line breaking with an explicit % intraspace.} +% \changes{babel~3.34}{2019/09/20}{Fix - with main the language must not +% be restored.} % % \begin{macrocode} \bbl@trace{Creating languages and reading ini files} @@ -8199,8 +8265,10 @@ help from Bernd Raichle, for which I am grateful. \catcode`\@=\atcatcode \let\atcatcode\relax \fi}% - \let\languagename\bbl@savelangname - \chardef\localeid\bbl@savelocaleid\relax} + \ifx\bbl@KVP@main\@nil % Restore only if not 'main' + \let\languagename\bbl@savelangname + \chardef\localeid\bbl@savelocaleid\relax + \fi} % \end{macrocode} % % A tool to define the macros for native digits from the list provided @@ -8242,7 +8310,7 @@ help from Bernd Raichle, for which I am grateful. % % Depending on whether or not the language exists, we define two macros. % -% \changes{3.22}{2018/06/05}{Fix - Error with \cs{chapter} if empty in ini.}- +% \changes{babel~3.22}{2018/06/05}{Fix - Error with \cs{chapter} if empty in ini.}- % % \begin{macrocode} \def\bbl@provide@new#1{% @@ -8300,7 +8368,7 @@ help from Bernd Raichle, for which I am grateful. % % The |hyphenrules| option is handled with an auxiliary macro. % -% \changes{3.14}{2017/10/03}{Take into account ini settings for +% \changes{babel~3.14}{2017/10/03}{Take into account ini settings for % hyphenrules if `import'.} % % \begin{macrocode} @@ -8359,6 +8427,15 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@savestrings\@empty \let\bbl@savetoday\@empty \let\bbl@savedate\@empty + \def\bbl@inipreread##1=##2\@@{% + \bbl@trim@def\bbl@tempa{##1}% Redundant below !! + % Move trims here ?? + \bbl@ifunset{bbl@KVP@\bbl@section/\bbl@tempa}% + {\expandafter\bbl@inireader\bbl@tempa=##2\@@}% + {\def\bbl@tempc{\expandafter\bbl@inireader\bbl@tempa=}% + \expandafter\expandafter\expandafter + \bbl@tempc\csname bbl@KVP@\bbl@section/\bbl@tempa\endcsname\@@}% + \global\bbl@csarg\let{KVP@\bbl@section/\bbl@tempa}\relax}% \let\bbl@inireader\bbl@iniskip \bbl@info{Importing data from babel-#1.ini for \languagename}% \loop @@ -8372,7 +8449,7 @@ help from Bernd Raichle, for which I am grateful. \repeat \fi} \def\bbl@iniline#1\bbl@iniline{% - \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inireader}#1\@@}% ] + \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inipreread}#1\@@}% ] % \end{macrocode} % % The special cases for comment lines and sections are handled by the @@ -8494,8 +8571,8 @@ help from Bernd Raichle, for which I am grateful. % % TODO. Remove copypaste pattern. % -% \changes{3.16}{2018/01/02}{Fix - dates were severely broken.} -% \changes{3.28}{2019/04/01}{Start work on calendars.} +% \changes{babel~3.16}{2018/01/02}{Fix - dates were severely broken.} +% \changes{babel~3.28}{2019/04/01}{Start work on calendars.} % % \begin{macrocode} \bbl@csarg\def{inikv@date.gregorian}#1=#2\@@{% for defaults @@ -8607,10 +8684,12 @@ help from Bernd Raichle, for which I am grateful. % 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. +% file named as the language (which means any code in it must be +% skipped, too. % -% \changes{3.16}{2018/01/02}{Load ids inside a box, to prevent extra +% \changes{babel~3.16}{2018/01/02}{Load ids inside a box, to prevent extra % spaces.} +% \changes{babel~3.34}{2019/08/05}{Added \cs{endinput}.} % % \begin{macrocode} \def\bbl@ini@ids#1{% @@ -8618,7 +8697,8 @@ help from Bernd Raichle, for which I am grateful. \begingroup \bbl@add\bbl@secpost@identification{\closein1 }% \catcode`\[=12 \catcode`\]=12 \catcode`\==12 % - \bbl@read@ini{##1}% + \bbl@read@ini{##1}% + \endinput \endgroup}% boxed, to avoid extra spaces: {\setbox\z@\hbox{\InputIfFileExists{babel-#1.tex}{}{}}}} % \end{macrocode} @@ -8847,8 +8927,8 @@ help from Bernd Raichle, for which I am grateful. % that definition (it would result in parameter stack overflow % because of a circular definition). % -% (Recent versions of natbib change dynamically |\@citex|, so PR4087 -% doesn't seem fixable in a simple way. Just load natbib before.) +% (Recent versions of \pkg{natbib} change dynamically |\@citex|, so PR4087 +% doesn't seem fixable in a simple way. Just load \pkg{natbib} before.) % % \begin{macrocode} \def\@citex[#1][#2]#3{% @@ -8998,13 +9078,14 @@ help from Bernd Raichle, for which I am grateful. \edef\thepage{% \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}}% \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@}}}}}% + {\ifbbl@single\else + \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} @@ -9020,33 +9101,34 @@ help from Bernd Raichle, for which I am grateful. % with the new definition of |\markboth|. % % \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} % end \IfBabelLayout + \bbl@tempc + \fi} % end ifbbl@single, end \IfBabelLayout % \end{macrocode} % % \end{macro} @@ -9157,11 +9239,11 @@ help from Bernd Raichle, for which I am grateful. % % The package \pkg{varioref} defines |\Ref| to be a robust command % wich uppercases the first character of the reference text. In -% order to be able to do that it needs to access the exandable form +% order to be able to do that it needs to access the expandable form % of |\ref|. So we employ a little trick here. We redefine the % (internal) command \verb*|\Ref | to call |\org@ref| instead of -% |\ref|. The disadvantgage of this solution is that whenever the -% derfinition of |\Ref| changes, this definition needs to be updated +% |\ref|. The disadvantage of this solution is that whenever the +% definition of |\Ref| changes, this definition needs to be updated % as well. % % \begin{macrocode} @@ -9436,7 +9518,7 @@ help from Bernd Raichle, for which I am grateful. % Youssef Jabri), which is compatible with \babel{}. % % There are two ways of modifying macros to make them “bidi”, namely, -% by patching the internal low level macros (which is what I have done +% by patching the internal low-level macros (which is what I have done % with lists, columns, counters, tocs, much like |rlbabel| did), and % by introducing a “middle layer” just below the user interface % (sectioning, footnotes). @@ -9453,17 +9535,17 @@ help from Bernd Raichle, for which I am grateful. % and so on, but bidi text does not work out of the box and some % development is necessary. It also provides tools to properly % set left-to-right and right-to-left page layouts. As Lua\TeX-ja -% shows, vertical typesetting is posible, too. Its main drawback +% shows, vertical typesetting is possible, too. Its main drawback % is font handling is often considered to be less mature than % \xetex{}, mainly in Indic scripts (but there are steps to make % HarfBuzz, the \xetex{} font engine, available in \luatex{}; see % ). % \end{itemize} % -% \changes{3.15}{2017/10/30}{Use an attribute instead of tex language +% \changes{babel~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@.} -% \changes{3.28}{2019/04/01}{Dir in boxes within math and other +% \changes{babel~3.15}{2017/10/30}{Store direction in @wdir@.} +% \changes{babel~3.28}{2019/04/01}{Dir in boxes within math and other % contexts (passim).} % % \begin{macrocode} @@ -9599,7 +9681,7 @@ help from Bernd Raichle, for which I am grateful. % properly handle the par direction. Note text and par dirs are % decoupled to some extent (although not completely). % -% \changes{3.16}{2018/01/02}{Fix - the direction prevented the removal +% \changes{babel~3.16}{2018/01/02}{Fix - the direction prevented the removal % of the indent to be re-placed} % % \begin{macrocode} @@ -9634,7 +9716,7 @@ help from Bernd Raichle, for which I am grateful. % A tool for weak L (mainly digits). We also disable warnings with % \textsf{hyperref}. % -% \changes{3.16}{2018/01/02}{New macro \cs{babelsublr}} +% \changes{babel~3.16}{2018/01/02}{New macro \cs{babelsublr}} % % \begin{macrocode} \DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}} @@ -9998,7 +10080,9 @@ help from Bernd Raichle, for which I am grateful. % write to auxs \expandafter\ifx\csname date\languagename\endcsname\relax\else \if@filesw - \protected@write\@auxout{}{\string\babel@aux{\languagename}{}}% + \ifx\babel@aux\@gobbletwo\else % Set if single in the first, redundant + \protected@write\@auxout{}{\string\babel@aux{\languagename}{}}% + \fi \bbl@usehooks{write}{}% \fi \fi} @@ -10093,7 +10177,7 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.9h}{2013/11/29}{Use \cs{def} instead of % \cs{renewcommand} for \cs{BabelLower}} % \changes{babel~3.9i}{2014/03/04}{Added `afterreset' hook} -% \changes{3.15}{2017/10/30}{Remove spaces inside captions and date.} +% \changes{babel~3.15}{2017/10/30}{Remove spaces inside captions and date.} % % \begin{macrocode} \newif\ifbbl@usedategroup @@ -10390,8 +10474,8 @@ help from Bernd Raichle, for which I am grateful. % |\lccode|'s and font encodings are not set at all, so in most % cases you should use |otherlanguage*|. % -% \changes{3.15}{2017/10/30}{Don't set language name. Use temp macro.} -% \changes{3.15}{2018/02/14}{Fix - didn't work with polyglossia} +% \changes{babel~3.15}{2017/10/30}{Don't set language name. Use temp macro.} +% \changes{babel~3.15}{2018/02/14}{Fix - didn't work with polyglossia} % % \begin{macrocode} \def\hyphenrules#1{% @@ -10819,7 +10903,7 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.9f}{2013/05/16}{Restored code to set default % hyphenmins, which was deleted mistakenly} % -% \cs{bbl@languages} saves a snapshot of the loaded languagues in the +% \cs{bbl@languages} saves a snapshot of the loaded languages in the % form \cs{bbl@elt}\marg{language-name}\marg{number}% % \marg{patterns-file}\marg{exceptions-file}. Note the last 2 % arguments are empty in `dialects' defined in |language.dat| with @@ -10884,7 +10968,7 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % % Now, hooks are defined. For efficiency reasons, they are dealt -% here in a special way. Besides \luatex, format specific +% here in a special way. Besides \luatex, format-specific % configuration files are taken into account. % % \changes{babel~3.9b}{2013/03/25}{Fixed an idiot slip: \cs{def} @@ -11054,7 +11138,7 @@ help from Bernd Raichle, for which I am grateful. % % \section{Font handling with fontspec} % -% \changes{3.15}{2017/10/30}{New way to select fonts, with \cs{babelfont}} +% \changes{babel~3.15}{2017/10/30}{New way to select fonts, with \cs{babelfont}} % % Add the bidi handler just before luaoftload, which is loaded by default % by LaTeX. Just in case, consider the possibility it has not been @@ -11127,6 +11211,11 @@ help from Bernd Raichle, for which I am grateful. % % With explicit languages, we could define the font at once, but we % don't. Just wait and see if the language is actually activated. +% |bbl@font| replaces hardcoded font names inside |\..family| by the +% corresponding macro |\..default|. +% +% \changes{babel~3.34}{2019/08/29}{Better checks for fonts, and improved +% compatibility with fontspec.} % % \begin{macrocode} %<<*Font selection>> @@ -11134,14 +11223,18 @@ help from Bernd Raichle, for which I am grateful. \@onlypreamble\babelfont \newcommand\babelfont[2][]{% 1=langs/scripts 2=fam \edef\bbl@tempa{#1}% - \def\bbl@tempb{#2}% + \def\bbl@tempb{#2}% Used by \bbl@bblfont \ifx\fontspec\@undefined \usepackage{fontspec}% \fi \EnableBabelHook{babel-fontspec}% Just calls \bbl@switchfont \bbl@bblfont} -\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname - \bbl@ifunset{\bbl@tempb family}{\bbl@providefam{\bbl@tempb}}{}% +\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt + \bbl@ifunset{\bbl@tempb family}% + {\bbl@providefam{\bbl@tempb}}% + {\bbl@exp{% + \\\bbl@sreplace\<\bbl@tempb family >% + {\@nameuse{\bbl@tempb default}}{\<\bbl@tempb default>}}}% % For the default font, just in case: \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \expandafter\bbl@ifblank\expandafter{\bbl@tempa}% @@ -11169,10 +11262,22 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % % The following macro is activated when the hook |babel-fontspec| is -% enabled. -% -% \begin{macrocode} -\def\bbl@switchfont{% +% enabled. But before we define a macro for a warning, which sets a +% flag to avoid duplicate them. +% +% \begin{macrocode} +\def\bbl@nostdfont#1{% + \bbl@ifunset{bbl@WFF@\f@family}% + {\bbl@csarg\gdef{WFF@\f@family}{}% Flag, to avoid dupl warns + \bbl@warning{The current font is not a babel standard family:\\% + #1% + \fontname\font\\% + There is nothing intrinsically wrong with it, but\\% + 'babel' will no set Script and Language. Consider\\% + defining a new family with \string\babelfont.\\% + Reported}} + {}}% +\gdef\bbl@switchfont{% \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \bbl@exp{% eg Arabic -> arabic \lowercase{\edef\\\bbl@tempa{\bbl@cs{sname@\languagename}}}}% @@ -11188,12 +11293,7 @@ help from Bernd Raichle, for which I am grateful. \global\let\% \}}}% {}}% 1=T - language, already defined - \def\bbl@tempa{% - \bbl@warning{The current font is not a standard family:\\% - \fontname\font\\% - Script and Language are not applied. Consider\\% - defining a new family with \string\babelfont.\\% - Reported}}% + \def\bbl@tempa{\bbl@nostdfont{}}% \bbl@foreach\bbl@font@fams{% don't gather with prev for \bbl@ifunset{bbl@##1dflt@\languagename}% {\bbl@cs{famrst@##1}% @@ -11207,6 +11307,40 @@ help from Bernd Raichle, for which I am grateful. \bbl@ifrestoring{}{\bbl@tempa}}% % \end{macrocode} % +% The following is executed at the beginning of the aux file or the +% document to warn about fonts not defined with |\babelfont|. +% +% \begin{macrocode} +\ifx\f@family\@undefined\else % if latex + \ifcase\bbl@engine % if pdftex + \let\bbl@ckeckstdfonts\relax + \else + \def\bbl@ckeckstdfonts{% + \begingroup + \global\let\bbl@ckeckstdfonts\relax + \let\bbl@tempa\@empty + \bbl@foreach\bbl@font@fams{% + \bbl@ifunset{bbl@##1dflt@}% + {\@nameuse{##1family}% + \bbl@csarg\gdef{WFF@\f@family}{}% Flag + \bbl@exp{\\\bbl@add\\\bbl@tempa{* \<##1family> / \f@family\\\\% + \space\space\fontname\font\\\\}}% + \bbl@csarg\xdef{##1dflt@}{\f@family}% + \expandafter\xdef\csname ##1default\endcsname{\f@family}}% + {}}% + \ifx\bbl@tempa\@empty\else + \bbl@warning{The following fonts are not babel standard families:\\% + \bbl@tempa + There is nothing intrinsically wrong with it, but\\% + 'babel' will no set Script and Language. Consider\\% + defining a new family with \string\babelfont.\\% + Reported}% + \fi + \endgroup} + \fi +\fi +% \end{macrocode} +% % Now the macros defining the font with \textsf{fontspec}. % % When there are repeated keys in \textsf{fontspec}, the last value @@ -11215,7 +11349,7 @@ help from Bernd Raichle, for which I am grateful. % |\bbl@mapselect| because |\selectfont| is called internally when a % font is defined. % -% \changes{3.28}{2019/04/01}{\cs{babelfont} now based on +% \changes{babel~3.28}{2019/04/01}{\cs{babelfont} now based on % \cs{newfontfamily}.} % % \begin{macrocode} @@ -11453,6 +11587,7 @@ help from Bernd Raichle, for which I am grateful. <@Restore Unicode catcodes before loading patterns@>} \ifx\DisableBabelHook\@undefined\endinput\fi \AddBabelHook{babel-fontspec}{afterextras}{\bbl@switchfont} +\AddBabelHook{babel-fontspec}{beforestart}{\bbl@ckeckstdfonts} \DisableBabelHook{babel-fontspec} <@Font selection@> \input txtbabel.def @@ -11478,7 +11613,7 @@ help from Bernd Raichle, for which I am grateful. % Consider |txtbabel| as a shorthand for \textit{tex--xet babel}, % which is the bidi model in both \pdftex{} and \xetex{}. % -% \changes{3.33}{2019/05/04}{\cs{@tabular}, \cs{list}, etc., are +% \changes{babel~3.32}{2019/05/04}{\cs{@tabular}, \cs{list}, etc., are % patched, instead of redefined.} % % \begin{macrocode} @@ -11590,7 +11725,7 @@ help from Bernd Raichle, for which I am grateful. % latter. If there are new synonymous, the are added, but note if the % language patterns have not been preloaded they won't at run time. % -% Other preloaded languages could be read twice, if they has been +% Other preloaded languages could be read twice, if they have been % preloaded into the format. This is not optimal, but it shouldn't % happen very often -- with \luatex{} patterns are best loaded when % the document is typeset, and the ``0th'' language is preloaded just @@ -12111,7 +12246,7 @@ help from Bernd Raichle, for which I am grateful. % (fullwidth \textit{vs.} halfwidth), not yet used. There is a separate % file, defined below. % -% \changes{3.31}{2019/05/04}{Simple CJK line breaking.} +% \changes{babel~3.31}{2019/05/04}{Simple CJK line breaking.} % % \textit{Work in progress.} % @@ -12122,6 +12257,7 @@ help from Bernd Raichle, for which I am grateful. <@Restore Unicode catcodes before loading patterns@>} \ifx\DisableBabelHook\@undefined\endinput\fi \AddBabelHook{babel-fontspec}{afterextras}{\bbl@switchfont} +\AddBabelHook{babel-fontspec}{beforestart}{\bbl@ckeckstdfonts} \DisableBabelHook{babel-fontspec} <@Font selection@> % \end{macrocode} @@ -12153,7 +12289,7 @@ help from Bernd Raichle, for which I am grateful. \AtBeginDocument{\bbl@luafixboxdir} % \end{macrocode} % -% \changes{3.32}{2019/05/23}{New - \cs{babelcharproperty}.} +% \changes{babel~3.32}{2019/05/23}{New - \cs{babelcharproperty}.} % % The code for |\babelcharproperty| is straightforward. Just note the % modified lua table can be different. @@ -12225,12 +12361,12 @@ help from Bernd Raichle, for which I am grateful. % \textsf{hhline}, \textsf{colortbl}, \textsf{longtable}, % \textsf{booktabs}, etc. However, \textsf{dcolumn} still fails. % -% \changes{3.18}{2018/02/14}{\cs{bbl@nextfake}, similar to the old +% \changes{babel~3.18}{2018/02/14}{\cs{bbl@nextfake}, similar to the old % \cs{nextfakemath} in Omega} -% \changes{3.19}{2018/04/23}{Patch \cs{@eqnnum}, somewhat ad hoc. To be +% \changes{babel~3.19}{2018/04/23}{Patch \cs{@eqnnum}, somewhat ad hoc. To be % improved.} -% \changes{3.21}{2018/05/09}{The ad hoc \cs{@eqnnum} was buggy. Fixed.} -% \changes{3.31}{2019/05/04}{\cs{@tabular} and \cs{list} are patched, +% \changes{babel~3.21}{2018/05/09}{The ad hoc \cs{@eqnnum} was buggy. Fixed.} +% \changes{babel~3.31}{2019/05/04}{\cs{@tabular} and \cs{list} are patched, % instead of redefined.} % % \begin{macrocode} @@ -12271,7 +12407,8 @@ help from Bernd Raichle, for which I am grateful. \noindent\box\@tempboxa} \fi \IfBabelLayout{tabular} - {\bbl@replace\@tabular{$}{\bbl@nextfake$}% + {\let\bbl@OL@@tabular\@tabular + \bbl@replace\@tabular{$}{\bbl@nextfake$}% \let\bbl@tabular\@tabular \AtBeginDocument{% \ifx\bbl@tabular\@tabular\else @@ -12279,7 +12416,8 @@ help from Bernd Raichle, for which I am grateful. \fi}} {} \IfBabelLayout{lists} - {\bbl@sreplace\list{\parshape}{\bbl@listparshape}% + {\let\bbl@OL@list\list + \bbl@sreplace\list{\parshape}{\bbl@listparshape}% \def\bbl@listparshape#1#2#3{% \parshape #1 #2 #3 % \ifnum\bbl@getluadir{page}=\bbl@getluadir{par}\else @@ -12295,6 +12433,8 @@ help from Bernd Raichle, for which I am grateful. \textdir TLT\relax \def\bbl@pictresetdir{\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 @@ -12302,6 +12442,7 @@ help from Bernd Raichle, for which I am grateful. \hb@xt@\z@{\kern#1\unitlength{\bbl@pictresetdir#3}\hss}}% \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@add\tikz@atbegin@node{\bbl@pictresetdir}% @@ -12316,19 +12457,26 @@ help from Bernd Raichle, for which I am grateful. % % \begin{macrocode} \IfBabelLayout{counters}% - {\bbl@sreplace\@textsuperscript{\m@th}{\m@th\mathdir\pagedir}% + {\let\bbl@OL@@textsuperscript\@textsuperscript + \bbl@sreplace\@textsuperscript{\m@th}{\m@th\mathdir\pagedir}% \let\bbl@latinarabic=\@arabic + \let\bbl@OL@@arabic\@arabic \def\@arabic#1{\babelsublr{\bbl@latinarabic#1}}% \@ifpackagewith{babel}{bidi=default}% {\let\bbl@asciiroman=\@roman + \let\bbl@OL@@roman\@roman \def\@roman#1{\babelsublr{\ensureascii{\bbl@asciiroman#1}}}% \let\bbl@asciiRoman=\@Roman + \let\bbl@OL@@roman\@Roman \def\@Roman#1{\babelsublr{\ensureascii{\bbl@asciiRoman#1}}}% + \let\bbl@OL@labelenumii\labelenumii \def\labelenumii{)\theenumii(}% + \let\bbl@OL@p@enumiii\p@enumiii \def\p@enumiii{\p@enumii)\theenumii(}}{}}{} <@Footnote changes@> \IfBabelLayout{footnotes}% - {\BabelFootnote\footnote\languagename{}{}% + {\let\bbl@OL@footnote\footnote + \BabelFootnote\footnote\languagename{}{}% \BabelFootnote\localfootnote\languagename{}{}% \BabelFootnote\mainfootnote{}{}{}} {} @@ -12338,11 +12486,13 @@ help from Bernd Raichle, for which I am grateful. % formatting. They have very little in common and are grouped here, as % a single option. % -% \changes{3.19}{2018/04/23}{New option extras for layout} +% \changes{babel~3.19}{2018/04/23}{New option extras for layout} % % \begin{macrocode} \IfBabelLayout{extras}% - {\bbl@sreplace\underline{$\@@underline}{\bbl@nextfake$\@@underline}% + {\let\bbl@OL@underline\underline + \bbl@sreplace\underline{$\@@underline}{\bbl@nextfake$\@@underline}% + \let\bbl@OL@LaTeX2e\LaTeX2e \DeclareRobustCommand{\LaTeXe}{\mbox{\m@th \if b\expandafter\@car\f@series\@nil\boldmath\fi \babelsublr{% @@ -12353,7 +12503,7 @@ help from Bernd Raichle, for which I am grateful. % % \subsection{Auto bidi with \texttt{basic} and \texttt{basic-r}} % -% \changes{3.14}{2017/09/30}{LuaTeX - support for R/AL texts - basic-r} +% \changes{babel~3.14}{2017/09/30}{LuaTeX - support for R/AL texts - basic-r} % % The file \textsf{babel-data-bidi.lua} currently only contains data. It is % a large and boring file and it's not shown here. See the generated diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins index ea54bbbf077..c0e8e5bfb57 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{2019/07/19} +\def\filedate{2019/09/27} \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 063767ea930..8b58d8b7c73 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}[2019/07/19 v3.33] +\ProvidesFile{bbcompat.dtx}[2019/09/27 v3.34] % % %% File 'bbcompat.dtx' diff --git a/Master/texmf-dist/source/latex/babel/locale.zip b/Master/texmf-dist/source/latex/babel/locale.zip index 35eca293a1c..699b8c86854 100644 Binary files a/Master/texmf-dist/source/latex/babel/locale.zip and b/Master/texmf-dist/source/latex/babel/locale.zip differ diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index 02e3a8c8f6d..d655e4faa53 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -41,7 +41,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2019/07/19 3.33 Babel common definitions] +\ProvidesFile{babel.def}[2019/09/27 3.34 Babel common definitions] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi @@ -65,6 +65,7 @@ \def\bbl@opt@safe{BR} \ifx\@uclclist\@undefined\let\@uclclist\@empty\fi \ifx\bbl@trace\@undefined\def\bbl@trace#1{}\fi + \expandafter\newif\csname ifbbl@single\endcsname \fi \ifx\bbl@switchflag\@undefined % Prevent double input \let\bbl@switchflag\relax @@ -121,6 +122,12 @@ #2}} \long\def\bbl@afterelse#1\else#2\fi{\fi#1} \long\def\bbl@afterfi#1\fi{\fi#1} +\def\bbl@exp#1{% + \begingroup + \let\\\noexpand + \def\<##1>{\expandafter\noexpand\csname##1\endcsname}% + \edef\bbl@exp@aux{\endgroup#1}% + \bbl@exp@aux} \def\bbl@tempa#1{% \long\def\bbl@trim##1##2{% \futurelet\bbl@trim@a\bbl@trim@c##2\@nil\@nil#1\@nil\relax{##1}}% @@ -187,9 +194,10 @@ \fi}% \expandafter\bbl@replace@aux#1#2\bbl@nil#2% \edef#1{\the\toks@}} -\expandafter\def\expandafter\bbl@parsedef\detokenize{macro:}#1->#2\relax{% +\bbl@exp{\def\\\bbl@parsedef##1\detokenize{macro:}}#2->#3\relax{% \def\bbl@tempa{#1}% - \def\bbl@tempb{#2}} + \def\bbl@tempb{#2}% + \def\bbl@tempe{#3}} \def\bbl@sreplace#1#2#3{% \begingroup \expandafter\bbl@parsedef\meaning#1\relax @@ -197,18 +205,20 @@ \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}% \def\bbl@tempd{#3}% \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}% - \bbl@exp{\\\bbl@replace\\\bbl@tempb{\bbl@tempc}{\bbl@tempd}}% - \bbl@exp{% + \bbl@xin@{\bbl@tempc}{\bbl@tempe}% If not in macro, do nothing + \ifin@ + \bbl@exp{\\\bbl@replace\\\bbl@tempe{\bbl@tempc}{\bbl@tempd}}% + \def\bbl@tempc{% Expanded an executed below as 'uplevel' + \\\makeatletter % "internal" macros with @ are assumed + \\\scantokens{% + \bbl@tempa\\\@namedef{\bbl@stripslash#1}\bbl@tempb{\bbl@tempe}}% + \catcode64=\the\catcode64\relax}% Restore @ + \else + \let\bbl@tempc\@empty % Not \relax + \fi + \bbl@exp{% For the 'uplevel' assignments \endgroup - \\\makeatletter % "internal" macros with @ are assumed - \\\scantokens{\def\\#1\bbl@tempa{\bbl@tempb}}% - \catcode64=\the\catcode64\relax}} % Restore @ -\def\bbl@exp#1{% - \begingroup - \let\\\noexpand - \def\<##1>{\expandafter\noexpand\csname##1\endcsname}% - \edef\bbl@exp@aux{\endgroup#1}% - \bbl@exp@aux} + \bbl@tempc}} % empty or expand to set #1 with changes \def\bbl@ifsamestring#1#2{% \begingroup \protected@edef\bbl@tempb{#1}% @@ -288,7 +298,8 @@ everylanguage=1,loadkernel=1,loadpatterns=1,loadexceptions=1,% adddialect=2,patterns=2,defaultcommands=0,encodedcommands=2,write=0,% beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,% - hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0} + hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,% + beforestart=0} \bbl@trace{Defining babelensure} \newcommand\babelensure[2][]{% TODO - revise test files \AddBabelHook{babel-ensure}{afterextras}{% @@ -405,8 +416,22 @@ \bbl@id@assign \chardef\localeid\@nameuse{bbl@id@@\languagename}% \bbl@patterns{\languagename}} +\def\bbl@beforestart{% + \bbl@usehooks{beforestart}{}% + \global\let\bbl@beforestart\relax} \AtBeginDocument{% + \bbl@beforestart + \if@filesw + \immediate\write\@mainaux{% + % \let\string\bbl@nostdfont\string\@gobble + \string\bbl@beforestart}% + \fi \expandafter\selectlanguage\expandafter{\bbl@main@language}% + \ifbbl@single % must go after the line above + \renewcommand\selectlanguage[1]{}% + \renewcommand\foreignlanguage[2]{#2}% + \global\let\babel@aux\@gobbletwo % Also as flag + \fi \ifcase\bbl@engine\or\pagedir\bodydir\fi} % TODO - a better place \def\select@language@x#1{% \ifcase\bbl@select@type @@ -473,7 +498,7 @@ \expandafter\let\csname normal@char#2\endcsname#3% \else \bbl@info{Making #2 an active character}% - \ifnum\mathcode`#2="8000 + \ifnum\mathcode`#2=\ifodd\bbl@engine"1000000 \else"8000 \fi \@namedef{normal@char#2}{% \textormath{#3}{\csname bbl@oridef@@#2\endcsname}}% \else @@ -1551,8 +1576,10 @@ \catcode`\@=\atcatcode \let\atcatcode\relax \fi}% - \let\languagename\bbl@savelangname - \chardef\localeid\bbl@savelocaleid\relax} + \ifx\bbl@KVP@main\@nil % Restore only if not 'main' + \let\languagename\bbl@savelangname + \chardef\localeid\bbl@savelocaleid\relax + \fi} \def\bbl@setdigits#1#2#3#4#5{% \bbl@exp{% \def\<\languagename digits>####1{% ie, \langdigits @@ -1682,6 +1709,15 @@ \let\bbl@savestrings\@empty \let\bbl@savetoday\@empty \let\bbl@savedate\@empty + \def\bbl@inipreread##1=##2\@@{% + \bbl@trim@def\bbl@tempa{##1}% Redundant below !! + % Move trims here ?? + \bbl@ifunset{bbl@KVP@\bbl@section/\bbl@tempa}% + {\expandafter\bbl@inireader\bbl@tempa=##2\@@}% + {\def\bbl@tempc{\expandafter\bbl@inireader\bbl@tempa=}% + \expandafter\expandafter\expandafter + \bbl@tempc\csname bbl@KVP@\bbl@section/\bbl@tempa\endcsname\@@}% + \global\bbl@csarg\let{KVP@\bbl@section/\bbl@tempa}\relax}% \let\bbl@inireader\bbl@iniskip \bbl@info{Importing data from babel-#1.ini for \languagename}% \loop @@ -1695,7 +1731,7 @@ \repeat \fi} \def\bbl@iniline#1\bbl@iniline{% - \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inireader}#1\@@}% ] + \@ifnextchar[\bbl@inisec{\@ifnextchar;\bbl@iniskip\bbl@inipreread}#1\@@}% ] \def\bbl@iniskip#1\@@{}% if starts with ; \def\bbl@inisec[#1]#2\@@{% if starts with opening bracket \@nameuse{bbl@secpost@\bbl@section}% ends previous section @@ -1860,6 +1896,7 @@ \bbl@add\bbl@secpost@identification{\closein1 }% \catcode`\[=12 \catcode`\]=12 \catcode`\==12 % \bbl@read@ini{##1}% + \endinput \endgroup}% boxed, to avoid extra spaces: {\setbox\z@\hbox{\InputIfFileExists{babel-#1.tex}{}{}}}} {\def\format{lplain} @@ -1959,30 +1996,32 @@ \edef\thepage{% \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}}% \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@}}}}}% - \ifx\@mkboth\markboth - \def\bbl@tempc{\let\@mkboth\markboth} - \else - \def\bbl@tempc{} - \fi - \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@tempc} % end \IfBabelLayout + {\ifbbl@single\else + \bbl@redefine\markright#1{% + \bbl@ifblank{#1}% + {\org@markright{}}% + {\toks@{#1}% + \bbl@exp{% + \\\org@markright{\\\protect\\\foreignlanguage{\languagename}% + {\\\protect\\\bbl@restore@actives\the\toks@}}}}}% + \ifx\@mkboth\markboth + \def\bbl@tempc{\let\@mkboth\markboth} + \else + \def\bbl@tempc{} + \fi + \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@tempc + \fi} % end ifbbl@single, end \IfBabelLayout \bbl@trace{Preventing clashes with other packages} \bbl@xin@{R}\bbl@opt@safe \ifin@ diff --git a/Master/texmf-dist/tex/generic/babel/babel.sty b/Master/texmf-dist/tex/generic/babel/babel.sty index e866fbbdd6a..d4da81cfb83 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.sty +++ b/Master/texmf-dist/tex/generic/babel/babel.sty @@ -33,7 +33,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{babel}[2019/07/19 3.33 The Babel package] +\ProvidesPackage{babel}[2019/09/27 3.34 The Babel package] \@ifpackagewith{babel}{debug} {\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}% \let\bbl@debug\@firstofone} @@ -72,6 +72,12 @@ #2}} \long\def\bbl@afterelse#1\else#2\fi{\fi#1} \long\def\bbl@afterfi#1\fi{\fi#1} +\def\bbl@exp#1{% + \begingroup + \let\\\noexpand + \def\<##1>{\expandafter\noexpand\csname##1\endcsname}% + \edef\bbl@exp@aux{\endgroup#1}% + \bbl@exp@aux} \def\bbl@tempa#1{% \long\def\bbl@trim##1##2{% \futurelet\bbl@trim@a\bbl@trim@c##2\@nil\@nil#1\@nil\relax{##1}}% @@ -138,9 +144,10 @@ \fi}% \expandafter\bbl@replace@aux#1#2\bbl@nil#2% \edef#1{\the\toks@}} -\expandafter\def\expandafter\bbl@parsedef\detokenize{macro:}#1->#2\relax{% +\bbl@exp{\def\\\bbl@parsedef##1\detokenize{macro:}}#2->#3\relax{% \def\bbl@tempa{#1}% - \def\bbl@tempb{#2}} + \def\bbl@tempb{#2}% + \def\bbl@tempe{#3}} \def\bbl@sreplace#1#2#3{% \begingroup \expandafter\bbl@parsedef\meaning#1\relax @@ -148,18 +155,20 @@ \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}% \def\bbl@tempd{#3}% \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}% - \bbl@exp{\\\bbl@replace\\\bbl@tempb{\bbl@tempc}{\bbl@tempd}}% - \bbl@exp{% + \bbl@xin@{\bbl@tempc}{\bbl@tempe}% If not in macro, do nothing + \ifin@ + \bbl@exp{\\\bbl@replace\\\bbl@tempe{\bbl@tempc}{\bbl@tempd}}% + \def\bbl@tempc{% Expanded an executed below as 'uplevel' + \\\makeatletter % "internal" macros with @ are assumed + \\\scantokens{% + \bbl@tempa\\\@namedef{\bbl@stripslash#1}\bbl@tempb{\bbl@tempe}}% + \catcode64=\the\catcode64\relax}% Restore @ + \else + \let\bbl@tempc\@empty % Not \relax + \fi + \bbl@exp{% For the 'uplevel' assignments \endgroup - \\\makeatletter % "internal" macros with @ are assumed - \\\scantokens{\def\\#1\bbl@tempa{\bbl@tempb}}% - \catcode64=\the\catcode64\relax}} % Restore @ -\def\bbl@exp#1{% - \begingroup - \let\\\noexpand - \def\<##1>{\expandafter\noexpand\csname##1\endcsname}% - \edef\bbl@exp@aux{\endgroup#1}% - \bbl@exp@aux} + \bbl@tempc}} % empty or expand to set #1 with changes \def\bbl@ifsamestring#1#2{% \begingroup \protected@edef\bbl@tempb{#1}% @@ -313,6 +322,8 @@ \DeclareOption{silent}{} \DeclareOption{mono}{} \DeclareOption{shorthands=off}{\bbl@tempa shorthands=\bbl@tempa} +\newif\ifbbl@single +\DeclareOption{selectors=off}{\bbl@singletrue} \DeclareOption{math=active}{} \DeclareOption{math=normal}{\def\bbl@mathnormal{\noexpand\textormath}} \DeclareOption{nocase}{} diff --git a/Master/texmf-dist/tex/generic/babel/hyphen.cfg b/Master/texmf-dist/tex/generic/babel/hyphen.cfg index d658be7135f..830f587b6fb 100644 --- a/Master/texmf-dist/tex/generic/babel/hyphen.cfg +++ b/Master/texmf-dist/tex/generic/babel/hyphen.cfg @@ -37,7 +37,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{hyphen.cfg}[2019/07/19 3.33 Babel hyphens] +\ProvidesFile{hyphen.cfg}[2019/09/27 3.34 Babel hyphens] \xdef\bbl@format{\jobname} \ifx\AtBeginDocument\@undefined \def\@empty{} diff --git a/Master/texmf-dist/tex/generic/babel/locale/tr/babel-turkish.tex b/Master/texmf-dist/tex/generic/babel/locale/tr/babel-turkish.tex index e7346cf2515..3653ca6ff2a 100644 --- a/Master/texmf-dist/tex/generic/babel/locale/tr/babel-turkish.tex +++ b/Master/texmf-dist/tex/generic/babel/locale/tr/babel-turkish.tex @@ -10,7 +10,7 @@ \BabelBeforeIni{tr}{% } -\StartBabelCommands*{turkish}{} +\StartBabelCommands{turkish}{} \SetCase {\uccode`i=`İ\relax \uccode`ı=`I\relax} diff --git a/Master/texmf-dist/tex/generic/babel/luababel.def b/Master/texmf-dist/tex/generic/babel/luababel.def index 69f0adfe3aa..2508b19f91b 100644 --- a/Master/texmf-dist/tex/generic/babel/luababel.def +++ b/Master/texmf-dist/tex/generic/babel/luababel.def @@ -490,19 +490,24 @@ \input #1\relax} \ifx\DisableBabelHook\@undefined\endinput\fi \AddBabelHook{babel-fontspec}{afterextras}{\bbl@switchfont} +\AddBabelHook{babel-fontspec}{beforestart}{\bbl@ckeckstdfonts} \DisableBabelHook{babel-fontspec} \bbl@trace{Font handling with fontspec} \@onlypreamble\babelfont \newcommand\babelfont[2][]{% 1=langs/scripts 2=fam \edef\bbl@tempa{#1}% - \def\bbl@tempb{#2}% + \def\bbl@tempb{#2}% Used by \bbl@bblfont \ifx\fontspec\@undefined \usepackage{fontspec}% \fi \EnableBabelHook{babel-fontspec}% Just calls \bbl@switchfont \bbl@bblfont} -\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname - \bbl@ifunset{\bbl@tempb family}{\bbl@providefam{\bbl@tempb}}{}% +\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt + \bbl@ifunset{\bbl@tempb family}% + {\bbl@providefam{\bbl@tempb}}% + {\bbl@exp{% + \\\bbl@sreplace\<\bbl@tempb family >% + {\@nameuse{\bbl@tempb default}}{\<\bbl@tempb default>}}}% % For the default font, just in case: \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \expandafter\bbl@ifblank\expandafter{\bbl@tempa}% @@ -521,7 +526,18 @@ \\\not@math@alphabet\<#1family>\relax \\\fontfamily\<#1default>\\\selectfont}% \\\DeclareTextFontCommand{\}{\<#1family>}}} -\def\bbl@switchfont{% +\def\bbl@nostdfont#1{% + \bbl@ifunset{bbl@WFF@\f@family}% + {\bbl@csarg\gdef{WFF@\f@family}{}% Flag, to avoid dupl warns + \bbl@warning{The current font is not a babel standard family:\\% + #1% + \fontname\font\\% + There is nothing intrinsically wrong with it, but\\% + 'babel' will no set Script and Language. Consider\\% + defining a new family with \string\babelfont.\\% + Reported}} + {}}% +\gdef\bbl@switchfont{% \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \bbl@exp{% eg Arabic -> arabic \lowercase{\edef\\\bbl@tempa{\bbl@cs{sname@\languagename}}}}% @@ -537,12 +553,7 @@ \global\let\% \}}}% {}}% 1=T - language, already defined - \def\bbl@tempa{% - \bbl@warning{The current font is not a standard family:\\% - \fontname\font\\% - Script and Language are not applied. Consider\\% - defining a new family with \string\babelfont.\\% - Reported}}% + \def\bbl@tempa{\bbl@nostdfont{}}% \bbl@foreach\bbl@font@fams{% don't gather with prev for \bbl@ifunset{bbl@##1dflt@\languagename}% {\bbl@cs{famrst@##1}% @@ -554,6 +565,34 @@ \\\bbl@font@set\% the main part! \<##1default>\<##1family>}}}% \bbl@ifrestoring{}{\bbl@tempa}}% +\ifx\f@family\@undefined\else % if latex + \ifcase\bbl@engine % if pdftex + \let\bbl@ckeckstdfonts\relax + \else + \def\bbl@ckeckstdfonts{% + \begingroup + \global\let\bbl@ckeckstdfonts\relax + \let\bbl@tempa\@empty + \bbl@foreach\bbl@font@fams{% + \bbl@ifunset{bbl@##1dflt@}% + {\@nameuse{##1family}% + \bbl@csarg\gdef{WFF@\f@family}{}% Flag + \bbl@exp{\\\bbl@add\\\bbl@tempa{* \<##1family> / \f@family\\\\% + \space\space\fontname\font\\\\}}% + \bbl@csarg\xdef{##1dflt@}{\f@family}% + \expandafter\xdef\csname ##1default\endcsname{\f@family}}% + {}}% + \ifx\bbl@tempa\@empty\else + \bbl@warning{The following fonts are not babel standard families:\\% + \bbl@tempa + There is nothing intrinsically wrong with it, but\\% + 'babel' will no set Script and Language. Consider\\% + defining a new family with \string\babelfont.\\% + Reported}% + \fi + \endgroup} + \fi +\fi \def\bbl@font@set#1#2#3{% eg \bbl@rmdflt@lang \rmdefault \rmfamily \bbl@xin@{<>}{#1}% \ifin@ @@ -724,7 +763,8 @@ \noindent\box\@tempboxa} \fi \IfBabelLayout{tabular} - {\bbl@replace\@tabular{$}{\bbl@nextfake$}% + {\let\bbl@OL@@tabular\@tabular + \bbl@replace\@tabular{$}{\bbl@nextfake$}% \let\bbl@tabular\@tabular \AtBeginDocument{% \ifx\bbl@tabular\@tabular\else @@ -732,7 +772,8 @@ \fi}} {} \IfBabelLayout{lists} - {\bbl@sreplace\list{\parshape}{\bbl@listparshape}% + {\let\bbl@OL@list\list + \bbl@sreplace\list{\parshape}{\bbl@listparshape}% \def\bbl@listparshape#1#2#3{% \parshape #1 #2 #3 % \ifnum\bbl@getluadir{page}=\bbl@getluadir{par}\else @@ -748,6 +789,8 @@ \textdir TLT\relax \def\bbl@pictresetdir{\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 @@ -755,21 +798,28 @@ \hb@xt@\z@{\kern#1\unitlength{\bbl@pictresetdir#3}\hss}}% \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@add\tikz@atbegin@node{\bbl@pictresetdir}% \fi}} {} \IfBabelLayout{counters}% - {\bbl@sreplace\@textsuperscript{\m@th}{\m@th\mathdir\pagedir}% + {\let\bbl@OL@@textsuperscript\@textsuperscript + \bbl@sreplace\@textsuperscript{\m@th}{\m@th\mathdir\pagedir}% \let\bbl@latinarabic=\@arabic + \let\bbl@OL@@arabic\@arabic \def\@arabic#1{\babelsublr{\bbl@latinarabic#1}}% \@ifpackagewith{babel}{bidi=default}% {\let\bbl@asciiroman=\@roman + \let\bbl@OL@@roman\@roman \def\@roman#1{\babelsublr{\ensureascii{\bbl@asciiroman#1}}}% \let\bbl@asciiRoman=\@Roman + \let\bbl@OL@@roman\@Roman \def\@Roman#1{\babelsublr{\ensureascii{\bbl@asciiRoman#1}}}% + \let\bbl@OL@labelenumii\labelenumii \def\labelenumii{)\theenumii(}% + \let\bbl@OL@p@enumiii\p@enumiii \def\p@enumiii{\p@enumii)\theenumii(}}{}}{} \bbl@trace{Bidi footnotes} \ifx\bbl@beforeforeign\leavevmode @@ -817,12 +867,15 @@ {\bbl@exp{\\\bbl@footnotetext{\\\foreignlanguage{#2}}}{#3}{#4}}}} \fi \IfBabelLayout{footnotes}% - {\BabelFootnote\footnote\languagename{}{}% + {\let\bbl@OL@footnote\footnote + \BabelFootnote\footnote\languagename{}{}% \BabelFootnote\localfootnote\languagename{}{}% \BabelFootnote\mainfootnote{}{}{}} {} \IfBabelLayout{extras}% - {\bbl@sreplace\underline{$\@@underline}{\bbl@nextfake$\@@underline}% + {\let\bbl@OL@underline\underline + \bbl@sreplace\underline{$\@@underline}{\bbl@nextfake$\@@underline}% + \let\bbl@OL@LaTeX2e\LaTeX2e \DeclareRobustCommand{\LaTeXe}{\mbox{\m@th \if b\expandafter\@car\f@series\@nil\boldmath\fi \babelsublr{% diff --git a/Master/texmf-dist/tex/generic/babel/nil.ldf b/Master/texmf-dist/tex/generic/babel/nil.ldf index d16b8e4f752..30e9ceb01eb 100644 --- a/Master/texmf-dist/tex/generic/babel/nil.ldf +++ b/Master/texmf-dist/tex/generic/babel/nil.ldf @@ -32,7 +32,7 @@ %% extension |.ins|) which are part of the distribution. %% -\ProvidesLanguage{nil}[2019/07/19 3.33 Nil language] +\ProvidesLanguage{nil}[2019/09/27 3.34 Nil language] \LdfInit{nil}{datenil} \ifx\l@nil\@undefined \newlanguage\l@nil diff --git a/Master/texmf-dist/tex/generic/babel/switch.def b/Master/texmf-dist/tex/generic/babel/switch.def index c0a24834630..9b43136cbbe 100644 --- a/Master/texmf-dist/tex/generic/babel/switch.def +++ b/Master/texmf-dist/tex/generic/babel/switch.def @@ -37,7 +37,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{switch.def}[2019/07/19 3.33 Babel switching mechanism] +\ProvidesFile{switch.def}[2019/09/27 3.34 Babel switching mechanism] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi @@ -58,8 +58,8 @@ \countdef\last@language=19 \def\addlanguage{\alloc@9\language\chardef\@cclvi} \fi -\def\bbl@version{3.33} -\def\bbl@date{2019/07/19} +\def\bbl@version{3.34} +\def\bbl@date{2019/09/27} \def\adddialect#1#2{% \global\chardef#1#2\relax \bbl@usehooks{adddialect}{{#1}{#2}}% @@ -139,7 +139,9 @@ % write to auxs \expandafter\ifx\csname date\languagename\endcsname\relax\else \if@filesw - \protected@write\@auxout{}{\string\babel@aux{\languagename}{}}% + \ifx\babel@aux\@gobbletwo\else % Set if single in the first, redundant + \protected@write\@auxout{}{\string\babel@aux{\languagename}{}}% + \fi \bbl@usehooks{write}{}% \fi \fi} diff --git a/Master/texmf-dist/tex/generic/babel/xebabel.def b/Master/texmf-dist/tex/generic/babel/xebabel.def index bf2da9aca63..f3ab376c6f8 100644 --- a/Master/texmf-dist/tex/generic/babel/xebabel.def +++ b/Master/texmf-dist/tex/generic/babel/xebabel.def @@ -82,19 +82,24 @@ \input #1\relax} \ifx\DisableBabelHook\@undefined\endinput\fi \AddBabelHook{babel-fontspec}{afterextras}{\bbl@switchfont} +\AddBabelHook{babel-fontspec}{beforestart}{\bbl@ckeckstdfonts} \DisableBabelHook{babel-fontspec} \bbl@trace{Font handling with fontspec} \@onlypreamble\babelfont \newcommand\babelfont[2][]{% 1=langs/scripts 2=fam \edef\bbl@tempa{#1}% - \def\bbl@tempb{#2}% + \def\bbl@tempb{#2}% Used by \bbl@bblfont \ifx\fontspec\@undefined \usepackage{fontspec}% \fi \EnableBabelHook{babel-fontspec}% Just calls \bbl@switchfont \bbl@bblfont} -\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname - \bbl@ifunset{\bbl@tempb family}{\bbl@providefam{\bbl@tempb}}{}% +\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt + \bbl@ifunset{\bbl@tempb family}% + {\bbl@providefam{\bbl@tempb}}% + {\bbl@exp{% + \\\bbl@sreplace\<\bbl@tempb family >% + {\@nameuse{\bbl@tempb default}}{\<\bbl@tempb default>}}}% % For the default font, just in case: \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \expandafter\bbl@ifblank\expandafter{\bbl@tempa}% @@ -113,7 +118,18 @@ \\\not@math@alphabet\<#1family>\relax \\\fontfamily\<#1default>\\\selectfont}% \\\DeclareTextFontCommand{\}{\<#1family>}}} -\def\bbl@switchfont{% +\def\bbl@nostdfont#1{% + \bbl@ifunset{bbl@WFF@\f@family}% + {\bbl@csarg\gdef{WFF@\f@family}{}% Flag, to avoid dupl warns + \bbl@warning{The current font is not a babel standard family:\\% + #1% + \fontname\font\\% + There is nothing intrinsically wrong with it, but\\% + 'babel' will no set Script and Language. Consider\\% + defining a new family with \string\babelfont.\\% + Reported}} + {}}% +\gdef\bbl@switchfont{% \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \bbl@exp{% eg Arabic -> arabic \lowercase{\edef\\\bbl@tempa{\bbl@cs{sname@\languagename}}}}% @@ -129,12 +145,7 @@ \global\let\% \}}}% {}}% 1=T - language, already defined - \def\bbl@tempa{% - \bbl@warning{The current font is not a standard family:\\% - \fontname\font\\% - Script and Language are not applied. Consider\\% - defining a new family with \string\babelfont.\\% - Reported}}% + \def\bbl@tempa{\bbl@nostdfont{}}% \bbl@foreach\bbl@font@fams{% don't gather with prev for \bbl@ifunset{bbl@##1dflt@\languagename}% {\bbl@cs{famrst@##1}% @@ -146,6 +157,34 @@ \\\bbl@font@set\% the main part! \<##1default>\<##1family>}}}% \bbl@ifrestoring{}{\bbl@tempa}}% +\ifx\f@family\@undefined\else % if latex + \ifcase\bbl@engine % if pdftex + \let\bbl@ckeckstdfonts\relax + \else + \def\bbl@ckeckstdfonts{% + \begingroup + \global\let\bbl@ckeckstdfonts\relax + \let\bbl@tempa\@empty + \bbl@foreach\bbl@font@fams{% + \bbl@ifunset{bbl@##1dflt@}% + {\@nameuse{##1family}% + \bbl@csarg\gdef{WFF@\f@family}{}% Flag + \bbl@exp{\\\bbl@add\\\bbl@tempa{* \<##1family> / \f@family\\\\% + \space\space\fontname\font\\\\}}% + \bbl@csarg\xdef{##1dflt@}{\f@family}% + \expandafter\xdef\csname ##1default\endcsname{\f@family}}% + {}}% + \ifx\bbl@tempa\@empty\else + \bbl@warning{The following fonts are not babel standard families:\\% + \bbl@tempa + There is nothing intrinsically wrong with it, but\\% + 'babel' will no set Script and Language. Consider\\% + defining a new family with \string\babelfont.\\% + Reported}% + \fi + \endgroup} + \fi +\fi \def\bbl@font@set#1#2#3{% eg \bbl@rmdflt@lang \rmdefault \rmfamily \bbl@xin@{<>}{#1}% \ifin@ -- cgit v1.2.3