diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-15 21:41:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-15 21:41:34 +0000 |
commit | 6024de648c5e4b1bcb3630cecc307ca55db9ae8e (patch) | |
tree | d9c6878e5900d0c9ea4de20694e550b88ef0ad8d /Master/texmf-dist/tex/latex/polyglossia | |
parent | 7ebe75c756258ce417125e376f199df4fd5b47a9 (diff) |
polyglossia (15nov19)
git-svn-id: svn://tug.org/texlive/trunk@52808 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/polyglossia')
75 files changed, 3519 insertions, 1039 deletions
diff --git a/Master/texmf-dist/tex/latex/polyglossia/babelsh.def b/Master/texmf-dist/tex/latex/polyglossia/babelsh.def index 7d14c291783..c525455fc02 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/babelsh.def +++ b/Master/texmf-dist/tex/latex/polyglossia/babelsh.def @@ -3,28 +3,71 @@ \bbl@afterfi\endinput \fi \ProvidesFile{babelsh.def} - [2013/04/30 % + [2019/09/30 % Babel common definitions for shorthands^^J - Taken verbatim from babel.def (2013/04/15 v3.9e)] + Taken verbatim from babel files (2019/09/27 v3.34)] % % ------------------------------------------------------------------------------ % -% XXX: from babel.sty +% lines 52 to 56 from babel.sty % % ------------------------------------------------------------------------------ % +\def\bbl@stripslash{\expandafter\@gobble\string} +\def\bbl@add#1#2{% + \bbl@ifunset{\bbl@stripslash#1}% + {\def#1{#2}}% + {\expandafter\def\expandafter#1\expandafter{#1#2}}} +% +% ------------------------------------------------------------------------------ +% +% line 73 to 74 from babel.sty +% +% ------------------------------------------------------------------------------ +% +\long\def\bbl@afterelse#1\else#2\fi{\fi#1} +\long\def\bbl@afterfi#1\fi{\fi#1} +% +% ------------------------------------------------------------------------------ +% +% line 399 from babel.sty +% +% ------------------------------------------------------------------------------ +% +\let\bbl@opt@shorthands\@nnil +% +% ------------------------------------------------------------------------------ +% +% lines 432 to 445 from babel.sty +% +% ------------------------------------------------------------------------------ +% +\ifx\bbl@opt@shorthands\@nnil + \def\bbl@ifshorthand#1#2#3{#2}% +\else\ifx\bbl@opt@shorthands\@empty + \def\bbl@ifshorthand#1#2#3{#3}% +\else \def\bbl@ifshorthand#1{% - \@expandtwoargs\in@{\string#1}{\bbl@opt@shorthands}% + \bbl@xin@{\string#1}{\bbl@opt@shorthands}% \ifin@ \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi} -\let\bbl@opt@shorthands\@nnil + \edef\bbl@opt@shorthands{% + \expandafter\bbl@sh@string\bbl@opt@shorthands\@empty}% +% +% ------------------------------------------------------------------------------ +% +% line 450 from babel.sty +% +% ------------------------------------------------------------------------------ +% +\fi\fi % % ------------------------------------------------------------------------------ % -% XXX: from switch.def +% lines 389 to 424 from switch.def % % ------------------------------------------------------------------------------ % @@ -67,18 +110,90 @@ % % ------------------------------------------------------------------------------ % -% XXX: from babel.def +% lines 48 to 69 from babel.def +% +% ------------------------------------------------------------------------------ +% +\ifx\bbl@ifshorthand\@undefined + \let\bbl@opt@shorthands\@nnil + \def\bbl@ifshorthand#1#2#3{#2}% + \let\bbl@language@opts\@empty + \ifx\babeloptionstrings\@undefined + \let\bbl@opt@strings\@nnil + \else + \let\bbl@opt@strings\babeloptionstrings + \fi + \def\BabelStringsDefault{generic} + \def\bbl@tempa{normal} + \ifx\babeloptionmath\bbl@tempa + \def\bbl@mathnormal{\noexpand\textormath} + \fi + \def\AfterBabelLanguage#1#2{} + \ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi + \let\bbl@afterlang\relax + \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 +% +% ------------------------------------------------------------------------------ +% +% line 108 from babel.def % % ------------------------------------------------------------------------------ % -\def\bbl@for#1#2#3{\@for#1:=#2\do{\ifx#1\@empty\else#3\fi}} -\def\bbl@add#1#2{% - \@ifundefined{\expandafter\@gobble\string#1}% - {\def#1{#2}}% - {\expandafter\def\expandafter#1\expandafter{#1#2}}} -\long\def\bbl@afterelse#1\else#2\fi{\fi#1} -\long\def\bbl@afterfi#1\fi{\fi#1} \def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% +% +% ------------------------------------------------------------------------------ +% +% lines 125 to 130 from babel.def +% +% ------------------------------------------------------------------------------ +% +\def\bbl@exp#1{% + \begingroup + \let\\\noexpand + \def\<##1>{\expandafter\noexpand\csname##1\endcsname}% + \edef\bbl@exp@aux{\endgroup#1}% + \bbl@exp@aux} +% +% ------------------------------------------------------------------------------ +% +% lines 144 to 149 from babel.def +% +% ------------------------------------------------------------------------------ +% +\def\bbl@ifunset#1{% + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +% +% ------------------------------------------------------------------------------ +% +% lines 234 to 243 from babel.def +% +% ------------------------------------------------------------------------------ +% +\chardef\bbl@engine=% + \ifx\directlua\@undefined + \ifx\XeTeXinputencoding\@undefined + \z@ + \else + \tw@ + \fi + \else + \@ne + \fi +% +% ------------------------------------------------------------------------------ +% +% lines 255 to 258 from babel.def +% +% ------------------------------------------------------------------------------ +% \def\bbl@withactive#1#2{% \begingroup \lccode`~=`#2\relax @@ -86,20 +201,24 @@ % % ------------------------------------------------------------------------------ % -% XXX: a bit further in babel.def +% lines 443 to 558 from babel.def % % ------------------------------------------------------------------------------ % -\def\bbl@add@special#1{% - \begingroup - \def\do{\noexpand\do\noexpand}% - \def\@makeother{\noexpand\@makeother\noexpand}% - \edef\x{\endgroup - \def\noexpand\dospecials{\dospecials\do#1}% - \expandafter\ifx\csname @sanitize\endcsname\relax \else - \def\noexpand\@sanitize{\@sanitize\@makeother#1}% - \fi}% - \x} +\def\bbl@add@special#1{% 1:a macro like \", \?, etc. + \bbl@add\dospecials{\do#1}% test @sanitize = \relax, for back. compat. + \bbl@ifunset{@sanitize}{}{\bbl@add\@sanitize{\@makeother#1}}% + \ifx\nfss@catcodes\@undefined\else % TODO - same for above + \begingroup + \catcode`#1\active + \nfss@catcodes + \ifnum\catcode`#1=\active + \endgroup + \bbl@add\nfss@catcodes{\@makeother#1}% + \else + \endgroup + \fi + \fi} \def\bbl@remove@special#1{% \begingroup \def\x##1##2{\ifnum`#1=`##2\noexpand\@empty @@ -108,7 +227,7 @@ \def\@makeother{\x\@makeother}% \edef\x{\endgroup \def\noexpand\dospecials{\dospecials}% - \expandafter\ifx\csname @sanitize\endcsname\relax \else + \expandafter\ifx\csname @sanitize\endcsname\relax\else \def\noexpand\@sanitize{\@sanitize}% \fi}% \x} @@ -126,19 +245,17 @@ \bbl@afterfi\csname#2@sh@#1@\string##1@\endcsname \fi}}% \def\initiate@active@char#1{% - \expandafter\ifx\csname active@char\string#1\endcsname\relax - \bbl@withactive - {\expandafter\@initiate@active@char\expandafter}#1\string#1#1% - \fi} + \bbl@ifunset{active@char\string#1}% + {\bbl@withactive + {\expandafter\@initiate@active@char\expandafter}#1\string#1#1}% + {}} \def\@initiate@active@char#1#2#3{% - \expandafter\edef\csname bbl@oricat@#2\endcsname{% - \catcode`#2=\the\catcode`#2\relax}% + \bbl@csarg\edef{oricat@#2}{\catcode`#2=\the\catcode`#2\relax}% \ifx#1\@undefined - \expandafter\edef\csname bbl@oridef@#2\endcsname{% - \let\noexpand#1\noexpand\@undefined}% + \bbl@csarg\edef{oridef@#2}{\let\noexpand#1\noexpand\@undefined}% \else - \expandafter\let\csname bbl@oridef@@#2\endcsname#1% - \expandafter\edef\csname bbl@oridef@#2\endcsname{% + \bbl@csarg\let{oridef@@#2}#1% + \bbl@csarg\edef{oridef@#2}{% \let\noexpand#1% \expandafter\noexpand\csname bbl@oridef@@#2\endcsname}% \fi @@ -146,7 +263,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 @@ -176,9 +293,11 @@ \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}% \bbl@csarg\edef{active@#2}{% \noexpand\active@prefix\noexpand#1% \expandafter\noexpand\csname active@char#2\endcsname}% @@ -196,22 +315,21 @@ \if\string'#2% \let\prim@s\bbl@prim@s \let\active@math@prime#1% - \fi} + \fi + \bbl@usehooks{initiateactive}{{#1}{#2}{#3}}} \@ifpackagewith{babel}{KeepShorthandsActive}% {\let\bbl@restoreactive\@gobble}% {\def\bbl@restoreactive#1{% - \edef\bbl@tempa{% + \bbl@exp{% % % ------------------------------------------------------------------------------ % -% XXX: WARNING: this has been commented in babelsh.def +% lines 561 to 755 from babel.def % % ------------------------------------------------------------------------------ % -% \noexpand\AfterBabelLanguage\noexpand\CurrentOption -% {\catcode`#1=\the\catcode`#1\relax}% - \noexpand\AtEndOfPackage{\catcode`#1=\the\catcode`#1\relax}}% - \bbl@tempa}% + \\\AtEndOfPackage + {\catcode`#1=\the\catcode`#1\relax}}}% \AtEndOfPackage{\let\bbl@restoreactive\@gobble}} \def\bbl@sh@select#1#2{% \expandafter\ifx\csname#1@sh@#2@sel\endcsname\relax @@ -245,7 +363,7 @@ \def\bbl@tempa{#3}% \ifx\bbl@tempa\@empty \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@scndcs - \@ifundefined{#1@sh@\string#2@}{}% + \bbl@ifunset{#1@sh@\string#2@}{}% {\def\bbl@tempa{#4}% \expandafter\ifx\csname#1@sh@\string#2@\endcsname\bbl@tempa \else @@ -256,7 +374,7 @@ \@namedef{#1@sh@\string#2@}{#4}% \else \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@firstcs - \@ifundefined{#1@sh@\string#2@\string#3@}{}% + \bbl@ifunset{#1@sh@\string#2@\string#3@}{}% {\def\bbl@tempa{#4}% \expandafter\ifx\csname#1@sh@\string#2@\string#3@\endcsname\bbl@tempa \else @@ -293,7 +411,7 @@ turned off in the package options}}} \def\user@language@group{user@\language@group} \def\bbl@set@user@generic#1#2{% - \@ifundefined{user@generic@active#1}% + \bbl@ifunset{user@generic@active#1}% {\bbl@active@def#1\user@language@group{user@active}{user@generic@active}% \bbl@active@def#1\user@group{user@generic@active}{language@active}% \expandafter\edef\csname#2@sh@#1@@\endcsname{% @@ -334,14 +452,15 @@ The character `\string #1' should be made a shorthand character;\\% add the command \string\useshorthands\string{#1\string} to the preamble.\\% - I will ignore your instruction}{}} + I will ignore your instruction}% + {You may proceed, but expect unexpected results}} \newcommand*\shorthandon[1]{\bbl@switch@sh\@ne#1\@nnil} \DeclareRobustCommand*\shorthandoff{% \@ifstar{\bbl@shorthandoff\tw@}{\bbl@shorthandoff\z@}} \def\bbl@shorthandoff#1#2{\bbl@switch@sh#1#2\@nnil} \def\bbl@switch@sh#1#2{% \ifx#2\@nnil\else - \@ifundefined{bbl@active@\string#2}% + \bbl@ifunset{bbl@active@\string#2}% {\bbl@error {I cannot switch `\string#2' on or off--not a shorthand}% {This character is not a shorthand. Maybe you made\\% @@ -358,9 +477,9 @@ \fi} \def\babelshorthand{\active@prefix\babelshorthand\bbl@putsh} \def\bbl@putsh#1{% - \@ifundefined{bbl@active@\string#1}% - {\bbl@putsh@i#1\@empty\@nnil}% - {\csname bbl@active@\string#1\endcsname}} + \bbl@ifunset{bbl@active@\string#1}% + {\bbl@putsh@i#1\@empty\@nnil}% + {\csname bbl@active@\string#1\endcsname}} \def\bbl@putsh@i#1#2\@nnil{% \csname\languagename @sh@\string#1@% \ifx\@empty#2\else\string#2@\fi\endcsname} @@ -381,6 +500,7 @@ \def\bbl@deactivate#1{% \bbl@ifshorthand{#1}{\bbl@s@deactivate{#1}}{}} \fi +\newcommand\ifbabelshorthand[3]{\bbl@ifunset{bbl@active@\string#1}{#3}{#2}} \def\bbl@prim@s{% \prime\futurelet\@let@token\bbl@pr@m@s} \def\bbl@if@primes#1#2{% @@ -403,30 +523,28 @@ \initiate@active@char{~} \declare@shorthand{system}{~}{\leavevmode\nobreak\ } \bbl@activate{~} -\def\bbl@disc#1#2{\nobreak\discretionary{#2-}{}{#1}\bbl@allowhyphens} -\def\bbl@t@one{T1} -\def\bbl@allowhyphens{\nobreak\hskip\z@skip} -\def\bbl@t@one{T1} % % ------------------------------------------------------------------------------ % -% XXX: later in babel.def +% lines 890 to 927 from babel.def % % ------------------------------------------------------------------------------ % +\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} \newcommand\babelnullhyphen{\char\hyphenchar\font} \def\babelhyphen{\active@prefix\babelhyphen\bbl@hyphen} \def\bbl@hyphen{% \@ifstar{\bbl@hyphen@i @}{\bbl@hyphen@i\@empty}} \def\bbl@hyphen@i#1#2{% - \@ifundefined{bbl@hy@#1#2\@empty}% + \bbl@ifunset{bbl@hy@#1#2\@empty}% {\csname bbl@#1usehyphen\endcsname{\discretionary{#2}{}{#2}}}% {\csname bbl@hy@#1#2\@empty\endcsname}} \def\bbl@usehyphen#1{% \leavevmode - \ifdim\lastskip>\z@\mbox{#1}\nobreak\else\nobreak#1\fi - \hskip\z@skip} + \ifdim\lastskip>\z@\mbox{#1}\else\nobreak#1\fi + \nobreak\hskip\z@skip} \def\bbl@@usehyphen#1{% \leavevmode\ifdim\lastskip>\z@\mbox{#1}\else#1\fi} \def\bbl@hyphenchar{% @@ -439,12 +557,11 @@ \def\bbl@hy@@soft{\bbl@@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}} \def\bbl@hy@hard{\bbl@usehyphen\bbl@hyphenchar} \def\bbl@hy@@hard{\bbl@@usehyphen\bbl@hyphenchar} -\def\bbl@hy@nobreak{\bbl@usehyphen{\mbox{\bbl@hyphenchar}\nobreak}} +\def\bbl@hy@nobreak{\bbl@usehyphen{\mbox{\bbl@hyphenchar}}} \def\bbl@hy@@nobreak{\mbox{\bbl@hyphenchar}} \def\bbl@hy@repeat{% \bbl@usehyphen{% - \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}% - \nobreak}} + \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}} \def\bbl@hy@@repeat{% \bbl@@usehyphen{% \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}} @@ -454,7 +571,7 @@ % % ------------------------------------------------------------------------------ % -% XXX: end of the code copied from babel files +% end of the code copied from babel files % % ------------------------------------------------------------------------------ % diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-acadien.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-acadien.ldf new file mode 100644 index 00000000000..7521b1b579d --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-acadien.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-acadien.ldf}[polyglossia: module for canadian (acadian) french] + +% We provide this as a babel alias + +\xpg@load@master@language{french} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-afrikaans.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-afrikaans.ldf new file mode 100644 index 00000000000..76b0bd1a58f --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-afrikaans.ldf @@ -0,0 +1,86 @@ +\ProvidesFile{gloss-afrikaans.ldf}[polyglossia: module for afrikaans] + +\PolyglossiaSetup{afrikaans}{ + hyphennames={afrikaans,dutch}, + hyphenmins={2,2}, + langtag=AFK, + frenchspacing=true, + fontsetup=true, +} + +\define@boolkey{afrikaans}[afrikaans@]{babelshorthands}[true]{} + +\ifsystem@babelshorthands + \setkeys{afrikaans}{babelshorthands=true} +\else + \setkeys{afrikaans}{babelshorthands=false} +\fi + +\ifcsundef{initiate@active@char}{% + \input{babelsh.def}% + \initiate@active@char{"}% + \shorthandoff{"}% +}{} + +\def\afrikaans@shorthands{% + \bbl@activate{"}% + \def\language@group{afrikaans}% + \declare@shorthand{afrikaans}{"-}{\nobreak-\bbl@allowhyphens} + \declare@shorthand{afrikaans}{"~}{\textormath{\leavevmode\hbox{-}}{-}} + \declare@shorthand{afrikaans}{"|}{% + \textormath{\discretionary{-}{}{\kern.03em}}{}} + \declare@shorthand{afrikaans}{""}{\hskip\z@skip} + \declare@shorthand{afrikaans}{"/}{\textormath + {\bbl@allowhyphens\discretionary{/}{}{/}\bbl@allowhyphens}{}}% + \def\-{\bbl@allowhyphens\discretionary{-}{}{}\bbl@allowhyphens}% +} + +\def\noafrikaans@shorthands{% + \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}% +} + +\def\captionsafrikaans{% + \def\prefacename{Voorwoord}% + \def\refname{Verwysings}% + \def\abstractname{Samevatting}% + \def\bibname{Bibliografie}% + \def\chaptername{Hoofstuk}% + \def\appendixname{Bylae}% + \def\contentsname{Inhoudsopgawe}% + \def\listfigurename{Lys van figure}% + \def\listtablename{Lys van tabelle}% + \def\indexname{Inhoud}% + \def\figurename{Figuur}% + \def\tablename{Tabel}% + \def\partname{Deel}% + \def\enclname{Bylae(n)}% + \def\ccname{a.\,a.}% + \def\headtoname{Aan}% + \def\pagename{Bladsy}% + \def\seename{sien}% + \def\alsoname{sien ook}% + \def\proofname{Bewys}% +% \def\glossaryname{}% +} + +\def\dateafrikaans{% + \def\today{\number\day~\ifcase\month\or + Januarie\or Februarie\or Maart\or April\or Mei\or Junie\or + Julie\or Augustus\or September\or Oktober\or November\or + Desember\fi + \space \number\year}% +} + +\def\noextras@afrikaans{% + \noafrikaans@shorthands% +} + +\def\blockextras@afrikaans{% + \ifafrikaans@babelshorthands\afrikaans@shorthands\fi% +} + +\def\inlineextras@afrikaans{% + \ifafrikaans@babelshorthands\afrikaans@shorthands\fi% +} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-american.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-american.ldf new file mode 100644 index 00000000000..490d52762f3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-american.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-american.ldf}[polyglossia: module for american english] + +% We provide this as a babel alias + +\xpg@load@master@language{english} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf index 858719b6a71..a00d3c777dd 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf @@ -143,9 +143,8 @@ and may look very wrong.} \def\arabicnumber#1{% \ifeastern@numerals - \arabicdigits{\number#1}% + \@ensure@dir{\arabicdigits{\number#1}}% \else - %%\RL{\protect\reset@font\number#1}% \number#1% \fi} diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-australian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-australian.ldf new file mode 100644 index 00000000000..28869253e74 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-australian.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-australian.ldf}[polyglossia: module for australian english] + +% We provide this as a babel alias + +\xpg@load@master@language{english} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-austrian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-austrian.ldf new file mode 100644 index 00000000000..87d89848742 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-austrian.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-acadien.ldf}[polyglossia: module for austrian german (old spelling)] + +% We provide this as a babel alias + +\xpg@load@master@language{german} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasa.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasa.ldf new file mode 100644 index 00000000000..7e897526982 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasa.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-kurmanji.ldf}[polyglossia: module for kurmanji kurdish] + +% We provide this as a babel alias + +\xpg@load@master@language{kurdish} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasai.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasai.ldf index aeed3e82ab4..30a6bca72d7 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasai.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasai.ldf @@ -3,19 +3,6 @@ % We only provide this gloss for babel compatibility. Since bahasai is % a malay variety, we use 'malay' with variant 'indonesian' now. -\input{gloss-malay.ldf} - -\PolyglossiaSetup{bahasai}{% - language=Indonesian, - langtag=IND, - hyphennames={indonesian,indon,bahasai,bahasa,bahasam,malay,melayu}, - hyphenmins={2,2}, - fontsetup=true} - -\let\captionsbahasai\captionsmalay@indonesian -\let\datebahasai\datemalay@indonesian - -\DefineFormatHijriDate{bahasai}{% - \number\value{Hijriday}\space\hijrimonthmalay@indonesian{\value{Hijrimonth}}\space\number\value{Hijriyear}} +\xpg@load@master@language{malay} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasam.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasam.ldf index 59dce4f9036..5c9b02fe3c5 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasam.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-bahasam.ldf @@ -1,21 +1,8 @@ \ProvidesFile{gloss-bahasam.ldf}[polyglossia: module for bahasa melayu] -% We only provide this gloss for babel compatibility. Since bahasai is -% a malay variety, we use 'malay' with variant 'indonesian' now. +% We only provide this gloss for babel compatibility. Since bahasam is +% a malay variety, we use 'malay' with variant 'malaysian' now. -\input{gloss-malay.ldf} - -\PolyglossiaSetup{bahasam}{% - language=Malay, - langtag=MLY, - hyphennames={malay,melayu,bahasam,bahasa,bahasai,indonesian,indon}, - hyphenmins={2,2}, - fontsetup=true} - -\let\captionsbahasam\captionsmalay@malay -\let\datebahasam\datemalay@malay - -\DefineFormatHijriDate{bahasam}{% - \number\value{Hijriday}\space\hijrimonthmalay@malay{\value{Hijrimonth}}\space\number\value{Hijriyear}} +\xpg@load@master@language{malay} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-belarusian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-belarusian.ldf new file mode 100644 index 00000000000..c02dc9b3bc6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-belarusian.ldf @@ -0,0 +1,272 @@ +\ProvidesFile{gloss-belarusian.ldf}[polyglossia: module for belarusian] + +\RequirePackage{xpg-cyrillicnumbers} + +\PolyglossiaSetup{belarusian}{ + script=Cyrillic, + scripttag=cyrl, + langtag=BEL, + hyphennames={belarusian}, + hyphenmins={2,2}, + frenchspacing=true, + fontsetup, + localnumeral=belarusiannumerals, + Localnumeral=Belarusiannumerals +} + +\def\belarusian@spelling{modern} +\define@choicekey*+{belarusian}{spelling}[\val\nr]{modern,classic,tarask}[modern]{% + \ifcase\nr\relax + % modern: + \def\belarusian@spelling{modern} + \or + % classic: + \def\belarusian@spelling{tarask} + \or + % tarask: + \def\belarusian@spelling{tarask} + \fi +}{\xpg@warning{Unknown Belarusian spelling `#1'}} + +\newif\ifcyrillic@numerals +\define@key{belarusian}{numerals}[arabic]{% + \ifstrequal{#1}{cyrillic}% + {\cyrillic@numeralstrue}% + {\cyrillic@numeralsfalse}% +} + +\define@boolkey{belarusian}[belarusian@]{babelshorthands}[false]{} + +\setkeys{belarusian}{numerals} + +\ifsystem@babelshorthands + \setkeys{belarusian}{babelshorthands=true} +\else + \setkeys{belarusian}{babelshorthands=false} +\fi + +\ifcsundef{initiate@active@char}{% + \input{babelsh.def}% + \initiate@active@char{"}% + \shorthandoff{"}% +}{} + +\def\belarusian@shorthands{% + \bbl@activate{"}% + \def\language@group{belarusian}% + \declare@shorthand{belarusian}{"`}{„}% + \declare@shorthand{belarusian}{"'}{“}% + \declare@shorthand{belarusian}{"<}{«}% + \declare@shorthand{belarusian}{">}{»}% + \declare@shorthand{belarusian}{""}{\hskip\z@skip}% + \declare@shorthand{belarusian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}% + \declare@shorthand{belarusian}{"=}{\nobreak-\hskip\z@skip}% + \declare@shorthand{belarusian}{"|}{\textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}% + \declare@shorthand{belarusian}{"-}{% + \def\belarusian@sh@tmp{% + \if\belarusian@sh@next-\expandafter\belarusian@sh@emdash% + \else\expandafter\belarusian@sh@hyphen\fi% + }% + \futurelet\belarusian@sh@next\belarusian@sh@tmp% + }% + \def\belarusian@sh@hyphen{% + \nobreak\-\bbl@allowhyphens}% + \def\belarusian@sh@emdash##1##2{\cdash-##1##2}% + \def\cdash##1##2##3{\def\tempx@{##3}% + \def\tempa@{-}\def\tempb@{~}\def\tempc@{*}% + \ifx\tempx@\tempa@\@Acdash\else + \ifx\tempx@\tempb@\@Bcdash\else + \ifx\tempx@\tempc@\@Ccdash\else + \errmessage{Wrong usage of cdash}\fi\fi\fi}% + \def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi + \cyrdash\hskip.2em\ignorespaces}% + \def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi + \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces}% + \def\@Ccdash{\leavevmode + \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}% + \ifx\cyrdash\undefined + \def\cyrdash{\hbox to.8em{--\hss--}}% + \fi + \declare@shorthand{belarusian}{",}{\nobreak\hskip.2em\ignorespaces}% +} + +\def\nobelarusian@shorthands{% + \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}% +} + +% Taken from babel-belarusian +\def\captionsbelarusian@modern{% + \def\prefacename{Прадмова}% + \def\refname{Спіс літаратуры}% + \def\abstractname{Анатацыя}% + \def\bibname{Літаратура}% + \def\chaptername{Глава}% + \def\appendixname{Дадатак}% + \def\contentsname{Змест}% + \def\listfigurename{Спіс ілюстрацый}% + \def\listtablename{Спіс табліц}% + \def\indexname{Прадметны паказальнік}% + \def\authorname{Паказальнік імён}% + \def\figurename{Рыс.}% + \def\tablename{Табліца}% + \def\partname{Частка}% + \def\enclname{укл.}% + \def\ccname{зых.}% + \def\headtoname{вх.}% + \def\pagename{с.}% + \def\seename{гл.}% + \def\alsoname{гл.\ таксама}% + \def\proofname{Доказ}% + \def\glossaryname{Слоўнік тэрмінаў}% + \def\acronymname{Абрэвіятуры}% + \def\lstlistingname{Лістынг}% + \def\lstlistlistingname{Лістынгі}% + \def\notesname{Нататкі}% +} + +\def\captionsbelarusian@tarask{% + \def\prefacename{Прадмова}% + \def\refname{Сьпіс літаратуры}% + \def\abstractname{Анатацыя}% + \def\bibname{Літаратура}% + \def\chaptername{Глава}% + \def\appendixname{Дадатак}% + \def\contentsname{Зьмест}% + \let\tocname=\contentsname + \def\listfigurename{Сьпіс ілюстрацый}% + \def\listtablename{Сьпіс табліц}% + \def\indexname{Прадметны паказальнік}% + \def\authorname{Паказальнік імён}% + \def\figurename{Рыс.}% + \def\tablename{Табліца}% + \def\partname{Частка}% + \def\enclname{укл.}% + \def\ccname{зых.}% + \def\headtoname{вх.}% + \def\pagename{с.}% + \def\seename{гл.}% + \def\alsoname{гл.\ таксама}% + \def\proofname{Доказ}% + \def\glossaryname{Слоўнік тэрмінаў}% + \def\acronymname{Абрэвіятуры}% + \def\lstlistingname{Лістынг}% + \def\lstlistlistingname{Лістынгі}% + \def\nomname{Азначэньні}% + \def\notesname{Нататкі}% +} + +\def\captionsbelarusian{% + \csuse{captionsbelarusian@\belarusian@spelling}% +} + +\def\datebelarusian@modern{% + \def\today{\number\day~\ifcase\month\or + студзеня\or + лютага\or + сакавіка\or + красавіка\or + мая\or + чэрвеня\or + ліпеня\or + жніўня\or + верасня\or + кастрычніка\or + лістапада\or + снежня\fi + \space \number\year~г.}% +} + +\def\datebelarusian@tarask{% + \def\today{\number\day~\ifcase\month\or% + студзеня\or + лютага\or + сакавіка\or + красавіка\or + траўня\or + чэрвеня\or + ліпеня\or + жніўня\or + верасьня\or + кастрычніка\or + лістапада\or + сьнежня\fi% + \space \number\year~г.}% +} + +\def\datebelarusian{% + \csuse{datebelarusian@\belarusian@spelling}% +} + +\newcommand{\belarusiannumerals}[2]{\belarusiannumber{#2}} +\newcommand{\Belarusiannumerals}[2]{\Belarusiannumber{#2}} + +\def\belarusiannumber#1{% + \ifcyrillic@numerals + \cyr@alph{#1}% + \else + \number#1% + \fi% +} + +\def\Belarusiannumber#1{% + \ifcyrillic@numerals + \cyr@Alph{#1}% + \else + \number#1% + \fi% +} + +\let\belarusiannumeral=\belarusiannumber +\let\Belarusiannumeral=\Belarusiannumber + +\def\Asbuk#1{\expandafter\cyr@Alph\csname c@#1\endcsname} + +\def\asbuk#1{\expandafter\cyr@alph\csname c@#1\endcsname} + +% This is a poor man's cyrillic alphanumeric. It just uses the alphabet and +% thus ends at 30. We now use proper cyrillic numbering. + +%\def\belarusian@Alph#1{\ifcase#1\or +% А\or Б\or В\or Г\or Д\or Е\or Ж\or +% З\or И\or К\or Л\or М\or Н\or О\or +% П\or Р\or С\or Т\or У\or Ф\or Х\or +% Ц\or Ч\or Ш\or Щ\or Э\or Ю\or Я\else\xpg@ill@value{#1}{belarusian@Alph}\fi} + +%\def\belarusian@alph#1{\ifcase#1\or +% а\or б\or в\or г\or д\or е\or ж\or +% з\or и\or к\or л\or м\or н\or о\or +% п\or р\or с\or т\or у\or ф\or х\or +% ц\or ч\or ш\or щ\or э\or ю\or я\else\xpg@ill@value{#1}{belarusian@alph}\fi} + +\def\belarusian@numbers{% + \let\latin@alph\@alph + \let\latin@Alph\@Alph + \ifcyrillic@numerals% + \def\belarusian@alph##1{\expandafter\belarusiannumeral\expandafter{\the##1}}% + \def\belarusian@Alph##1{\expandafter\belarusiannumeral\expandafter{\the##1}}% + \let\@alph\belarusian@alph% + \let\@Alph\belarusian@Alph% + \fi +} + +\def\nobelarusian@numbers{% + \let\@alph\latin@alph% + \let\@Alph\latin@Alph% +} + +\def\noextras@belarusian{% + \ifcyrillic@numerals\nobelarusian@numbers\fi% + \nobelarusian@shorthands% +} + +\def\blockextras@belarusian{% + \ifcyrillic@numerals\belarusian@numbers\fi% + \ifbelarusian@babelshorthands\belarusian@shorthands\fi% +} + +\def\inlineextras@belarusian{% + \ifbelarusian@babelshorthands\belarusian@shorthands\fi% +} + +\endinput + diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-bosnian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-bosnian.ldf new file mode 100644 index 00000000000..187bb3e65f9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-bosnian.ldf @@ -0,0 +1,46 @@ +\ProvidesFile{gloss-bosnian.ldf}[polyglossia: module for bosnian] + +\PolyglossiaSetup{bosnian}{ + langtag=BOS, + hyphennames={bosnian,croatian}, + hyphenmins={2,2}, % adapted from gloss-croatian + frenchspacing=true, % adapted from gloss-croatian + indentfirst=false, % adapted from gloss-croatian + fontsetup=true +} + +% TODO: Add script=Cyrillic + +% from babel-bosnian +\def\captionsbosnian{% + \def\prefacename{Predgovor}% + \def\refname{Literatura}% + \def\abstractname{Sažetak}% + \def\bibname{Bibliografija}% + \def\chaptername{Poglavlje}% + \def\appendixname{Dodatak}% + \def\contentsname{Sadržaj}% + \def\listfigurename{Popis slika}% + \def\listtablename{Popis tablica}% + \def\indexname{Indeks}% + \def\figurename{Slika}% + \def\tablename{Tablica}% + \def\partname{Dio}% + \def\enclname{Prilozi}% + \def\ccname{Kopija}% + \def\headtoname{Prima}% + \def\pagename{Stranica}% + \def\seename{Vidjeti}% + \def\alsoname{Također vidjeti}% + \def\proofname{Dokaz}% + \def\glossaryname{Rječnik}% +} + +\def\datebosnian{% + \def\today{\number\day.~\ifcase\month\or + januar\or februar\or mart\or april\or maj\or + juni\or juli\or august\or septembar\or oktobar\or novembar\or + decembar\fi \space \number\year.~}% +} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-brazil.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-brazil.ldf index 9a703e79e08..257a75e334b 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-brazil.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-brazil.ldf @@ -4,22 +4,6 @@ % 'brazil' was selected in accordance with babel. % Since brazil is a variety of portuguese, we use 'portuguese' now. -% FIXME: Once we support babel aliases (#112) this gloss can go. +\xpg@load@master@language{portuguese} -\xpg@warning{The language name 'brazil' is deprectated.\MessageBreak - Please use 'portuguese' with variant 'brazilian' instead.} - -\input{gloss-portuguese.ldf} - -\PolyglossiaSetup{brazil}{ - language=Brazilian Portuguese, - langtag=PTG, - hyphennames={brazil,portuguese,portuges}, - hyphenmins={2,3}, - fontsetup=true, -} - -\let\captionsportuges\captionsportuguese@brazil -\let\dateportuges\dateportuguese@brazil - \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-british.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-british.ldf new file mode 100644 index 00000000000..e598d02edcf --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-british.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-acadien.ldf}[polyglossia: module for british english] + +% We provide this as a babel alias + +\xpg@load@master@language{english} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-canadian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-canadian.ldf new file mode 100644 index 00000000000..6a0b7ab5232 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-canadian.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-canadian.ldf}[polyglossia: module for canadian english] + +% We provide this as a babel alias + +\xpg@load@master@language{english} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-canadien.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-canadien.ldf new file mode 100644 index 00000000000..02f9e44a888 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-canadien.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-acadien.ldf}[polyglossia: module for canadian french] + +% We provide this as a babel alias + +\xpg@load@master@language{french} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf index c4ccb5f869f..1205da7870b 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf @@ -8,12 +8,18 @@ fontsetup=true, } +\ifluatex + \RequirePackage{luavlna} +\fi + \define@boolkey{czech}[czech@]{babelshorthands}[true]{} \define@boolkey{czech}[czech@]{splithyphens}[true]{} \define@boolkey{czech}[czech@]{vlna}[true]{} +\setkeys{czech}{splithyphens,vlna} + \ifsystem@babelshorthands \setkeys{czech}{babelshorthands=true} \else @@ -71,8 +77,7 @@ \def\czech@hyphens{% \ifluatex - \xpg@warning{The 'splithyphens' option only works for XeLaTeX.\MessageBreak - Please use the luavlna package to enable the feature for LuaLaTeX} + \AfterPreamble{\enablesplithyphens{czech}}% \else \XeTeXinterchartokenstate=1 \XeTeXcharclass `\- \czech@hyphen @@ -83,7 +88,9 @@ } \def\noczech@hyphens{% - \ifxetex + \ifluatex + \AfterPreamble{\disablesplithyphens{czech}}% + \else \XeTeXcharclass `\- \z@ \fi% } @@ -92,8 +99,7 @@ % prevent them to land at the end of a line \def\czech@vlna{% \ifluatex - \xpg@warning{The 'vlna' option only works for XeLaTeX.\MessageBreak - Please use the luavlna package to enable the feature for LuaLaTeX} + \preventsingleon \else % Code taken and adapted from xevlna.sty \XeTeXinterchartokenstate=1 @@ -137,6 +143,7 @@ \def\noczech@vlna{% \ifluatex + \preventsingleoff \else \XeTeXcharclass`\(\z@ \XeTeXcharclass`\[\z@ @@ -204,14 +211,14 @@ \def\blockextras@czech{% \ifczech@babelshorthands\czech@shorthands\fi% - \ifczech@vlna\czech@vlna\fi% - \ifczech@splithyphens\czech@hyphens\fi% + \ifczech@vlna\czech@vlna\else\noczech@vlna\fi% + \ifczech@splithyphens\czech@hyphens\else\noczech@hyhens\fi% } \def\inlineextras@czech{% \ifczech@babelshorthands\czech@shorthands\fi% - \ifczech@vlna\czech@vlna\fi% - \ifczech@splithyphens\czech@hyphens\fi% + \ifczech@vlna\czech@vlna\else\noczech@vlna\fi% + \ifczech@splithyphens\czech@hyphens\else\noczech@hyhens\fi% } \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf index f94a684af92..5bbefc5dc85 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf @@ -61,11 +61,15 @@ \def\alsoname{zie ook}% \def\proofname{Bewijs}% \def\glossaryname{Verklarende woordenlijst}% +} + +\def\datedutch{% \def\today{\number\day~\ifcase\month% \or januari\or februari\or maart\or april\or mei\or juni\or juli\or augustus\or september\or oktober\or november\or december\fi - \space \number\year}} + \space \number\year}% +} \def\noextras@dutch{% \nodutch@shorthands% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf index 9c666b15c49..626209d8800 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf @@ -1,4 +1,5 @@ \ProvidesFile{gloss-english.ldf}[polyglossia: module for english] + \PolyglossiaSetup{english}{ hyphennames={english,american,usenglish,USenglish}, hyphenmins={2,3}, @@ -6,6 +7,13 @@ fontsetup=true, } +% Babel aliases +\setlanguagealias[variant=us]{english}{american} +\setlanguagealias[variant=australian]{english}{australian} +\setlanguagealias[variant=british]{english}{british} +\setlanguagealias[variant=canadian]{english}{canadian} +\setlanguagealias[variant=newzealand]{english}{newzealand} + \providebool{british@hyphen} \providebool{english@ordinalmonthday} \providebool{british@dateformat} diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-farsi.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-farsi.ldf index 0c65b37574f..03ed820f11c 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-farsi.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-farsi.ldf @@ -3,40 +3,6 @@ % We only provide this gloss for babel compatibility. % The proper English language name is Persian. -\input{gloss-persian.ldf} - -\PolyglossiaSetup{farsi}{ - script=Arabic, - direction=RL, - scripttag=arab, - langtag=FAR, - hyphennames={nohyphenation}, - fontsetup=true, - localnumeral=farsinumerals -} - -\define@key{farsi}{numerals}[eastern]{% - \setkeys{persian}{numerals=#1}} - -\define@key{farsi}{abjadjimnotail}[true]{% - \setkeys{persian}{abjadjimnotail=#1}} - -\define@key{farsi}{locale}[default]{% - \setkeys{persian}{locale=#1}} - -\setkeys{farsi}{locale,numerals} - -%\Hijritoday is now locale-aware and will format the date with this macro: -\DefineFormatHijriDate{farsi}{\@ensure@RTL{% - \farsinumber{\value{Hijriday}}\space\HijriMonthArabic{\value{Hijrimonth}}\space\farsinumber{\value{Hijriyear}}}} - -\let\captionsfarsi\captionspersian -\let\datefarsi\datepersian -\let\farsi@numbers\persian@numbers -\let\nofarsi@numbers\nopersian@numbers -\let\farsi@globalnumbers\persian@globalnumbers -\let\nofarsi@globalnumbers\nopersian@globalnumbers -\let\blockextras@farsi\blockextras@persian -\let\noextras@farsi\noextras@persian +\xpg@load@master@language{persian} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf index 8cb0731d2df..57ec25f48e5 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-french.ldf @@ -10,6 +10,10 @@ hyphenmins={2,2}, fontsetup=true} +% Babel aliases +\setlanguagealias[variant=acadian]{french}{acadien} +\setlanguagealias[variant=canadian]{french}{canadien} + \def\french@variant{french} \define@choicekey*+{french}{variant}[\val\nr]{french,canadian,acadian}[french]{% \ifcase\nr\relax @@ -20,17 +24,17 @@ \def\french@variant{canadien}% \SetLanguageKeys{french}{babelname=canadien}% \xpg@ifdefined{canadien}{}% - {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak - I will use the standard patterns for French instead}% - \adddialect\l@canadien\l@french\relax}% + {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak + I will use the standard patterns for French instead}% + \adddialect\l@canadien\l@french\relax}% \or % acadian: \def\french@variant{acadian}% \SetLanguageKeys{french}{babelname=canadien}% \xpg@ifdefined{acadian}{}% - {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak - I will use the standard patterns for French instead}% - \adddialect\l@acadian\l@french\relax}% + {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak + I will use the standard patterns for French instead}% + \adddialect\l@acadian\l@french\relax}% \fi \xpg@info{Option: French, variant=\val}% }{\xpg@warning{Unknown French variant `#1'}} @@ -41,8 +45,7 @@ }% \ifluatex - \newluatexattribute\xpg@frpt % - \directlua{polyglossia.load_frpt()}% + \directlua{require('polyglossia-french')}% \else \newXeTeXintercharclass\french@openbrackets % ( ] { \newXeTeXintercharclass\french@closebrackets % ( ] { @@ -83,6 +86,10 @@ \define@boolkey{french}[french@]{autospaceguillemets}[true]{} \french@autospaceguillemetstrue +\newif\iffrench@thincolonspace +\define@boolkey{french}[french@]{thincolonspace}[true]{} +\french@thincolonspacefalse + % Backwards compatibility \define@boolkey{french}[french@]{automaticspacesaroundguillemets}[true]{% \iffrench@automaticspacesaroundguillemets @@ -109,6 +116,51 @@ \fi } +% Configuration of item labels +\def\french@itemi{\textemdash} +\def\french@itemii{\textemdash} +\def\french@itemiii{\textemdash} +\def\french@itemiv{\textemdash} + +\define@key{french}{itemlabels}[\textemdash]{% + \def\french@itemi{#1} + \def\french@itemii{#1} + \def\french@itemiii{#1} + \def\french@itemiv{#1} +} + +\define@key{french}{itemlabeli}[\textemdash]{% + \def\french@itemi{#1} +} + +\define@key{french}{itemlabelii}[\textemdash]{% + \def\french@itemii{#1} +} + +\define@key{french}{itemlabeliii}[\textemdash]{% + \def\french@itemiii{#1} +} + +\define@key{french}{itemlabeliv}[\textemdash]{% + \def\french@itemiv{#1} +} + +\define@boolkey{french}[french@]{frenchitemlabels}[true]{% + \AfterPreamble{% + \ifdefstring{\xpg@main@language}{french}{% + \iffrench@frenchitemlabels + \renewcommand{\labelitemi}{\french@itemi}% + \renewcommand{\labelitemii}{\french@itemii}% + \renewcommand{\labelitemiii}{\french@itemiii}% + \renewcommand{\labelitemiv}{\french@itemiv}% + \else + \let\@makefntext\xpg@orig@makefntext + \fi + }{\xpg@warning{Option 'frenchitemlabels' only supported if French is main language!}}% + }% +} + + \def\french@fontsetup{% \unless\iffrench@autospacetypewriter \let\ttfamily\french@ttfamilyFB @@ -120,11 +172,24 @@ \let\ttfamily\french@ttfamilyORI } +\def\xpg@french@thinsp{\kern 0.5\fontdimen2\font} + \def\french@punctuation{% \lccode"2019="2019 \ifluatex - \xpg@frpt=1\relax % - \directlua{polyglossia.activate_frpt()}% + \iffrench@thincolonspace + \iffrench@autospaceguillemets + \directlua{polyglossia.activate_french_punct(true, true)}% + \else + \directlua{polyglossia.activate_french_punct(true, false)}% + \fi + \else + \iffrench@autospaceguillemets + \directlua{polyglossia.activate_french_punct(false, true)}% + \else + \directlua{polyglossia.activate_french_punct(false, false)}% + \fi + \fi \else \XeTeXinterchartokenstate=1 \XeTeXcharclass `\! \french@punctthin @@ -134,50 +199,53 @@ \XeTeXcharclass `\⁈ \french@punctthin \XeTeXcharclass `\⁉ \french@punctthin \XeTeXcharclass `\; \french@punctthin - \XeTeXcharclass `\: \french@punctthick + \iffrench@thincolonspace + \XeTeXcharclass `\: \french@punctthin + \else + \XeTeXcharclass `\: \french@punctthick + \fi \XeTeXcharclass `\« \french@punctguillstart \XeTeXcharclass `\» \french@punctguillend \XeTeXcharclass `\‹ \french@punctguillstart \XeTeXcharclass `\› \french@punctguillend \XeTeXcharclass `\( \french@openbrackets \XeTeXcharclass `\) \french@closebrackets - \XeTeXcharclass `\] \french@openbrackets - \XeTeXcharclass `\[ \french@closebrackets + \XeTeXcharclass `\[ \french@openbrackets + \XeTeXcharclass `\] \french@closebrackets \XeTeXcharclass `\{ \french@openbrackets \XeTeXcharclass `\} \french@closebrackets - \XeTeXinterchartoks \z@ \french@punctthin = {\thinspace}% + \XeTeXcharclass `\⟨ \french@openbrackets + \XeTeXcharclass `\⟩ \french@closebrackets + \XeTeXinterchartoks \z@ \french@punctthin = {\xpg@french@thinsp}% \XeTeXinterchartoks \z@ \french@punctthick = {\nobreakspace}% - \XeTeXinterchartoks \xpg@boundaryclass \french@punctthin = {\xpg@unskip\thinspace}% + \XeTeXinterchartoks \xpg@boundaryclass \french@punctthin = {\xpg@unskip\xpg@french@thinsp}% \XeTeXinterchartoks \xpg@boundaryclass \french@punctthick = {\xpg@unskip\nobreakspace}% \iffrench@autospaceguillemets - \XeTeXinterchartoks \french@punctguillstart \z@ = {\thinspace}% "«a" -> "«\,a" - % \XeTeXinterchartoks \z@ \french@punctguillstart = {\nobreakspace}% "a«" unchanged? - % \XeTeXinterchartoks \french@punctguillend \z@ = {\nobreakspace}% "»a" unchanged? - \XeTeXinterchartoks \z@ \french@punctguillend = {\thinspace}% "a»" -> "a\,»" - \XeTeXinterchartoks \french@punctguillstart \xpg@boundaryclass = {\thinspace\ignorespaces}% "« " -> "«\," - \XeTeXinterchartoks \xpg@boundaryclass \french@punctguillend = {\xpg@unskip\thinspace}% " »" -> "\,»" + \let\xpg@french@guillspace\xpg@french@thinsp% + \XeTeXinterchartoks \french@punctguillstart \z@ = {\xpg@french@guillspace}% "«a" -> "«\,a" + % \XeTeXinterchartoks \z@ \french@punctguillstart = {\nobreakspace}% "a«" unchanged? + % \XeTeXinterchartoks \french@punctguillend \z@ = {\nobreakspace}% "»a" unchanged? + \XeTeXinterchartoks \z@ \french@punctguillend = {\xpg@french@guillspace}% "a»" -> "a\,»" + \XeTeXinterchartoks \french@punctguillstart \xpg@boundaryclass = {\xpg@french@guillspace\ignorespaces}% "« " -> "«\," + \XeTeXinterchartoks \xpg@boundaryclass \french@punctguillend = {\xpg@unskip\xpg@french@guillspace}% " »" -> "\,»" + \XeTeXinterchartoks \french@closebrackets \french@punctguillend = {\xpg@french@guillspace}% ")»" -> ")\,»" + \else + \def\xpg@french@guillspace{}% \fi - \XeTeXinterchartoks \french@punctguillend \french@punctthin = {\thinspace}% "»;" -> "»\,;" + \XeTeXinterchartoks \french@punctguillend \french@punctthin = {\xpg@french@thinsp}% "»;" -> "»\,;" \XeTeXinterchartoks \french@punctguillend \french@punctthick = {\nobreakspace}% "»:" -> "» :" - \XeTeXinterchartoks \french@punctthin \french@punctguillend = {\thinspace}% "?»" -> "?\,»" + \XeTeXinterchartoks \french@punctthin \french@punctguillend = {\xpg@french@thinsp}% "?»" -> "?\,»" \XeTeXinterchartoks \french@openbrackets \french@punctthin = {\xpg@unskip}% "(?" -> "(?" and not "( ?" \XeTeXinterchartoks \french@punctthin \french@closebrackets = {\xpg@unskip}% "?)" -> "?)" (code not need, just for symetry with previous one) - \XeTeXinterchartoks \french@closebrackets \french@punctthin = {\thinspace}% ")?" -> ")\,?" + \XeTeXinterchartoks \french@closebrackets \french@punctthin = {\xpg@french@thinsp}% ")?" -> ")\,?" \XeTeXinterchartoks \french@closebrackets \french@punctthick = {\nobreakspace}% "):" -> ") :" \fi - } +} \def\nofrench@punctuation{% \lccode"2019=\z@ \ifluatex - \xpg@frpt=0\relax % - % Though it would make compilation slightly faster, it is not possible to - % safely uncomment the following line. Imagine the following case: you start - % a paragraph by some french text, then, in the same paragraph, you change - % the language to something else, and thus call the following line. This means - % that, at then end of the paragraph, the function won't be in the callback, - % so the beginning of the paragraph won't be processed by it. - %\directlua{polyglossia.desactivate_frpt()} + \directlua{polyglossia.deactivate_french_punct()}% \else \XeTeXcharclass `\! \z@ \XeTeXcharclass `\? \z@ @@ -191,9 +259,17 @@ \XeTeXcharclass `\» \z@ \XeTeXcharclass `\‹ \z@ \XeTeXcharclass `\› \z@ + \XeTeXcharclass `\( \z@ + \XeTeXcharclass `\) \z@ + \XeTeXcharclass `\[ \z@ + \XeTeXcharclass `\] \z@ + \XeTeXcharclass `\{ \z@ + \XeTeXcharclass `\} \z@ + \XeTeXcharclass `\⟨ \z@ + \XeTeXcharclass `\⟩ \z@ \XeTeXinterchartokenstate=0 \fi - } +} \def\captionsfrench{% \def\refname{Références}% @@ -223,7 +299,7 @@ \def\ccname{Copie à }% \def\headtoname{}% \def\proofname{Démonstration}% - } +} \def\datefrench{% \def\today{\ifx\ier\undefined\def\ier{er}\fi diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-friulan.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-friulan.ldf index b395c7d4a27..a4a3c2a770d 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-friulan.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-friulan.ldf @@ -2,21 +2,7 @@ % We only provide this gloss for babel compatibility. -\input{gloss-friulian.ldf} +\xpg@load@master@language{friulian} -\PolyglossiaSetup{friulan}{% - language=Friulian, - hyphennames={friulan,furlan}, - hyphenmins={2,2}, - langtag=FRL, - indentfirst=false, - fontsetup=true, - frenchspacing=true, -} - -\let\captionsfriulan\captionsfriulian -\let\datefriulan\datefriulian -\let\noextras@friulan\noextras@friulian -\let\blockextras@friulan\blockextras@friulian -\let\inlineextras@friulan\inlineextras@friulian +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-friulian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-friulian.ldf index 87e3705ba56..8cabe99e69c 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-friulian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-friulian.ldf @@ -11,6 +11,9 @@ frenchspacing=true, } +% Babel and backwards compat. alias +\setlanguagealias{friulian}{friulan} + \def\captionsfriulian{% \def\prefacename{Prefazion}% \def\refname{Riferiments}% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-gaelic.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-gaelic.ldf index 327ce8526d2..91666261c57 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-gaelic.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-gaelic.ldf @@ -9,6 +9,10 @@ fontsetup=true, } +% Babel aliases +\setlanguagealias[variant=irish]{gaelic}{irish} +\setlanguagealias[variant=scottish]{gaelic}{scottish} + \def\gaelic@variant{irish} \define@choicekey*+{gaelic}{variant}[\val\nr]{irish,scottish}[irish]{% \ifcase\nr\relax diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-georgian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-georgian.ldf new file mode 100644 index 00000000000..8d53e228a05 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-georgian.ldf @@ -0,0 +1,225 @@ +\ProvidesFile{gloss-georgian.ldf}[polyglossia: module for georgian] + +\PolyglossiaSetup{georgian}{ + script=Georgian, + scripttag=geor, + langtag=KAT, + hyphennames={georgian}, + fontsetup=true, + localnumeral=georgiannumerals +} + +\newif\ifgeorgian@numerals +\define@key{georgian}{numerals}[arabic]{% + \ifstrequal{#1}{georgian}% + {\georgian@numeralstrue}% + {\georgian@numeralsfalse}% +} + +\define@boolkey{georgian}[georgian@]{babelshorthands}[true]{} + +\define@boolkey{georgian}[georgian@]{oldmonthnames}[true]{} + +\ifsystem@babelshorthands + \setkeys{georgian}{babelshorthands=true} +\else + \setkeys{georgian}{babelshorthands=false} +\fi + +\ifcsundef{initiate@active@char}{% + \input{babelsh.def}% + \initiate@active@char{"}% + \shorthandoff{"}% +}{} + +\def\georgian@shorthands{% + \bbl@activate{"}% + \def\language@group{georgian}% + \declare@shorthand{georgian}{"`}{„}% + \declare@shorthand{georgian}{"'}{“}% + \declare@shorthand{georgian}{"<}{«}% + \declare@shorthand{georgian}{">}{»}% + \declare@shorthand{georgian}{""}{\hskip\z@skip}% + \declare@shorthand{georgian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}% + \declare@shorthand{georgian}{"=}{\nobreak-\hskip\z@skip}% + \declare@shorthand{georgian}{"|}{\textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}% + \declare@shorthand{georgian}{"-}{% + \def\georgian@sh@tmp{% + \if\georgian@sh@next-\expandafter\georgian@sh@emdash% + \else\expandafter\georgian@sh@hyphen\fi% + }% + \futurelet\georgian@sh@next\georgian@sh@tmp}% + \def\georgian@sh@hyphen{% + \nobreak\-\bbl@allowhyphens}% + \def\georgian@sh@emdash##1##2{\cdash-##1##2}% + \def\cdash##1##2##3{\def\tempx@{##3}% + \def\tempa@{-}\def\tempb@{~}\def\tempc@{*}% + \ifx\tempx@\tempa@\@Acdash\else + \ifx\tempx@\tempb@\@Bcdash\else + \ifx\tempx@\tempc@\@Ccdash\else + \errmessage{Wrong usage of cdash}\fi\fi\fi}% + \def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi + \cyrdash\hskip.2em\ignorespaces}% + \def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi + \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces}% + \def\@Ccdash{\leavevmode + \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}% + \ifx\cyrdash\undefined + \def\cyrdash{\hbox to.8em{--\hss--}}% + \fi + \declare@shorthand{georgian}{",}{\nobreak\hskip.2em\ignorespaces}% +} + +\def\nogeorgian@shorthands{% + \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}% +} + +\def\captionsgeorgian{% + \def\prefacename{წინასიტყვაობა}% + \def\refname{ლიტერატურა}% + \def\abstractname{ანოტაცია}% + \def\bibname{ლიტერატურა}% + \def\chaptername{თავი}% + \def\appendixname{დანართი}% + \@ifundefined{thechapter} + {\def\contentsname{შინაარსი}}% + {\def\contentsname{შინაარსი}}% + \let\tocname=\contentsname + \def\listfigurename{სურათი}% + \def\listtablename{ცხრილი}% + \def\indexname{საძიებელი}% + \def\authorname{სახელთა საძიებელი}% + \def\figurename{სურ.}% + \def\tablename{ცხრ.}% + \def\partname{ნაწილი}% + \def\enclname{ჩათვ.}% + \def\ccname{წყარ.}% + \def\headtoname{შ.}% + \def\pagename{გვ.}% + \def\seename{იხ.}% + \def\alsoname{იხ.\ ასევე}% + \def\proofname{დამტკიცება}% + \def\glossaryname{ტერმინები}% +}% + +\def\dategeorgian{% + \def\today{\number\day~\ifcase\month\or + იანვარი\or + თებერვალი\or + მარტი\or + აპრილი\or + მაისი\or + ივნისი\or + ივლისი\or + აგვისტო\or + სექტემბერი\or + ოქტომბერი\or + ნოემბერი\or + დეკემბერი\fi + \space \number\year~წ.}% + \ifgeorgian@oldmonthnames + \dategeorgian@old% + \fi +} + +\def\dategeorgian@old{% + \def\today{\number\day~\ifcase\month\or + აპნისი\or + სურწყუნისი\or + მირკანი\or + იგრიკა\or + ვარდობისთვე\or + თიბათვე\or + მკათათვე\or + მარიამობისთვე\or + ახალწლისა ენკენისთვე\or + ღვინობისთვე\or + გიორგობისთვე\or + ქრისტეშობისთვე\fi + \space \number\year~წ.}% +} + +\def\georgian@numbers{% + \ifgeorgian@numerals% + \def\georgian@alph##1{\expandafter\georgiannumeral\expandafter{\the##1}}% + \let\@alph\georgian@@alph% + \fi +} + +\def\nogeorgian@numbers{% + \let\@alph\latin@alph% + \let\georgian@alph\@undefined% +} + +\def\georgian@globalnumbers{% + \ifgeorgian@numerals + \let\@arabic\georgiannumber% + \renewcommand\thefootnote{\localnumeral*{footnote}}% + \renewcommand\theequation{\localnumeral*{equation}}% + \fi +} + +% Store original definition +\let\xpg@save@arabic\@arabic + +\def\nogeorgian@globalnumbers{ + \let\@arabic\xpg@save@arabic% +} + +\newcommand{\georgiannumerals}[2]{% + \ifgeorgian@numerals + \georgiannumber{#2}% + \else + #2% + \fi% +} + +\protected\def\georgiannumber#1{\expandafter\@georgiannumber\expandafter{\number#1}} +\def\@georgiannumber#1{% + \ifnum#1<\@ne\space\geor@ill@value{#1}% + \else + \ifnum#1<10\expandafter\geor@num@i\number#1% + \else + \ifnum#1<100\expandafter\geor@num@ii\number#1% + \else + \ifnum#1<\@m\expandafter\geor@num@iii\number#1% + \else + \ifnum#1<\@M\expandafter\geor@num@iv\number#1% + \else + \space\geor@ill@value{#1}% + \fi + \fi + \fi + \fi + \fi +} + +\let\georgiannumeral=\georgiannumber +\def\geor@num@i#1{% 1--9 + \ifcase#1\or ა\or ბ\or გ\or დ\or ე\or ვ\or ზ\or ჱ\or თ\fi} +\def\geor@num@ii#1{% 10--90 + \ifcase#1\or ი\or კ\or ლ\or მ\or ნ\or ჲ\or ო\or პ\or ჟ\fi + \geor@num@i} +\def\geor@num@iii#1{% 100--900 + \ifcase#1\or რ\or ს\or ტ\or ჳ\or ფ\or ქ\or ღ\or ყ\or შ\fi + \geor@num@ii} +\def\geor@num@iv#1{% 1000--9000 + \ifcase#1\or ჩ\or ც\or ძ\or წ\or ჭ\or ხ\or ჴ\or ჯ\or ჰ\fi + \geor@num@iii} +\def\geor@ill@value#1{\xpg@warning{Illegal value (#1) for Georgian numeral}[$#1$]} + +\def\noextras@georgian{% + \ifgeorgian@numerals\nogeorgian@numbers\fi% + \nogeorgian@shorthands% +} + +\def\blockextras@georgian{% + \ifgeorgian@numerals\georgian@numbers\fi% + \ifgeorgian@babelshorthands\georgian@shorthands\fi% +} + +\def\inlineextras@georgian{% + \ifgeorgian@babelshorthands\georgian@shorthands\fi% +} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-german.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-german.ldf index bf4a690060e..3c66f6f8367 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-german.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-german.ldf @@ -1,4 +1,5 @@ \ProvidesFile{gloss-german.ldf}[polyglossia: module for german] + \PolyglossiaSetup{german}{ hyphenmins={2,2}, frenchspacing=true, @@ -7,6 +8,14 @@ babelname=ngerman } +% Babel aliases +\setlanguagealias[variant=austrian,spelling=old]{german}{austrian} +\setlanguagealias[variant=austrian,spelling=new]{german}{naustrian} +\setlanguagealias[variant=german,spelling=old]{german}{germanb} +\setlanguagealias[variant=german,spelling=new]{german}{ngerman} +\setlanguagealias[variant=swiss,spelling=old]{german}{swissgerman} +\setlanguagealias[variant=swiss,spelling=new]{german}{nswissgerman} + \newif\if@german@oldspelling \@german@oldspellingfalse \define@choicekey*+{german}{spelling}[\val\nr]{new,old,1901}[new]{% @@ -65,21 +74,26 @@ \else \if@swiss@locale \SetLanguageKeys{german}{babelname=nswissgerman}% - \fi + \else \if@austrian@locale \SetLanguageKeys{german}{babelname=naustrian}% - \fi + \else + \SetLanguageKeys{german}{babelname=ngerman}% + \fi\fi \fi } -\newif\if@german@fraktur -\define@choicekey*+{german}{script}[\val\nr]{latin,fraktur}[latin]{% +\newif\if@german@blackletter +\define@choicekey*+{german}{script}[\val\nr]{latin,blackletter,fraktur}[latin]{% \ifcase\nr\relax % latin: - \@german@frakturfalse% + \@german@blackletterfalse% + \or + % blackletter: + \@german@blacklettertrue% \or % fraktur: - \@german@frakturtrue% + \@german@blacklettertrue% \fi \xpg@info{Option: German, script=\val}% }{\xpg@warning{Unknown German script `#1'}} @@ -187,7 +201,7 @@ } %%Strings for Fraktur contributed by Gerrit <z0idberg . gmx . de> -\def\captions@german@fraktur{% +\def\captions@german@blackletter{% \captions@german% \def\abstractname{Zuſammenfaſſung}% \def\seename{ſiehe}% @@ -195,7 +209,7 @@ \def\glossaryname{Gloſſar}% } -\def\date@german@fraktur{% +\def\date@german@blackletter{% \def\today{\number\day.% \space \ifcase\month% \or\if@austrian@locale Jänner\else Januar\fi\or Februar\or März\or% @@ -205,13 +219,13 @@ } \def\captionsgerman{% - \if@german@fraktur\captions@german@fraktur\else\captions@german\fi + \if@german@blackletter\captions@german@blackletter\else\captions@german\fi \if@austrian@locale\captions@german@austrian\fi \if@swiss@locale\captions@german@swiss\fi } \def\dategerman{% - \if@german@fraktur\date@german@fraktur\else\date@german\fi + \if@german@blackletter\date@german@blackletter\else\date@german\fi } \def\german@language{% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-germanb.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-germanb.ldf new file mode 100644 index 00000000000..e907dc0e200 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-germanb.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-germanb.ldf}[polyglossia: module for german (old spelling)] + +% We provide this as a babel alias + +\xpg@load@master@language{german} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf index ecef64d772a..eba37b56c74 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf @@ -1,4 +1,5 @@ \ProvidesFile{gloss-greek.ldf}[polyglossia: module for greek] + \PolyglossiaSetup{greek}{ script=Greek, scripttag=grek, @@ -11,6 +12,9 @@ %TODO localalph={greek@alph,greek@Alph} } +% Babel aliases +\setlanguagealias[variant=polytonic]{greek}{polutonikogreek} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% The code in this file was initially adapted from the antomega %% module for greek. Currently large parts of it derive from the diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-hungarian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-hungarian.ldf index 5c990cef896..c44c7a63ff0 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-hungarian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-hungarian.ldf @@ -2,7 +2,7 @@ \PolyglossiaSetup{hungarian}{ babelname=magyar, - hyphennames={magyar,hungarian}, + hyphennames={hungarian,magyar}, langtag=HUN, hyphenmins={2,2}, fontsetup=true, @@ -10,6 +10,49 @@ \frenchspacing +% Babel and backwards compat. alias +\setlanguagealias{hungarian}{magyar} + +\newif\if@hungarian@swapcaptions +\newif\if@hungarian@swapheadings +\newif\if@hungarian@swapheaders +\define@choicekey*+{hungarian}{swapstrings}[\val\nr]{all,captions,headings,headers,hheaders,none}[all]{% + \ifcase\nr\relax + % all: + \@hungarian@swapcaptionstrue% + \@hungarian@swapheadingstrue% + \@hungarian@swapheaderstrue% + \or + % captions: + \@hungarian@swapcaptionstrue% + \@hungarian@swapheadingsfalse% + \@hungarian@swapheadersfalse% + \or + % headings: + \@hungarian@swapcaptionsfalse% + \@hungarian@swapheadingstrue% + \@hungarian@swapheadersfalse% + \or + % headers: + \@hungarian@swapcaptionsfalse% + \@hungarian@swapheadingsfalse% + \@hungarian@swapheaderstrue% + \or + % hheaders: + \@hungarian@swapcaptionsfalse% + \@hungarian@swapheadingstrue% + \@hungarian@swapheaderstrue% + \or + % none: + \@hungarian@swapcaptionsfalse% + \@hungarian@swapheadingsfalse% + \@hungarian@swapheadersfalse% + \fi + \xpg@info{Option: Hungarian, swapstrings=\val}% +}{\xpg@warning{Unknown Hungarian swapstrings value `#1'}} + +\setkeys{hungarian}{swapstrings} + \def\captionshungarian{% \def\refname{Hivatkozások}% \def\abstractname{Kivonat}% @@ -57,25 +100,188 @@ 21-én\or 22-én\or 23-án\or 24-én\or 25-én\or 26-án\or 27-én\or 28-án\or 29-én\or 30-án\or 31-én\fi}% - \let\ontoday\ondatehungarian} + \let\ontoday\ondatehungarian% + \let\ondatemagyar\ondatehungarian% +} -% change 'táblázat x.x' to 'x.x. táblázat' -\def\xpg@hungarian@fnum@table{\thetable.~\tablename} +% Save original capsformats \let\xpg@save@fnum@table\fnum@table - -% change 'ábra x.x' to 'x.x. ábra' -\def\xpg@hungarian@fnum@figure{\thefigure.~\figurename} \let\xpg@save@fnum@figure\fnum@figure +\def\hungarian@capsformat{% + % + % Change captions + \if@hungarian@swapcaptions + % change 'ábra x.x' to 'x.x. ábra' + \def\fnum@figure{\thefigure.~\figurename} + % + % change 'táblázat x.x' to 'x.x. táblázat' + \def\fnum@table{\thetable.~\tablename} + \fi + % + % change chapter and part headings + \if@hungarian@swapheadings + % With titlesec + \ifdefined\titleformat% + \ifdefined\@part% + \let\xpg@save@part@format\@part% + \patchcmd{\@part}% + {\partname\nobreakspace\thepart}% + {\thepart.\nobreakspace\partname}% + {}% + {\xpg@warning{Failed to patch part for Hungarian}}% + \fi% + \ifdefined\chapter% + \titleformat\chapter[display]% + {\@ifundefined{ttl@fil}{\raggedright}{\ttl@fil}\ttl@fonts\ttl@sizes6} + {\thechapter.\space\@chapapp}{.8\baselineskip}{\ttl@sizes\z@\ttl@passexplicit} + \fi% + \else% (not \ifdefined\titleformat) + % With KOMA + \ifdefined\sectionformat% + \ifdefined\partformat% + \let\xpg@save@part@format\partformat% + \renewcommand{\partformat}{\thepart.~\partname}% + \fi% + \ifdefined\chapterformat% + \let\xpg@save@chap@format\chapterformat% + \renewcommand{\chapterformat}{\mbox{\thechapter\autodot% + \IfUsePrefixLine{\nobreakspace\chapapp}{\enskip}}}% + \fi% + \else% (not \ifdefined\sectionformat) + % With memoir + \ifdefined\@memptsize% + \ifdefined\@makechapterhead% + \let\xpg@save@chap@format\@makechapterhead% + \patchcmd{\@makechapterhead}{\printchaptername \chapternamenum \printchapternum}% + {\printchapternum.\chapternamenum\printchaptername}% + {}% + {\xpg@warning{Failed to patch chapter for Hungarian}}% + \fi% + \ifdefined\@part% + \let\xpg@save@part@format\@part% + \patchcmd{\@part}{\printpartname \partnamenum \printpartnum}% + {\printpartnum.\partnamenum\printpartname}% + {}% + {\xpg@warning{Failed to patch part for Hungarian}}% + \fi% + \else% (not \ifdefined\@memptsize) + % With standard classes + \ifdefined\@makechapterhead% + \let\xpg@save@chap@format\@makechapterhead% + \patchcmd{\@makechapterhead}% + {\@chapapp\space \thechapter}% + {\thechapter.\space \@chapapp}% + {}% + {\xpg@warning{Failed to patch chapter for Hungarian}}% + \fi% + \ifdefined\@part% + \let\xpg@save@part@format\@part% + \patchcmd{\@part}% + {\partname\nobreakspace\thepart}% + {\thepart.\nobreakspace\partname}% + {}% + {\xpg@warning{Failed to patch part for Hungarian}}% + \fi% (end \ifdefined\@part) + \fi% (end \ifdefined\@memptsize) + \fi% (end \ifdefined\sectionformat) + \fi% (end \ifdefined\titleformat) + \fi% (end \if@hungarian@swapheadings) + % + % Change running headers + \if@hungarian@swapheaders + \ifdefined\chapterformat% + % With KOMA + \let\xpg@save@chaptermark@format\chaptermarkformat% + \renewcommand*\chaptermarkformat{% + \thechapter\autodot\ \IfChapterUsesPrefixLine{\chapapp\enskip}{}} + \else% (not \ifdefined\chapterformat) + \ifdefined\@memptsize% + % With memoir + \let\xpg@save@chaptermark@format\chaptermark% + \renewcommand*\chaptermark[1]{% + \markboth{\memUChead{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \thechapter.\ \@chapapp\ % + \fi + \fi + ##1}}{}}% + \else% (not \ifdefined\@memptsize) + % With standard classes + \ifdefined\chaptermark% + \let\xpg@save@chaptermark@format\chaptermark% + \patchcmd{\chaptermark}% + {\@chapapp\ \thechapter.}% + {\thechapter.\ \@chapapp}% + {}% + {\xpg@warning{Failed to patch chaptermark for Hungarian}}% + \fi% (end \ifdefined\chaptermark) + \fi% (end \ifdefined\@memptsize) + \fi% (end \ifdefined\chapterformat) + \fi% (end \if@hungarian@swapheaders) +} + +\def\nohungarian@capsformat{% + % + % Reset changes of \hungarian@capsformat + \let\fnum@table\xpg@save@fnum@table% + \let\fnum@figure\xpg@save@fnum@figure% + % + % Reset chapter and part heading + \ifdefined\titleformat% + % With titlesec + \ifdefined\xpg@save@part@format + \let\@part\xpg@save@part@format + \fi% + \ifdefined\chapter + \titleformat\chapter[display]% + {\@ifundefined{ttl@fil}{\raggedright}{\ttl@fil}\ttl@fonts\ttl@sizes6} + {\@chapapp\space\thechapter}{.8\baselineskip}{\ttl@sizes\z@\ttl@passexplicit} + \fi% + \else% (not \ifdefined\titleformat) + \ifdefined\sectionformat% + % With KOMA + \ifdefined\xpg@save@part@format + \let\partformat\xpg@save@part@format + \fi% + \ifdefined\xpg@save@chap@format + \let\chapterformat\xpg@save@chap@format + \fi% + \else% + % With memoir and standard classes + \ifdefined\xpg@save@part@format + \let\@part\xpg@save@part@format + \fi% + \ifdefined\xpg@save@chap@format + \let\@makechapterhead\xpg@save@chap@format + \fi% + \fi% (end \ifdefined\sectionformat) + \fi% (end \ifdefined\titleformat) + % + % Reset headers + \ifdefined\chaptermarkformat% + % With KOMA + \ifdefined\xpg@save@chaptermark@format + \let\chaptermarkformat\xpg@save@chaptermark@format% + \fi + \else% + \ifdefined\chaptermark% + % With memoir and standard classes + \ifdefined\xpg@save@chaptermark@format + \let\chaptermark\xpg@save@chaptermark@format% + \fi + \fi% (end \ifdefined\chaptermark) + \fi% (end \ifdefined\chapterformat) +} + \def\blockextras@hungarian{% - \let\fnum@table\xpg@hungarian@fnum@table - \let\fnum@figure\xpg@hungarian@fnum@figure + \hungarian@capsformat% } \def\noextras@hungarian{% - \let\fnum@table\xpg@save@fnum@table - \let\fnum@figure\xpg@save@fnum@figure - \let\ontoday\@undefined + \nohungarian@capsformat% + \let\ontoday\@undefined% } \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-irish.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-irish.ldf index aa27c3d3455..d3eb2ef187e 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-irish.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-irish.ldf @@ -3,16 +3,6 @@ % We only provide this gloss for babel compatibility. Since irish is % a gaelic variety, we use 'gaelic' with variant 'irish' now. -\input{gloss-gaelic.ldf} - -\PolyglossiaSetup{irish}{ - hyphennames={irish}, - hyphenmins={2,2}, - langtag=IRI, - fontsetup=true, -} - -\let\captionsirish\captionsgaelic@irish -\let\dateirish\dategaelic@irish +\xpg@load@master@language{gaelic} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf index ca050dea61f..3f118de9b4c 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf @@ -17,6 +17,9 @@ localnumeral=kurdishnumerals } +% Babel aliases +\setlanguagealias[variant=kurmanji]{kurdish}{kurmanji} + \newif\if@kurdish@kurmanji \def\kurdish@variant{sorani} \define@choicekey*+{kurdish}{variant}[\val\nr]{sorani,kurmanji}[sorani]{% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf index 3fc7d20ceca..08c4883f748 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf @@ -1,298 +1,907 @@ -%% -%% This is file `gloss-latin.ldf', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% gloss-latin.dtx (with options: `lamodern') -%% ------------------------------------------------------------------ -%% Latin module for polyglossia -%% Copyright (C) Claudio Beccari 2013-2016 -%% Copyright (C) Élie Roux 2016 -%% This work is distributed under the MIT License. -%% -%% See the postamble. -%% ------------------------------------------------------------------ -\ProvidesFile{gloss-latin.ldf} - [2016/09/10 v.1.03 Latin support from polyglossia] -%% +\ProvidesFile{gloss-latin.ldf}[polyglossia: module for Latin v.2.0 2019-10-28] +\ExplSyntaxOn -\PolyglossiaSetup{latin}{% - hyphennames={latin}, - hyphenmins={2,2}, - langtag=LAT, - frenchspacing=true, - fontsetup=true, -} -\def\classicuclccodes{\lccode`\V=`\u \uccode`\u=`\V} -\def\noclassicuclccodes{\lccode`\V=`\v \uccode`\u=`\U} -\def\tmp@modern{modern} -\def\tmp@medieval{medieval} -\unless\ifluatex - \def\tmp@classic{classic} - \def\tmp@liturgical{liturgical} -\fi -\newif\ifmedieval\medievalfalse -\newif\ifclassic\classicfalse -\define@boolkey{latin}[latin@]{ecclesiastic}[true]{} +\PolyglossiaSetup {latin} + { + hyphennames = {latin}, + hyphenmins = {2,2}, + frenchspacing = true, + fontsetup = true, + langtag = LAT + } -\let\latin@variant\l@latin -\ifluatex - \ifcsname l@latin\endcsname\xpg@set@language@luatex@ii{latin}\fi -\fi -\def\captionslatin{\latincaptions}% -\def\datelatin{\latindate}% -\define@key{latin}{variant}[modern]{% -\def\@tempa{#1}% -\ifx\@tempa\tmp@medieval - \ifluatex - \ifcsname l@latin\endcsname\xpg@set@language@luatex@ii{latin}\fi - \fi - \let\latin@variant\l@latin - \xpg@set@language@luatex@ii{latin} - \medievaltrue \classictrue - \xpg@info{Option: Medieval Latin}% -\else - \ifx\@tempa\tmp@classic - \unless\ifluatex - \unless\ifcsname l@classiclatin\endcsname - \xpg@nopatterns{Classic Latin}% - \adddialect\l@classiclatin\l@latin - \let\latin@variant\l@latin - \else - \let\latin@variant\l@classiclatin - \fi - \fi - \medievalfalse\classictrue - \xpg@info{Option: Classic Latin}% - \else - \ifx\@tempa\tmp@liturgical\unless\ifluatex - \unless\ifcsname l@liturgicallatin\endcsname - \xpg@nopatterns{Liturgical Latin}% - \adddialect\l@liturgicallatin\l@latin - \def\latin@variant{\l@latin}% - \else - \let\latin@variant\l@liturgicallatin - \fi - \medievaltrue\classicfalse - \xpg@info{Option: Liturgical Latin}\fi - \else - \ifx\@tempa\tmp@modern - \let\latin@variant\l@latin - \ifluatex\xpg@set@language@luatex@ii{latin}\fi - \xpg@info{Option: Modern Latin}% - \else - \def\latin@variant{\l@nohyphenation}% - \PackageWarning{polyglossia}{% - *******************\MessageBreak - No hyphenation set for \@tempa - *******************\MessageBreak - }{}% - \fi - \fi - \fi -\fi -} - -\def\latin@language{\language=\latin@variant}% -\ifluatex - \PackageWarning{polyglossia}{\MessageBreak\MessageBreak - *****************\MessageBreak - The ecclesiastic option is not active\MessageBreak - when typesetting with LuaLaTeX\MessageBreak - *****************\MessageBreak - \MessageBreak}{} - \else - \def\ecclesiasticlatin@punctuation{% - \def\xpg@unskip{\ifhmode\ifdim\lastskip>\z@\unskip\fi\fi} - \lccode\string"2019=\string"2019 - \newXeTeXintercharclass\ecclesiasticlatin@punctthin - \newXeTeXintercharclass\ecclesiasticlatin@punctguillstart - \newXeTeXintercharclass\ecclesiasticlatin@punctguillend - \XeTeXinterchartokenstate=1 - \XeTeXcharclass `\! \ecclesiasticlatin@punctthin - \XeTeXcharclass `\? \ecclesiasticlatin@punctthin - \XeTeXcharclass `\; \ecclesiasticlatin@punctthin - \XeTeXcharclass `\: \ecclesiasticlatin@punctthin - \XeTeXcharclass `\« \ecclesiasticlatin@punctguillstart - \XeTeXcharclass `\» \ecclesiasticlatin@punctguillend - \XeTeXinterchartoks \z@ \ecclesiasticlatin@punctthin = {\penalty\@M - \hskip.2\fontdimen2\font \@plus\z@\@minus\z@}% - \XeTeXinterchartoks 255 \ecclesiasticlatin@punctthin = {\xpg@unskip} - \XeTeXinterchartoks \ecclesiasticlatin@punctguillstart \z@ = {\penalty\@M - \hskip.2\fontdimen2\font \@plus\z@\@minus\z@\ignorespaces} - \XeTeXinterchartoks \z@ \ecclesiasticlatin@punctguillend = {\xpg@unskip - \penalty\@M\hskip.2\fontdimen2\font \@plus\z@\@minus\z@} - } - - \def\noecclesiasticlatin@punctuation{% - \lccode\string"2019=\z@ +% Babel aliases +\setlanguagealias[variant=classic]{latin}{latinclassic} +\setlanguagealias[variant=ecclesiastic]{latin}{latinecclesiastic} +\setlanguagealias[variant=medieval]{latin}{latinmedieval} + + +%%%%% Variables and commands concerning spelling + +\bool_new:N \l_polyglossia_latin_use_j_bool +\bool_new:N \l_polyglossia_latin_use_v_bool +\bool_new:N \l_polyglossia_latin_use_digraphs_bool +\bool_new:N \l_polyglossia_latin_capitalize_month_bool + +\cs_new:Npn \polyglossia_latin_classical_character_codes: + { + \char_set_lccode:nn {`\V} {`\u} + \char_set_uccode:nn {`\u} {`\V} + \char_set_uccode:nn {`\ú} {`\V} + \char_set_uccode:nn {`\ū} {`\V} + \char_set_uccode:nn {`\ŭ} {`\V} + } + +\cs_new:Npn \polyglossia_latin_modern_character_codes: + { + \char_set_lccode:nn {`\V} {`\v} + \char_set_uccode:nn {`\u} {`\U} + \char_set_uccode:nn {`\ú} {`\Ú} + \char_set_uccode:nn {`\ū} {`\Ū} + \char_set_uccode:nn {`\ŭ} {`\Ŭ} + } + + +%%%%% Messages and commands concerning hyphenation + +\msg_new:nnn {polyglossia} {latin / missing modern patterns} + { + No~hyphenation~patterns~were~found~for~Latin~\msg_line_context:.~ + I~will~not~hyphenate~Latin~words. + } + +\msg_new:nnn {polyglossia} {latin / missing patterns} + { + The~"#1"~hyphenation~patterns~were~not~found~\msg_line_context:.~ + I~will~use~the~patterns~for~modern~Latin~instead. + } + +\cs_new:Npn \polyglossia_latin_use_modern_patterns: + { + \xpg@ifdefined {latin} + { + \def \latin@language + { + \polyglossia@setup@language@patterns {latin} + } + } + { + \msg_warning:nn {polyglossia} {latin / missing modern patterns} + \adddialect \l@latin \l@nohyphenation + } + } + +\cs_new:Npn \polyglossia_latin_set_patterns:n #1 +% #1 may be "classiclatin" or "liturgicallatin" + { + \xpg@ifdefined {#1} + { + \def \latin@language + { + \polyglossia@setup@language@patterns {#1} + } + } + { + \xpg@ifdefined {latin} + { + \msg_warning:nnn {polyglossia} {latin / missing patterns} {#1} + \adddialect \l@ #1 \l@latin + \polyglossia_latin_use_modern_patterns: + } + { + \msg_warning:nn {polyglossia} {latin / missing modern patterns} + \adddialect \l@ #1 \l@nohyphenation + } + } + } + + +%%%%% Settings for the spacing of the punctuation for ecclesiastical Latin + +\bool_new:N \g_polyglossia_latin_punctuation_spacing_bool + +\sys_if_engine_luatex:TF + { + \directlua { require('polyglossia-latin') } + } + { + \newXeTeXintercharclass \g_polyglossia_latin_punctuation_class + \newXeTeXintercharclass \g_polyglossia_latin_opening_guillemet_class + \newXeTeXintercharclass \g_polyglossia_latin_closing_guillemet_class + \newXeTeXintercharclass \g_polyglossia_latin_opening_bracket_class + \newXeTeXintercharclass \g_polyglossia_latin_closing_bracket_class + + \cs_new:Npn \polyglossia_latin_insert_punctuation_space: + { + \nobreak + \skip_horizontal:n { 0.08333 \fontdimen6 \font } % 1/12 quad + } + \cs_new:Npn \polyglossia_latin_replace_preceding_space: + { + \dim_compare:nNnT {\lastskip} > {\c_zero_dim} {\unskip} + \polyglossia_latin_insert_punctuation_space: + } + \cs_new:Npn \polyglossia_latin_replace_following_space: + { + \polyglossia_latin_insert_punctuation_space: + \ignorespaces + } + } + +\cs_new:Npn \polyglossia_latin_punctuation_spacing: + { + \sys_if_engine_luatex:TF + { + \directlua { polyglossia.activate_latin_punct() } + } + { + \XeTeXinterchartokenstate = 1 + \XeTeXcharclass `\! \g_polyglossia_latin_punctuation_class + \XeTeXcharclass `\? \g_polyglossia_latin_punctuation_class + \XeTeXcharclass `\‼ \g_polyglossia_latin_punctuation_class + \XeTeXcharclass `\⁇ \g_polyglossia_latin_punctuation_class + \XeTeXcharclass `\⁈ \g_polyglossia_latin_punctuation_class + \XeTeXcharclass `\⁉ \g_polyglossia_latin_punctuation_class + \XeTeXcharclass `\; \g_polyglossia_latin_punctuation_class + \XeTeXcharclass `\: \g_polyglossia_latin_punctuation_class + \XeTeXcharclass `\« \g_polyglossia_latin_opening_guillemet_class + \XeTeXcharclass `\» \g_polyglossia_latin_closing_guillemet_class + \XeTeXcharclass `\‹ \g_polyglossia_latin_opening_guillemet_class + \XeTeXcharclass `\› \g_polyglossia_latin_closing_guillemet_class + \XeTeXcharclass `\( \g_polyglossia_latin_opening_bracket_class + \XeTeXcharclass `\) \g_polyglossia_latin_closing_bracket_class + \XeTeXcharclass `\[ \g_polyglossia_latin_opening_bracket_class + \XeTeXcharclass `\] \g_polyglossia_latin_closing_bracket_class + \XeTeXcharclass `\{ \g_polyglossia_latin_opening_bracket_class + \XeTeXcharclass `\} \g_polyglossia_latin_closing_bracket_class + \XeTeXcharclass `\⟨ \g_polyglossia_latin_opening_bracket_class + \XeTeXcharclass `\⟩ \g_polyglossia_latin_closing_bracket_class + + % punctuation followed by a closing guillemet + \XeTeXinterchartoks \g_polyglossia_latin_punctuation_class \g_polyglossia_latin_closing_guillemet_class = + { + \polyglossia_latin_insert_punctuation_space: + } + % closing bracket followed by punctuation + \XeTeXinterchartoks \g_polyglossia_latin_closing_bracket_class \g_polyglossia_latin_punctuation_class = + { + \polyglossia_latin_insert_punctuation_space: + } + % closing bracket followed by a closing guillemet + \XeTeXinterchartoks \g_polyglossia_latin_closing_bracket_class \g_polyglossia_latin_closing_guillemet_class = + { + \polyglossia_latin_insert_punctuation_space: + } + % opening guillemet followed by a space + \XeTeXinterchartoks \g_polyglossia_latin_opening_guillemet_class \xpg@boundaryclass = + { + \polyglossia_latin_replace_following_space: + } + % opening guillemet followed by an ordinary character + \XeTeXinterchartoks \g_polyglossia_latin_opening_guillemet_class \z@ = + { + \polyglossia_latin_insert_punctuation_space: + } + % closing guillemet followed by punctuation + \XeTeXinterchartoks \g_polyglossia_latin_closing_guillemet_class \g_polyglossia_latin_punctuation_class = + { + \polyglossia_latin_insert_punctuation_space: + } + % space followed by punctuation + \XeTeXinterchartoks \xpg@boundaryclass \g_polyglossia_latin_punctuation_class = + { + \polyglossia_latin_replace_preceding_space: + } + % space followed by closing guillemet + \XeTeXinterchartoks \xpg@boundaryclass \g_polyglossia_latin_closing_guillemet_class = + { + \polyglossia_latin_replace_preceding_space: + } + % ordinary character followed by punctuation + \XeTeXinterchartoks \z@ \g_polyglossia_latin_punctuation_class = + { + \polyglossia_latin_insert_punctuation_space: + } + % ordinary character followed by closing guillemet + \XeTeXinterchartoks \z@ \g_polyglossia_latin_closing_guillemet_class = + { + \polyglossia_latin_insert_punctuation_space: + } + } + } + +\cs_new:Npn \polyglossia_latin_no_punctuation_spacing: + { + \sys_if_engine_luatex:TF + { + \directlua { polyglossia.deactivate_latin_punct() } + } + { \XeTeXcharclass `\! \z@ \XeTeXcharclass `\? \z@ + \XeTeXcharclass `\‼ \z@ + \XeTeXcharclass `\⁇ \z@ + \XeTeXcharclass `\⁈ \z@ + \XeTeXcharclass `\⁉ \z@ \XeTeXcharclass `\; \z@ \XeTeXcharclass `\: \z@ \XeTeXcharclass `\« \z@ \XeTeXcharclass `\» \z@ - \XeTeXinterchartokenstate=0 + \XeTeXcharclass `\‹ \z@ + \XeTeXcharclass `\› \z@ + \XeTeXcharclass `\( \z@ + \XeTeXcharclass `\) \z@ + \XeTeXcharclass `\[ \z@ + \XeTeXcharclass `\] \z@ + \XeTeXcharclass `\{ \z@ + \XeTeXcharclass `\} \z@ + \XeTeXcharclass `\⟨ \z@ + \XeTeXcharclass `\⟩ \z@ + \XeTeXinterchartokenstate = 0 } - \let\latin@original@makefntext\@makefntext - \newcommand\latin@ecclesiastic@makefntext[1]{% - \parindent 1em \noindent - \latin@Makefnmark{\enspace #1}} - \newcommand\latin@Makefnmark{\hbox{\normalfont\@thefnmark.}} -\fi -\setkeys{latin}{variant,ecclesiastic=false} -\def\latincaptions{% - \def\prefacename{\ifmedieval Præfatio\else Praefatio\fi}% - \def\refname{Conspectus librorum}% - \def\abstractname{Summarium}% - \def\bibname{Conspectus librorum}% - \def\chaptername{Caput}% - \def\appendixname{Additamentum}% - \def\contentsname{Index}% - \def\listfigurename{Conspectus descriptionum}% - \def\listtablename{Conspectus tabularum}% - \def\indexname{Index rerum notabilium}% - \def\figurename{Descriptio}% - \def\tablename{Tabula}% - \def\partname{Pars}% - \def\enclname{Additur}% - \def\ccname{Exemplar}% - \def\headtoname{\ignorespaces}% - \def\pagename{charta}% - \def\seename{cfr.}% - \def\alsoname{cfr.}% - \def\proofname{Demonstratio}% - \def\glossaryname{Glossarium}% - } - -\def\latindate{% - \def\today{\uppercase\expandafter{\romannumeral\day}% - \space \ifcase\month% - \or Januarii\or Februarii\or Martii\or Aprilis\or Maji\or - Junii\or Julii\or Augusti\or Septembris\or Octobris\or - \ifclassic Nouembris\else Novembris\fi - \or Decembris\fi% - \space \uppercase\expandafter{\romannumeral\year}}} -%%%%%%%%% Latin shorthands - -\define@boolkey{latin}[latin@]{babelshorthands}[true]{} + } + + +%%%%% Messages and commands concerning footnotes + +\cs_if_exist:NT \@makefntext + { + \cs_set_eq:NN \polyglossia_latin_original_footnote:n \@makefntext + } + +% This is the footnote style as defined by the "ecclesiastic" package. +\cs_new:Npn \polyglossia_latin_variant_footnote:n #1 + { + \parindent 1em + \noindent + \hbox { \normalfont \@thefnmark . } + \enspace #1 + } + +\msg_new:nnn {polyglossia} {latin / ineffective footnote option} + { + The~option~"ecclesiasticfootnotes"~is~ineffective~\msg_line_context: + \c_space_tl as~Latin~is~not~the~main~language. + } + +\cs_new:Npn \polyglossia_latin_apply_footnote_option: + { + \str_if_eq:VnTF \xpg@main@language {latin} + { + \cs_if_exist:NT \@makefntext + { + \iflatin@ecclesiasticfootnotes + \let \@makefntext \polyglossia_latin_variant_footnote:n + \else + \let \@makefntext \polyglossia_latin_original_footnote:n + \fi + } + } + { + \msg_warning:nn {polyglossia} {latin / ineffective footnote option} + } + } + +\define@boolkey {latin} [latin@] {ecclesiasticfootnotes} [true] + { + \token_if_eq_meaning:NNTF \@onlypreamble \@notprerr + { + % within the document + \polyglossia_latin_apply_footnote_option: + } + { + % within the preamble + % The application of the option has to be postponed as the main + % language may be undefined when the option is called. + \AtBeginDocument { \polyglossia_latin_apply_footnote_option: } + } + } + + +%%%%% Language variants: classic, medieval, modern, and ecclesiastic + +\msg_new:nnn {polyglossia} {latin / language variant} + { + Activating~Latin~language~variant~"#1"~\msg_line_context:. + } + +\msg_new:nnn {polyglossia} {latin / illegal language variant} + { + The~Latin~language~variant~"#1"~is~undefined~\msg_line_context:. + } + +\cs_new:Npn \polyglossia_latin_classic_settings: + { + \bool_set_false:N \l_polyglossia_latin_use_j_bool + \bool_set_false:N \l_polyglossia_latin_use_v_bool + \bool_set_false:N \l_polyglossia_latin_use_digraphs_bool + \bool_set_true:N \l_polyglossia_latin_capitalize_month_bool + \bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool + \SetLanguageKeys {latin} { babelname = latin.classic } + \polyglossia_latin_set_patterns:n {classiclatin} + } + +\cs_new:Npn \polyglossia_latin_medieval_settings: + { + \bool_set_false:N \l_polyglossia_latin_use_j_bool + \bool_set_false:N \l_polyglossia_latin_use_v_bool + \bool_set_true:N \l_polyglossia_latin_use_digraphs_bool + \bool_set_true:N \l_polyglossia_latin_capitalize_month_bool + \bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool + \SetLanguageKeys {latin} { babelname = latin.medieval } + \polyglossia_latin_use_modern_patterns: + } + +\cs_new:Npn \polyglossia_latin_modern_settings: + { + \bool_set_false:N \l_polyglossia_latin_use_j_bool + \bool_set_true:N \l_polyglossia_latin_use_v_bool + \bool_set_false:N \l_polyglossia_latin_use_digraphs_bool + \bool_set_true:N \l_polyglossia_latin_capitalize_month_bool + \bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool + \SetLanguageKeys {latin} { babelname = latin } + \polyglossia_latin_use_modern_patterns: + } + +\cs_new:Npn \polyglossia_latin_ecclesiastic_settings: + { + \bool_set_false:N \l_polyglossia_latin_use_j_bool + \bool_set_true:N \l_polyglossia_latin_use_v_bool + \bool_set_true:N \l_polyglossia_latin_use_digraphs_bool + \bool_set_false:N \l_polyglossia_latin_capitalize_month_bool + \bool_set_true:N \l_polyglossia_latin_punctuation_spacing_bool + \SetLanguageKeys {latin} { babelname = latin.ecclesiastic } + \polyglossia_latin_use_modern_patterns: + } + +\define@key{latin}{variant} + { + \str_case:nnF {#1} + { + {classic} + { + \msg_info:nnn {polyglossia} {latin / language variant} {classic} + \polyglossia_latin_classic_settings: + } + {medieval} + { + \msg_info:nnn {polyglossia} {latin / language variant} {medieval} + \polyglossia_latin_medieval_settings: + } + {modern} + { + \msg_info:nnn {polyglossia} {latin / language variant} {modern} + \polyglossia_latin_modern_settings: + } + {ecclesiastic} + { + \msg_info:nnn {polyglossia} {latin / language variant} {ecclesiastic} + \polyglossia_latin_ecclesiastic_settings: + } + } + { + \msg_warning:nnn {polyglossia} {latin / illegal language variant} {#1} + } + } + + +%%%%% Boolean options concerning spelling + +\define@boolkey{latin}[latin@]{usej}[true] + { + \iflatin@usej + \bool_set_true:N \l_polyglossia_latin_use_j_bool + \else + \bool_set_false:N \l_polyglossia_latin_use_j_bool + \fi + } + +\define@boolkey{latin}[latin@]{capitalizemonth}[true] + { + \iflatin@capitalizemonth + \bool_set_true:N \l_polyglossia_latin_capitalize_month_bool + \else + \bool_set_false:N \l_polyglossia_latin_capitalize_month_bool + \fi + } + + +%%%%% Hyphenation variants: classic, liturgical, and modern + +\msg_new:nnn {polyglossia} {latin / hyphenation variant} + { + Activating~hyphenation~patterns~for~#1~Latin~\msg_line_context:. + } + +\msg_new:nnn {polyglossia} {latin / illegal hyphenation variant} + { + The~Latin~hyphenation~variant~"#1"~is~undefined~\msg_line_context:. + } + +\define@key{latin}{hyphenation} + { + \str_case:nnTF {#1} + { + {classic} { \polyglossia_latin_set_patterns:n {classiclatin} } + {liturgical} { \polyglossia_latin_set_patterns:n {liturgicallatin} } + {modern} { \polyglossia_latin_use_modern_patterns: } + } + { + \msg_info:nnn {polyglossia} {latin / hyphenation variant} {#1} + } + { + \msg_warning:nnn {polyglossia} {latin / illegal hyphenation variant} {#1} + } + } + + +%%%%% Latin captions and date + +\def \captionslatin + { + \def \prefacename + { + \bool_if:NTF \l_polyglossia_latin_use_digraphs_bool {Præfatio} {Praefatio} + } + \def \refname {Conspectus~librorum} + \def \abstractname {Summarium} + \def \bibname {Conspectus~librorum} + \def \chaptername {Caput} + \def \appendixname {Additamentum} + \def \contentsname {Index} + \def \listfigurename {Conspectus~descriptionum} + \def \listtablename {Conspectus~tabularum} + \def \indexname {Index~rerum~notabilium} + \def \figurename {Descriptio} + \def \tablename {Tabula} + \def \partname {Pars} + \def \enclname {Additur} + \def \ccname {Exemplar} + \def \headtoname {\ignorespaces} + \def \pagename {charta} + \def \seename {cfr.} + \def \alsoname {cfr.} + \def \proofname {Demonstratio} + \def \glossaryname {Glossarium} + } + +\cs_new:Npn \polyglossia_latin_month_name: + { + \str_set:Nx \l_tmpa_str + { + \int_case:nn { \month } + { + {1} { \bool_if:NTF \l_polyglossia_latin_use_j_bool {januarii} {ianuarii} } + {2} {februarii} + {3} {martii} + {4} {aprilis} + {5} { \bool_if:NTF \l_polyglossia_latin_use_j_bool {maji} {maii} } + {6} { \bool_if:NTF \l_polyglossia_latin_use_j_bool {junii} {iunii} } + {7} { \bool_if:NTF \l_polyglossia_latin_use_j_bool {julii} {iulii} } + {8} {augusti} + {9} {septembris} + {10} {octobris} + {11} { \bool_if:NTF \l_polyglossia_latin_use_v_bool {novembris} {nouembris} } + {12} {decembris} + } + } + \bool_if:NTF \l_polyglossia_latin_capitalize_month_bool + { + \tl_mixed_case:n { \l_tmpa_str } + } + { + \str_use:N \l_tmpa_str + } + } + +\def \datelatin + { + \def \today + { + \int_to_Roman:n { \day } + \c_space_tl + \polyglossia_latin_month_name: + \c_space_tl + \int_to_Roman:n { \year } + } + } + + +%%%%% Latin shorthands + +\define@boolkey{latin}[latin@]{babelshorthands}[true] + { + } + +\define@boolkey{latin}[latin@]{prosodicshorthands}[true] + { + } \ifsystem@babelshorthands \setkeys{latin}{babelshorthands=true} \else \setkeys{latin}{babelshorthands=false} \fi -\ifcsundef{initiate@active@char}{% -\input{babelsh.def}% -\initiate@active@char{"}% -\initiate@active@char{'}% -}{} -\def\latin@shorthands{% - \def\language@group{latin}% - \bbl@activate{"}% - \declare@shorthand{latin}{"}{\relax - \ifmmode - \def\xpgla@nextdq{''}% - \else - \def\xpgla@nextdq{\futurelet\xpgla@temp\xpgla@cwm}% - \fi - \xpgla@nextdq}% - \bbl@activate{'}% - \declare@shorthand{latin}{'}{\relax - \ifmmode - \def\xpgla@nextsq{'}% - \else - \def\xpgla@nextsq{\futurelet\xpgla@temp@A\xpgla@putacute}% - \fi - \xpgla@nextsq}% -} -\def\xpgla@allowhyphens{\bbl@allowhyphens - \discretionary{-}{}{}\bbl@allowhyphens} -\newcommand*{\xpgla@cwm}{\let\xpgla@@nextdq\relax - \ifcat\noexpand\xpgla@temp a% - \let\xpgla@@nextdq\xpgla@allowhyphens - \else - \ifx\xpgla@temp\ae - \let\xpgla@@nextdq\xpgla@allowhyphens - \else - \ifx\xpgla@temp\oe - \let\xpgla@@nextdq\xpgla@allowhyphens + +\ExplSyntaxOff % babelsh.def does not support expl3 syntax +\ifcsundef{initiate@active@char}{\input{babelsh.def}}{} +\ExplSyntaxOn + +\initiate@active@char {"} +\initiate@active@char {'} +\initiate@active@char {^} +\initiate@active@char {=} + +\shorthandoff {"} +\shorthandoff {'} +\shorthandoff {^} +\shorthandoff {=} + +% The active '=' character may cause problems with key=value interfaces. +% We have to make sure here that no problems can occur outside a Latin +% prosodic shorthand environment. + +\protected@write \@auxout { } { \shorthandoff {=} } % for the aux file + +\AtBeginDocument + { + \str_if_eq:VnTF \xpg@main@language {latin} + { + \iflatin@prosodicshorthands \else - \if\noexpand\xpgla@temp\string|% - \def\xpgla@@nextdq{\xpgla@allowhyphens\@gobble}% - \fi + \shorthandoff {=} \fi + } + { + % The following command should not be called if the main language + % defines a '=' shorthand. However, there are no languages besides + % Latin defining such a shorthand in polyglossia. + \shorthandoff {=} + } + } + +\cs_new:Npn \polyglossia_latin_shorthands: + { + \def \language@group {latin} + \bbl@activate {"} + \declare@shorthand {latin} {"} + { + \mode_if_math:TF + { + \token_to_str:N " + } + { + \polyglossia_latin_apply_quotemark:N + } + } + \bbl@activate {'} + \declare@shorthand {latin} {'} + { + \mode_if_math:TF + { + \active@math@prime % defined in "latex.ltx" + } + { + \polyglossia_latin_put_acute:N + } + } + } + +\cs_new:Npn \polyglossia_latin_prosodic_shorthands: + { + \def \language@group {latin} + % The '=' shorthand is normally turned off to avoid problems with key=value + % interfaces. We turn it on here to enable prosodic shorthands. + \shorthandon {=} + \bbl@activate {=} + \declare@shorthand {latin} {=} + { + \mode_if_math:TF + { + \token_to_str:N = + } + { + \polyglossia_latin_put_macron:N + } + } + \bbl@activate {^} + \declare@shorthand {latin} {^} + { + \mode_if_math:TF + { + \token_to_str:N ^ + } + { + \polyglossia_latin_put_breve:N + } + } + } + +\cs_new:Npn \polyglossia_latin_apply_quotemark:N #1 + { + \str_case:nnF {#1} + { + {A} { \polyglossia_latin_digraph_shorthand:Nnn E { Æ } + { + \polyglossia_latin_digraph_shorthand:Nnn e { Æ } + { + \polyglossia_latin_allow_hyphens: A + } + } + } + {a} { \polyglossia_latin_digraph_shorthand:Nnn e { æ } + { + \polyglossia_latin_allow_hyphens: a + } + } + {O} { \polyglossia_latin_digraph_shorthand:Nnn E { Œ } + { + \polyglossia_latin_digraph_shorthand:Nnn e { Œ } + { + \polyglossia_latin_allow_hyphens: O + } + } + } + {o} { \polyglossia_latin_digraph_shorthand:Nnn e { œ } + { + \polyglossia_latin_allow_hyphens: o + } + } + {|} { \polyglossia_latin_allow_hyphens: } + {<} { « } + {>} { » } + } + { + \token_if_letter:NTF #1 { \polyglossia_latin_allow_hyphens: #1 } + { + \token_if_eq_meaning:NNTF #1 \AE { \polyglossia_latin_allow_hyphens: #1 } + { + \token_if_eq_meaning:NNTF #1 \ae { \polyglossia_latin_allow_hyphens: #1 } + { + \token_if_eq_meaning:NNTF #1 \OE { \polyglossia_latin_allow_hyphens: #1 } + { + \token_if_eq_meaning:NNTF #1 \oe { \polyglossia_latin_allow_hyphens: #1 } + { + \token_to_str:N " + #1 + } + } + } + } + } + } + } + +\cs_new:Npn \polyglossia_latin_put_acute:N #1 + { + \str_case:nnF {#1} + { + {A} { \polyglossia_latin_digraph_shorthand:Nnn E { Ǽ } + { + \polyglossia_latin_digraph_shorthand:Nnn e { Ǽ } { Á } + } + } + {a} { \polyglossia_latin_digraph_shorthand:Nnn e { ǽ } { á } } + {E} { É } + {e} { é } + {I} { Í } + {i} { í } + {O} { \polyglossia_latin_digraph_shorthand:Nnn E { \'Œ } + { + \polyglossia_latin_digraph_shorthand:Nnn e { \'Œ } { Ó } + } + } + {o} { \polyglossia_latin_digraph_shorthand:Nnn e { \'œ } { ó } } + {U} { Ú } + {u} { ú } + {V} { \' V } % V may be a vowel, but lowercase v is never used as a vowel. + {Y} { Ý } + {y} { ý } + {Æ} { Ǽ } + {æ} { ǽ } + {Œ} { \'Œ } + {œ} { \'œ } + } + { + \token_if_eq_meaning:NNTF #1 \AE { Ǽ } + { + \token_if_eq_meaning:NNTF #1 \ae { ǽ } + { + \token_if_eq_meaning:NNTF #1 \OE { \'Œ } + { + \token_if_eq_meaning:NNTF #1 \oe { \'œ } + { + \token_to_str:N ' + #1 + } + } + } + } + } + } + +\cs_new:Npn \polyglossia_latin_put_macron:N #1 + { + \str_case:nnF {#1} + { + {A} { \polyglossia_latin_diphthong_macron:NNn AE + { + \polyglossia_latin_diphthong_macron:NNn Ae + { + \polyglossia_latin_diphthong_macron:NNn AU + { + \polyglossia_latin_diphthong_macron:NNn Au { Ā } + } + } + } + } + {a} { \polyglossia_latin_diphthong_macron:NNn ae + { + \polyglossia_latin_diphthong_macron:NNn au { ā } + } + } + {E} { \polyglossia_latin_diphthong_macron:NNn EU + { + \polyglossia_latin_diphthong_macron:NNn Eu { Ē } + } + } + {e} { \polyglossia_latin_diphthong_macron:NNn eu { ē } } + {I} { Ī } + {i} { ī } + {O} { \polyglossia_latin_diphthong_macron:NNn OE + { + \polyglossia_latin_diphthong_macron:NNn Oe { Ō } + } + } + {o} { \polyglossia_latin_diphthong_macron:NNn oe { ō } } + {U} { Ū } + {u} { ū } + {V} { \= V } % V may be a vowel, but lowercase v is never used as a vowel. + {Y} { Ȳ } + {y} { ȳ } + } + { + \token_to_str:N = + #1 + } + } + +\cs_new:Npn \polyglossia_latin_put_breve:N #1 + { + \str_case:nnF {#1} + { + {A} { Ă } + {a} { ă } + {E} { Ĕ } + {e} { ĕ } + {I} { Ĭ } + {i} { ĭ } + {O} { Ŏ } + {o} { ŏ } + {U} { Ŭ } + {u} { ŭ } + {V} { \u{V} } % V may be a vowel, but lowercase v is never used as a vowel. + {Y} { \u{Y} } + {y} { \u{y} } + } + { + \token_to_str:N ^ + #1 + } + } + + +\cs_new:Npn \polyglossia_latin_allow_hyphens: + { + \bbl@allowhyphens + \discretionary {-} {} {} + \bbl@allowhyphens + } + +\cs_new:Npn \polyglossia_latin_digraph_shorthand:Nnn #1#2#3 +% #1: second letter of digraph (E or e) +% #2: digraph character +% #3: non-digraph code + { + \bool_if:NTF \l_polyglossia_latin_use_digraphs_bool + { + \peek_meaning_remove:NTF #1 {#2} {#3} + } + { + #3 + } + } + +\cs_new:Npn \polyglossia_latin_diphthong_macron:NNn #1#2#3 +% #1: first character of diphthong +% #2: second character of diphthong +% #3: non-diphthong code + { + \peek_meaning:NTF #2 { #1 \char "35E \relax } {#3} % U+35E: combining double macron + } + +\cs_new:Npn \polyglossia_latin_no_shorthands: + { + \bbl@deactivate {"} + \bbl@deactivate {'} + \bbl@deactivate {=} + \bbl@deactivate {^} + % The active '=' character may cause problems with key=value interfaces. + % We have to make sure here that no problems can occur outside a Latin + % prosodic shorthand environment. + \shorthandoff {=} + } + + +%%%%% Further settings + +\let \xpgla@savedvalues \empty + +\AtEndPreamble + { + \edef \xpgla@savedvalues + { + \clubpenalty = \the \clubpenalty \space + \@clubpenalty = \the \@clubpenalty \space + \widowpenalty = \the \widowpenalty \space + \finalhyphendemerits = \the \finalhyphendemerits + } + } + +\def \noextras@latin + { + \polyglossia_latin_no_shorthands: + \xpgla@savedvalues + \polyglossia_latin_no_punctuation_spacing: + \polyglossia_latin_modern_character_codes: + } + +\cs_new:Npn \polyglossia_latin_inline_extras: + { + \bool_if:NF \l_polyglossia_latin_use_v_bool + { + \polyglossia_latin_classical_character_codes: + } + \bool_if:NT \l_polyglossia_latin_punctuation_spacing_bool + { + \polyglossia_latin_punctuation_spacing: + } + \iflatin@babelshorthands + \polyglossia_latin_shorthands: \fi - \fi - \xpgla@@nextdq}% -\def\xpgla@putacute#1{\let\xpgla@nextsq\relax% -\if a\xpgla@temp@A - æ\kern-0.175em^^^^0301\kern0.175em\xpgla@allowhyphens -\else -\if o\xpgla@temp@A - œ\kern-0.175em^^^^0301\kern0.175em\xpgla@allowhyphens -\else - \if æ\xpgla@temp@A - æ^^^^0301% - \else - \if œ\xpgla@temp@A - œ^^^^0301% - \else - \string'% + \iflatin@prosodicshorthands + \polyglossia_latin_prosodic_shorthands: \fi - \fi -\fi -\fi}% - -\def\nolatin@shorthands{% - \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}% - \@ifundefined{initiate@active@char}{}{\bbl@deactivate{'}}% -} - -\let\xpgla@savedvalues\empty -\AtEndPreamble{% - \edef\xpgla@savedvalues{% - \clubpenalty=\the\clubpenalty\space - \@clubpenalty=\the\@clubpenalty\space - \widowpenalty=\the\widowpenalty\space - \finalhyphendemerits=\the\finalhyphendemerits} -} -\def\noextras@latin{% - \lccode\string"2019=\z@ - \nolatin@shorthands - \xpgla@savedvalues - \noclassicuclccodes - \iflatin@ecclesiastic - \unless\ifluatex\noecclesiasticlatin@punctuation - \let\@makefntext\latin@original@makefntext\fi - \fi -} - -\def\blockextras@latin{% - \lccode\string"2019=\string"2019 - \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000 - \finalhyphendemerits=50000000 - \ifclassic\classicuclccodes\fi - \iflatin@babelshorthands\latin@shorthands\fi - \iflatin@ecclesiastic\unless\ifluatex\ecclesiasticlatin@punctuation - \let\@makefntext\latin@ecclesiastic@makefntext\fi - \fi -} - -\def\inlineextras@latin{% - \lccode\string"2019=\string"2019 - \ifclassic\classicuclccodes\fi - \iflatin@babelshorthands\latin@shorthands\fi - \iflatin@ecclesiastic - \unless\ifluatex\ecclesiasticlatin@punctuation - \let\@makefntext\latin@ecclesiastic@makefntext\fi - \fi -} + } + +\def \blockextras@latin + { + % The following four values were overtaken from the Italian language module. + % It is unclear why they were chosen. + \clubpenalty = 3000 + \@clubpenalty = 3000 + \widowpenalty = 3000 + \finalhyphendemerits = 50000000 + \polyglossia_latin_inline_extras: + } + +\def \inlineextras@latin + { + \polyglossia_latin_inline_extras: + } + + +%% Default settings + +\polyglossia_latin_modern_settings: + +\ExplSyntaxOff + %% Copyright (C) Claudio Beccari 2013-2016 -%% Copyright (C) Élie Roux 2016 -%% +%% Copyright (C) Élie Roux 2016-2019 +%% Copyright (C) Keno Wehr 2019 +%% %% Permission is hereby granted, free of charge, to any person obtaining %% a copy of this software and associated documentation files %% (the "Software"), to deal in the Software without restriction, including @@ -300,10 +909,10 @@ %% distribute, sublicense, and/or sell copies of the Software, and to permit %% persons to whom the Software is furnished to do so, subject to the following %% conditions: -%% +%% %% The above copyright notice and this permission notice shall be included in %% all copies or substantial portions of the Software. -%% +%% %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR %% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, %% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-latinclassic.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-latinclassic.ldf new file mode 100644 index 00000000000..6c1f4dbfa0b --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-latinclassic.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-latinclassic.ldf}[polyglossia: module for classic latin] + +% We provide this as a babel alias + +\xpg@load@master@language{latin} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-latinecclesiastic.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-latinecclesiastic.ldf new file mode 100644 index 00000000000..a8198310f5c --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-latinecclesiastic.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-latinecclesiastic.ldf}[polyglossia: module for ecclesiastic latin] + +% We provide this as a babel alias + +\xpg@load@master@language{latin} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-latinmedieval.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-latinmedieval.ldf new file mode 100644 index 00000000000..98920c2f5c0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-latinmedieval.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-latinmedieval.ldf}[polyglossia: module for medieval latin] + +% We provide this as a babel alias + +\xpg@load@master@language{latin} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-lowersorbian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-lowersorbian.ldf new file mode 100644 index 00000000000..e6f4604722d --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-lowersorbian.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-lowersorbian.ldf}[polyglossia: module for lower sorbian] + +% We provide this as a babel alias + +\xpg@load@master@language{sorbian} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-lsorbian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-lsorbian.ldf index c57304b8936..3bef1d2b945 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-lsorbian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-lsorbian.ldf @@ -3,18 +3,6 @@ % We only provide this gloss for babel compatibility. Since lsorbian is % a sorbian variety, we use 'sorbian' with variant 'lower' now. -\input{gloss-sorbian.ldf} - -\PolyglossiaSetup{lsorbian}{ - language=Lower Sorbian, - babelname=lowersorbian, - hyphennames={lsorbian,lowersorbian,Lsorbian}, - langtag=LSB, - hyphenmins={2,2}, - fontsetup=true, -} - -\let\captionslsorbian\captionssorbian@lsorbian -\let\datelsorbian\datesorbian@lsorbian +\xpg@load@master@language{sorbian} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-magyar.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-magyar.ldf index b4b05b6288f..fa56daeaea5 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-magyar.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-magyar.ldf @@ -2,19 +2,6 @@ % We only provide this gloss for babel compatibility. -\input{gloss-hungarian.ldf} - -\PolyglossiaSetup{magyar}{ - hyphennames={magyar,hungarian}, - langtag=HUN, - hyphenmins={2,2}, - fontsetup=true, -} - -\let\captionsmagyar\captionshungarian -\let\datemagyar\datehungarian -\let\ondatemagyar\ondatehungarian -\let\blockextras@magyar\blockextras@hungarian -\let\noextras@magyar\noextras@hungarian +\xpg@load@master@language{hungarian} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf index ce617ab0b91..819dbf31469 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf @@ -9,6 +9,13 @@ hyphenmins={2,2}, fontsetup=true} +% Babel aliases +\setlanguagealias[variant=indonesian]{malay}{bahasai} +\setlanguagealias[variant=malaysian]{malay}{bahasa} + +% Backwards compat. alias +\setlanguagealias[variant=malaysian]{malay}{bahasam} + \providebool{malay@melayu} \malay@melayufalse \def\malay@variant{malay} diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf index 9f761c3a566..0d6f896fb35 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf @@ -1,6 +1,6 @@ \ProvidesFile{gloss-mongolian.ldf}[polyglossia: module for mongolian] -\RequirePackage{cyrillicnumbers} +\RequirePackage{xpg-cyrillicnumbers} \PolyglossiaSetup{mongolian}{ script=Cyrillic, diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-naustrian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-naustrian.ldf new file mode 100644 index 00000000000..8820bf11fb6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-naustrian.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-naustrian.ldf}[polyglossia: module for austrian german (current spelling)] + +% We provide this as a babel alias + +\xpg@load@master@language{german} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-newzealand.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-newzealand.ldf new file mode 100644 index 00000000000..90fcbcb524b --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-newzealand.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-newzealand.ldf}[polyglossia: module for newzealand english] + +% We provide this as a babel alias + +\xpg@load@master@language{english} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-ngerman.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-ngerman.ldf new file mode 100644 index 00000000000..b70b33e3caf --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-ngerman.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-ngerman.ldf}[polyglossia: module for german (current spelling)] + +% We provide this as a babel alias + +\xpg@load@master@language{german} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-norsk.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-norsk.ldf index 7e08546c149..4885e118fe2 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-norsk.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-norsk.ldf @@ -3,18 +3,7 @@ % We only provide this gloss for babel compatibility. Since norsk is % actually norwegian bokmal, we use 'norwegian' with variant 'bokmal' now. -\input{gloss-norwegian.ldf} - -\PolyglossiaSetup{norsk}{ - hyphennames={norsk}, - hyphenmins={2,2}, - langtag=NOR, - frenchspacing=true, - fontsetup=true, -} - -\let\captionsnorsk\captionsnorwegian@norsk -\let\datenorsk\datenorwegian@norsk +\xpg@load@master@language{norwegian} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-norwegian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-norwegian.ldf index 47d5affa74a..f06119053d0 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-norwegian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-norwegian.ldf @@ -7,6 +7,10 @@ fontsetup=false, } +% Babel and backwards compat. aliases +\setlanguagealias[variant=bokmal]{norwegian}{norsk} +\setlanguagealias[variant=nynorsk]{norwegian}{nynorsk} + \def\norwegian@variant{nynorsk} \define@choicekey*+{norwegian}{variant}[\val\nr]{nynorsk,bokmal}[nynorsk]{% \ifcase\nr\relax diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-nswissgerman.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-nswissgerman.ldf new file mode 100644 index 00000000000..9143ccfa039 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-nswissgerman.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-nswissgerman.ldf}[polyglossia: module for swiss german (current spelling)] + +% We provide this as a babel alias + +\xpg@load@master@language{german} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-nynorsk.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-nynorsk.ldf index 4b63ab64eae..0ec96170557 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-nynorsk.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-nynorsk.ldf @@ -3,18 +3,7 @@ % We only provide this gloss for babel compatibility. Since nynorsk is % a norwegian variety, we use 'norwegian' with variant 'nynorsk' now. -\input{gloss-norwegian.ldf} - -\PolyglossiaSetup{nynorsk}{ - hyphennames={nynorsk}, - langtag=NYN, - hyphenmins={2,2}, - frenchspacing=true, - fontsetup=true, -} - -\let\captionsnorsk\captionsnorwegian@nynorsk -\let\datenorsk\datenorwegian@nynorsk +\xpg@load@master@language{norwegian} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-persian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-persian.ldf index a874e3943ec..6dc2c72a0b6 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-persian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-persian.ldf @@ -20,6 +20,9 @@ and may look very wrong.} localnumeral=farsinumerals } +% Babel and backwards compat. alias +\setlanguagealias{persian}{farsi} + \newif\if@western@numerals \def\tmp@western{western} \define@key{persian}{numerals}[eastern]{% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-polutonikogreek.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-polutonikogreek.ldf new file mode 100644 index 00000000000..2d6b3b55c90 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-polutonikogreek.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-polutonikogreek.ldf}[polyglossia: module for polytonic greek] + +% We provide this as a babel alias + +\xpg@load@master@language{greek} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-portuges.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-portuges.ldf index 906f3d546c5..8a5aa176c17 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-portuges.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-portuges.ldf @@ -1,25 +1,10 @@ -\ProvidesFile{gloss-portuges.ldf}[polyglossia: module for portuguese (DEPRECATED!)] +\ProvidesFile{gloss-portuges.ldf}[polyglossia: module for portuguese] % We only provide this gloss for backwards compatibility. The name % 'portuges' was selected in accordance with babel (which probably % introduced it in 8.3 filename times). Since polyglossia uses full % English language names, we use 'portuguese' now. -% FIXME: Once we support babel aliases (#112) this gloss can go. - -\xpg@warning{The language name 'portuges' is deprectated.\MessageBreak - Please use 'portuguese' instead.} - -\input{gloss-portuguese.ldf} - -\PolyglossiaSetup{portuges}{ - hyphennames={portuges,portuguese}, - hyphenmins={2,3}, - langtag=PTG, - fontsetup=true, -} - -\let\captionsportuges\captionsportuguese@portuges -\let\dateportuges\dateportuguese@portuges +\xpg@load@master@language{portuguese} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf index 35e7bfae907..2463006cc67 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf @@ -1,4 +1,5 @@ \ProvidesFile{gloss-portuguese.ldf}[polyglossia: module for portuguese] + \PolyglossiaSetup{portuguese}{ babelname=portuges, hyphennames={portuges,portuguese}, @@ -7,11 +8,16 @@ fontsetup=true, } +% Babel aliases +\setlanguagealias[variant=portuguese]{portuguese}{portuges} +\setlanguagealias[variant=brazilian]{portuguese}{brazil} + \def\portuguese@variant{portuges} \define@choicekey*+{portuguese}{variant}[\val\nr]{portuguese,brazilian}[portuguese]{% \ifcase\nr\relax % portuguese: \def\portuguese@variant{portuges}% + \SetLanguageKeys{portuguese}{babelname=portuges}% \or % brazilian: \def\portuguese@variant{brazil}% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf index f969aa258d3..f638bdbf7d8 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf @@ -1,6 +1,6 @@ \ProvidesFile{gloss-russian.ldf}[polyglossia: module for russian] -\RequirePackage{cyrillicnumbers} +\RequirePackage{xpg-cyrillicnumbers} \PolyglossiaSetup{russian}{ script=Cyrillic, @@ -9,6 +9,7 @@ hyphennames={russian}, hyphenmins={2,2}, frenchspacing=true, + indentfirst=true, fontsetup, localnumeral=russiannumerals, Localnumeral=Russiannumerals @@ -36,6 +37,14 @@ {\cyrillic@numeralsfalse}% } +\define@boolkey{russian}[russian@]{indentfirst}{ + \ifrussian@indentfirst + \SetLanguageKeys{russian}{indentfirst=true} + \else + \SetLanguageKeys{russian}{indentfirst=false} + \fi +} + \define@boolkey{russian}[russian@]{babelshorthands}[false]{} \setkeys{russian}{spelling,numerals} diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-sami.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-sami.ldf index e249a2f675d..991755d309d 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-sami.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-sami.ldf @@ -9,6 +9,10 @@ fontsetup=true, } +% Babel and backwards compat. alias +\setlanguagealias{sami}{samin} +%\setlanguagealias[variant=northern]{sami}{samin} + % TODO: Add other Sami varieties \def\sami@variant{northern} %\define@choicekey*+{sami}{variant}[\val\nr]{northern}[nothern]{% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-samin.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-samin.ldf index e91698f4335..16df9ae0e57 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-samin.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-samin.ldf @@ -3,17 +3,6 @@ % We only provide this gloss for babel compatibility. Since samin is % a sami variety, we use 'sami' with variant 'northern' now. -\input{gloss-sami.ldf} - -\PolyglossiaSetup{samin}{ - hyphennames={samin}, - hyphenmins={2,2}, - language={Northern Sami}, - langtag=NSM, - fontsetup=true, -} - -\let\captionssamin\captionssami@nothern -\let\datesamin\datesami@nothern +\xpg@load@master@language{sami} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf index 0f988f69fa9..7d38e3b0b7d 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf @@ -24,6 +24,8 @@ and may look very wrong.} }% } +\define@key{sanskrit}{script}[Devanagari]{\setkeys{sanskrit}{Script=#1}} + \def\fontsetup@sanskrit@Devanagari{% \SetLanguageKeys{sanskrit}{scripttag=deva,script=Devanagari} \xpg@fontsetup@nonlatin{sanskrit}} @@ -48,16 +50,20 @@ and may look very wrong.} \setkeys{sanskrit}{Script} %sets the default for Devanagari -\def\tmp@western{Western} + \newif\ifsanskrit@devanagari@numerals \sanskrit@devanagari@numeralstrue +\define@choicekey*+{sanskrit}{numerals}[\val\nr]{Devanagari,Western}[Devanagari]{% + \ifcase\nr\relax + % Devanagari: + \sanskrit@devanagari@numeralstrue% + \or + % Western: + \sanskrit@devanagari@numeralsfalse% + \fi + \xpg@info{Option: Sanskrit, numerals=\val}% +}{\xpg@warning{Unknown Sanskrit numeral `#1'}} -\define@key{sanskrit}{numerals}[Devanagari]{% - \def\@tmpa{#1}% - \ifx\@tmpa\tmp@western - \sanskrit@devanagari@numeralsfalse - \fi% -} \newcommand{\sanskritnumerals}[2]{\sanskritnumber{#2}} @@ -69,34 +75,45 @@ and may look very wrong.} \fi% } -% FIXME: Support LuaTeX -\ifxetex - \newXeTeXintercharclass\sanskrit@punctthin % ! ? ; : danda double_danda +\ifluatex + \directlua{require('polyglossia-sanskrit')}% +\else + \newXeTeXintercharclass\sanskrit@punctthin % ! ? ‼ ⁇ ⁈ ⁉ : ; danda double_danda \fi \def\sanskrit@punctthinspace{{\unskip\thinspace}} \def\sanskrit@punctuation{% - % FIXME: Support LuaTeX - \ifxetex + \ifluatex + \directlua{polyglossia.activate_sanskrit_punct()}% + \else \XeTeXinterchartokenstate=1% \XeTeXcharclass `\! \sanskrit@punctthin \XeTeXcharclass `\? \sanskrit@punctthin - \XeTeXcharclass `\; \sanskrit@punctthin + \XeTeXcharclass `\‼ \sanskrit@punctthin + \XeTeXcharclass `\⁇ \sanskrit@punctthin + \XeTeXcharclass `\⁈ \sanskrit@punctthin + \XeTeXcharclass `\⁉ \sanskrit@punctthin \XeTeXcharclass `\: \sanskrit@punctthin - \XeTeXcharclass `\। \sanskrit@punctthin - \XeTeXcharclass `\॥ \sanskrit@punctthin + \XeTeXcharclass `\; \sanskrit@punctthin + \XeTeXcharclass `\। \sanskrit@punctthin % danda, U+0964 + \XeTeXcharclass `\॥ \sanskrit@punctthin % double danda, U+0965 \XeTeXinterchartoks \z@ \sanskrit@punctthin = \sanskrit@punctthinspace \fi } \def\nosanskrit@punctuation{% - % FIXME: Support LuaTeX - \ifxetex + \ifluatex + \directlua{polyglossia.deactivate_sanskrit_punct()}% + \else \XeTeXcharclass `\! \z@ \XeTeXcharclass `\? \z@ - \XeTeXcharclass `\; \z@ + \XeTeXcharclass `\‼ \z@ + \XeTeXcharclass `\⁇ \z@ + \XeTeXcharclass `\⁈ \z@ + \XeTeXcharclass `\⁉ \z@ \XeTeXcharclass `\: \z@ + \XeTeXcharclass `\; \z@ \XeTeXcharclass `\। \z@ \XeTeXcharclass `\॥ \z@ \XeTeXinterchartokenstate=0% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-scottish.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-scottish.ldf index 14a2388441f..4af54cb39d7 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-scottish.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-scottish.ldf @@ -3,16 +3,6 @@ % We only provide this gloss for babel compatibility. Since scottish is % a gaelic variety, we use 'gaelic' with variant 'scottish' now. -\input{gloss-gaelic.ldf} - -\PolyglossiaSetup{scottish}{ - hyphennames={scottish}, - hyphenmins={2,2}, - langtag=GAE, - fontsetup=true, -} - -\let\captionsscottish\captionsgaelic@scottish -\let\datescottish\dategaelic@scottish +\xpg@load@master@language{gaelic} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf index 1f03368db65..b06adb1f46d 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf @@ -4,7 +4,7 @@ %% same thing for all languages that have a "script" key ! %% BETTER APPROACH: see gloss-sanskrit! -\RequirePackage{cyrillicnumbers} +\RequirePackage{xpg-cyrillicnumbers} \PolyglossiaSetup{serbian}{ langtag=SRB, @@ -17,25 +17,27 @@ %TODO localalph } +% Babel aliases +\setlanguagealias[script=Cyrillic]{serbian}{serbianc} + \newif\if@serbian@cyr +\define@choicekey*+{serbian}{Script}[\val\nr]{cyrillic,latin}[cyrillic]{% + \ifcase\nr\relax + % cyrillic: + \@serbian@cyrtrue + \SetLanguageKeys{serbian}{scripttag=cyrl,script=Cyrillic,babelname=serbianc} + \xpg@fontsetup@nonlatin{serbian}% + \or + % latin: + \@serbian@cyrfalse + \SetLanguageKeys{serbian}{scripttag=latn,script=Latin} + \xpg@fontsetup@latin{serbian}% + %TODO \def\serbian@language{\language=\l@serbianlat}% + % or should we use Croatian patterns as a fallback for the time being??? + \fi + \xpg@info{Option: Serbian, script=\val}% +}{\xpg@warning{Unknown Serbian script `#1'}} -\define@key{serbian}{Script}[Cyrillic]{% - \ifstrequal{#1}{Cyrillic}% - {\@serbian@cyrtrue - \SetLanguageKeys{serbian}{scripttag=cyrl,script=Cyrillic,babelname=serbianc} - \xpg@fontsetup@nonlatin{serbian}% - }% - {\ifstrequal{#1}{Latin}% - {\@serbian@cyrfalse - \SetLanguageKeys{serbian}{scripttag=latn,script=Latin} - \xpg@fontsetup@latin{serbian}% - %TODO \def\serbian@language{\language=\l@serbianlat}% - % or should we use Croatian patterns as a fallback for the time being??? - }% - {\xpg@error{Unknown script `#1' for Serbian language\MessageBreak - Valid values are "Cyrillic" and "Latin"}}% - }% -} \define@key{serbian}{script}[Cyrillic]{\setkeys{serbian}{Script=#1}} \newif\ifserbian@numerals diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-serbianc.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-serbianc.ldf new file mode 100644 index 00000000000..0095f855276 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-serbianc.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-serbianc.ldf}[polyglossia: module for serbian (cyrillic)] + +% We provide this as a babel alias + +\xpg@load@master@language{serbian} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf index b6fc910e350..417e43ba52b 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf @@ -7,6 +7,176 @@ fontsetup=true, } +\ifluatex + \RequirePackage{luavlna} +\fi + +\define@boolkey{slovak}[slovak@]{babelshorthands}[true]{} + +\define@boolkey{slovak}[slovak@]{splithyphens}[true]{} + +\define@boolkey{slovak}[slovak@]{vlna}[true]{} + +\setkeys{slovak}{splithyphens,vlna} + +\ifsystem@babelshorthands + \setkeys{slovak}{babelshorthands=true} +\else + \setkeys{slovak}{babelshorthands=false} +\fi + +\ifcsundef{initiate@active@char}{% + \input{babelsh.def}% + \initiate@active@char{"}% + \shorthandoff{"}% +}{} + +\def\slovak@@splhyphen#1{% + \kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}% + \nobreak\hskip\z@% +} + +\def\slovak@splhyphen{% + \slovak@@splhyphen{-}% +} + +\def\slovak@shorthands{% + \bbl@activate{"}% + \def\language@group{slovak}% + \declare@shorthand{slovak}{"=}{\slovak@splhyphen}% + \declare@shorthand{slovak}{""}{\hskip\z@skip}% + \declare@shorthand{slovak}{"~}{\textormath{\leavevmode\hbox{-}}{-}}% + \declare@shorthand{slovak}{"-}{\nobreak\-\bbl@allowhyphens}% + \declare@shorthand{slovak}{"|}{% + \textormath{\penalty\@M\discretionary{-}{}{\kern.03em}% + \bbl@allowhyphens}{}% + }% + \declare@shorthand{slovak}{"/}{\textormath + {\bbl@allowhyphens\discretionary{/}{}{/}\bbl@allowhyphens}{}}% + \declare@shorthand{slovak}{"`}{„}% + \declare@shorthand{slovak}{"'}{“}% + \declare@shorthand{slovak}{"<}{«}% + \declare@shorthand{slovak}{">}{»}% +} + +\def\noslovak@shorthands{% + \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}% +} + +\ifxetex + % splithyphens + \newXeTeXintercharclass\slovak@hyphen % - + % vlna + \newXeTeXintercharclass\slovak@openpunctuation + \newXeTeXintercharclass\slovak@nonsyllabicpreposition + \ifdefined\e@alloc@intercharclass@top + \chardef\slovak@boundary=\e@alloc@intercharclass@top + \else + \ifdefined\XeTeXinterwordspaceshaping + \chardef\slovak@boundary=4095 % + \def\newXeTeXintercharclass{% + \e@alloc\XeTeXcharclass\chardef + \xe@alloc@intercharclass\m@ne\@ucharclass@boundary} + \else + \chardef\slovak@boundary=255 + \fi + \fi +\fi + +\def\slovak@hyphens{% + \ifluatex + \AfterPreamble{\enablesplithyphens{slovak}}% + \else + \XeTeXinterchartokenstate=1 + \XeTeXcharclass `\- \slovak@hyphen + \XeTeXinterchartoks \z@ \slovak@hyphen = {\slovak@@splhyphen}% "-" -> "\slovak@@splhyphen-" + % necessary if used together with vlna: + \XeTeXinterchartoks \slovak@nonsyllabicpreposition \slovak@hyphen = {\slovak@@splhyphen}% "-" -> "\slovak@@splhyphen-" + \fi% +} + +\def\noslovak@hyphens{% + \ifluatex + \AfterPreamble{\disablesplithyphens{slovak}}% + \else + \XeTeXcharclass `\- \z@ + \fi% +} + +% Add nonbreakable space after single-letter word to +% prevent them to land at the end of a line +\def\slovak@vlna{% + \ifluatex + \preventsingleon + \else + % Code taken and adapted from xevlna.sty + \XeTeXinterchartokenstate=1 + \XeTeXcharclass `\( \slovak@openpunctuation + \XeTeXcharclass `\[ \slovak@openpunctuation + \XeTeXcharclass `\„ \slovak@openpunctuation + \XeTeXcharclass `\» \slovak@openpunctuation + \XeTeXcharclass `\K \slovak@nonsyllabicpreposition + \XeTeXcharclass `\k \slovak@nonsyllabicpreposition + \XeTeXcharclass `\S \slovak@nonsyllabicpreposition + \XeTeXcharclass `\s \slovak@nonsyllabicpreposition + \XeTeXcharclass `\V \slovak@nonsyllabicpreposition + \XeTeXcharclass `\v \slovak@nonsyllabicpreposition + \XeTeXcharclass `\Z \slovak@nonsyllabicpreposition + \XeTeXcharclass `\z \slovak@nonsyllabicpreposition + \XeTeXcharclass `\O \slovak@nonsyllabicpreposition + \XeTeXcharclass `\o \slovak@nonsyllabicpreposition + \XeTeXcharclass `\U \slovak@nonsyllabicpreposition + \XeTeXcharclass `\u \slovak@nonsyllabicpreposition + \XeTeXcharclass `\A \slovak@nonsyllabicpreposition + \XeTeXcharclass `\a \slovak@nonsyllabicpreposition + \XeTeXcharclass `\I \slovak@nonsyllabicpreposition + \XeTeXcharclass `\i \slovak@nonsyllabicpreposition + \XeTeXinterchartoks \slovak@boundary \slovak@nonsyllabicpreposition {\slovak@interchartoks} + \XeTeXinterchartoks \slovak@openpunctuation \slovak@nonsyllabicpreposition {\slovak@interchartoks} + \def\slovak@nointerchartoks{\let\slovak@interchartoks\slovak@PreCSpreposition} + \def\slovak@PreCSpreposition{\def\next{}% + \ifnum\catcode`\ =10 % nothing will be done in verbatim + \ifmmode % nothing in math + \else + \let\slovak@interchartoks\slovak@nointerchartoks + \let\next\slovak@ExamineCSpreposition + \fi \fi + \next% + } + \def\slovak@ExamineCSpreposition ##1{##1\futurelet\next\slovak@ProcessCSpreposition} + \def\slovak@ProcessCSpreposition{\ifx\next\slovak@XeTeXspace\nobreak\fi} + \futurelet\slovak@XeTeXspace{ }\slovak@nointerchartoks + \fi +} + +\def\noslovak@vlna{% + \ifluatex + \preventsingleoff + \else + \XeTeXcharclass`\(\z@ + \XeTeXcharclass`\[\z@ + \XeTeXcharclass`\„\z@ + \XeTeXcharclass`\»\z@ + \XeTeXcharclass`\K\z@ + \XeTeXcharclass`\k\z@ + \XeTeXcharclass`\S\z@ + \XeTeXcharclass`\s\z@ + \XeTeXcharclass`\V\z@ + \XeTeXcharclass`\v\z@ + \XeTeXcharclass`\Z\z@ + \XeTeXcharclass`\z\z@ + \XeTeXcharclass`\O\z@ + \XeTeXcharclass`\o\z@ + \XeTeXcharclass`\U\z@ + \XeTeXcharclass`\u\z@ + \XeTeXcharclass`\A\z@ + \XeTeXcharclass`\a\z@ + \XeTeXcharclass`\I\z@ + \XeTeXcharclass`\i\z@ + \fi +} + + \def\captionsslovak{% \def\refname{Referencie}% \def\abstractname{Abstrakt}% @@ -30,7 +200,7 @@ \def\headtoname{Pre}% was komu \def\proofname{Dôkaz}% \def\glossaryname{Slovník}% - } +} \def\dateslovak{% \def\today{\number\day.~\ifcase\month\or @@ -38,6 +208,25 @@ júna\or júla\or augusta\or septembra\or októbra\or novembra\or decembra\fi \space \number\year}% - } +} + +\def\noextras@slovak{% + \noslovak@shorthands% + \noslovak@hyphens% + \noslovak@vlna% + \ifxetex\XeTeXinterchartokenstate=0\fi% +} + +\def\blockextras@slovak{% + \ifslovak@babelshorthands\slovak@shorthands\fi% + \ifslovak@vlna\slovak@vlna\else\noslovak@vlna\fi% + \ifslovak@splithyphens\slovak@hyphens\else\noslovak@hyhens\fi% +} + +\def\inlineextras@slovak{% + \ifslovak@babelshorthands\slovak@shorthands\fi% + \ifslovak@vlna\slovak@vlna\else\noslovak@vlna\fi% + \ifslovak@splithyphens\slovak@hyphens\else\noslovak@hyhens\fi% +} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-slovene.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-slovene.ldf new file mode 100644 index 00000000000..361da73e905 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-slovene.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-slovene.ldf}[polyglossia: module for slovenian] + +% We provide this as a babel alias + +\xpg@load@master@language{slovenian} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-slovenian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-slovenian.ldf index 6ddba4cc2f0..16874a82c37 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-slovenian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-slovenian.ldf @@ -8,6 +8,9 @@ fontsetup=true, } +% Babel aliases +\setlanguagealias{slovenian}{slovene} + \providebool{slovenian@localalph} \define@boolkey{slovenian}[slovenian@]{localalph}[false]{% \def\@tmpa{#1}% diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-sorbian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-sorbian.ldf index ea137ea9dd3..0310cf77e32 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-sorbian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-sorbian.ldf @@ -9,6 +9,14 @@ fontsetup=true, } +% Backwards compat. aliases +\setlanguagealias[variant=lower]{sorbian}{lsorbian} +\setlanguagealias[variant=upper]{sorbian}{usorbian} + +% Babel aliases +\setlanguagealias[variant=lower]{sorbian}{lowersorbian} +\setlanguagealias[variant=upper]{sorbian}{uppersorbian} + \def\sorbian@variant{usorbian} \define@choicekey*+{sorbian}{variant}[\val\nr]{upper,lower}[upper]{% \ifcase\nr\relax diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf index 717202bdfed..951ad3d7a31 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf @@ -1,4 +1,5 @@ \ProvidesFile{gloss-spanish.ldf}[polyglossia: module for spanish] + \PolyglossiaSetup{spanish}{ hyphennames={spanish}, hyphenmins={2,2}, @@ -6,6 +7,152 @@ frenchspacing=true, indentfirst=true, fontsetup=true, + babelname=spanish +} + +% Babel aliases +\setlanguagealias[variant=mexican]{spanish}{spanishmx} + +\newif\if@spanish@mexico +\@spanish@mexicofalse +\define@choicekey*+{spanish}{variant}[\val\nr]{spanish,mexican}[spanish]{% + \ifcase\nr\relax + % spanish: + \@spanish@mexicofalse% + \SetLanguageKeys{spanish}{babelname=spanish}% + \or + % mexican: + \@spanish@mexicotrue% + \SetLanguageKeys{spanish}{babelname=spanishmx}% + \fi + \xpg@info{Option: spanish, variant=\val}% +}{\xpg@warning{Unknown spanish variant `#1'}} + +% Localized math operators à la babel +\newif\ifspanish@accentedoperators +\newif\ifspanish@spacedoperators +\newif\ifspanish@locoperators + +\define@choicekey*+{spanish}{spanishoperators}[\val\nr]{all,accented,spaced,none}[all]{% + \ifcase\nr\relax + % all: + \spanish@locoperatorstrue% + \spanish@accentedoperatorstrue% + \spanish@spacedoperatorstrue% + \or + % accented: + \spanish@locoperatorsfalse% + \spanish@accentedoperatorstrue% + \spanish@spacedoperatorsfalse% + \or + % spaced: + \spanish@locoperatorsfalse% + \spanish@accentedoperatorsfalse% + \spanish@spacedoperatorstrue% + \or + % none: + \spanish@locoperatorsfalse% + \spanish@accentedoperatorsfalse% + \spanish@spacedoperatorsfalse% + \fi + \xpg@info{Option: Spanish, spanishoperators=\val}% +}{\xpg@warning{Unknown spanishoperators value `#1'}} + +\let\xpg@save@lim\lim +\let\xpg@save@limsup\limsup +\let\xpg@save@liminf\liminf +\let\xpg@save@max\max +\let\xpg@save@min\min +\let\xpg@save@inf\inf +\let\xpg@save@bmod\bmod +\let\xpg@save@pmod\pmod + +\def\spanish@accentedoperators{% + \DeclareRobustCommand\lim{\mathop{\operator@font lím}}% + \DeclareRobustCommand\limsup{\mathop{\operator@font lím\,sup}}% + \DeclareRobustCommand\liminf{\mathop{\operator@font lím\,inf}}% + \DeclareRobustCommand\max{\mathop{\operator@font máx}}% + \DeclareRobustCommand\min{\mathop{\operator@font mín}}% + \DeclareRobustCommand\inf{\mathop{\operator@font ínf}}% + \DeclareRobustCommand\bmod{% + \nonscript\mskip-\medmuskip\mkern5mu% + \mathbin{\operator@font mód}\penalty900\mkern5mu% + \nonscript\mskip-\medmuskip}% + \@ifundefined{@amsmath@err}% + {\DeclareRobustCommand\pmod[1]{% + \allowbreak\mkern18mu({\operator@font mód}\,\,##1)}}% + {\let\xpg@save@mod\mod + \DeclareRobustCommand\mod[1]{\allowbreak\if@display\mkern18mu + \else\mkern12mu\fi{\operator@font mód}\,\,##1}% + \DeclareRobustCommand\pmod[1]{\pod{{\operator@font mód}% + \mkern6mu##1}}}% +} + +\def\nospanish@accentedoperators{% + \let\lim\xpg@save@lim% + \let\limsup\xpg@save@limsup% + \let\liminf\xpg@save@liminf% + \let\max\xpg@save@max% + \let\min\xpg@save@min% + \let\inf\xpg@save@inf% + \let\bmod\xpg@save@bmod% + \let\pmod\xpg@save@pmod% + \@ifundefined{@amsmath@err}{}{\let\mod\xpg@save@mod}% +} + +\let\xpg@save@arccos\arccos +\let\xpg@save@arcsin\arcsin +\let\xpg@save@arctan\arctan +\let\arcsen\arcsin +\let\arctg\arctan + + +\def\spanish@spacedoperators{% + \DeclareRobustCommand\arccos{\mathop{\operator@font arc\,cos}\nolimits}% + \DeclareRobustCommand\arcsin{\mathop{\operator@font arc\,sen}\nolimits}% + \DeclareRobustCommand\arctan{\mathop{\operator@font arc\,tg}\nolimits}% +} + +\def\nospanish@spacedoperators{% + \let\arccos\xpg@save@arccos% + \let\arcsen\arcsin% + \let\arctg\arctan% +} + + +\let\xpg@save@sin\sin +\let\xpg@save@tan\tan +\let\xpg@save@sinh\sinh +\let\xpg@save@tanh\tanh +\let\sen\sin +\let\tg\tan +\let\senh\sinh +\let\tgh\tanh + +\def\spanish@locoperators{% + \DeclareRobustCommand\sin{\mathop{\operator@font sen}\nolimits}% + \DeclareRobustCommand\tan{\mathop{\operator@font tg}\nolimits}% + \DeclareRobustCommand\sinh{\mathop{\operator@font senh}\nolimits}% + \DeclareRobustCommand\tanh{\mathop{\operator@font tgh}\nolimits}% +} + +\def\nospanish@locoperators{% + \let\sen\xpg@save@sin% + \let\tg\xpg@save@tan% + \let\sinh\xpg@save@sinh% + \let\tanh\xpg@save@tanh% + \let\sen\relax% + \let\tg\relax% + \let\senh\relax% + \let\tgh\relax% +} + +\newcommand*\spanishoperator[2][]{% + \ifx#1\\\\ + \protected@csxdef{#2}{\mathop{\operator@font #2}\nolimits}% + \else + \protected@csxdef{#2}{\mathop{\operator@font #1}\nolimits}% + \fi } \def\captionsspanish{% @@ -30,13 +177,38 @@ \def\alsoname{véase también}% \def\proofname{Prueba}% \def\glossaryname{Glosario}% - } + \if@spanish@mexico + \captionsspanish@mexico% + \fi% +} + +\def\captionsspanish@mexico{% + \def\tablename{Tabla}% +} \def\datespanish{% \def\today{\number\day~de~\ifcase\month\or enero\or febrero\or marzo\or abril\or mayo\or junio\or julio\or agosto\or septiembre\or octubre\or noviembre\or diciembre\fi\space de~\number\year}% - } +} + +\def\noextras@spanish{% + \nospanish@accentedoperators% + \nospanish@spacedoperators% + \nospanish@locoperators% +} + +\def\blockextras@spanish{% + \ifspanish@accentedoperators\spanish@accentedoperators\fi% + \ifspanish@spacedoperators\spanish@spacedoperators\fi% + \ifspanish@locoperators\spanish@locoperators\fi% +} + +\def\inlineextras@spanish{% + \ifspanish@accentedoperators\spanish@accentedoperators\fi% + \ifspanish@spacedoperators\spanish@spacedoperators\fi% + \ifspanish@locoperators\spanish@locoperators\fi% +} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-spanishmx.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-spanishmx.ldf new file mode 100644 index 00000000000..f7c72b8d542 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-spanishmx.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-spanishmx.ldf}[polyglossia: module for mexican spanish] + +% We provide this as a babel alias + +\xpg@load@master@language{spanish} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-swissgerman.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-swissgerman.ldf new file mode 100644 index 00000000000..4c96e7bd4ba --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-swissgerman.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-swissgerman.ldf}[polyglossia: module for swiss german (old spelling)] + +% We provide this as a babel alias + +\xpg@load@master@language{german} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-uppersorbian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-uppersorbian.ldf new file mode 100644 index 00000000000..fbe16f418da --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-uppersorbian.ldf @@ -0,0 +1,7 @@ +\ProvidesFile{gloss-uppersorbian.ldf}[polyglossia: module for upper sorbian] + +% We provide this as a babel alias + +\xpg@load@master@language{sorbian} + +\endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-usorbian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-usorbian.ldf index 7aa9dd32a80..ccdab425623 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/gloss-usorbian.ldf +++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-usorbian.ldf @@ -3,18 +3,6 @@ % We only provide this gloss for babel compatibility. Since usorbian is % a sorbian variety, we use 'sorbian' with variant 'upper' now. -\input{gloss-sorbian.ldf} - -\PolyglossiaSetup{usorbian}{ - language=Upper Sorbian, - babelname=uppersorbian, - hyphennames={usorbian,uppersorbian}, - hyphenmins={2,2}, - langtag=USB, - fontsetup=true, -} - -\let\captionsusorbian\captionssorbian@usorbian -\let\dateusorbian\datesorbian@usorbian +\xpg@load@master@language{sorbian} \endinput diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-french.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-french.lua new file mode 100644 index 00000000000..42396073eee --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-french.lua @@ -0,0 +1,52 @@ +require('polyglossia-punct') + +local function set_left_space(lang, char, kern, rubber) + polyglossia.add_left_spaced_character(lang, char, kern, "space", rubber) +end + +local function set_right_space(lang, char, kern, rubber) + polyglossia.add_right_spaced_character(lang, char, kern, "space", rubber) +end + +local function activate_french_punct(thincolonspace, autospaceguillemets) + -- We need different language tags here to make switching of options possible + -- within a paragraph. + local lang = "french" + if thincolonspace then + lang = lang.."-thincolon" + end + if autospaceguillemets then + lang = lang.."-autospace" + end + + polyglossia.activate_punct(lang) + polyglossia.clear_spaced_characters(lang) + + if thincolonspace then + set_left_space(lang, ':', 0.5) + else + set_left_space(lang, ':', 1, true) -- stretchable and shrinkable space + end + + set_left_space(lang, '!', 0.5) + set_left_space(lang, '?', 0.5) + set_left_space(lang, ';', 0.5) + set_left_space(lang, '‼', 0.5) + set_left_space(lang, '⁇', 0.5) + set_left_space(lang, '⁈', 0.5) + set_left_space(lang, '⁉', 0.5) + + if autospaceguillemets then + set_left_space(lang, '»', 0.5) + set_left_space(lang, '›', 0.5) + set_right_space(lang, '«', 0.5) + set_right_space(lang, '‹', 0.5) + end +end + +local function deactivate_french_punct() + polyglossia.deactivate_punct() +end + +polyglossia.activate_french_punct = activate_french_punct +polyglossia.deactivate_french_punct = deactivate_french_punct diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua deleted file mode 100644 index 9d0ae235f22..00000000000 --- a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-frpt.lua +++ /dev/null @@ -1,224 +0,0 @@ -require('polyglossia') -- just in case... - -local add_to_callback = luatexbase.add_to_callback -local remove_from_callback = luatexbase.remove_from_callback -local priority_in_callback = luatexbase.priority_in_callback - -local get_quad = luaotfload.aux.get_quad -- needs luaotfload > 20130516 - -local next, type = next, type - -local nodes, fonts, node = nodes, fonts, node - -local nodecodes = nodes.nodecodes - -local insert_node_before = node.insert_before -local insert_node_after = node.insert_after -local remove_node = node.remove -local has_attribute = node.has_attribute -local node_copy = node.copy -local new_node = node.new - -local math_code = nodecodes.math -local end_of_math = node.end_of_math -if not end_of_math then -- luatex < .76 - local traverse_nodes = node.traverse_id - local end_of_math = function (n) - for n in traverse_nodes(math_code, n.next) do - return n - end - end -end - --- node types according to node.types() -local glue_code = nodecodes.glue -local glue_spec_code = nodecodes.glue_spec -local glyph_code = nodecodes.glyph -local penalty_code = nodecodes.penalty -local kern_code = nodecodes.kern - --- we make a new node, so that we can copy it later on -local penalty_node = new_node(penalty_code) -penalty_node.penalty = 10000 - -local function get_penalty_node() - return node_copy(penalty_node) -end - --- same for glue node -local kern_node = new_node(kern_code) - -local function get_kern_node(dim) - local n = node_copy(kern_node) - n.kern = dim - return n -end - --- we have here all possible space characters, referenced by their --- unicode slot number, taken from char-def.lua -local space_chars = {[32]=1, [160]=1, [5760]=1, [6158]=1, [8192]=1, [8193]=1, [8194]=1, [8195]=1, - [8196]=1, [8197]=1, [8198]=1, [8199]=1, [8200]=1, [8201]=1, [8202]=1, [8239]=1, [8287]=1, [12288]=1} - --- from nodes-tst.lua, adapted -local function somespace(n,all) - if n then - local id = n.id - if id == glue_code then - return (all or (n.spec.width ~= 0)) and glue_code - elseif id == kern_code then - return (all or (n.kern ~= 0)) and kern_code - elseif id == glyph_code then - if space_chars[n.char] then - return true - else - return false - end - end - end - return false -end - --- idem -local function somepenalty(n,value) - if n then - local id = n.id - if id == penalty_code then - if value then - return n.penalty == value - else - return true - end - end - end - return false -end - -local xpgfrptattr = luatexbase.attributes['xpg@frpt'] - -local left=1 -local right=2 -local byte = unicode.utf8.byte - --- Now there is a good question: how do we now, in lua, what a \thinspace is? --- In the LaTeX source (ltspace.dtx) it is defined as: --- \def\thinspace{\kern .16667em }. I see no way of seeing if it has been --- overriden or not... So we stick to this value. -local thinspace = 0.16667 --- thickspace is defined in amsmath.sty as: --- \renewcommand{\;}{\mspace+\thickmuskip{.2777em}}. Same problem as above, we --- stick to this fixed value. -local thickspace = 0.2777 -- 5/18 - -local mappings = { - [byte(':')] = {left, thickspace}, --really? - [byte('!')] = {left, thinspace}, - [byte('?')] = {left, thinspace}, - [byte(';')] = {left, thinspace}, - [byte('‼')] = {left, thinspace}, - [byte('⁇')] = {left, thinspace}, - [byte('⁈')] = {left, thinspace}, - [byte('⁉')] = {left, thinspace}, - [byte('»')] = {left, thinspace}, - [byte('›')] = {left, thinspace}, - [byte('«')] = {right, thinspace}, - [byte('‹')] = {right, thinspace}, - } - -local function set_spacings(thinsp, thicksp) - for _, m in pairs(mappings) do - if m[2] == thinspace then - m[2] = thinsp - elseif m[2] == thickspace then - m[2] = thicksp - end - end - thickspace = thicksp - thinspace = thinsp -end - --- from typo-spa.lua -local function process(head) - local done = false - local start = head - -- head is always begin of par (whatsit), so we have at least two prev nodes - -- penalty followed by glue - while start do - local id = start.id - if id == glyph_code then - local attr = has_attribute(start, xpgfrptattr) - if attr and attr > 0 then - local char = start.char - local map = mappings[char] - --node.unset_attribute(start, xpgfrptattr) -- needed? - if map then - local quad = get_quad(start.font) -- might be optimized - local prev = start.prev - if map[1] == left and prev then - local prevprev = prev.prev - local somespace = somespace(prev,true) - -- TODO: there is a question here: do we override a preceding space or not?... - if somespace then - local somepenalty = somepenalty(prevprev,10000) - if somepenalty then - head = remove_node(head,prev) - head = remove_node(head,prevprev) - else - head = remove_node(head,prev) - end - end - insert_node_before(head,start,get_penalty_node()) - insert_node_before(head,start,get_kern_node(map[2]*quad)) - done = true - end - local next = start.next - if map[1] == right and next then - local nextnext = next.next - local somepenalty = somepenalty(next,10000) - if somepenalty then - local somespace = somespace(nextnext,true) - if somespace then - head = remove_node(head,next) - head = remove_node(head,nextnext) - end - else - local somespace = somespace(next,true) - if somespace then - head = remove_node(head,next) - end - end - insert_node_after(head,start,get_kern_node(map[2]*quad)) - insert_node_after(head,start,get_penalty_node()) - done = true - end - end - end - elseif id == math_code then - -- warning: this is a feature of luatex > 0.76 - start = end_of_math(start) -- weird, can return nil .. no math end? - end - if start then - start = start.next - end - end - return head, done -end - -local callback_name = "pre_linebreak_filter" - -local function activate() - if not priority_in_callback (callback_name, "polyglossia-frpt.process") then - add_to_callback(callback_name, process, "polyglossia-frpt.process", 1) - end -end - -local function desactivate() - if priority_in_callback (callback_name, "polyglossia-frpt.process") then - remove_from_callback(callback_name, "polyglossia-frpt.process") - end -end - -polyglossia.activate_frpt = activate -polyglossia.desactivate_frpt = desactivate -polyglossia.set_spacings = set_spacings -polyglossia.thinspace = thinspace -polyglossia.thickspace = thickpace diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-latin.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-latin.lua new file mode 100644 index 00000000000..05c65ffe8bb --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-latin.lua @@ -0,0 +1,31 @@ +require('polyglossia-punct') + +-- For ecclesiastic Latin (and sometimes for Italian) a very small space is +-- used for the punctuation. The ecclesiastic package uses a space of +-- 0.3\fontdimen2, where \fontdimen2 is a interword space, which is typically +-- between 1/4 and 1/3 of a quad. We choose a half of a \thinspace here. +local hairspace = 0.08333 -- 1/12 + +local function activate_latin_punct() + polyglossia.activate_punct('latin') + polyglossia.clear_spaced_characters('latin') + polyglossia.add_left_spaced_character('latin',':',hairspace,'quad') + polyglossia.add_left_spaced_character('latin','!',hairspace,'quad') + polyglossia.add_left_spaced_character('latin','?',hairspace,'quad') + polyglossia.add_left_spaced_character('latin',';',hairspace,'quad') + polyglossia.add_left_spaced_character('latin','‼',hairspace,'quad') + polyglossia.add_left_spaced_character('latin','⁇',hairspace,'quad') + polyglossia.add_left_spaced_character('latin','⁈',hairspace,'quad') + polyglossia.add_left_spaced_character('latin','⁉',hairspace,'quad') + polyglossia.add_left_spaced_character('latin','»',hairspace,'quad') + polyglossia.add_left_spaced_character('latin','›',hairspace,'quad') + polyglossia.add_right_spaced_character('latin','«',hairspace,'quad') + polyglossia.add_right_spaced_character('latin','‹',hairspace,'quad') +end + +local function deactivate_latin_punct() + polyglossia.deactivate_punct() +end + +polyglossia.activate_latin_punct = activate_latin_punct +polyglossia.deactivate_latin_punct = deactivate_latin_punct diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-punct.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-punct.lua new file mode 100644 index 00000000000..6af13714f00 --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-punct.lua @@ -0,0 +1,305 @@ +require('polyglossia') -- just in case... + +local add_to_callback = luatexbase.add_to_callback +local remove_from_callback = luatexbase.remove_from_callback +local priority_in_callback = luatexbase.priority_in_callback +local new_attribute = luatexbase.new_attribute + +local node = node + +local insert_node_before = node.insert_before +local insert_node_after = node.insert_after +local remove_node = node.remove +local has_attribute = node.has_attribute +local node_copy = node.copy +local new_node = node.new +local end_of_math = node.end_of_math +local getnext = node.getnext +local getprev = node.getprev + +-- node types according to node.types() +local glue_code = node.id"glue" +local glyph_code = node.id"glyph" +local penalty_code = node.id"penalty" +local kern_code = node.id"kern" +local math_code = node.id"math" + +-- we need some node subtypes +local userkern = 1 +local userskip = 0 +local removable_skip = { + [0] = true, -- userskip + [13] = true, -- spaceskip + [14] = true, -- xspaceskip +} + +-- we make a new node, so that we can copy it later on +local kern_node = new_node(kern_code) +kern_node.subtype = userkern -- this kern can be removed later on + +local function get_kern_node(dim) + local n = node_copy(kern_node) + n.kern = dim + return n +end + +local glue_node = new_node(glue_code) +glue_node.subtype = userskip + +local function get_glue_node(dim, stretch, shrink) + local n = node_copy(glue_node) + n.width = dim + n.stretch = stretch + n.shrink = shrink + return n +end + +local penalty_node = new_node(penalty_code) +penalty_node.penalty = 10000 + +local function get_penalty_node() + return node_copy(penalty_node) +end + +-- we have here all possible space characters, referenced by their unicode slot +-- number, taken from char-def.lua +local space_chars = {[32] = true, [160] = true, [5760] = true, [6158] = true, + [8192] = true, [8193] = true, [8194] = true, [8195] = true, [8196] = true, + [8197] = true, [8198] = true, [8199] = true, [8200] = true, [8201] = true, + [8202] = true, [8239] = true, [8287] = true, [12288] = true} + +-- from nodes-tst.lua, adapted +local function somespace(n) + if n then + local id, subtype = n.id, n.subtype + if id == glue_code then + -- it is dangerous to remove all the type of glue + return removable_skip[subtype] + elseif id == kern_code then + -- remove only user's kern + return subtype == userkern + elseif id == glyph_code then + return space_chars[n.char] + end + end +end + +-- we have here all left bracket characters, referenced by their unicode slot +local left_bracket_chars = {[40] = true, [123] = true, [91] = true, [10216] = true} + +local function someleftbracket(n) + if n then + local id = n.id + if id == glyph_code then + return left_bracket_chars[n.char] + end + end +end + +-- we have here all right bracket characters, referenced by their unicode slot +local right_bracket_chars = {[41] = true, [125] = true, [93] = true, [10217] = true} + +local function somerightbracket(n) + if n then + local id = n.id + if id == glyph_code then + return right_bracket_chars[n.char] + end + end +end + +-- idem +local function somepenalty(n, value) + if n then + local id = n.id + if id == penalty_code then + if value then + return n.penalty == value + else + return true + end + end + end +end + +local punct_attr = new_attribute("polyglossia_punct") + +local lang_id = {} +local lang_counter = 0 +local left_space = {} +local right_space = {} + +local function ensure_lang_id(lang) + if not lang_id[lang] then + lang_counter = lang_counter + 1 + lang_id[lang] = lang_counter + end + return lang_id[lang] +end + +local function clear_spaced_characters(lang) + local id = ensure_lang_id(lang) + left_space[id] = {} + right_space[id] = {} +end + +local function illegal_unit(unit) + if unit then + texio.write_nl('Illegal spacing unit "'..unit..'".') + else + texio.write_nl('Spacing unit is a nil value.') + end +end + +local function add_left_spaced_character(lang, char, kern, unit, rubber) +-- The parameter kern is a number meant as a fraction of the unit. +-- The unit can be "quad" (1em) or "space" (interword space). +-- The parameter rubber is a Boolean value indicating if the inserted space is +-- stretchable and shrinkable (only relevant if the unit is "space"). + local id = ensure_lang_id(lang) + if unit == "quad" or unit == "space" then + left_space[id][char] = {} + left_space[id][char]["kern"] = kern + left_space[id][char]["unit"] = unit + left_space[id][char]["rubber"] = rubber + else + illegal_unit(unit) + end +end + +local function add_right_spaced_character(lang, char, kern, unit, rubber) + local id = ensure_lang_id(lang) + if unit == "quad" or unit == "space" then + right_space[id][char] = {} + right_space[id][char]["kern"] = kern + right_space[id][char]["unit"] = unit + right_space[id][char]["rubber"] = rubber + else + illegal_unit(unit) + end +end + +-- from typo-spa.lua, adapted +local function process(head) + local current = head + while current do + local id = current.id + if id == glyph_code then + local attr = has_attribute(current, punct_attr) + if attr then + local char = utf8.char(current.char) -- requires Lua 5.3 + local leftspace = left_space[attr][char] + local rightspace = right_space[attr][char] + if leftspace or rightspace then + local fontparameters = fonts.hashes.parameters[current.font] + local unit, stretch, shrink, spacing_node + if leftspace then + local prev = getprev(current) + local space_exception = false + if prev then + local prevprev = getprev(prev) + -- do not add space after left (opening) bracket + space_exception = someleftbracket(prev) + if somespace(prev) then + -- TODO: there is a question here: do we override a preceding space or not?... + if somepenalty(prevprev, 10000) then + head = remove_node(head, prevprev) + end + head = remove_node(head, prev) + end + end + if leftspace.unit == "quad" then + unit = fontparameters.quad + spacing_node = get_kern_node(leftspace.kern*unit) + elseif leftspace.unit == "space" then + unit = fontparameters.space + if leftspace.rubber then + stretch = leftspace.kern*fontparameters.space_stretch + shrink = leftspace.kern*fontparameters.space_shrink + spacing_node = get_glue_node(leftspace.kern*unit, stretch, shrink) + head = insert_node_before(head, current, get_penalty_node()) + else + spacing_node = get_kern_node(leftspace.kern*unit) + end + end + if not space_exception then + head = insert_node_before(head, current, spacing_node) + end + end + if rightspace then + local next = getnext(current) + local space_exception = false + if next then + -- do not add space before right (closing) bracket + space_exception = somerightbracket(next) + local nextnext = getnext(next) + if somepenalty(next, 10000) and somespace(nextnext) then + head = remove_node(head, next) + head = remove_node(head, nextnext) + elseif somespace(next) then + head = remove_node(head, next) + end + end + if rightspace.unit == "quad" then + unit = fontparameters.quad + spacing_node = get_kern_node(rightspace.kern*unit) + elseif rightspace.unit == "space" then + unit = fontparameters.space + if rightspace.rubber then + stretch = rightspace.kern*fontparameters.space_stretch + shrink = rightspace.kern*fontparameters.space_shrink + spacing_node = get_glue_node(rightspace.kern*unit, stretch, shrink) + if not space_exception then + head, current = insert_node_after(head, current, get_penalty_node()) + end + else + spacing_node = get_kern_node(rightspace.kern*unit) + end + end + if not space_exception then + head, current = insert_node_after(head, current, spacing_node) + end + end + end + end + elseif id == math_code then + -- warning: this is a feature of luatex > 0.76 + current = end_of_math(current) -- weird, can return nil .. no math end? + end + current = getnext(current) -- no error even if current is nil + end + return head +end + +local function activate(lang) + local id = ensure_lang_id(lang) + -- We set the punctuation attribute to a language id here. This is + -- important to be able to intermix languages with different spacings + -- in one paragraph. + tex.setattribute(punct_attr, id) + for _, callback_name in ipairs{ "pre_linebreak_filter", "hpack_filter" } do + if not priority_in_callback(callback_name, "polyglossia-punct.process") then + add_to_callback(callback_name, process, "polyglossia-punct.process", 1) + end + end +end + +local function deactivate() + tex.setattribute(punct_attr, -0x7FFFFFFF) -- this value means "unset" + -- Though it would make compilation slightly faster, it is not possible to + -- safely uncomment the following lines. Imagine the following case: you + -- start a paragraph by some spaced punctuation text, then, in the same + -- paragraph, you change the language to something else, and thus call the + -- following lines. This means that, at the end of the paragraph, the + -- function won't be in the callback, so the beginning of the paragraph + -- won't be processed by it. + -- if priority_in_callback(callback_name, "polyglossia-punct.process") then + -- remove_from_callback(callback_name, "polyglossia-punct.process") + -- end +end + +polyglossia.activate_punct = activate +polyglossia.deactivate_punct = deactivate +polyglossia.add_left_spaced_character = add_left_spaced_character +polyglossia.add_right_spaced_character = add_right_spaced_character +polyglossia.clear_spaced_characters = clear_spaced_characters diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia-sanskrit.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-sanskrit.lua new file mode 100644 index 00000000000..b2546dcad2a --- /dev/null +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia-sanskrit.lua @@ -0,0 +1,30 @@ +require('polyglossia-punct') + +-- How do we now, in Lua, what a \thinspace is? In the LaTeX source (latex.ltx) +-- it is defined as: +-- \def\thinspace{\leavevmode@ifvmode\kern .16667em } +-- I see no way of seeing if it has been overriden or not. So we stick to this +-- value. +local thinspace = 0.16667 -- 1/6 + +local function activate_sanskrit_punct() + polyglossia.activate_punct('sanskrit') + polyglossia.clear_spaced_characters('sanskrit') + polyglossia.add_left_spaced_character('sanskrit','!',thinspace,'quad') + polyglossia.add_left_spaced_character('sanskrit','?',thinspace,'quad') + polyglossia.add_left_spaced_character('sanskrit','‼',thinspace,'quad') + polyglossia.add_left_spaced_character('sanskrit','⁇',thinspace,'quad') + polyglossia.add_left_spaced_character('sanskrit','⁈',thinspace,'quad') + polyglossia.add_left_spaced_character('sanskrit','⁉',thinspace,'quad') + polyglossia.add_left_spaced_character('sanskrit',':',thinspace,'quad') + polyglossia.add_left_spaced_character('sanskrit',';',thinspace,'quad') + polyglossia.add_left_spaced_character('sanskrit','।',thinspace,'quad') -- danda, U+0964 + polyglossia.add_left_spaced_character('sanskrit','॥',thinspace,'quad') -- double danda, U+0965 +end + +local function deactivate_sanskrit_punct() + polyglossia.deactivate_punct() +end + +polyglossia.activate_sanskrit_punct = activate_sanskrit_punct +polyglossia.deactivate_sanskrit_punct = deactivate_sanskrit_punct diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.lua b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.lua index e26e7dc6ec8..fe2f0c3a107 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.lua +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.lua @@ -1,7 +1,3 @@ -require('luatex-hyphen') - -local luatexhyphen = luatexhyphen -local byte = unicode.utf8.byte local module_name = "polyglossia" local polyglossia_module = { @@ -16,82 +12,73 @@ local polyglossia_module = { luatexbase.provides_module(polyglossia_module) -local log_info = function(message) - luatexbase.module_info(module_name, message) +local log_info = function(message, ...) + luatexbase.module_info(module_name, message:format(...)) end -local log_warning = function(message) - luatexbase.module_warning(module_name, message) +local log_warn = function(message, ...) + luatexbase.module_warning(module_name, message:format(...)) end polyglossia = polyglossia or {} local polyglossia = polyglossia --- predefined l@nohyphenation or dummy new language -local nohyphid = luatexbase.registernumber'l@nohyphenation' or lang.id(lang.new()) --- key `nohyphenation` is for .sty file when possibly undefined l@nohyphenation -local newloader_loaded_languages = { nohyphenation = nohyphid } - -local newloader_available_languages = dofile(kpse.find_file('language.dat.lua')) --- Suggestion by Dohyun Kim on #129 -local t = { } -for k, v in pairs(newloader_available_languages) do - t[k] = v - for _, vv in pairs(v.synonyms) do - t[vv] = v - end -end -newloader_available_languages = t - -local function loadlang(lang, id) - if luatexhyphen.lookupname(lang) then - luatexhyphen.loadlanguage(lang, id) - end -end - local function select_language(lang, id) - loadlang(lang, id) - polyglossia.current_language = lang + polyglossia.current_language = lang end local function set_default_language(lang, id) - polyglossia.default_language = lang + polyglossia.default_language = lang end +local byte = utf8.codepoint -- use standard module of lua 5.3 + local check_char if luaotfload and luaotfload.aux and luaotfload.aux.font_has_glyph then - local font_has_glyph = luaotfload.aux.font_has_glyph - function check_char(chr) - local codepoint = tonumber(chr) - if not codepoint then codepoint = byte(chr) end - if font_has_glyph(font.current(), codepoint) then - tex.sprint('1') - else - tex.sprint('0') + local font_has_glyph = luaotfload.aux.font_has_glyph + function check_char(chr) + local codepoint = tonumber(chr) or byte(chr) + if font_has_glyph(font.current(), codepoint) then + tex.sprint('1') + else + tex.sprint('0') + end end - end else - local ids = fonts.identifiers or fonts.ids or fonts.hashes.identifiers - function check_char(chr) -- always in current font - local otfdata = ids[font.current()].characters - local codepoint = tonumber(chr) - if not codepoint then codepoint = byte(chr) end - if otfdata and otfdata[codepoint] then - tex.print('1') - else - tex.print('0') - end - end -end - -local function load_frpt() - require('polyglossia-frpt') + function check_char(chr) -- always in current font + local fontid = font.current() + local fontdata = font.getfont(fontid) or font.fonts[fontid] + local chardata = fontdata.characters + local codepoint = tonumber(chr) or byte(chr) + if chardata and chardata[codepoint] then + tex.sprint('1') + else + tex.sprint('0') + end + end end local function load_tibt_eol() require('polyglossia-tibt') end +-- predefined l@nohyphenation or LuaTeX's maximum value for \language +local nohyphid = luatexbase.registernumber'l@nohyphenation' or 16383 + +-- key `nohyphenation` is for .sty file when possibly undefined l@nohyphenation +local newloader_loaded_languages = { nohyphenation = nohyphid } + +local newloader_available_languages = require'language.dat.lua' +-- Suggestion by Dohyun Kim on #129 +local t = { } +for k, v in pairs(newloader_available_languages) do + t[k] = v + for _, vv in pairs(v.synonyms) do + t[vv] = v + end +end +newloader_available_languages = t + -- LaTeX's language register is \count19 local lang_register = 19 @@ -99,19 +86,36 @@ local lang_register = 19 local function newloader(langentry) local loaded_language = newloader_loaded_languages[langentry] if loaded_language then - log_info('Language ' .. langentry .. ' already loaded; id is ' .. lang.id(loaded_language)) - -- texio.write_nl('term and log', 'Language ' .. langentry .. ' already loaded with patterns ' .. tostring(loaded_language) .. '; id is ' .. lang.id(loaded_language)) - -- texio.write_nl('term and log', 'Language ' .. langentry .. ' already loaded with patterns ' .. loaded_language['patterns'] .. '; id is ' .. lang.id(loaded_language)) - return lang.id(loaded_language) + local langid = lang.id(loaded_language) + log_info('Language %s already loaded; id is %i', langentry, langid) + return langid else local langdata = newloader_available_languages[langentry] - if langdata and langdata['special'] == 'language0' then return 0 end - if langdata then - local s = "Language data for " .. langentry + + local special = langdata.special + if special then + -- language0 (USenglish) is already included in the format + if special == 'language0' then + return 0 + + -- disabled language should not be used for utf-8 text + elseif special:find'^disabled:' then + log_warn('Hyphenation of language %s %s', langentry, special) + return nohyphid + end + end + + -- language info will be written into the .log file + local s = { "Language data for " .. langentry } for k, v in pairs(langdata) do - s = s .. "\n" .. k .. "\t" .. tostring(v) + if type(v) == 'table' then -- for 'synonyms' + s[#s+1] = k .. "\t" .. table.concat(v,',') + else + s[#s+1] = k .. "\t" .. tostring(v) + end end + log_info(table.concat(s,"\n")) -- -- LaTeX's \newlanguage increases language register (count19), @@ -133,47 +137,47 @@ local function newloader(langentry) local langobject = lang.new() local langid = lang.id(langobject) -- get bigger one between \newlanguage and new lang obj id - local maxlangid = math.max(langcnt, langid) + local newlangid = math.max(langcnt, langid) -- set language register for possible \newlanguage - tex.setcount('global', lang_register, maxlangid) + tex.setcount('global', lang_register, newlangid) -- get new lang object if needeed - if langid ~= maxlangid then - langobject = lang.new(maxlangid) - end - s = s .. "\npatterns: " .. langdata.patterns - log_info(s) - if langdata.patterns and langdata.patterns ~= '' then - local pattfilepath = kpse.find_file(langdata.patterns) - if pattfilepath then - local pattfile = io.open(pattfilepath) - lang.patterns(langobject, pattfile:read('*all')) - pattfile:close() - end + if langid ~= newlangid then + langobject = lang.new(newlangid) end - if langdata.hyphenation and langdata.hyphenation ~= '' then - local hyphfilepath = kpse.find_file(langdata.hyphenation) - if hyphfilepath then - local hyphfile = io.open(hyphfilepath) - lang.hyphenation(langobject, hyphfile:read('*all')) - hyphfile:close() + + -- load hyphenation patterns and exceptions + for _,v in ipairs{ 'patterns', 'hyphenation' } do + local data = langdata[v] + if data and data ~= '' then + -- cope with comma separated list, such as serbian + for _,vv in ipairs(data:explode',+') do + local filepath = kpse.find_file(vv) + if filepath then + local fh = io.open(filepath) + lang[v](langobject, fh:read'a') + fh:close() + else + log_warn('Hyphenation file %s not found', vv) + end + end end end + newloader_loaded_languages[langentry] = langobject - log_info('Language ' .. langentry .. ' was not yet loaded; created with id ' .. lang.id(langobject)) - return lang.id(langobject) + log_info('Language %s was not yet loaded; created with id %i', + langentry, newlangid) + return newlangid else - log_warning('Language ' .. langentry .. ' not found in language.dat.lua') + log_warn('Language %s not found in language.dat.lua', langentry) return nohyphid end end end -polyglossia.loadlang = loadlang polyglossia.select_language = select_language polyglossia.set_default_language = set_default_language polyglossia.check_char = check_char -polyglossia.load_frpt = load_frpt polyglossia.load_tibt_eol = load_tibt_eol polyglossia.newloader = newloader polyglossia.newloader_loaded_languages = newloader_loaded_languages diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty index 4f419e14ddd..9cdb503c1ab 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty +++ b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{polyglossia}[2019/10/27 v1.45 +\ProvidesPackage{polyglossia}[2019/11/15 v1.46 Alternative to Babel for XeLaTeX and LuaLaTeX] \RequirePackage{etoolbox} \RequirePackage{makecmds} @@ -324,7 +324,14 @@ \xpg@set@hyphenation@patterns{#1} } } - { + {% + % Since this function is sometimes called from the gloss files + % directly, we need to check whether the requested hyphenname exists. + \xpg@ifdefined{#1}{}% + {% + \xpg@nopatterns{#1} + \expandafter\adddialect\csname l@#1\endcsname\l@nohyphenation\relax% + }% \xpg@set@hyphenation@patterns{#1} } } @@ -667,7 +674,7 @@ } \cs_new_nopar:Nn{\polyglossia@lang@frenchspacing:n}{ - \prop_get:NnNTF \polyglossia@langsetup {#1/frenchspacing} \l_tmpa_tl + \prop_get:NxNTF \polyglossia@langsetup {#1/frenchspacing} \l_tmpa_tl { \str_case_e:nnF{\l_tmpa_tl}{ {true}{\frenchspacing} @@ -682,7 +689,7 @@ } \cs_new_nopar:Nn{\polyglossia@lang@indentfirst:n}{ - \prop_get:NnNTF \polyglossia@langsetup {#1/indentfirst} \l_tmpa_tl + \prop_get:NxNTF \polyglossia@langsetup {#1/indentfirst} \l_tmpa_tl { \str_case_e:nnF{\l_tmpa_tl}{ {true}{\french@indent} @@ -698,7 +705,7 @@ \cs_new:Nn{\polyglossia@lang@setpardirection:n}{ - \prop_get:NnNTF \polyglossia@langsetup {#1/direction} \l_tmpa_tl + \prop_get:NxNTF \polyglossia@langsetup {#1/direction} \l_tmpa_tl { \polyglossia@setpardirection:n{\l_tmpa_tl} } @@ -710,7 +717,7 @@ \cs_new:Nn{\polyglossia@lang@settextdirection:nn}{ - \prop_get:NnNTF \polyglossia@langsetup {#1/direction} \l_tmpa_tl + \prop_get:NxNTF \polyglossia@langsetup {#1/direction} \l_tmpa_tl { \polyglossia@settextdirection:n{\l_tmpa_tl}{#2} } @@ -1003,21 +1010,73 @@ } } +% load a master language from an alias file +\newcommand*\xpg@load@master@language[1] { + \xpg@input{gloss-#1.ldf} + \csgdef{#1@loaded}{} + \global\edef\xpg@loaded{#1\ifx\xpg@loaded\@empty\else,\xpg@loaded\fi}% +} + % define environment and command \cs_new:Nn \polyglossia@define@language@cmd:n { - \exp_args:Ne - \newenvironment {\prop_item:Nn{\polyglossia@langsetup}{#1/envname}} [1] [] - { - \begin{otherlanguage}[##1]{#1} - }% - { - \end{otherlanguage} - }% - \exp_args:Nc \newcommand {text#1} [2][] - {% - \xpg@textlanguage[##1]{#1}{##2}% + \ifcsundef{#1@alias@lang}{% + \exp_args:Ne + \newenvironment {\prop_item:Nn{\polyglossia@langsetup}{#1/envname}} [1] [] + { + \begin{otherlanguage}[##1]{#1} + }% + { + \end{otherlanguage} + }% + \exp_args:Nc \newcommand {text#1} [2][] + {% + \xpg@textlanguage[##1]{#1}{##2}% + }% + }{} +} + +% provide way to define alias environment and command +% \setlanguagealias[<options>]{<language>}{<alias>} +\DeclareDocumentCommand \setlanguagealias {s O{} m m} +{ + \ifcsundef{#4@alias@lang}{% + \exp_args:Ne + \newenvironment {#4} + { + \begin{otherlanguage}[#2]{#3} + }% + { + \end{otherlanguage} + }% + % The starred version does not define \text<alias> + \IfBooleanF {#1} + { + \exp_args:Nc \newcommand {text#4} [2][] + {% + \xpg@textlanguage[#2,##1]{#3}{##2}% + }% + }% + }{% + \exp_args:Ne + \renewenvironment {#4} + { + \begin{otherlanguage}[#2]{#3} + }% + { + \end{otherlanguage} + }% + % The starred version does not (re)define \text<alias> + \IfBooleanF {#1} + { + \exp_args:Nc \renewcommand {text#4} [2][] + {% + \xpg@textlanguage[#2,##1]{#3}{##2}% + }% + }% }% + \csgdef{#4@alias@lang}{#3}% + \tl_if_blank:nF {#2} {\csgdef{#4@alias@opts}{#2}}% } \newcommand{\setdefaultlanguage}[2][]{% @@ -1032,13 +1091,37 @@ \polyglossia_load_lang_definition:nn{#1}{#2} % define environment and command (except for internal latex language) \ifstrequal{#2}{latex}{}{% - \polyglossia@define@language@cmd:n{#2} + \exp_args:Nx\polyglossia@define@language@cmd:n{#2} }% \csgdef{#2@loaded}{}% } { \relax } + \ifcsdef{#2@alias@lang}{% + \ifcsdef{#2@alias@opts}{% + \exp_args:Nxx \polyglossia_load_lang_definition:nn {\csuse{#2@alias@opts},#1} {\csuse{#2@alias@lang}}% + \exp_args:Nxx \polyglossia@set@default@language:nn {\csuse{#2@alias@opts},#1} {\csuse{#2@alias@lang}}% + }{% + \polyglossia@set@default@language:nn {#1} {\csuse{#2@alias@lang}}% + }% + }{% + \polyglossia@set@default@language:nn {#1} {#2}% + }% +} + +\cs_new:Nn \polyglossia@set@default@language:nn +{ + \ifcsundef{#2@loaded}% + { + % latex is an internal language, so do not record + \ifstrequal{#2}{latex}{}{% + \global\edef\xpg@loaded{#2\ifx\xpg@loaded\@empty\else,\xpg@loaded\fi}% + \global\edef\xpg@bloaded{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}% + \ifx\xpg@bloaded\@empty\else,\xpg@bloaded\fi}% + }% + \csgdef{#2@loaded}{}% + }{} \gdef\xpg@main@language{#2}% \tl_if_blank:nTF {#1}{\gdef\mainlanguagevariant{}}{% % If the optional argument sets a value for the key “variant”, @@ -1047,8 +1130,7 @@ \xpg@parsevariantkeyvalue##1=@xpg@main@langvariant\relax }% }% - % Store babelname of main language (for external packages such as biblatex) - \xdef\mainbabelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + \csgdef{#2@gvar}{\mainlanguagevariant}% %% The following settings are for the default language and script % this tells bidi.sty or luabidi.sty that the document is RTL \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}{RL}{% @@ -1064,8 +1146,14 @@ \xpg@info{Default~ language~ is~ #2}% \polyglossia@set@language@name[#1]{#2}% \def\mainlanguagename{#2} + % Store babelname of main language (for external packages such as biblatex) + \prop_get:NxNT \polyglossia@langsetup {#2/babelname} \l_tmpa_tl + { \edef\mainbabelname{\l_tmpa_tl} } % Store babelname of current language (for external packages such as biblatex) - \xdef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + \prop_get:NxNT \polyglossia@langsetup {#2/babelname} \l_tmpa_tl + { \edef\babelname{\l_tmpa_tl}% + \csgdef{#2@gbabelname}{\babelname}% + } \ifluatex % \directlua{polyglossia.set_default_language('\luatexluaescapestring{\string#2}')}% \fi % @@ -1115,14 +1203,44 @@ \selectlanguage[#1]{#2}% \selectbackgroundlanguage{#2}% % Store babelname of current language (for external packages such as biblatex) - \xdef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + \tl_if_blank:nTF {#1}{% + \ifcsundef{#2@gbabelname}{% + \edef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + }{% + \edef\babelname{\csuse{#2@gbabelname}}% + }% + }{% + \edef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + }% } % This saves the normalfont for the latin script since we may change normalfont in other scripts \let\normalfontlatin=\normalfont% -\let\rmfamilylatin=\rmfamily% -\let\sffamilylatin=\sffamily% -\let\ttfamilylatin=\ttfamily% + +% Provide default fonts (as set with \setmainfont, \setsansfont and \setmonofont) +% for Latin scripts and as a fallback for non-Latin scripts. +\DeclareRobustCommand\xpg@defaultfont@rm{% + \tl_if_empty:NF{\g__fontspec_nfss_enc_tl}{\fontencoding{\g__fontspec_nfss_enc_tl}}% + \fontfamily\rmdefault% + \selectfont% +} +\DeclareRobustCommand\xpg@defaultfont@sf{% + \tl_if_empty:NF{\g__fontspec_nfss_enc_tl}{\fontencoding{\g__fontspec_nfss_enc_tl}}% + \fontfamily\sfdefault% + \selectfont% +} +\DeclareRobustCommand\xpg@defaultfont@tt{% + \tl_if_empty:NF{\g__fontspec_nfss_enc_tl}{\fontencoding{\g__fontspec_nfss_enc_tl}}% + \fontfamily\ttdefault% + \selectfont% +} + +% These switches activate the default fonts +% Note that a simple \let\rmfamilylatin=\rmfamily +% does not work reliably (see #24) +\cs_gset_eq:cc{rmfamilylatin}{xpg@defaultfont@rm}% +\cs_gset_eq:cc{sffamilylatin}{xpg@defaultfont@sf}% +\cs_gset_eq:cc{ttfamilylatin}{xpg@defaultfont@tt}% \def\xpg@set@familydefault{% % We need the \edef route here in order @@ -1144,15 +1262,16 @@ % This (re-)saves the normalfont for the latin script since we may % change normalfont in other scripts \let\normalfontlatin=\normalfont% - \let\rmfamilylatin=\rmfamily% - \let\sffamilylatin=\sffamily% - \let\ttfamilylatin=\ttfamily% + % And for all cases, we also reset \<xx>familylatin + \cs_gset_eq:cc{rmfamilylatin}{xpg@defaultfont@rm}% + \cs_gset_eq:cc{sffamilylatin}{xpg@defaultfont@sf}% + \cs_gset_eq:cc{ttfamilylatin}{xpg@defaultfont@tt}% } \def\resetfontlatin{% - \let\rmfamily=\rmfamilylatin% - \let\sffamily=\sffamilylatin% - \let\ttfamily=\ttfamilylatin% + \cs_gset_eq:cc{rmfamily}{xpg@defaultfont@rm}% + \cs_gset_eq:cc{sffamily}{xpg@defaultfont@sf}% + \cs_gset_eq:cc{ttfamily}{xpg@defaultfont@tt}% \global\let\normalfont=\normalfontlatin} \def\selectfontfamilylatin{% @@ -1197,19 +1316,42 @@ \global\edef\xpg@loaded{#2\ifx\xpg@loaded\@empty\else,\xpg@loaded\fi}% \polyglossia_load_lang_definition:nn{#1}{#2} % define environment and command - \polyglossia@define@language@cmd:n{#2} + \exp_args:Nx\polyglossia@define@language@cmd:n{#2} \csgdef{#2@loaded}{}% - % If a variant is set, store it. - \gdef\otherlanguagevariant{} - \tl_if_blank:nTF {#1}{}{% - % If the optional argument sets a value for the key “variant”, - % store it in \xpg@main@langvariant - \clist_map_inline:nn { #1 } {% - \xpg@parsevariantkeyvalue##1=@xpg@other@langvariant\relax - }% + \ifcsdef{#2@alias@lang}{% + \ifcsdef{#2@alias@opts}{% + \exp_args:Nxx \polyglossia_load_lang_definition:nn {\csuse{#2@alias@opts},#1} {\csuse{#2@alias@lang}}% + \exp_args:Nxx \polyglossia@set@other@language:nn {\csuse{#2@alias@opts},#1} {\csuse{#2@alias@lang}}% + }{% + \polyglossia@set@other@language:nn {#1} {\csuse{#2@alias@lang}}% + }% + }{% + \polyglossia@set@other@language:nn {#1} {#2}% }% - \csgdef{#2@gvar}{\otherlanguagevariant}% + } + {} +} + +\cs_new:Nn \polyglossia@set@other@language:nn +{ + \ifcsundef{#2@loaded} + { + \global\edef\xpg@loaded{#2\ifx\xpg@loaded\@empty\else,\xpg@loaded\fi}% + \csgdef{#2@loaded}{}% }{} + % If a variant is set, store it. + \gdef\otherlanguagevariant{} + \tl_if_blank:nTF {#1}{}{% + % If the optional argument sets a value for the key “variant”, + % store it in \xpg@other@langvariant + \clist_map_inline:nn { #1 } {% + \xpg@parsevariantkeyvalue##1=@xpg@other@langvariant\relax + }% + }% + \csgdef{#2@gvar}{\otherlanguagevariant}% + \prop_get:NxNT \polyglossia@langsetup {#2/babelname} \l_tmpa_tl + { \xdef\otherlanguagebabelname{\l_tmpa_tl} } + \csgdef{#2@gbabelname}{\otherlanguagebabelname}% } % Store main language variant for external packages @@ -1219,7 +1361,7 @@ \newcommand\setotherlanguages[1]{% \def\do##1{\setotherlanguage{##1}}% - \docsvlist{#1}}% + \exp_args:Nx\docsvlist{#1}}% \def\common@language{% FIXME is this really needed??? \ifbool{xpg@hyphenation@disabled}{% @@ -1234,13 +1376,38 @@ \common@language% } + +% Alias to \text<lang>, but more suitable +% for specific (esp. tag-based) aliases +% where \text<alias> would cause clashes +% (e.g., \textit) +\newcommand\textlang[3][]{% + \ifcsdef{#2@alias@lang}{% + \ifcsdef{#2@alias@opts}{% + \xpg@textlanguage[\csuse{#2@alias@opts},#1]{\csuse{#2@alias@lang}}{#3}% + }{% + \xpg@textlanguage[#1]{\csuse{#2@alias@lang}}{#3}% + }% + }{% + \xpg@textlanguage[#1]{#2}{#3}% + }% +}% + \providecommand{\foreignlanguage}{} % wrapper for foreignlanguage and otherlanguage* \newcommand*\polyglossia@setforeignlanguage[2][]{ \select@@language[#1]{#2} % Store babelname of current language (for external packages such as biblatex) - \xdef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + \tl_if_blank:nTF {#1}{% + \ifcsundef{#2@gbabelname}{% + \edef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + }{% + \edef\babelname{\csuse{#2@gbabelname}}% + }% + }{% + \edef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + }% } % joint code of \foreignlanguage, otherlanguage* @@ -1248,7 +1415,7 @@ \newcommand{\xpg@otherlanguage}[2][] {% \polyglossia@error@iflangnotloaded:n{#2} - \setkeys{#2}{#1}% + \exp_args:Nne \setkeys{#2}{#1}% \polyglossia@setforeignlanguage[#1]{#2} % buggy restoration heure \csuse{inlineextras@#2}% @@ -1259,7 +1426,20 @@ \renewcommand{\foreignlanguage}[3][] {% - \polyglossia@error@iflangnotloaded:n{#2} + \ifcsdef{#2@alias@lang}{% + \ifcsdef{#2@alias@opts}{% + \polyglossia@foreignlanguage:nnn {\csuse{#2@alias@opts},#1} {\csuse{#2@alias@lang}} {#3}% + }{% + \polyglossia@foreignlanguage:nnn {#1} {\csuse{#2@alias@lang}} {#3}% + }% + }{% + \polyglossia@foreignlanguage:nnn {#1} {#2} {#3}% + }% +} + +\cs_new:Nn \polyglossia@foreignlanguage:nnn +{ + \polyglossia@error@iflangnotloaded:n{#2} \bgroup \xpg@otherlanguage[#1]{#2}% \polyglossia@lang@settextdirection:nn{#2}{#3}% @@ -1271,12 +1451,25 @@ \renewenvironment{otherlanguage*}[2][] {% + \ifcsdef{#2@alias@lang}{% + \ifcsdef{#2@alias@opts}{% + \polyglossia@otherlanguage:nn {\csuse{#2@alias@opts},#1} {\csuse{#2@alias@lang}}% + }{% + \polyglossia@otherlanguage:nn {#1} {\csuse{#2@alias@lang}}% + }% + }{% + \polyglossia@otherlanguage:nn {#1} {#2}% + }% +} +{\egroup} + +\cs_new:Nn \polyglossia@otherlanguage:nn +{ \xpg@otherlanguage[#1]{#2}% \polyglossia@lang@settextdirection:nn{#2}\bgroup% } -{\egroup} -% use by \text<lang>. Equivalent to \foreignlanguage, +% use by \text<lang> and \textlang. Equivalent to \foreignlanguage, % except that dates are localized. \newcommand*\xpg@textlanguage[3][]{% \polyglossia@error@iflangnotloaded:n{#2} @@ -1315,10 +1508,23 @@ \DeclareDocumentCommand \selectlanguage {s O{} m} {% - \polyglossia@error@iflangnotloaded:n{#3} + \ifcsdef{#3@alias@lang}{% + \ifcsdef{#3@alias@opts}{% + \polyglossia@select@language:nnn {#1} {\csuse{#3@alias@opts},#2} {\csuse{#3@alias@lang}}% + }{% + \polyglossia@select@language:nnn {#1} {#2} {\csuse{#3@alias@lang}}% + }% + }{% + \polyglossia@error@iflangnotloaded:n{#3}% + \polyglossia@select@language:nnn {#1} {#2} {#3}% + } +} + +\cs_new:Nn \polyglossia@select@language:nnn +{ \IfBooleanF {#1} { - \tl_set:Nx \xpg@pop@language { \exp_not:N \xpg@pop@language@i {#2} {#3} } + \cs_set_nopar:Npx \xpg@pop@language { \exp_not:N \xpg@pop@language@i {#2} {#3} } \group_insert_after:N \xpg@pop@language } \tl_if_blank:nTF {#2}{}{% @@ -1326,7 +1532,7 @@ \clist_map_inline:nn { #2 } {% \xpg@parsevariantkeyvalue##1=@xpg@langvariant\relax }% - \setkeys{#3}{#2}% + \exp_args:Nne \setkeys{#3}{#2}% }% % The starred variant does not write to the aux \IfBooleanTF#1{% @@ -1386,7 +1592,15 @@ \newcommand*{\xpg@set@language@aux}[2][]{% % Store babelname of current language (for external packages such as biblatex) - \xdef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + \tl_if_blank:nTF {#1}{% + \ifcsundef{#2@gbabelname}{% + \edef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + }{% + \edef\babelname{\csuse{#2@gbabelname}}% + }% + }{% + \edef\babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}% + }% \@select@language[#1]{#2}% % Write to the aux \if@filesw% @@ -1491,11 +1705,6 @@ \fi } -% FIXME: Remove after gloss-latin (last user) has been rewritten) -\newcommand\xpg@set@language@luatex@ii[1]{% - \xpg@set@bbl@hyphendata{\expandafter\the\csname l@#1\endcsname} -} - \newcommand*\@select@language[2][]{ % hook for compatibility with biblatex @@ -1564,9 +1773,9 @@ \provideenvironment{otherlanguage}{}{} \renewenvironment{otherlanguage}[2][] -{ +{% \xpg@set@group@aux% - \selectlanguage[#1]{#2} + \selectlanguage[#1]{#2}% } {\xpg@unset@group@aux} diff --git a/Master/texmf-dist/tex/latex/polyglossia/cyrillicnumbers.sty b/Master/texmf-dist/tex/latex/polyglossia/xpg-cyrillicnumbers.sty index 171ac441568..2b4bcf876ad 100644 --- a/Master/texmf-dist/tex/latex/polyglossia/cyrillicnumbers.sty +++ b/Master/texmf-dist/tex/latex/polyglossia/xpg-cyrillicnumbers.sty @@ -1,5 +1,5 @@ -\ProvidesPackage{cyrillicnumbers} - [2019/09/13 v0.1 % +\ProvidesPackage{xpg-cyrillicnumbers} + [2019/11/15 v0.2 % Formatting of Cyrillic alphabetic numbers] %% This follows https://en.wikipedia.org/wiki/Cyrillic_numerals |