diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/babel')
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.dtx | 575 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.ins | 594 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/babel/bbunicode.dtx | 75 |
3 files changed, 806 insertions, 438 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index 1b004611f5c..d279bd0cab9 100644 --- a/Master/texmf-dist/source/latex/babel/babel.dtx +++ b/Master/texmf-dist/source/latex/babel/babel.dtx @@ -44,16 +44,16 @@ % %% File 'babel.dtx' %\fi -%%\ProvidesFile{babel.dtx}[2013/12/03 v3.9h The Babel package] +%%\ProvidesFile{babel.dtx}[2014/03/15 v3.9i The Babel package] %\iffalse % % Babel DOCUMENT-STYLE option for LaTeX version 2.09 or plain TeX; %% Babel package for LaTeX2e. % -%% Copyright (C) 1989 -- 2008 by Johannes Braams, +%% Copyright (C) 1989-2008 by Johannes Braams, %% TeXniek %% all rights reserved. -%% Copyright (C) 2013 by Johannes Braams +%% Copyright (C) 2013-2014 by Johannes Braams %% TeXniek %% by Javier Bezos %% all rights reserved. @@ -109,7 +109,8 @@ \babelhyphen,\babelhyphenation,\spanishhyphenmins,\addto, \StartBabelCommands,\SetString,\EndBabelCommands,\shorthandoff, \languageshorthands,\useshorthands,\AddBabelHook,\SetStringLoop, - \SetCase,\AfterBabelLanguage,\SetHyphenMap,\BabelLowerMM}, + \SetCase,\AfterBabelLanguage,\SetHyphenMap,\BabelLowerMM, + \babelensure,\babeltags}, keywordstyle=[0]\color{thered}, keywords=[1]{ngerman,italian,dutch,english,main,esperanto, frenchb,shorthands,extrasfrench,extrasrussian,extrasenglish, @@ -185,8 +186,8 @@ \vspace{2cm}\hspace{1.5cm} \begin{minipage}{5cm} \Large -Version 3.9h\newline -2013/12/03 +Version 3.9i\newline +2014/03/15 \vspace{1cm} \textit{Original author}\newline @@ -340,9 +341,10 @@ switch the language in multilingual document. The main language is selected automatically when the |document| environment begins. In the preamble it has \textit{not} been selected, -except hyphenation patterns and the name assigned to -|\languagename|. If you need to define boxes and the like in the -preamble, you might want to use some of the following commands. +except hyphenation patterns and the name assigned to |\languagename| +(in particular, shorthands, captions and date are not activated). If +you need to define boxes and the like in the preamble, you might want +to use some of the following commands. \Describe\selectlanguage{\marg{language}} When a user wants to switch from one language to another he can @@ -398,7 +400,7 @@ language, \emph{not} the names and dates, (2) does not send information about the language to auxiliary files (i.e., the surrounding language is still in force), and (3) it works even if the language has not been set as package option (but in such a -case it only sets the hyphenation patterns). +case it only sets the hyphenation patterns and a warning is shown). \Describe{\begin\menv{otherlanguage*}}% {\marg{language}\Eenv{otherlanguage*}} @@ -427,6 +429,65 @@ like, say, |'| done by some languages (eg, \textsf{italian}, \textsf{frenchb}, \textsf{ukraineb}). To set hyphenation exceptions, use |\babelhyphenation| (see below). +\subsection{More on selection} + +\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 commands +above can be cumbersome. With this tool shorter names can be +defined. It adds nothing really new -- it is just syntactical sugar. + +It defines |\text|\m{tag1}\marg{text} to be +|\foreignlanguage|\marg{language1}\marg{text}, and |\begin|\marg{tag1} + to be |\begin{otherlanguage*}|\marg{language1}, and so on. Note + |\|\m{tag1} is also allowed, but remember set it locally inside a + group. So, with +\begin{verbatim} +\babeltags{de = german} +\end{verbatim} +yo can write +\begin{verbatim} +text \textde{German text} text +\end{verbatim} +and +\begin{verbatim} +text +\begin{de} +German text +\end{de} +text +\end{verbatim} + +\Describe\babelensure{|[include=|\m{commands}|,exclude=|\m{commands}% + |,fontenc=|\m{encoding}|]|\marg{language}} + +\New{3.9i} Except in a few languages, like Russian, captions and +dates are just strings, and do not switch the language. That means +you should set it explicitly if you want to use them, or hyphenation +(and in some cases the text itself) will be wrong. For example: +\begin{verbatim} +\foreignlanguage{russian}{text \foreignlanguage{polish}{\seename} text} +\end{verbatim} + +Of course, \TeX{} can do it for you. To avoid switching the language +all the while, |\babelensure| redefines the captions for a given +language to wrap them with a selector. By default only the basic +captions and |\today| are redefined, but you can add further macros +with the key |include| in the optional argument (without +commas). Macros not to be modified are listed in |exclude|. You can +also enforce a font encoding with |fontenc|.\footnote{With it encoded +string may not work as expected.} A couple of examples: +\begin{verbatim} +\babelensure[include=\Today]{spanish} +\babelensure[fontenc=T5]{vietnamese} +\end{verbatim} + +They are activated when the language is selected (at the |afterextras| +event), and it makes some assumptions which could not be fulfilled in +some languages. Note also you should include only macros defined by +the language, not global macros (eg, |\TeX| of |\dag|). + \subsection{Getting the current language name} \Describe\languagename{} @@ -461,10 +522,37 @@ contains glyphs for Modern Greek does not mean it includes them for Classic Greek. As to directionality, it poses special challenges because it also affects individual characters and layout elements.} -Note however some languages sharing the same script define macros to -switch it (eg, |\textcyrillic|), but be aware they may also set the -language to a certain default. Even the \babel{} core defines -|\textlatin|, but its use is now discouraged. +Some languages sharing the same script define macros to switch it (eg, +|\textcyrillic|), but be aware they may also set the language to a +certain default. Even the \babel{} core defined |\textlatin|, but is +was somewhat buggy because in some cases it messed up encodings and +fonts (for example, if the main latin encoding was |LY1|), and +therefore it has been deprecated.\footnote{But still defined for +backwards compatibility.} + +\Describe{\ensureascii}{\marg{text}} + +\New{3.9i} This macro makes sure \marg{text} is typeset with a +LICR-savvy encoding in the ASCII range. It is used to redefine |\TeX| +and |\LaTeX| so that they are correctly typeset even with |LGR| or +|X2| (the complete list is stored in |\BabelNonASCII|, which by default +is |LGR|, |X2|, |OT2|, |OT3|, |OT6|, |LHE|, |LWN|, |LMA|, |LMC|, +|LMS|, |LMU|, but you can modify it). So, in some sense it fixes the +bug described in the previous paragraph. + +If non-ASCII encodings are not loaded (or no encoding at all), it is +no-op (also |\TeX| and |\LaTeX| are not redefined); otherwise, +|\ensureascii| switches to the encoding at the beginning of the +document if ASCII-savvy, or else the last ASCII-savvy encoding +loaded. For example, if you load |LY1,LGR|, then it is set to |LY1|, +but if you load |LY1,T2A| it is set to |T2A|. The symbol encodings +|TS1|, |T3|, and |TS3| are not taken into account, since they are not +used for ``ordinary'' text. + +The foregoing rules (which are applied ``at begin document'') cover +most of cases. Note no asumption is made on characters above +127, which may not follow the LICR conventions -- the goal is just +to ensure most of the ASCII letters and symbols are the right ones. \subsection{Shorthands} @@ -494,9 +582,11 @@ use only shorthands provided by languages. Please, note the following: \begin{enumerate} -\item Activated chars used for two-char shorthands cannot be - followed by a closing brace |}| and the spaces following are - gobbled. With one-char shorthands (eg,~|:|), they are preserved. +\item Activated chars used for two-char shorthands cannot be followed + by a closing brace |}| and the spaces following are gobbled + (\New{3.9i} this + doesn't applies to \luatex). With one-char shorthands (eg,~|:|), + they are preserved. \item If on a certain level (system, language, user) there is a one-char shorthand, two-char ones starting with that char and on the same level are ignored. @@ -525,7 +615,7 @@ sets the |\catcode| to active (13). Both commands only work on `known' shorthand characters. If a character is not known to be a shorthand character its category code will be left unchanged. -\New{3.9} Note however, |\shorthandoff| does not behave as +\New{3.9a} Note however, |\shorthandoff| does not behave as you would expect with characters like |~| or |^|, because they usually are not ``other''. For them |\shorthandoff*| is provided, so that with @@ -545,7 +635,7 @@ The command |\useshorthands| initiates the definition of user-defined shorthand sequences. It has one argument, the character that starts these personal shorthands. -\New{3.9} However, user shorthands are not always alive, as they may +\New{3.9a} However, user shorthands are not always alive, as they may be deactivated by languages (for example, if you use |"| for your user shorthands and switch from \textsf{german} to \textsf{french}, they stop working). Therefore, a starred version @@ -563,7 +653,7 @@ The command |\defineshorthand| takes two arguments: the first is a one- or two-character shorthand sequence, and the second is the code the shorthand should expand to. -\New{3.9} An optional argument allows to (re)define language +\New{3.9a} An optional argument allows to (re)define language and system shorthands (some languages do not activate shorthands, so you may want to add |\languageshorthands|\marg{lang} to the corresponding |\extras|\m{lang}). By default, user shorthands are @@ -687,7 +777,7 @@ preserved for backward compatibility.} \subsection{Package options} -\New{3.9} +\New{3.9a} These package options are processed before language options, so that they are taken into account irrespective of its order. The first three options have been available in previous versions. @@ -767,7 +857,9 @@ supporting this feature. Predefined labels are |generic| (for traditional \TeX, LICR and ASCII strings), |unicode| (for engines like \xetex{} and \luatex) and |encoded| (for special cases requiring mixed encodings). Other allowed values are font encoding codes (|T1|, |T2A|, -|LGR|, |L7X|...), but only in languages supporting them. +|LGR|, |L7X|...), but only in languages supporting them. Be aware with +|encoded| captions are protected, but they work in |\MakeUppercase| +and the like. \Describe{hyphenmap=}{\texttt{off} $\string|$ \texttt{main} $\string|$ \texttt{select} $\string|$ \texttt{other} $\string|$ @@ -837,7 +929,7 @@ you attempt to load both. Here is a way to overcome this problem: \subsection{Hooks} -\New{3.9} A hook is a piece of code to be executed at certain +\New{3.9a} A hook is a piece of code to be executed at certain events. Some hooks are predefined when \luatex{} and \xetex{} are used. @@ -850,8 +942,8 @@ containing the string |babel| are reserved (they are used, for example, by |\useshortands*| to add a hook for the event |afterextras|). -Current events are the following; in some of them you can use one or -two \TeX{} parameters (|#1|, |#2|), with the meaning given: +Current events are the following; in some of them you can use one to +three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given: \begin{description} \renewcommand\makelabel[1]{% \hspace\labelsep\normalfont\ttfamily\color{thered}#1} @@ -888,17 +980,23 @@ two \TeX{} parameters (|#1|, |#2|), with the meaning given: \AddBabelHook{myhook}{stringprocess}{% \protected@edef\BabelString{\BabelString}} \end{verbatim} +\item[initiateactive] (char as active, char as other, original char) + \New{3.9i} Executed just after a shorthand has been `initiated'. The three + parameters are the same character with different catcodes: active, + other (|\string|'ed) and the original one. +\item[afterreset] \New{3.9i} Executed when selecting a language just after + |\originalTeX| is run and reset to its base value, before executing + |\captions|\m{language} and |\date|\m{language}. \end{description} -Four events are used in -\file{hyphen.cfg}, which are handled in a quite different way for -efficiency reasons -- unlike the precedent ones, they -only have a single hook and replace a default definition. +Four events are used in \file{hyphen.cfg}, which are handled in a +quite different way for efficiency reasons -- unlike the precedent +ones, they only have a single hook and replace a default definition. \begin{description} \renewcommand\makelabel[1]{% \hspace\labelsep\normalfont\ttfamily\color{thered}#1} \itemsep=-\parskip -\item[everylanguage] (language) Executed before patterns are loaded. +\item[everylanguage] (language) Executed before every language patterns are loaded. \item[loadkernel] (file) By default loads |switch.def|. It can be used to load a different version of this files or to load nothing. \item[loadpatterns] (patterns file) Loads the patterns file. Used by @@ -908,7 +1006,7 @@ only have a single hook and replace a default definition. \end{description} \Describe\BabelContentsFiles{} -\New{3.9} This macro contains a list of ``toc'' types which +\New{3.9a} This macro contains a list of ``toc'' types which require a command to switch the language. Its default value is |toc,lof,lot|, but you may redefine it with |\renewcommand| (it's up to you to make sure no toc type is duplicated). @@ -920,7 +1018,7 @@ to you to make sure no toc type is duplicated). \DescribeOther\babelhyphen{% \colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}\marg{text}} -\New{3.9} It is customary to classify hyphens in two types: (1) +\New{3.9a} It is customary to classify hyphens in two types: (1) \textit{explicit} or \textit{hard hyphens}, which in \TeX\ are entered as \verb|-|, and (2) \textit{optional} or \textit{soft hyphens}, which are entered as \verb|\-|. Strictly, a \textit{soft @@ -977,7 +1075,7 @@ parenthesis). \Describe\babelhyphenation{\texttt{[}\langlist\texttt{]}%^^A \marg{exceptions}} -\New{3.9} Sets hyphenation exceptions for the languages given +\New{3.9a} Sets hyphenation exceptions for the languages given or, without the optional argument, for \textit{all} languages (eg, proper nouns or common loan words, and of course monolingual documents). Language exceptions take precedence over global ones. @@ -1149,9 +1247,9 @@ Then you preprocess it with |devnag| \m{file}, which creates |"8000|) as a shorthand can make \TeX{} enter in an infinite loop. (Another issue in the `to do' list, although there is a partial solution.) -\item Also in the `to do' list is a user interface to set the way - scripts are switched, to avoid the current problem of languages - trying to define |\text|\m{script} in different ways. +\item Plain \luatex{} does not load patterns on the fly. Since this +format is not based on \babel{} but on \file{etex.src} further +investigation is required. This is another task in the `to do' list. \end{itemize} The following packages can be useful, too (the list is still @@ -1170,6 +1268,7 @@ far from complete): \item[microtype] Adjusts the typesetting according to some languages (kerning and spacing). Ligatures can be disabled. \item[substitutefont] Combines fonts in several encodings. +\item[mkpattern] Generates hyphenation patterns. \end{description} \subsection{Future work} @@ -1197,10 +1296,10 @@ Handling of ``Unicode'' fonts is also problematic. There is ones) and it doesn't provide ``orthogonal axis'' for features, including those related to the language (mainly language and script). A couple of tentative macros, which solve the two main cases, -are provided by \babel with a partial solution (only \xetex{} and -\luatex, for obvious reasons), but use them at your own risk, as they -might be removed in the future. For this very reason, they are -described here: +are provided by \babel{} ($\ge$3.9g) with a partial solution (only +\xetex{} and \luatex, for obvious reasons), but use them at your own +risk, as they might be removed in the future. For this very reason, +they are described here: \begin{itemize} \item |\babelFSstore|\marg{babel-language} sets the current three basic families (rm, sf, tt) as the default for the language @@ -1256,10 +1355,10 @@ dutch hyphen.dutch exceptions.dutch % Nederlands german hyphen.ger \end{verbatim} -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 didn't work correctly.} For example: +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 +didn't work correctly.} For example: \begin{verbatim} german:T1 hyphenT1.ger german hyphen.ger @@ -1345,9 +1444,8 @@ Some recommendations: \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 - like |\latintext| is discouraged and will be very likely deprecated - in the future.\footnote{But not removed, for backward compatibility.} - + like |\latintext| is deprecated.\footnote{But not removed, for backward + compatibility.} \end{itemize} There are no special requirements for documenting your language @@ -1480,7 +1578,7 @@ explained in in sec. \ref{s:strings} (\babel{} 3.9 and later). \begin{verbatim} \ProvidesLanguage{<language>} - [2013/12/03 v0.0 <Language> support from the babel system] + [2014/04/15 v0.0 <Language> support from the babel system] \LdfInit{<language>}{captions<language>} \ifx\undefined\l@<language> @@ -1640,7 +1738,7 @@ used to properly switch French spacing on and off. \subsection{Encoding-dependent strings} \label{s:strings} -\New{3.9} Babel 3.9 provides a way of defining strings in several +\New{3.9a} Babel 3.9 provides a way of defining strings in several encodings, intended mainly for \luatex{} and \xetex. This is the only new feature requiring changes in language files if you want to make use of it. @@ -1660,7 +1758,7 @@ kind. Thanks to this new feature, string values and string language switching are not mixed any more. No need of |\addto|. If the language -is german, just redefine |\germanchaptername|. +is |french|, just redefine |\frenchchaptername|. \Describe\StartBabelCommands {\marg{language-list}\marg{category}\oarg{selector}} @@ -1702,9 +1800,11 @@ strings should be defined somehow inside it; they can be the only blocks (mainly LGC scripts using the LICR). Blocks without a selector can be activated explicitly with |strings=generic| (no block is taken into account except those). With |strings=encoded|, strings in those -blocks are set as default (internally, |?|). If there is no key -|strings|, string definitions are ignored, but |\SetCase|s are still -honoured (an a |encoded| way). +blocks are set as default (internally, |?|). With |strings=encoded| +strings are protected, but they are correctly expanded in +|\MakeUppercase| and the like. If there is no key |strings|, string +definitions are ignored, but |\SetCase|s are still honoured (in a +|encoded| way). The \m{category} is either |captions|, |date| or |extras|. You must stick to these three categories, even if no error is raised when using @@ -2247,8 +2347,8 @@ help from Bernd Raichle, for which I am grateful. % little bit of literate programming. % % \begin{macrocode} -%<<version=3.9h>> -%<<date=2013/12/03>> +%<<version=3.9i>> +%<<date=2014/03/15>> % \end{macrocode} % % We define some basic which just make the code cleaner. |\bbl@add| is @@ -2257,9 +2357,11 @@ help from Bernd Raichle, for which I am grateful. % and in \file{babel.sty}, which means in \LaTeX{} is executed % twice, but we need them when defining options and % \file{babel.def} cannot be load until options have been defined. +% \changes{babel~3.9i}{2014/02/16}{\cs{@for} didn't work with +% Plain. Added \cs{bbl@loop}} % \begin{macrocode} %<<*Basic macros>> -\def\bbl@for#1#2#3{\@for#1:=#2\do{\ifx#1\@empty\else#3\fi}} +\def\bbl@for#1#2#3{\bbl@loopx#1{#2}{\ifx#1\@empty\else#3\fi}} \def\bbl@add#1#2{% \@ifundefined{\expandafter\@gobble\string#1}% {\def#1{#2}}% @@ -2267,6 +2369,12 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% \long\def\bbl@afterelse#1\else#2\fi{\fi#1} \long\def\bbl@afterfi#1\fi{\fi#1} +\def\bbl@loop#1#2#3{\bbl@@loop#1{#3}#2,\@nnil,} +\def\bbl@loopx#1#2{\expandafter\bbl@loop\expandafter#1\expandafter{#2}} +\def\bbl@@loop#1#2#3,{% + \ifx\@nnil#3\relax\else + \def#1{#3}#2\bbl@afterfi\bbl@@loop#1{#2}% + \fi} %<</Basic macros>> % \end{macrocode} % @@ -2769,6 +2877,8 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.8c}{2004/06/12}{Added the \Lopt{newzealand} option} % \changes{babel~3.6e}{1997/01/08}{Added options \Lopt{UKenglish} and % \Lopt{USenglish}} +% \changes{babel~3.9i}{2014/03/01}{Removed German options, because +% they are now loaded directly} % % Languages are loaded when processing the corresponding option % \textit{except} if a |main| language has been set. In such a @@ -2800,7 +2910,6 @@ help from Bernd Raichle, for which I am grateful. \DeclareOption{afrikaans}{\bbl@load@language{dutch}} \DeclareOption{american}{\bbl@load@language{english}} \DeclareOption{australian}{\bbl@load@language{english}} -\DeclareOption{austrian}{\bbl@load@language{germanb}} \DeclareOption{bahasa}{\bbl@load@language{bahasai}} \DeclareOption{bahasai}{\bbl@load@language{bahasai}} \DeclareOption{bahasam}{\bbl@load@language{bahasam}} @@ -2811,7 +2920,6 @@ help from Bernd Raichle, for which I am grateful. \DeclareOption{canadien}{\bbl@load@language{frenchb}} \DeclareOption{francais}{\bbl@load@language{frenchb}} \DeclareOption{french}{\bbl@load@language{frenchb}}% -\DeclareOption{german}{\bbl@load@language{germanb}} \DeclareOption{hebrew}{% \input{rlbabel.def}% \bbl@load@language{hebrew}} @@ -2821,9 +2929,7 @@ help from Bernd Raichle, for which I am grateful. \DeclareOption{lowersorbian}{\bbl@load@language{lsorbian}} \DeclareOption{malay}{\bbl@load@language{bahasam}} \DeclareOption{meyalu}{\bbl@load@language{bahasam}} -\DeclareOption{naustrian}{\bbl@load@language{ngermanb}} \DeclareOption{newzealand}{\bbl@load@language{english}} -\DeclareOption{ngerman}{\bbl@load@language{ngermanb}} \DeclareOption{nynorsk}{\bbl@load@language{norsk}} \DeclareOption{polutonikogreek}{% \bbl@load@language{greek}% @@ -3003,9 +3109,21 @@ help from Bernd Raichle, for which I am grateful. % have to be checked in a number of places. Some of the code below % is common to plain \TeX\ and \LaTeX, some of it is for the % \LaTeX\ case only. +% +% Plain formats based on etex (etex, xetex, luatex) don't load +% |hyphen.cfg| but |etex.src|, which follows a different naming +% convention, so we need to define the babel names. It presumes +% |language.def| exists and it is the same file used when +% formats were created. +% % \changes{babel~3.9a}{2013/01/11}{Added \cs{bbl@for} for loops % ignoring empties} -% \changes{babel~3.9c}{2013/04/06}{Normalize \cs{bbl@afterlang} to relax} +% \changes{babel~3.9c}{2013/04/06}{Normalize \cs{bbl@afterlang} to +% relax} +% \changes{babel~3.9i}{2014/03/10}{Make sure \cs{bbl@language@opts} +% is defined.} +% \changes{babel~3.9i}{2014/03/11}{Define \cs{l@} values from +% \cs{lang@} values set in Plain etex/xetex/luatex} % % \subsection{Tools} % @@ -3019,6 +3137,22 @@ help from Bernd Raichle, for which I am grateful. \ProvidesFile{babel.def}[<@date@> <@version@> Babel common definitions] <@Load macros for plain if not LaTeX@> <@Load switch if newer@> +\ifx\bbl@languages\@undefined + \openin1 = language.def + \ifeof1 + \closein1 + \message{I couldn't find the file language.def} + \else + \closein1 + \def\addlanguage#1#2#3#4#5{% + \expandafter\ifx\csname lang@#1\endcsname\relax\else + \global\expandafter\let\csname l@#1\expandafter\endcsname + \csname lang@#1\endcsname + \fi}% + \input language.def + \fi + \chardef\l@english\lang@USenglish +\fi <@Basic macros@> \ifx\bbl@opt@strings\@undefined \def\bbl@opt@safe{BR} @@ -3027,6 +3161,7 @@ help from Bernd Raichle, for which I am grateful. \fi \ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi \ifx\bbl@afterlang\@undefined\let\bbl@afterlang\relax\fi +\ifx\bbl@language@opts\@undefined\let\bbl@language@opts\@empty\fi \providecommand\AfterBabelLanguage[2]{} \def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% \chardef\bbl@engine=% @@ -3144,8 +3279,62 @@ help from Bernd Raichle, for which I am grateful. % % \subsection{Encoding issues} % -% The first thing we need to do is to determine, at -% |\begin{document}|, which latin fontencoding to use. +% Because documents may use non-ASCII font encodings, we make sure +% that the logos of \TeX\ and \LaTeX\ always come out in the right +% encoding. There is a list of non-ASCII encodings. Unfortunately, +% \textsf{fontenc} deletes its package options, so we must guess +% which encodings has been loaded by traversing |\@filelist| to +% search for \marg{enc}|enc.def|. If a non-ASCII has been loaded, we +% define versions of |\TeX| and |\LaTeX| for them using +% |\ensureascii|. The default ASCII encoding is set, too (in reverse +% order): the ``main'' encoding (when the document begins), the last +% loaded, or |OT1|. +% +% \begin{macro}{\ensureascii} +% \changes{babel~3.9i}{2014/02/14}{Macro added, to replace +% \cs{textlatin} and friends} +% \begin{macrocode} +\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU,} +\let\org@TeX\TeX +\let\org@LaTeX\LaTeX +\let\ensureascii\@firstofone +\AtBeginDocument{% + \in@false + \bbl@loopx\bbl@tempa\BabelNonASCII{% is there a non-ascii enc? + \ifin@\else + \edef\bbl@tempb{{,\bbl@tempa enc.def,}{,\@filelist,}}% + \lowercase\expandafter{\expandafter\in@\bbl@tempb}% + \fi} + \ifin@ % if a non-ascii has been loaded + \def\ensureascii#1{{\fontencoding{OT1}\selectfont#1}}% + \DeclareTextCommandDefault{\TeX}{\org@TeX}% + \DeclareTextCommandDefault{\LaTeX}{\org@LaTeX}% + \def\bbl@tempb#1\@@{\uppercase{\bbl@tempc#1}ENC.DEF\@empty\@@}% + \def\bbl@tempc#1ENC.DEF#2\@@{% + \ifx\@empty#2\else + \@ifundefined{T@#1}% + {}% + {\@expandtwoargs\in@{,#1,}{,\BabelNonASCII,}% + \ifin@ + \DeclareTextCommand{\TeX}{#1}{\ensureascii{\org@TeX}}% + \DeclareTextCommand{\LaTeX}{#1}{\ensureascii{\org@LaTeX}}% + \else + \def\ensureascii##1{{\fontencoding{#1}\selectfont##1}}% + \fi}% + \fi}% + \bbl@loopx\bbl@tempa\@filelist{\expandafter\bbl@tempb\bbl@tempa\@@}% + \@expandtwoargs\in@{,\cf@encoding,}{,\BabelNonASCII,}% + \ifin@\else + \edef\ensureascii#1{{% + \noexpand\fontencoding{\cf@encoding}\noexpand\selectfont#1}}% + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% Now comes the old deprecated stuff. The first thing we need to do +% is to determine, at |\begin{document}|, which latin fontencoding to +% use. % % \begin{macro}{\latinencoding} % \changes{babel~3.6i}{1997/03/15}{Macro added, moved from @@ -3194,7 +3383,7 @@ help from Bernd Raichle, for which I am grateful. % \file{.ldf} files} % Then we can define the command |\latintext| which is a % declarative switch to a latin font-encoding. Usage of this macro -% is discouraged, except if understood as a switch to ASCII. +% is deprecated. % \begin{macrocode} \DeclareRobustCommand{\latintext}{% \fontencoding{\latinencoding}\selectfont @@ -3218,6 +3407,87 @@ help from Bernd Raichle, for which I am grateful. \DeclareTextFontCommand{\textlatin}{\latintext} \fi % \end{macrocode} +% \end{macro} +% +% \begin{macro}{\babelensure} +% +% The user command just parses the optional argument and creates a +% new macro named |\bbl@ens@|\m{language}. We register a hook at the +% |afterextras| event which just executes this macro in a +% ``complete'' selection (which, if undefined, is |\relax| and does +% nothing). This part is somewhat involved because we have to make +% sure things are expanded the correct number of times. +% +% The macro |\bbl@ens@|\m{language} contains +% |\bbl@ensure|\marg{include}\marg{exclude}\marg{fontenc}, which +% in turn loops over the macros names in |\bbl@ensured|, excluding +% (with the help of |\in@|) those in the |exclude| list. If the +% |fontenc| is given (and not |\relax|), the |\fontencoding| is +% also added. Then we loop over the |include| list, but if the +% macro already contains |\foreignlanguage|, nothing is done. +% +% |\bbl@ensured| is the list of macros supposed to be ``ensured''. +% \changes{babel~3.9i}{2014/02/14}{Macro \cs{babelensure} added} +% +% \begin{macrocode} +\newcommand\babelensure[2][]{% + \AddBabelHook{babel-ensure}{afterextras}{% + \ifcase\bbl@select@type + \@nameuse{bbl@e@\languagename}% + \fi} + \begingroup + \let\bbl@ens@include\@empty + \let\bbl@ens@exclude\@empty + \def\bbl@ens@fontenc{\relax}% + \def\bbl@tempb##1{% + \ifx\@empty##1\else\noexpand##1\expandafter\bbl@tempb\fi}% + \edef\bbl@tempa{\bbl@tempb#1\@empty}% + \def\bbl@tempb##1=##2\@@{\@namedef{bbl@ens@##1}{##2}}% + \bbl@for\bbl@tempa\bbl@tempa{\expandafter\bbl@tempb\bbl@tempa\@@}% + \def\bbl@tempc{\bbl@ensure} + \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{% + \expandafter{\bbl@ens@include}}% + \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{% + \expandafter{\bbl@ens@exclude}}% + \toks@\expandafter{\bbl@tempc}% + \edef\x{% + \endgroup + \noexpand\@namedef{bbl@e@#2}{\the\toks@{\bbl@ens@fontenc}}} + \x} +\def\bbl@ensure#1#2#3{% + \def\bbl@tempb##1{% + \ifx##1\@empty\else + \in@{##1}{#2}% + \ifin@\else + \toks@\expandafter{##1}% + \edef##1{% + \noexpand\foreignlanguage{\languagename}% + {\ifx\relax#3\else + \noexpand\fontencoding{#3}\noexpand\selectfont + \fi + \the\toks@}}% + \fi + \expandafter\bbl@tempb + \fi}% + \expandafter\bbl@tempb\bbl@ensured\@empty + \def\bbl@tempa##1{% + \ifx##1\@empty\else + \expandafter\in@\expandafter\foreignlanguage\expandafter{##1}% + \ifin@\else + \bbl@tempb##1\@empty + \fi + \expandafter\bbl@tempa + \fi}% + \bbl@tempa#1\@empty} +\def\bbl@ensured{% + \prefacename\refname\abstractname\bibname\chaptername\appendixname + \contentsname\listfigurename\listtablename\indexname\figurename + \tablename\partname\enclname\ccname\headtoname\pagename\seename + \alsoname\proofname\glossaryname\today} +% \end{macrocode} +% \end{macro} +% +% \subsection{Setting up language files} % % The second version of |\LdfInit| macro takes two arguments. The first % argument is the name of the language that will be defined in the @@ -3591,6 +3861,8 @@ help from Bernd Raichle, for which I am grateful. % the search of a definition in the user, language and system % levels (or eventually |normal@char|\m{char}). % \changes{babel~3.9a}{2012/12/27}{Added code for option math=normal} +% \changes{babel~3.9i}{2014/02/03}{Don't call directly +% \cs{user@active}, but with an intermediate step} % \begin{macrocode} \let\bbl@tempa\@firstoftwo \if\string^#2% @@ -3607,9 +3879,11 @@ help from Bernd Raichle, for which I am grateful. \expandafter\noexpand\csname normal@char#2\endcsname \noexpand\else \noexpand\expandafter - \expandafter\noexpand\csname user@active#2\endcsname + \expandafter\noexpand\csname bbl@doactive#2\endcsname \noexpand\fi}% {\expandafter\noexpand\csname normal@char#2\endcsname}}% + \bbl@csarg\edef{doactive#2}{% + \expandafter\noexpand\csname user@active#2\endcsname}% % \end{macrocode} % % \changes{babel~3.9a}{2012/12/27}{Shorthands are not defined @@ -3694,11 +3968,13 @@ help from Bernd Raichle, for which I am grateful. % \cs{normal@char'} because it is handled in a generic way above} % \changes{babel~3.9a}{2012/12/29}{Removed the intermediate step of % \cs{bbl@act@caret} and moved above} +% \changes{babel~3.9i}{2012/12/29}{Added the event \cs{initiateactive}} % \begin{macrocode} \if\string'#2% \let\prim@s\bbl@prim@s \let\active@math@prime#1% - \fi} + \fi + \bbl@usehooks{initiateactive}{{#1}{#2}{#3}}} % \end{macrocode} % % Initiating a shorthand makes active the char. That is not @@ -3886,7 +4162,7 @@ help from Bernd Raichle, for which I am grateful. % definition files have to be usable in both text and mathmode. To % achieve this the helper macro |\textormath| is provided. % \changes{babel~3.9a}{2012/12/29}{Failed if an argument had a -% condicional. Use the more robust mechanism of \cs{XXXoftwo}} +% condicional. Use the more robust mechanism of \cs{XXXoftwo}} % \begin{macrocode} \def\textormath{% \ifmmode @@ -4181,21 +4457,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macro} % \end{macro} % -% Usually the |~| is active and expands to \verb*=\penalty\@M\ =. -% When it is written to the \file{.aux} file it is written -% expanded. To prevent that and to be able to use the character |~| -% as a start character for a shorthand, it is redefined here as a -% one character shorthand on system level. The system declaration -% is in most cases redundant (when |~| is still a non-break space), -% and in some cases is inconvenient (if |~| has been redefined); -% however, for backward compatibility it is maintained (some -% existing documents may rely on the \babel{} value). -% \begin{macrocode} -\initiate@active@char{~} -\declare@shorthand{system}{~}{\leavevmode\nobreak\ } -\bbl@activate{~} -% \end{macrocode} -% % \begin{macro}{\OT1dqpos} % \begin{macro}{\T1dqpos} % The position of the double quote character is different for the @@ -4234,7 +4495,7 @@ help from Bernd Raichle, for which I am grateful. \def\bbl@tempc{#1}% \bbl@fixname\bbl@tempc \bbl@iflanguage\bbl@tempc{% - \@for\bbl@attr:=#2\do{% + \bbl@loopx\bbl@attr{#2}{% % \end{macrocode} % We want to make sure that each attribute is selected only once; % therefore we store the already selected attributes in @@ -4381,7 +4642,7 @@ help from Bernd Raichle, for which I am grateful. % Then we loop over the list of known attributes, trying to find a % match. % \begin{macrocode} - \@for\bbl@tempb:=#2\do{% + \bbl@loopx\bbl@tempb{#2}{% \expandafter\in@\expandafter{\expandafter,\bbl@tempb,}{,#1,}% \ifin@ % \end{macrocode} @@ -4406,7 +4667,7 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\bbl@clear@ttribs{% \ifx\bbl@attributes\@undefined\else - \@for\bbl@tempa:=\bbl@attributes\do{% + \bbl@loopx\bbl@tempa{\bbl@attributes}{% \expandafter\bbl@clear@ttrib\bbl@tempa. }% \let\bbl@attributes\@undefined @@ -4545,6 +4806,33 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % +% \subsection{Short tags} +% +% \begin{macro}{\babeltags} +% This macro is straightforward. After zapping spaces, we +% loop over the list and define the macros |\text|\m{tag} and +% |\|\m{tag}. Definitions are first expanded so that they don't +% contain |\csname| but the actual macro. +% \changes{babel~3.9i}{2014/02/21}{Macro \cs{babeltags} added} +% +% \begin{macrocode} +\def\babeltags#1{% + \edef\bbl@tempa{\zap@space#1 \@empty}% + \def\bbl@tempb##1=##2\@@{% + \edef\bbl@tempc{% + \noexpand\newcommand + \expandafter\noexpand\csname ##1\endcsname{% + \noexpand\protect + \expandafter\noexpand\csname otherlanguage*\endcsname{##2}} + \noexpand\newcommand + \expandafter\noexpand\csname text##1\endcsname{% + \noexpand\foreignlanguage{##2}}} + \bbl@tempc}% + \bbl@for\bbl@tempa\bbl@tempa{% + \expandafter\bbl@tempb\bbl@tempa\@@}} +% \end{macrocode} +% \end{macro} +% % \subsection{Hyphens} % % \begin{macro}{\babelhyphenation} @@ -4593,12 +4881,14 @@ help from Bernd Raichle, for which I am grateful. % T1 fontencoding} % \changes{babel-3.9a}{2012/07/28}{Replaced many \cs{allowhyphens} by % \cs{bbl@allowhyphen}. They were either no-op or executed always.} +% \changes{babel-3.9i}{2014/01/29}{\cs{bbl@allowhyphens} must be +% ignored at the beginning of a paragraph or table cell.} % This macro makes hyphenation possible. Basically its definition % is nothing more than |\nobreak| |\hskip| \texttt{0pt plus % 0pt}\footnote{\TeX\ begins and ends a word for hyphenation at a % glue node. The penalty prevents a linebreak at this glue node.}. % \begin{macrocode} -\def\bbl@allowhyphens{\nobreak\hskip\z@skip} +\def\bbl@allowhyphens{\ifvmode\else\nobreak\hskip\z@skip\fi} \def\bbl@t@one{T1} \def\allowhyphens{\ifx\cf@encoding\bbl@t@one\else\bbl@allowhyphens\fi} % \end{macrocode} @@ -5138,6 +5428,7 @@ help from Bernd Raichle, for which I am grateful. \@ifundefined{bbl@tolower}{% \g@addto@macro\@uclclist{% \reserved@b{\reserved@b\@gobble}% stops processing the list + \let\bbl@encoded\bbl@encoded@uclc \@ifundefined{\languagename @bbl@uclc}% and resumes it {\reserved@a}% {\csname\languagename @bbl@uclc\endcsname}% @@ -5176,13 +5467,13 @@ help from Bernd Raichle, for which I am grateful. \def\SetStringLoop##1##2{% \def\bbl@templ####1{\expandafter\noexpand\csname##1\endcsname}% \count@\z@ - \@for\bbl@tempa:=\@empty##2\do{% \@empty "undoes" \expandafter - \advance\count@\@ne - \toks@\expandafter{\bbl@tempa}% - \edef\bbl@tempb{% - \bbl@templ{\romannumeral\count@}{\the\toks@}% - \count@=\the\count@\relax}% - \expandafter\SetString\bbl@tempb}}% + \bbl@loop\bbl@tempa{##2}{% + \advance\count@\@ne + \toks@\expandafter{\bbl@tempa}% + \edef\bbl@tempb{% + \bbl@templ{\romannumeral\count@}{\the\toks@}% + \count@=\the\count@\relax}% + \expandafter\SetString\bbl@tempb}}% %<</Define SetStringLoop>> % \end{macrocode} % @@ -5298,8 +5589,8 @@ help from Bernd Raichle, for which I am grateful. \@expandtwoargs \in@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}}% \fi - \ifx\bbl@opt@strings\@nnil % ie, no strings -> defaults - \else\ifx\bbl@opt@strings\relax % ie, strings with no value + \ifx\bbl@opt@strings\@nnil % ie, no strings key -> defaults + \else\ifx\bbl@opt@strings\relax % ie, strings=encoded \let\AfterBabelCommands\bbl@aftercmds \let\SetString\bbl@setstring \let\bbl@stringdef\bbl@encstring @@ -5377,7 +5668,6 @@ help from Bernd Raichle, for which I am grateful. % the preamble unknown languages, as described in the doc.} % % \begin{macrocode} -\def\bbl@scset#1#2{\def#1{#2}} \def\bbl@setstring#1#2{% \bbl@forlang\bbl@tempa{% \edef\bbl@LC{\bbl@tempa\expandafter\@gobble\string#1}% @@ -5392,6 +5682,36 @@ help from Bernd Raichle, for which I am grateful. \csname\bbl@LC\expandafter\endcsname\expandafter{\BabelString}}} % \end{macrocode} % +% Now, some addtional stuff to be used when encoded strings are +% used. Captions then include |\bbl@encoded| for string to be +% expanded in case transformations. It is |\relax| by default, but +% in |\MakeUppercase| and |\MakeLowercase| its value is a modified +% expandable |\@changed@cmd|. +% +% \changes{babel~3.9i}{2014/03/13}{Added code to expand captions in +% case transformations.} +% +% \begin{macrocode} +\ifx\bbl@opt@strings\relax + \def\bbl@scset#1#2{\def#1{\bbl@encoded#2}} + \bbl@patchuclc +\else + \def\bbl@scset#1#2{\def#1{#2}} +\fi +\let\bbl@encoded\relax +\def\bbl@encoded@uclc#1{% + \@inmathwarn#1% + \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax + \expandafter\ifx\csname ?\string#1\endcsname\relax + \TextSymbolUnavailable#1% + \else + \csname ?\string#1\endcsname + \fi + \else + \csname\cf@encoding\string#1\endcsname + \fi} +% \end{macrocode} +% % Macros to deal with case mapping for hyphenation. To decide if the % document is monolingual or multilingual, we make a rough guess -- % just see if there is a comma in the languages list, built in the @@ -5475,7 +5795,7 @@ 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} + hyphenation=2,initiateactive=3,afterreset=0} \ifcase\bbl@engine\or \input luababel.def \or @@ -6168,45 +6488,6 @@ help from Bernd Raichle, for which I am grateful. % \end{macrocode} % \end{macro} % -% \subsection{Encoding issues (part 2)} -% -% \changes{babel~3.7c}{1999/04/16}{Removed redefinition of \cs{@roman} -% and \cs{@Roman}} -% -% \begin{macro}{\TeX} -% \begin{macro}{\LaTeX} -% \changes{babel~3.7a}{1998/03/12}{Make \TeX\ and \LaTeX\ logos -% encoding-independent} -% Because documents may use font encodings other than one of the -% latin encodings, we make sure that the logos of \TeX\ and -% \LaTeX\ always come out in the right encoding (note, however, -% encodings not rendering the logos correctly do not conform the -% LICR). -% \begin{macrocode} -\bbl@redefine\TeX{\textlatin{\org@TeX}} -\bbl@redefine\LaTeX{\textlatin{\org@LaTeX}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\nfss@catcodes} -% \changes{babel~3.5g}{1996/08/18}{Need to add the double quote and -% acute characters to \cs{nfss@catcodes} to prevent problems when -% reading in .fd files} -% \LaTeX's font selection scheme sometimes wants to read font -% definition files in the middle of processing the document. In -% order to guard against any characters having the wrong -% |\catcode|s it always calls |\nfss@catcodes| before loading a -% file. Unfortunately, the characters |"| and |'| are not dealt -% with. Therefore we have to add them until \LaTeX\ does that -% itself. -% \begin{macrocode} -\bbl@add\nfss@catcodes{% - \@makeother\'% - \@makeother\"} -% \end{macrocode} -% \end{macro} -% % \subsection{Local Language Configuration} % % \begin{macro}{\loadlocalcfg} @@ -6248,6 +6529,24 @@ help from Bernd Raichle, for which I am grateful. \if@nobreak\ifvmode\nobreak\fi\fi} \fi % \end{macrocode} +% +% Usually the |~| is active and expands to \verb*=\penalty\@M\ =. +% When it is written to the \file{.aux} file it is written +% expanded. To prevent that and to be able to use the character |~| +% as a start character for a shorthand, it is redefined here as a +% one character shorthand on system level. The system declaration +% is in most cases redundant (when |~| is still a non-break space), +% and in some cases is inconvenient (if |~| has been redefined); +% however, for backward compatibility it is maintained (some +% existing documents may rely on the \babel{} value). +% \changes{babel~3.9i}{2014/02/06}{Moved from above, after +% \cs{bbl@usehook} has been defined} +% \begin{macrocode} +\initiate@active@char{~} +\declare@shorthand{system}{~}{\leavevmode\nobreak\ } +\bbl@activate{~} +% \end{macrocode} +% % Finally, the default is to use English as the main language. % \changes{babel~3.6c}{1997/01/05}{When \file{hyphen.cfg} is not % loaded in the format \cs{l@english} might not be defined; assume @@ -6963,9 +7262,10 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.6d}{1997/01/07}{set the language shorthands to % `none' before switching on the extras} % \changes{babel~3.9a}{2012/08/14}{Make sure the save counter is reset -% even in \cs{originalTeX} is used in other contexts} +% even if \cs{originalTeX} is used in other contexts} % \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} % \begin{macrocode} \def\bbl@switch#1{% \originalTeX @@ -6973,6 +7273,7 @@ help from Bernd Raichle, for which I am grateful. \csname noextras#1\endcsname \let\originalTeX\@empty \babel@beginsave}% + \bbl@usehooks{afterreset}{}% \languageshorthands{none}% \ifcase\bbl@select@type \csname captions#1\endcsname diff --git a/Master/texmf-dist/source/latex/babel/babel.ins b/Master/texmf-dist/source/latex/babel/babel.ins index 539ffba53e9..e6c2a86197f 100644 --- a/Master/texmf-dist/source/latex/babel/babel.ins +++ b/Master/texmf-dist/source/latex/babel/babel.ins @@ -1,297 +1,297 @@ -%% -%% This file will generate fast loadable files and documentation -%% driver files from the doc files in this package when run through -%% LaTeX or TeX. -%% -%% Copyright 2012-2013 Javier Bezos and Johannes L. Braams. -%% Copyright 1989-2008 Johannes L. Braams and any individual authors -%% listed elsewhere in this file. All rights reserved. -%% -%% This file is part of the Babel system. -%% -------------------------------------- -%% -%% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2003/12/01 or later. -%% -%% This work has the LPPL maintenance status "maintained". -%% -%% The Current Maintainer of this work is Javier Bezos. -%% -%% The list of all files belonging to the LaTeX base distribution is -%% given in the file `manifest.bbl. See also `legal.bbl' for additional -%% information. -%% -%% The list of derived (unpacked) files belonging to the distribution -%% and covered by LPPL is defined by the unpacking scripts (with -%% extension .ins) which are part of the distribution. -%% -%% --------------- start of docstrip commands ------------------ -%% -%% Copyright 2012-2013 Javier Bezos and Johannes L. Braams. -%% Copyright 2005-2008 Johannes L. Braams -%% -%% This file is part of the `babel' system. -%% -%% You are allowed to distribute this file together with all files -%% mentioned in manifest.bbl. -%% -%% You are not allowed to modify its contents. -%% -\def\filedate{2013/10/10} -\def\batchfile{babel.ins} -\input docstrip.tex - -{\ifx\generate\undefined -\Msg{**********************************************} -\Msg{*} -\Msg{* This installation requires docstrip} -\Msg{* version 2.3c or later.} -\Msg{*} -\Msg{* An older version of docstrip has been input} -\Msg{*} -\Msg{**********************************************} -\errhelp{Move or rename old docstrip.tex.} -\errmessage{Old docstrip in input path} -\batchmode -\csname @@end\endcsname -\fi} - -% Modify docstrip. A pseudo-guard is defined to set variables: -% <<name=value>>. These variables are used with <@name@> -% Two further pseudo-guards define "block" variables: <<*name>> and -% <</name>> delimite the lines to be retrived with <@name@>. Note -% the verbatim guard is overriden, which it's not used here. - -\def\replaceVar#1<@#2{% - #1% - \ifx\endLine#2\else - \expandafter\replaceVarX\expandafter#2% - \fi} - -\def\replaceVarX#1@>{\csname #1Var\endcsname\replaceVar} - -\def\normalLine#1\endLine{% - \advance\codeLinesPassed\@ne - \maybeMsg{.}% - \edef\inLine{\replaceVar#1<@\endLine}% - \let\do\putline@do - \ifcollect - \xdef\varCollect{\varCollect^^J\inLine}% - \else - \activefiles - \fi} - -\newif\ifcollect - -\def\verbOption<#1#2>>#3{% - \ifx#1*% - \maybeMsg{<<*#2>>}% - \global\collecttrue - \gdef\varCollect##1{}% - \else\ifx#1/% - \global\collectfalse - \global\expandafter\let\csname #2Var\endcsname\varCollect - \else - \varOptionI#1#2>% - \fi\fi} - -\def\varOptionI#1=#2>{% - \maybeMsg{<<#1=#2>>}% - \expandafter\gdef\csname #1Var\endcsname{#2}} - -% Preambles - -\declarepreamble\mainpreamble -This is a generated file. - -Copyright 2012-2013 Javier Bezos and Johannes L. Braams. -Copyright 1989-2008 Johannes L. Braams and any individual authors -listed elsewhere in this file. All rights reserved. - -This file was generated from file(s) of the Babel system. ---------------------------------------------------------- - -It may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either version 1.3 -of this license or (at your option) any later version. -The latest version of this license is in - http://www.latex-project.org/lppl.txt -and version 1.3 or later is part of all distributions of LaTeX -version 2003/12/01 or later. - -This work has the LPPL maintenance status "maintained". - -The Current Maintainer of this work is Javier Bezos. - -This file may only be distributed together with a copy of the Babel -system. You may however distribute the Babel system without -such generated files. - -The list of all files belonging to the Babel distribution is -given in the file `manifest.bbl'. See also `legal.bbl for additional -information. - -The list of derived (unpacked) files belonging to the distribution -and covered by LPPL is defined by the unpacking scripts (with -extension .ins) which are part of the distribution. -\endpreamble - -\declarepreamble\drvpreamble - -This file was generated from file(s) of the Babel system. ---------------------------------------------------------- - -Copyright 2012-2013 Javier Bezos and Johannes L. Braams. -Copyright (C) 2008 Johannes Braams. All rights reserved. - -To produce the documentation in the way you like you are allowed -to change this driver file. - -\endpreamble - -\declarepreamble\istpreamble -This file was generated from file(s) of the Babel system. ---------------------------------------------------------- - -Copyright 2012-2013 Javier Bezos and Johannes L. Braams. -Copyright (C) 2008 Johannes Braams. All rights reserved. - -This file is a style file for the MakeIndex program - -\endpreamble - -\declarepostamble\istpost -\endpostamble - -\keepsilent -\askonceonly - -\usepreamble\mainpreamble -\usedir{tex/generic/babel} - -\askforoverwritefalse - -\tracingmacros2 - -\generate{\file{babel.sty}{\from{babel.dtx}{package}} - \file{babel.def}{\from{babel.dtx}{core}} - \file{switch.def}{\from{babel.dtx}{kernel}} - \file{hyphen.cfg}{\from{babel.dtx}{patterns}} - \file{nil.ldf}{\from{babel.dtx}{nil}} - } -% Support for plain users -\generate{\file{plain.def}{\from{babel.dtx}{plain}} - \file{bplain.tex}{\from{babel.dtx}{bplain}} - \file{blplain.tex}{\from{babel.dtx}{blplain}} - } -% Support for Unicode-based engines -\generate{\file{xebabel.def}{\from{bbunicode.dtx}{xetex}} - \file{luababel.def}{\from{bbunicode.dtx}{luatex}} - } - -% compatibility files - -\usepreamble\mainpreamble - -\def\compatfile#1{\file{#1.sty}{\from{bbcompat.dtx}{#1}}} - -\generate{% - \compatfile{esperanto} - \compatfile{afrikaans} - \compatfile{dutch} - \compatfile{american} - \compatfile{british} - \compatfile{english} - \compatfile{UKenglish} - \compatfile{USenglish} - \compatfile{germanb} - \compatfile{austrian} - \compatfile{ngermanb} - \compatfile{naustrian} - \compatfile{irish} - \compatfile{scottish} - \compatfile{welsh} - \compatfile{breton} - } -\generate{% - \compatfile{francais} - \compatfile{italian} - \compatfile{portuges} - \compatfile{spanish} - \compatfile{catalan} - \compatfile{galician} - \compatfile{danish} - \compatfile{norsk} - \compatfile{swedish} - \compatfile{finnish} - \compatfile{magyar} - \compatfile{greek} - \compatfile{croatian} - \compatfile{czech} - \compatfile{slovak} - \compatfile{polish} - } -\generate{% - \compatfile{estonian} - \compatfile{romanian} - \compatfile{slovene} - \compatfile{russianb} - \compatfile{ukraineb} - \compatfile{turkish} - \compatfile{lsorbian} - \compatfile{usorbian} - \compatfile{bahasa} - \compatfile{hebrew} - %\compatfile{sanskrit} - \compatfile{basque} - \compatfile{latin} - \compatfile{icelandic} - \compatfile{serbian} - \compatfile{bulgarian} - } -\generate{% - \compatfile{samin} - \compatfile{interlingua} - \compatfile{albanian} - \compatfile{bahasam} - } - -% MakeIndex style files - -\usepreamble\istpreamble -\usepostamble\istpost -\usedir{makeindex/babel} - -\generate{\file{bbind.ist}{\from{bbidxglo.dtx}{idx}} - \file{bbglo.ist}{\from{bbidxglo.dtx}{glo}}} - -\Msg{***********************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move all the files} -\Msg{* with names ending in .ldf, .sty, .def or .fd into a} -\Msg{* directory searched by TeX} -\Msg{*} -\Msg{* For making a format the following files have to be in a} -\Msg{* directory which is searched by IniTeX:} -\Msg{* \space\space hyphen.cfg} -\Msg{* \space\space language.dat} -\Msg{* \space\space and files with hyphenation patterns} -\Msg{*} -\Msg{* To produce source listings you can run files with names} -\Msg{* ending in .dtx and/or .drv through LaTeX} -\Msg{*} -\Msg{* To produce the complete source listing MakeIndex needs to be} -\Msg{* able to find the following files} -\Msg{* \space\space bbind.ist} -\Msg{* \space\space bbglo.ist} -\Msg{*} -\Msg{* Happy TeXing} -\Msg{*} -\Msg{***********************************************************} - - +%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX or TeX.
+%%
+%% Copyright 2012-2013 Javier Bezos and Johannes L. Braams.
+%% Copyright 1989-2008 Johannes L. Braams and any individual authors
+%% listed elsewhere in this file. All rights reserved.
+%%
+%% This file is part of the Babel system.
+%% --------------------------------------
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Javier Bezos.
+%%
+%% The list of all files belonging to the LaTeX base distribution is
+%% given in the file `manifest.bbl. See also `legal.bbl' for additional
+%% information.
+%%
+%% The list of derived (unpacked) files belonging to the distribution
+%% and covered by LPPL is defined by the unpacking scripts (with
+%% extension .ins) which are part of the distribution.
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+%% Copyright 2012-2013 Javier Bezos and Johannes L. Braams.
+%% Copyright 2005-2008 Johannes L. Braams
+%%
+%% This file is part of the `babel' system.
+%%
+%% You are allowed to distribute this file together with all files
+%% mentioned in manifest.bbl.
+%%
+%% You are not allowed to modify its contents.
+%%
+\def\filedate{2013/10/10}
+\def\batchfile{babel.ins}
+\input docstrip.tex
+
+{\ifx\generate\undefined
+\Msg{**********************************************}
+\Msg{*}
+\Msg{* This installation requires docstrip}
+\Msg{* version 2.3c or later.}
+\Msg{*}
+\Msg{* An older version of docstrip has been input}
+\Msg{*}
+\Msg{**********************************************}
+\errhelp{Move or rename old docstrip.tex.}
+\errmessage{Old docstrip in input path}
+\batchmode
+\csname @@end\endcsname
+\fi}
+
+% Modify docstrip. A pseudo-guard is defined to set variables:
+% <<name=value>>. These variables are used with <@name@>
+% Two further pseudo-guards define "block" variables: <<*name>> and
+% <</name>> delimite the lines to be retrived with <@name@>. Note
+% the verbatim guard is overriden, which it's not used here.
+
+\def\replaceVar#1<@#2{%
+ #1%
+ \ifx\endLine#2\else
+ \expandafter\replaceVarX\expandafter#2%
+ \fi}
+
+\def\replaceVarX#1@>{\csname #1Var\endcsname\replaceVar}
+
+\def\normalLine#1\endLine{%
+ \advance\codeLinesPassed\@ne
+ \maybeMsg{.}%
+ \edef\inLine{\replaceVar#1<@\endLine}%
+ \let\do\putline@do
+ \ifcollect
+ \xdef\varCollect{\varCollect^^J\inLine}%
+ \else
+ \activefiles
+ \fi}
+
+\newif\ifcollect
+
+\def\verbOption<#1#2>>#3{%
+ \ifx#1*%
+ \maybeMsg{<<*#2>>}%
+ \global\collecttrue
+ \gdef\varCollect##1{}%
+ \else\ifx#1/%
+ \global\collectfalse
+ \global\expandafter\let\csname #2Var\endcsname\varCollect
+ \else
+ \varOptionI#1#2>%
+ \fi\fi}
+
+\def\varOptionI#1=#2>{%
+ \maybeMsg{<<#1=#2>>}%
+ \expandafter\gdef\csname #1Var\endcsname{#2}}
+
+% Preambles
+
+\declarepreamble\mainpreamble
+This is a generated file.
+
+Copyright 2012-2013 Javier Bezos and Johannes L. Braams.
+Copyright 1989-2008 Johannes L. Braams and any individual authors
+listed elsewhere in this file. All rights reserved.
+
+This file was generated from file(s) of the Babel system.
+---------------------------------------------------------
+
+It may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of LaTeX
+version 2003/12/01 or later.
+
+This work has the LPPL maintenance status "maintained".
+
+The Current Maintainer of this work is Javier Bezos.
+
+This file may only be distributed together with a copy of the Babel
+system. You may however distribute the Babel system without
+such generated files.
+
+The list of all files belonging to the Babel distribution is
+given in the file `manifest.bbl'. See also `legal.bbl for additional
+information.
+
+The list of derived (unpacked) files belonging to the distribution
+and covered by LPPL is defined by the unpacking scripts (with
+extension .ins) which are part of the distribution.
+\endpreamble
+
+\declarepreamble\drvpreamble
+
+This file was generated from file(s) of the Babel system.
+---------------------------------------------------------
+
+Copyright 2012-2013 Javier Bezos and Johannes L. Braams.
+Copyright (C) 2008 Johannes Braams. All rights reserved.
+
+To produce the documentation in the way you like you are allowed
+to change this driver file.
+
+\endpreamble
+
+\declarepreamble\istpreamble
+This file was generated from file(s) of the Babel system.
+---------------------------------------------------------
+
+Copyright 2012-2013 Javier Bezos and Johannes L. Braams.
+Copyright (C) 2008 Johannes Braams. All rights reserved.
+
+This file is a style file for the MakeIndex program
+
+\endpreamble
+
+\declarepostamble\istpost
+\endpostamble
+
+\keepsilent
+\askonceonly
+
+\usepreamble\mainpreamble
+\usedir{tex/generic/babel}
+
+\askforoverwritefalse
+
+\tracingmacros2
+
+\generate{\file{babel.sty}{\from{babel.dtx}{package}}
+ \file{babel.def}{\from{babel.dtx}{core}}
+ \file{switch.def}{\from{babel.dtx}{kernel}}
+ \file{hyphen.cfg}{\from{babel.dtx}{patterns}}
+ \file{nil.ldf}{\from{babel.dtx}{nil}}
+ }
+% Support for plain users
+\generate{\file{plain.def}{\from{babel.dtx}{plain}}
+ \file{bplain.tex}{\from{babel.dtx}{bplain}}
+ \file{blplain.tex}{\from{babel.dtx}{blplain}}
+ }
+% Support for Unicode-based engines
+\generate{\file{xebabel.def}{\from{bbunicode.dtx}{xetex}}
+ \file{luababel.def}{\from{bbunicode.dtx}{luatex}}
+ }
+
+% compatibility files
+
+\usepreamble\mainpreamble
+
+\def\compatfile#1{\file{#1.sty}{\from{bbcompat.dtx}{#1}}}
+
+\generate{%
+ \compatfile{esperanto}
+ \compatfile{afrikaans}
+ \compatfile{dutch}
+ \compatfile{american}
+ \compatfile{british}
+ \compatfile{english}
+ \compatfile{UKenglish}
+ \compatfile{USenglish}
+ \compatfile{germanb}
+ \compatfile{austrian}
+ \compatfile{ngermanb}
+ \compatfile{naustrian}
+ \compatfile{irish}
+ \compatfile{scottish}
+ \compatfile{welsh}
+ \compatfile{breton}
+ }
+\generate{%
+ \compatfile{francais}
+ \compatfile{italian}
+ \compatfile{portuges}
+ \compatfile{spanish}
+ \compatfile{catalan}
+ \compatfile{galician}
+ \compatfile{danish}
+ \compatfile{norsk}
+ \compatfile{swedish}
+ \compatfile{finnish}
+ \compatfile{magyar}
+ \compatfile{greek}
+ \compatfile{croatian}
+ \compatfile{czech}
+ \compatfile{slovak}
+ \compatfile{polish}
+ }
+\generate{%
+ \compatfile{estonian}
+ \compatfile{romanian}
+ \compatfile{slovene}
+ \compatfile{russianb}
+ \compatfile{ukraineb}
+ \compatfile{turkish}
+ \compatfile{lsorbian}
+ \compatfile{usorbian}
+ \compatfile{bahasa}
+ \compatfile{hebrew}
+ %\compatfile{sanskrit}
+ \compatfile{basque}
+ \compatfile{latin}
+ \compatfile{icelandic}
+ \compatfile{serbian}
+ \compatfile{bulgarian}
+ }
+\generate{%
+ \compatfile{samin}
+ \compatfile{interlingua}
+ \compatfile{albanian}
+ \compatfile{bahasam}
+ }
+
+% MakeIndex style files
+
+\usepreamble\istpreamble
+\usepostamble\istpost
+\usedir{makeindex/babel}
+
+\generate{\file{bbind.ist}{\from{bbidxglo.dtx}{idx}}
+ \file{bbglo.ist}{\from{bbidxglo.dtx}{glo}}}
+
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move all the files}
+\Msg{* with names ending in .ldf, .sty, .def or .fd into a}
+\Msg{* directory searched by TeX}
+\Msg{*}
+\Msg{* For making a format the following files have to be in a}
+\Msg{* directory which is searched by IniTeX:}
+\Msg{* \space\space hyphen.cfg}
+\Msg{* \space\space language.dat}
+\Msg{* \space\space and files with hyphenation patterns}
+\Msg{*}
+\Msg{* To produce source listings you can run files with names}
+\Msg{* ending in .dtx and/or .drv through LaTeX}
+\Msg{*}
+\Msg{* To produce the complete source listing MakeIndex needs to be}
+\Msg{* able to find the following files}
+\Msg{* \space\space bbind.ist}
+\Msg{* \space\space bbglo.ist}
+\Msg{*}
+\Msg{* Happy TeXing}
+\Msg{*}
+\Msg{***********************************************************}
+
+
diff --git a/Master/texmf-dist/source/latex/babel/bbunicode.dtx b/Master/texmf-dist/source/latex/babel/bbunicode.dtx index 78a4d817f71..5df721e33f2 100644 --- a/Master/texmf-dist/source/latex/babel/bbunicode.dtx +++ b/Master/texmf-dist/source/latex/babel/bbunicode.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 2013 Javier Bezos and any individual authors +% Copyright 2013-2014 Javier Bezos and any individual authors % listed elsewhere in this file. All rights reserved. % % This file is part of the Babel system. @@ -31,12 +31,12 @@ % \iffalse %<*dtx> \ProvidesFile{bbunicode.dtx} - [2013/04/22 v1.0b Babel hooks for Unicode engines] + [2014/03/10 v1.0c Babel hooks for Unicode engines] %</dtx> % %% File `bbunicode.dtx' %% Babel package for LaTeX version 2e -%% Copyright (C) 2103 +%% Copyright (C) 2103-2014 %% by Javier Bezos % %<*filedriver> @@ -68,6 +68,7 @@ % opti\texttt{}ons aren't ``orthogonal''). % \end{itemize} % +% \begin{macrocode} %<<*Font selection>> \def\babelFSstore#1{% \bbl@for\bbl@tempa{#1}{% @@ -102,7 +103,7 @@ \babel@save\bbl@langfeatures \edef\bbl@langfeatures{#2,}}} %<</Font selection>> -% +% \end{macrocode} % \section{Hooks for XeTeX and LuaTeX} % % \subsection{XeTeX} @@ -110,6 +111,51 @@ % Unfortunately, the current encoding cannot be retrieved and % therefore it is reset always to |utf8|, which seems a sensible % default. +% +% \LaTeX{} sets many ``codes'' just before loading +% \verb|hyphen.cfg|. That is not a problem in luatex, but in xetex +% they must be reset to the proper value. Most of the work is done in +% \textsf{xe(la)tex.ini}, so here we just ``undo'' some of the +% changes done by \LaTeX. Anyway, for consistency Lua\TeX{} also +% resets the catcodes. +% \changes{bbunicode~1.0c}{2014/03/10}{Reset ``codes'' set by \cs{LaTeX} +% to what xetex expects. Used also in luatex.} +% \begin{macrocode} +%<<*Restore Unicode catcodes before loading patterns>> +\AddBabelHook{xetex}{loadkernel}{% + \begingroup + % Reset chars "80-"C0 to category "other", no case mapping: + \catcode`\@=11 \count@=128 + \loop\ifnum\count@<192 + \global\uccode\count@=0 \global\lccode\count@=0 + \global\catcode\count@=12 \global\sfcode\count@=1000 + \advance\count@ by 1 \repeat + % Other: + \def\O ##1 {% + \global\uccode"##1=0 \global\lccode"##1=0 + \global\catcode"##1=12 \global\sfcode"##1=1000 }% + % Letter: + \def\L ##1 ##2 ##3 {\global\catcode"##1=11 + \global\uccode"##1="##2 + \global\lccode"##1="##3 + % Uppercase letters have sfcode=999: + \ifnum"##1="##3 \else \global\sfcode"##1=999 \fi }% + % Letter without case mappings: + \def\l ##1 {\L ##1 ##1 ##1 }% + \l 00AA + \L 00B5 039C 00B5 + \l 00BA + \O 00D7 + \l 00DF + \O 00F7 + \L 00FF 0178 00FF + \endgroup + \input #1\relax} +%<</Restore Unicode catcodes before loading patterns>> +% \end{macrocode} +% +% Now, the code. +% % \begin{macrocode} %<*xetex> \def\BabelStringsDefault{unicode} @@ -125,6 +171,7 @@ \AddBabelHook{xetex}{stopcommands}{% \xebbl@stop \let\xebbl@stop\relax} +<@Restore Unicode catcodes before loading patterns@> <@Font selection@> %</xetex> % \end{macrocode} @@ -135,6 +182,9 @@ % P\'{e}gouri\'{e}-Gonnard. \'{E}lie also improved the code below. % \changes{bbunicode~1.0b}{2013/04/22}{luatex-hyphen is loaded % with require. Changes supplied by \'{E}lie Roux.} +% \changes{bbunicode~1.0c}{2013/04/22}{Defined hook for +% `initiateactive', to fetch the next token and continue only if +% letter or other} % % \begin{macrocode} %<*luatex> @@ -189,6 +239,22 @@ '\luatexluaescapestring{\string#2}') }% \fi} +\AddBabelHook{luatex}{initiateactive}{% + \bbl@csarg\edef{doactive#2}{% + \futurelet\noexpand\let@token + \expandafter\noexpand\csname luabbl@doactive#2\endcsname}% + \def\bbl@tempa##1##2{% + \@namedef{luabbl@doactive#2}{% + \ifcat\noexpand\let@token a% + \expandafter##1% + \else\ifcat\noexpand\let@token.% + \expandafter\expandafter\expandafter##1% + \else + \expandafter\expandafter\expandafter##2% + \fi\fi}}% + \@expandtwoargs\bbl@tempa + {\expandafter\noexpand\csname user@active#2\endcsname}% + {\expandafter\noexpand\csname normal@char#2\endcsname}} \AddBabelHook{luatex}{everylanguage}{% \directlua{ processnow = (tex.language == 0) or @@ -205,6 +271,7 @@ \input #1\relax \fi \directlua{processnow = nil}} +<@Restore Unicode catcodes before loading patterns@> <@Font selection@> %</luatex> % \end{macrocode} |