diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-04 23:39:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-04 23:39:46 +0000 |
commit | 2c16907b492b353f234ae633ea24851c0f809242 (patch) | |
tree | a639e848a1f8919ef7529c405cb447c53ab2c389 /Master/texmf-dist/tex/generic/babel/babel.def | |
parent | bb83d426056841b56f02baa144b334892a340fa6 (diff) |
babel (4jan18)
git-svn-id: svn://tug.org/texlive/trunk@46210 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/babel.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/babel.def | 195 |
1 files changed, 127 insertions, 68 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel.def b/Master/texmf-dist/tex/generic/babel/babel.def index cd6e92b3584..81f324c8fba 100644 --- a/Master/texmf-dist/tex/generic/babel/babel.def +++ b/Master/texmf-dist/tex/generic/babel/babel.def @@ -40,7 +40,7 @@ \wlog{File: #1 #4 #3 <#2>}% \let\ProvidesFile\@undefined} \fi -\ProvidesFile{babel.def}[2017/11/03 3.15 Babel common definitions] +\ProvidesFile{babel.def}[2018/01/04 3.16 Babel common definitions] \ifx\AtBeginDocument\@undefined \input plain.def\relax \fi @@ -358,7 +358,8 @@ \let\languagename\bbl@main@language \bbl@patterns{\languagename}} \AtBeginDocument{% - \expandafter\selectlanguage\expandafter{\bbl@main@language}} + \expandafter\selectlanguage\expandafter{\bbl@main@language}% + \ifcase\bbl@engine\or\pagedir\bodydir\fi} % TODO - a better place \def\select@language@x#1{% \ifcase\bbl@select@type \bbl@ifsamestring\languagename{#1}{}{\select@language{#1}}% @@ -1156,50 +1157,36 @@ \UseTextSymbol{OT1}{\DJ}} \DeclareTextCommand{\SS}{OT1}{SS} \ProvideTextCommandDefault{\SS}{\UseTextSymbol{OT1}{\SS}} -\ProvideTextCommand{\glq}{OT1}{% +\ProvideTextCommandDefault{\glq}{% \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}} -\ProvideTextCommand{\glq}{T1}{% - \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}} -\ProvideTextCommandDefault{\glq}{\UseTextSymbol{OT1}\glq} \ProvideTextCommand{\grq}{T1}{% \textormath{\textquoteleft}{\mbox{\textquoteleft}}} +\ProvideTextCommand{\grq}{TU}{% + \textormath{\textquoteleft}{\mbox{\textquoteleft}}} \ProvideTextCommand{\grq}{OT1}{% - \save@sf@q{\kern-.0125em% - \textormath{\textquoteleft}{\mbox{\textquoteleft}}% - \kern.07em\relax}} + \save@sf@q{\kern-.0125em + \textormath{\textquoteleft}{\mbox{\textquoteleft}}% + \kern.07em\relax}} \ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq} -\ProvideTextCommand{\glqq}{OT1}{% +\ProvideTextCommandDefault{\glqq}{% \textormath{\quotedblbase}{\mbox{\quotedblbase}}} -\ProvideTextCommand{\glqq}{T1}{% - \textormath{\quotedblbase}{\mbox{\quotedblbase}}} -\ProvideTextCommandDefault{\glqq}{\UseTextSymbol{OT1}\glqq} \ProvideTextCommand{\grqq}{T1}{% \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}} +\ProvideTextCommand{\grqq}{TU}{% + \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}} \ProvideTextCommand{\grqq}{OT1}{% - \save@sf@q{\kern-.07em% - \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}% - \kern.07em\relax}} + \save@sf@q{\kern-.07em + \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}% + \kern.07em\relax}} \ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq} -\ProvideTextCommand{\flq}{OT1}{% +\ProvideTextCommandDefault{\flq}{% \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}} -\ProvideTextCommand{\flq}{T1}{% - \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}} -\ProvideTextCommandDefault{\flq}{\UseTextSymbol{OT1}\flq} -\ProvideTextCommand{\frq}{OT1}{% - \textormath{\guilsinglright}{\mbox{\guilsinglright}}} -\ProvideTextCommand{\frq}{T1}{% +\ProvideTextCommandDefault{\frq}{% \textormath{\guilsinglright}{\mbox{\guilsinglright}}} -\ProvideTextCommandDefault{\frq}{\UseTextSymbol{OT1}\frq} -\ProvideTextCommand{\flqq}{OT1}{% - \textormath{\guillemotleft}{\mbox{\guillemotleft}}} -\ProvideTextCommand{\flqq}{T1}{% +\ProvideTextCommandDefault{\flqq}{% \textormath{\guillemotleft}{\mbox{\guillemotleft}}} -\ProvideTextCommandDefault{\flqq}{\UseTextSymbol{OT1}\flqq} -\ProvideTextCommand{\frqq}{OT1}{% +\ProvideTextCommandDefault{\frqq}{% \textormath{\guillemotright}{\mbox{\guillemotright}}} -\ProvideTextCommand{\frqq}{T1}{% - \textormath{\guillemotright}{\mbox{\guillemotright}}} -\ProvideTextCommandDefault{\frqq}{\UseTextSymbol{OT1}\frqq} \def\umlauthigh{% \def\bbl@umlauta##1{\leavevmode\bgroup% \expandafter\accent\csname\f@encoding dqpos\endcsname @@ -1240,7 +1227,39 @@ \chardef\l@english\z@ \fi \main@language{english} -\ifcase\bbl@engine\or +\providecommand\IfBabelLayout[3]{#3}% +\newcommand\BabelPatchSection[1]{% + \@ifundefined{#1}{}{% + \bbl@exp{\let\<bbl@ss@#1>\<#1>}% + \@namedef{#1}{% + \@ifstar{\bbl@presec@s{#1}}% + {\@dblarg{\bbl@presec@x{#1}}}}}} +\def\bbl@presec@x#1[#2]#3{% + \bbl@exp{% + \\\select@language@x{\bbl@main@language}% + \\\@nameuse{bbl@ss@#1}% + [\\\foreignlanguage{\languagename}{\unexpanded{#2}}]% + {\\\foreignlanguage{\languagename}{\unexpanded{#3}}}% + \\\select@language@x{\languagename}}} +\def\bbl@presec@s#1#2{% + \bbl@exp{% + \\\select@language@x{\bbl@main@language}% + \\\@nameuse{bbl@ss@#1}*% + {\\\foreignlanguage{\languagename}{\unexpanded{#2}}}% + \\\select@language@x{\languagename}}} +\IfBabelLayout{sectioning}% at begin document ??? + {\BabelPatchSection{part}% + \BabelPatchSection{chapter}% + \BabelPatchSection{section}% + \BabelPatchSection{subsection}% + \BabelPatchSection{subsubsection}% + \BabelPatchSection{paragraph}% + \BabelPatchSection{subparagraph}% + \def\babel@toc#1{% + \select@language@x{\bbl@main@language}}}{} +\ifcase\bbl@engine + \input txtbabel.def +\or \input luababel.def \or \input xebabel.def @@ -1279,6 +1298,12 @@ {Use this macro as documented}}% {\bbl@provide@renew{#2}}}% \bbl@exp{\\\babelensure[exclude=\\\today]{#2}}% + \bbl@ifunset{bbl@ensure@\languagename}% + {\bbl@exp{% + \\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{% + \\\foreignlanguage{\languagename}% + {####1}}}}% + {}% \ifx\bbl@KVP@script\@nil\else \bbl@csarg\edef{sname@#2}{\bbl@KVP@script}% \fi @@ -1380,10 +1405,10 @@ \let\bbl@inireader\bbl@iniskip \bbl@info{Importing data from babel-#1.ini for \languagename}% \loop + \if T\ifeof1F\fi T\relax % Trick, because inside \loop \endlinechar\m@ne \read1 to \bbl@line \endlinechar`\^^M - \if T\ifeof1F\fi T\relax % Trick, because inside \loop \ifx\bbl@line\@empty\else \expandafter\bbl@iniline\bbl@line\bbl@iniline \fi @@ -1470,21 +1495,23 @@ \bbl@TG@@date \global\bbl@csarg\let{date@\languagename}\bbl@toreplace \bbl@exp{% - \gdef\<\languagename date>####1####2####3{% + \gdef\<\languagename date>{\\\protect\<\languagename date >}% + \gdef\<\languagename date >####1####2####3{% + \\\bbl@usedategrouptrue \<bbl@ensure@\languagename>{% \<bbl@date@\languagename>{####1}{####2}{####3}}}% \\\bbl@add\\\bbl@savetoday{% \\\SetString\\\today{% - \<\languagename date>{\year}{\month}{\day}}}}}}% + \<\languagename date>{\\\the\year}{\\\the\month}{\\\the\day}}}}}}% {}} -\newcommand\BabelDateSpace{\nobreakspace{}} +\newcommand\BabelDateSpace{\nobreakspace} \newcommand\BabelDateDot{.\@} \newcommand\BabelDated[1]{{\number#1}} \newcommand\BabelDatedd[1]{{\ifnum#1<10 0\fi\number#1}} \newcommand\BabelDateM[1]{{\number#1}} \newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}} \newcommand\BabelDateMMMM[1]{{% - \csname month\romannumeral\month name\endcsname}}% + \csname month\romannumeral#1name\endcsname}}% \newcommand\BabelDatey[1]{{\number#1}}% \newcommand\BabelDateyy[1]{{% \ifnum#1<10 0\number#1 % @@ -1512,6 +1539,30 @@ \bbl@replace\bbl@toreplace{[yy]}{\BabelDateyy{####1}}% \bbl@replace\bbl@toreplace{[yyyy]}{\BabelDateyyyy{####1}}% \bbl@replace@finish@iii\bbl@toreplace} +\def\bbl@provide@lsys#1{% + \bbl@ifunset{bbl@lname@#1}% + {\bbl@ini@ids{#1}}% + {}% + \bbl@csarg\let{lsys@#1}\@empty + \bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}% + \bbl@ifunset{bbl@sotf#1}{\bbl@csarg\gdef{sotf@#1}{DFLT}}{}% + \bbl@csarg\bbl@add@list{lsys@#1}{Script=\bbl@cs{sname@#1}}% + \bbl@ifunset{bbl@lname@#1}{}% + {\bbl@csarg\bbl@add@list{lsys@#1}{Language=\bbl@cs{lname@#1}}}% + \bbl@csarg\bbl@toglobal{lsys@#1}}% + % \bbl@exp{% TODO - should be global + % \<keys_if_exist:nnF>{fontspec-opentype/Script}{\bbl@cs{sname@#1}}% + % {\\\newfontscript{\bbl@cs{sname@#1}}{\bbl@cs{sotf@#1}}}% + % \<keys_if_exist:nnF>{fontspec-opentype/Language}{\bbl@cs{lname@#1}}% + % {\\\newfontlanguage{\bbl@cs{lname@#1}}{\bbl@cs{lotf@#1}}}}} +\def\bbl@ini@ids#1{% + \def\BabelBeforeIni##1##2{% + \begingroup + \bbl@add\bbl@secpost@identification{\closein1 }% + \catcode`\[=12 \catcode`\]=12 \catcode`\==12 + \bbl@read@ini{##1}% + \endgroup}% boxed, to avoid extra spaces: + {\setbox\z@\hbox{\InputIfFileExists{babel-#1.tex}{}{}}}} \ifx\bbl@opt@safe\@empty\else \def\@newl@bel#1#2#3{% {\@safe@activestrue @@ -1589,29 +1640,36 @@ \let\org@bibcite\bibcite \let\org@@bibitem\@bibitem \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 +\IfBabelLayout{sectioning} + {\ifx\bbl@opt@headfoot\@nnil + \g@addto@macro\@resetactivechars{% + \set@typeset@protect + \expandafter\select@language@x\expandafter{\bbl@main@language}% + \let\protect\noexpand}% + \fi} + {\bbl@redefine\markright#1{% + \bbl@ifblank{#1}% + {\org@markright{}}% + {\toks@{#1}% + \bbl@exp{% + \\\org@markright{\\\protect\\\foreignlanguage{\languagename}% + {\\\protect\\\bbl@restore@actives\the\toks@}}}}} + \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 \bbl@xin@{R}\bbl@opt@safe \ifin@ \AtBeginDocument{% @@ -1760,17 +1818,16 @@ \global\bbl@csarg\chardef{wdir@#1}\z@ \fi} \def\bbl@switchdir{% + \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}% \bbl@exp{\\\bbl@setdirs\bbl@cs{wdir@\languagename}}} \def\bbl@setdirs#1{% TODO - math \ifcase\bbl@select@type % TODO - strictly, not the right test - \bbl@pagedir{#1}% \bbl@bodydir{#1}% \bbl@pardir{#1}% \fi \bbl@textdir{#1}} -\ifcase\bbl@engine -\or +\ifodd\bbl@engine % luatex=1 \AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir} \DisableBabelHook{babel-bidi} \def\bbl@getluadir#1{% @@ -1797,7 +1854,7 @@ \def\bbl@bodydir{\bbl@setdir{body}\bodydir} \def\bbl@pagedir{\bbl@setdir{page}\pagedir} \def\bbl@dirparastext{\pardir\the\textdir\relax}% %%%% -\or +\else % pdftex=0, xetex=2 \AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir} \DisableBabelHook{babel-bidi} \newcount\bbl@dirlevel @@ -1847,15 +1904,17 @@ \let\bbl@xebidipar\relax \TeXXeTstate\@ne \def\bbl@xeeverypar{% - \ifcase\bbl@thepardir\else + \ifcase\bbl@thepardir + \ifcase\bbl@thetextdir\else\beginR\fi + \else {\setbox\z@\lastbox\beginR\box\z@}% - \fi - \ifcase\bbl@thetextdir\else\beginR\fi}% + \fi}% \let\bbl@severypar\everypar \newtoks\everypar \everypar=\bbl@severypar \bbl@severypar{\bbl@xeeverypar\the\everypar}} \fi +\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}} \ifx\loadlocalcfg\@undefined \@ifpackagewith{babel}{noconfigs}% {\let\loadlocalcfg\@gobble}% |