diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-15 22:02:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-15 22:02:11 +0000 |
commit | f179cfe8b834f54150dcfb4a1eec882f36dd1136 (patch) | |
tree | 63a0020fb4ca833a2d06967ac9e0379beb42c3e9 /Master/texmf-dist/source/latex/babel/babel.dtx | |
parent | 4fca0de8cc619b33b6a1d40f927d983d76c38180 (diff) |
babel (15oct19)
git-svn-id: svn://tug.org/texlive/trunk@52400 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/babel/babel.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/babel/babel.dtx | 184 |
1 files changed, 113 insertions, 71 deletions
diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx index 86d4890e348..398c5e4ae3b 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/09/27 v3.34 The Babel package] +\ProvidesFile{babel.dtx}[2019/10/15 v3.35 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -1023,11 +1023,13 @@ using them; see above. shorthands is safe. With \texttt{safe=bib} only |\nocite|, |\bibcite| and |\bibitem| are redefined. With |safe=ref| only |\newlabel|, |\ref| and |\pageref| are redefined (as well as a few macros from -\textsf{varioref} and \textsf{ifthen}). With |safe=none| no macro is -redefined. This option is strongly recommended, because a good deal of -incompatibilities and errors are related to these redefinitions -- of -course, in such a case you cannot use shorthands in these macros, but -this is not a real problem (just use ``allowed'' characters). +\textsf{varioref} and \textsf{ifthen}). + +With |safe=none| no macro is redefined. This option is strongly +recommended, because a good deal of incompatibilities and errors are +related to these redefinitions. As of \New{3.34}, in $\epsilon$\TeX{} +based engines (ie, almost every engine except the oldest ones) +shorthands can be used in these macros (formerly you could not). \Describe{math=}{\texttt{active} $\string|$ \texttt{normal}} Shorthands are mainly intended for text, not for math. By setting this @@ -4071,8 +4073,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<<version=3.34>> -%<<date=2019/09/27>> +%<<version=3.35>> +%<<date=2019/10/15>> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -4210,25 +4212,30 @@ help from Bernd Raichle, for which I am grateful. % it is based on |\ifcsname|, which is more efficient, and do not % waste memory. % +% \changes{babel~3.35}{2019/09/22}{Inside a group, so that \cs{ifcsname} +% is still undefined.} +% % \begin{macrocode} -\def\bbl@ifunset#1{% - \expandafter\ifx\csname#1\endcsname\relax - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} -\bbl@ifunset{ifcsname}% - {}% - {\def\bbl@ifunset#1{% - \ifcsname#1\endcsname - \expandafter\ifx\csname#1\endcsname\relax - \bbl@afterelse\expandafter\@firstoftwo +\begingroup + \gdef\bbl@ifunset#1{% + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} + \bbl@ifunset{ifcsname}% + {}% + {\gdef\bbl@ifunset#1{% + \ifcsname#1\endcsname + \expandafter\ifx\csname#1\endcsname\relax + \bbl@afterelse\expandafter\@firstoftwo + \else + \bbl@afterfi\expandafter\@secondoftwo + \fi \else - \bbl@afterfi\expandafter\@secondoftwo - \fi - \else - \expandafter\@firstoftwo - \fi}} + \expandafter\@firstoftwo + \fi}} +\endgroup % \end{macrocode} % \end{macro} % @@ -6079,28 +6086,43 @@ help from Bernd Raichle, for which I am grateful. % The command |\active@prefix| which is used in the expansion of % active characters has a function similar to |\OT1-cmd| in that it % |\protect|s the active character whenever |\protect| is -% \emph{not} |\@typeset@protect|. -% -% \begin{macrocode} -\def\active@prefix#1{% - \ifx\protect\@typeset@protect - \else -% \end{macrocode} -% -% When |\protect| is set to |\@unexpandable@protect| we make sure -% that the active character is als \emph{not} expanded by inserting -% |\noexpand| in front of it. The |\@gobble| is needed to remove +% \emph{not} |\@typeset@protect|. The |\@gobble| is needed to remove % a token such as |\activechar:| (when the double colon was the -% active character to be dealt with). +% active character to be dealt with). There are two definitions, +% depending of |\ifincsname| is available. If there is, the +% expansion will be more robust. +% +% \changes{babel 3.35}{2019/09/18}{Added \cs{ifincsname} test.} % % \begin{macrocode} - \ifx\protect\@unexpandable@protect - \noexpand#1% - \else - \protect#1% - \fi - \expandafter\@gobble - \fi} +\begingroup +\bbl@ifunset{ifincsname}% + {\gdef\active@prefix#1{% + \ifx\protect\@typeset@protect + \else + \ifx\protect\@unexpandable@protect + \noexpand#1% + \else + \protect#1% + \fi + \expandafter\@gobble + \fi}} + {\gdef\active@prefix#1{% + \ifincsname + \string#1% + \expandafter\@gobble + \else + \ifx\protect\@typeset@protect + \else + \ifx\protect\@unexpandable@protect + \noexpand#1% + \else + \protect#1% + \fi + \expandafter\expandafter\expandafter\@gobble + \fi + \fi}} +\endgroup % \end{macrocode} % % \end{macro} @@ -8060,7 +8082,13 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@KVP@mapdigits\@nil \let\bbl@KVP@intraspace\@nil \let\bbl@KVP@intrapenalty\@nil - \bbl@forkv{#1}{\bbl@csarg\def{KVP@##1}{##2}}% TODO - error handling + \bbl@forkv{#1}{% TODO - error handling + \in@{/}{##1}% + \ifin@ + \bbl@renewinikey##1\@@{##2}% + \else + \bbl@csarg\def{KVP@##1}{##2}% + \fi}% \ifx\bbl@KVP@import\@nil\else \bbl@exp{\\\bbl@ifblank{\bbl@KVP@import}}% {\begingroup @@ -8432,10 +8460,7 @@ help from Bernd Raichle, for which I am grateful. % 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 @@ -8460,9 +8485,15 @@ help from Bernd Raichle, for which I am grateful. % \begin{macrocode} \def\bbl@iniskip#1\@@{}% if starts with ; \def\bbl@inisec[#1]#2\@@{% if starts with opening bracket + \def\bbl@elt##1##2{\bbl@inireader##1=##2\@@}% + \@nameuse{bbl@renew@\bbl@section}% + \global\bbl@csarg\let{renew@\bbl@section}\relax \@nameuse{bbl@secpost@\bbl@section}% ends previous section \def\bbl@section{#1}% - \@nameuse{bbl@secpre@\bbl@section}% starts current section + \def\bbl@elt##1##2{% + \@namedef{bbl@KVP@#1/##1}{}}% + \@nameuse{bbl@renew@#1}% + \@nameuse{bbl@secpre@#1}% starts current section \bbl@ifunset{bbl@inikv@#1}% {\let\bbl@inireader\bbl@iniskip}% {\bbl@exp{\let\\\bbl@inireader\<bbl@inikv@#1>}}} @@ -9067,6 +9098,9 @@ help from Bernd Raichle, for which I am grateful. % the mark are not disabled by the output routine kicking in while % \cs{@safe@activestrue} is in effect. % +% \changes{babel~3.35}{2019/10/11}{Now \cs{markboth} is protected. +% Consider this case.} +% % \begin{macrocode} \bbl@trace{Marks} \IfBabelLayout{sectioning} @@ -9079,7 +9113,8 @@ help from Bernd Raichle, for which I am grateful. \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}}% \fi} {\ifbbl@single\else - \bbl@redefine\markright#1{% + \bbl@ifunset{markright }\bbl@redefine\bbl@redefinerobust + \markright#1{% \bbl@ifblank{#1}% {\org@markright{}}% {\toks@{#1}% @@ -9098,7 +9133,9 @@ help from Bernd Raichle, for which I am grateful. % headings for the page. While doing so they also store a copy of % |\markboth| in |\@mkboth|. Therefore we need to check whether % |\@mkboth| has already been set. If so we neeed to do that again -% with the new definition of |\markboth|. +% with the new definition of |\markboth|. (As of Oct 2019, \LaTeX{} +% stores the definition in an intermediate macros, so it's not +% necessary anymore, but it's preserved for older versions.) % % \begin{macrocode} \ifx\@mkboth\markboth @@ -9106,12 +9143,8 @@ help from Bernd Raichle, for which I am grateful. \else \def\bbl@tempc{} \fi -% \end{macrocode} -% -% Now we can start the new definition of |\markboth| -% -% \begin{macrocode} - \bbl@redefine\markboth#1#2{% + \bbl@ifunset{markboth }\bbl@redefine\bbl@redefinerobust + \markboth#1#2{% \protected@edef\bbl@tempb##1{% \protect\foreignlanguage {\languagename}{\protect\bbl@restore@actives##1}}% @@ -9122,11 +9155,6 @@ help from Bernd Raichle, for which I am grateful. {\@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 \fi} % end ifbbl@single, end \IfBabelLayout % \end{macrocode} @@ -9386,10 +9414,11 @@ help from Bernd Raichle, for which I am grateful. % \changes{babel~3.9j}{2014/03/17}{Moved misplaced code - it should be % executed only with LaTeX} % \changes{babel~3.23}{2018/08/28}{Added TS1, T3, TS3} +% \changes{babel~3.35}{2019/10/01}{Added PU, PD1} % % \begin{macrocode} \bbl@trace{Encoding and fonts} -\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU} +\newcommand\BabelNonASCII{LGR,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU,PU,PD1} \newcommand\BabelNonText{TS1,T3,TS3} \let\org@TeX\TeX \let\org@LaTeX\LaTeX @@ -11272,9 +11301,12 @@ help from Bernd Raichle, for which I am grateful. \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.\\% + There is nothing intrinsically wrong with this warning, and\\% + you can ignore it altogether if you do not need these\\% + families. But if they are used in the document, you should be\\% + aware 'babel' will no set Script and Language for them, so\\% + you may consider defining a new family with \string\babelfont.\\% + See the manual for further details about \string\babelfont.\\% Reported}} {}}% \gdef\bbl@switchfont{% @@ -12504,6 +12536,8 @@ help from Bernd Raichle, for which I am grateful. % \subsection{Auto bidi with \texttt{basic} and \texttt{basic-r}} % % \changes{babel~3.14}{2017/09/30}{LuaTeX - support for R/AL texts - basic-r} +% \changes{babel~3.35}{2019/10/11}{Hack for unboxed boxes - The PUAs +% are `on'.} % % 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 @@ -12515,19 +12549,24 @@ help from Bernd Raichle, for which I am grateful. Babel = Babel or {} +-- TODO: merge ranges into characters, as meta index + Babel.ranges={ {0x0590, 0x05FF, 'r'}, {0x0600, 0x07BF, 'al'}, {0x07C0, 0x085F, 'r'}, {0x0860, 0x086F, 'al'}, {0x08A0, 0x08FF, 'al'}, + {0xE000, 0xF8FF, 'on'}, -- PUA {0xFB1D, 0xFB4F, 'r'}, {0xFB50, 0xFDFF, 'al'}, {0xFE70, 0xFEFF, 'al'}, {0x10800, 0x10C4F, 'r'}, {0x1E800, 0x1E8DF, 'r'}, {0x1E900, 0x1E95F, 'r'}, - {0x1F300, 0x1F9FF, 'on'} + {0x1F300, 0x1F9FF, 'on'}, + {0xF0000, 0xFFFFD, 'on'}, -- PUA + {0x100000, 0x10FFFD, 'on'} -- PUA } Babel.characters={ @@ -18854,7 +18893,7 @@ function Babel.bidi(head, ispar) if mir == 'rrr' or mir == 'lrr' or mir == 'rrl' or mir == 'rlr' then for ch in node.traverse(node.next(last_lr)) do if ch == item then break end - if ch.id == node.id'glyph' then + if ch.id == node.id'glyph' and characters[ch.char] then ch.char = characters[ch.char].m or ch.char end end @@ -18883,7 +18922,9 @@ function Babel.bidi(head, ispar) % \begin{macrocode} if last_lr and outer == 'r' then for ch in node.traverse_id(node.id'glyph', node.next(last_lr)) do - ch.char = characters[ch.char].m or ch.char + if characters[ch.char] then + ch.char = characters[ch.char].m or ch.char + end end end if first_n then @@ -19215,7 +19256,8 @@ function Babel.bidi(head, ispar, hdir) for r = first_on, q - 1 do nodes[r][2] = temp item = nodes[r][1] -- MIRRORING - if Babel.mirroring_enabled and item.id == GLYPH and temp == 'r' then + if Babel.mirroring_enabled and item.id == GLYPH + and temp == 'r' and characters[item.char] then item.char = characters[item.char].m or item.char end end |