summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-04-05 22:10:52 +0000
committerKarl Berry <karl@freefriends.org>2022-04-05 22:10:52 +0000
commit1d3a41c853f7524663343fd7a7d561848375497a (patch)
treeb5f046c070ef4fc5ed8e7f417b9d4a81b36fe860 /Master/texmf-dist
parent44c7e92cd62a724d239c17b52359d86abaf22615 (diff)
polyglossia (27mar22)
git-svn-id: svn://tug.org/texlive/trunk@62940 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/polyglossia/README.md6
-rw-r--r--Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdfbin63529 -> 70604 bytes
-rw-r--r--Master/texmf-dist/doc/latex/polyglossia/example-korean.pdfbin30752 -> 20309 bytes
-rw-r--r--Master/texmf-dist/doc/latex/polyglossia/example-thai.pdfbin13253 -> 13478 bytes
-rw-r--r--Master/texmf-dist/doc/latex/polyglossia/examples.pdfbin143624 -> 147484 bytes
-rw-r--r--Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdfbin341615 -> 348164 bytes
-rw-r--r--Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex181
-rw-r--r--Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx2418
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-afrikaans.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf5
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-belarusian.ldf12
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-bosnian.ldf2
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-catalan.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-croatian.ldf79
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf24
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf24
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-finnish.ldf23
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-georgian.ldf6
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-german.ldf8
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf6
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-italian.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-korean.ldf224
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-latex.ldf33
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf163
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf6
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-occitan.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-piedmontese.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf102
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf6
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf5
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf95
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf12
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf4
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-tibetan.ldf81
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf10
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty1272
39 files changed, 3081 insertions, 1758 deletions
diff --git a/Master/texmf-dist/doc/latex/polyglossia/README.md b/Master/texmf-dist/doc/latex/polyglossia/README.md
index 33bbb1d2d76..df223991ec2 100644
--- a/Master/texmf-dist/doc/latex/polyglossia/README.md
+++ b/Master/texmf-dist/doc/latex/polyglossia/README.md
@@ -1,4 +1,4 @@
-# THE POLYGLOSSIA PACKAGE v1.51
+# THE POLYGLOSSIA PACKAGE v1.54
## Multilingual typesetting with XeLaTeX and LuaLaTeX
This package provides an alternative to Babel for users of XeLaTeX and LuaLaTeX.
@@ -26,8 +26,8 @@ Polyglossia makes it possible to automate the following tasks:
# LICENCE
-Copyright (c) 2008-2010 François Charette, 2013 Élie Roux, 2011-2021 Arthur Reutenauer,
-Copyright (c) 2019-2021 Bastien Roucariès, 2019-2021 Jürgen Spitzmüller
+Copyright (c) 2008-2010 François Charette, 2013 Élie Roux, 2011-2022 Arthur Reutenauer,
+Copyright (c) 2019-2022 Bastien Roucariès, 2019-2022 Jürgen Spitzmüller
Except where otherwise noted, Polyglossia is placed under the terms of the MIT licence
(https://opensource.org/licenses/MIT).
diff --git a/Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf b/Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf
index 534e04f240b..2ad7e7905b6 100644
--- a/Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf
+++ b/Master/texmf-dist/doc/latex/polyglossia/example-arabic.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/polyglossia/example-korean.pdf b/Master/texmf-dist/doc/latex/polyglossia/example-korean.pdf
index 99d188f6699..99dd5c319d5 100644
--- a/Master/texmf-dist/doc/latex/polyglossia/example-korean.pdf
+++ b/Master/texmf-dist/doc/latex/polyglossia/example-korean.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf b/Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf
index 8938a531f48..36bff4d4298 100644
--- a/Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf
+++ b/Master/texmf-dist/doc/latex/polyglossia/example-thai.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/polyglossia/examples.pdf b/Master/texmf-dist/doc/latex/polyglossia/examples.pdf
index b35cfe4af29..d74be57444c 100644
--- a/Master/texmf-dist/doc/latex/polyglossia/examples.pdf
+++ b/Master/texmf-dist/doc/latex/polyglossia/examples.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf b/Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf
index efbcbab0cb0..74e64410ad3 100644
--- a/Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf
+++ b/Master/texmf-dist/doc/latex/polyglossia/polyglossia.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex b/Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex
index 155d42c392f..2046d6a66ab 100644
--- a/Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex
+++ b/Master/texmf-dist/doc/latex/polyglossia/polyglossia.tex
@@ -1,7 +1,7 @@
% !TeX spellcheck = en_US
% !TeX TS-program = xelatex
\documentclass[11pt]{ltxdoc}
-\usepackage{color}
+\usepackage{xcolor}
\usepackage{xspace,fancyvrb,longtable,booktabs}
\usepackage[neverdecrease]{paralist}
\usepackage[format=hang,labelfont=bf,labelsep=period]{caption}
@@ -129,7 +129,7 @@
\color{xpgblue}Polyglossia: Modern multilingual typesetting with \XeLaTeX\ and \LuaLaTeX}
\author{\TA{François Charette} \and \TA{Arthur Reutenauer}\thanks{Current maintainer}
\and \TA{Bastien Roucariès} \and \TA{Jürgen Spitzmüller}}
-\date{\filedate \qquad \fileversion\\
+\date{\filedate \qquad \fileversion\thanks{Please report bugs to \url{http://github.com/reutenauer/polyglossia/issues}}\\
\footnotesize (\textsc{pdf} file generated on \today)}
\maketitle
@@ -302,11 +302,9 @@ brazil & portuguese & variant=brazilian \\
british & english & variant=british \\
canadian & english & variant=canadian \\
canadien & french & variant=canadian \\
-classiclatin\footnote{In \pkg{babel} currently only selectable via dot modifier (\emph{latin.classic}).}
- & latin & variant=classic \\
+classiclatin & latin & variant=classic \\
farsi & persian & \\
-ecclesiasticlatin\footnote{In \pkg{babel} currently only selectable via dot modifier (\emph{latin.ecclesiastic}).}
- & latin & variant=ecclesiastic \\
+ecclesiasticlatin & latin & variant=ecclesiastic \\
friulan & friulian & \\
german\footnote{Due to the name conflict only available in \pkg{polyglossia} as \emph{germanb} (which is a \pkg{babel} synonym).}
& german & spelling=old \\
@@ -314,8 +312,7 @@ irish & gaelic & variant=irish [\emph{default}] \\
kurmanji & kurdish & variant=kurmanji \\
lowersorbian & sorbian & variant=lower \\
magyar & hungarian & \\
-medievallatin\footnote{In \pkg{babel} currently only selectable via dot modifier (\emph{latin.medieval}).}
- & latin & variant=medieval \\
+medievallatin & latin & variant=medieval \\
naustrian & german & variant=austrian \\
newzealand & english & variant=newzealand \\
ngerman & german & variant=german [\emph{default}] \\
@@ -334,7 +331,7 @@ uppersorbian & sorbian & variant=upper [\emph{default}] \\
\bottomrule
\end{tabular}
\end{minipage}
-
+
\end{table}
For convenience reasons, \pkg{polyglossia} also supports the use of babel names\new{1.46} (for the few justified
@@ -831,7 +828,7 @@ and that passing \xpgvalue{babelshorthands} (without value) is equivalent to pas
\paragraph*{Commands:}
\begin{itemize}
\item \Cmd\abjad outputs Arabic \textit{abjad} numbers according to the Mashriq varieties.
- Example: ¦\abjad{1863}¦ yields \textarabic{\abjad{1863}}.
+ Example: ¦\abjad{1863}¦ yields \textarabic{\abjad{1863}}.
\item \Cmd\abjadmaghribi outputs Arabic \textit{abjad} numbers according to the Maghrib varieties.
Example: ¦\abjadmaghribi{1863}¦ yields \textarabic{\abjadmaghribi{1863}}.
\item \Cmd\abjadalph\new{1.50} steps through the Arabic alphabet, thus it can only be used up to 28.
@@ -947,17 +944,17 @@ and that passing \xpgvalue{babelshorthands} (without value) is equivalent to pas
\item[¦"/¦] a slash that allows for a subsequent line break. As opposed to \cmd\slash, hyphenation
at the breakpoints preset in the hyphenation patterns is still allowed.
\end{shorthands}
- Furthermore, the following shorthands generate easy access to Croatian digraphs (ligatures):
+ Furthermore, the following shorthands generate easy access to Croatian digraphs:
\begin{shorthands}
- \item[¦"dz¦] Generates the ligature \charifavailable{01C6}{dž}\ if the font provides it. If not, the
- two characters are output separately. Also available for ¦"Dz¦ (\charifavailable{01C5}{Dž})
- and ¦"DZ¦ (\charifavailable{01C4}{DŽ}).
- \item[¦"lj¦] Generates the ligature \charifavailable{01C9}{lj}\ if the font provides it. If not, the
- two characters are output separately. Also available for ¦"Lj¦ (\charifavailable{01C8}{Lj})
- and ¦"LJ¦ (\charifavailable{01C7}{LJ}).
- \item[¦"nj¦] Generates the ligature \charifavailable{01CC}{nj}\ if the font provides it. If not, the
- two characters are output separately. Also available for ¦"Nj¦ (\charifavailable{01CB}{Nj})
- and ¦"NJ¦ (\charifavailable{01CA}{NJ}).
+ \item[¦"dz¦] Generates the digraph \charifavailable{01C6}{dž}\ if the font provides it. If not,
+ the two consecutive glyphs are output mimicking the digraph. Also available for
+ ¦"Dz¦ (\charifavailable{01C5}{Dž}) and ¦"DZ¦ (\charifavailable{01C4}{DŽ}).
+ \item[¦"lj¦] Generates the digraph \charifavailable{01C9}{lj}\ if the font provides it. If not,
+ the two consecutive glyphs are output mimicking the digraph. Also available for
+ ¦"Lj¦ (\charifavailable{01C8}{Lj}) and ¦"LJ¦ (\charifavailable{01C7}{LJ}).
+ \item[¦"nj¦] Generates the digraph \charifavailable{01CC}{nj}\ if the font provides it. If not,
+ the two consecutive glyphs are output mimicking the digraph. Also available for
+ ¦"Nj¦ (\charifavailable{01CB}{Nj}) and ¦"NJ¦ (\charifavailable{01CA}{NJ}).
\end{shorthands}
Finally, there are also four shorthands for quotation marks:
@@ -967,19 +964,21 @@ and that passing \xpgvalue{babelshorthands} (without value) is equivalent to pas
\item[¦">¦] for Croatian left guillemets (»).
\item[¦"<¦] for Croatian right guillemets («).
\end{shorthands}
- \item \xpgboolkeyfalse[1.47]{disableligatures}
- If this is \xpgvalue{true}, all Croatian ligatures (for digraphs such as
- \charifavailable{01C6}{dž}) will be replaced by single characters. This can
- be useful if the ligatures on your font are broken (if the font does not
- have them, they are automatically replaced).
+ \item \xpgboolkeyfalse[1.47]{disabledigraphs}[Up to version 1.53, the option was
+ called \xpgvalue{disableligatures}. The old option is kept for backwards compatibility,
+ but the use is discouraged.] If this is \xpgvalue{true}, all Croatian digraphs
+ (such as \charifavailable{01C6}{dž}) will be replaced by the two consecutive letters,
+ which is the most common way of typesetting them in Croatian. This can be useful if
+ the Unicode digraphs in your font are broken (if the font does not have them,
+ they are automatically mimicked by the two consecutive glyphs).
\item \xpgboolkeytrue[1.53]{localalph}
If \xpgvalue{true}, alphanumeric counters will use a locally established version which excludes
the characters \meta{q}, \meta{w}, \meta{x} and \meta{y} from alphabetic counting.
Obviously this limits the counting range to 22.
\item \xpgboolkeytrue[1.51]{splithyphens}
- According to Croatian typesetting conventions, if a word with a hard hyphen (such as \emph{je-li})
- is hyphenated at this hyphen, a second hyphenation character is to be inserted at the beginning
- of the line that follows the hyphenation (\emph{je-/-li}).
+ According to Croatian typesetting conventions, if a word with a hard hyphen (such as
+ \emph{hrvatsko-engleski}) is hyphenated at this hyphen, a second hyphenation character is to be
+ inserted at the beginning of the line that follows the hyphenation (\emph{hrvatsko-/-engleski}).
By default, this is done automatically (if you are using \LuaTeX, the \pkg{luavlna} package is
loaded to achieve this).
Set this option to ¦false¦ to disable the feature.
@@ -1067,6 +1066,13 @@ and that passing \xpgvalue{babelshorthands} (without value) is equivalent to pas
\item[¦"/¦] a slash that allows for a subsequent line break. As opposed to \cmd\slash,
hyphenation at the breakpoints preset in the hyphenation patterns is still allowed.
\end{shorthands}
+ \item \xpgboolkeyfalse[1.54]{schoolhyphens}
+ If this is set to true, alternative (experimental) hyphenation patterns are used rather than the
+ default Finnish patterns. These patterns (called `School Hyphenation') are more basic in that
+ they do not contain hyphenation exceptions for compound words since these result in simple words
+ not being hyphenated at points where this would be valid. The backdrop of the `School' patterns
+ is that compound words might be hyphenated incorrectly.
+ See \url{https://github.com/hyphenation/basic-finnish} for details.
\end{itemize}
\subsection{french}\label{french}
@@ -1498,16 +1504,22 @@ and that passing \xpgvalue{babelshorthands} (without value) is equivalent to pas
\item[¦=A¦] for Ā (A with macron), also available for Ē, Ī, Ō, Ū, V̄, and Ȳ.
Note that a macron above the letter V is only displayed if your font
supports the Unicode character ¦0304¦ (\emph{combining macron}).
- \item[¦=ae¦] for a͞e (ae diphthong with macron), also available for a͞u, e͞u,
- and o͞e. Note that macrons above diphthongs are only displayed if your font
- supports the Unicode character ¦035E¦ (\emph{combining double
+ \item[¦=ae¦] for a͞e (ae diphthong with macron, for the ¦classic¦ and
+ the ¦modern¦ variant) or ǣ (ae ligature with macron, for the ¦medieval¦
+ and the ¦ecclesiastic¦ variant), respectively; also available for a͞u,
+ e͞u, and o͞e/œ̄. Note that macrons above diphthongs are only displayed if
+ your font supports the Unicode character ¦035E¦ (\emph{combining double
macron}).
- \item[¦=Ae¦] for A͞e (Ae diphthong with macron), also available for A͞u, E͞u,
- and O͞e.
- \item[¦=AE¦] for A͞E (AE diphthong with macron), also available for A͞U, E͞U,
- and O͞E.
+ \item[¦=Ae¦] for A͞e (Ae diphthong with macron, for the ¦classic¦ and
+ the ¦modern¦ variant) or Ǣ (AE ligature with macron, for the ¦medieval¦
+ and the ¦ecclesiastic¦ variant), respectively; also available for A͞u,
+ E͞u, and O͞e/Œ̄.
+ \item[¦=AE¦] for A͞E (AE diphthong with macron, for the ¦classic¦ and
+ the ¦modern¦ variant) or Ǣ (AE ligature with macron, for the ¦medieval¦
+ and the ¦ecclesiastic¦ variant), respectively; also available for A͞U,
+ E͞U, and O͞E/Œ̄.
\item[¦\textasciicircum a¦] for ă (a with breve), also available for ĕ, ĭ,
- ŏ, ŭ, and y̆. Note that a breve above the letter y is only displayed if
+ ŏ, ŭ, and y̆. Note that a breve above the letter y is only displayed if
your font supports the Unicode character ¦0306¦ (\emph{combining
breve}).
\item[¦\textasciicircum A¦] Ă (A with breve), also available for Ĕ, Ĭ, Ŏ,
@@ -1613,6 +1625,32 @@ Currently, only the Khalkha variety in Cyrillic script is supported.
\paragraph*{Options:}
\begin{itemize}
\item \xpgchoicekey[1.45]{variant}{\xpgvalue{brazilian} or \xpgpresetvalue{portuguese}}
+ \item \xpgboolkeyfalse[1.54]{babelshorthands}
+ If this is turned on, the following shorthands for fine-tuning hyphenation and micro-typography
+ of Portuguese words are activated.
+ \begin{shorthands}
+ \item[¦"|¦] disables a ligature at this position.
+ \item[¦"=¦] for an explicit hyphen sign which is repeated at the beginning
+ of the next line when hyphenated, as common in Portuguese typesetting
+ (also if ¦splithyphens=false¦). Unlike plain ¦-¦, this also allows
+ for hyphenation at the other points preset in the hyphenation patterns.
+ \item[\texttt{"\textasciitilde}] for a hyphen sign without a breakpoint. Useful for
+ cases where the hyphen should stick at the following syllable.
+ \item[¦"-¦] adds a hyphenation point that does still allow for hyphenation at the points preset
+ in the hyphenation patterns (as opposed to \cmd\-).
+ \item[¦""¦] allows for a line break at this position (without hyphenation sign).
+ \item[¦"/¦] a slash that allows for a subsequent line break. As opposed to \cmd\slash, hyphenation
+ at the breakpoints preset in the hyphenation patterns is still allowed.
+ \item[¦"<¦] for French left guillemets («).
+ \item[¦">¦] for French right guillemets (»).
+ \end{shorthands}
+ \item \xpgboolkeytrue[1.54]{splithyphens}
+ According to Portuguese typesetting conventions, if a word with a hard hyphen (such as
+ \emph{pára-brisas}) is hyphenated at this hyphen, a second hyphenation character is to be
+ inserted at the beginning of the line that follows the hyphenation (\emph{pára-/-brisas}).
+ By default, this is done automatically (if you are using \LuaTeX, the \pkg{luavlna} package is
+ loaded to achieve this).
+ Set this option to ¦false¦ to disable the feature.
\end{itemize}
\subsection{russian}\label{russian}
@@ -1710,6 +1748,13 @@ Currently support for Sami is limited to Northern Sami.
\paragraph*{Options:}
\begin{itemize}
\item \xpgchoicekey{script}{\xpgpresetvalue{Cyrillic} or \xpgvalue{Latin}}
+ \item \xpgboolkeytrue[1.54]{splithyphens}
+ According to Serbian typesetting conventions, if a word with a hard hyphen (such as
+ \emph{калцијум-карбонат}) is hyphenated at this hyphen, a second hyphenation character is to be
+ inserted at the beginning of the line that follows the hyphenation (\emph{калцијум-/-карбонат}).
+ By default, this is done automatically (if you are using \LuaTeX, the \pkg{luavlna} package is
+ loaded to achieve this).
+ Set this option to ¦false¦ to disable the feature.
\item \xpgchoicekey{numerals}{\xpgpresetvalue{arabic}, \xpgvalue{cyrillic-alph} or \xpgvalue{cyrillic-trad}}
Uses either Arabic numerals or Cyrillic alphanumerical numbering. The two Cyrillic variants differ as follows:
\begin{itemize}
@@ -1742,7 +1787,8 @@ Currently support for Sami is limited to Northern Sami.
\begin{shorthands}
\item[¦"=¦] for an explicit hyphen sign which is repeated at the beginning
of the next line when hyphenated, as common in Slovak typesetting
- (only needed with ¦splithyphens=false¦).
+ (also if ¦splithyphens=false¦). Unlike plain ¦-¦, this also allows
+ for hyphenation at the other points preset in the hyphenation patterns.
\item[¦"|¦] disables a ligature at this position.
\item[\texttt{"\textasciitilde}] for a hyphen sign without a breakpoint. Useful for
cases where the hyphen should stick at the following syllable.
@@ -1982,11 +2028,11 @@ Ukrainian mathematical symbols.
(such as, in the case of English, ¦\def\chaptername{Chapter}¦)
\item \Cmd{\date\meta{lang}} stores definitions of date formats (usually redefinitions
of \cmd\today, in some cases also definitions of additional date commands)
- \item \Cmd{\blockextras\meta{lang}} stores macros that are to be executed when the language
+ \item \Cmd{\blockextras@\meta{lang}} stores macros that are to be executed when the language
\meta{lang} is activated via \cmd\selectlanguage\ command or the \meta{lang} environment
- \item \Cmd{\inlineextras\meta{lang}} stores macros that are to be executed when the language
+ \item \Cmd{\inlineextras@\meta{lang}} stores macros that are to be executed when the language
\meta{lang} is activated locally via \cmd\text\meta{lang} command
- \item \Cmd{\noextras\meta{lang}} stores macros that are to be executed when the language
+ \item \Cmd{\noextras@\meta{lang}} stores macros that are to be executed when the language
\meta{lang} is closed
\end{itemize}
%
@@ -2337,6 +2383,48 @@ where \meta{type} is a supported language id type (such as ¦bcp-47¦) and \meta
\section{Revision history}
\bgroup\footnotesize
+\subsection*{1.54 (27-03-2022)}
+
+\subsubsection*{New features}
+\begin{itemize}
+ \item New option \xpgoption{splithyphens} for Serbian (\TXI{496}) and Portuguese (\TXI{534}).
+ \item Add \xpgoption{babelshorthands} to Portuguese.
+ \item Add \xpgoption{schoolhyphens} option to Finnish (\TXI{525}).
+\end{itemize}
+
+\subsubsection*{Interface and defaults changes}
+\begin{itemize}
+ \item Rename \xpgoption{disableligatures} to \xpgoption{disabledigraphs} for Croatian (\TXI{497}, \TXP{500}).
+ \item Fix output with \xpgoption{numerals=cyrillic-alph} (part of \TXI{503}).
+ \item Standardize February and November in Indonesian according to the Great Dictionary of the Indonesian Language
+ of the Language Center (\emph{Kamus Besar Bahasa Indonesia}) (\TXP{526}).
+\end{itemize}
+
+\subsubsection*{Bug fixes}
+\begin{itemize}
+ \item Fix robustification of font family switches (\TXI{428}).
+ \item Preserve font family switches across languages (\TXI{519}).
+ \item Fix \TeX\ dash ligatures with \xpgoption{splithyphens} (\TXI{502}).
+ \item Prevent \emph{missing hyphenmins value} \LaTeX\ error with unknown languages (\TXI{513}).
+ \item Fix global \xpgoption{babelshorthands}, \xpgoption{localmarks} and \xpgoption{verbose}
+ options (\TXI{515}).
+ \item Fix Latin shorthands (\TXI{516}).
+ \item Remove spurious space in Bosnian date (\TXP{528}).
+ \item Fix \cmd\languagevariant\ and \cmd\mainlanguagevariant\ macros (\TXI{530}, \TXI{531}).
+ \item Make \cmd\iflanguageloaded\ and friends work in preamble (\TXI{532}).
+ \item Fix deactivation of shorthands (\TXI{320}).
+ \item Fix deactivation of numerals.
+ \item Update deprecated \LaTeX\ hooks (\TXI{523}).
+ \item Fix \xpgoption{luatexrenderer} option which was not considered appropriately (\TXI{533}).
+ \item Turn warning about \texttt{totalhyphenmin} to info, which is more appropriate (\TXI{111}).
+\end{itemize}
+
+\subsubsection*{Documentation improvements}
+\begin{itemize}
+ \item Document in this manual where to report bugs (\TXI{512}).
+\end{itemize}
+
+
\subsection*{1.53 (12-04-2021)}
\subsubsection*{New features}
@@ -2569,12 +2657,13 @@ where \meta{type} is a supported language id type (such as ¦bcp-47¦) and \meta
change of behavior should you have used one of these options without value (\TXI{363}).
Concerned are the following options:
\begin{itemize}
- \item ¦babelshorthands¦ in language Belarusian, Mongolian, Ukrainian, and Russian
- (now ¦babelshorthands¦ equals ¦babelshorthand=true¦, no longer ¦babelshorthands=false¦).
- \item ¦localalph¦ in language Slovenian (¦localalph¦ now equals ¦localalph=true¦).
- \item ¦latesthyphen¦ in language German (¦latesthyphen¦ now equals ¦latesthyphen=true¦).
- \item ¦fullyear¦ in package \pkg{hebrewcal} (¦fullyear¦ now equals ¦fullyear=true¦).
+ \item \xpgoption{babelshorthands} in language Belarusian, Mongolian, Ukrainian, and Russian
+ (now \xpgoption{babelshorthands} equals \xpgoption{babelshorthand=true}, no longer \xpgoption{babelshorthands=false}).
+ \item \xpgoption{localalph} in language Slovenian (\xpgoption{localalph} now equals \xpgoption{localalph=true}).
+ \item \xpgoption{fullyear} in package \pkg{hebrewcal} (\xpgoption{fullyear} now equals \xpgoption{fullyear=true}).
\end{itemize}
+\item The option \xpgoption{latesthyphen} in language German is deprecated. \XeTeX\ and \LuaTeX\ nowadays
+ always use the latest German hyphens.
\item The command ¦\setlanguagealias*¦ (introduced in v1.46) does no longer define
dedicated alias environments.
\item The babelnames for Latin variants have been corrected to ¦classiclatin¦, ¦ecclesiasticlatin¦
@@ -3129,7 +3218,7 @@ And of course my gratitude also goes to \TA{Jonathan Kew}, the formidable author
Many thanks to all the people who have contributed bugfixes and new features to \pkg{polyglossia}
since we took over.
In alphabetical order: \TA{Ignas Anikevicius}, \TA{Sina Ahmadi}, \TA{Wouter Bolsterlee}, \TA{Christian Buhtz},
-\TA{Zgarbul Andrey}, \TA{Oleg Domanov}, \TA{Philipp Gesang}, \TA{Kevin Godby}, \TA{Enrico Gregorio},
+\TA{Zgarbul Andrey}, \TA{Oleg Domanov}, user \TA{fakhriaunur}, \TA{Philipp Gesang}, \TA{Kevin Godby}, \TA{Enrico Gregorio},
\TA{Khaled Hosny}, \TA{Najib Idrissi}, user \TA{julroy67}, \TA{Dohyun Kim}, \TA{Phil Kime}, \TA{Mike Kroutikov},
\TA{Ivan Kokan}, \TA{Caleb Maclennan}, \TA{José Mancera}, \TA{Miquel Ortega}, \TA{Yevgen Pogribnyi}, \TA{Will Robertson},
\TA{Maïeul Rouquette}, \TA{Elie Roux}, \TA{Hugo Roy}, \TA{Guy Rutenberg}, \TA{Philipp Stephani}, \TA{Niranjan Tambe},
diff --git a/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx b/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx
index fdcd7f32eb3..d3f0abc5897 100644
--- a/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx
+++ b/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx
@@ -8,7 +8,7 @@
\iffalse
%</internal>
%<*README>
-# THE POLYGLOSSIA PACKAGE v1.51
+# THE POLYGLOSSIA PACKAGE v1.54
## Multilingual typesetting with XeLaTeX and LuaLaTeX
This package provides an alternative to Babel for users of XeLaTeX and LuaLaTeX.
@@ -36,8 +36,8 @@ Polyglossia makes it possible to automate the following tasks:
# LICENCE
-Copyright (c) 2008-2010 François Charette, 2013 Élie Roux, 2011-2021 Arthur Reutenauer,
-Copyright (c) 2019-2021 Bastien Roucariès, 2019-2021 Jürgen Spitzmüller
+Copyright (c) 2008-2010 François Charette, 2013 Élie Roux, 2011-2022 Arthur Reutenauer,
+Copyright (c) 2019-2022 Bastien Roucariès, 2019-2022 Jürgen Spitzmüller
Except where otherwise noted, Polyglossia is placed under the terms of the MIT licence
(https://opensource.org/licenses/MIT).
@@ -66,17 +66,17 @@ to track the issues and follow progress.
The polyglossia package
(C) 2008–2010 François Charette
- (C) 2011–2021 Arthur Reutenauer
+ (C) 2011–2022 Arthur Reutenauer
(C) 2013 Elie Roux
(C) 2019 Bastien Roucariès
- (C) 2019–2021 Jürgen Spitzmüller
+ (C) 2019–2022 Jürgen Spitzmüller
License information appended
\endpreamble
\postamble
- Copyright (C) 2021 by Arthur Reutenauer <arthur 'dot' reutenauer 'at' normalesup 'dot' org>
+ Copyright (C) 2022 by Arthur Reutenauer <arthur 'dot' reutenauer 'at' normalesup 'dot' org>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -273,7 +273,6 @@ to track the issues and follow progress.
\generate{\file{gloss-la-x-medieval.ldf}{\from{polyglossia.dtx}{gloss-la-x-medieval.ldf}}}
\generate{\file{gloss-la.ldf}{\from{polyglossia.dtx}{gloss-la.ldf}}}
\generate{\file{gloss-lao.ldf}{\from{polyglossia.dtx}{gloss-lao.ldf}}}
-\generate{\file{gloss-latex.ldf}{\from{polyglossia.dtx}{gloss-latex.ldf}}}
\generate{\file{gloss-latin.ldf}{\from{polyglossia.dtx}{gloss-latin.ldf}}}
\generate{\file{gloss-latinclassic.ldf}{\from{polyglossia.dtx}{gloss-latinclassic.ldf}}}
\generate{\file{gloss-latinecclesiastic.ldf}{\from{polyglossia.dtx}{gloss-latinecclesiastic.ldf}}}
@@ -373,7 +372,7 @@ to track the issues and follow progress.
% !TeX spellcheck = en_US
% !TeX TS-program = xelatex
\documentclass[11pt]{ltxdoc}
-\usepackage{color}
+\usepackage{xcolor}
\usepackage{xspace,fancyvrb,longtable,booktabs}
\usepackage[neverdecrease]{paralist}
\usepackage[format=hang,labelfont=bf,labelsep=period]{caption}
@@ -512,7 +511,7 @@ to track the issues and follow progress.
% \color{xpgblue}Polyglossia: Modern multilingual typesetting with \XeLaTeX\ and \LuaLaTeX}
% \author{\TA{François Charette} \and \TA{Arthur Reutenauer}\thanks{Current maintainer}
% \and \TA{Bastien Roucariès} \and \TA{Jürgen Spitzmüller}}
-% \date{\filedate \qquad \fileversion\\
+% \date{\filedate \qquad \fileversion\thanks{Please report bugs to \url{http://github.com/reutenauer/polyglossia/issues}}\\
% \footnotesize (\textsc{pdf} file generated on \today)}
%
% \maketitle
@@ -685,11 +684,9 @@ to track the issues and follow progress.
% british & english & variant=british \\
% canadian & english & variant=canadian \\
% canadien & french & variant=canadian \\
-% classiclatin\footnote{In \pkg{babel} currently only selectable via dot modifier (\emph{latin.classic}).}
-% & latin & variant=classic \\
+% classiclatin & latin & variant=classic \\
% farsi & persian & \\
-% ecclesiasticlatin\footnote{In \pkg{babel} currently only selectable via dot modifier (\emph{latin.ecclesiastic}).}
-% & latin & variant=ecclesiastic \\
+% ecclesiasticlatin & latin & variant=ecclesiastic \\
% friulan & friulian & \\
% german\footnote{Due to the name conflict only available in \pkg{polyglossia} as \emph{germanb} (which is a \pkg{babel} synonym).}
% & german & spelling=old \\
@@ -697,8 +694,7 @@ to track the issues and follow progress.
% kurmanji & kurdish & variant=kurmanji \\
% lowersorbian & sorbian & variant=lower \\
% magyar & hungarian & \\
-% medievallatin\footnote{In \pkg{babel} currently only selectable via dot modifier (\emph{latin.medieval}).}
-% & latin & variant=medieval \\
+% medievallatin & latin & variant=medieval \\
% naustrian & german & variant=austrian \\
% newzealand & english & variant=newzealand \\
% ngerman & german & variant=german [\emph{default}] \\
@@ -717,7 +713,7 @@ to track the issues and follow progress.
% \bottomrule
% \end{tabular}
% \end{minipage}
-%
+%
% \end{table}
%
% For convenience reasons, \pkg{polyglossia} also supports the use of babel names\new{1.46} (for the few justified
@@ -1214,7 +1210,7 @@ to track the issues and follow progress.
% \paragraph*{Commands:}
% \begin{itemize}
% \item \Cmd\abjad outputs Arabic \textit{abjad} numbers according to the Mashriq varieties.
-% Example: ¦\abjad{1863}¦ yields \textarabic{\abjad{1863}}.
+% Example: ¦\abjad{1863}¦ yields \textarabic{\abjad{1863}}.
% \item \Cmd\abjadmaghribi outputs Arabic \textit{abjad} numbers according to the Maghrib varieties.
% Example: ¦\abjadmaghribi{1863}¦ yields \textarabic{\abjadmaghribi{1863}}.
% \item \Cmd\abjadalph\new{1.50} steps through the Arabic alphabet, thus it can only be used up to 28.
@@ -1330,17 +1326,17 @@ to track the issues and follow progress.
% \item[¦"/¦] a slash that allows for a subsequent line break. As opposed to \cmd\slash, hyphenation
% at the breakpoints preset in the hyphenation patterns is still allowed.
% \end{shorthands}
-% Furthermore, the following shorthands generate easy access to Croatian digraphs (ligatures):
+% Furthermore, the following shorthands generate easy access to Croatian digraphs:
% \begin{shorthands}
-% \item[¦"dz¦] Generates the ligature \charifavailable{01C6}{dž}\ if the font provides it. If not, the
-% two characters are output separately. Also available for ¦"Dz¦ (\charifavailable{01C5}{Dž})
-% and ¦"DZ¦ (\charifavailable{01C4}{DŽ}).
-% \item[¦"lj¦] Generates the ligature \charifavailable{01C9}{lj}\ if the font provides it. If not, the
-% two characters are output separately. Also available for ¦"Lj¦ (\charifavailable{01C8}{Lj})
-% and ¦"LJ¦ (\charifavailable{01C7}{LJ}).
-% \item[¦"nj¦] Generates the ligature \charifavailable{01CC}{nj}\ if the font provides it. If not, the
-% two characters are output separately. Also available for ¦"Nj¦ (\charifavailable{01CB}{Nj})
-% and ¦"NJ¦ (\charifavailable{01CA}{NJ}).
+% \item[¦"dz¦] Generates the digraph \charifavailable{01C6}{dž}\ if the font provides it. If not,
+% the two consecutive glyphs are output mimicking the digraph. Also available for
+% ¦"Dz¦ (\charifavailable{01C5}{Dž}) and ¦"DZ¦ (\charifavailable{01C4}{DŽ}).
+% \item[¦"lj¦] Generates the digraph \charifavailable{01C9}{lj}\ if the font provides it. If not,
+% the two consecutive glyphs are output mimicking the digraph. Also available for
+% ¦"Lj¦ (\charifavailable{01C8}{Lj}) and ¦"LJ¦ (\charifavailable{01C7}{LJ}).
+% \item[¦"nj¦] Generates the digraph \charifavailable{01CC}{nj}\ if the font provides it. If not,
+% the two consecutive glyphs are output mimicking the digraph. Also available for
+% ¦"Nj¦ (\charifavailable{01CB}{Nj}) and ¦"NJ¦ (\charifavailable{01CA}{NJ}).
% \end{shorthands}
%
% Finally, there are also four shorthands for quotation marks:
@@ -1350,19 +1346,21 @@ to track the issues and follow progress.
% \item[¦">¦] for Croatian left guillemets (»).
% \item[¦"<¦] for Croatian right guillemets («).
% \end{shorthands}
-% \item \xpgboolkeyfalse[1.47]{disableligatures}
-% If this is \xpgvalue{true}, all Croatian ligatures (for digraphs such as
-% \charifavailable{01C6}{dž}) will be replaced by single characters. This can
-% be useful if the ligatures on your font are broken (if the font does not
-% have them, they are automatically replaced).
+% \item \xpgboolkeyfalse[1.47]{disabledigraphs}[Up to version 1.53, the option was
+% called \xpgvalue{disableligatures}. The old option is kept for backwards compatibility,
+% but the use is discouraged.] If this is \xpgvalue{true}, all Croatian digraphs
+% (such as \charifavailable{01C6}{dž}) will be replaced by the two consecutive letters,
+% which is the most common way of typesetting them in Croatian. This can be useful if
+% the Unicode digraphs in your font are broken (if the font does not have them,
+% they are automatically mimicked by the two consecutive glyphs).
% \item \xpgboolkeytrue[1.53]{localalph}
% If \xpgvalue{true}, alphanumeric counters will use a locally established version which excludes
% the characters \meta{q}, \meta{w}, \meta{x} and \meta{y} from alphabetic counting.
% Obviously this limits the counting range to 22.
% \item \xpgboolkeytrue[1.51]{splithyphens}
-% According to Croatian typesetting conventions, if a word with a hard hyphen (such as \emph{je-li})
-% is hyphenated at this hyphen, a second hyphenation character is to be inserted at the beginning
-% of the line that follows the hyphenation (\emph{je-/-li}).
+% According to Croatian typesetting conventions, if a word with a hard hyphen (such as
+% \emph{hrvatsko-engleski}) is hyphenated at this hyphen, a second hyphenation character is to be
+% inserted at the beginning of the line that follows the hyphenation (\emph{hrvatsko-/-engleski}).
% By default, this is done automatically (if you are using \LuaTeX, the \pkg{luavlna} package is
% loaded to achieve this).
% Set this option to ¦false¦ to disable the feature.
@@ -1450,6 +1448,13 @@ to track the issues and follow progress.
% \item[¦"/¦] a slash that allows for a subsequent line break. As opposed to \cmd\slash,
% hyphenation at the breakpoints preset in the hyphenation patterns is still allowed.
% \end{shorthands}
+% \item \xpgboolkeyfalse[1.54]{schoolhyphens}
+% If this is set to true, alternative (experimental) hyphenation patterns are used rather than the
+% default Finnish patterns. These patterns (called `School Hyphenation') are more basic in that
+% they do not contain hyphenation exceptions for compound words since these result in simple words
+% not being hyphenated at points where this would be valid. The backdrop of the `School' patterns
+% is that compound words might be hyphenated incorrectly.
+% See \url{https://github.com/hyphenation/basic-finnish} for details.
% \end{itemize}
%
% \subsection{french}\label{french}
@@ -1881,16 +1886,22 @@ to track the issues and follow progress.
% \item[¦=A¦] for Ā (A with macron), also available for Ē, Ī, Ō, Ū, V̄, and Ȳ.
% Note that a macron above the letter V is only displayed if your font
% supports the Unicode character ¦0304¦ (\emph{combining macron}).
-% \item[¦=ae¦] for a͞e (ae diphthong with macron), also available for a͞u, e͞u,
-% and o͞e. Note that macrons above diphthongs are only displayed if your font
-% supports the Unicode character ¦035E¦ (\emph{combining double
+% \item[¦=ae¦] for a͞e (ae diphthong with macron, for the ¦classic¦ and
+% the ¦modern¦ variant) or ǣ (ae ligature with macron, for the ¦medieval¦
+% and the ¦ecclesiastic¦ variant), respectively; also available for a͞u,
+% e͞u, and o͞e/œ̄. Note that macrons above diphthongs are only displayed if
+% your font supports the Unicode character ¦035E¦ (\emph{combining double
% macron}).
-% \item[¦=Ae¦] for A͞e (Ae diphthong with macron), also available for A͞u, E͞u,
-% and O͞e.
-% \item[¦=AE¦] for A͞E (AE diphthong with macron), also available for A͞U, E͞U,
-% and O͞E.
+% \item[¦=Ae¦] for A͞e (Ae diphthong with macron, for the ¦classic¦ and
+% the ¦modern¦ variant) or Ǣ (AE ligature with macron, for the ¦medieval¦
+% and the ¦ecclesiastic¦ variant), respectively; also available for A͞u,
+% E͞u, and O͞e/Œ̄.
+% \item[¦=AE¦] for A͞E (AE diphthong with macron, for the ¦classic¦ and
+% the ¦modern¦ variant) or Ǣ (AE ligature with macron, for the ¦medieval¦
+% and the ¦ecclesiastic¦ variant), respectively; also available for A͞U,
+% E͞U, and O͞E/Œ̄.
% \item[¦\textasciicircum a¦] for ă (a with breve), also available for ĕ, ĭ,
-% ŏ, ŭ, and y̆. Note that a breve above the letter y is only displayed if
+% ŏ, ŭ, and y̆. Note that a breve above the letter y is only displayed if
% your font supports the Unicode character ¦0306¦ (\emph{combining
% breve}).
% \item[¦\textasciicircum A¦] Ă (A with breve), also available for Ĕ, Ĭ, Ŏ,
@@ -1996,6 +2007,32 @@ to track the issues and follow progress.
% \paragraph*{Options:}
% \begin{itemize}
% \item \xpgchoicekey[1.45]{variant}{\xpgvalue{brazilian} or \xpgpresetvalue{portuguese}}
+% \item \xpgboolkeyfalse[1.54]{babelshorthands}
+% If this is turned on, the following shorthands for fine-tuning hyphenation and micro-typography
+% of Portuguese words are activated.
+% \begin{shorthands}
+% \item[¦"|¦] disables a ligature at this position.
+% \item[¦"=¦] for an explicit hyphen sign which is repeated at the beginning
+% of the next line when hyphenated, as common in Portuguese typesetting
+% (also if ¦splithyphens=false¦). Unlike plain ¦-¦, this also allows
+% for hyphenation at the other points preset in the hyphenation patterns.
+% \item[\texttt{"\textasciitilde}] for a hyphen sign without a breakpoint. Useful for
+% cases where the hyphen should stick at the following syllable.
+% \item[¦"-¦] adds a hyphenation point that does still allow for hyphenation at the points preset
+% in the hyphenation patterns (as opposed to \cmd\-).
+% \item[¦""¦] allows for a line break at this position (without hyphenation sign).
+% \item[¦"/¦] a slash that allows for a subsequent line break. As opposed to \cmd\slash, hyphenation
+% at the breakpoints preset in the hyphenation patterns is still allowed.
+% \item[¦"<¦] for French left guillemets («).
+% \item[¦">¦] for French right guillemets (»).
+% \end{shorthands}
+% \item \xpgboolkeytrue[1.54]{splithyphens}
+% According to Portuguese typesetting conventions, if a word with a hard hyphen (such as
+% \emph{pára-brisas}) is hyphenated at this hyphen, a second hyphenation character is to be
+% inserted at the beginning of the line that follows the hyphenation (\emph{pára-/-brisas}).
+% By default, this is done automatically (if you are using \LuaTeX, the \pkg{luavlna} package is
+% loaded to achieve this).
+% Set this option to ¦false¦ to disable the feature.
% \end{itemize}
%
% \subsection{russian}\label{russian}
@@ -2093,6 +2130,13 @@ to track the issues and follow progress.
% \paragraph*{Options:}
% \begin{itemize}
% \item \xpgchoicekey{script}{\xpgpresetvalue{Cyrillic} or \xpgvalue{Latin}}
+% \item \xpgboolkeytrue[1.54]{splithyphens}
+% According to Serbian typesetting conventions, if a word with a hard hyphen (such as
+% \emph{калцијум-карбонат}) is hyphenated at this hyphen, a second hyphenation character is to be
+% inserted at the beginning of the line that follows the hyphenation (\emph{калцијум-/-карбонат}).
+% By default, this is done automatically (if you are using \LuaTeX, the \pkg{luavlna} package is
+% loaded to achieve this).
+% Set this option to ¦false¦ to disable the feature.
% \item \xpgchoicekey{numerals}{\xpgpresetvalue{arabic}, \xpgvalue{cyrillic-alph} or \xpgvalue{cyrillic-trad}}
% Uses either Arabic numerals or Cyrillic alphanumerical numbering. The two Cyrillic variants differ as follows:
% \begin{itemize}
@@ -2125,7 +2169,8 @@ to track the issues and follow progress.
% \begin{shorthands}
% \item[¦"=¦] for an explicit hyphen sign which is repeated at the beginning
% of the next line when hyphenated, as common in Slovak typesetting
-% (only needed with ¦splithyphens=false¦).
+% (also if ¦splithyphens=false¦). Unlike plain ¦-¦, this also allows
+% for hyphenation at the other points preset in the hyphenation patterns.
% \item[¦"|¦] disables a ligature at this position.
% \item[\texttt{"\textasciitilde}] for a hyphen sign without a breakpoint. Useful for
% cases where the hyphen should stick at the following syllable.
@@ -2365,11 +2410,11 @@ to track the issues and follow progress.
% (such as, in the case of English, ¦\def\chaptername{Chapter}¦)
% \item \Cmd{\date\meta{lang}} stores definitions of date formats (usually redefinitions
% of \cmd\today, in some cases also definitions of additional date commands)
-% \item \Cmd{\blockextras\meta{lang}} stores macros that are to be executed when the language
+% \item \Cmd{\blockextras@\meta{lang}} stores macros that are to be executed when the language
% \meta{lang} is activated via \cmd\selectlanguage\ command or the \meta{lang} environment
-% \item \Cmd{\inlineextras\meta{lang}} stores macros that are to be executed when the language
+% \item \Cmd{\inlineextras@\meta{lang}} stores macros that are to be executed when the language
% \meta{lang} is activated locally via \cmd\text\meta{lang} command
-% \item \Cmd{\noextras\meta{lang}} stores macros that are to be executed when the language
+% \item \Cmd{\noextras@\meta{lang}} stores macros that are to be executed when the language
% \meta{lang} is closed
% \end{itemize}
% ^^A
@@ -2720,6 +2765,48 @@ to track the issues and follow progress.
% \section{Revision history}
%
% \bgroup\footnotesize
+% \subsection*{1.54 (27-03-2022)}
+%
+% \subsubsection*{New features}
+% \begin{itemize}
+% \item New option \xpgoption{splithyphens} for Serbian (\TXI{496}) and Portuguese (\TXI{534}).
+% \item Add \xpgoption{babelshorthands} to Portuguese.
+% \item Add \xpgoption{schoolhyphens} option to Finnish (\TXI{525}).
+% \end{itemize}
+%
+% \subsubsection*{Interface and defaults changes}
+% \begin{itemize}
+% \item Rename \xpgoption{disableligatures} to \xpgoption{disabledigraphs} for Croatian (\TXI{497}, \TXP{500}).
+% \item Fix output with \xpgoption{numerals=cyrillic-alph} (part of \TXI{503}).
+% \item Standardize February and November in Indonesian according to the Great Dictionary of the Indonesian Language
+% of the Language Center (\emph{Kamus Besar Bahasa Indonesia}) (\TXP{526}).
+% \end{itemize}
+%
+% \subsubsection*{Bug fixes}
+% \begin{itemize}
+% \item Fix robustification of font family switches (\TXI{428}).
+% \item Preserve font family switches across languages (\TXI{519}).
+% \item Fix \TeX\ dash ligatures with \xpgoption{splithyphens} (\TXI{502}).
+% \item Prevent \emph{missing hyphenmins value} \LaTeX\ error with unknown languages (\TXI{513}).
+% \item Fix global \xpgoption{babelshorthands}, \xpgoption{localmarks} and \xpgoption{verbose}
+% options (\TXI{515}).
+% \item Fix Latin shorthands (\TXI{516}).
+% \item Remove spurious space in Bosnian date (\TXP{528}).
+% \item Fix \cmd\languagevariant\ and \cmd\mainlanguagevariant\ macros (\TXI{530}, \TXI{531}).
+% \item Make \cmd\iflanguageloaded\ and friends work in preamble (\TXI{532}).
+% \item Fix deactivation of shorthands (\TXI{320}).
+% \item Fix deactivation of numerals.
+% \item Update deprecated \LaTeX\ hooks (\TXI{523}).
+% \item Fix \xpgoption{luatexrenderer} option which was not considered appropriately (\TXI{533}).
+% \item Turn warning about \texttt{totalhyphenmin} to info, which is more appropriate (\TXI{111}).
+% \end{itemize}
+%
+% \subsubsection*{Documentation improvements}
+% \begin{itemize}
+% \item Document in this manual where to report bugs (\TXI{512}).
+% \end{itemize}
+%
+%
% \subsection*{1.53 (12-04-2021)}
%
% \subsubsection*{New features}
@@ -2952,12 +3039,13 @@ to track the issues and follow progress.
% change of behavior should you have used one of these options without value (\TXI{363}).
% Concerned are the following options:
% \begin{itemize}
-% \item ¦babelshorthands¦ in language Belarusian, Mongolian, Ukrainian, and Russian
-% (now ¦babelshorthands¦ equals ¦babelshorthand=true¦, no longer ¦babelshorthands=false¦).
-% \item ¦localalph¦ in language Slovenian (¦localalph¦ now equals ¦localalph=true¦).
-% \item ¦latesthyphen¦ in language German (¦latesthyphen¦ now equals ¦latesthyphen=true¦).
-% \item ¦fullyear¦ in package \pkg{hebrewcal} (¦fullyear¦ now equals ¦fullyear=true¦).
+% \item \xpgoption{babelshorthands} in language Belarusian, Mongolian, Ukrainian, and Russian
+% (now \xpgoption{babelshorthands} equals \xpgoption{babelshorthand=true}, no longer \xpgoption{babelshorthands=false}).
+% \item \xpgoption{localalph} in language Slovenian (\xpgoption{localalph} now equals \xpgoption{localalph=true}).
+% \item \xpgoption{fullyear} in package \pkg{hebrewcal} (\xpgoption{fullyear} now equals \xpgoption{fullyear=true}).
% \end{itemize}
+% \item The option \xpgoption{latesthyphen} in language German is deprecated. \XeTeX\ and \LuaTeX\ nowadays
+% always use the latest German hyphens.
% \item The command ¦\setlanguagealias*¦ (introduced in v1.46) does no longer define
% dedicated alias environments.
% \item The babelnames for Latin variants have been corrected to ¦classiclatin¦, ¦ecclesiasticlatin¦
@@ -3512,7 +3600,7 @@ to track the issues and follow progress.
% Many thanks to all the people who have contributed bugfixes and new features to \pkg{polyglossia}
% since we took over.
% In alphabetical order: \TA{Ignas Anikevicius}, \TA{Sina Ahmadi}, \TA{Wouter Bolsterlee}, \TA{Christian Buhtz},
-% \TA{Zgarbul Andrey}, \TA{Oleg Domanov}, \TA{Philipp Gesang}, \TA{Kevin Godby}, \TA{Enrico Gregorio},
+% \TA{Zgarbul Andrey}, \TA{Oleg Domanov}, user \TA{fakhriaunur}, \TA{Philipp Gesang}, \TA{Kevin Godby}, \TA{Enrico Gregorio},
% \TA{Khaled Hosny}, \TA{Najib Idrissi}, user \TA{julroy67}, \TA{Dohyun Kim}, \TA{Phil Kime}, \TA{Mike Kroutikov},
% \TA{Ivan Kokan}, \TA{Caleb Maclennan}, \TA{José Mancera}, \TA{Miquel Ortega}, \TA{Yevgen Pogribnyi}, \TA{Will Robertson},
% \TA{Maïeul Rouquette}, \TA{Elie Roux}, \TA{Hugo Roy}, \TA{Guy Rutenberg}, \TA{Philipp Stephani}, \TA{Niranjan Tambe},
@@ -3543,7 +3631,7 @@ to track the issues and follow progress.
% \subsection{polyglossia.sty}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{polyglossia}[2021/04/12 v1.53
+\ProvidesPackage{polyglossia}[2022/03/27 v1.54
Modern multilingual typesetting with XeLaTeX and LuaLaTeX]
\RequirePackage{etoolbox}
\RequirePackage{makecmds}
@@ -3560,27 +3648,45 @@ to track the issues and follow progress.
% Execute code #3 if package #1 has been loaded already, else
% add to package hook #2
-\newcommand\xpg@at@package[3]{%
- \@ifpackageloaded{#1}{#3}{\AddToHook{#2}{#3}}%
-}
-
+\cs_new_nopar:Nn \__xpg_at_package_hook:nnn{
+ \@ifpackageloaded{#1}{#3}{\AddToHook{#2}{#3}}%
+}
+
+% safe according to expl3 bug #960
+\cs_generate_variant:Nn \prop_item:Nn { Ne, Nf, No, Nx }
+\cs_generate_variant:Nn \clist_set:Nn { Ne, Nf, No, Nx }
+\cs_generate_variant:Nn \clist_gput_right:Nn {Ne}
+\cs_generate_variant:Nn \prop_get:NnN {NeN}
+\cs_generate_variant:Nn \prop_gput:Nnn {Nne, Nee, Nen}
+\cs_generate_variant:Nn \cs_gset:Npn {Npe}
+\cs_generate_variant:Nn \cs_new:Nn {Ne}
+\cs_generate_variant:Nn \cs_new_nopar:Nn {Ne}
+\cs_generate_variant:Nn \cs_gset_nopar:Npn {Npe}
+\cs_generate_variant:Nn \cs_gset_nopar:Npn {cpe}
+\cs_generate_variant:Nn \tl_set:Nn {Ne}
+\cs_generate_variant:Nn \str_foldcase:n {e}
+\prg_generate_conditional_variant:Nnn \file_if_exist:n {e} {TF, T, F, p}
+\prg_generate_conditional_variant:Nnn \tl_if_blank:n {e} {TF, T, F, p}
+\prg_generate_conditional_variant:Nnn \clist_if_in:Nn {Ne} {TF, T, F, p}
+\prg_generate_conditional_variant:Nnn \prop_if_in:Nn {Ne} {TF, T, F, p}
% correct a bug in tracklang
-\xpg@at@package{tracklang}{file/after/tracklang.sty}{%
+\__xpg_at_package_hook:nnn{tracklang}{file/tracklang.sty/after}{%
\@ifpackagelater{tracklang}{2019/08/30}{}{\global\def\AddTrackedLangage{\AddTrackedLanguage}}
}
-
%% This is for compatibility with Babel-aware package:
\def\languageshorthands#1{\relax} %this is for scrlttr2 class
\def\bbl@cs#1{\csname bbl@#1\endcsname}%
\AtEndPreamble{\let\bbl@set@language\xpg@set@language@aux} %for biblatex
\AtEndPreamble{\let\bbl@main@language\xpg@main@language} %for biblatex
-\providecommand\texorpdfstring[2]{#1}% dummy command if hyperref is not loaded
+\AtEndPreamble{
+ \providecommand\texorpdfstring[2]{#1}% dummy command if hyperref is not loaded
+}
-\ifluatex
+\sys_if_engine_luatex:T{
\RequirePackage{luatexbase} % already included by fontspec, but needed here
\RequireLuaModule{polyglossia}
-\fi
+}
% Which version of XeTeX do we use? What is the boudary class? 4095 or 255
\@ifundefined{e@alloc@intercharclass@top}
@@ -3588,10 +3694,16 @@ to track the issues and follow progress.
{\let\xpg@boundaryclass=\e@alloc@intercharclass@top}
% Useful for getting list of loaded languages and variants. Like babel's bbl@loaded
-\let\xpg@loaded\@empty% list of loaded languages (polyglossia name)
-\let\xpg@vloaded\@empty% list of loaded variants
-\let\xpg@bloaded\@empty% list of loaded languages (babel name)
-\let\xpg@bcp@loaded\@empty% list of loaded languages (bcp-47 id)
+% all language loaded
+\seq_new:N \__xpg_langs_loaded
+% list of loaded languages (polyglossia name)
+\clist_new:N \xpg@loaded
+% list of loaded variants
+\clist_new:N \xpg@vloaded
+% list of loaded languages (babel name)
+\clist_new:N \xpg@bloaded
+% list of loaded languages (bcp-47 id)
+\clist_new:N \xpg@bcp@loaded
% counter in latin
\def\latinalph#1{\expandafter\latin@alph\csname c@#1\endcsname}
@@ -3661,25 +3773,37 @@ to track the issues and follow progress.
% error out if lang is not loaded
\cs_new_nopar:Nn \polyglossia@error@iflangnotloaded:n
{
- \cs_if_exist:cF{#1@loaded}
+ \seq_if_in:NxF \__xpg_langs_loaded {#1}
{
\xpg@error{language~ #1~ is~ not~ loaded.~ Please~ load~ it~ before~ using~ it.}
}
}
+\msg_new:nnn { polyglossia } { languagenotloaded }
+{
+ The~ language~ #1~ is~ not~ loaded.~ You~ should~ load~ it.
+}
+\msg_redirect_name:nnn { polyglossia } { languagenotloaded } { critical }
-% error do not use directly the gloss file
-\msg_new:nnn { polyglossia } { directloadgloss }
+\cs_new_nopar:Nn \__xpg_msg_if_lang_not_loaded:n
{
- You~ should~ not~ load~ directly~ the~ gloss~ file~ using~ `\string\usepackage'.
- You~ must~ use~ `\string\setotherlanguage\{#1\}' or `\string\setmainlanguage\{#1\}'.
+ \tl_if_blank:eT {\xpg_alias_base_lang:n{#1}}
+ {
+ \msg_show:nnn { polyglossia } { languagenotloaded } {#1}
+ }
}
-\msg_redirect_name:nnn { polyglossia } { directloadgloss } { critical }
+%
%% use macro if defined, else warn that it is not
-\def\csuse@warn#1{%
- \ifcsundef{#1}{\xpg@warning{ \expandafter\string\csname #1\endcsname\space is~ not~ defined}}%
- {\csname #1\endcsname}}
+\cs_new_nopar:Nn \__xpg_use_or_warn:N
+{
+ \cs_if_exist_use:NF {#1}
+ {
+ \xpg@warning { \tl_to_str:N {#1} ~ is~ not~ defined }
+ }
+}
+\cs_generate_variant:Nn \__xpg_use_or_warn:N {c}
+
%% ensure directionality if bidi is loaded, else ignore
\def\@@ensure@dir#1{\ifcsundef{@ensure@dir}{#1}{\@ensure@dir{#1}}}
@@ -3697,66 +3821,94 @@ to track the issues and follow progress.
}
}
+% if #1 is LR run #2 else #3
+\prg_set_conditional:Nnn \__xpg_if_LR_str:n {p, T, F, TF}
+{
+ \str_case_e:nnF{#1}{
+ {LR}{\prg_return_true:}
+ {RL}{\prg_return_false:}
+ }
+ {
+ \xpg@error{Unknown~ direction~#1}
+ \prg_return_false:
+ }
+}
+\prg_generate_conditional_variant:Nnn \__xpg_if_LR_str:n {e} {p, T, F, TF}
+
% (lua)bidi commands to change directionality for paragraphs
% and inline text.
% overwritten with correct package
\cs_new_nopar:Nn{\polyglossia@setpardirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\relax}%
- {RL}{\xpg@error{right-to-left,~ but~ (lua)bidi~ package~ was~ not~ loaded!}}%
- }%
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(base~ wrapper)}}%
+ \__xpg_if_LR_str:nF {#1}
+ {
+ \xpg@error{right-to-left,~ but~ (lua)bidi~ package~ was~ not~ loaded!}
+ }
}
\cs_new_nopar:Nn{\polyglossia@settextdirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\relax}%
- {RL}{\xpg@error{right-to-left,~ but~ (lua)bidi~ package~ was~ not~ loaded!}}%
- }%
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(base~ wrapper)}}%
+ \__xpg_if_LR_str:nF {#1}
+ {
+ \xpg@error{right-to-left,~ but~ (lua)bidi~ package~ was~ not~ loaded!}
+ }
}
-\xpg@at@package{bidi}{package/after/bidi}{%
+\__xpg_at_package_hook:nnn{bidi}{package/bidi/after}{%
\ExplSyntaxOn%
\cs_gset_nopar:Nn{\polyglossia@setpardirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\setLR}%
- {RL}{\setRL}%
- }%
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(bidi~ wrapper)}}%
+ \__xpg_if_LR_str:nTF{#1}%
+ {%
+ \setLR%
+ }%
+ {%
+ \setRL%
+ }%
}%
\cs_gset_nopar:Nn{\polyglossia@settextdirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\LRE}%
- {RL}{\RLE}%
- }%
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(bidi~ wrapper)}}%
+ \__xpg_if_LR_str:nTF{#1}%
+ {%
+ \LRE%
+ }%
+ {%
+ \RLE%
+ }%
}%
\ExplSyntaxOff%
}
-\xpg@at@package{luabidi}{package/after/luabidi}{%
+\__xpg_at_package_hook:nnn{luabidi}{package/luabidi/after}{%
\ExplSyntaxOn%
\cs_gset_nopar:Nn{\polyglossia@setpardirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\setLR}%
- {RL}{\setRL}%
- }
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(luabidi~ wrapper)}}%
+ \__xpg_if_LR_str:nTF{#1}%
+ {%
+ \setLR%
+ }%
+ {%
+ \setRL%
+ }%
}%
\cs_gset_nopar:Nn{\polyglossia@settextdirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\LRE}%
- {RL}{\RLE}%
- }
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(luabidi~ wrapper)}}%
+ \__xpg_if_LR_str:nTF{#1}%
+ {%
+ \LRE%
+ }%
+ {%
+ \RLE%
+ }%
}%
\ExplSyntaxOff%
}
+% emulate \RTLmain
+\cs_new_nopar:Nn \__xpg_setRTLmain: {}
+\str_case_e:nnF{\c_sys_engine_str}{%
+ {luatex}{\cs_gset:Nn \__xpg_setRTLmain: {\setRTLmain}}
+ {xetex}{\cs_gset:Nn \__xpg_setRTLmain: {\@RTLmaintrue\setnonlatin}}
+}
+{
+ \cs_gset:Nn \__xpg_setRTLmain:
+ {
+ \xpg@warning{You’re~ running a~ TeX~ engine~ that~ is~ not~ LuaTeX~ or~ XeTeX.\MessageBreak
+ That~ is~ almost~ guaranteed~ to~ cause~ problems.}
+ }
+}
+
%% compatibility with babel
\let\addto\gappto% gappto is defined in etoolbox
@@ -3792,6 +3944,8 @@ to track the issues and follow progress.
%% TODO? \toggletrue{#1@setup@done}%
% reinit \do
\def\do##1{\setotherlanguage{##1}}%
+ % register base alias
+ \xpg_language_alias { #1 } { #1 }
}
% Adjust language key setting after initial setup
@@ -3804,14 +3958,14 @@ to track the issues and follow progress.
% setup hyphennames from a str list of hyphen
\cs_new:Nn \polyglossia_setup_hyphen:n {
- \exp_args:Nne \clist_set:Nn{\l_tmpa_clist}{\prop_item:Nn \polyglossia@langsetup {#1 / hyphennames}}
+ \clist_set:Ne{\l_tmpa_clist}{\prop_item:Nn \polyglossia@langsetup {#1 / hyphennames}}
\providebool{havehyphen}
\boolfalse{havehyphen}
% for each hyphen in the set until we find one that works
\clist_map_inline:Nn \l_tmpa_clist {
\ifbool{havehyphen}{}{%
% check if language hyphenname is defined
- \polyglossia@check@ifdefined:NF{#1}{%
+ \__xpg_check_if_exist_l@:NF{#1}{%
% if not, first consider nohyphenation
\str_if_eq:nnTF{##1}{nohyphenation}
{%
@@ -3828,7 +3982,7 @@ to track the issues and follow progress.
\xpg@set@hyphenation@patterns{##1}
\global\booltrue{havehyphen}
}%
- }{}%
+ }{}%
}%
}%
}%
@@ -3847,7 +4001,7 @@ to track the issues and follow progress.
\polyglossia@setup@language@patterns{#1}%
}%
% setup hyphenmins
- \exp_args:NNe \clist_set:Nn \l_tmpa_clist
+ \clist_set:Ne \l_tmpa_clist
{ \prop_item:Nn \polyglossia@langsetup {#1 / hyphenmins} }
\cs_if_eq:cNF {l@#1} \l@nohyphenation
{
@@ -4053,7 +4207,14 @@ to track the issues and follow progress.
\prop_gput:Nnn{\polyglossia@langsetup}{#1/Localnumeral}{##1}
},
#1 / Localnumeral.value_required:n = true,
- #1 / Localnumeral.initial:n = {polyglossia@C@localnumeral}
+ #1 / Localnumeral.initial:n = {polyglossia@C@localnumeral},
+ % environment define command (by default create the environment)
+ #1 / DefineCommandsCmd
+ .code:n = {\prop_gput:Nnn{\polyglossia@langsetup}{#1/DefineCommandsCmd}{##1}},
+ #1 / DefineCommandsCmd
+ .value_required:n = true,
+ #1 / DefineCommandsCmd
+ .initial:n = {xpg_define_language_commands:e}
}
}
@@ -4297,7 +4458,10 @@ to track the issues and follow progress.
}
}
-\AtEndDocument{\prop_log:N{\polyglossia@langsetup}}
+\AtEndDocument{
+ \prop_log:N{\polyglossia@langsetup}
+ \prop_log:N{\__xpg_alias}
+}
\def\xpg@lastlanguage{0}%
\providebool{xpg@hyphenation@disabled}%
@@ -4454,7 +4618,9 @@ to track the issues and follow progress.
}%
\polyglossia@addfontfeature@language:xx{\prop_item:Nn{\polyglossia@langsetup}{#1/langtag}}
{\prop_item:Nn{\polyglossia@langsetup}{#1/language}}
- }}%
+ }%
+ \def\familytype{rm}%
+ }%
\csgdef{#1@font@sf}{%
\cs_if_exist_use:cF{#1fontsf}%
{
@@ -4475,7 +4641,9 @@ to track the issues and follow progress.
}%
\polyglossia@addfontfeature@language:xx{\prop_item:Nn{\polyglossia@langsetup}{#1/langtag}}
{\prop_item:Nn{\polyglossia@langsetup}{#1/language}}
- }}%
+ }%
+ \def\familytype{sf}%
+ }%
\csgdef{#1@font@tt}{%
\cs_if_exist_use:cF{#1fonttt}%
{
@@ -4496,7 +4664,9 @@ to track the issues and follow progress.
}%
\polyglossia@addfontfeature@language:xx{\prop_item:Nn{\polyglossia@langsetup}{#1/langtag}}
{\prop_item:Nn{\polyglossia@langsetup}{#1/language}}
- }}%
+ }%
+ \def\familytype{tt}%
+ }%
\endgroup
}
@@ -4552,21 +4722,29 @@ to track the issues and follow progress.
\newXeTeXintercharclass\xpg@normalclass %TODO
}{}
-\ifxetex
%% when no patterns are available, we use \l@nohyphenation, assigned to 255
%% (suggestion by Enrico Gregorio)
- \@ifundefined{l@nohyphenation}{\chardef\l@nohyphenation=255 }{}
-\else\ifluatex
- \@ifundefined{l@nohyphenation}{\chardef\l@nohyphenation=\directlua{
- tex.sprint(polyglossia.newloader_loaded_languages.nohyphenation)}\relax
- }{}
-\fi\fi
+\str_case_e:nn{\c_sys_engine_str}{
+ {luatex}
+ {
+ \@ifundefined{l@nohyphenation}
+ {\chardef\l@nohyphenation=\directlua{
+ tex.sprint(polyglossia.newloader_loaded_languages.nohyphenation)}\relax
+ }
+ {}
+ }
+ {xetex}
+ {
+ \@ifundefined{l@nohyphenation}{\chardef\l@nohyphenation=255 }{}
+ }
+}
+
%we call this macro when a gloss file is not found for a given language
\def\xpg@nogloss#1{%
\xpg@warning{File~ gloss-#1.ldf~ does~ not~ exist!\MessageBreak
I~ will~ nevertheless~ try~ to~ use~ hyphenation~ patterns~ for~ #1.}%
- \PolyglossiaSetup{#1}{hyphenmins,hyphennames={#1},fontsetup=true}%
+ \PolyglossiaSetup{#1}{hyphenmins={2,3},hyphennames={#1},fontsetup=true}%
% the above amounts to:
%\ifcsundef{l@#1}%
% {\expandafter\adddialect\csname l@#1\endcsname\l@nohyphenation\relax}%
@@ -4583,40 +4761,105 @@ to track the issues and follow progress.
\catcode`\@=\xpg@saved@at@catcode%
}
+%% Load a lde file
+\cs_new_nopar:Nn \__xpg_gloss_ext: {lde}
+\cs_new_nopar:Ne \__xpg_saved_@pkgextension: {\@pkgextension}
+
+\msg_new:nnn { polyglossia } { directloadgloss }
+{
+ You~ should~ not~ load~ directly~ the~ gloss~ file. ~
+ You~ must~ use~ `\string\setotherlanguage\{#1\}' or `\string\setmainlanguage\{#1\}'.
+}
+\msg_redirect_name:nnn { polyglossia } { directloadgloss } { critical }
+\NewDocumentCommand{\__xpg_ProvidesLanguageDefinitionExtension_error}{m m m m}
+{
+ \msg_critical:nn { polyglossia } { directloadgloss }
+}
+% ProvideExplPackage but for language file
+\cs_new_eq:NN \ProvidesLanguageDefinitionExtension \__xpg_ProvidesLanguageDefinitionExtension_error
+\cs_new_eq:NN \__xpg_saved_ProvidesExplPackage \ProvidesExplPackage
+\NewDocumentCommand{\__xpg_ProvidesLanguageDefinitionExtension}{m m m m}
+{
+ \__xpg_saved_ProvidesExplPackage{#1}{#2}{#3}{#4}
+ \cs_gset_eq:NN \@pkgextension \__xpg_saved_@pkgextension:
+ \cs_gset_eq:NN \ProvidesLanguageDefinitionExtension \__xpg_ProvidesLanguageDefinitionExtension_error
+}
+
+
+% wrapper for loading a gle file
+\NewDocumentCommand{\RequireLanguageDefinitionExtension}{O{} m}
+{
+ \cs_gset_eq:NN \__xpg_saved_@pkgextension: \@pkgextension
+ \cs_gset_eq:NN \__xpg_saved_ProvidesExplPackage \ProvidesExplPackage
+ \cs_gset_eq:NN \@pkgextension \__xpg_gloss_ext:
+ \cs_gset_eq:NN \ProvidesLanguageDefinitionExtension \__xpg_ProvidesLanguageDefinitionExtension
+ \RequirePackage[#1]{gloss-#2}
+ % be paranoiac restore
+ \cs_gset_eq:NN \@pkgextension \__xpg_saved_@pkgextension:
+ \cs_gset_eq:NN \__xpg_ProvidesLanguageDefinitionExtension_error \ProvideLanguageDefinitionExtension
+}
+
% try to load a language file
\cs_new:Nn \polyglossia_load_lang_definition:nn {
- \file_if_exist:nTF{gloss-#2.ldf}
+ \file_if_exist:eTF{gloss-#2.lde}
{
- % Temporarily force catcode of ~ to 13 since babelsh.def
- % requires it. This is needed particularly with LaTeX3
- % packages which force \ExplSyntaxOn (#425)
- \protected\edef\xpg@restore@tilde@catcode{\catcode 126 = \the\catcode 126\relax}
- \catcode 126 = 13
- \xpg@input{gloss-#2.ldf}
+ \RequireLanguageDefinitionExtension[#1]{#2}
\setkeys{#2}{#1}
- % restore former ~ catcode
- \xpg@restore@tilde@catcode
}
{
- \xpg@nogloss{#2}
+ \file_if_exist:nTF{gloss-#2.ldf}
+ {
+ % Temporarily force catcode of ~ to 13 since babelsh.def
+ % requires it. This is needed particularly with LaTeX3
+ % packages which force \ExplSyntaxOn (#425)
+ \protected\edef\xpg@restore@tilde@catcode{\catcode 126 = \the\catcode 126\relax}
+ \catcode 126 = 13
+ \xpg@input{gloss-#2.ldf}
+ \setkeys{#2}{#1}
+ % restore former ~ catcode
+ \xpg@restore@tilde@catcode
+ }
+ {
+ \xpg@nogloss{#2}
+ }
}
}
+\cs_generate_variant:Nn \polyglossia_load_lang_definition:nn {
+ ee, ef, en, eo, ex,
+ fe, ff, fn, fo, fx,
+ ne, nf, no, nx,
+ oe, of, on, oo, ox,
+ xe, xf, xn, xo, xx
+}
% load a master language from an alias file
\newcommand*\xpg@load@master@language[1] {
- \xpg@input{gloss-#1.ldf}
- \ifcsundef{#1@loaded}%
- {
- \exp_args:Nx\polyglossia@define@language@cmd:n{#1}%
- }{}
- \polyglossia@register@language:nn{}{#1}%
- \csgdef{#1@loaded}{}%
+ \file_if_exist:eTF{gloss-#1.lde}
+ {
+ \RequireLanguageDefinitionExtension{#1}
+ }
+ {
+ \xpg@input{gloss-#1.ldf}
+ }
+ \seq_if_in:NxF \__xpg_langs_loaded {#1}
+ {
+ % define environment and command if not alias
+ \str_if_eq:eeT {\prop_item:Ne \__xpg_alias {#1/target}} {#1} {
+ \use:c{\prop_item:Nn{\polyglossia@langsetup}
+ {#1/DefineCommandsCmd}}
+ {#1}
+ }
+ }
+ \polyglossia@register@language:nn{}{#1}%
+ \seq_gput_right:Nn \__xpg_langs_loaded {#1}
}
+\prop_new:N \__xpg_alias
-% define environment and command
-\cs_new:Nn \polyglossia@define@language@cmd:n {
- \ifcsundef{#1@alias@lang}{%
+% define environment and command if not alias
+\cs_new:Nn \xpg_define_language_commands:n {
+ \str_if_eq:eeT {\prop_item:Ne \__xpg_alias {#1/target}} {#1}
+ {
\exp_args:Ne
\newenvironment {\prop_item:Nn{\polyglossia@langsetup}{#1/envname}} [1] []
{
@@ -4627,156 +4870,242 @@ to track the issues and follow progress.
}%
\exp_args:Nc \newcommand {text#1} [2][]
{%
- \xpg@textlanguage[##1]{#1}{##2}%
+ \__xpg_textlanguage:een{##1}{#1}{##2}%
}%
- }{}
+ }
+}
+\cs_generate_variant:Nn \xpg_define_language_commands:n {e}
+
+\AtBeginDocument{
+ \prop_log:N{\__xpg_alias}
}
+% resolve alias property #1 lang #2 item
+\cs_new:Nn \xpg_alias_prop_item:nn {
+ \prop_if_in:NeTF \__xpg_alias {#1/#2}
+ {
+ \prop_item:Ne \__xpg_alias {#1/#2}
+ }
+ {
+ \prop_if_in:NeTF \__xpg_alias {#1/target}
+ {
+ % target to self fall back to language table
+ \str_if_eq:eeTF { \prop_item:Ne \__xpg_alias {#1/target} } { #1 }
+ {
+ \prop_item:Nn{\polyglossia@langsetup} {#1/#2}
+ }
+ % load alias by recursion
+ {
+ \xpg_alias_prop_item:ee { \prop_item:Ne \__xpg_alias {#1/target} } {#2}
+ }
+ }
+ {
+ % empty
+ }
+ }
+}
+\cs_generate_variant:Nn \xpg_alias_prop_item:nn {en, ne, ee}
+
+% add option #2 to list of option of language #1
+\cs_new:Nn \xpg_alias_add_to_option_i:nn
+{
+ \tl_if_blank:eTF {#2}
+ {
+ \xpg_alias_prop_item:nn {#1}{options}
+ }
+ {
+ \tl_if_blank:eTF { \xpg_alias_prop_item:nn {#1}{options} }
+ {
+ #2
+ }
+ {
+ \xpg_alias_prop_item:nn {#1}{options},#2
+ }
+ }
+}
+
+
+% get base language
+\cs_new:Nn \xpg_alias_base_lang:n {
+ \str_if_eq:eeTF { \prop_item:Ne \__xpg_alias {#1/target} } { #1 }
+ {
+ #1
+ }
+ {
+ \xpg_alias_base_lang:n { \prop_item:Ne \__xpg_alias {#1/target} }
+ }
+}
+\cs_generate_variant:Nn \xpg_alias_base_lang:n {e}
+
+\keys_define:nn { polyglossia/alias }
+{
+ % babelname\l_tmpa_prop
+ babelname .prop_put:N = \__xpg_language_alias_prop,
+ % bcp47
+ bcp47 .prop_put:N = \__xpg_language_alias_prop,
+ % variant
+ variant .prop_put:N = \__xpg_language_alias_prop,
+}
+
+
+
+% provide way to define alias environment and command
+% #1 () variant
+% #2 [] option (not yet without variant and bcp47 name)
+% #3 language
+% #4 () babel name
+% #5 [] bcp47 name
+% #6 alias
+\DeclareDocumentCommand \xpg_language_alias { D(){} O{} m D(){} O{} m}
+{
+ \prop_gremove:Nn \__xpg_alias {#6/target}
+ \prop_gremove:Nn \__xpg_alias {#6/options}
+ \prop_gremove:Nn \__xpg_alias {#6/bcp47}
+ \prop_gremove:Nn \__xpg_alias {#6/babelname}
+ \prop_gremove:Nn \__xpg_alias {#6/variant}
+ \prop_gput:Nee \__xpg_alias {#6/target} {#3}
+ \tl_if_blank:eF {#1}
+ {
+ \prop_gput:Nee \__xpg_alias {#6/variant} {#1}
+ }
+ \tl_if_blank:eF {#5}
+ {
+ \prop_gput:Nee \__xpg_alias {#6/bcp47} {#5}
+ }
+ \tl_if_blank:eF {#4}
+ {
+ \prop_gput:Nee \__xpg_alias {#6/babelname} {#1}
+ }
+ \tl_if_blank:eF {#2}
+ {
+ \prop_gput:Nee \__xpg_alias {#6/options} {#2}
+ }
+}
+
+
% provide way to define alias environment and command
% \setlanguagealias[<options>]{<language>}{<alias>}
\DeclareDocumentCommand \setlanguagealias {s O{} m m}
{
% The starred version does not define commands and environments
\IfBooleanF {#1}
+ {
+ \exp_args:Nc \providecommand {text#4} [2][] {}
+ \exp_args:Nc \renewcommand {text#4} [2][]
{
- \ifcsundef{#4@alias@lang}{%
- \exp_args:Ne
- \newenvironment {#4}
- {
- \begin{otherlanguage}[#2]{#3}
- }%
- {
- \end{otherlanguage}
- }%
- \exp_args:Nc \newcommand {text#4} [2][]
- {%
- \xpg@textlanguage[#2,##1]{#3}{##2}%
- }%
- }{%
- \exp_args:Ne
- \renewenvironment {#4}
- {
- \begin{otherlanguage}[#2]{#3}
- }%
- {
- \end{otherlanguage}
- }%
- \exp_args:Nc \renewcommand {text#4} [2][]
- {%
- \xpg@textlanguage[#2,##1]{#3}{##2}%
- }%
- }%
+ \__xpg_textlanguage:een{##1}{#4}{##2}
+ }
+ \exp_args:Nc \providecommand {#4} {}
+ \exp_args:Ne \renewenvironment {#4}
+ {
+ \begin{otherlanguage}{#4}
+ }
+ {
+ \end{otherlanguage}
+ }
}%
- \csgdef{#4@alias@lang}{#3}%
- \tl_if_blank:nF {#2} {\csgdef{#4@alias@opts}{#2}}%
+ \tl_clear_new:N \__xpg_alias_option_tl
+ \prop_clear_new:N \__xpg_language_alias_prop
+ \keys_set_known:nnN{polyglossia/alias} {#2} \__xpg_alias_option_tl
+ \xpg_language_alias
+ (\prop_item:Nn \__xpg_language_alias_prop {variant})
+ % TODO not yet [\__xpg_alias_option_tl]
+ [#2]
+ {#3}
+ (\prop_item:Nn \__xpg_language_alias_prop {babelname})
+ [\prop_item:Nn \__xpg_language_alias_prop {bcp47}]
+ {#4}
}
\cs_new:Nn \polyglossia@register@language:nn {
- % register polyglossia language name
- \ifcsundef{#2@registered}{%
- \global\edef\xpg@loaded{%
- \ifx\xpg@loaded\@empty\else\xpg@loaded,\fi #2%
- }%
- }{}
- \csgdef{#2@registered}{}%
- \tl_if_blank:nF {#1}{%
- % Register the language options
- \polyglossia@set@lang@options:nn {#2} {#1}%
- }%
- % register babelname
- \def\xpg@tmp@babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}%
- \ifcsundef{\csname xpg@tmp@babelname\endcsname @bbl@registered}{%
- \global\edef\xpg@bloaded{%
- \ifx\xpg@bloaded\@empty\else\xpg@bloaded,\fi\xpg@tmp@babelname}%
- }{}%
- \csgdef{\csname xpg@tmp@babelname\endcsname @bbl@registered}{}%
- % register BCP-47 ID
- \def\xpg@tmp@bcpname{\prop_item:Nn{\polyglossia@langsetup}{#2/bcp47}}%
- \ifcsundef{\csname xpg@tmp@bcpname\endcsname @bcp@registered}{%
- \global\edef\xpg@bcp@loaded{%
- \ifx\xpg@bcp@loaded\@empty\else\xpg@bcp@loaded,\fi\xpg@tmp@bcpname}%
- }{}%
- \csgdef{\csname xpg@tmp@bcpname\endcsname @bcp@registered}{}%
+ \clist_if_in:NeF \xpg@loaded {#2}{
+ \clist_gput_right:Ne \xpg@loaded {#2}
+ }
+ % Register the language options
+ \polyglossia@set@lang@options:nnn {#2} {#1} {@xpg@set@langvariant}
+ % register babelname
+ \prop_get:NeN \polyglossia@langsetup {#2/babelname} \l_tmpa_tl
+ \clist_if_in:NeF \xpg@bloaded {\l_tmpa_tl}{
+ \clist_gput_right:Ne \xpg@bloaded {\l_tmpa_tl}
+ }
+ % register BCP-47 ID
+ \prop_get:NeN \polyglossia@langsetup {#2/bcp47} \l_tmpa_tl
+ \clist_if_in:NeF \xpg@bcp@loaded {\l_tmpa_tl}{
+ \clist_gput_right:Ne \xpg@bcp@loaded {\l_tmpa_tl}
+ }
}
-
\newcommand{\setdefaultlanguage}[2][]{%
% latex is an internal language, so do not record
- \ifstrequal{#2}{latex}{}{%
- % register polyglossia language name
- \ifcsundef{#2@registered}{%
- \global\edef\xpg@loaded{%
- \ifx\xpg@loaded\@empty\else\xpg@loaded,\fi #2%
- }%
- }{}%
- \csgdef{#2@registered}{}%
- }%
- \ifcsundef{#2@loaded}%
+ \str_if_eq:eeF{#2}{latex}
{
- \polyglossia_load_lang_definition:nn{#1}{#2}
- % define environment and command (except for internal latex language)
- \ifstrequal{#2}{latex}{}{%
- \exp_args:Nx\polyglossia@define@language@cmd:n{#2}
- }%
- \csgdef{#2@loaded}{}%
+ \clist_if_in:NeF \xpg@loaded {\xpg_alias_base_lang:n{##2}}{
+ \clist_gput_right:Ne \xpg@loaded {\xpg_alias_base_lang:n{##2}}
+ }
}
+ \seq_if_in:NxF \__xpg_langs_loaded {#2}
{
- \relax
+ \polyglossia_load_lang_definition:nn{#1}{#2}
+ % define environment and command if not alias
+ \str_if_eq:eeT {\prop_item:Ne \__xpg_alias {#2/target}} {#2} {
+ \use:c{\prop_item:Nn{\polyglossia@langsetup}
+ {#2/DefineCommandsCmd}}
+ {#2}
+ }
+ \seq_gput_right:Nn \__xpg_langs_loaded {#2}
}
- \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}%
- }%
+ \polyglossia@set@default@language:ee {\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ {\xpg_alias_base_lang:n{#2}}%
}
+
\cs_new:Nn \polyglossia@set@default@language:nn
{
\gdef\xpg@main@language{#2}%
- \tl_if_blank:nTF {#1}{\gdef\mainlanguagevariant{}}{%
+ \tl_if_blank:nTF {#1}
+ {
+ \cs_gset_nopar:Npn \mainlanguagevariant {}
+ }
+ {%
% Register the language options
- \polyglossia@set@lang@options:nn {#2} {#1}%
+ \polyglossia@set@lang@options:nnn {#2} {#1} {@xpg@main@langvariant}%
}%
\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}{%
- \str_case_e:nnF{\c_sys_engine_str}{%
- {luatex}{\setRTLmain}
- {xetex}{\@RTLmaintrue\setnonlatin}
- }{}%
- }{}%
+ \__xpg_if_LR_str:eF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}
+ {
+ \__xpg_setRTLmain:
+ }
\cs_gset_nopar:Nn \polyglossia@AtBeginDocument@selectlanguage: {
\selectbackgroundlanguage{#2}
\selectlanguage[#1]{#2}%
}
\xpg@info{Default~ language~ is~ #2}%
\polyglossia@set@language@name[#1]{#2}%
- \def\mainlanguagename{#2}
+
+ \cs_gset_nopar:Npn \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} }
+ \cs_gset_nopar:Npe \mainbabelname { \prop_item:Nn \polyglossia@langsetup {#2/babelname} }
% Store babelname of current language (for external packages such as biblatex)
- \prop_get:NxNT \polyglossia@langsetup {#2/babelname} \l_tmpa_tl
- { \edef\babelname{\l_tmpa_tl}%
- \cs_gset_eq:cc{#2@gbabelname}{babelname}%
- }
+ \cs_gset_eq:NN \babelname \mainbabelname
+ \cs_gset_eq:cc{#2@gbabelname}{babelname}%
% Store BCP-47 id of main language
- \prop_get:NxNT \polyglossia@langsetup {#2/bcp47} \l_tmpa_tl
- { \csedef{mainbcp47id}{\l_tmpa_tl} }
- % Store BCP-47 id of current language
- \prop_get:NxNT \polyglossia@langsetup {#2/bcp47} \l_tmpa_tl
- { \csedef{bcp47id}{\l_tmpa_tl}%
- \cs_gset_eq:cc{#2@gbcp47id}{bcp47id}%
- }
- \ifluatex %
- \directlua{polyglossia.set_default_language('\luatexluaescapestring{\string#2}')}%
- \fi %
+ \cs_gset_nopar:cpe {mainbcp47id} { \prop_item:Nn \polyglossia@langsetup {#2/bcp47} }
+ \cs_gset_eq:cc {bcp47id} {mainbcp47id}
+ \cs_gset_eq:cc{#2@gbcp47id}{bcp47id}
+
+ \sys_if_engine_luatex:T
+ {
+ \directlua{polyglossia.set_default_language('\luatexluaescapestring{\string#2}')}%
+ }
+}
+\cs_generate_variant:Nn\polyglossia@set@default@language:nn {
+ ee, ef, en, eo, ex,
+ fe, ff, fn, fo, fx,
+ ne, nf, no, nx,
+ oe, of, on, oo, ox,
+ xe, xf, xn, xo, xx
}
\let\setmainlanguage=\setdefaultlanguage
@@ -4785,12 +5114,11 @@ to track the issues and follow progress.
% Currently supported: bcp-47
\DeclareDocumentCommand \languageid {m}
{
- \str_case:nnTF {#1}
+ \str_case:nnF {#1}
{
{bcp-47} { \csuse{bcp47id} }
{bcp47} { \csuse{bcp47id} }
}
- {}
{
\xpg@error{Invalid~ \string\languageid\space argument:~ #1}
}
@@ -4800,25 +5128,26 @@ to track the issues and follow progress.
% Currently supported: bcp-47
\DeclareDocumentCommand \mainlanguageid {m}
{
- \str_case:nnTF {#1}
+ \str_case:nnF {#1}
{
{bcp-47} { \csuse{mainbcp47id} }
{bcp47} { \csuse{mainbcp47id} }
}
- {}
{
\xpg@error{Invalid~ \string\mainlanguageid\space argument:~ #1}
}
}
-
-\def\mainbabelname{}%
-\def\mainlanguagevariant{}%
+% main babel name
+\cs_new_nopar:Npn \mainlanguagename {}
+\cs_new_nopar:Npn \mainbabelname {}
+\cs_new_nopar:cpn {mainbcp47id} {}
+\cs_new_nopar:Npn \mainlanguagevariant {}%
% Store main language variant for external packages
\define@key{xpg@main@langvariant}{variant}{%
- \gdef\mainlanguagevariant{#1}%
+ \cs_gset_nopar:Npn \mainlanguagevariant {#1}%
}
-\def\babelname{}%
+\cs_new_nopar:Npn \babelname {}
\def\languagevariant{}%
% Store current language variant for external packages
\define@key{xpg@set@langvariant}{variant}{%
@@ -4831,21 +5160,16 @@ to track the issues and follow progress.
\ifcsundef{#2@gvar}{\def\languagevariant{}}{\def\languagevariant{\csuse{#2@gvar}}}
}{%
% Register the language options
- \polyglossia@set@lang@options:nn {#2} {#1}%
+ \polyglossia@set@lang@options:nnn {#2} {#1} {@xpg@set@langvariant}%
+ \cs_set_eq:cc{#2@gvar}{languagevariant}%
}%
}
\newcommand*{\resetdefaultlanguage}[2][]{%
- \ifcsdef{#2@alias@lang}{%
- \ifcsdef{#2@alias@opts}{%
- \exp_args:Nxx \polyglossia@reset@default@language:nn {\csuse{#2@alias@opts},#1} {\csuse{#2@alias@lang}}%
- }{%
- polyglossia@reset@default@language:nn {#1} {\csuse{#2@alias@lang}}%
- }%
- }{%
- polyglossia@reset@default@language:nn {#1} {#2}%
- }%
+ \polyglossia@reset@default@language:nn
+ {\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ {\xpg_alias_base_lang:n{#2}}%
}
\cs_new:Nn \polyglossia@reset@default@language:nn
@@ -4859,7 +5183,10 @@ to track the issues and follow progress.
\cs_if_exist_use:c{noextras@bbl@\mainbabelname}%
\csuse{init@noextras@\xpg@main@language}%
\polyglossia@set@language@name[#1]{#2}%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}{RL}{\@rlmaintrue\@rl@footnotetrue}{}%
+ \__xpg_if_LR_str:eF{\prop_item:Ne{\polyglossia@langsetup}{#2/direction}}
+ {
+ \@rlmaintrue\@rl@footnotetrue
+ }
\selectlanguage[#1]{#2}%
\selectbackgroundlanguage{#2}%
% Store babelname of current language (for external packages such as biblatex)
@@ -4883,6 +5210,13 @@ to track the issues and follow progress.
\csedef{bcp47id}{\prop_item:Nn{\polyglossia@langsetup}{#2/bcp47}}%
}%
}
+\cs_generate_variant:Nn \polyglossia@reset@default@language:nn {
+ ee, ef, en, eo, ex,
+ fe, ff, fn, fo, fx,
+ ne, nf, no, nx,
+ oe, of, on, oo, ox,
+ xe, xf, xn, xo, xx
+}
% This saves the normalfont for the latin script since we may change normalfont in other scripts
\let\normalfontlatin=\normalfont%
@@ -4964,15 +5298,18 @@ to track the issues and follow progress.
\def\xpg@select@fontfamily#1{%
\def\tmp@tt{tt}\def\tmp@sf{sf}%
\ifx\familytype\tmp@tt
- \csuse@warn{#1@font@tt}%
+ \__xpg_use_or_warn:c{#1@font@tt}%
\else\ifx\familytype\tmp@sf
- \csuse@warn{#1@font@sf}%
- \else\csuse@warn{#1@font@rm}\fi\fi}
+ \__xpg_use_or_warn:c{#1@font@sf}%
+ \else\__xpg_use_or_warn:c{#1@font@rm}\fi\fi}
\def\xpg@set@normalfont#1{%
- \DeclareRobustCommand\rmfamily{\csuse{#1@font@rm}}%
- \DeclareRobustCommand\sffamily{\csuse{#1@font@sf}}%
- \DeclareRobustCommand\ttfamily{\csuse{#1@font@tt}}%
+ \letcs{\rmfamily}{#1@font@rm}%
+ \letcs{\sffamily}{#1@font@sf}%
+ \letcs{\ttfamily}{#1@font@tt}%
+ \robustify\rmfamily%
+ \robustify\sffamily%
+ \robustify\ttfamily%
\gdef\normalfont{\protect\xpg@select@fontfamily{#1}%
\fontseries{\seriesdefault}\selectfont%
\fontshape{\shapedefault}
@@ -4991,14 +5328,10 @@ to track the issues and follow progress.
\@afterindentfalse%
}
-\newcommand*{\selectbackgroundlanguage}[1]{%
- \ifcsdef{#1@alias@lang}{%
- \polyglossia@select@background@language:n {\csuse{#1@alias@lang}}%
- }{%
- \polyglossia@select@background@language:n {#1}%
- }%
+\cs_new_nopar:Npn \selectbackgroundlanguage #1
+{%
+ \polyglossia@select@background@language:n {\xpg_alias_base_lang:n{#1}}
}
-
\cs_new:Nn \polyglossia@select@background@language:n
{
\str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#1/lcscript}}{latin}
@@ -5006,26 +5339,23 @@ to track the issues and follow progress.
{\xpg@set@normalfont{#1}}%
\csuse{#1@globalnumbers}%
}
-
-\newcommand{\setotherlanguage}[2][]{%
- \ifcsundef{#2@loaded}
+\cs_generate_variant:Nn \polyglossia@select@background@language:n {e}
+% Declare secondary language #2 with language options #1
+\DeclareDocumentCommand \setotherlanguage { O{} m }
+{
+ \seq_if_in:NxF \__xpg_langs_loaded {#2}
{
- \polyglossia_load_lang_definition:nn{#1}{#2}
- % define environment and command
- \exp_args:Nx\polyglossia@define@language@cmd:n{#2}
- \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@loaded}{}%
+ \polyglossia_load_lang_definition:ee {#1} {#2}%
+ % define environment and command if not alias
+ \str_if_eq:eeT {\prop_item:Ne \__xpg_alias {#2/target}} {#2} {
+ \use:c{\prop_item:Nn{\polyglossia@langsetup}
+ {#2/DefineCommandsCmd}}
+ {#2}
+ }
+ \polyglossia@set@other@language:ee {\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ {\xpg_alias_base_lang:n{#2}}%
+ \seq_gput_right:Nn \__xpg_langs_loaded {#2}
}
- {}
}
\cs_new:Nn \polyglossia@set@other@language:nn
@@ -5033,15 +5363,22 @@ to track the issues and follow progress.
\polyglossia@register@language:nn{#1}{#2}%
% If a variant is set, store it.
\gdef\otherlanguagevariant{}
- \tl_if_blank:nTF {#1}{}{%
- % Register the language options
- \polyglossia@set@lang@options:nn {#2} {#1}%
- }%
+ % Register the language options
+ \polyglossia@set@lang@options:nnn {#2} {#1} {@xpg@other@langvariant}%
+
\csgdef{#2@gvar}{\otherlanguagevariant}%
\prop_get:NxNT \polyglossia@langsetup {#2/babelname} \l_tmpa_tl
{ \xdef\otherlanguagebabelname{\l_tmpa_tl} }
\cs_gset_eq:cc{#2@gbabelname}{otherlanguagebabelname}%
}
+\cs_generate_variant:Nn \polyglossia@set@other@language:nn {
+ ee, ef, en, eo, ex,
+ fe, ff, fn, fo, fx,
+ ne, nf, no, nx,
+ oe, of, on, oo, ox,
+ xe, xf, xn, xo, xx
+}
+
% Store main language variant for external packages
\define@key{xpg@other@langvariant}{variant}{%
@@ -5071,15 +5408,7 @@ to track the issues and follow progress.
% where \text<alias> would cause clashes
% (e.g., \textit)
\newcommand\textlang[3][]{%
- \ifcsdef{#2@alias@lang}{%
- \ifcsdef{#2@alias@opts}{%
- \exp_args:Nxx \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}%
- }%
+ \__xpg_textlanguage:een {#1} {#2} {#3}
}%
% Alias to {<lang>}, but more suitable
@@ -5122,6 +5451,8 @@ to track the issues and follow progress.
% joint code of \foreignlanguage, otherlanguage*
% and \text<lang>
+% #1 option
+% #2 language
\newcommand{\xpg@otherlanguage}[2][]
{%
\polyglossia@error@iflangnotloaded:n{#2}
@@ -5137,66 +5468,90 @@ to track the issues and follow progress.
}
\renewcommand{\foreignlanguage}[3][]
-{%
- \ifcsdef{#2@alias@lang}{%
- \ifcsdef{#2@alias@opts}{%
- \exp_args:Nxx \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}%
- }%
+{
+ \__xpg_foreignlanguage:eeen {#1} {#2} {\xpg_alias_base_lang:n{#2}} {#3}
}
-\cs_new:Nn \polyglossia@foreignlanguage:nnn
+% internal wrapper for foreing language
+% #1 option
+% #2 alias
+% #3 base lang
+% #3 text
+\cs_new:Nn \__xpg_foreignlanguage:nnnn
{
- \polyglossia@error@iflangnotloaded:n{#2}
- \bgroup
- \xpg@otherlanguage[#1]{#2}%
- \polyglossia@lang@settextdirection:nn{#2}{#3}%
- \egroup
+ \tl_if_blank:nT {#3}
+ {
+ \msg_show:nnn { polyglossia } { languagenotloaded } {#2}
+ }
+ \group_begin:
+ \xpg@otherlanguage[\xpg_alias_add_to_option_i:nn{#2}{#1}]{#4}%
+ \polyglossia@lang@settextdirection:nn{#3}{#4}%
+ \group_end:
}
+\cs_generate_variant:Nn \__xpg_foreignlanguage:nnn {een}
+
% otherlanguage* is the environment equivalent of \foreignlanguage
\expandafter\providecommand\csname otherlanguage*\endcsname{}
\renewenvironment{otherlanguage*}[2][]
{%
- \ifcsdef{#2@alias@lang}{%
- \ifcsdef{#2@alias@opts}{%
- \exp_args:Nxx \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}%
- }%
+ \__xpg_otherlanguage:eee {#1} {#2} {\xpg_alias_base_lang:n{#2}}
}
-{\egroup}
+{\group_end:}
-\cs_new:Nn \polyglossia@otherlanguage:nn
+% internal wrapper
+% #1 option
+% #2 alias
+% #3 base lang
+\cs_new:Nn \__xpg_otherlanguage:nnn
{
- \xpg@otherlanguage[#1]{#2}%
- \polyglossia@lang@settextdirection:nn{#2}\bgroup%
+ \tl_if_blank:nT {#3}
+ {
+ \msg_show:nnn { polyglossia } { languagenotloaded } {#2}
+ }
+ \xpg@otherlanguage[\xpg_alias_add_to_option_i:nn{#2}{#1}]{#3}%
+ \polyglossia@lang@settextdirection:nn{#3}\group_begin:%
+}
+\cs_generate_variant:Nn \__xpg_otherlanguage:nnn {
+ eee
}
% use by \text<lang> and \textlang. Equivalent to \foreignlanguage,
% except that dates are localized.
-\newcommand\xpg@textlanguage[3][]{%
- \polyglossia@error@iflangnotloaded:n{#2}
- \bgroup
- \xpg@otherlanguage[#1]{#2}%
- \csuse{date#2}%
- % This is a hook for external packages which want to access variants
- % via babelname (such as biblatex)
- \cs_if_exist_use:c{date@bbl@\babelname}%
- \polyglossia@lang@settextdirection:nn{#2}{#3}%
- \egroup
- % Reset the language's/script's font families
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/lcscript}}{latin}{}{\resetfontlatin}%
+% #1: option
+% #2: alias
+% #3: text
+\cs_new:Nn \__xpg_textlanguage:nnn
+{
+ \__xpg_textlanguage:nnen {#1} {#2} {\xpg_alias_base_lang:n{#2}} {#3}
}
+\cs_generate_variant:Nn \__xpg_textlanguage:nnn {een}
+% use by \text<lang> and \textlang. Equivalent to \foreignlanguage,
+% except that dates are localized.
+% #1: option
+% #2: alias
+% #3: base language
+% #4: text
+\cs_new:Nn \__xpg_textlanguage:nnnn
+{
+ \tl_if_blank:nT {#3}
+ {
+ \msg_show:nnn { polyglossia } { languagenotloaded } {#2}
+ }
+ \group_begin:
+ \xpg@otherlanguage[#1]{#3}%
+ \csuse{date#3}%
+ % This is a hook for external packages which want to access variants
+ % via babelname (such as biblatex)
+ \cs_if_exist_use:c{date@bbl@\babelname}%
+ \polyglossia@lang@settextdirection:nn{#3}{#4}%
+ \group_end:
+ % Reset the language's/script's font families
+ \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#3/lcscript}}{latin}{}{\resetfontlatin}%
+}
+\cs_generate_variant:Nn \__xpg_textlanguage:nnnn {nnen}
% Define language-specific hyphenation exceptions
\newcommand\pghyphenation[3][]{
@@ -5219,58 +5574,59 @@ to track the issues and follow progress.
\let\emp@langname\@undefined}
\DeclareDocumentCommand \selectlanguage {s O{} m}
-{%
- \ifcsdef{#3@alias@lang}{%
- \ifcsdef{#3@alias@opts}{%
- \exp_args:Nxx \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}%
- }
+{
+ \__xpg_msg_if_lang_not_loaded:n {#3}
+ \polyglossia@select@language:nee {#1}
+ {\xpg_alias_add_to_option_i:nn{#3}{#2}}
+ {\xpg_alias_base_lang:n{#3}}
}
\cs_new:Nn \polyglossia@select@language:nnn
{
\IfBooleanF {#1}
- {
- \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}{}{%
- % Register the language options
- \polyglossia@set@lang@options:nn {#3} {#2}%
- }%
- % The starred variant does not write to the aux
- \IfBooleanTF#1{%
- \xpg@set@language@nonaux[#2]{#3}%
- }{%
- \xpg@set@language@aux[#2]{#3}%
- }%
- \ifluatex%
- \directlua{polyglossia.select_language('\luatexluaescapestring{\string#3}',
- \the\csname l@#3\endcsname)}%
- \fi%
+ {
+ \cs_set_nopar:Npx \xpg@pop@language { \exp_not:N \xpg@pop@language@i {#2} {#3} }
+ \group_insert_after:N \xpg@pop@language
+ }
+ % Register the language options
+ \polyglossia@set@lang@options:nnn {#3} {#2} {@xpg@set@langvariant}%
+ % The starred variant does not write to the aux
+ \IfBooleanTF#1{%
+ \xpg@set@language@nonaux[#2]{#3}%
+ }
+ {%
+ \xpg@set@language@aux[#2]{#3}%
+ }%
+ \sys_if_engine_luatex:T
+ {
+ \directlua{polyglossia.select_language('\luatexluaescapestring{\string#3}',
+ \the\csname l@#3\endcsname)}%
+ }
\polyglossia@register@language:nn{#2}{#3}%
}
+\cs_generate_variant:Nn \polyglossia@select@language:nnn {
+ nee, nne
+}
-\cs_new:Nn \polyglossia@set@lang@options:nn
-{
+% set lang option #2 for lang #1
+\cs_new:Nn \polyglossia@set@lang@options:nnn
+{
+ \tl_if_blank:nF {#2}
+ {
% If the optional argument sets a value for the key “variant”, copy it to xpg@langvariant
\clist_map_inline:nn { #2 } {%
- \xpg@parsevariantkeyvalue##1=@xpg@langvariant:#1\relax
+ \xpg@parsevariantkeyvalue##1=#3:#1\relax
}%
\exp_args:Nne \setkeys{#1}{#2}%
+ }
}
% Initialize default language options, so that
% \iflanguageoption has the info it needs also
% for default settings
\newcommand*\xpg@initialize@gloss@options[2]{%
- \polyglossia@set@lang@options:nn {#1} {#2}%
+ \polyglossia@set@lang@options:nnn {#1} {#2} {@xpg@set@langvariant}%
}
% Record synonymous keyvals such as variant=us and variant=american
@@ -5320,16 +5676,16 @@ to track the issues and follow progress.
{
\prop_get:cnNTF {xpg@current@options@#1} {#2} \l_tmpa_tl
{
- \exp_args:Nee \str_if_eq:NNTF{\l_tmpa_tl}{#3}
+ \str_if_eq:eeTF{\l_tmpa_tl}{#3}
{\prg_return_true:}
{
\prop_get:cnNTF {xpg@alias@keyvals@#1@#3} {#2} \l_tmpb_tl
{
- \exp_args:Nne \clist_set:Nn{\l_tmpa_clist}{\l_tmpb_tl}
+ \clist_set:Ne{\l_tmpa_clist}{\l_tmpb_tl}
\providetoggle{xpgvalfound}
\togglefalse{xpgvalfound}
\clist_map_inline:Nn \l_tmpa_clist {
- \exp_args:Nee \str_if_eq:NNT{##1}{\l_tmpa_tl}
+ \str_if_eq:eeT{##1}{\l_tmpa_tl}
{ \toggletrue{xpgvalfound} }
}
\iftoggle{xpgvalfound}{\prg_return_true:}{\prg_return_false:}
@@ -5352,39 +5708,39 @@ to track the issues and follow progress.
% Append any variant to csv list of variants
\define@key{xpg@langvariant}{variant}{%
- \edef\xpg@vloaded{#1\ifx\xpg@vloaded\@empty\else,\xpg@vloaded\fi}%
-}
-
-\prg_set_conditional:Npnn \polyglossia@check@if@lang@loaded:N #1 { p , T , F , TF }{
- \cs_if_exist:cTF{#1}{
- \prg_return_true:
- }{
- \prg_return_false:
+ \clist_if_in:NeF \xpg@vloaded {#1}{
+ \clist_gput_right:Ne \xpg@vloaded {#1}
}
}
% Test if language is loaded
\newcommand*\iflanguageloaded[3]{%
- \polyglossia@check@if@lang@loaded:NTF{#1@loaded}{#2}{#3}%
+ \AddToHook{begindocument/end}{%
+ \clist_if_in:NeTF \xpg@loaded{#1}{#2}{#3}%
+ }%
}
% Same for babellanguage is loaded
\newcommand*\ifbabellanguageloaded[3]{%
- \polyglossia@check@if@lang@loaded:NTF{#1@bbl@loaded}{#2}{#3}%
+ \AddToHook{begindocument/end}{%
+ \clist_if_in:NeTF \xpg@bloaded{#1}{#2}{#3}%
+ }%
}
% Same for languageid
\DeclareDocumentCommand \iflanguageidloaded {mmmm}
{
+ \AddToHook{begindocument/end}{%
\str_case:nnTF {#1}
{
- {bcp-47} { \polyglossia@check@if@lang@loaded:NTF{#2@bcp@loaded}{#3}{#4} }
- {bcp47} { \polyglossia@check@if@lang@loaded:NTF{#2@bcp@loaded}{#3}{#4} }
+ {bcp-47} { \clist_if_in:NeTF \xpg@bcp@loaded{#2}{#3}{#4} }
+ {bcp47} { \clist_if_in:NeTF \xpg@bcp@loaded{#2}{#3}{#4} }
}
{}
{
\xpg@error{Invalid~ \string\iflanguageidloaded\space argument:~ #1}
}
+ }%
}
% Check if the current font has a given glyph
@@ -5403,8 +5759,10 @@ to track the issues and follow progress.
}
}
{
- \xpg@warning{You’re running a TeX engine that is not LuaTeX or XeTeX.\MessageBreak
- That is almost guaranteed to cause problems.}
+ \xpg@warning{You’re ~ running ~ a ~ TeX engine ~ that ~ is ~
+ not ~ LuaTeX ~ or ~ XeTeX.\MessageBreak
+ That~ is~ almost~ guaranteed~ to~ cause~ problems.}
+ \prg_return_false:
}
}
@@ -5446,6 +5804,11 @@ to track the issues and follow progress.
}%
\@select@language[#1]{#2}%
% Write to the aux
+ \xpg@set@language@only@aux[#1]{#2}%
+}
+
+\newcommand*{\xpg@set@language@only@aux}[2][]{%
+ % Write to the aux
\if@filesw%
\ifx#1\\\\%
\protected@write\@auxout{}{\protect\selectlanguage*{#2}}%
@@ -5477,45 +5840,8 @@ to track the issues and follow progress.
}{}%
}
-% Open a group in the aux file. This is to keep
-% nested language options local (see #320).
-% In bidi tables, the opening/closing needs to be swapped (see #354)
-\newcommand*{\xpg@set@group@aux}{%
- \if@filesw%
- \ifbool{xpg@inbiditable}{%
- \protected@write\@auxout{}{\egroup}%
- \addtocontents{toc}{\egroup}%
- \addtocontents{lof}{\egroup}%
- \addtocontents{lot}{\egroup}%
- }{%
- \protected@write\@auxout{}{\bgroup}%
- \addtocontents{toc}{\bgroup}%
- \addtocontents{lof}{\bgroup}%
- \addtocontents{lot}{\bgroup}%
- }%
- \fi
-}
-
-% Close the group in the aux file.
-% In bidi RTL tables, the opening/closing needs
-% to be swapped (see #354).
-\newcommand*{\xpg@unset@group@aux}{%
- \if@filesw%
- \ifbool{xpg@inbiditable}{%
- \protected@write\@auxout{}{\bgroup}%
- \addtocontents{toc}{\bgroup}%
- \addtocontents{lof}{\bgroup}%
- \addtocontents{lot}{\bgroup}%
- }{%
- \protected@write\@auxout{}{\egroup}%
- \addtocontents{toc}{\egroup}%
- \addtocontents{lof}{\egroup}%
- \addtocontents{lot}{\egroup}%
- }%
- \fi
-}
-
-\prg_set_conditional:Npnn \polyglossia@check@ifdefined:N #1 { p , T , F , TF }{
+% check if language is defined
+\prg_set_conditional:Npnn \__xpg_check_if_exist_l@:N #1 { p , T , F , TF }{
\cs_if_exist:cTF {l@#1}
{
\cs_if_eq:cNTF {l@#1} \l@nohyphenation
@@ -5537,48 +5863,54 @@ to track the issues and follow progress.
\def\polyglossia@luatex@load@lang#1{%
% if \l@#1 is not properly defined, call lua function newloader(#1),
% and assign the returned number to \l@#1
- \polyglossia@check@ifdefined:NF {#1}
- {
- \expandafter\chardef\csname l@#1\endcsname=
- \directlua{ tex.sprint(polyglossia.newloader'#1') }\relax
- }
+ \__xpg_check_if_exist_l@:NF {#1}
+ {
+ \expandafter\chardef\csname l@#1\endcsname=
+ \directlua{ tex.sprint(polyglossia.newloader'#1') }\relax
+ }
}
% This check is also used by biblatex, so don't
% rename silently.
\newcommand\xpg@ifdefined[3]{%
- % With luatex, we first need to define \l@#1.
- \ifluatex
- \polyglossia@luatex@load@lang{#1}%
- \fi
- \polyglossia@check@ifdefined:NTF{#1}{#2}{#3}%
+ % With luatex, we first need to define \l@#1.
+ \sys_if_engine_luatex:T
+ {
+ \polyglossia@luatex@load@lang{#1}%
+ }
+ \__xpg_check_if_exist_l@:NTF{#1}{#2}{#3}%
}%
% Set \bbl@hyphendata@\the\language, which is (lua)babel's
% hyphenation pattern hook
% FIXME Clarifiy why/when this is needed.
\newcommand*\xpg@set@bbl@hyphendata[1]{%
- \ifluatex%
- \ifcsdef{bbl@hyphendata@#1}{}{%
- \global\@namedef{bbl@hyphendata@\the\language}{}%
- }%
- \fi%
+ \sys_if_engine_luatex:T
+ {
+ \ifcsdef{bbl@hyphendata@#1}{}{%
+ \global\@namedef{bbl@hyphendata@\the\language}{}%
+ }%
+ }
}
% Set hyphenation patterns for a given language. This does the right
% thing both for XeTeX and LuaTeX
\newcommand*\xpg@set@hyphenation@patterns[1]{%
- \ifluatex
- \polyglossia@luatex@load@lang{#1}%
- \language=\csname l@#1\endcsname
- \else
- \ifxetex
- \language=\csname l@#1\endcsname
- \else
+ \str_case_e:nnF{\c_sys_engine_str}{
+ {luatex}
+ {
+ \polyglossia@luatex@load@lang{#1}%
+ \language=\csname l@#1\endcsname
+ }
+ {xetex}
+ {
+ \language=\csname l@#1\endcsname
+ }
+ }
+ {
\xpg@warning{You’re~running~a~TeX~engine~that~is~not~LuaTeX~or~XeTeX.\MessageBreak
That~is~almost~guaranteed~to~cause~problems.}%
- \fi
- \fi
+ }
}
@@ -5615,38 +5947,46 @@ to track the issues and follow progress.
% Hook for external packages such as biblatex
\def\polyglossia@language@switched{}
-\def\noextrascurrent#1{%
- \csuse{noextras@#1}%
- % This is a hook for external packages which want to access variants
- % via babelname (such as biblatex)
- \cs_if_exist_use:c{noextras@bbl@\babelname}
+% remove all custumization for language #1
+\cs_new:Npn \noextrascurrent #1
+{%
+ \cs_if_exist_use:c{noextras@#1}%
+ % This is a hook for external packages which want to access variants
+ % via babelname (such as biblatex)
+ \cs_if_exist_use:c{noextras@bbl@\babelname}
}
% Common code for `\select@language' and `\foreignlanguage'.
\newcommand{\select@@language}[2][]{%
% disable the extras and number settings of the previous language
- \ifcsundef{languagename}{}{%
- \noextrascurrent{\languagename}%
- \csuse{no\languagename @numbers}%
- \ifxetex
- \str_if_eq:eeTF{\exp_args:Nne\prop_item:Nn{\polyglossia@langsetup}{\languagename/direction}}{RL}%
- {%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}{RL}%
- {}% RTL -> RTL
- {\setlatin}% RTL -> LTR
- }{%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}{RL}%
- {\setnonlatin}% LTR -> RTL
- {}% LTR -> LTR
- }%
- \fi
+ \cs_if_exist:cT{languagename}
+ {%
+ \noextrascurrent{\languagename}%
+ \cs_if_exist_use:c{no\languagename @numbers}%
+ \sys_if_engine_xetex:T{
+ \__xpg_if_LR_str:eTF{\prop_item:Ne{\polyglossia@langsetup}{\languagename/direction}}
+ {
+ \__xpg_if_LR_str:eF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}
+ {\setnonlatin}% LTR -> RTL
+ }%
+ {%
+ \__xpg_if_LR_str:eT{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}
+ {\setlatin}% RTL -> LTR
+ }
+ }
}%
\polyglossia@set@language@name[#1]{#2}%
% Set the language's/script's font families
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/lcscript}}{latin}{\resetfontlatin}{\xpg@set@normalfont{#2}}%
+ \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/lcscript}} {latin}
+ {
+ \resetfontlatin
+ }
+ {
+ \xpg@set@normalfont{#2}
+ }%
\xpg@select@fontfamily{#2}%
- \csuse@warn{#2@language}%
- \csuse{#2@numbers}%
+ \__xpg_use_or_warn:c{#2@language}%
+ \cs_if_exist_use:c{#2@numbers}%
\use@localhyphenmins[#1]{#2}%
\polyglossia@lang@frenchspacing:n{#2}
}
@@ -5656,24 +5996,48 @@ to track the issues and follow progress.
\provideenvironment{otherlanguage}{}{}
-\newbool{xpg@noset@groups}
+%
+% Keep track of the active (nested) languages and options
+%
+\clist_new:N \l_xpg_lang_stack
+
+\cs_new:Nn \polyglossia@stack@language:nn
+{
+ \clist_push:Nn \l_xpg_lang_stack {#1:#2}
+}
+
+\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx}
+
+\cs_new:Nn \polyglossia@unstack@language:n
+{
+ \clist_gpop:NNTF \l_xpg_lang_stack \l_tmpa_tl {
+ % Stored format = options:language => split:
+ \seq_set_split:Nnx \l_tmpa_seq {:} \l_tmpa_tl
+ \seq_get_left:NN \l_tmpa_seq \l_tmpb_tl
+ \seq_get_right:NN \l_tmpa_seq \l_tmpc_tl
+ % Execute passed command with language and maybe options
+ \tl_if_empty:NTF \l_tmpb_tl {\cs_if_exist_use:c{#1}{\l_tmpc_tl}}
+ {\cs_if_exist_use:c{#1}[\l_tmpb_tl]{\l_tmpc_tl}}
+ }
+ {}
+}
+
\renewenvironment{otherlanguage}[2][]
{%
- % We usually embrace the switch in groups to keep the changes local.
- % We cannot do this if an LTR environmet starts in an RTL paragraph,
- % as bidi interferes here badly with its directionality smartness.
- \ifxetex
- \str_if_eq:eeT{\exp_args:Nne\prop_item:Nn{\polyglossia@langsetup}{\languagename/direction}}{RL}%
- {%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#1/direction}}{RL}%
- {}% RTL -> RTL
- {\ifvmode\else\booltrue{xpg@noset@groups}\fi}% RTL -> LTR
- }%
- \fi%
- \ifbool{xpg@noset@groups}{}{\xpg@set@group@aux}%
+ % Get real current options (incl. defaults)
+ \clist_clear_new:N \l_xpg_current_options
+ \prop_map_inline:cn {xpg@current@options@#2}
+ {
+ \clist_put_right:Nn \l_xpg_current_options {##1=##2}
+ }
+ % Store current options and language on stack
+ \polyglossia@stack@language:nn{\clist_use:Nn \l_xpg_current_options {,}}{#2}%
\selectlanguage[#1]{#2}%
}
-{\ifbool{xpg@noset@groups}{}{\xpg@unset@group@aux}}
+{%
+ % restore previous language in aux file and remove closed one from stack
+ \polyglossia@unstack@language:n{xpg@set@language@only@aux}%
+}
\newcommand{\setlocalhyphenmins}[3]{%
\xpg@ifdefined{#1}{%
@@ -5690,26 +6054,20 @@ to track the issues and follow progress.
% \setlanghyphenmins[options]{lang}{l}{r}
\newcommand*\setlanghyphenmins[4][]{%
% Check for real language name and options
- \edef\xpg@tmp@lang{#2}%
- \edef\xpg@tmp@opts{#1}%
- \ifcsdef{#2@alias@lang}{%
- \edef\xpg@tmp@lang{\csuse{#2@alias@lang}}%
- \ifcsdef{#2@alias@opts}{%
- \edef\xpg@tmp@opts{\csuse{#2@alias@opts},#1}%
- }{}%
- }{}%
+ \edef\xpg@tmp@opts{\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ \edef\xpg@tmp@lang{\xpg_alias_base_lang:n{#2}}
\bgroup
\polyglossia@error@iflangnotloaded:n{\xpg@tmp@lang}
\exp_args:Nne \setkeys{\xpg@tmp@lang}{\xpg@tmp@opts}%
% Store BCP-47 id of language
\tl_if_blank:nTF {\xpg@tmp@opts}{%
\ifcsundef{\csname xpg@tmp@lang\endcsname @gbcp47id}{%
- \csedef{tmp@bcp47id}{\exp_args:Nne\prop_item:Nn{\polyglossia@langsetup}{\xpg@tmp@lang /bcp47}}%
+ \csedef{tmp@bcp47id}{\prop_item:Ne{\polyglossia@langsetup}{\xpg@tmp@lang /bcp47}}%
}{%
\csedef{tmp@bcp47id}{\csuse{#2@gbcp47id}}%
}%
}{%
- \csedef{tmp@bcp47id}{\exp_args:Nne \prop_item:Nn{\polyglossia@langsetup}{\xpg@tmp@lang /bcp47}}%
+ \csedef{tmp@bcp47id}{\prop_item:Ne{\polyglossia@langsetup}{\xpg@tmp@lang /bcp47}}%
}%
\xpg@warning{id: \csuse{tmp@bcp47id}}%
\csgdef{\csname tmp@bcp47id\endcsname @hyphenmins}{{#3}{#4}}%
@@ -5741,15 +6099,15 @@ to track the issues and follow progress.
\edef\tmpa{\csuse{\csname tmp@bcp47id\endcsname @hyphenmins}}%
\expandafter\expandafter\expandafter\set@hyphenmins\tmpa\relax%
}
- \ifluatex
+ \sys_if_engine_luatex:T{
% Set \totalhyphenmin if specified
\prop_get:NxNTF \polyglossia@langsetup {#2/totalhyphenmin} \l_tmpa_tl
{
- \xpg@warning{totalhyphenmin: '\l_tmpa_tl'}
+ \xpg@info{totalhyphenmin: '\l_tmpa_tl'}
\expandafter\hyphenationmin \l_tmpa_tl%
}%
{}%
- \fi
+ }
}
% Babel previously compiled in hyphenrules into the kernel (via hyphen.cfg)
@@ -5761,37 +6119,17 @@ to track the issues and follow progress.
% supports language options and aliases.
\renewenvironment{hyphenrules}[2][]
{%
- % We usually embrace the switch in groups to keep the changes local.
- % We cannot do this if an LTR environmet starts in an RTL paragraph,
- % as bidi interferes here badly with its directionality smartness.
- \ifxetex
- \str_if_eq:eeT{\exp_args:Nne\prop_item:Nn{\polyglossia@langsetup}{\languagename/direction}}{RL}%
- {%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#1/direction}}{RL}%
- {}% RTL -> RTL
- {\ifvmode\else\booltrue{xpg@noset@groups}\fi}% RTL -> LTR
- }%
- \fi%
- \ifbool{xpg@noset@groups}{}{\xpg@set@group@aux}%
% Check for real language name and options
- \edef\xpg@tmp@lang{#2}%
- \edef\xpg@tmp@opts{#1}%
- \ifcsdef{#2@alias@lang}{%
- \edef\xpg@tmp@lang{\csuse{#2@alias@lang}}%
- \ifcsdef{#2@alias@opts}{%
- \edef\xpg@tmp@opts{\csuse{#2@alias@opts},#1}%
- }{}%
- }{}%
- \tl_if_blank:nF {\xpg@tmp@opts}{%
- % Register the language options
- \polyglossia@set@lang@options:nn {\xpg@tmp@lang} {\xpg@tmp@opts}%
- }%
+ \edef\xpg@tmp@opts{\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ \edef\xpg@tmp@lang{\xpg_alias_base_lang:n{#2}}
+ % Register the language options
+ \polyglossia@set@lang@options:nnn {\xpg@tmp@lang} {\xpg@tmp@opts} {@xpg@set@langvariant}%
% Now switch patterns
- \csuse@warn{\csuse{xpg@tmp@lang}@language}%
+ \__xpg_use_or_warn:c{\use:c{xpg@tmp@lang}@language}%
% And activate hyphenmins
\use@localhyphenmins[\xpg@tmp@opts]{\xpg@tmp@lang}%
}
-{\ifbool{xpg@noset@groups}{}{\xpg@unset@group@aux}}
+{}
\AtEndPreamble{%
\@ifpackageloaded{bidi}{%
@@ -5846,15 +6184,15 @@ to track the issues and follow progress.
% Set the LuaTeX renderer. As opposed to fontspec, we use Harfbuzz by default.
% This can be changed via the luatexrenderer package option.
-\ifluatex
- \exp_args:Nee \str_if_eq:nnF{\l_polyglossia_luatex_renderer}{none}
- {
- \xpg@info{Setting~ LuaTeX~ font~ renderer~ to~ \l_polyglossia_luatex_renderer}
- \exp_args:Nee \defaultfontfeatures{Renderer=\l_polyglossia_luatex_renderer}
- }
-\fi
+\sys_if_engine_luatex:T{
+ \str_if_eq:eeF{\l_polyglossia_luatex_renderer}{none}
+ {
+ \xpg@info{Setting~ LuaTeX~ font~ renderer~ to~ \l_polyglossia_luatex_renderer}
+ \exp_args:Ne \defaultfontfeatures{Renderer=\l_polyglossia_luatex_renderer}
+ }
+}
-\bool_if:nTF \l_polyglossia_verbose_bool {} {
+\bool_if:nF \l_polyglossia_verbose_bool {
\gdef\@latex@info#1{\relax}% no latex info
\gdef\@font@info#1{\relax}% no latex font info
\gdef\@font@warning#1{\relax}% no latex font warnings
@@ -5862,9 +6200,9 @@ to track the issues and follow progress.
\gdef\xpg@info#1{\relax}% no polyglossia info
}
-\bool_if:nTF \l_polyglossia_localmarks_bool {
+\bool_if:nT \l_polyglossia_localmarks_bool {
\polyglossia@enable@local@marks:
-}{}
+}
% compatibility
\newif\ifsystem@babelshorthands
@@ -9247,11 +9585,11 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@afrikaans{%
- \ifafrikaans@babelshorthands\afrikaans@shorthands\fi%
+ \ifafrikaans@babelshorthands\afrikaans@shorthands\else\noafrikaans@shorthands\fi%
}
\def\inlineextras@afrikaans{%
- \ifafrikaans@babelshorthands\afrikaans@shorthands\fi%
+ \ifafrikaans@babelshorthands\afrikaans@shorthands\else\noafrikaans@shorthands\fi%
}
% \end{macrocode}
@@ -9855,8 +10193,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi%
\fi}}
-
-\newcommand{\arabicnumerals}[2]{\arabicnumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via aeb (BCP).
+\providecommand{\arabicnumerals}[2]{\arabicnumber{#2}}
\def\arabicnumber#1{%
\ifeastern@numerals
@@ -10666,8 +11005,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\csuse{datebelarusian@\belarusian@spelling}%
}
-\newcommand{\belarusiannumerals}[2]{\belarusiannumber{#2}}
-\newcommand{\Belarusiannumerals}[2]{\Belarusiannumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via be-tarask (BCP).
+\providecommand{\belarusiannumerals}[2]{\belarusiannumber{#2}}
+\providecommand{\Belarusiannumerals}[2]{\Belarusiannumber{#2}}
\def\belarusiannumber#1{%
\ifcyrillic@numerals
@@ -10743,12 +11084,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@belarusian{%
- \ifcyrillic@numerals\belarusian@numbers\fi%
- \ifbelarusian@babelshorthands\belarusian@shorthands\fi%
+ \ifcyrillic@numerals\belarusian@numbers\else\nobelarusian@numbers\fi%
+ \ifbelarusian@babelshorthands\belarusian@shorthands\else\nobelarusian@shorthands\fi%
}
\def\inlineextras@belarusian{%
- \ifbelarusian@babelshorthands\belarusian@shorthands\fi%
+ \ifbelarusian@babelshorthands\belarusian@shorthands\else\nobelarusian@shorthands\fi%
}
% \end{macrocode}
@@ -10988,7 +11329,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\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.~}%
+ decembar\fi \space \number\year.}%
}
% \end{macrocode}
@@ -11457,11 +11798,11 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@catalan{%
- \ifcatalan@babelshorthands\catalan@shorthands\fi%
+ \ifcatalan@babelshorthands\catalan@shorthands\else\nocatalan@shorthands\fi%
}
\def\inlineextras@catalan{%
- \ifcatalan@babelshorthands\catalan@shorthands\fi%
+ \ifcatalan@babelshorthands\catalan@shorthands\else\nocatalan@shorthands\fi%
}
% \end{macrocode}
% \iffalse
@@ -11603,14 +11944,25 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\define@boolkey{croatian}[croatian@]{babelshorthands}[true]{}
-\define@boolkey{croatian}[croatian@]{disableligatures}[true]{}
+\define@boolkey{croatian}[croatian@]{disabledigraphs}[true]{}
+
+% Alias kept for backwards compatibility. Please do not remove
+\define@boolkey{croatian}[croatian@]{disableligatures}[true]{%
+ \xpg@warning{The option disableligatures is deprected.\MessageBreak
+ Please use disabledigraphs instead}%
+ \ifcroatian@disableligatures
+ \croatian@disabledigraphstrue
+ \else
+ \croatian@disabledigraphsfalse
+ \fi
+}
\define@boolkey{croatian}[croatian@]{splithyphens}[true]{}
\define@boolkey{croatian}[croatian@]{localalph}[true]{}
% Register default options
-\xpg@initialize@gloss@options{croatian}{babelshorthands=false,disableligatures=false,
+\xpg@initialize@gloss@options{croatian}{babelshorthands=false,disabledigraphs=false,
splithyphens=true,localalph=true}
\ifsystem@babelshorthands
@@ -11626,6 +11978,14 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}{}
\def\croatian@@splhyphen#1{%
+ \def\croatian@sh@tmp{%
+ \if\croatian@sh@next-#1%
+ \else\expandafter\croatian@@@splhyphen{#1}\fi%
+ }%
+ \futurelet\croatian@sh@next\croatian@sh@tmp%
+}
+
+\def\croatian@@@splhyphen#1{%
\ifnum\hyphenchar \font>0%
\kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
\nobreak\hskip\z@%
@@ -11655,12 +12015,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\declare@shorthand{croatian}{"'}{”}%
\declare@shorthand{croatian}{"<}{«}%
\declare@shorthand{croatian}{">}{»}%
- \declare@shorthand{croatian}{"D}{\xpg@hr@lig{D}}%
- \declare@shorthand{croatian}{"d}{\xpg@hr@lig{d}}%
- \declare@shorthand{croatian}{"L}{\xpg@hr@lig{L}}%
- \declare@shorthand{croatian}{"l}{\xpg@hr@lig{l}}%
- \declare@shorthand{croatian}{"N}{\xpg@hr@lig{N}}%
- \declare@shorthand{croatian}{"n}{\xpg@hr@lig{n}}%
+ \declare@shorthand{croatian}{"D}{\xpg@hr@digraph{D}}%
+ \declare@shorthand{croatian}{"d}{\xpg@hr@digraph{d}}%
+ \declare@shorthand{croatian}{"L}{\xpg@hr@digraph{L}}%
+ \declare@shorthand{croatian}{"l}{\xpg@hr@digraph{l}}%
+ \declare@shorthand{croatian}{"N}{\xpg@hr@digraph{N}}%
+ \declare@shorthand{croatian}{"n}{\xpg@hr@digraph{n}}%
}
\def\nocroatian@shorthands{%
@@ -11693,24 +12053,24 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi%
}
-\newcommand*\hr@charifavailable[2]{%
- \ifcroatian@disableligatures
- \bgroup#2\egroup%
- \else
- \charifavailable{#1}{#2}%
+\newcommand*\hr@charifavailable[3]{%
+ \ifcroatian@disabledigraphs% no notion of digraphs at all
+ \bgroup#3\egroup%
+ \else% digraph...
+ \charifavailable{#1}{#2}% ... either a Unicode original or a mimic of one
\fi%
}
-% Provide croatian ligatures if available in current font
-\def\xpg@hr@lig#1#2{%
+% Provide croatian digraphs if available in current font
+\def\xpg@hr@digraph#1#2{%
\bgroup%
% 1. DŽ, Dž and dž
\ifx#1D%
\ifx#2Z\relax%
- \hr@charifavailable{01C4}{DŽ}%
+ \hr@charifavailable{01C4}{D\nobreak Ž}{DŽ}%
\else%
\ifx#2z\relax
- \hr@charifavailable{01C5}{Dž}%
+ \hr@charifavailable{01C5}{D\nobreak ž}{Dž}%
\else
D#2%
\fi%
@@ -11718,7 +12078,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi%
\ifx#1d%
\ifx#2z\relax
- \hr@charifavailable{01C6}{dž}%
+ \hr@charifavailable{01C6}{d\nobreak ž}{dž}%
\else
d#2%
\fi%
@@ -11726,10 +12086,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
% 2. LJ, Lj and lj
\ifx#1L%
\ifx#2J\relax%
- \hr@charifavailable{01C7}{LJ}%
+ \hr@charifavailable{01C7}{L\nobreak J}{LJ}%
\else%
\ifx#2j\relax
- \hr@charifavailable{01C8}{Lj}%
+ \hr@charifavailable{01C8}{L\nobreak j}{Lj}%
\else
L#2%
\fi%
@@ -11737,7 +12097,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi%
\ifx#1l%
\ifx#2j\relax
- \hr@charifavailable{01C9}{lj}%
+ \hr@charifavailable{01C9}{l\nobreak j}{lj}%
\else
l#2%
\fi%
@@ -11745,10 +12105,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
% 2. NJ, Nj and nj
\ifx#1N%
\ifx#2J\relax%
- \hr@charifavailable{01CA}{NJ}%
+ \hr@charifavailable{01CA}{N\nobreak J}{NJ}%
\else%
\ifx#2j\relax
- \hr@charifavailable{01CB}{Nj}%
+ \hr@charifavailable{01CB}{N\nobreak j}{Nj}%
\else
N#2%
\fi%
@@ -11756,7 +12116,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi%
\ifx#1n%
\ifx#2j\relax
- \hr@charifavailable{01CC}{nj}%
+ \hr@charifavailable{01CC}{n\nobreak j}{nj}%
\else
n#2%
\fi%
@@ -11769,7 +12129,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\refname{Literatura}%
\def\abstractname{Sažetak}%
\def\bibname{Bibliografija}%
- \def\chaptername{Poglav\hr@charifavailable{01C9}{lj}e}%
+ \def\chaptername{Poglav\xpg@hr@digraph{l}{j}e}%
\def\appendixname{Dodatak}%
\def\contentsname{Sadržaj}%
\def\listfigurename{Popis slika}%
@@ -11790,9 +12150,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\datecroatian{%
\def\today{\number\day.~\ifcase\month\or
- siječ\hr@charifavailable{01CC}{nj}a\or ve\hr@charifavailable{01C9}{lj}ače\or
- ožujka\or trav\hr@charifavailable{01CC}{nj}a\or svib\hr@charifavailable{01CC}{nj}a\or
- lip\hr@charifavailable{01CC}{nj}a\or srp\hr@charifavailable{01CC}{nj}a\or
+ siječ\xpg@hr@digraph{n}{j}a\or ve\xpg@hr@digraph{l}{j}ače\or
+ ožujka\or trav\xpg@hr@digraph{n}{j}a\or svib\xpg@hr@digraph{n}{j}a\or
+ lip\xpg@hr@digraph{n}{j}a\or srp\xpg@hr@digraph{n}{j}a\or
kolovoza\or rujna\or listopada\or studenoga\or prosinca\fi \space \number\year.}%
}
@@ -11815,13 +12175,13 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@croatian{%
- \ifcroatian@babelshorthands\croatian@shorthands\fi%
+ \ifcroatian@babelshorthands\croatian@shorthands\else\nocroatian@shorthands\fi%
\ifcroatian@splithyphens\croatian@hyphens\else\nocroatian@hyphens\fi%
\ifcroatian@localalph\let\alph\croatian@alph\let\Alph\croatian@Alph\fi%
}
\def\inlineextras@croatian{%
- \ifcroatian@babelshorthands\croatian@shorthands\fi%
+ \ifcroatian@babelshorthands\croatian@shorthands\else\nocroatian@shorthands\fi%
\ifcroatian@splithyphens\croatian@hyphens\else\nocroatian@hyphens\fi%
\ifcroatian@localalph\let\alph\croatian@alph\let\Alph\croatian@Alph\fi%
}
@@ -11904,7 +12264,15 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\shorthandoff{"}%
}{}
-\def\cs@@splithyphen#1{%
+\def\czech@@splithyphen#1{%
+ \def\czech@sh@tmp{%
+ \if\czech@sh@next-#1%
+ \else\expandafter\czech@@@splithyphen{#1}\fi%
+ }%
+ \futurelet\czech@sh@next\czech@sh@tmp%
+}
+
+\def\czech@@@splithyphen#1{%
\ifnum\hyphenchar \font>0%
\kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
\nobreak\hskip\z@%
@@ -11913,14 +12281,14 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi%
}
-\def\cs@splithyphen{%
- \cs@@splithyphen{-}%
+\def\czech@splithyphen{%
+ \czech@@splithyphen{-}%
}
\def\czech@shorthands{%
\bbl@activate{"}%
\def\language@group{czech}%
- \declare@shorthand{czech}{"=}{\cs@splithyphen}%
+ \declare@shorthand{czech}{"=}{\czech@splithyphen}%
\declare@shorthand{czech}{"`}{„}%
\declare@shorthand{czech}{"'}{“}%
\declare@shorthand{czech}{"<}{«}%
@@ -11957,9 +12325,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\else
\XeTeXinterchartokenstate=1
\XeTeXcharclass `\- \czech@hyphen
- \XeTeXinterchartoks \z@ \czech@hyphen = {\cs@@splithyphen}% "-" -> "\cs@@splithyphen-"
+ \XeTeXinterchartoks \z@ \czech@hyphen = {\czech@@splithyphen}% "-" -> "\czech@@splithyphen-"
% necessary if used together with vlna:
- \XeTeXinterchartoks \czech@nonsyllabicpreposition \czech@hyphen = {\cs@@splithyphen}% "-" -> "\cs@@splithyphen-"
+ \XeTeXinterchartoks \czech@nonsyllabicpreposition \czech@hyphen = {\czech@@splithyphen}% "-" -> "\czech@@splithyphen-"
\fi%
}
@@ -12091,13 +12459,13 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@czech{%
- \ifczech@babelshorthands\czech@shorthands\fi%
+ \ifczech@babelshorthands\czech@shorthands\else\noczech@shorthands\fi%
\ifczech@vlna\czech@vlna\else\noczech@vlna\fi%
\ifczech@splithyphens\czech@hyphens\else\noczech@hyphens\fi%
}
\def\inlineextras@czech{%
- \ifczech@babelshorthands\czech@shorthands\fi%
+ \ifczech@babelshorthands\czech@shorthands\else\noczech@shorthands\fi%
\ifczech@vlna\czech@vlna\else\noczech@vlna\fi%
\ifczech@splithyphens\czech@hyphens\else\noczech@hyphens\fi%
}
@@ -12642,11 +13010,11 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@dutch{%
- \ifdutch@babelshorthands\dutch@shorthands\fi%
+ \ifdutch@babelshorthands\dutch@shorthands\else\nodutch@shorthands\fi%
}
\def\inlineextras@dutch{%
- \ifdutch@babelshorthands\dutch@shorthands\fi%
+ \ifdutch@babelshorthands\dutch@shorthands\else\nodutch@shorthands\fi%
}
% \end{macrocode}
@@ -12819,19 +13187,20 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
% BCP-47 compliant aliases
-\setlanguagealias*{english}{en}
-\setlanguagealias*[variant=australian]{english}{en-AU}
-\setlanguagealias*[variant=newzealand]{english}{en-NZ}
-\setlanguagealias*[variant=us]{english}{en-US}
-\setlanguagealias*[variant=british]{english}{en-GB}
-\setlanguagealias*[variant=canadian]{english}{en-CA}
+\setlanguagealias*[bcp47=en]{english}{en}
+\setlanguagealias*[variant=australian,babelname=autralian,bcp47=en-AU]{en}{en-AU}
+\setlanguagealias*[variant=canadian,babelname=canadian,bcp47=en-CA]{en}{en-CA}
+\setlanguagealias*[variant=british,babelname=british,bcp47=en-NZ]{en}{en-GB}
+\setlanguagealias*[variant=newzealand,babelname=newzealand,bcp47=en-NZ]{en}{en-NZ}
+\setlanguagealias*[variant=us,babelname=american,bcp47=en-US]{en}{en-US}
+
% 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}
+\setlanguagealias[variant=us]{en-US}{american}
+\setlanguagealias[variant=australian]{en-AU}{australian}
+\setlanguagealias[variant=british]{en-GB}{british}
+\setlanguagealias[variant=canadian]{en-CA}{canadian}
+\setlanguagealias[variant=newzealand]{en-NZ}{newzealand}
\providebool{british@hyphen}
\providebool{english@ordinalmonthday}
@@ -12979,6 +13348,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\alsoname{see also}%
\def\proofname{Proof}%
}
+
\def\dateenglish{%
\def\english@day{%
\ifenglish@ordinalmonthday
@@ -13290,8 +13660,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\define@boolkey{finnish}[finnish@]{babelshorthands}[true]{}
+\define@boolkey{finnish}[finnish@]{schoolhyphens}[true]{}
+
% Register default options
-\xpg@initialize@gloss@options{finnish}{babelshorthands=false}
+\xpg@initialize@gloss@options{finnish}{babelshorthands=false,schoolhyphens=false}
\ifsystem@babelshorthands
\setkeys{finnish}{babelshorthands=true}
@@ -13345,6 +13717,21 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\proofname{Todistus}%
\def\glossaryname{Sanasto}%
}
+
+\def\finnish@language{%
+ \iffinnish@schoolhyphens
+ \xpg@ifdefined{schoolfinnish}{%
+ \polyglossia@setup@language@patterns{schoolfinnish}%
+ }{%
+ \xpg@warning{Finnish 'School' hyphenation patterns (schoolfinnish) not available.\MessageBreak
+ I will use the standard patterns for Finnish instead}%
+ \polyglossia@setup@language@patterns{finnish}%
+ }%
+ \else
+ \polyglossia@setup@language@patterns{finnish}%
+ \fi
+}
+
\def\datefinnish{%
\def\today{\number\day.~\ifcase\month\or
tammikuuta\or helmikuuta\or maaliskuuta\or huhtikuuta\or
@@ -13357,11 +13744,11 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@finnish{%
- \iffinnish@babelshorthands\finnish@shorthands\fi%
+ \iffinnish@babelshorthands\finnish@shorthands\else\nofinnish@shorthands\fi%
}
\def\inlineextras@finnish{%
- \iffinnish@babelshorthands\finnish@shorthands\fi%
+ \iffinnish@babelshorthands\finnish@shorthands\else\nofinnish@shorthands\fi%
}
% \end{macrocode}
@@ -14496,12 +14883,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@georgian{%
- \ifgeorgian@numerals\georgian@numbers\fi%
- \ifgeorgian@babelshorthands\georgian@shorthands\fi%
+ \ifgeorgian@numerals\georgian@numbers\else\nogeorgian@numbers\fi%
+ \ifgeorgian@babelshorthands\georgian@shorthands\else\nogeorgian@shorthands\fi%
}
\def\inlineextras@georgian{%
- \ifgeorgian@babelshorthands\georgian@shorthands\fi%
+ \ifgeorgian@babelshorthands\georgian@shorthands\else\nogeorgian@shorthands\fi%
}
% \end{macrocode}
@@ -14664,7 +15051,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\xpg@info{Option: German, script=\xpg@val}%
}{\xpg@warning{Unknown German script `#1'}}
-% Option defunc'ed, as bot XeTeX and LuaTeX meanwhile
+% Option defunc'ed, as both XeTeX and LuaTeX meanwhile
% use the experimental German hyphenation patterns by default.
\define@boolkey{german}[german@]{latesthyphen}[true]{}
@@ -14673,7 +15060,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\setkeys{german}{spelling,script,variant}
% Register default options
-\xpg@initialize@gloss@options{german}{variant=german,spelling=new,script=latin,latesthyphen=false,babelshorthands=false}
+\xpg@initialize@gloss@options{german}{variant=german,spelling=new,script=latin,babelshorthands=false}
% Register alias options
\xpg@set@alias@values{german}{spelling}{new}{1996}
\xpg@set@alias@values{german}{spelling}{old}{1901}
@@ -14829,11 +15216,11 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@german{%
- \ifgerman@babelshorthands\german@shorthands\fi%
+ \ifgerman@babelshorthands\german@shorthands\else\nogerman@shorthands\fi%
}
\def\inlineextras@german{%
- \ifgerman@babelshorthands\german@shorthands\fi%
+ \ifgerman@babelshorthands\german@shorthands\else\nogerman@shorthands\fi%
}
% \end{macrocode}
@@ -15144,8 +15531,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\renewrobustcmd\anw@print{ʹ}}
\anw@true
-\newcommand{\greeknumerals}[2]{\greeknumber{#2}}
-\newcommand{\Greeknumerals}[2]{\Greeknumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via politunikogreek.
+\providecommand{\greeknumerals}[2]{\greeknumber{#2}}
+\providecommand{\Greeknumerals}[2]{\Greeknumber{#2}}
\protected\def\greeknumber#1{\expandafter\@greeknumber\expandafter{\number#1}}
\def\@greeknumber#1{%
@@ -16353,12 +16742,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\lccode\string"2019=\string"2019%
\clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000%
\finalhyphendemerits=50000000%
- \ifitalian@babelshorthands\italian@shorthands\fi%
+ \ifitalian@babelshorthands\italian@shorthands\else\noitalian@shorthands\fi%
}
\def\inlineextras@italian{%
\lccode\string"2019=\string"2019%
- \ifitalian@babelshorthands\italian@shorthands\fi%
+ \ifitalian@babelshorthands\italian@shorthands\else\noitalian@shorthands\fi%
}
%%% CHANGES END %%%
% \end{macrocode}
@@ -17120,16 +17509,25 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
% change chapter and part headings
\if@korean@swapheadings
% With titlesec
- \ifdefined\titleformat
- \ifdefined\@part
- \let\xpg@save@part@format\@part
- \patchcmd{\@part}%
+ \ifcsdef{titleformat}{%
+ \ifcsdef{H@old@part}{% Hyperref
+ \let\xpg@save@part@format\H@old@part
+ \patchcmd{\H@old@part}%
{\partname\nobreakspace\thepart}%
{\koreanTHEname\nobreakspace \thepart\nobreakspace \partname}%
{}%
{\xpg@warning{Failed to patch part for Korean}}%
- \fi
- \ifdefined\chapter
+ }{% not hyperref
+ \ifcsdef{@part}{%
+ \let\xpg@save@part@format\@part
+ \patchcmd{\@part}%
+ {\partname\nobreakspace\thepart}%
+ {\koreanTHEname\nobreakspace \thepart\nobreakspace \partname}%
+ {}%
+ {\xpg@warning{Failed to patch part for Korean}}%
+ }{}%
+ }
+ \ifcsdef{chapter}{%
\titleformat\chapter[display]%
{\@ifundefined{ttl@fil}{\raggedright}{\ttl@fil}\ttl@fonts\ttl@sizes6}%
{%
@@ -17139,15 +17537,15 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\koreanTHEname\space \thechapter\space \@chapapp
\fi
}{.8\baselineskip}{\ttl@sizes\z@\ttl@passexplicit}%
- \fi
- \else % (not \ifdefined\titleformat)
+ }{}%
+ }{% (not \ifdefined\titleformat)
% With KOMA
- \ifdefined\sectionformat
- \ifdefined\partformat
+ \ifcsdef{sectionformat}{%
+ \ifcsdef{partformat}{%
\let\xpg@save@part@format\partformat
\renewcommand*{\partformat}{\koreanTHEname~\thepart~\partname}%
- \fi
- \ifdefined\chapterformat
+ }{}%
+ \ifcsdef{chapterformat}{%
\let\xpg@save@chap@format\chapterformat
\renewcommand*{\chapterformat}{\mbox{%
\IfChapterUsesPrefixLine
@@ -17160,11 +17558,11 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}%
{\thechapter\autodot\enskip}%
}}%
- \fi
- \else % (not \ifdefined\sectionformat)
+ }{}%
+ }{% (not \ifdefined\sectionformat)
% With memoir
- \ifdefined\@memptsize
- \ifdefined\@makechapterhead
+ \ifcsdef{@memptsize}{%
+ \ifcsdef{@makechapterhead}{%
\let\xpg@save@chap@format\@makechapterhead
\patchcmd{\@makechapterhead}%
{\printchaptername \chapternamenum \printchapternum}%
@@ -17182,10 +17580,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\ifpatchable\printchaptername\@chapapp
{\chapnamefont\koreanTHEname\chapternamenum}{}}%
\fi
- \fi
- \ifdefined\@part
- \let\xpg@save@part@format\@part
- \patchcmd{\@part}%
+ }{}%
+ \ifcsdef{H@old@part}{% Hyperref
+ \let\xpg@save@part@format\H@old@part
+ \patchcmd{\H@old@part}%
{\printpartname \partnamenum \printpartnum}%
{\printkoreanpartthe \printpartnum\partnamenum \printpartname}%
{}%
@@ -17193,10 +17591,22 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\ifdefined\printkoreanpartthe\else
\def\printkoreanpartthe{\partnamefont\koreanTHEname\partnamenum}%
\fi
- \fi
- \else % (not \ifdefined\@memptsize)
+ }{% not hyperref
+ \ifcsdef{@part}{%
+ \let\xpg@save@part@format\@part
+ \patchcmd{\@part}%
+ {\printpartname \partnamenum \printpartnum}%
+ {\printkoreanpartthe \printpartnum\partnamenum \printpartname}%
+ {}%
+ {\xpg@warning{Failed to patch part for Korean}}%
+ \ifdefined\printkoreanpartthe\else
+ \def\printkoreanpartthe{\partnamefont\koreanTHEname\partnamenum}%
+ \fi
+ }{}%
+ }%
+ }{% (not \ifdefined\@memptsize)
% With standard classes
- \ifdefined\@makechapterhead
+ \ifcsdef{@makechapterhead}{%
\let\xpg@save@chap@format\@makechapterhead
\patchcmd{\@makechapterhead}%
{\@chapapp\space \thechapter}%
@@ -17209,23 +17619,35 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}%
{}%
{\xpg@warning{Failed to patch chapter for Korean}}%
- \fi
- \ifdefined\@part
- \let\xpg@save@part@format\@part
- \patchcmd{\@part}%
+ }{}%
+ \ifcsdef{H@old@part}{% Hyperref
+ \let\xpg@save@part@format\H@old@part
+ \patchcmd{\H@old@part}%
{\partname\nobreakspace\thepart}%
{\koreanTHEname\nobreakspace \thepart\nobreakspace \partname}%
{}%
{\xpg@warning{Failed to patch part for Korean}}%
- \fi % (end \ifdefined\@part)
- \fi % (end \ifdefined\@memptsize)
- \fi % (end \ifdefined\sectionformat)
- \fi % (end \ifdefined\titleformat)
+ }{% not hyperref
+ \ifcsdef{@part}{%
+ \ifpatchable{\@part}%
+ {\partname\nobreakspace\thepart}%
+ {\let\xpg@save@part@format\@part
+ \patchcmd{\@part}%
+ {\partname\nobreakspace\thepart}%
+ {\koreanTHEname\nobreakspace \thepart\nobreakspace \partname}%
+ {}%
+ {\ifcsdef{part}{\xpg@warning{Failed to patch part for Korean}}{}}}%
+ {}%
+ }{}% (end \ifdefined\@part)
+ }% (end not hyperref)
+ }% (end \ifdefined\@memptsize)
+ }% (end \ifdefined\sectionformat)
+ }% (end \ifdefined\titleformat)
\fi % (end \if@korean@swapheadings)
%
% Change running headers
\if@korean@swapheaders
- \ifdefined\chapterformat
+ \ifcsdef{chapterformat}{%
% With KOMA
\let\xpg@save@chaptermark@format\chaptermarkformat
\renewcommand*\chaptermarkformat{%
@@ -17240,8 +17662,8 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{\thechapter\autodot}%
\enskip
}%
- \else % (not \ifdefined\chapterformat)
- \ifdefined\@memptsize
+ }{% (not \ifdefined\chapterformat)
+ \ifcsdef{@memptsize}{%
% With memoir
\let\xpg@save@chaptermark@format\chaptermark
\patchcmd{\chaptermark}%
@@ -17254,74 +17676,85 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi
}%
{}%
- {}%
- \else % (not \ifdefined\@memptsize)
+ {\xpg@warning{Failed to patch chaptermark for Korean}}%
+ }{% (not \ifdefined\@memptsize)
% With standard classes
- \ifdefined\chaptermark
- \let\xpg@save@chaptermark@format\chaptermark
- \patchcmd{\chaptermark}%
- {\@chapapp\ \thechapter}%
- {%
- \ifx\@chapapp\korean@appendix@chapapp
- \appendixname\ \thechapter
- \else
- \koreanTHEname\ \thechapter\ \@chapapp
- \fi
- }%
- {}%
- {}%
- \fi % (end \ifdefined\chaptermark)
- \fi % (end \ifdefined\@memptsize)
- \fi % (end \ifdefined\chapterformat)
+ \ifcsdef{chaptermark}{%
+ \ifpatchable{\chaptermark}%
+ {\@chapapp\ \thechapter}%
+ {\let\xpg@save@chaptermark@format\chaptermark
+ \patchcmd{\chaptermark}%
+ {\@chapapp\ \thechapter}%
+ {%
+ \ifx\@chapapp\korean@appendix@chapapp
+ \appendixname\ \thechapter
+ \else
+ \koreanTHEname\ \thechapter\ \@chapapp
+ \fi
+ }%
+ {}%
+ {\xpg@warning{Failed to patch chaptermark for Korean}}}%
+ {}%
+ }{}% (end \ifdefined\chaptermark)
+ }% (end \ifdefined\@memptsize)
+ }% (end \ifdefined\chapterformat)
\fi % (end \if@korean@swapheaders)
}
\def\nokorean@headingsformat{%
% Reset chapter and part heading
- \ifdefined\titleformat
+ \ifcsdef{titleformat}{%
% With titlesec
- \ifdefined\xpg@save@part@format
- \let\@part\xpg@save@part@format
- \fi
- \ifdefined\chapter
+ \ifcsdef{xpg@save@part@format}{%
+ \ifcsdef{H@old@part}{%
+ \let\H@old@part\xpg@save@part@format
+ }{%
+ \let\@part\xpg@save@part@format
+ }%
+ }{}%
+ \ifcsdef{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
+ }{}%
+ }{% (not \ifdefined\titleformat)
+ \ifcsdef{sectionformat}{%
% With KOMA
- \ifdefined\xpg@save@part@format
+ \ifcsdef{xpg@save@part@format}{%
\let\partformat\xpg@save@part@format
- \fi
- \ifdefined\xpg@save@chap@format
+ }{}%
+ \ifcsdef{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
+ \ifcsdef{xpg@save@part@format}{%
+ \ifcsdef{H@old@part}{%
+ \let\H@old@part\xpg@save@part@format
+ }{%
+ \let\@part\xpg@save@part@format
+ }%
+ }{}%
+ \ifcsdef{xpg@save@chap@format}{%
\let\@makechapterhead\xpg@save@chap@format
- \fi
- \fi % (end \ifdefined\sectionformat)
- \fi % (end \ifdefined\titleformat)
+ }{}%
+ }% (end \ifdefined\sectionformat)
+ }% (end \ifdefined\titleformat)
%
% Reset headers
- \ifdefined\chaptermarkformat
+ \ifcsdef{chaptermarkformat}{%
% With KOMA
- \ifdefined\xpg@save@chaptermark@format
+ \ifcsdef{xpg@save@chaptermark@format}{%
\let\chaptermarkformat\xpg@save@chaptermark@format
- \fi
- \else
- \ifdefined\chaptermark
+ }{}%
+ }{%
+ \ifcsdef{chaptermark}{%
% With memoir and standard classes
- \ifdefined\xpg@save@chaptermark@format
+ \ifcsdef{xpg@save@chaptermark@format}{%
\let\chaptermark\xpg@save@chaptermark@format
- \fi
- \fi % (end \ifdefined\chaptermark)
- \fi % (end \ifdefined\chapterformat)
+ }{}%
+ }{}% (end \ifdefined\chaptermark)
+ }% (end \ifdefined\chapterformat)
}
\def\datekorean{%
@@ -17824,7 +18257,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\csname datekurdish@\kurdish@variant @\kurdish@script\endcsname%
}
-\newcommand{\kurdishnumerals}[2]{\kurdishnumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via BCP.
+\providecommand{\kurdishnumerals}[2]{\kurdishnumber{#2}}
\def\kurdishnumber#1{%
\if@western@numerals
@@ -18064,54 +18499,13 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
% \end{macrocode}
% \iffalse
%</gloss-lao.ldf>
-%<*gloss-latex.ldf>
-% \fi
-% \clearpage
-%
-% \subsection{gloss-latex.ldf}
-% \begin{macrocode}
-\ProvidesFile{gloss-latex.ldf}[polyglossia: module for default language]
-
-\PolyglossiaSetup{latex}{
- hyphennames={english},
- hyphenmins={2,3},
- langtag=ENG,
- fontsetup=true,
-}
-
-\def\captionslatex{%
- \def\prefacename{Preface}%
- \def\refname{References}%
- \def\abstractname{Abstract}%
- \def\bibname{Bibliography}%
- \def\chaptername{Chapter}%
- \def\appendixname{Appendix}%
- \def\contentsname{Contents}%
- \def\listfigurename{List of Figures}%
- \def\listtablename{List of Tables}%
- \def\indexname{Index}%
- \def\figurename{Figure}%
- \def\tablename{Table}%
- \def\partname{Part}%
- \def\enclname{encl}%
- \def\ccname{cc}%
- \def\headtoname{To}%
- \def\pagename{Page}%
- \def\seename{see}%
- \def\alsoname{see also}%
- \def\proofname{Proof}%
-}
-
-% \end{macrocode}
-% \iffalse
-%</gloss-latex.ldf>
%<*gloss-latin.ldf>
% \fi
% \clearpage
%
% \subsection{gloss-latin.ldf}
% \begin{macrocode}
-\ProvidesFile{gloss-latin.ldf}[polyglossia: module for Latin v.2.3 2020-03-08]
+\ProvidesFile{gloss-latin.ldf}[polyglossia: module for Latin v.2.4 2021-10-25]
\ExplSyntaxOn
@@ -18140,7 +18534,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\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_use_ligatures_bool
\bool_new:N \l_polyglossia_latin_capitalize_month_bool
\cs_new:Npn \polyglossia_latin_classical_character_codes:
@@ -18501,7 +18895,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{
\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_false:N \l_polyglossia_latin_use_ligatures_bool
\bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
\bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
\str_set:Nn \l_polyglossia_latin_variant_str {classic}
@@ -18513,7 +18907,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{
\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_use_ligatures_bool
\bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
\bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
\str_set:Nn \l_polyglossia_latin_variant_str {medieval}
@@ -18525,7 +18919,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{
\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_false:N \l_polyglossia_latin_use_ligatures_bool
\bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
\bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
\str_set:Nn \l_polyglossia_latin_variant_str {modern}
@@ -18537,7 +18931,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{
\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_true:N \l_polyglossia_latin_use_ligatures_bool
\bool_set_false:N \l_polyglossia_latin_capitalize_month_bool
\bool_set_true:N \l_polyglossia_latin_punctuation_spacing_bool
\str_set:Nn \l_polyglossia_latin_variant_str {ecclesiastic}
@@ -18632,7 +19026,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{
\def \prefacename
{
- \bool_if:NTF \l_polyglossia_latin_use_digraphs_bool {Præfatio} {Praefatio}
+ \bool_if:NTF \l_polyglossia_latin_use_ligatures_bool {Præfatio} {Praefatio}
}
\def \refname {Conspectus~librorum}
\def \abstractname {Summarium}
@@ -18658,7 +19052,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\cs_new:Npn \polyglossia_latin_month_name:
{
- \str_set:Nx \l_tmpa_str
+ \tl_set:Nx \l_tmpa_tl
{
\int_case:nn { \month }
{
@@ -18678,10 +19072,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\bool_if:NTF \l_polyglossia_latin_capitalize_month_bool
{
- \tl_mixed_case:n { \l_tmpa_str }
+ \text_titlecase:n { \l_tmpa_tl }
}
{
- \str_use:N \l_tmpa_str
+ \l_tmpa_tl
}
}
@@ -18830,28 +19224,28 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{
\str_case:nnF {#1}
{
- {A} { \polyglossia_latin_digraph_shorthand:Nnn E { Æ }
+ {A} { \polyglossia_latin_ligature_shorthand:Nnn E { Æ }
{
- \polyglossia_latin_digraph_shorthand:Nnn e { Æ }
+ \polyglossia_latin_ligature_shorthand:Nnn e { Æ }
{
\polyglossia_latin_allow_hyphens: A
}
}
}
- {a} { \polyglossia_latin_digraph_shorthand:Nnn e { æ }
+ {a} { \polyglossia_latin_ligature_shorthand:Nnn e { æ }
{
\polyglossia_latin_allow_hyphens: a
}
}
- {O} { \polyglossia_latin_digraph_shorthand:Nnn E { Π}
+ {O} { \polyglossia_latin_ligature_shorthand:Nnn E { Π}
{
- \polyglossia_latin_digraph_shorthand:Nnn e { Π}
+ \polyglossia_latin_ligature_shorthand:Nnn e { Π}
{
\polyglossia_latin_allow_hyphens: O
}
}
}
- {o} { \polyglossia_latin_digraph_shorthand:Nnn e { œ }
+ {o} { \polyglossia_latin_ligature_shorthand:Nnn e { œ }
{
\polyglossia_latin_allow_hyphens: o
}
@@ -18861,23 +19255,20 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{>} { » }
}
{
- \token_if_letter:NTF #1 { \polyglossia_latin_allow_hyphens: #1 }
+ \tl_if_single_token:nTF {#1}
{
- \token_if_eq_meaning:NNTF #1 \AE { \polyglossia_latin_allow_hyphens: #1 }
+ \token_if_letter:NTF #1 { \polyglossia_latin_allow_hyphens: }
{
- \token_if_eq_meaning:NNTF #1 \ae { \polyglossia_latin_allow_hyphens: #1 }
+ \polyglossia_latin_if_ligature_command:NTF #1 { \polyglossia_latin_allow_hyphens: }
{
- \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
- }
- }
+ \token_to_str:N "
}
}
}
+ {
+ \token_to_str:N "
+ }
+ #1
}
}
@@ -18885,22 +19276,22 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{
\str_case:nnF {#1}
{
- {A} { \polyglossia_latin_digraph_shorthand:Nnn E { Ǽ }
+ {A} { \polyglossia_latin_ligature_shorthand:Nnn E { Ǽ }
{
- \polyglossia_latin_digraph_shorthand:Nnn e { Ǽ } { Á }
+ \polyglossia_latin_ligature_shorthand:Nnn e { Ǽ } { Á }
}
}
- {a} { \polyglossia_latin_digraph_shorthand:Nnn e { ǽ } { á } }
+ {a} { \polyglossia_latin_ligature_shorthand:Nnn e { ǽ } { á } }
{E} { É }
{e} { é }
{I} { Í }
{i} { í }
- {O} { \polyglossia_latin_digraph_shorthand:Nnn E { \'Π}
+ {O} { \polyglossia_latin_ligature_shorthand:Nnn E { \'Π}
{
- \polyglossia_latin_digraph_shorthand:Nnn e { \'Œ } { Ó }
+ \polyglossia_latin_ligature_shorthand:Nnn e { \'Œ } { Ó }
}
}
- {o} { \polyglossia_latin_digraph_shorthand:Nnn e { \'œ } { ó } }
+ {o} { \polyglossia_latin_ligature_shorthand:Nnn e { \'œ } { ó } }
{U} { Ú }
{u} { ú }
{V} { \' V } % V may be a vowel, but lowercase v is never used as a vowel.
@@ -18912,20 +19303,17 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{œ} { \'œ }
}
{
- \token_if_eq_meaning:NNTF #1 \AE { Ǽ }
+ \tl_if_single_token:nTF {#1}
{
- \token_if_eq_meaning:NNTF #1 \ae { ǽ }
+ \polyglossia_latin_if_ligature_command:NTF #1 { \' }
{
- \token_if_eq_meaning:NNTF #1 \OE { \'Π}
- {
- \token_if_eq_meaning:NNTF #1 \oe { \'œ }
- {
- \token_to_str:N '
- #1
- }
- }
+ \token_to_str:N '
}
}
+ {
+ \token_to_str:N '
+ }
+ #1
}
}
@@ -18933,9 +19321,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{
\str_case:nnF {#1}
{
- {A} { \polyglossia_latin_diphthong_macron:NNn AE
+ {A} { \polyglossia_latin_ligature_macron:NNnn AE { Ǣ }
{
- \polyglossia_latin_diphthong_macron:NNn Ae
+ \polyglossia_latin_ligature_macron:NNnn Ae { Ǣ }
{
\polyglossia_latin_diphthong_macron:NNn AU
{
@@ -18944,7 +19332,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
}
}
- {a} { \polyglossia_latin_diphthong_macron:NNn ae
+ {a} { \polyglossia_latin_ligature_macron:NNnn ae { ǣ }
{
\polyglossia_latin_diphthong_macron:NNn au { ā }
}
@@ -18957,12 +19345,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{e} { \polyglossia_latin_diphthong_macron:NNn eu { ē } }
{I} { Ī }
{i} { ī }
- {O} { \polyglossia_latin_diphthong_macron:NNn OE
+ {O} { \polyglossia_latin_ligature_macron:NNnn OE { \=Π}
{
- \polyglossia_latin_diphthong_macron:NNn Oe { Ō }
+ \polyglossia_latin_ligature_macron:NNnn Oe { \=Œ } { Ō }
}
}
- {o} { \polyglossia_latin_diphthong_macron:NNn oe { ō } }
+ {o} { \polyglossia_latin_ligature_macron:NNnn oe { \=œ } { ō } }
{U} { Ū }
{u} { ū }
{V} { \= V } % V may be a vowel, but lowercase v is never used as a vowel.
@@ -18970,7 +19358,16 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
{y} { ȳ }
}
{
- \token_to_str:N =
+ \tl_if_single_token:nTF {#1}
+ {
+ \polyglossia_latin_if_ligature_command:NTF #1 { \= }
+ {
+ \token_to_str:N =
+ }
+ }
+ {
+ \token_to_str:N =
+ }
#1
}
}
@@ -19007,12 +19404,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\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
+\cs_new:Npn \polyglossia_latin_ligature_shorthand:Nnn #1#2#3
+% #1: second letter of ligature (E or e)
+% #2: ligature character
+% #3: non-ligature code
{
- \bool_if:NTF \l_polyglossia_latin_use_digraphs_bool
+ \bool_if:NTF \l_polyglossia_latin_use_ligatures_bool
{
\peek_meaning_remove:NTF #1 {#2} {#3}
}
@@ -19021,12 +19418,60 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
}
+\msg_new:nnn {polyglossia} {latin / no-double-macron-font}
+ {
+ The~combining~double~macron~(U+035E)~is~not~available~in~the~current~
+ font.~The~diphthong~is~typeset~without~macron~ \msg_line_context: .
+ }
+
\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
+ \peek_meaning:NTF #2
+ {
+ #1
+ \iffontchar \font "35E \relax % U+35E: combining double macron
+ \char "35E \relax
+ \else
+ \msg_warning:nn {polyglossia} {latin / no-double-macron-font}
+ \fi
+ }
+ {
+ #3
+ }
+ }
+
+\cs_new:Npn \polyglossia_latin_ligature_macron:NNnn #1#2#3#4
+% #1: first character of diphthong
+% #2: second character of diphthong
+% #3: ligature code
+% #4: false code
+ {
+ \polyglossia_latin_ligature_shorthand:Nnn #2 {#3}
+ {
+ \polyglossia_latin_diphthong_macron:NNn #1 #2 {#4}
+ }
+ }
+
+% The following conditional tests if the argument is a ligature command (\AE,
+% \ae, \OE, or \oe).
+\prg_new_conditional:Npnn \polyglossia_latin_if_ligature_command:N #1 {TF}
+ {
+ \token_if_eq_meaning:NNTF #1 \AE { \prg_return_true: }
+ {
+ \token_if_eq_meaning:NNTF #1 \ae { \prg_return_true: }
+ {
+ \token_if_eq_meaning:NNTF #1 \OE { \prg_return_true: }
+ {
+ \token_if_eq_meaning:NNTF #1 \oe { \prg_return_true: }
+ {
+ \prg_return_false:
+ }
+ }
+ }
+ }
}
\cs_new:Npn \polyglossia_latin_no_shorthands:
@@ -19644,8 +20089,8 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\datemalay@indonesian{%
\def\today{\number\day~\ifcase\month\or
- Januari\or Pebruari\or Maret\or April\or Mei\or Juni\or
- Juli\or Agustus\or September\or Oktober\or Nopember\or Desember\fi
+ Januari\or Februari\or Maret\or April\or Mei\or Juni\or
+ Juli\or Agustus\or September\or Oktober\or November\or Desember\fi
\space \number\year}}
\def\datemalay@malay{%
@@ -20170,12 +20615,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@mongolian{%
- \ifcyrillic@numerals\mongolian@numbers\fi%
- \ifmongolian@babelshorthands\mongolian@shorthands\fi%
+ \ifcyrillic@numerals\mongolian@numbers\else\nomongolian@numbers\fi%
+ \ifmongolian@babelshorthands\mongolian@shorthands\else\nomongolian@shorthands\fi%
}
\def\inlineextras@mongolian{%
- \ifmongolian@babelshorthands\mongolian@shorthands\fi%
+ \ifmongolian@babelshorthands\mongolian@shorthands\else\nomongolian@shorthands\fi%
}
% \end{macrocode}
@@ -20676,12 +21121,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\lccode\string"2019=\string"2019%
\clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000%
\finalhyphendemerits=50000000%
- \ifoccitan@babelshorthands\occitan@shorthands\fi%
+ \ifoccitan@babelshorthands\occitan@shorthands\else\nooccitan@shorthands\fi%
}
\def\inlineextras@occitan{%
\lccode\string"2019=\string"2019%
- \ifoccitan@babelshorthands\occitan@shorthands\fi%
+ \ifoccitan@babelshorthands\occitan@shorthands\else\nooccitan@shorthands\fi%
}
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
@@ -20958,12 +21403,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\lccode\string"2019=\string"2019%
\clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000%
\finalhyphendemerits=50000000%
- \ifpiedmontese@babelshorthands\piedmontese@shorthands\fi%
+ \ifpiedmontese@babelshorthands\piedmontese@shorthands\else\nopiedmontese@shorthands\fi%
}
\def\inlineextras@piedmontese{%
\lccode\string"2019=\string"2019%
- \ifpiedmontese@babelshorthands\piedmontese@shorthands\fi%
+ \ifpiedmontese@babelshorthands\piedmontese@shorthands\else\nopiedmontese@shorthands\fi%
}
%%% CHANGES END %%%
% \end{macrocode}
@@ -21082,6 +21527,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\setlanguagealias[variant=portuguese]{portuguese}{portuges}
\setlanguagealias[variant=brazilian]{portuguese}{brazil}
+\ifluatex
+ \RequirePackage{luavlna}
+\fi
+
\def\portuguese@variant{portuges}
\define@choicekey*+{portuguese}{variant}[\xpg@val\xpg@nr]{portuguese,brazilian}[portuguese]{%
\ifcase\xpg@nr\relax
@@ -21098,10 +21547,91 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\xpg@info{Option: portuguese, variant=\xpg@val}%
}{\xpg@warning{Unknown portuguese variant `#1'}}
+\define@boolkey{portuguese}[portuguese@]{babelshorthands}[true]{}
+
+\define@boolkey{portuguese}[portuguese@]{splithyphens}[true]{}
% Register default options
-\xpg@initialize@gloss@options{portuguese}{variant=portuguese}
+\xpg@initialize@gloss@options{portuguese}{variant=portuguese,
+ babelshorthands=false,
+ splithyphens=true}
+
+\ifsystem@babelshorthands
+ \setkeys{portuguese}{babelshorthands=true}
+\else
+ \setkeys{portuguese}{babelshorthands=false}
+\fi
+
+\ifcsundef{initiate@active@char}{%
+ \input{babelsh.def}%
+ \initiate@active@char{"}%
+ \shorthandoff{"}%
+}{}
+
+\def\portuguese@@splhyphen#1{%
+ \def\portuguese@sh@tmp{%
+ \if\portuguese@sh@next-#1%
+ \else\expandafter\portuguese@@@splhyphen{#1}\fi%
+ }%
+ \futurelet\portuguese@sh@next\portuguese@sh@tmp%
+}
+\def\portuguese@@@splhyphen#1{%
+ \ifnum\hyphenchar \font>0%
+ \kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
+ \nobreak\hskip\z@%
+ \else%
+ #1%
+ \fi%
+}
+
+\def\portuguese@splhyphen{%
+ \portuguese@@splhyphen{-}%
+}
+
+\def\portuguese@shorthands{%
+ \bbl@activate{"}%
+ \def\language@group{portuguese}%
+ \declare@shorthand{portuguese}{"=}{\portuguese@splhyphen}%
+ \declare@shorthand{portuguese}{""}{\hskip\z@skip}%
+ \declare@shorthand{portuguese}{"~}{\textormath{\leavevmode\hbox{-}}{-}}%
+ \declare@shorthand{portuguese}{"-}{\nobreak\-\bbl@allowhyphens}%
+ \declare@shorthand{portuguese}{"|}{%
+ \textormath{\penalty\@M\discretionary{-}{}{\kern.03em}%
+ \bbl@allowhyphens}{}%
+ }%
+ \declare@shorthand{portuguese}{"/}{\textormath
+ {\bbl@allowhyphens\discretionary{/}{}{/}\bbl@allowhyphens}{}}%
+ \declare@shorthand{portuguese}{"<}{«}%
+ \declare@shorthand{portuguese}{">}{»}%
+}
+
+\def\noportuguese@shorthands{%
+ \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
+}
+
+\ifxetex
+ % splithyphens
+ \newXeTeXintercharclass\portuguese@hyphen % -
+\fi
+
+\def\portuguese@hyphens{%
+ \ifluatex
+ \AfterPreamble{\enablesplithyphens{portuguese}}%
+ \else
+ \XeTeXinterchartokenstate=1
+ \XeTeXcharclass `\- \portuguese@hyphen
+ \XeTeXinterchartoks \z@ \portuguese@hyphen = {\portuguese@@splhyphen}% "-" -> "\portuguese@@splhyphen-"
+ \fi%
+}
+
+\def\noportuguese@hyphens{%
+ \ifluatex
+ \AfterPreamble{\disablesplithyphens{portuguese}}%
+ \else
+ \XeTeXcharclass `\- \z@
+ \fi%
+}
\def\portuguese@language{%
\polyglossia@setup@language@patterns{\portuguese@variant}%
@@ -21177,6 +21707,21 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\dateportuguese{%
\csname dateportuguese@\portuguese@variant\endcsname%
}
+
+\def\noextras@portuguese{%
+ \ifportuguese@babelshorthands\noportuguese@shorthands\fi%
+ \noportuguese@hyphens%
+}
+
+\def\blockextras@portuguese{%
+ \ifportuguese@babelshorthands\portuguese@shorthands\else\noportuguese@shorthands\fi%
+ \ifportuguese@splithyphens\portuguese@hyphens\else\noportuguese@hyphens\fi%
+}
+
+\def\inlineextras@portuguese{%
+ \ifportuguese@babelshorthands\portuguese@shorthands\else\noportuguese@shorthands\fi%
+ \ifportuguese@splithyphens\portuguese@hyphens\else\noportuguese@hyphens\fi%
+}
% \end{macrocode}
% \iffalse
@@ -21646,12 +22191,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\blockextras@russian{%
\russian@capsformat%
- \ifcyrillic@numerals\russian@numbers\fi%
- \ifrussian@babelshorthands\russian@shorthands\fi%
+ \ifcyrillic@numerals\russian@numbers\else\norussian@numbers\fi%
+ \ifrussian@babelshorthands\russian@shorthands\else\norussian@shorthands\fi%
}
\def\inlineextras@russian{%
- \ifrussian@babelshorthands\russian@shorthands\fi%
+ \ifrussian@babelshorthands\russian@shorthands\else\norussian@shorthands\fi%
}
%%% These lines taken from russianb.ldf, part of babel package.
@@ -21875,8 +22420,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
% Register default options
\xpg@initialize@gloss@options{sanskrit}{script=Devanagari,numerals=Devanagari}
-
-\newcommand{\sanskritnumerals}[2]{\sanskritnumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via BCP.
+\providecommand{\sanskritnumerals}[2]{\sanskritnumber{#2}}
\def\sanskritnumber#1{%
\ifsanskrit@devanagari@numerals
@@ -21982,7 +22528,8 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
langtag=SRB,
hyphennames={serbian},
hyphenmins={2,2},
- indentfirst=true,
+ frenchspacing=true, % Правопис српскога језика, Матица српска, 2010. (измењено и допуњено, четврто издање): т. 188, под Обликовање ступца и пасуса
+ indentfirst=true, % Правопис српскога језика, Матица српска, 2010. (измењено и допуњено, четврто издање): т. 188, под Обликовање ступца и пасуса
fontsetup=false,
localnumeral=serbiannumerals,
Localnumeral=Serbiannumerals,
@@ -21998,6 +22545,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
% Babel aliases
\setlanguagealias[script=Cyrillic]{serbian}{serbianc}
+\ifluatex
+ \RequirePackage{luavlna}
+\fi
+
\newif\if@serbian@cyr
\define@choicekey*+{serbian}{Script}[\xpg@val\xpg@nr]{cyrillic,latin}[cyrillic]{%
\ifcase\xpg@nr\relax
@@ -22041,10 +22592,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\xpg@info{Option: Serbian, numerals=\xpg@val}%
}{\xpg@warning{Unknown Serbian numerals value `#1'}}
+\define@boolkey{serbian}[serbian@]{splithyphens}[true]{}
+
\setkeys{serbian}{Script,numerals}
% Register default options
-\xpg@initialize@gloss@options{serbian}{script=Cyrillic,numerals=arabic}
+\xpg@initialize@gloss@options{serbian}{script=Cyrillic,numerals=arabic,splithyphens=true}
\def\captionsserbian{%
\if@serbian@cyr\captionsserbian@cyr\else\captionsserbian@lat\fi
@@ -22125,9 +22678,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
децембар\fi \space \number\year.}%
}
-
-\newcommand{\serbiannumerals}[2]{\serbiannumber{#2}}
-\newcommand{\Serbiannumerals}[2]{\Serbiannumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via serbianc.
+\providecommand{\serbiannumerals}[2]{\serbiannumber{#2}}
+\providecommand{\Serbiannumerals}[2]{\Serbiannumber{#2}}
\def\serbiannumber#1{%
\ifcyrillic@numerals
@@ -22172,12 +22726,65 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\let\@Alph\latin@Alph
}
+\def\serbian@@splhyphen#1{%
+ \def\serbian@sh@tmp{%
+ \if\serbian@sh@next-#1%
+ \else\expandafter\serbian@@@splhyphen{#1}\fi%
+ }%
+ \futurelet\serbian@sh@next\serbian@sh@tmp%
+}
+
+\def\serbian@@@splhyphen#1{%
+ \ifnum\hyphenchar \font>0%
+ \kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
+ \nobreak\hskip\z@%
+ \else%
+ #1%
+ \fi%
+}
+
+\def\serbian@splhyphen{%
+ \serbian@@splhyphen{-}%
+}
+
+\ifxetex
+ % splithyphens
+ \newXeTeXintercharclass\serbian@hyphen % -
+ \newXeTeXintercharclass\serbian@nonsyllabicpreposition%
+\fi
+
+\def\serbian@hyphens{%
+ \ifluatex
+ \AfterPreamble{\enablesplithyphens{serbian}}%
+ \else
+ \XeTeXinterchartokenstate=1
+ \XeTeXcharclass `\- \serbian@hyphen
+ \XeTeXinterchartoks \z@ \serbian@hyphen = {\serbian@@splhyphen}% "-" -> "\serbian@@splhyphen-"
+ % necessary if used together with vlna:
+ \XeTeXinterchartoks \serbian@nonsyllabicpreposition \serbian@hyphen = {\serbian@@splhyphen}% "-" -> "\serbian@@splhyphen-"
+ \fi%
+}
+
+\def\noserbian@hyphens{%
+ \ifluatex
+ \AfterPreamble{\disablesplithyphens{serbian}}%
+ \else
+ \XeTeXcharclass `\- \z@
+ \fi%
+}
+
\def\blockextras@serbian{%
- \ifcyrillic@numerals\serbian@numbers\fi
+ \ifcyrillic@numerals\serbian@numbers\else\noserbian@numbers\fi%
+ \ifserbian@splithyphens\serbian@hyphens\else\noserbian@hyphens\fi%
+}
+
+\def\inlineextras@serbian{%
+ \ifserbian@splithyphens\serbian@hyphens\else\noserbian@hyphens\fi%
}
\def\noextras@serbian{%
- \ifcyrillic@numerals\noserbian@numbers\fi
+ \ifcyrillic@numerals\noserbian@numbers\fi%
+ \noserbian@hyphens%
}
\def\Asbuk#1{\expandafter\serbian@asbuk@Alph\csname c@#1\endcsname}
@@ -22186,21 +22793,21 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\AsbukTrad#1{\expandafter\cyr@Alph\csname c@#1\endcsname}
\def\asbukTrad#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.
+% This is a poor man's cyrillic alphanumeric.
+% It just uses the alphabet and thus ends at 30.
\def\serbian@asbuk@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 Я%
+ А\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 Џ\or Ш%
\else\xpg@ill@value{#1}{serbian@asbuk@Alph}\fi%
}
\def\serbian@asbuk@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 я%
+ а\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 џ\or ш%
\else\xpg@ill@value{#1}{serbian@asbuk@alph}\fi%
}
@@ -22268,6 +22875,14 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}{}
\def\slovak@@splhyphen#1{%
+ \def\slovak@sh@tmp{%
+ \if\slovak@sh@next-#1%
+ \else\expandafter\slovak@@@splhyphen{#1}\fi%
+ }%
+ \futurelet\slovak@sh@next\slovak@sh@tmp%
+}
+
+\def\slovak@@@splhyphen#1{%
\ifnum\hyphenchar \font>0%
\kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
\nobreak\hskip\z@%
@@ -22463,13 +23078,13 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\blockextras@slovak{%
- \ifslovak@babelshorthands\slovak@shorthands\fi%
+ \ifslovak@babelshorthands\slovak@shorthands\else\noslovak@shorthands\fi%
\ifslovak@vlna\slovak@vlna\else\noslovak@vlna\fi%
\ifslovak@splithyphens\slovak@hyphens\else\noslovak@hyphens\fi%
}
\def\inlineextras@slovak{%
- \ifslovak@babelshorthands\slovak@shorthands\fi%
+ \ifslovak@babelshorthands\slovak@shorthands\else\noslovak@shorthands\fi%
\ifslovak@vlna\slovak@vlna\else\noslovak@vlna\fi%
\ifslovak@splithyphens\slovak@hyphens\else\noslovak@hyphens\fi%
}
@@ -22933,7 +23548,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\let\tgh\relax%
}
-\newcommand*\spanishoperator[2][]{%
+% Use \providecommand here as the ldf file might
+% be reloaded via babel aliases.
+\providecommand*\spanishoperator[2][]{%
\ifx#1\\\\
\protected@csxdef{#2}{\mathop{\operator@font #2}\nolimits}%
\else
@@ -23590,8 +24207,10 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\tmp@tibetan{tibetan}
\define@key{tibetan}{numerals}[tibetan]{%
\def\@tmpa{#1}%
- \ifx\@tmpa\tmp@tibetan\@tibetan@numeralstrue\else
- \@tibetan@numeralsfalse\fi
+ \ifx\@tmpa\tmp@tibetan\@tibetan@numeralstrue%
+ \else
+ \@tibetan@numeralsfalse%
+ \fi%
}
\ifluatex
@@ -23600,23 +24219,23 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi
\def\tibetan@eol{%
- \ifluatex %
- \xpg@tibteol=1\relax %
+ \ifluatex%
+ \xpg@tibteol=1\relax%
\directlua{polyglossia.activate_tibt_eol()}%
- \else %
+ \else%
\XeTeXlinebreaklocale "bo"%
\XeTeXlinebreakskip=0pt plus 0.1em% doesn't do much, but doesn't harm I guess...
- \fi %
+ \fi%
}
\def\notibetan@eol{%
- \ifluatex %
- \xpg@tibteol=0\relax %
+ \ifluatex%
+ \xpg@tibteol=0\relax%
%\directlua{polyglossia.activate_tibt_eol()}%
- \else %
+ \else%
\XeTeXlinebreaklocale "en"% en? really?
\XeTeXlinebreakskip=0pt plus 0pt%
- \fi %
+ \fi%
}
% Register default options
@@ -23649,6 +24268,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\proofname{བདེན་དཔང་།}% not sure about this one...
\def\glossaryname{མིང་ཚིག་རེའུ་མིག།}%
}
+
\def\datetibetan{%
\def\tibetan@month{%
\ifcase\month\or
@@ -23673,6 +24293,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
}
\def\tibetandigits#1{\expandafter\@tibetan@digits #1@}
+
\def\@tibetan@digits#1{%
\ifx @#1% then terminate
\else
@@ -23691,14 +24312,28 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\fi}
\def\@tibetanalph#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 ས\or ཧ\or ཨ
- \else\xpg@ill@value{#1}{@tibetanalph}\fi}
-\def\tibetanAlph#1{\expandafter\@tibetanAlph\csname c@#1\endcsname}
+ \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 ས\or ཧ\or ཨ
+ \else%
+ \xpg@ill@value{#1}{@tibetanalph}%
+ \fi%
+}
+
+\def\tibetanAlph#1{%
+ \expandafter\@tibetanAlph\csname c@#1\endcsname%
+}
+
\def\@tibetanAlph#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 ས\or ཧ\or ཨ
- \else\xpg@ill@value{#1}{@tibetanalph}\fi}
+ \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
+ ས\or ཧ\or ཨ%
+ \else%
+ \xpg@ill@value{#1}{@tibetanalph}%
+ \fi%
+}
\newcommand{\tibetanumerals}[2]{\tibetannumber{#2}}
@@ -23708,13 +24343,16 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\let\@Alph\@tibetanAlph%
\fi
}
+
\def\notibetan@numbers{%
\let\@alph\latin@alph%
\let\@Alph\latin@Alph%
}
+% Store original definition
+\let\xpg@orig@arabic\@arabic
+
\def\tibetan@globalnumbers{%
- \let\xpg@orig@arabic\@arabic%
\let\@arabic\tibetannumber%
\renewcommand{\thefootnote}{\localnumeral*{footnote}}%
}
@@ -23725,17 +24363,31 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\noextras@tibetan{%
\notibetan@eol%
- \ifcsname xpg@orig@baselinestretch\endcsname\renewcommand{\baselinestretch}{\xpg@orig@baselinestretch}\fi %
- }
+ \ifcsname xpg@orig@baselinestretch\endcsname%
+ \renewcommand{\baselinestretch}{\xpg@orig@baselinestretch}%
+ \fi%
+}
\def\inlineextras@tibetan{%
- \xdef\xpg@orig@baselinestretch{\ifcsname baselinestretch\endcsname \baselinestretch \else 1\fi}%
+ \xdef\xpg@orig@baselinestretch{%
+ \ifcsname baselinestretch\endcsname
+ \baselinestretch
+ \else
+ 1%
+ \fi%
+ }%
\renewcommand{\baselinestretch}{1.2}%
\tibetan@eol%
- }
+}
\def\blockextras@tibetan{%
- \xdef\xpg@orig@baselinestretch{\ifcsname baselinestretch\endcsname \baselinestretch \else 1\fi}%
+ \xdef\xpg@orig@baselinestretch{%
+ \ifcsname baselinestretch\endcsname
+ \baselinestretch
+ \else
+ 1%
+ \fi%
+ }%
\renewcommand{\baselinestretch}{1.2}%
\tibetan@eol%
}
@@ -24134,8 +24786,8 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\let\ukrainiannumeral=\ukrainiannumber
\let\Ukrainiannumeral=\Ukrainiannumber
-\def\Asbuk#1{\expandafter\ukranian@asbuk@Alph\csname c@#1\endcsname}
-\def\asbuk#1{\expandafter\ukranian@asbuk@alph\csname c@#1\endcsname}
+\def\Asbuk#1{\expandafter\ukrainian@asbuk@Alph\csname c@#1\endcsname}
+\def\asbuk#1{\expandafter\ukrainian@asbuk@alph\csname c@#1\endcsname}
\def\AsbukTrad#1{\expandafter\cyr@Alph\csname c@#1\endcsname}
\def\asbukTrad#1{\expandafter\cyr@alph\csname c@#1\endcsname}
@@ -24180,12 +24832,12 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages
\def\blockextras@ukrainian{%
\ukrainian@capsformat%
- \ifcyrillic@numerals\ukrainian@numbers\fi%
- \ifukrainian@babelshorthands\ukrainian@shorthands\fi%
+ \ifcyrillic@numerals\ukrainian@numbers\else\noukrainian@numbers\fi%
+ \ifukrainian@babelshorthands\ukrainian@shorthands\else\noukrainian@shorthands\fi%
}
\def\inlineextras@ukrainian{%
- \ifukrainian@babelshorthands\ukrainian@shorthands\fi%
+ \ifukrainian@babelshorthands\ukrainian@shorthands\else\noukrainian@shorthands\fi%
}
%%% stuff from Babel
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-afrikaans.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-afrikaans.ldf
index 6ca384200d9..45a4c6af004 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-afrikaans.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-afrikaans.ldf
@@ -83,11 +83,11 @@
}
\def\blockextras@afrikaans{%
- \ifafrikaans@babelshorthands\afrikaans@shorthands\fi%
+ \ifafrikaans@babelshorthands\afrikaans@shorthands\else\noafrikaans@shorthands\fi%
}
\def\inlineextras@afrikaans{%
- \ifafrikaans@babelshorthands\afrikaans@shorthands\fi%
+ \ifafrikaans@babelshorthands\afrikaans@shorthands\else\noafrikaans@shorthands\fi%
}
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf
index 3ba44837895..41f9b15c8a1 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-arabic.ldf
@@ -156,8 +156,9 @@
\fi%
\fi}}
-
-\newcommand{\arabicnumerals}[2]{\arabicnumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via aeb (BCP).
+\providecommand{\arabicnumerals}[2]{\arabicnumber{#2}}
\def\arabicnumber#1{%
\ifeastern@numerals
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-belarusian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-belarusian.ldf
index 1d1c2f1fd80..1b75e990098 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-belarusian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-belarusian.ldf
@@ -224,8 +224,10 @@
\csuse{datebelarusian@\belarusian@spelling}%
}
-\newcommand{\belarusiannumerals}[2]{\belarusiannumber{#2}}
-\newcommand{\Belarusiannumerals}[2]{\Belarusiannumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via be-tarask (BCP).
+\providecommand{\belarusiannumerals}[2]{\belarusiannumber{#2}}
+\providecommand{\Belarusiannumerals}[2]{\Belarusiannumber{#2}}
\def\belarusiannumber#1{%
\ifcyrillic@numerals
@@ -301,12 +303,12 @@
}
\def\blockextras@belarusian{%
- \ifcyrillic@numerals\belarusian@numbers\fi%
- \ifbelarusian@babelshorthands\belarusian@shorthands\fi%
+ \ifcyrillic@numerals\belarusian@numbers\else\nobelarusian@numbers\fi%
+ \ifbelarusian@babelshorthands\belarusian@shorthands\else\nobelarusian@shorthands\fi%
}
\def\inlineextras@belarusian{%
- \ifbelarusian@babelshorthands\belarusian@shorthands\fi%
+ \ifbelarusian@babelshorthands\belarusian@shorthands\else\nobelarusian@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
index e533f8c439b..9b9eb2a7b54 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-bosnian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-bosnian.ldf
@@ -44,7 +44,7 @@
\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.~}%
+ decembar\fi \space \number\year.}%
}
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-catalan.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-catalan.ldf
index 42c57c6a2b4..7d34312bbe7 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-catalan.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-catalan.ldf
@@ -148,10 +148,10 @@
}
\def\blockextras@catalan{%
- \ifcatalan@babelshorthands\catalan@shorthands\fi%
+ \ifcatalan@babelshorthands\catalan@shorthands\else\nocatalan@shorthands\fi%
}
\def\inlineextras@catalan{%
- \ifcatalan@babelshorthands\catalan@shorthands\fi%
+ \ifcatalan@babelshorthands\catalan@shorthands\else\nocatalan@shorthands\fi%
}
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-croatian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-croatian.ldf
index 54074f0b14f..71a45cb40ad 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-croatian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-croatian.ldf
@@ -18,14 +18,25 @@
\define@boolkey{croatian}[croatian@]{babelshorthands}[true]{}
-\define@boolkey{croatian}[croatian@]{disableligatures}[true]{}
+\define@boolkey{croatian}[croatian@]{disabledigraphs}[true]{}
+
+% Alias kept for backwards compatibility. Please do not remove
+\define@boolkey{croatian}[croatian@]{disableligatures}[true]{%
+ \xpg@warning{The option disableligatures is deprected.\MessageBreak
+ Please use disabledigraphs instead}%
+ \ifcroatian@disableligatures
+ \croatian@disabledigraphstrue
+ \else
+ \croatian@disabledigraphsfalse
+ \fi
+}
\define@boolkey{croatian}[croatian@]{splithyphens}[true]{}
\define@boolkey{croatian}[croatian@]{localalph}[true]{}
% Register default options
-\xpg@initialize@gloss@options{croatian}{babelshorthands=false,disableligatures=false,
+\xpg@initialize@gloss@options{croatian}{babelshorthands=false,disabledigraphs=false,
splithyphens=true,localalph=true}
\ifsystem@babelshorthands
@@ -41,6 +52,14 @@
}{}
\def\croatian@@splhyphen#1{%
+ \def\croatian@sh@tmp{%
+ \if\croatian@sh@next-#1%
+ \else\expandafter\croatian@@@splhyphen{#1}\fi%
+ }%
+ \futurelet\croatian@sh@next\croatian@sh@tmp%
+}
+
+\def\croatian@@@splhyphen#1{%
\ifnum\hyphenchar \font>0%
\kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
\nobreak\hskip\z@%
@@ -70,12 +89,12 @@
\declare@shorthand{croatian}{"'}{”}%
\declare@shorthand{croatian}{"<}{«}%
\declare@shorthand{croatian}{">}{»}%
- \declare@shorthand{croatian}{"D}{\xpg@hr@lig{D}}%
- \declare@shorthand{croatian}{"d}{\xpg@hr@lig{d}}%
- \declare@shorthand{croatian}{"L}{\xpg@hr@lig{L}}%
- \declare@shorthand{croatian}{"l}{\xpg@hr@lig{l}}%
- \declare@shorthand{croatian}{"N}{\xpg@hr@lig{N}}%
- \declare@shorthand{croatian}{"n}{\xpg@hr@lig{n}}%
+ \declare@shorthand{croatian}{"D}{\xpg@hr@digraph{D}}%
+ \declare@shorthand{croatian}{"d}{\xpg@hr@digraph{d}}%
+ \declare@shorthand{croatian}{"L}{\xpg@hr@digraph{L}}%
+ \declare@shorthand{croatian}{"l}{\xpg@hr@digraph{l}}%
+ \declare@shorthand{croatian}{"N}{\xpg@hr@digraph{N}}%
+ \declare@shorthand{croatian}{"n}{\xpg@hr@digraph{n}}%
}
\def\nocroatian@shorthands{%
@@ -108,24 +127,24 @@
\fi%
}
-\newcommand*\hr@charifavailable[2]{%
- \ifcroatian@disableligatures
- \bgroup#2\egroup%
- \else
- \charifavailable{#1}{#2}%
+\newcommand*\hr@charifavailable[3]{%
+ \ifcroatian@disabledigraphs% no notion of digraphs at all
+ \bgroup#3\egroup%
+ \else% digraph...
+ \charifavailable{#1}{#2}% ... either a Unicode original or a mimic of one
\fi%
}
-% Provide croatian ligatures if available in current font
-\def\xpg@hr@lig#1#2{%
+% Provide croatian digraphs if available in current font
+\def\xpg@hr@digraph#1#2{%
\bgroup%
% 1. DŽ, Dž and dž
\ifx#1D%
\ifx#2Z\relax%
- \hr@charifavailable{01C4}{DŽ}%
+ \hr@charifavailable{01C4}{D\nobreak Ž}{DŽ}%
\else%
\ifx#2z\relax
- \hr@charifavailable{01C5}{Dž}%
+ \hr@charifavailable{01C5}{D\nobreak ž}{Dž}%
\else
D#2%
\fi%
@@ -133,7 +152,7 @@
\fi%
\ifx#1d%
\ifx#2z\relax
- \hr@charifavailable{01C6}{dž}%
+ \hr@charifavailable{01C6}{d\nobreak ž}{dž}%
\else
d#2%
\fi%
@@ -141,10 +160,10 @@
% 2. LJ, Lj and lj
\ifx#1L%
\ifx#2J\relax%
- \hr@charifavailable{01C7}{LJ}%
+ \hr@charifavailable{01C7}{L\nobreak J}{LJ}%
\else%
\ifx#2j\relax
- \hr@charifavailable{01C8}{Lj}%
+ \hr@charifavailable{01C8}{L\nobreak j}{Lj}%
\else
L#2%
\fi%
@@ -152,7 +171,7 @@
\fi%
\ifx#1l%
\ifx#2j\relax
- \hr@charifavailable{01C9}{lj}%
+ \hr@charifavailable{01C9}{l\nobreak j}{lj}%
\else
l#2%
\fi%
@@ -160,10 +179,10 @@
% 2. NJ, Nj and nj
\ifx#1N%
\ifx#2J\relax%
- \hr@charifavailable{01CA}{NJ}%
+ \hr@charifavailable{01CA}{N\nobreak J}{NJ}%
\else%
\ifx#2j\relax
- \hr@charifavailable{01CB}{Nj}%
+ \hr@charifavailable{01CB}{N\nobreak j}{Nj}%
\else
N#2%
\fi%
@@ -171,7 +190,7 @@
\fi%
\ifx#1n%
\ifx#2j\relax
- \hr@charifavailable{01CC}{nj}%
+ \hr@charifavailable{01CC}{n\nobreak j}{nj}%
\else
n#2%
\fi%
@@ -184,7 +203,7 @@
\def\refname{Literatura}%
\def\abstractname{Sažetak}%
\def\bibname{Bibliografija}%
- \def\chaptername{Poglav\hr@charifavailable{01C9}{lj}e}%
+ \def\chaptername{Poglav\xpg@hr@digraph{l}{j}e}%
\def\appendixname{Dodatak}%
\def\contentsname{Sadržaj}%
\def\listfigurename{Popis slika}%
@@ -205,9 +224,9 @@
\def\datecroatian{%
\def\today{\number\day.~\ifcase\month\or
- siječ\hr@charifavailable{01CC}{nj}a\or ve\hr@charifavailable{01C9}{lj}ače\or
- ožujka\or trav\hr@charifavailable{01CC}{nj}a\or svib\hr@charifavailable{01CC}{nj}a\or
- lip\hr@charifavailable{01CC}{nj}a\or srp\hr@charifavailable{01CC}{nj}a\or
+ siječ\xpg@hr@digraph{n}{j}a\or ve\xpg@hr@digraph{l}{j}ače\or
+ ožujka\or trav\xpg@hr@digraph{n}{j}a\or svib\xpg@hr@digraph{n}{j}a\or
+ lip\xpg@hr@digraph{n}{j}a\or srp\xpg@hr@digraph{n}{j}a\or
kolovoza\or rujna\or listopada\or studenoga\or prosinca\fi \space \number\year.}%
}
@@ -230,13 +249,13 @@
}
\def\blockextras@croatian{%
- \ifcroatian@babelshorthands\croatian@shorthands\fi%
+ \ifcroatian@babelshorthands\croatian@shorthands\else\nocroatian@shorthands\fi%
\ifcroatian@splithyphens\croatian@hyphens\else\nocroatian@hyphens\fi%
\ifcroatian@localalph\let\alph\croatian@alph\let\Alph\croatian@Alph\fi%
}
\def\inlineextras@croatian{%
- \ifcroatian@babelshorthands\croatian@shorthands\fi%
+ \ifcroatian@babelshorthands\croatian@shorthands\else\nocroatian@shorthands\fi%
\ifcroatian@splithyphens\croatian@hyphens\else\nocroatian@hyphens\fi%
\ifcroatian@localalph\let\alph\croatian@alph\let\Alph\croatian@Alph\fi%
}
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf
index 7246b20dd4e..e4627dbc7dd 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-czech.ldf
@@ -37,7 +37,15 @@
\shorthandoff{"}%
}{}
-\def\cs@@splithyphen#1{%
+\def\czech@@splithyphen#1{%
+ \def\czech@sh@tmp{%
+ \if\czech@sh@next-#1%
+ \else\expandafter\czech@@@splithyphen{#1}\fi%
+ }%
+ \futurelet\czech@sh@next\czech@sh@tmp%
+}
+
+\def\czech@@@splithyphen#1{%
\ifnum\hyphenchar \font>0%
\kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
\nobreak\hskip\z@%
@@ -46,14 +54,14 @@
\fi%
}
-\def\cs@splithyphen{%
- \cs@@splithyphen{-}%
+\def\czech@splithyphen{%
+ \czech@@splithyphen{-}%
}
\def\czech@shorthands{%
\bbl@activate{"}%
\def\language@group{czech}%
- \declare@shorthand{czech}{"=}{\cs@splithyphen}%
+ \declare@shorthand{czech}{"=}{\czech@splithyphen}%
\declare@shorthand{czech}{"`}{„}%
\declare@shorthand{czech}{"'}{“}%
\declare@shorthand{czech}{"<}{«}%
@@ -90,9 +98,9 @@
\else
\XeTeXinterchartokenstate=1
\XeTeXcharclass `\- \czech@hyphen
- \XeTeXinterchartoks \z@ \czech@hyphen = {\cs@@splithyphen}% "-" -> "\cs@@splithyphen-"
+ \XeTeXinterchartoks \z@ \czech@hyphen = {\czech@@splithyphen}% "-" -> "\czech@@splithyphen-"
% necessary if used together with vlna:
- \XeTeXinterchartoks \czech@nonsyllabicpreposition \czech@hyphen = {\cs@@splithyphen}% "-" -> "\cs@@splithyphen-"
+ \XeTeXinterchartoks \czech@nonsyllabicpreposition \czech@hyphen = {\czech@@splithyphen}% "-" -> "\czech@@splithyphen-"
\fi%
}
@@ -224,13 +232,13 @@
}
\def\blockextras@czech{%
- \ifczech@babelshorthands\czech@shorthands\fi%
+ \ifczech@babelshorthands\czech@shorthands\else\noczech@shorthands\fi%
\ifczech@vlna\czech@vlna\else\noczech@vlna\fi%
\ifczech@splithyphens\czech@hyphens\else\noczech@hyphens\fi%
}
\def\inlineextras@czech{%
- \ifczech@babelshorthands\czech@shorthands\fi%
+ \ifczech@babelshorthands\czech@shorthands\else\noczech@shorthands\fi%
\ifczech@vlna\czech@vlna\else\noczech@vlna\fi%
\ifczech@splithyphens\czech@hyphens\else\noczech@hyphens\fi%
}
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf
index 4bc454b4eda..dce1fbf3ced 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-dutch.ldf
@@ -83,11 +83,11 @@
}
\def\blockextras@dutch{%
- \ifdutch@babelshorthands\dutch@shorthands\fi%
+ \ifdutch@babelshorthands\dutch@shorthands\else\nodutch@shorthands\fi%
}
\def\inlineextras@dutch{%
- \ifdutch@babelshorthands\dutch@shorthands\fi%
+ \ifdutch@babelshorthands\dutch@shorthands\else\nodutch@shorthands\fi%
}
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf
index e7830363820..108b4306be8 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf
@@ -9,19 +9,20 @@
}
% BCP-47 compliant aliases
-\setlanguagealias*{english}{en}
-\setlanguagealias*[variant=australian]{english}{en-AU}
-\setlanguagealias*[variant=newzealand]{english}{en-NZ}
-\setlanguagealias*[variant=us]{english}{en-US}
-\setlanguagealias*[variant=british]{english}{en-GB}
-\setlanguagealias*[variant=canadian]{english}{en-CA}
+\setlanguagealias*[bcp47=en]{english}{en}
+\setlanguagealias*[variant=australian,babelname=autralian,bcp47=en-AU]{en}{en-AU}
+\setlanguagealias*[variant=canadian,babelname=canadian,bcp47=en-CA]{en}{en-CA}
+\setlanguagealias*[variant=british,babelname=british,bcp47=en-NZ]{en}{en-GB}
+\setlanguagealias*[variant=newzealand,babelname=newzealand,bcp47=en-NZ]{en}{en-NZ}
+\setlanguagealias*[variant=us,babelname=american,bcp47=en-US]{en}{en-US}
+
% 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}
+\setlanguagealias[variant=us]{en-US}{american}
+\setlanguagealias[variant=australian]{en-AU}{australian}
+\setlanguagealias[variant=british]{en-GB}{british}
+\setlanguagealias[variant=canadian]{en-CA}{canadian}
+\setlanguagealias[variant=newzealand]{en-NZ}{newzealand}
\providebool{british@hyphen}
\providebool{english@ordinalmonthday}
@@ -169,6 +170,7 @@
\def\alsoname{see also}%
\def\proofname{Proof}%
}
+
\def\dateenglish{%
\def\english@day{%
\ifenglish@ordinalmonthday
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-finnish.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-finnish.ldf
index 0537a0386c1..d4f16da891e 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-finnish.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-finnish.ldf
@@ -13,8 +13,10 @@
\define@boolkey{finnish}[finnish@]{babelshorthands}[true]{}
+\define@boolkey{finnish}[finnish@]{schoolhyphens}[true]{}
+
% Register default options
-\xpg@initialize@gloss@options{finnish}{babelshorthands=false}
+\xpg@initialize@gloss@options{finnish}{babelshorthands=false,schoolhyphens=false}
\ifsystem@babelshorthands
\setkeys{finnish}{babelshorthands=true}
@@ -68,6 +70,21 @@
\def\proofname{Todistus}%
\def\glossaryname{Sanasto}%
}
+
+\def\finnish@language{%
+ \iffinnish@schoolhyphens
+ \xpg@ifdefined{schoolfinnish}{%
+ \polyglossia@setup@language@patterns{schoolfinnish}%
+ }{%
+ \xpg@warning{Finnish 'School' hyphenation patterns (schoolfinnish) not available.\MessageBreak
+ I will use the standard patterns for Finnish instead}%
+ \polyglossia@setup@language@patterns{finnish}%
+ }%
+ \else
+ \polyglossia@setup@language@patterns{finnish}%
+ \fi
+}
+
\def\datefinnish{%
\def\today{\number\day.~\ifcase\month\or
tammikuuta\or helmikuuta\or maaliskuuta\or huhtikuuta\or
@@ -80,11 +97,11 @@
}
\def\blockextras@finnish{%
- \iffinnish@babelshorthands\finnish@shorthands\fi%
+ \iffinnish@babelshorthands\finnish@shorthands\else\nofinnish@shorthands\fi%
}
\def\inlineextras@finnish{%
- \iffinnish@babelshorthands\finnish@shorthands\fi%
+ \iffinnish@babelshorthands\finnish@shorthands\else\nofinnish@shorthands\fi%
}
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-georgian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-georgian.ldf
index 7d84e5bad01..329b3b852e0 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-georgian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-georgian.ldf
@@ -221,12 +221,12 @@
}
\def\blockextras@georgian{%
- \ifgeorgian@numerals\georgian@numbers\fi%
- \ifgeorgian@babelshorthands\georgian@shorthands\fi%
+ \ifgeorgian@numerals\georgian@numbers\else\nogeorgian@numbers\fi%
+ \ifgeorgian@babelshorthands\georgian@shorthands\else\nogeorgian@shorthands\fi%
}
\def\inlineextras@georgian{%
- \ifgeorgian@babelshorthands\georgian@shorthands\fi%
+ \ifgeorgian@babelshorthands\georgian@shorthands\else\nogeorgian@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 a26bb7805f8..44a9dcc1fb2 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-german.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-german.ldf
@@ -149,7 +149,7 @@
\xpg@info{Option: German, script=\xpg@val}%
}{\xpg@warning{Unknown German script `#1'}}
-% Option defunc'ed, as bot XeTeX and LuaTeX meanwhile
+% Option defunc'ed, as both XeTeX and LuaTeX meanwhile
% use the experimental German hyphenation patterns by default.
\define@boolkey{german}[german@]{latesthyphen}[true]{}
@@ -158,7 +158,7 @@
\setkeys{german}{spelling,script,variant}
% Register default options
-\xpg@initialize@gloss@options{german}{variant=german,spelling=new,script=latin,latesthyphen=false,babelshorthands=false}
+\xpg@initialize@gloss@options{german}{variant=german,spelling=new,script=latin,babelshorthands=false}
% Register alias options
\xpg@set@alias@values{german}{spelling}{new}{1996}
\xpg@set@alias@values{german}{spelling}{old}{1901}
@@ -314,11 +314,11 @@
}
\def\blockextras@german{%
- \ifgerman@babelshorthands\german@shorthands\fi%
+ \ifgerman@babelshorthands\german@shorthands\else\nogerman@shorthands\fi%
}
\def\inlineextras@german{%
- \ifgerman@babelshorthands\german@shorthands\fi%
+ \ifgerman@babelshorthands\german@shorthands\else\nogerman@shorthands\fi%
}
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf
index 7cb48fdc9e6..d7b77cec08b 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-greek.ldf
@@ -252,8 +252,10 @@
\renewrobustcmd\anw@print{ʹ}}
\anw@true
-\newcommand{\greeknumerals}[2]{\greeknumber{#2}}
-\newcommand{\Greeknumerals}[2]{\Greeknumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via politunikogreek.
+\providecommand{\greeknumerals}[2]{\greeknumber{#2}}
+\providecommand{\Greeknumerals}[2]{\Greeknumber{#2}}
\protected\def\greeknumber#1{\expandafter\@greeknumber\expandafter{\number#1}}
\def\@greeknumber#1{%
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-italian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-italian.ldf
index aea21a2f3fa..eeb7c667208 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-italian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-italian.ldf
@@ -129,12 +129,12 @@
\lccode\string"2019=\string"2019%
\clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000%
\finalhyphendemerits=50000000%
- \ifitalian@babelshorthands\italian@shorthands\fi%
+ \ifitalian@babelshorthands\italian@shorthands\else\noitalian@shorthands\fi%
}
\def\inlineextras@italian{%
\lccode\string"2019=\string"2019%
- \ifitalian@babelshorthands\italian@shorthands\fi%
+ \ifitalian@babelshorthands\italian@shorthands\else\noitalian@shorthands\fi%
}
%%% CHANGES END %%%
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-korean.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-korean.ldf
index 52152d12659..1a81fa193cf 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-korean.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-korean.ldf
@@ -109,16 +109,25 @@
% change chapter and part headings
\if@korean@swapheadings
% With titlesec
- \ifdefined\titleformat
- \ifdefined\@part
- \let\xpg@save@part@format\@part
- \patchcmd{\@part}%
+ \ifcsdef{titleformat}{%
+ \ifcsdef{H@old@part}{% Hyperref
+ \let\xpg@save@part@format\H@old@part
+ \patchcmd{\H@old@part}%
{\partname\nobreakspace\thepart}%
{\koreanTHEname\nobreakspace \thepart\nobreakspace \partname}%
{}%
{\xpg@warning{Failed to patch part for Korean}}%
- \fi
- \ifdefined\chapter
+ }{% not hyperref
+ \ifcsdef{@part}{%
+ \let\xpg@save@part@format\@part
+ \patchcmd{\@part}%
+ {\partname\nobreakspace\thepart}%
+ {\koreanTHEname\nobreakspace \thepart\nobreakspace \partname}%
+ {}%
+ {\xpg@warning{Failed to patch part for Korean}}%
+ }{}%
+ }
+ \ifcsdef{chapter}{%
\titleformat\chapter[display]%
{\@ifundefined{ttl@fil}{\raggedright}{\ttl@fil}\ttl@fonts\ttl@sizes6}%
{%
@@ -128,15 +137,15 @@
\koreanTHEname\space \thechapter\space \@chapapp
\fi
}{.8\baselineskip}{\ttl@sizes\z@\ttl@passexplicit}%
- \fi
- \else % (not \ifdefined\titleformat)
+ }{}%
+ }{% (not \ifdefined\titleformat)
% With KOMA
- \ifdefined\sectionformat
- \ifdefined\partformat
+ \ifcsdef{sectionformat}{%
+ \ifcsdef{partformat}{%
\let\xpg@save@part@format\partformat
\renewcommand*{\partformat}{\koreanTHEname~\thepart~\partname}%
- \fi
- \ifdefined\chapterformat
+ }{}%
+ \ifcsdef{chapterformat}{%
\let\xpg@save@chap@format\chapterformat
\renewcommand*{\chapterformat}{\mbox{%
\IfChapterUsesPrefixLine
@@ -149,11 +158,11 @@
}%
{\thechapter\autodot\enskip}%
}}%
- \fi
- \else % (not \ifdefined\sectionformat)
+ }{}%
+ }{% (not \ifdefined\sectionformat)
% With memoir
- \ifdefined\@memptsize
- \ifdefined\@makechapterhead
+ \ifcsdef{@memptsize}{%
+ \ifcsdef{@makechapterhead}{%
\let\xpg@save@chap@format\@makechapterhead
\patchcmd{\@makechapterhead}%
{\printchaptername \chapternamenum \printchapternum}%
@@ -171,10 +180,10 @@
\ifpatchable\printchaptername\@chapapp
{\chapnamefont\koreanTHEname\chapternamenum}{}}%
\fi
- \fi
- \ifdefined\@part
- \let\xpg@save@part@format\@part
- \patchcmd{\@part}%
+ }{}%
+ \ifcsdef{H@old@part}{% Hyperref
+ \let\xpg@save@part@format\H@old@part
+ \patchcmd{\H@old@part}%
{\printpartname \partnamenum \printpartnum}%
{\printkoreanpartthe \printpartnum\partnamenum \printpartname}%
{}%
@@ -182,10 +191,22 @@
\ifdefined\printkoreanpartthe\else
\def\printkoreanpartthe{\partnamefont\koreanTHEname\partnamenum}%
\fi
- \fi
- \else % (not \ifdefined\@memptsize)
+ }{% not hyperref
+ \ifcsdef{@part}{%
+ \let\xpg@save@part@format\@part
+ \patchcmd{\@part}%
+ {\printpartname \partnamenum \printpartnum}%
+ {\printkoreanpartthe \printpartnum\partnamenum \printpartname}%
+ {}%
+ {\xpg@warning{Failed to patch part for Korean}}%
+ \ifdefined\printkoreanpartthe\else
+ \def\printkoreanpartthe{\partnamefont\koreanTHEname\partnamenum}%
+ \fi
+ }{}%
+ }%
+ }{% (not \ifdefined\@memptsize)
% With standard classes
- \ifdefined\@makechapterhead
+ \ifcsdef{@makechapterhead}{%
\let\xpg@save@chap@format\@makechapterhead
\patchcmd{\@makechapterhead}%
{\@chapapp\space \thechapter}%
@@ -198,23 +219,35 @@
}%
{}%
{\xpg@warning{Failed to patch chapter for Korean}}%
- \fi
- \ifdefined\@part
- \let\xpg@save@part@format\@part
- \patchcmd{\@part}%
+ }{}%
+ \ifcsdef{H@old@part}{% Hyperref
+ \let\xpg@save@part@format\H@old@part
+ \patchcmd{\H@old@part}%
{\partname\nobreakspace\thepart}%
{\koreanTHEname\nobreakspace \thepart\nobreakspace \partname}%
{}%
{\xpg@warning{Failed to patch part for Korean}}%
- \fi % (end \ifdefined\@part)
- \fi % (end \ifdefined\@memptsize)
- \fi % (end \ifdefined\sectionformat)
- \fi % (end \ifdefined\titleformat)
+ }{% not hyperref
+ \ifcsdef{@part}{%
+ \ifpatchable{\@part}%
+ {\partname\nobreakspace\thepart}%
+ {\let\xpg@save@part@format\@part
+ \patchcmd{\@part}%
+ {\partname\nobreakspace\thepart}%
+ {\koreanTHEname\nobreakspace \thepart\nobreakspace \partname}%
+ {}%
+ {\ifcsdef{part}{\xpg@warning{Failed to patch part for Korean}}{}}}%
+ {}%
+ }{}% (end \ifdefined\@part)
+ }% (end not hyperref)
+ }% (end \ifdefined\@memptsize)
+ }% (end \ifdefined\sectionformat)
+ }% (end \ifdefined\titleformat)
\fi % (end \if@korean@swapheadings)
%
% Change running headers
\if@korean@swapheaders
- \ifdefined\chapterformat
+ \ifcsdef{chapterformat}{%
% With KOMA
\let\xpg@save@chaptermark@format\chaptermarkformat
\renewcommand*\chaptermarkformat{%
@@ -229,8 +262,8 @@
{\thechapter\autodot}%
\enskip
}%
- \else % (not \ifdefined\chapterformat)
- \ifdefined\@memptsize
+ }{% (not \ifdefined\chapterformat)
+ \ifcsdef{@memptsize}{%
% With memoir
\let\xpg@save@chaptermark@format\chaptermark
\patchcmd{\chaptermark}%
@@ -243,74 +276,85 @@
\fi
}%
{}%
- {}%
- \else % (not \ifdefined\@memptsize)
+ {\xpg@warning{Failed to patch chaptermark for Korean}}%
+ }{% (not \ifdefined\@memptsize)
% With standard classes
- \ifdefined\chaptermark
- \let\xpg@save@chaptermark@format\chaptermark
- \patchcmd{\chaptermark}%
- {\@chapapp\ \thechapter}%
- {%
- \ifx\@chapapp\korean@appendix@chapapp
- \appendixname\ \thechapter
- \else
- \koreanTHEname\ \thechapter\ \@chapapp
- \fi
- }%
- {}%
- {}%
- \fi % (end \ifdefined\chaptermark)
- \fi % (end \ifdefined\@memptsize)
- \fi % (end \ifdefined\chapterformat)
+ \ifcsdef{chaptermark}{%
+ \ifpatchable{\chaptermark}%
+ {\@chapapp\ \thechapter}%
+ {\let\xpg@save@chaptermark@format\chaptermark
+ \patchcmd{\chaptermark}%
+ {\@chapapp\ \thechapter}%
+ {%
+ \ifx\@chapapp\korean@appendix@chapapp
+ \appendixname\ \thechapter
+ \else
+ \koreanTHEname\ \thechapter\ \@chapapp
+ \fi
+ }%
+ {}%
+ {\xpg@warning{Failed to patch chaptermark for Korean}}}%
+ {}%
+ }{}% (end \ifdefined\chaptermark)
+ }% (end \ifdefined\@memptsize)
+ }% (end \ifdefined\chapterformat)
\fi % (end \if@korean@swapheaders)
}
\def\nokorean@headingsformat{%
% Reset chapter and part heading
- \ifdefined\titleformat
+ \ifcsdef{titleformat}{%
% With titlesec
- \ifdefined\xpg@save@part@format
- \let\@part\xpg@save@part@format
- \fi
- \ifdefined\chapter
+ \ifcsdef{xpg@save@part@format}{%
+ \ifcsdef{H@old@part}{%
+ \let\H@old@part\xpg@save@part@format
+ }{%
+ \let\@part\xpg@save@part@format
+ }%
+ }{}%
+ \ifcsdef{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
+ }{}%
+ }{% (not \ifdefined\titleformat)
+ \ifcsdef{sectionformat}{%
% With KOMA
- \ifdefined\xpg@save@part@format
+ \ifcsdef{xpg@save@part@format}{%
\let\partformat\xpg@save@part@format
- \fi
- \ifdefined\xpg@save@chap@format
+ }{}%
+ \ifcsdef{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
+ \ifcsdef{xpg@save@part@format}{%
+ \ifcsdef{H@old@part}{%
+ \let\H@old@part\xpg@save@part@format
+ }{%
+ \let\@part\xpg@save@part@format
+ }%
+ }{}%
+ \ifcsdef{xpg@save@chap@format}{%
\let\@makechapterhead\xpg@save@chap@format
- \fi
- \fi % (end \ifdefined\sectionformat)
- \fi % (end \ifdefined\titleformat)
+ }{}%
+ }% (end \ifdefined\sectionformat)
+ }% (end \ifdefined\titleformat)
%
% Reset headers
- \ifdefined\chaptermarkformat
+ \ifcsdef{chaptermarkformat}{%
% With KOMA
- \ifdefined\xpg@save@chaptermark@format
+ \ifcsdef{xpg@save@chaptermark@format}{%
\let\chaptermarkformat\xpg@save@chaptermark@format
- \fi
- \else
- \ifdefined\chaptermark
+ }{}%
+ }{%
+ \ifcsdef{chaptermark}{%
% With memoir and standard classes
- \ifdefined\xpg@save@chaptermark@format
+ \ifcsdef{xpg@save@chaptermark@format}{%
\let\chaptermark\xpg@save@chaptermark@format
- \fi
- \fi % (end \ifdefined\chaptermark)
- \fi % (end \ifdefined\chapterformat)
+ }{}%
+ }{}% (end \ifdefined\chaptermark)
+ }% (end \ifdefined\chapterformat)
}
\def\datekorean{%
@@ -519,6 +563,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassID{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern \XPGKOhalfhalf
\or \unkern\unkern \XPGKOquarterquarter
@@ -530,6 +575,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassAA{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern \XPGKOhalfhalf
\or \unkern\unkern \XPGKOquarterquarter
@@ -540,16 +586,16 @@
% macros for interchartoks (CJK punctuations)
\def\XPGKOstartOP#1{\leavevmode
\hbox to.5em\bgroup\hss\XeTeXinterchartokenstate\z@ #1\egroup
- \kern-1sp \kern1sp }
+ \kern-6sp \kern6sp }
\def\XPGKOstartCL#1{\leavevmode
\hbox to.5em\bgroup\XeTeXinterchartokenstate\z@ #1\hss\egroup
- \kern-2sp \kern2sp }
+ \kern-7sp \kern7sp }
\def\XPGKOstartMD#1{\leavevmode
\hbox to.5em\bgroup\hss\XeTeXinterchartokenstate\z@ #1\hss\egroup
- \kern-3sp \kern3sp }
+ \kern-8sp \kern8sp }
\def\XPGKOstartFS#1{\leavevmode
\hbox to.5em\bgroup\XeTeXinterchartokenstate\z@ #1\hss\egroup
- \kern-4sp \kern4sp }
+ \kern-9sp \kern9sp }
\let\XPGKOnobreak \nobreak
\def\XPGKOhalfzero {\hskip \XPGKOhalfdim \relax}%
\def\XPGKOhalfhalf {\hskip \XPGKOhalfdim minus \XPGKOhalfdim \relax}%
@@ -669,6 +715,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassOP{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern \XPGKOhalfhalf
\or \unkern\unkern \XPGKOquarterquarter
@@ -679,6 +726,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XeTeXcharclassCL{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern
\or \unkern\unkern \XPGKOnobreak\XPGKOquarterquarter
@@ -689,6 +737,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassMD{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern \XPGKOnobreak\XPGKOquarterquarter
\or \unkern\unkern \XPGKOnobreak\XPGKOquarterquarter
\or \unkern\unkern \XPGKOnobreak\XPGKOhalfquarter
@@ -699,6 +748,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassFS{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern
\or \unkern\unkern \XPGKOnobreak\XPGKOquarterquarter
@@ -709,6 +759,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassLD{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern \XPGKOnobreak\XPGKOhalfhalf
\or \unkern\unkern \XPGKOnobreak\XPGKOquarterquarter
@@ -719,6 +770,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassEX{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern \XPGKOnobreak\XPGKOhalfhalf
\or \unkern\unkern \XPGKOnobreak\XPGKOquarterquarter
@@ -729,6 +781,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassAO{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern \XPGKOhalfhalf
\or \unkern\unkern \XPGKOquarterquarter
@@ -739,6 +792,7 @@
\XeTeXinterchartoks\XeTeXcharclassBoundary\XPGKOcharclassAC{%
\ifnum\lastnodetype=12 %
\ifcase\lastkern
+ \or \or \or \or \or
\or \unkern\unkern
\or \unkern\unkern \XPGKOnobreak\XPGKOhalfhalf
\or \unkern\unkern \XPGKOnobreak\XPGKOquarterquarter
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf
index 840e0f50f0b..357a349fa83 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-kurdish.ldf
@@ -336,7 +336,9 @@
\csname datekurdish@\kurdish@variant @\kurdish@script\endcsname%
}
-\newcommand{\kurdishnumerals}[2]{\kurdishnumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via BCP.
+\providecommand{\kurdishnumerals}[2]{\kurdishnumber{#2}}
\def\kurdishnumber#1{%
\if@western@numerals
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-latex.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-latex.ldf
deleted file mode 100644
index 2f9e869dd6b..00000000000
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-latex.ldf
+++ /dev/null
@@ -1,33 +0,0 @@
-\ProvidesFile{gloss-latex.ldf}[polyglossia: module for default language]
-
-\PolyglossiaSetup{latex}{
- hyphennames={english},
- hyphenmins={2,3},
- langtag=ENG,
- fontsetup=true,
-}
-
-\def\captionslatex{%
- \def\prefacename{Preface}%
- \def\refname{References}%
- \def\abstractname{Abstract}%
- \def\bibname{Bibliography}%
- \def\chaptername{Chapter}%
- \def\appendixname{Appendix}%
- \def\contentsname{Contents}%
- \def\listfigurename{List of Figures}%
- \def\listtablename{List of Tables}%
- \def\indexname{Index}%
- \def\figurename{Figure}%
- \def\tablename{Table}%
- \def\partname{Part}%
- \def\enclname{encl}%
- \def\ccname{cc}%
- \def\headtoname{To}%
- \def\pagename{Page}%
- \def\seename{see}%
- \def\alsoname{see also}%
- \def\proofname{Proof}%
-}
-
-\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf
index 7fe7690693d..c692b985d04 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-latin.ldf
@@ -1,4 +1,4 @@
-\ProvidesFile{gloss-latin.ldf}[polyglossia: module for Latin v.2.3 2020-03-08]
+\ProvidesFile{gloss-latin.ldf}[polyglossia: module for Latin v.2.4 2021-10-25]
\ExplSyntaxOn
@@ -27,7 +27,7 @@
\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_use_ligatures_bool
\bool_new:N \l_polyglossia_latin_capitalize_month_bool
\cs_new:Npn \polyglossia_latin_classical_character_codes:
@@ -388,7 +388,7 @@
{
\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_false:N \l_polyglossia_latin_use_ligatures_bool
\bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
\bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
\str_set:Nn \l_polyglossia_latin_variant_str {classic}
@@ -400,7 +400,7 @@
{
\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_use_ligatures_bool
\bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
\bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
\str_set:Nn \l_polyglossia_latin_variant_str {medieval}
@@ -412,7 +412,7 @@
{
\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_false:N \l_polyglossia_latin_use_ligatures_bool
\bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
\bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
\str_set:Nn \l_polyglossia_latin_variant_str {modern}
@@ -424,7 +424,7 @@
{
\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_true:N \l_polyglossia_latin_use_ligatures_bool
\bool_set_false:N \l_polyglossia_latin_capitalize_month_bool
\bool_set_true:N \l_polyglossia_latin_punctuation_spacing_bool
\str_set:Nn \l_polyglossia_latin_variant_str {ecclesiastic}
@@ -519,7 +519,7 @@
{
\def \prefacename
{
- \bool_if:NTF \l_polyglossia_latin_use_digraphs_bool {Præfatio} {Praefatio}
+ \bool_if:NTF \l_polyglossia_latin_use_ligatures_bool {Præfatio} {Praefatio}
}
\def \refname {Conspectus~librorum}
\def \abstractname {Summarium}
@@ -545,7 +545,7 @@
\cs_new:Npn \polyglossia_latin_month_name:
{
- \str_set:Nx \l_tmpa_str
+ \tl_set:Nx \l_tmpa_tl
{
\int_case:nn { \month }
{
@@ -565,10 +565,10 @@
}
\bool_if:NTF \l_polyglossia_latin_capitalize_month_bool
{
- \tl_mixed_case:n { \l_tmpa_str }
+ \text_titlecase:n { \l_tmpa_tl }
}
{
- \str_use:N \l_tmpa_str
+ \l_tmpa_tl
}
}
@@ -717,28 +717,28 @@
{
\str_case:nnF {#1}
{
- {A} { \polyglossia_latin_digraph_shorthand:Nnn E { Æ }
+ {A} { \polyglossia_latin_ligature_shorthand:Nnn E { Æ }
{
- \polyglossia_latin_digraph_shorthand:Nnn e { Æ }
+ \polyglossia_latin_ligature_shorthand:Nnn e { Æ }
{
\polyglossia_latin_allow_hyphens: A
}
}
}
- {a} { \polyglossia_latin_digraph_shorthand:Nnn e { æ }
+ {a} { \polyglossia_latin_ligature_shorthand:Nnn e { æ }
{
\polyglossia_latin_allow_hyphens: a
}
}
- {O} { \polyglossia_latin_digraph_shorthand:Nnn E { Π}
+ {O} { \polyglossia_latin_ligature_shorthand:Nnn E { Π}
{
- \polyglossia_latin_digraph_shorthand:Nnn e { Π}
+ \polyglossia_latin_ligature_shorthand:Nnn e { Π}
{
\polyglossia_latin_allow_hyphens: O
}
}
}
- {o} { \polyglossia_latin_digraph_shorthand:Nnn e { œ }
+ {o} { \polyglossia_latin_ligature_shorthand:Nnn e { œ }
{
\polyglossia_latin_allow_hyphens: o
}
@@ -748,23 +748,20 @@
{>} { » }
}
{
- \token_if_letter:NTF #1 { \polyglossia_latin_allow_hyphens: #1 }
+ \tl_if_single_token:nTF {#1}
{
- \token_if_eq_meaning:NNTF #1 \AE { \polyglossia_latin_allow_hyphens: #1 }
+ \token_if_letter:NTF #1 { \polyglossia_latin_allow_hyphens: }
{
- \token_if_eq_meaning:NNTF #1 \ae { \polyglossia_latin_allow_hyphens: #1 }
+ \polyglossia_latin_if_ligature_command:NTF #1 { \polyglossia_latin_allow_hyphens: }
{
- \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
- }
- }
+ \token_to_str:N "
}
}
}
+ {
+ \token_to_str:N "
+ }
+ #1
}
}
@@ -772,22 +769,22 @@
{
\str_case:nnF {#1}
{
- {A} { \polyglossia_latin_digraph_shorthand:Nnn E { Ǽ }
+ {A} { \polyglossia_latin_ligature_shorthand:Nnn E { Ǽ }
{
- \polyglossia_latin_digraph_shorthand:Nnn e { Ǽ } { Á }
+ \polyglossia_latin_ligature_shorthand:Nnn e { Ǽ } { Á }
}
}
- {a} { \polyglossia_latin_digraph_shorthand:Nnn e { ǽ } { á } }
+ {a} { \polyglossia_latin_ligature_shorthand:Nnn e { ǽ } { á } }
{E} { É }
{e} { é }
{I} { Í }
{i} { í }
- {O} { \polyglossia_latin_digraph_shorthand:Nnn E { \'Π}
+ {O} { \polyglossia_latin_ligature_shorthand:Nnn E { \'Π}
{
- \polyglossia_latin_digraph_shorthand:Nnn e { \'Œ } { Ó }
+ \polyglossia_latin_ligature_shorthand:Nnn e { \'Œ } { Ó }
}
}
- {o} { \polyglossia_latin_digraph_shorthand:Nnn e { \'œ } { ó } }
+ {o} { \polyglossia_latin_ligature_shorthand:Nnn e { \'œ } { ó } }
{U} { Ú }
{u} { ú }
{V} { \' V } % V may be a vowel, but lowercase v is never used as a vowel.
@@ -799,20 +796,17 @@
{œ} { \'œ }
}
{
- \token_if_eq_meaning:NNTF #1 \AE { Ǽ }
+ \tl_if_single_token:nTF {#1}
{
- \token_if_eq_meaning:NNTF #1 \ae { ǽ }
+ \polyglossia_latin_if_ligature_command:NTF #1 { \' }
{
- \token_if_eq_meaning:NNTF #1 \OE { \'Π}
- {
- \token_if_eq_meaning:NNTF #1 \oe { \'œ }
- {
- \token_to_str:N '
- #1
- }
- }
+ \token_to_str:N '
}
}
+ {
+ \token_to_str:N '
+ }
+ #1
}
}
@@ -820,9 +814,9 @@
{
\str_case:nnF {#1}
{
- {A} { \polyglossia_latin_diphthong_macron:NNn AE
+ {A} { \polyglossia_latin_ligature_macron:NNnn AE { Ǣ }
{
- \polyglossia_latin_diphthong_macron:NNn Ae
+ \polyglossia_latin_ligature_macron:NNnn Ae { Ǣ }
{
\polyglossia_latin_diphthong_macron:NNn AU
{
@@ -831,7 +825,7 @@
}
}
}
- {a} { \polyglossia_latin_diphthong_macron:NNn ae
+ {a} { \polyglossia_latin_ligature_macron:NNnn ae { ǣ }
{
\polyglossia_latin_diphthong_macron:NNn au { ā }
}
@@ -844,12 +838,12 @@
{e} { \polyglossia_latin_diphthong_macron:NNn eu { ē } }
{I} { Ī }
{i} { ī }
- {O} { \polyglossia_latin_diphthong_macron:NNn OE
+ {O} { \polyglossia_latin_ligature_macron:NNnn OE { \=Π}
{
- \polyglossia_latin_diphthong_macron:NNn Oe { Ō }
+ \polyglossia_latin_ligature_macron:NNnn Oe { \=Œ } { Ō }
}
}
- {o} { \polyglossia_latin_diphthong_macron:NNn oe { ō } }
+ {o} { \polyglossia_latin_ligature_macron:NNnn oe { \=œ } { ō } }
{U} { Ū }
{u} { ū }
{V} { \= V } % V may be a vowel, but lowercase v is never used as a vowel.
@@ -857,7 +851,16 @@
{y} { ȳ }
}
{
- \token_to_str:N =
+ \tl_if_single_token:nTF {#1}
+ {
+ \polyglossia_latin_if_ligature_command:NTF #1 { \= }
+ {
+ \token_to_str:N =
+ }
+ }
+ {
+ \token_to_str:N =
+ }
#1
}
}
@@ -894,12 +897,12 @@
\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
+\cs_new:Npn \polyglossia_latin_ligature_shorthand:Nnn #1#2#3
+% #1: second letter of ligature (E or e)
+% #2: ligature character
+% #3: non-ligature code
{
- \bool_if:NTF \l_polyglossia_latin_use_digraphs_bool
+ \bool_if:NTF \l_polyglossia_latin_use_ligatures_bool
{
\peek_meaning_remove:NTF #1 {#2} {#3}
}
@@ -908,12 +911,60 @@
}
}
+\msg_new:nnn {polyglossia} {latin / no-double-macron-font}
+ {
+ The~combining~double~macron~(U+035E)~is~not~available~in~the~current~
+ font.~The~diphthong~is~typeset~without~macron~ \msg_line_context: .
+ }
+
\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
+ \peek_meaning:NTF #2
+ {
+ #1
+ \iffontchar \font "35E \relax % U+35E: combining double macron
+ \char "35E \relax
+ \else
+ \msg_warning:nn {polyglossia} {latin / no-double-macron-font}
+ \fi
+ }
+ {
+ #3
+ }
+ }
+
+\cs_new:Npn \polyglossia_latin_ligature_macron:NNnn #1#2#3#4
+% #1: first character of diphthong
+% #2: second character of diphthong
+% #3: ligature code
+% #4: false code
+ {
+ \polyglossia_latin_ligature_shorthand:Nnn #2 {#3}
+ {
+ \polyglossia_latin_diphthong_macron:NNn #1 #2 {#4}
+ }
+ }
+
+% The following conditional tests if the argument is a ligature command (\AE,
+% \ae, \OE, or \oe).
+\prg_new_conditional:Npnn \polyglossia_latin_if_ligature_command:N #1 {TF}
+ {
+ \token_if_eq_meaning:NNTF #1 \AE { \prg_return_true: }
+ {
+ \token_if_eq_meaning:NNTF #1 \ae { \prg_return_true: }
+ {
+ \token_if_eq_meaning:NNTF #1 \OE { \prg_return_true: }
+ {
+ \token_if_eq_meaning:NNTF #1 \oe { \prg_return_true: }
+ {
+ \prg_return_false:
+ }
+ }
+ }
+ }
}
\cs_new:Npn \polyglossia_latin_no_shorthands:
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf
index a03227174e5..451894f2c78 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-malay.ldf
@@ -140,8 +140,8 @@
\def\datemalay@indonesian{%
\def\today{\number\day~\ifcase\month\or
- Januari\or Pebruari\or Maret\or April\or Mei\or Juni\or
- Juli\or Agustus\or September\or Oktober\or Nopember\or Desember\fi
+ Januari\or Februari\or Maret\or April\or Mei\or Juni\or
+ Juli\or Agustus\or September\or Oktober\or November\or Desember\fi
\space \number\year}}
\def\datemalay@malay{%
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf
index 5fe17ffd4d0..6be2136acd4 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-mongolian.ldf
@@ -216,12 +216,12 @@
}
\def\blockextras@mongolian{%
- \ifcyrillic@numerals\mongolian@numbers\fi%
- \ifmongolian@babelshorthands\mongolian@shorthands\fi%
+ \ifcyrillic@numerals\mongolian@numbers\else\nomongolian@numbers\fi%
+ \ifmongolian@babelshorthands\mongolian@shorthands\else\nomongolian@shorthands\fi%
}
\def\inlineextras@mongolian{%
- \ifmongolian@babelshorthands\mongolian@shorthands\fi%
+ \ifmongolian@babelshorthands\mongolian@shorthands\else\nomongolian@shorthands\fi%
}
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-occitan.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-occitan.ldf
index 08884434c07..3b15cddd841 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-occitan.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-occitan.ldf
@@ -148,12 +148,12 @@
\lccode\string"2019=\string"2019%
\clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000%
\finalhyphendemerits=50000000%
- \ifoccitan@babelshorthands\occitan@shorthands\fi%
+ \ifoccitan@babelshorthands\occitan@shorthands\else\nooccitan@shorthands\fi%
}
\def\inlineextras@occitan{%
\lccode\string"2019=\string"2019%
- \ifoccitan@babelshorthands\occitan@shorthands\fi%
+ \ifoccitan@babelshorthands\occitan@shorthands\else\nooccitan@shorthands\fi%
}
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-piedmontese.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-piedmontese.ldf
index 61d5d7b1d2d..cf860417546 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-piedmontese.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-piedmontese.ldf
@@ -108,12 +108,12 @@
\lccode\string"2019=\string"2019%
\clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000%
\finalhyphendemerits=50000000%
- \ifpiedmontese@babelshorthands\piedmontese@shorthands\fi%
+ \ifpiedmontese@babelshorthands\piedmontese@shorthands\else\nopiedmontese@shorthands\fi%
}
\def\inlineextras@piedmontese{%
\lccode\string"2019=\string"2019%
- \ifpiedmontese@babelshorthands\piedmontese@shorthands\fi%
+ \ifpiedmontese@babelshorthands\piedmontese@shorthands\else\nopiedmontese@shorthands\fi%
}
%%% CHANGES END %%%
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf
index 048ad1c671c..2e4a9d2d50a 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-portuguese.ldf
@@ -18,6 +18,10 @@
\setlanguagealias[variant=portuguese]{portuguese}{portuges}
\setlanguagealias[variant=brazilian]{portuguese}{brazil}
+\ifluatex
+ \RequirePackage{luavlna}
+\fi
+
\def\portuguese@variant{portuges}
\define@choicekey*+{portuguese}{variant}[\xpg@val\xpg@nr]{portuguese,brazilian}[portuguese]{%
\ifcase\xpg@nr\relax
@@ -34,10 +38,91 @@
\xpg@info{Option: portuguese, variant=\xpg@val}%
}{\xpg@warning{Unknown portuguese variant `#1'}}
+\define@boolkey{portuguese}[portuguese@]{babelshorthands}[true]{}
+
+\define@boolkey{portuguese}[portuguese@]{splithyphens}[true]{}
% Register default options
-\xpg@initialize@gloss@options{portuguese}{variant=portuguese}
+\xpg@initialize@gloss@options{portuguese}{variant=portuguese,
+ babelshorthands=false,
+ splithyphens=true}
+
+\ifsystem@babelshorthands
+ \setkeys{portuguese}{babelshorthands=true}
+\else
+ \setkeys{portuguese}{babelshorthands=false}
+\fi
+
+\ifcsundef{initiate@active@char}{%
+ \input{babelsh.def}%
+ \initiate@active@char{"}%
+ \shorthandoff{"}%
+}{}
+
+\def\portuguese@@splhyphen#1{%
+ \def\portuguese@sh@tmp{%
+ \if\portuguese@sh@next-#1%
+ \else\expandafter\portuguese@@@splhyphen{#1}\fi%
+ }%
+ \futurelet\portuguese@sh@next\portuguese@sh@tmp%
+}
+
+\def\portuguese@@@splhyphen#1{%
+ \ifnum\hyphenchar \font>0%
+ \kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
+ \nobreak\hskip\z@%
+ \else%
+ #1%
+ \fi%
+}
+
+\def\portuguese@splhyphen{%
+ \portuguese@@splhyphen{-}%
+}
+
+\def\portuguese@shorthands{%
+ \bbl@activate{"}%
+ \def\language@group{portuguese}%
+ \declare@shorthand{portuguese}{"=}{\portuguese@splhyphen}%
+ \declare@shorthand{portuguese}{""}{\hskip\z@skip}%
+ \declare@shorthand{portuguese}{"~}{\textormath{\leavevmode\hbox{-}}{-}}%
+ \declare@shorthand{portuguese}{"-}{\nobreak\-\bbl@allowhyphens}%
+ \declare@shorthand{portuguese}{"|}{%
+ \textormath{\penalty\@M\discretionary{-}{}{\kern.03em}%
+ \bbl@allowhyphens}{}%
+ }%
+ \declare@shorthand{portuguese}{"/}{\textormath
+ {\bbl@allowhyphens\discretionary{/}{}{/}\bbl@allowhyphens}{}}%
+ \declare@shorthand{portuguese}{"<}{«}%
+ \declare@shorthand{portuguese}{">}{»}%
+}
+\def\noportuguese@shorthands{%
+ \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
+}
+
+\ifxetex
+ % splithyphens
+ \newXeTeXintercharclass\portuguese@hyphen % -
+\fi
+
+\def\portuguese@hyphens{%
+ \ifluatex
+ \AfterPreamble{\enablesplithyphens{portuguese}}%
+ \else
+ \XeTeXinterchartokenstate=1
+ \XeTeXcharclass `\- \portuguese@hyphen
+ \XeTeXinterchartoks \z@ \portuguese@hyphen = {\portuguese@@splhyphen}% "-" -> "\portuguese@@splhyphen-"
+ \fi%
+}
+
+\def\noportuguese@hyphens{%
+ \ifluatex
+ \AfterPreamble{\disablesplithyphens{portuguese}}%
+ \else
+ \XeTeXcharclass `\- \z@
+ \fi%
+}
\def\portuguese@language{%
\polyglossia@setup@language@patterns{\portuguese@variant}%
@@ -113,5 +198,20 @@
\def\dateportuguese{%
\csname dateportuguese@\portuguese@variant\endcsname%
}
+
+\def\noextras@portuguese{%
+ \ifportuguese@babelshorthands\noportuguese@shorthands\fi%
+ \noportuguese@hyphens%
+}
+
+\def\blockextras@portuguese{%
+ \ifportuguese@babelshorthands\portuguese@shorthands\else\noportuguese@shorthands\fi%
+ \ifportuguese@splithyphens\portuguese@hyphens\else\noportuguese@hyphens\fi%
+}
+
+\def\inlineextras@portuguese{%
+ \ifportuguese@babelshorthands\portuguese@shorthands\else\noportuguese@shorthands\fi%
+ \ifportuguese@splithyphens\portuguese@hyphens\else\noportuguese@hyphens\fi%
+}
\endinput
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf
index 5579317a125..1d9ed82df99 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-russian.ldf
@@ -348,12 +348,12 @@
\def\blockextras@russian{%
\russian@capsformat%
- \ifcyrillic@numerals\russian@numbers\fi%
- \ifrussian@babelshorthands\russian@shorthands\fi%
+ \ifcyrillic@numerals\russian@numbers\else\norussian@numbers\fi%
+ \ifrussian@babelshorthands\russian@shorthands\else\norussian@shorthands\fi%
}
\def\inlineextras@russian{%
- \ifrussian@babelshorthands\russian@shorthands\fi%
+ \ifrussian@babelshorthands\russian@shorthands\else\norussian@shorthands\fi%
}
%%% These lines taken from russianb.ldf, part of babel package.
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf
index 2e940d9556f..7d80c75bae8 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-sanskrit.ldf
@@ -71,8 +71,9 @@
% Register default options
\xpg@initialize@gloss@options{sanskrit}{script=Devanagari,numerals=Devanagari}
-
-\newcommand{\sanskritnumerals}[2]{\sanskritnumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via BCP.
+\providecommand{\sanskritnumerals}[2]{\sanskritnumber{#2}}
\def\sanskritnumber#1{%
\ifsanskrit@devanagari@numerals
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf
index a302431ed13..480c44e817c 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-serbian.ldf
@@ -11,7 +11,8 @@
langtag=SRB,
hyphennames={serbian},
hyphenmins={2,2},
- indentfirst=true,
+ frenchspacing=true, % Правопис српскога језика, Матица српска, 2010. (измењено и допуњено, четврто издање): т. 188, под Обликовање ступца и пасуса
+ indentfirst=true, % Правопис српскога језика, Матица српска, 2010. (измењено и допуњено, четврто издање): т. 188, под Обликовање ступца и пасуса
fontsetup=false,
localnumeral=serbiannumerals,
Localnumeral=Serbiannumerals,
@@ -27,6 +28,10 @@
% Babel aliases
\setlanguagealias[script=Cyrillic]{serbian}{serbianc}
+\ifluatex
+ \RequirePackage{luavlna}
+\fi
+
\newif\if@serbian@cyr
\define@choicekey*+{serbian}{Script}[\xpg@val\xpg@nr]{cyrillic,latin}[cyrillic]{%
\ifcase\xpg@nr\relax
@@ -70,10 +75,12 @@
\xpg@info{Option: Serbian, numerals=\xpg@val}%
}{\xpg@warning{Unknown Serbian numerals value `#1'}}
+\define@boolkey{serbian}[serbian@]{splithyphens}[true]{}
+
\setkeys{serbian}{Script,numerals}
% Register default options
-\xpg@initialize@gloss@options{serbian}{script=Cyrillic,numerals=arabic}
+\xpg@initialize@gloss@options{serbian}{script=Cyrillic,numerals=arabic,splithyphens=true}
\def\captionsserbian{%
\if@serbian@cyr\captionsserbian@cyr\else\captionsserbian@lat\fi
@@ -154,9 +161,10 @@
децембар\fi \space \number\year.}%
}
-
-\newcommand{\serbiannumerals}[2]{\serbiannumber{#2}}
-\newcommand{\Serbiannumerals}[2]{\Serbiannumber{#2}}
+% Use \providecommand here as the ldf file might
+% be reloaded via serbianc.
+\providecommand{\serbiannumerals}[2]{\serbiannumber{#2}}
+\providecommand{\Serbiannumerals}[2]{\Serbiannumber{#2}}
\def\serbiannumber#1{%
\ifcyrillic@numerals
@@ -201,12 +209,65 @@
\let\@Alph\latin@Alph
}
+\def\serbian@@splhyphen#1{%
+ \def\serbian@sh@tmp{%
+ \if\serbian@sh@next-#1%
+ \else\expandafter\serbian@@@splhyphen{#1}\fi%
+ }%
+ \futurelet\serbian@sh@next\serbian@sh@tmp%
+}
+
+\def\serbian@@@splhyphen#1{%
+ \ifnum\hyphenchar \font>0%
+ \kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
+ \nobreak\hskip\z@%
+ \else%
+ #1%
+ \fi%
+}
+
+\def\serbian@splhyphen{%
+ \serbian@@splhyphen{-}%
+}
+
+\ifxetex
+ % splithyphens
+ \newXeTeXintercharclass\serbian@hyphen % -
+ \newXeTeXintercharclass\serbian@nonsyllabicpreposition%
+\fi
+
+\def\serbian@hyphens{%
+ \ifluatex
+ \AfterPreamble{\enablesplithyphens{serbian}}%
+ \else
+ \XeTeXinterchartokenstate=1
+ \XeTeXcharclass `\- \serbian@hyphen
+ \XeTeXinterchartoks \z@ \serbian@hyphen = {\serbian@@splhyphen}% "-" -> "\serbian@@splhyphen-"
+ % necessary if used together with vlna:
+ \XeTeXinterchartoks \serbian@nonsyllabicpreposition \serbian@hyphen = {\serbian@@splhyphen}% "-" -> "\serbian@@splhyphen-"
+ \fi%
+}
+
+\def\noserbian@hyphens{%
+ \ifluatex
+ \AfterPreamble{\disablesplithyphens{serbian}}%
+ \else
+ \XeTeXcharclass `\- \z@
+ \fi%
+}
+
\def\blockextras@serbian{%
- \ifcyrillic@numerals\serbian@numbers\fi
+ \ifcyrillic@numerals\serbian@numbers\else\noserbian@numbers\fi%
+ \ifserbian@splithyphens\serbian@hyphens\else\noserbian@hyphens\fi%
+}
+
+\def\inlineextras@serbian{%
+ \ifserbian@splithyphens\serbian@hyphens\else\noserbian@hyphens\fi%
}
\def\noextras@serbian{%
- \ifcyrillic@numerals\noserbian@numbers\fi
+ \ifcyrillic@numerals\noserbian@numbers\fi%
+ \noserbian@hyphens%
}
\def\Asbuk#1{\expandafter\serbian@asbuk@Alph\csname c@#1\endcsname}
@@ -215,21 +276,21 @@
\def\AsbukTrad#1{\expandafter\cyr@Alph\csname c@#1\endcsname}
\def\asbukTrad#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.
+% This is a poor man's cyrillic alphanumeric.
+% It just uses the alphabet and thus ends at 30.
\def\serbian@asbuk@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 Я%
+ А\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 Џ\or Ш%
\else\xpg@ill@value{#1}{serbian@asbuk@Alph}\fi%
}
\def\serbian@asbuk@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 я%
+ а\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 џ\or ш%
\else\xpg@ill@value{#1}{serbian@asbuk@alph}\fi%
}
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf
index c64a408b9b4..67c0185974a 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-slovak.ldf
@@ -37,6 +37,14 @@
}{}
\def\slovak@@splhyphen#1{%
+ \def\slovak@sh@tmp{%
+ \if\slovak@sh@next-#1%
+ \else\expandafter\slovak@@@splhyphen{#1}\fi%
+ }%
+ \futurelet\slovak@sh@next\slovak@sh@tmp%
+}
+
+\def\slovak@@@splhyphen#1{%
\ifnum\hyphenchar \font>0%
\kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
\nobreak\hskip\z@%
@@ -232,13 +240,13 @@
}
\def\blockextras@slovak{%
- \ifslovak@babelshorthands\slovak@shorthands\fi%
+ \ifslovak@babelshorthands\slovak@shorthands\else\noslovak@shorthands\fi%
\ifslovak@vlna\slovak@vlna\else\noslovak@vlna\fi%
\ifslovak@splithyphens\slovak@hyphens\else\noslovak@hyphens\fi%
}
\def\inlineextras@slovak{%
- \ifslovak@babelshorthands\slovak@shorthands\fi%
+ \ifslovak@babelshorthands\slovak@shorthands\else\noslovak@shorthands\fi%
\ifslovak@vlna\slovak@vlna\else\noslovak@vlna\fi%
\ifslovak@splithyphens\slovak@hyphens\else\noslovak@hyphens\fi%
}
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf
index 3a4cb2f08ac..c78fec6f497 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-spanish.ldf
@@ -158,7 +158,9 @@
\let\tgh\relax%
}
-\newcommand*\spanishoperator[2][]{%
+% Use \providecommand here as the ldf file might
+% be reloaded via babel aliases.
+\providecommand*\spanishoperator[2][]{%
\ifx#1\\\\
\protected@csxdef{#2}{\mathop{\operator@font #2}\nolimits}%
\else
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-tibetan.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-tibetan.ldf
index a33c829ab3f..ef6f4260e55 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-tibetan.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-tibetan.ldf
@@ -23,8 +23,10 @@
\def\tmp@tibetan{tibetan}
\define@key{tibetan}{numerals}[tibetan]{%
\def\@tmpa{#1}%
- \ifx\@tmpa\tmp@tibetan\@tibetan@numeralstrue\else
- \@tibetan@numeralsfalse\fi
+ \ifx\@tmpa\tmp@tibetan\@tibetan@numeralstrue%
+ \else
+ \@tibetan@numeralsfalse%
+ \fi%
}
\ifluatex
@@ -33,23 +35,23 @@
\fi
\def\tibetan@eol{%
- \ifluatex %
- \xpg@tibteol=1\relax %
+ \ifluatex%
+ \xpg@tibteol=1\relax%
\directlua{polyglossia.activate_tibt_eol()}%
- \else %
+ \else%
\XeTeXlinebreaklocale "bo"%
\XeTeXlinebreakskip=0pt plus 0.1em% doesn't do much, but doesn't harm I guess...
- \fi %
+ \fi%
}
\def\notibetan@eol{%
- \ifluatex %
- \xpg@tibteol=0\relax %
+ \ifluatex%
+ \xpg@tibteol=0\relax%
%\directlua{polyglossia.activate_tibt_eol()}%
- \else %
+ \else%
\XeTeXlinebreaklocale "en"% en? really?
\XeTeXlinebreakskip=0pt plus 0pt%
- \fi %
+ \fi%
}
% Register default options
@@ -82,6 +84,7 @@
\def\proofname{བདེན་དཔང་།}% not sure about this one...
\def\glossaryname{མིང་ཚིག་རེའུ་མིག།}%
}
+
\def\datetibetan{%
\def\tibetan@month{%
\ifcase\month\or
@@ -106,6 +109,7 @@
}
\def\tibetandigits#1{\expandafter\@tibetan@digits #1@}
+
\def\@tibetan@digits#1{%
\ifx @#1% then terminate
\else
@@ -124,14 +128,28 @@
\fi}
\def\@tibetanalph#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 ས\or ཧ\or ཨ
- \else\xpg@ill@value{#1}{@tibetanalph}\fi}
-\def\tibetanAlph#1{\expandafter\@tibetanAlph\csname c@#1\endcsname}
+ \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 ས\or ཧ\or ཨ
+ \else%
+ \xpg@ill@value{#1}{@tibetanalph}%
+ \fi%
+}
+
+\def\tibetanAlph#1{%
+ \expandafter\@tibetanAlph\csname c@#1\endcsname%
+}
+
\def\@tibetanAlph#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 ས\or ཧ\or ཨ
- \else\xpg@ill@value{#1}{@tibetanalph}\fi}
+ \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
+ ས\or ཧ\or ཨ%
+ \else%
+ \xpg@ill@value{#1}{@tibetanalph}%
+ \fi%
+}
\newcommand{\tibetanumerals}[2]{\tibetannumber{#2}}
@@ -141,13 +159,16 @@
\let\@Alph\@tibetanAlph%
\fi
}
+
\def\notibetan@numbers{%
\let\@alph\latin@alph%
\let\@Alph\latin@Alph%
}
+% Store original definition
+\let\xpg@orig@arabic\@arabic
+
\def\tibetan@globalnumbers{%
- \let\xpg@orig@arabic\@arabic%
\let\@arabic\tibetannumber%
\renewcommand{\thefootnote}{\localnumeral*{footnote}}%
}
@@ -158,17 +179,31 @@
\def\noextras@tibetan{%
\notibetan@eol%
- \ifcsname xpg@orig@baselinestretch\endcsname\renewcommand{\baselinestretch}{\xpg@orig@baselinestretch}\fi %
- }
+ \ifcsname xpg@orig@baselinestretch\endcsname%
+ \renewcommand{\baselinestretch}{\xpg@orig@baselinestretch}%
+ \fi%
+}
\def\inlineextras@tibetan{%
- \xdef\xpg@orig@baselinestretch{\ifcsname baselinestretch\endcsname \baselinestretch \else 1\fi}%
+ \xdef\xpg@orig@baselinestretch{%
+ \ifcsname baselinestretch\endcsname
+ \baselinestretch
+ \else
+ 1%
+ \fi%
+ }%
\renewcommand{\baselinestretch}{1.2}%
\tibetan@eol%
- }
+}
\def\blockextras@tibetan{%
- \xdef\xpg@orig@baselinestretch{\ifcsname baselinestretch\endcsname \baselinestretch \else 1\fi}%
+ \xdef\xpg@orig@baselinestretch{%
+ \ifcsname baselinestretch\endcsname
+ \baselinestretch
+ \else
+ 1%
+ \fi%
+ }%
\renewcommand{\baselinestretch}{1.2}%
\tibetan@eol%
}
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf
index e9f00844289..3a8ab54aba6 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-ukrainian.ldf
@@ -201,8 +201,8 @@
\let\ukrainiannumeral=\ukrainiannumber
\let\Ukrainiannumeral=\Ukrainiannumber
-\def\Asbuk#1{\expandafter\ukranian@asbuk@Alph\csname c@#1\endcsname}
-\def\asbuk#1{\expandafter\ukranian@asbuk@alph\csname c@#1\endcsname}
+\def\Asbuk#1{\expandafter\ukrainian@asbuk@Alph\csname c@#1\endcsname}
+\def\asbuk#1{\expandafter\ukrainian@asbuk@alph\csname c@#1\endcsname}
\def\AsbukTrad#1{\expandafter\cyr@Alph\csname c@#1\endcsname}
\def\asbukTrad#1{\expandafter\cyr@alph\csname c@#1\endcsname}
@@ -247,12 +247,12 @@
\def\blockextras@ukrainian{%
\ukrainian@capsformat%
- \ifcyrillic@numerals\ukrainian@numbers\fi%
- \ifukrainian@babelshorthands\ukrainian@shorthands\fi%
+ \ifcyrillic@numerals\ukrainian@numbers\else\noukrainian@numbers\fi%
+ \ifukrainian@babelshorthands\ukrainian@shorthands\else\noukrainian@shorthands\fi%
}
\def\inlineextras@ukrainian{%
- \ifukrainian@babelshorthands\ukrainian@shorthands\fi%
+ \ifukrainian@babelshorthands\ukrainian@shorthands\else\noukrainian@shorthands\fi%
}
%%% stuff from Babel
diff --git a/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty b/Master/texmf-dist/tex/latex/polyglossia/polyglossia.sty
index 9c6ac0c1bc1..87196b182f5 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}[2021/04/12 v1.53
+\ProvidesPackage{polyglossia}[2022/03/27 v1.54
Modern multilingual typesetting with XeLaTeX and LuaLaTeX]
\RequirePackage{etoolbox}
\RequirePackage{makecmds}
@@ -16,27 +16,45 @@
% Execute code #3 if package #1 has been loaded already, else
% add to package hook #2
-\newcommand\xpg@at@package[3]{%
- \@ifpackageloaded{#1}{#3}{\AddToHook{#2}{#3}}%
-}
-
+\cs_new_nopar:Nn \__xpg_at_package_hook:nnn{
+ \@ifpackageloaded{#1}{#3}{\AddToHook{#2}{#3}}%
+}
+
+% safe according to expl3 bug #960
+\cs_generate_variant:Nn \prop_item:Nn { Ne, Nf, No, Nx }
+\cs_generate_variant:Nn \clist_set:Nn { Ne, Nf, No, Nx }
+\cs_generate_variant:Nn \clist_gput_right:Nn {Ne}
+\cs_generate_variant:Nn \prop_get:NnN {NeN}
+\cs_generate_variant:Nn \prop_gput:Nnn {Nne, Nee, Nen}
+\cs_generate_variant:Nn \cs_gset:Npn {Npe}
+\cs_generate_variant:Nn \cs_new:Nn {Ne}
+\cs_generate_variant:Nn \cs_new_nopar:Nn {Ne}
+\cs_generate_variant:Nn \cs_gset_nopar:Npn {Npe}
+\cs_generate_variant:Nn \cs_gset_nopar:Npn {cpe}
+\cs_generate_variant:Nn \tl_set:Nn {Ne}
+\cs_generate_variant:Nn \str_foldcase:n {e}
+\prg_generate_conditional_variant:Nnn \file_if_exist:n {e} {TF, T, F, p}
+\prg_generate_conditional_variant:Nnn \tl_if_blank:n {e} {TF, T, F, p}
+\prg_generate_conditional_variant:Nnn \clist_if_in:Nn {Ne} {TF, T, F, p}
+\prg_generate_conditional_variant:Nnn \prop_if_in:Nn {Ne} {TF, T, F, p}
% correct a bug in tracklang
-\xpg@at@package{tracklang}{file/after/tracklang.sty}{%
+\__xpg_at_package_hook:nnn{tracklang}{file/tracklang.sty/after}{%
\@ifpackagelater{tracklang}{2019/08/30}{}{\global\def\AddTrackedLangage{\AddTrackedLanguage}}
}
-
%% This is for compatibility with Babel-aware package:
\def\languageshorthands#1{\relax} %this is for scrlttr2 class
\def\bbl@cs#1{\csname bbl@#1\endcsname}%
\AtEndPreamble{\let\bbl@set@language\xpg@set@language@aux} %for biblatex
\AtEndPreamble{\let\bbl@main@language\xpg@main@language} %for biblatex
-\providecommand\texorpdfstring[2]{#1}% dummy command if hyperref is not loaded
+\AtEndPreamble{
+ \providecommand\texorpdfstring[2]{#1}% dummy command if hyperref is not loaded
+}
-\ifluatex
+\sys_if_engine_luatex:T{
\RequirePackage{luatexbase} % already included by fontspec, but needed here
\RequireLuaModule{polyglossia}
-\fi
+}
% Which version of XeTeX do we use? What is the boudary class? 4095 or 255
\@ifundefined{e@alloc@intercharclass@top}
@@ -44,10 +62,16 @@
{\let\xpg@boundaryclass=\e@alloc@intercharclass@top}
% Useful for getting list of loaded languages and variants. Like babel's bbl@loaded
-\let\xpg@loaded\@empty% list of loaded languages (polyglossia name)
-\let\xpg@vloaded\@empty% list of loaded variants
-\let\xpg@bloaded\@empty% list of loaded languages (babel name)
-\let\xpg@bcp@loaded\@empty% list of loaded languages (bcp-47 id)
+% all language loaded
+\seq_new:N \__xpg_langs_loaded
+% list of loaded languages (polyglossia name)
+\clist_new:N \xpg@loaded
+% list of loaded variants
+\clist_new:N \xpg@vloaded
+% list of loaded languages (babel name)
+\clist_new:N \xpg@bloaded
+% list of loaded languages (bcp-47 id)
+\clist_new:N \xpg@bcp@loaded
% counter in latin
\def\latinalph#1{\expandafter\latin@alph\csname c@#1\endcsname}
@@ -117,25 +141,37 @@
% error out if lang is not loaded
\cs_new_nopar:Nn \polyglossia@error@iflangnotloaded:n
{
- \cs_if_exist:cF{#1@loaded}
+ \seq_if_in:NxF \__xpg_langs_loaded {#1}
{
\xpg@error{language~ #1~ is~ not~ loaded.~ Please~ load~ it~ before~ using~ it.}
}
}
+\msg_new:nnn { polyglossia } { languagenotloaded }
+{
+ The~ language~ #1~ is~ not~ loaded.~ You~ should~ load~ it.
+}
+\msg_redirect_name:nnn { polyglossia } { languagenotloaded } { critical }
-% error do not use directly the gloss file
-\msg_new:nnn { polyglossia } { directloadgloss }
+\cs_new_nopar:Nn \__xpg_msg_if_lang_not_loaded:n
{
- You~ should~ not~ load~ directly~ the~ gloss~ file~ using~ `\string\usepackage'.
- You~ must~ use~ `\string\setotherlanguage\{#1\}' or `\string\setmainlanguage\{#1\}'.
+ \tl_if_blank:eT {\xpg_alias_base_lang:n{#1}}
+ {
+ \msg_show:nnn { polyglossia } { languagenotloaded } {#1}
+ }
}
-\msg_redirect_name:nnn { polyglossia } { directloadgloss } { critical }
+%
%% use macro if defined, else warn that it is not
-\def\csuse@warn#1{%
- \ifcsundef{#1}{\xpg@warning{ \expandafter\string\csname #1\endcsname\space is~ not~ defined}}%
- {\csname #1\endcsname}}
+\cs_new_nopar:Nn \__xpg_use_or_warn:N
+{
+ \cs_if_exist_use:NF {#1}
+ {
+ \xpg@warning { \tl_to_str:N {#1} ~ is~ not~ defined }
+ }
+}
+\cs_generate_variant:Nn \__xpg_use_or_warn:N {c}
+
%% ensure directionality if bidi is loaded, else ignore
\def\@@ensure@dir#1{\ifcsundef{@ensure@dir}{#1}{\@ensure@dir{#1}}}
@@ -153,66 +189,94 @@
}
}
+% if #1 is LR run #2 else #3
+\prg_set_conditional:Nnn \__xpg_if_LR_str:n {p, T, F, TF}
+{
+ \str_case_e:nnF{#1}{
+ {LR}{\prg_return_true:}
+ {RL}{\prg_return_false:}
+ }
+ {
+ \xpg@error{Unknown~ direction~#1}
+ \prg_return_false:
+ }
+}
+\prg_generate_conditional_variant:Nnn \__xpg_if_LR_str:n {e} {p, T, F, TF}
+
% (lua)bidi commands to change directionality for paragraphs
% and inline text.
% overwritten with correct package
\cs_new_nopar:Nn{\polyglossia@setpardirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\relax}%
- {RL}{\xpg@error{right-to-left,~ but~ (lua)bidi~ package~ was~ not~ loaded!}}%
- }%
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(base~ wrapper)}}%
+ \__xpg_if_LR_str:nF {#1}
+ {
+ \xpg@error{right-to-left,~ but~ (lua)bidi~ package~ was~ not~ loaded!}
+ }
}
\cs_new_nopar:Nn{\polyglossia@settextdirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\relax}%
- {RL}{\xpg@error{right-to-left,~ but~ (lua)bidi~ package~ was~ not~ loaded!}}%
- }%
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(base~ wrapper)}}%
+ \__xpg_if_LR_str:nF {#1}
+ {
+ \xpg@error{right-to-left,~ but~ (lua)bidi~ package~ was~ not~ loaded!}
+ }
}
-\xpg@at@package{bidi}{package/after/bidi}{%
+\__xpg_at_package_hook:nnn{bidi}{package/bidi/after}{%
\ExplSyntaxOn%
\cs_gset_nopar:Nn{\polyglossia@setpardirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\setLR}%
- {RL}{\setRL}%
- }%
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(bidi~ wrapper)}}%
+ \__xpg_if_LR_str:nTF{#1}%
+ {%
+ \setLR%
+ }%
+ {%
+ \setRL%
+ }%
}%
\cs_gset_nopar:Nn{\polyglossia@settextdirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\LRE}%
- {RL}{\RLE}%
- }%
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(bidi~ wrapper)}}%
+ \__xpg_if_LR_str:nTF{#1}%
+ {%
+ \LRE%
+ }%
+ {%
+ \RLE%
+ }%
}%
\ExplSyntaxOff%
}
-\xpg@at@package{luabidi}{package/after/luabidi}{%
+\__xpg_at_package_hook:nnn{luabidi}{package/luabidi/after}{%
\ExplSyntaxOn%
\cs_gset_nopar:Nn{\polyglossia@setpardirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\setLR}%
- {RL}{\setRL}%
- }
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(luabidi~ wrapper)}}%
+ \__xpg_if_LR_str:nTF{#1}%
+ {%
+ \setLR%
+ }%
+ {%
+ \setRL%
+ }%
}%
\cs_gset_nopar:Nn{\polyglossia@settextdirection:n}{%
- \str_case_e:nnTF{#1}{%
- {LR}{\LRE}%
- {RL}{\RLE}%
- }
- {}%
- {\xpg@error{Unknown~ language~ direction~ #1 ~(luabidi~ wrapper)}}%
+ \__xpg_if_LR_str:nTF{#1}%
+ {%
+ \LRE%
+ }%
+ {%
+ \RLE%
+ }%
}%
\ExplSyntaxOff%
}
+% emulate \RTLmain
+\cs_new_nopar:Nn \__xpg_setRTLmain: {}
+\str_case_e:nnF{\c_sys_engine_str}{%
+ {luatex}{\cs_gset:Nn \__xpg_setRTLmain: {\setRTLmain}}
+ {xetex}{\cs_gset:Nn \__xpg_setRTLmain: {\@RTLmaintrue\setnonlatin}}
+}
+{
+ \cs_gset:Nn \__xpg_setRTLmain:
+ {
+ \xpg@warning{You’re~ running a~ TeX~ engine~ that~ is~ not~ LuaTeX~ or~ XeTeX.\MessageBreak
+ That~ is~ almost~ guaranteed~ to~ cause~ problems.}
+ }
+}
+
%% compatibility with babel
\let\addto\gappto% gappto is defined in etoolbox
@@ -248,6 +312,8 @@
%% TODO? \toggletrue{#1@setup@done}%
% reinit \do
\def\do##1{\setotherlanguage{##1}}%
+ % register base alias
+ \xpg_language_alias { #1 } { #1 }
}
% Adjust language key setting after initial setup
@@ -260,14 +326,14 @@
% setup hyphennames from a str list of hyphen
\cs_new:Nn \polyglossia_setup_hyphen:n {
- \exp_args:Nne \clist_set:Nn{\l_tmpa_clist}{\prop_item:Nn \polyglossia@langsetup {#1 / hyphennames}}
+ \clist_set:Ne{\l_tmpa_clist}{\prop_item:Nn \polyglossia@langsetup {#1 / hyphennames}}
\providebool{havehyphen}
\boolfalse{havehyphen}
% for each hyphen in the set until we find one that works
\clist_map_inline:Nn \l_tmpa_clist {
\ifbool{havehyphen}{}{%
% check if language hyphenname is defined
- \polyglossia@check@ifdefined:NF{#1}{%
+ \__xpg_check_if_exist_l@:NF{#1}{%
% if not, first consider nohyphenation
\str_if_eq:nnTF{##1}{nohyphenation}
{%
@@ -284,7 +350,7 @@
\xpg@set@hyphenation@patterns{##1}
\global\booltrue{havehyphen}
}%
- }{}%
+ }{}%
}%
}%
}%
@@ -303,7 +369,7 @@
\polyglossia@setup@language@patterns{#1}%
}%
% setup hyphenmins
- \exp_args:NNe \clist_set:Nn \l_tmpa_clist
+ \clist_set:Ne \l_tmpa_clist
{ \prop_item:Nn \polyglossia@langsetup {#1 / hyphenmins} }
\cs_if_eq:cNF {l@#1} \l@nohyphenation
{
@@ -509,7 +575,14 @@
\prop_gput:Nnn{\polyglossia@langsetup}{#1/Localnumeral}{##1}
},
#1 / Localnumeral.value_required:n = true,
- #1 / Localnumeral.initial:n = {polyglossia@C@localnumeral}
+ #1 / Localnumeral.initial:n = {polyglossia@C@localnumeral},
+ % environment define command (by default create the environment)
+ #1 / DefineCommandsCmd
+ .code:n = {\prop_gput:Nnn{\polyglossia@langsetup}{#1/DefineCommandsCmd}{##1}},
+ #1 / DefineCommandsCmd
+ .value_required:n = true,
+ #1 / DefineCommandsCmd
+ .initial:n = {xpg_define_language_commands:e}
}
}
@@ -753,7 +826,10 @@
}
}
-\AtEndDocument{\prop_log:N{\polyglossia@langsetup}}
+\AtEndDocument{
+ \prop_log:N{\polyglossia@langsetup}
+ \prop_log:N{\__xpg_alias}
+}
\def\xpg@lastlanguage{0}%
\providebool{xpg@hyphenation@disabled}%
@@ -910,7 +986,9 @@
}%
\polyglossia@addfontfeature@language:xx{\prop_item:Nn{\polyglossia@langsetup}{#1/langtag}}
{\prop_item:Nn{\polyglossia@langsetup}{#1/language}}
- }}%
+ }%
+ \def\familytype{rm}%
+ }%
\csgdef{#1@font@sf}{%
\cs_if_exist_use:cF{#1fontsf}%
{
@@ -931,7 +1009,9 @@
}%
\polyglossia@addfontfeature@language:xx{\prop_item:Nn{\polyglossia@langsetup}{#1/langtag}}
{\prop_item:Nn{\polyglossia@langsetup}{#1/language}}
- }}%
+ }%
+ \def\familytype{sf}%
+ }%
\csgdef{#1@font@tt}{%
\cs_if_exist_use:cF{#1fonttt}%
{
@@ -952,7 +1032,9 @@
}%
\polyglossia@addfontfeature@language:xx{\prop_item:Nn{\polyglossia@langsetup}{#1/langtag}}
{\prop_item:Nn{\polyglossia@langsetup}{#1/language}}
- }}%
+ }%
+ \def\familytype{tt}%
+ }%
\endgroup
}
@@ -1008,21 +1090,29 @@
\newXeTeXintercharclass\xpg@normalclass %TODO
}{}
-\ifxetex
%% when no patterns are available, we use \l@nohyphenation, assigned to 255
%% (suggestion by Enrico Gregorio)
- \@ifundefined{l@nohyphenation}{\chardef\l@nohyphenation=255 }{}
-\else\ifluatex
- \@ifundefined{l@nohyphenation}{\chardef\l@nohyphenation=\directlua{
- tex.sprint(polyglossia.newloader_loaded_languages.nohyphenation)}\relax
- }{}
-\fi\fi
+\str_case_e:nn{\c_sys_engine_str}{
+ {luatex}
+ {
+ \@ifundefined{l@nohyphenation}
+ {\chardef\l@nohyphenation=\directlua{
+ tex.sprint(polyglossia.newloader_loaded_languages.nohyphenation)}\relax
+ }
+ {}
+ }
+ {xetex}
+ {
+ \@ifundefined{l@nohyphenation}{\chardef\l@nohyphenation=255 }{}
+ }
+}
+
%we call this macro when a gloss file is not found for a given language
\def\xpg@nogloss#1{%
\xpg@warning{File~ gloss-#1.ldf~ does~ not~ exist!\MessageBreak
I~ will~ nevertheless~ try~ to~ use~ hyphenation~ patterns~ for~ #1.}%
- \PolyglossiaSetup{#1}{hyphenmins,hyphennames={#1},fontsetup=true}%
+ \PolyglossiaSetup{#1}{hyphenmins={2,3},hyphennames={#1},fontsetup=true}%
% the above amounts to:
%\ifcsundef{l@#1}%
% {\expandafter\adddialect\csname l@#1\endcsname\l@nohyphenation\relax}%
@@ -1039,40 +1129,105 @@
\catcode`\@=\xpg@saved@at@catcode%
}
+%% Load a lde file
+\cs_new_nopar:Nn \__xpg_gloss_ext: {lde}
+\cs_new_nopar:Ne \__xpg_saved_@pkgextension: {\@pkgextension}
+
+\msg_new:nnn { polyglossia } { directloadgloss }
+{
+ You~ should~ not~ load~ directly~ the~ gloss~ file. ~
+ You~ must~ use~ `\string\setotherlanguage\{#1\}' or `\string\setmainlanguage\{#1\}'.
+}
+\msg_redirect_name:nnn { polyglossia } { directloadgloss } { critical }
+\NewDocumentCommand{\__xpg_ProvidesLanguageDefinitionExtension_error}{m m m m}
+{
+ \msg_critical:nn { polyglossia } { directloadgloss }
+}
+% ProvideExplPackage but for language file
+\cs_new_eq:NN \ProvidesLanguageDefinitionExtension \__xpg_ProvidesLanguageDefinitionExtension_error
+\cs_new_eq:NN \__xpg_saved_ProvidesExplPackage \ProvidesExplPackage
+\NewDocumentCommand{\__xpg_ProvidesLanguageDefinitionExtension}{m m m m}
+{
+ \__xpg_saved_ProvidesExplPackage{#1}{#2}{#3}{#4}
+ \cs_gset_eq:NN \@pkgextension \__xpg_saved_@pkgextension:
+ \cs_gset_eq:NN \ProvidesLanguageDefinitionExtension \__xpg_ProvidesLanguageDefinitionExtension_error
+}
+
+
+% wrapper for loading a gle file
+\NewDocumentCommand{\RequireLanguageDefinitionExtension}{O{} m}
+{
+ \cs_gset_eq:NN \__xpg_saved_@pkgextension: \@pkgextension
+ \cs_gset_eq:NN \__xpg_saved_ProvidesExplPackage \ProvidesExplPackage
+ \cs_gset_eq:NN \@pkgextension \__xpg_gloss_ext:
+ \cs_gset_eq:NN \ProvidesLanguageDefinitionExtension \__xpg_ProvidesLanguageDefinitionExtension
+ \RequirePackage[#1]{gloss-#2}
+ % be paranoiac restore
+ \cs_gset_eq:NN \@pkgextension \__xpg_saved_@pkgextension:
+ \cs_gset_eq:NN \__xpg_ProvidesLanguageDefinitionExtension_error \ProvideLanguageDefinitionExtension
+}
+
% try to load a language file
\cs_new:Nn \polyglossia_load_lang_definition:nn {
- \file_if_exist:nTF{gloss-#2.ldf}
+ \file_if_exist:eTF{gloss-#2.lde}
{
- % Temporarily force catcode of ~ to 13 since babelsh.def
- % requires it. This is needed particularly with LaTeX3
- % packages which force \ExplSyntaxOn (#425)
- \protected\edef\xpg@restore@tilde@catcode{\catcode 126 = \the\catcode 126\relax}
- \catcode 126 = 13
- \xpg@input{gloss-#2.ldf}
+ \RequireLanguageDefinitionExtension[#1]{#2}
\setkeys{#2}{#1}
- % restore former ~ catcode
- \xpg@restore@tilde@catcode
}
{
- \xpg@nogloss{#2}
+ \file_if_exist:nTF{gloss-#2.ldf}
+ {
+ % Temporarily force catcode of ~ to 13 since babelsh.def
+ % requires it. This is needed particularly with LaTeX3
+ % packages which force \ExplSyntaxOn (#425)
+ \protected\edef\xpg@restore@tilde@catcode{\catcode 126 = \the\catcode 126\relax}
+ \catcode 126 = 13
+ \xpg@input{gloss-#2.ldf}
+ \setkeys{#2}{#1}
+ % restore former ~ catcode
+ \xpg@restore@tilde@catcode
+ }
+ {
+ \xpg@nogloss{#2}
+ }
}
}
+\cs_generate_variant:Nn \polyglossia_load_lang_definition:nn {
+ ee, ef, en, eo, ex,
+ fe, ff, fn, fo, fx,
+ ne, nf, no, nx,
+ oe, of, on, oo, ox,
+ xe, xf, xn, xo, xx
+}
% load a master language from an alias file
\newcommand*\xpg@load@master@language[1] {
- \xpg@input{gloss-#1.ldf}
- \ifcsundef{#1@loaded}%
- {
- \exp_args:Nx\polyglossia@define@language@cmd:n{#1}%
- }{}
- \polyglossia@register@language:nn{}{#1}%
- \csgdef{#1@loaded}{}%
+ \file_if_exist:eTF{gloss-#1.lde}
+ {
+ \RequireLanguageDefinitionExtension{#1}
+ }
+ {
+ \xpg@input{gloss-#1.ldf}
+ }
+ \seq_if_in:NxF \__xpg_langs_loaded {#1}
+ {
+ % define environment and command if not alias
+ \str_if_eq:eeT {\prop_item:Ne \__xpg_alias {#1/target}} {#1} {
+ \use:c{\prop_item:Nn{\polyglossia@langsetup}
+ {#1/DefineCommandsCmd}}
+ {#1}
+ }
+ }
+ \polyglossia@register@language:nn{}{#1}%
+ \seq_gput_right:Nn \__xpg_langs_loaded {#1}
}
+\prop_new:N \__xpg_alias
-% define environment and command
-\cs_new:Nn \polyglossia@define@language@cmd:n {
- \ifcsundef{#1@alias@lang}{%
+% define environment and command if not alias
+\cs_new:Nn \xpg_define_language_commands:n {
+ \str_if_eq:eeT {\prop_item:Ne \__xpg_alias {#1/target}} {#1}
+ {
\exp_args:Ne
\newenvironment {\prop_item:Nn{\polyglossia@langsetup}{#1/envname}} [1] []
{
@@ -1083,156 +1238,242 @@
}%
\exp_args:Nc \newcommand {text#1} [2][]
{%
- \xpg@textlanguage[##1]{#1}{##2}%
+ \__xpg_textlanguage:een{##1}{#1}{##2}%
}%
- }{}
+ }
+}
+\cs_generate_variant:Nn \xpg_define_language_commands:n {e}
+
+\AtBeginDocument{
+ \prop_log:N{\__xpg_alias}
+}
+
+% resolve alias property #1 lang #2 item
+\cs_new:Nn \xpg_alias_prop_item:nn {
+ \prop_if_in:NeTF \__xpg_alias {#1/#2}
+ {
+ \prop_item:Ne \__xpg_alias {#1/#2}
+ }
+ {
+ \prop_if_in:NeTF \__xpg_alias {#1/target}
+ {
+ % target to self fall back to language table
+ \str_if_eq:eeTF { \prop_item:Ne \__xpg_alias {#1/target} } { #1 }
+ {
+ \prop_item:Nn{\polyglossia@langsetup} {#1/#2}
+ }
+ % load alias by recursion
+ {
+ \xpg_alias_prop_item:ee { \prop_item:Ne \__xpg_alias {#1/target} } {#2}
+ }
+ }
+ {
+ % empty
+ }
+ }
+}
+\cs_generate_variant:Nn \xpg_alias_prop_item:nn {en, ne, ee}
+
+% add option #2 to list of option of language #1
+\cs_new:Nn \xpg_alias_add_to_option_i:nn
+{
+ \tl_if_blank:eTF {#2}
+ {
+ \xpg_alias_prop_item:nn {#1}{options}
+ }
+ {
+ \tl_if_blank:eTF { \xpg_alias_prop_item:nn {#1}{options} }
+ {
+ #2
+ }
+ {
+ \xpg_alias_prop_item:nn {#1}{options},#2
+ }
+ }
+}
+
+
+% get base language
+\cs_new:Nn \xpg_alias_base_lang:n {
+ \str_if_eq:eeTF { \prop_item:Ne \__xpg_alias {#1/target} } { #1 }
+ {
+ #1
+ }
+ {
+ \xpg_alias_base_lang:n { \prop_item:Ne \__xpg_alias {#1/target} }
+ }
+}
+\cs_generate_variant:Nn \xpg_alias_base_lang:n {e}
+
+\keys_define:nn { polyglossia/alias }
+{
+ % babelname\l_tmpa_prop
+ babelname .prop_put:N = \__xpg_language_alias_prop,
+ % bcp47
+ bcp47 .prop_put:N = \__xpg_language_alias_prop,
+ % variant
+ variant .prop_put:N = \__xpg_language_alias_prop,
+}
+
+
+
+% provide way to define alias environment and command
+% #1 () variant
+% #2 [] option (not yet without variant and bcp47 name)
+% #3 language
+% #4 () babel name
+% #5 [] bcp47 name
+% #6 alias
+\DeclareDocumentCommand \xpg_language_alias { D(){} O{} m D(){} O{} m}
+{
+ \prop_gremove:Nn \__xpg_alias {#6/target}
+ \prop_gremove:Nn \__xpg_alias {#6/options}
+ \prop_gremove:Nn \__xpg_alias {#6/bcp47}
+ \prop_gremove:Nn \__xpg_alias {#6/babelname}
+ \prop_gremove:Nn \__xpg_alias {#6/variant}
+ \prop_gput:Nee \__xpg_alias {#6/target} {#3}
+ \tl_if_blank:eF {#1}
+ {
+ \prop_gput:Nee \__xpg_alias {#6/variant} {#1}
+ }
+ \tl_if_blank:eF {#5}
+ {
+ \prop_gput:Nee \__xpg_alias {#6/bcp47} {#5}
+ }
+ \tl_if_blank:eF {#4}
+ {
+ \prop_gput:Nee \__xpg_alias {#6/babelname} {#1}
+ }
+ \tl_if_blank:eF {#2}
+ {
+ \prop_gput:Nee \__xpg_alias {#6/options} {#2}
+ }
}
+
% provide way to define alias environment and command
% \setlanguagealias[<options>]{<language>}{<alias>}
\DeclareDocumentCommand \setlanguagealias {s O{} m m}
{
% The starred version does not define commands and environments
\IfBooleanF {#1}
+ {
+ \exp_args:Nc \providecommand {text#4} [2][] {}
+ \exp_args:Nc \renewcommand {text#4} [2][]
{
- \ifcsundef{#4@alias@lang}{%
- \exp_args:Ne
- \newenvironment {#4}
- {
- \begin{otherlanguage}[#2]{#3}
- }%
- {
- \end{otherlanguage}
- }%
- \exp_args:Nc \newcommand {text#4} [2][]
- {%
- \xpg@textlanguage[#2,##1]{#3}{##2}%
- }%
- }{%
- \exp_args:Ne
- \renewenvironment {#4}
- {
- \begin{otherlanguage}[#2]{#3}
- }%
- {
- \end{otherlanguage}
- }%
- \exp_args:Nc \renewcommand {text#4} [2][]
- {%
- \xpg@textlanguage[#2,##1]{#3}{##2}%
- }%
- }%
+ \__xpg_textlanguage:een{##1}{#4}{##2}
+ }
+ \exp_args:Nc \providecommand {#4} {}
+ \exp_args:Ne \renewenvironment {#4}
+ {
+ \begin{otherlanguage}{#4}
+ }
+ {
+ \end{otherlanguage}
+ }
}%
- \csgdef{#4@alias@lang}{#3}%
- \tl_if_blank:nF {#2} {\csgdef{#4@alias@opts}{#2}}%
+ \tl_clear_new:N \__xpg_alias_option_tl
+ \prop_clear_new:N \__xpg_language_alias_prop
+ \keys_set_known:nnN{polyglossia/alias} {#2} \__xpg_alias_option_tl
+ \xpg_language_alias
+ (\prop_item:Nn \__xpg_language_alias_prop {variant})
+ % TODO not yet [\__xpg_alias_option_tl]
+ [#2]
+ {#3}
+ (\prop_item:Nn \__xpg_language_alias_prop {babelname})
+ [\prop_item:Nn \__xpg_language_alias_prop {bcp47}]
+ {#4}
}
\cs_new:Nn \polyglossia@register@language:nn {
- % register polyglossia language name
- \ifcsundef{#2@registered}{%
- \global\edef\xpg@loaded{%
- \ifx\xpg@loaded\@empty\else\xpg@loaded,\fi #2%
- }%
- }{}
- \csgdef{#2@registered}{}%
- \tl_if_blank:nF {#1}{%
- % Register the language options
- \polyglossia@set@lang@options:nn {#2} {#1}%
- }%
- % register babelname
- \def\xpg@tmp@babelname{\prop_item:Nn{\polyglossia@langsetup}{#2/babelname}}%
- \ifcsundef{\csname xpg@tmp@babelname\endcsname @bbl@registered}{%
- \global\edef\xpg@bloaded{%
- \ifx\xpg@bloaded\@empty\else\xpg@bloaded,\fi\xpg@tmp@babelname}%
- }{}%
- \csgdef{\csname xpg@tmp@babelname\endcsname @bbl@registered}{}%
- % register BCP-47 ID
- \def\xpg@tmp@bcpname{\prop_item:Nn{\polyglossia@langsetup}{#2/bcp47}}%
- \ifcsundef{\csname xpg@tmp@bcpname\endcsname @bcp@registered}{%
- \global\edef\xpg@bcp@loaded{%
- \ifx\xpg@bcp@loaded\@empty\else\xpg@bcp@loaded,\fi\xpg@tmp@bcpname}%
- }{}%
- \csgdef{\csname xpg@tmp@bcpname\endcsname @bcp@registered}{}%
+ \clist_if_in:NeF \xpg@loaded {#2}{
+ \clist_gput_right:Ne \xpg@loaded {#2}
+ }
+ % Register the language options
+ \polyglossia@set@lang@options:nnn {#2} {#1} {@xpg@set@langvariant}
+ % register babelname
+ \prop_get:NeN \polyglossia@langsetup {#2/babelname} \l_tmpa_tl
+ \clist_if_in:NeF \xpg@bloaded {\l_tmpa_tl}{
+ \clist_gput_right:Ne \xpg@bloaded {\l_tmpa_tl}
+ }
+ % register BCP-47 ID
+ \prop_get:NeN \polyglossia@langsetup {#2/bcp47} \l_tmpa_tl
+ \clist_if_in:NeF \xpg@bcp@loaded {\l_tmpa_tl}{
+ \clist_gput_right:Ne \xpg@bcp@loaded {\l_tmpa_tl}
+ }
}
-
\newcommand{\setdefaultlanguage}[2][]{%
% latex is an internal language, so do not record
- \ifstrequal{#2}{latex}{}{%
- % register polyglossia language name
- \ifcsundef{#2@registered}{%
- \global\edef\xpg@loaded{%
- \ifx\xpg@loaded\@empty\else\xpg@loaded,\fi #2%
- }%
- }{}%
- \csgdef{#2@registered}{}%
- }%
- \ifcsundef{#2@loaded}%
+ \str_if_eq:eeF{#2}{latex}
{
- \polyglossia_load_lang_definition:nn{#1}{#2}
- % define environment and command (except for internal latex language)
- \ifstrequal{#2}{latex}{}{%
- \exp_args:Nx\polyglossia@define@language@cmd:n{#2}
- }%
- \csgdef{#2@loaded}{}%
+ \clist_if_in:NeF \xpg@loaded {\xpg_alias_base_lang:n{##2}}{
+ \clist_gput_right:Ne \xpg@loaded {\xpg_alias_base_lang:n{##2}}
+ }
}
+ \seq_if_in:NxF \__xpg_langs_loaded {#2}
{
- \relax
+ \polyglossia_load_lang_definition:nn{#1}{#2}
+ % define environment and command if not alias
+ \str_if_eq:eeT {\prop_item:Ne \__xpg_alias {#2/target}} {#2} {
+ \use:c{\prop_item:Nn{\polyglossia@langsetup}
+ {#2/DefineCommandsCmd}}
+ {#2}
+ }
+ \seq_gput_right:Nn \__xpg_langs_loaded {#2}
}
- \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}%
- }%
+ \polyglossia@set@default@language:ee {\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ {\xpg_alias_base_lang:n{#2}}%
}
+
\cs_new:Nn \polyglossia@set@default@language:nn
{
\gdef\xpg@main@language{#2}%
- \tl_if_blank:nTF {#1}{\gdef\mainlanguagevariant{}}{%
+ \tl_if_blank:nTF {#1}
+ {
+ \cs_gset_nopar:Npn \mainlanguagevariant {}
+ }
+ {%
% Register the language options
- \polyglossia@set@lang@options:nn {#2} {#1}%
+ \polyglossia@set@lang@options:nnn {#2} {#1} {@xpg@main@langvariant}%
}%
\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}{%
- \str_case_e:nnF{\c_sys_engine_str}{%
- {luatex}{\setRTLmain}
- {xetex}{\@RTLmaintrue\setnonlatin}
- }{}%
- }{}%
+ \__xpg_if_LR_str:eF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}
+ {
+ \__xpg_setRTLmain:
+ }
\cs_gset_nopar:Nn \polyglossia@AtBeginDocument@selectlanguage: {
\selectbackgroundlanguage{#2}
\selectlanguage[#1]{#2}%
}
\xpg@info{Default~ language~ is~ #2}%
\polyglossia@set@language@name[#1]{#2}%
- \def\mainlanguagename{#2}
+
+ \cs_gset_nopar:Npn \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} }
+ \cs_gset_nopar:Npe \mainbabelname { \prop_item:Nn \polyglossia@langsetup {#2/babelname} }
% Store babelname of current language (for external packages such as biblatex)
- \prop_get:NxNT \polyglossia@langsetup {#2/babelname} \l_tmpa_tl
- { \edef\babelname{\l_tmpa_tl}%
- \cs_gset_eq:cc{#2@gbabelname}{babelname}%
- }
+ \cs_gset_eq:NN \babelname \mainbabelname
+ \cs_gset_eq:cc{#2@gbabelname}{babelname}%
% Store BCP-47 id of main language
- \prop_get:NxNT \polyglossia@langsetup {#2/bcp47} \l_tmpa_tl
- { \csedef{mainbcp47id}{\l_tmpa_tl} }
- % Store BCP-47 id of current language
- \prop_get:NxNT \polyglossia@langsetup {#2/bcp47} \l_tmpa_tl
- { \csedef{bcp47id}{\l_tmpa_tl}%
- \cs_gset_eq:cc{#2@gbcp47id}{bcp47id}%
- }
- \ifluatex %
- \directlua{polyglossia.set_default_language('\luatexluaescapestring{\string#2}')}%
- \fi %
+ \cs_gset_nopar:cpe {mainbcp47id} { \prop_item:Nn \polyglossia@langsetup {#2/bcp47} }
+ \cs_gset_eq:cc {bcp47id} {mainbcp47id}
+ \cs_gset_eq:cc{#2@gbcp47id}{bcp47id}
+
+ \sys_if_engine_luatex:T
+ {
+ \directlua{polyglossia.set_default_language('\luatexluaescapestring{\string#2}')}%
+ }
+}
+\cs_generate_variant:Nn\polyglossia@set@default@language:nn {
+ ee, ef, en, eo, ex,
+ fe, ff, fn, fo, fx,
+ ne, nf, no, nx,
+ oe, of, on, oo, ox,
+ xe, xf, xn, xo, xx
}
\let\setmainlanguage=\setdefaultlanguage
@@ -1241,12 +1482,11 @@
% Currently supported: bcp-47
\DeclareDocumentCommand \languageid {m}
{
- \str_case:nnTF {#1}
+ \str_case:nnF {#1}
{
{bcp-47} { \csuse{bcp47id} }
{bcp47} { \csuse{bcp47id} }
}
- {}
{
\xpg@error{Invalid~ \string\languageid\space argument:~ #1}
}
@@ -1256,25 +1496,26 @@
% Currently supported: bcp-47
\DeclareDocumentCommand \mainlanguageid {m}
{
- \str_case:nnTF {#1}
+ \str_case:nnF {#1}
{
{bcp-47} { \csuse{mainbcp47id} }
{bcp47} { \csuse{mainbcp47id} }
}
- {}
{
\xpg@error{Invalid~ \string\mainlanguageid\space argument:~ #1}
}
}
-
-\def\mainbabelname{}%
-\def\mainlanguagevariant{}%
+% main babel name
+\cs_new_nopar:Npn \mainlanguagename {}
+\cs_new_nopar:Npn \mainbabelname {}
+\cs_new_nopar:cpn {mainbcp47id} {}
+\cs_new_nopar:Npn \mainlanguagevariant {}%
% Store main language variant for external packages
\define@key{xpg@main@langvariant}{variant}{%
- \gdef\mainlanguagevariant{#1}%
+ \cs_gset_nopar:Npn \mainlanguagevariant {#1}%
}
-\def\babelname{}%
+\cs_new_nopar:Npn \babelname {}
\def\languagevariant{}%
% Store current language variant for external packages
\define@key{xpg@set@langvariant}{variant}{%
@@ -1287,21 +1528,16 @@
\ifcsundef{#2@gvar}{\def\languagevariant{}}{\def\languagevariant{\csuse{#2@gvar}}}
}{%
% Register the language options
- \polyglossia@set@lang@options:nn {#2} {#1}%
+ \polyglossia@set@lang@options:nnn {#2} {#1} {@xpg@set@langvariant}%
+ \cs_set_eq:cc{#2@gvar}{languagevariant}%
}%
}
\newcommand*{\resetdefaultlanguage}[2][]{%
- \ifcsdef{#2@alias@lang}{%
- \ifcsdef{#2@alias@opts}{%
- \exp_args:Nxx \polyglossia@reset@default@language:nn {\csuse{#2@alias@opts},#1} {\csuse{#2@alias@lang}}%
- }{%
- polyglossia@reset@default@language:nn {#1} {\csuse{#2@alias@lang}}%
- }%
- }{%
- polyglossia@reset@default@language:nn {#1} {#2}%
- }%
+ \polyglossia@reset@default@language:nn
+ {\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ {\xpg_alias_base_lang:n{#2}}%
}
\cs_new:Nn \polyglossia@reset@default@language:nn
@@ -1315,7 +1551,10 @@
\cs_if_exist_use:c{noextras@bbl@\mainbabelname}%
\csuse{init@noextras@\xpg@main@language}%
\polyglossia@set@language@name[#1]{#2}%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}{RL}{\@rlmaintrue\@rl@footnotetrue}{}%
+ \__xpg_if_LR_str:eF{\prop_item:Ne{\polyglossia@langsetup}{#2/direction}}
+ {
+ \@rlmaintrue\@rl@footnotetrue
+ }
\selectlanguage[#1]{#2}%
\selectbackgroundlanguage{#2}%
% Store babelname of current language (for external packages such as biblatex)
@@ -1339,6 +1578,13 @@
\csedef{bcp47id}{\prop_item:Nn{\polyglossia@langsetup}{#2/bcp47}}%
}%
}
+\cs_generate_variant:Nn \polyglossia@reset@default@language:nn {
+ ee, ef, en, eo, ex,
+ fe, ff, fn, fo, fx,
+ ne, nf, no, nx,
+ oe, of, on, oo, ox,
+ xe, xf, xn, xo, xx
+}
% This saves the normalfont for the latin script since we may change normalfont in other scripts
\let\normalfontlatin=\normalfont%
@@ -1420,15 +1666,18 @@
\def\xpg@select@fontfamily#1{%
\def\tmp@tt{tt}\def\tmp@sf{sf}%
\ifx\familytype\tmp@tt
- \csuse@warn{#1@font@tt}%
+ \__xpg_use_or_warn:c{#1@font@tt}%
\else\ifx\familytype\tmp@sf
- \csuse@warn{#1@font@sf}%
- \else\csuse@warn{#1@font@rm}\fi\fi}
+ \__xpg_use_or_warn:c{#1@font@sf}%
+ \else\__xpg_use_or_warn:c{#1@font@rm}\fi\fi}
\def\xpg@set@normalfont#1{%
- \DeclareRobustCommand\rmfamily{\csuse{#1@font@rm}}%
- \DeclareRobustCommand\sffamily{\csuse{#1@font@sf}}%
- \DeclareRobustCommand\ttfamily{\csuse{#1@font@tt}}%
+ \letcs{\rmfamily}{#1@font@rm}%
+ \letcs{\sffamily}{#1@font@sf}%
+ \letcs{\ttfamily}{#1@font@tt}%
+ \robustify\rmfamily%
+ \robustify\sffamily%
+ \robustify\ttfamily%
\gdef\normalfont{\protect\xpg@select@fontfamily{#1}%
\fontseries{\seriesdefault}\selectfont%
\fontshape{\shapedefault}
@@ -1447,14 +1696,10 @@
\@afterindentfalse%
}
-\newcommand*{\selectbackgroundlanguage}[1]{%
- \ifcsdef{#1@alias@lang}{%
- \polyglossia@select@background@language:n {\csuse{#1@alias@lang}}%
- }{%
- \polyglossia@select@background@language:n {#1}%
- }%
+\cs_new_nopar:Npn \selectbackgroundlanguage #1
+{%
+ \polyglossia@select@background@language:n {\xpg_alias_base_lang:n{#1}}
}
-
\cs_new:Nn \polyglossia@select@background@language:n
{
\str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#1/lcscript}}{latin}
@@ -1462,26 +1707,23 @@
{\xpg@set@normalfont{#1}}%
\csuse{#1@globalnumbers}%
}
-
-\newcommand{\setotherlanguage}[2][]{%
- \ifcsundef{#2@loaded}
+\cs_generate_variant:Nn \polyglossia@select@background@language:n {e}
+% Declare secondary language #2 with language options #1
+\DeclareDocumentCommand \setotherlanguage { O{} m }
+{
+ \seq_if_in:NxF \__xpg_langs_loaded {#2}
{
- \polyglossia_load_lang_definition:nn{#1}{#2}
- % define environment and command
- \exp_args:Nx\polyglossia@define@language@cmd:n{#2}
- \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@loaded}{}%
+ \polyglossia_load_lang_definition:ee {#1} {#2}%
+ % define environment and command if not alias
+ \str_if_eq:eeT {\prop_item:Ne \__xpg_alias {#2/target}} {#2} {
+ \use:c{\prop_item:Nn{\polyglossia@langsetup}
+ {#2/DefineCommandsCmd}}
+ {#2}
+ }
+ \polyglossia@set@other@language:ee {\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ {\xpg_alias_base_lang:n{#2}}%
+ \seq_gput_right:Nn \__xpg_langs_loaded {#2}
}
- {}
}
\cs_new:Nn \polyglossia@set@other@language:nn
@@ -1489,15 +1731,22 @@
\polyglossia@register@language:nn{#1}{#2}%
% If a variant is set, store it.
\gdef\otherlanguagevariant{}
- \tl_if_blank:nTF {#1}{}{%
- % Register the language options
- \polyglossia@set@lang@options:nn {#2} {#1}%
- }%
+ % Register the language options
+ \polyglossia@set@lang@options:nnn {#2} {#1} {@xpg@other@langvariant}%
+
\csgdef{#2@gvar}{\otherlanguagevariant}%
\prop_get:NxNT \polyglossia@langsetup {#2/babelname} \l_tmpa_tl
{ \xdef\otherlanguagebabelname{\l_tmpa_tl} }
\cs_gset_eq:cc{#2@gbabelname}{otherlanguagebabelname}%
}
+\cs_generate_variant:Nn \polyglossia@set@other@language:nn {
+ ee, ef, en, eo, ex,
+ fe, ff, fn, fo, fx,
+ ne, nf, no, nx,
+ oe, of, on, oo, ox,
+ xe, xf, xn, xo, xx
+}
+
% Store main language variant for external packages
\define@key{xpg@other@langvariant}{variant}{%
@@ -1527,15 +1776,7 @@
% where \text<alias> would cause clashes
% (e.g., \textit)
\newcommand\textlang[3][]{%
- \ifcsdef{#2@alias@lang}{%
- \ifcsdef{#2@alias@opts}{%
- \exp_args:Nxx \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}%
- }%
+ \__xpg_textlanguage:een {#1} {#2} {#3}
}%
% Alias to {<lang>}, but more suitable
@@ -1578,6 +1819,8 @@
% joint code of \foreignlanguage, otherlanguage*
% and \text<lang>
+% #1 option
+% #2 language
\newcommand{\xpg@otherlanguage}[2][]
{%
\polyglossia@error@iflangnotloaded:n{#2}
@@ -1593,66 +1836,90 @@
}
\renewcommand{\foreignlanguage}[3][]
-{%
- \ifcsdef{#2@alias@lang}{%
- \ifcsdef{#2@alias@opts}{%
- \exp_args:Nxx \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}%
- }%
+{
+ \__xpg_foreignlanguage:eeen {#1} {#2} {\xpg_alias_base_lang:n{#2}} {#3}
}
-\cs_new:Nn \polyglossia@foreignlanguage:nnn
+% internal wrapper for foreing language
+% #1 option
+% #2 alias
+% #3 base lang
+% #3 text
+\cs_new:Nn \__xpg_foreignlanguage:nnnn
{
- \polyglossia@error@iflangnotloaded:n{#2}
- \bgroup
- \xpg@otherlanguage[#1]{#2}%
- \polyglossia@lang@settextdirection:nn{#2}{#3}%
- \egroup
+ \tl_if_blank:nT {#3}
+ {
+ \msg_show:nnn { polyglossia } { languagenotloaded } {#2}
+ }
+ \group_begin:
+ \xpg@otherlanguage[\xpg_alias_add_to_option_i:nn{#2}{#1}]{#4}%
+ \polyglossia@lang@settextdirection:nn{#3}{#4}%
+ \group_end:
}
+\cs_generate_variant:Nn \__xpg_foreignlanguage:nnn {een}
+
% otherlanguage* is the environment equivalent of \foreignlanguage
\expandafter\providecommand\csname otherlanguage*\endcsname{}
\renewenvironment{otherlanguage*}[2][]
{%
- \ifcsdef{#2@alias@lang}{%
- \ifcsdef{#2@alias@opts}{%
- \exp_args:Nxx \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}%
- }%
+ \__xpg_otherlanguage:eee {#1} {#2} {\xpg_alias_base_lang:n{#2}}
}
-{\egroup}
+{\group_end:}
-\cs_new:Nn \polyglossia@otherlanguage:nn
+% internal wrapper
+% #1 option
+% #2 alias
+% #3 base lang
+\cs_new:Nn \__xpg_otherlanguage:nnn
{
- \xpg@otherlanguage[#1]{#2}%
- \polyglossia@lang@settextdirection:nn{#2}\bgroup%
+ \tl_if_blank:nT {#3}
+ {
+ \msg_show:nnn { polyglossia } { languagenotloaded } {#2}
+ }
+ \xpg@otherlanguage[\xpg_alias_add_to_option_i:nn{#2}{#1}]{#3}%
+ \polyglossia@lang@settextdirection:nn{#3}\group_begin:%
+}
+\cs_generate_variant:Nn \__xpg_otherlanguage:nnn {
+ eee
}
% use by \text<lang> and \textlang. Equivalent to \foreignlanguage,
% except that dates are localized.
-\newcommand\xpg@textlanguage[3][]{%
- \polyglossia@error@iflangnotloaded:n{#2}
- \bgroup
- \xpg@otherlanguage[#1]{#2}%
- \csuse{date#2}%
- % This is a hook for external packages which want to access variants
- % via babelname (such as biblatex)
- \cs_if_exist_use:c{date@bbl@\babelname}%
- \polyglossia@lang@settextdirection:nn{#2}{#3}%
- \egroup
- % Reset the language's/script's font families
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/lcscript}}{latin}{}{\resetfontlatin}%
+% #1: option
+% #2: alias
+% #3: text
+\cs_new:Nn \__xpg_textlanguage:nnn
+{
+ \__xpg_textlanguage:nnen {#1} {#2} {\xpg_alias_base_lang:n{#2}} {#3}
}
+\cs_generate_variant:Nn \__xpg_textlanguage:nnn {een}
+% use by \text<lang> and \textlang. Equivalent to \foreignlanguage,
+% except that dates are localized.
+% #1: option
+% #2: alias
+% #3: base language
+% #4: text
+\cs_new:Nn \__xpg_textlanguage:nnnn
+{
+ \tl_if_blank:nT {#3}
+ {
+ \msg_show:nnn { polyglossia } { languagenotloaded } {#2}
+ }
+ \group_begin:
+ \xpg@otherlanguage[#1]{#3}%
+ \csuse{date#3}%
+ % This is a hook for external packages which want to access variants
+ % via babelname (such as biblatex)
+ \cs_if_exist_use:c{date@bbl@\babelname}%
+ \polyglossia@lang@settextdirection:nn{#3}{#4}%
+ \group_end:
+ % Reset the language's/script's font families
+ \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#3/lcscript}}{latin}{}{\resetfontlatin}%
+}
+\cs_generate_variant:Nn \__xpg_textlanguage:nnnn {nnen}
% Define language-specific hyphenation exceptions
\newcommand\pghyphenation[3][]{
@@ -1675,58 +1942,59 @@
\let\emp@langname\@undefined}
\DeclareDocumentCommand \selectlanguage {s O{} m}
-{%
- \ifcsdef{#3@alias@lang}{%
- \ifcsdef{#3@alias@opts}{%
- \exp_args:Nxx \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}%
- }
+{
+ \__xpg_msg_if_lang_not_loaded:n {#3}
+ \polyglossia@select@language:nee {#1}
+ {\xpg_alias_add_to_option_i:nn{#3}{#2}}
+ {\xpg_alias_base_lang:n{#3}}
}
\cs_new:Nn \polyglossia@select@language:nnn
{
\IfBooleanF {#1}
- {
- \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}{}{%
- % Register the language options
- \polyglossia@set@lang@options:nn {#3} {#2}%
- }%
- % The starred variant does not write to the aux
- \IfBooleanTF#1{%
- \xpg@set@language@nonaux[#2]{#3}%
- }{%
- \xpg@set@language@aux[#2]{#3}%
- }%
- \ifluatex%
- \directlua{polyglossia.select_language('\luatexluaescapestring{\string#3}',
- \the\csname l@#3\endcsname)}%
- \fi%
+ {
+ \cs_set_nopar:Npx \xpg@pop@language { \exp_not:N \xpg@pop@language@i {#2} {#3} }
+ \group_insert_after:N \xpg@pop@language
+ }
+ % Register the language options
+ \polyglossia@set@lang@options:nnn {#3} {#2} {@xpg@set@langvariant}%
+ % The starred variant does not write to the aux
+ \IfBooleanTF#1{%
+ \xpg@set@language@nonaux[#2]{#3}%
+ }
+ {%
+ \xpg@set@language@aux[#2]{#3}%
+ }%
+ \sys_if_engine_luatex:T
+ {
+ \directlua{polyglossia.select_language('\luatexluaescapestring{\string#3}',
+ \the\csname l@#3\endcsname)}%
+ }
\polyglossia@register@language:nn{#2}{#3}%
}
+\cs_generate_variant:Nn \polyglossia@select@language:nnn {
+ nee, nne
+}
-\cs_new:Nn \polyglossia@set@lang@options:nn
-{
+% set lang option #2 for lang #1
+\cs_new:Nn \polyglossia@set@lang@options:nnn
+{
+ \tl_if_blank:nF {#2}
+ {
% If the optional argument sets a value for the key “variant”, copy it to xpg@langvariant
\clist_map_inline:nn { #2 } {%
- \xpg@parsevariantkeyvalue##1=@xpg@langvariant:#1\relax
+ \xpg@parsevariantkeyvalue##1=#3:#1\relax
}%
\exp_args:Nne \setkeys{#1}{#2}%
+ }
}
% Initialize default language options, so that
% \iflanguageoption has the info it needs also
% for default settings
\newcommand*\xpg@initialize@gloss@options[2]{%
- \polyglossia@set@lang@options:nn {#1} {#2}%
+ \polyglossia@set@lang@options:nnn {#1} {#2} {@xpg@set@langvariant}%
}
% Record synonymous keyvals such as variant=us and variant=american
@@ -1776,16 +2044,16 @@
{
\prop_get:cnNTF {xpg@current@options@#1} {#2} \l_tmpa_tl
{
- \exp_args:Nee \str_if_eq:NNTF{\l_tmpa_tl}{#3}
+ \str_if_eq:eeTF{\l_tmpa_tl}{#3}
{\prg_return_true:}
{
\prop_get:cnNTF {xpg@alias@keyvals@#1@#3} {#2} \l_tmpb_tl
{
- \exp_args:Nne \clist_set:Nn{\l_tmpa_clist}{\l_tmpb_tl}
+ \clist_set:Ne{\l_tmpa_clist}{\l_tmpb_tl}
\providetoggle{xpgvalfound}
\togglefalse{xpgvalfound}
\clist_map_inline:Nn \l_tmpa_clist {
- \exp_args:Nee \str_if_eq:NNT{##1}{\l_tmpa_tl}
+ \str_if_eq:eeT{##1}{\l_tmpa_tl}
{ \toggletrue{xpgvalfound} }
}
\iftoggle{xpgvalfound}{\prg_return_true:}{\prg_return_false:}
@@ -1808,39 +2076,39 @@
% Append any variant to csv list of variants
\define@key{xpg@langvariant}{variant}{%
- \edef\xpg@vloaded{#1\ifx\xpg@vloaded\@empty\else,\xpg@vloaded\fi}%
-}
-
-\prg_set_conditional:Npnn \polyglossia@check@if@lang@loaded:N #1 { p , T , F , TF }{
- \cs_if_exist:cTF{#1}{
- \prg_return_true:
- }{
- \prg_return_false:
+ \clist_if_in:NeF \xpg@vloaded {#1}{
+ \clist_gput_right:Ne \xpg@vloaded {#1}
}
}
% Test if language is loaded
\newcommand*\iflanguageloaded[3]{%
- \polyglossia@check@if@lang@loaded:NTF{#1@loaded}{#2}{#3}%
+ \AddToHook{begindocument/end}{%
+ \clist_if_in:NeTF \xpg@loaded{#1}{#2}{#3}%
+ }%
}
% Same for babellanguage is loaded
\newcommand*\ifbabellanguageloaded[3]{%
- \polyglossia@check@if@lang@loaded:NTF{#1@bbl@loaded}{#2}{#3}%
+ \AddToHook{begindocument/end}{%
+ \clist_if_in:NeTF \xpg@bloaded{#1}{#2}{#3}%
+ }%
}
% Same for languageid
\DeclareDocumentCommand \iflanguageidloaded {mmmm}
{
+ \AddToHook{begindocument/end}{%
\str_case:nnTF {#1}
{
- {bcp-47} { \polyglossia@check@if@lang@loaded:NTF{#2@bcp@loaded}{#3}{#4} }
- {bcp47} { \polyglossia@check@if@lang@loaded:NTF{#2@bcp@loaded}{#3}{#4} }
+ {bcp-47} { \clist_if_in:NeTF \xpg@bcp@loaded{#2}{#3}{#4} }
+ {bcp47} { \clist_if_in:NeTF \xpg@bcp@loaded{#2}{#3}{#4} }
}
{}
{
\xpg@error{Invalid~ \string\iflanguageidloaded\space argument:~ #1}
}
+ }%
}
% Check if the current font has a given glyph
@@ -1859,8 +2127,10 @@
}
}
{
- \xpg@warning{You’re running a TeX engine that is not LuaTeX or XeTeX.\MessageBreak
- That is almost guaranteed to cause problems.}
+ \xpg@warning{You’re ~ running ~ a ~ TeX engine ~ that ~ is ~
+ not ~ LuaTeX ~ or ~ XeTeX.\MessageBreak
+ That~ is~ almost~ guaranteed~ to~ cause~ problems.}
+ \prg_return_false:
}
}
@@ -1902,6 +2172,11 @@
}%
\@select@language[#1]{#2}%
% Write to the aux
+ \xpg@set@language@only@aux[#1]{#2}%
+}
+
+\newcommand*{\xpg@set@language@only@aux}[2][]{%
+ % Write to the aux
\if@filesw%
\ifx#1\\\\%
\protected@write\@auxout{}{\protect\selectlanguage*{#2}}%
@@ -1933,45 +2208,8 @@
}{}%
}
-% Open a group in the aux file. This is to keep
-% nested language options local (see #320).
-% In bidi tables, the opening/closing needs to be swapped (see #354)
-\newcommand*{\xpg@set@group@aux}{%
- \if@filesw%
- \ifbool{xpg@inbiditable}{%
- \protected@write\@auxout{}{\egroup}%
- \addtocontents{toc}{\egroup}%
- \addtocontents{lof}{\egroup}%
- \addtocontents{lot}{\egroup}%
- }{%
- \protected@write\@auxout{}{\bgroup}%
- \addtocontents{toc}{\bgroup}%
- \addtocontents{lof}{\bgroup}%
- \addtocontents{lot}{\bgroup}%
- }%
- \fi
-}
-
-% Close the group in the aux file.
-% In bidi RTL tables, the opening/closing needs
-% to be swapped (see #354).
-\newcommand*{\xpg@unset@group@aux}{%
- \if@filesw%
- \ifbool{xpg@inbiditable}{%
- \protected@write\@auxout{}{\bgroup}%
- \addtocontents{toc}{\bgroup}%
- \addtocontents{lof}{\bgroup}%
- \addtocontents{lot}{\bgroup}%
- }{%
- \protected@write\@auxout{}{\egroup}%
- \addtocontents{toc}{\egroup}%
- \addtocontents{lof}{\egroup}%
- \addtocontents{lot}{\egroup}%
- }%
- \fi
-}
-
-\prg_set_conditional:Npnn \polyglossia@check@ifdefined:N #1 { p , T , F , TF }{
+% check if language is defined
+\prg_set_conditional:Npnn \__xpg_check_if_exist_l@:N #1 { p , T , F , TF }{
\cs_if_exist:cTF {l@#1}
{
\cs_if_eq:cNTF {l@#1} \l@nohyphenation
@@ -1993,48 +2231,54 @@
\def\polyglossia@luatex@load@lang#1{%
% if \l@#1 is not properly defined, call lua function newloader(#1),
% and assign the returned number to \l@#1
- \polyglossia@check@ifdefined:NF {#1}
- {
- \expandafter\chardef\csname l@#1\endcsname=
- \directlua{ tex.sprint(polyglossia.newloader'#1') }\relax
- }
+ \__xpg_check_if_exist_l@:NF {#1}
+ {
+ \expandafter\chardef\csname l@#1\endcsname=
+ \directlua{ tex.sprint(polyglossia.newloader'#1') }\relax
+ }
}
% This check is also used by biblatex, so don't
% rename silently.
\newcommand\xpg@ifdefined[3]{%
- % With luatex, we first need to define \l@#1.
- \ifluatex
- \polyglossia@luatex@load@lang{#1}%
- \fi
- \polyglossia@check@ifdefined:NTF{#1}{#2}{#3}%
+ % With luatex, we first need to define \l@#1.
+ \sys_if_engine_luatex:T
+ {
+ \polyglossia@luatex@load@lang{#1}%
+ }
+ \__xpg_check_if_exist_l@:NTF{#1}{#2}{#3}%
}%
% Set \bbl@hyphendata@\the\language, which is (lua)babel's
% hyphenation pattern hook
% FIXME Clarifiy why/when this is needed.
\newcommand*\xpg@set@bbl@hyphendata[1]{%
- \ifluatex%
- \ifcsdef{bbl@hyphendata@#1}{}{%
- \global\@namedef{bbl@hyphendata@\the\language}{}%
- }%
- \fi%
+ \sys_if_engine_luatex:T
+ {
+ \ifcsdef{bbl@hyphendata@#1}{}{%
+ \global\@namedef{bbl@hyphendata@\the\language}{}%
+ }%
+ }
}
% Set hyphenation patterns for a given language. This does the right
% thing both for XeTeX and LuaTeX
\newcommand*\xpg@set@hyphenation@patterns[1]{%
- \ifluatex
- \polyglossia@luatex@load@lang{#1}%
- \language=\csname l@#1\endcsname
- \else
- \ifxetex
- \language=\csname l@#1\endcsname
- \else
+ \str_case_e:nnF{\c_sys_engine_str}{
+ {luatex}
+ {
+ \polyglossia@luatex@load@lang{#1}%
+ \language=\csname l@#1\endcsname
+ }
+ {xetex}
+ {
+ \language=\csname l@#1\endcsname
+ }
+ }
+ {
\xpg@warning{You’re~running~a~TeX~engine~that~is~not~LuaTeX~or~XeTeX.\MessageBreak
That~is~almost~guaranteed~to~cause~problems.}%
- \fi
- \fi
+ }
}
@@ -2071,38 +2315,46 @@
% Hook for external packages such as biblatex
\def\polyglossia@language@switched{}
-\def\noextrascurrent#1{%
- \csuse{noextras@#1}%
- % This is a hook for external packages which want to access variants
- % via babelname (such as biblatex)
- \cs_if_exist_use:c{noextras@bbl@\babelname}
+% remove all custumization for language #1
+\cs_new:Npn \noextrascurrent #1
+{%
+ \cs_if_exist_use:c{noextras@#1}%
+ % This is a hook for external packages which want to access variants
+ % via babelname (such as biblatex)
+ \cs_if_exist_use:c{noextras@bbl@\babelname}
}
% Common code for `\select@language' and `\foreignlanguage'.
\newcommand{\select@@language}[2][]{%
% disable the extras and number settings of the previous language
- \ifcsundef{languagename}{}{%
- \noextrascurrent{\languagename}%
- \csuse{no\languagename @numbers}%
- \ifxetex
- \str_if_eq:eeTF{\exp_args:Nne\prop_item:Nn{\polyglossia@langsetup}{\languagename/direction}}{RL}%
- {%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}{RL}%
- {}% RTL -> RTL
- {\setlatin}% RTL -> LTR
- }{%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}{RL}%
- {\setnonlatin}% LTR -> RTL
- {}% LTR -> LTR
- }%
- \fi
+ \cs_if_exist:cT{languagename}
+ {%
+ \noextrascurrent{\languagename}%
+ \cs_if_exist_use:c{no\languagename @numbers}%
+ \sys_if_engine_xetex:T{
+ \__xpg_if_LR_str:eTF{\prop_item:Ne{\polyglossia@langsetup}{\languagename/direction}}
+ {
+ \__xpg_if_LR_str:eF{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}
+ {\setnonlatin}% LTR -> RTL
+ }%
+ {%
+ \__xpg_if_LR_str:eT{\prop_item:Nn{\polyglossia@langsetup}{#2/direction}}
+ {\setlatin}% RTL -> LTR
+ }
+ }
}%
\polyglossia@set@language@name[#1]{#2}%
% Set the language's/script's font families
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/lcscript}}{latin}{\resetfontlatin}{\xpg@set@normalfont{#2}}%
+ \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#2/lcscript}} {latin}
+ {
+ \resetfontlatin
+ }
+ {
+ \xpg@set@normalfont{#2}
+ }%
\xpg@select@fontfamily{#2}%
- \csuse@warn{#2@language}%
- \csuse{#2@numbers}%
+ \__xpg_use_or_warn:c{#2@language}%
+ \cs_if_exist_use:c{#2@numbers}%
\use@localhyphenmins[#1]{#2}%
\polyglossia@lang@frenchspacing:n{#2}
}
@@ -2112,24 +2364,48 @@
\provideenvironment{otherlanguage}{}{}
-\newbool{xpg@noset@groups}
+%
+% Keep track of the active (nested) languages and options
+%
+\clist_new:N \l_xpg_lang_stack
+
+\cs_new:Nn \polyglossia@stack@language:nn
+{
+ \clist_push:Nn \l_xpg_lang_stack {#1:#2}
+}
+
+\cs_generate_variant:Nn \seq_set_split:Nnn {Nnx}
+
+\cs_new:Nn \polyglossia@unstack@language:n
+{
+ \clist_gpop:NNTF \l_xpg_lang_stack \l_tmpa_tl {
+ % Stored format = options:language => split:
+ \seq_set_split:Nnx \l_tmpa_seq {:} \l_tmpa_tl
+ \seq_get_left:NN \l_tmpa_seq \l_tmpb_tl
+ \seq_get_right:NN \l_tmpa_seq \l_tmpc_tl
+ % Execute passed command with language and maybe options
+ \tl_if_empty:NTF \l_tmpb_tl {\cs_if_exist_use:c{#1}{\l_tmpc_tl}}
+ {\cs_if_exist_use:c{#1}[\l_tmpb_tl]{\l_tmpc_tl}}
+ }
+ {}
+}
+
\renewenvironment{otherlanguage}[2][]
{%
- % We usually embrace the switch in groups to keep the changes local.
- % We cannot do this if an LTR environmet starts in an RTL paragraph,
- % as bidi interferes here badly with its directionality smartness.
- \ifxetex
- \str_if_eq:eeT{\exp_args:Nne\prop_item:Nn{\polyglossia@langsetup}{\languagename/direction}}{RL}%
- {%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#1/direction}}{RL}%
- {}% RTL -> RTL
- {\ifvmode\else\booltrue{xpg@noset@groups}\fi}% RTL -> LTR
- }%
- \fi%
- \ifbool{xpg@noset@groups}{}{\xpg@set@group@aux}%
+ % Get real current options (incl. defaults)
+ \clist_clear_new:N \l_xpg_current_options
+ \prop_map_inline:cn {xpg@current@options@#2}
+ {
+ \clist_put_right:Nn \l_xpg_current_options {##1=##2}
+ }
+ % Store current options and language on stack
+ \polyglossia@stack@language:nn{\clist_use:Nn \l_xpg_current_options {,}}{#2}%
\selectlanguage[#1]{#2}%
}
-{\ifbool{xpg@noset@groups}{}{\xpg@unset@group@aux}}
+{%
+ % restore previous language in aux file and remove closed one from stack
+ \polyglossia@unstack@language:n{xpg@set@language@only@aux}%
+}
\newcommand{\setlocalhyphenmins}[3]{%
\xpg@ifdefined{#1}{%
@@ -2146,26 +2422,20 @@
% \setlanghyphenmins[options]{lang}{l}{r}
\newcommand*\setlanghyphenmins[4][]{%
% Check for real language name and options
- \edef\xpg@tmp@lang{#2}%
- \edef\xpg@tmp@opts{#1}%
- \ifcsdef{#2@alias@lang}{%
- \edef\xpg@tmp@lang{\csuse{#2@alias@lang}}%
- \ifcsdef{#2@alias@opts}{%
- \edef\xpg@tmp@opts{\csuse{#2@alias@opts},#1}%
- }{}%
- }{}%
+ \edef\xpg@tmp@opts{\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ \edef\xpg@tmp@lang{\xpg_alias_base_lang:n{#2}}
\bgroup
\polyglossia@error@iflangnotloaded:n{\xpg@tmp@lang}
\exp_args:Nne \setkeys{\xpg@tmp@lang}{\xpg@tmp@opts}%
% Store BCP-47 id of language
\tl_if_blank:nTF {\xpg@tmp@opts}{%
\ifcsundef{\csname xpg@tmp@lang\endcsname @gbcp47id}{%
- \csedef{tmp@bcp47id}{\exp_args:Nne\prop_item:Nn{\polyglossia@langsetup}{\xpg@tmp@lang /bcp47}}%
+ \csedef{tmp@bcp47id}{\prop_item:Ne{\polyglossia@langsetup}{\xpg@tmp@lang /bcp47}}%
}{%
\csedef{tmp@bcp47id}{\csuse{#2@gbcp47id}}%
}%
}{%
- \csedef{tmp@bcp47id}{\exp_args:Nne \prop_item:Nn{\polyglossia@langsetup}{\xpg@tmp@lang /bcp47}}%
+ \csedef{tmp@bcp47id}{\prop_item:Ne{\polyglossia@langsetup}{\xpg@tmp@lang /bcp47}}%
}%
\xpg@warning{id: \csuse{tmp@bcp47id}}%
\csgdef{\csname tmp@bcp47id\endcsname @hyphenmins}{{#3}{#4}}%
@@ -2197,15 +2467,15 @@
\edef\tmpa{\csuse{\csname tmp@bcp47id\endcsname @hyphenmins}}%
\expandafter\expandafter\expandafter\set@hyphenmins\tmpa\relax%
}
- \ifluatex
+ \sys_if_engine_luatex:T{
% Set \totalhyphenmin if specified
\prop_get:NxNTF \polyglossia@langsetup {#2/totalhyphenmin} \l_tmpa_tl
{
- \xpg@warning{totalhyphenmin: '\l_tmpa_tl'}
+ \xpg@info{totalhyphenmin: '\l_tmpa_tl'}
\expandafter\hyphenationmin \l_tmpa_tl%
}%
{}%
- \fi
+ }
}
% Babel previously compiled in hyphenrules into the kernel (via hyphen.cfg)
@@ -2217,37 +2487,17 @@
% supports language options and aliases.
\renewenvironment{hyphenrules}[2][]
{%
- % We usually embrace the switch in groups to keep the changes local.
- % We cannot do this if an LTR environmet starts in an RTL paragraph,
- % as bidi interferes here badly with its directionality smartness.
- \ifxetex
- \str_if_eq:eeT{\exp_args:Nne\prop_item:Nn{\polyglossia@langsetup}{\languagename/direction}}{RL}%
- {%
- \str_if_eq:eeTF{\prop_item:Nn{\polyglossia@langsetup}{#1/direction}}{RL}%
- {}% RTL -> RTL
- {\ifvmode\else\booltrue{xpg@noset@groups}\fi}% RTL -> LTR
- }%
- \fi%
- \ifbool{xpg@noset@groups}{}{\xpg@set@group@aux}%
% Check for real language name and options
- \edef\xpg@tmp@lang{#2}%
- \edef\xpg@tmp@opts{#1}%
- \ifcsdef{#2@alias@lang}{%
- \edef\xpg@tmp@lang{\csuse{#2@alias@lang}}%
- \ifcsdef{#2@alias@opts}{%
- \edef\xpg@tmp@opts{\csuse{#2@alias@opts},#1}%
- }{}%
- }{}%
- \tl_if_blank:nF {\xpg@tmp@opts}{%
- % Register the language options
- \polyglossia@set@lang@options:nn {\xpg@tmp@lang} {\xpg@tmp@opts}%
- }%
+ \edef\xpg@tmp@opts{\xpg_alias_add_to_option_i:nn{#2}{#1}}
+ \edef\xpg@tmp@lang{\xpg_alias_base_lang:n{#2}}
+ % Register the language options
+ \polyglossia@set@lang@options:nnn {\xpg@tmp@lang} {\xpg@tmp@opts} {@xpg@set@langvariant}%
% Now switch patterns
- \csuse@warn{\csuse{xpg@tmp@lang}@language}%
+ \__xpg_use_or_warn:c{\use:c{xpg@tmp@lang}@language}%
% And activate hyphenmins
\use@localhyphenmins[\xpg@tmp@opts]{\xpg@tmp@lang}%
}
-{\ifbool{xpg@noset@groups}{}{\xpg@unset@group@aux}}
+{}
\AtEndPreamble{%
\@ifpackageloaded{bidi}{%
@@ -2302,15 +2552,15 @@
% Set the LuaTeX renderer. As opposed to fontspec, we use Harfbuzz by default.
% This can be changed via the luatexrenderer package option.
-\ifluatex
- \exp_args:Nee \str_if_eq:nnF{\l_polyglossia_luatex_renderer}{none}
- {
- \xpg@info{Setting~ LuaTeX~ font~ renderer~ to~ \l_polyglossia_luatex_renderer}
- \exp_args:Nee \defaultfontfeatures{Renderer=\l_polyglossia_luatex_renderer}
- }
-\fi
+\sys_if_engine_luatex:T{
+ \str_if_eq:eeF{\l_polyglossia_luatex_renderer}{none}
+ {
+ \xpg@info{Setting~ LuaTeX~ font~ renderer~ to~ \l_polyglossia_luatex_renderer}
+ \exp_args:Ne \defaultfontfeatures{Renderer=\l_polyglossia_luatex_renderer}
+ }
+}
-\bool_if:nTF \l_polyglossia_verbose_bool {} {
+\bool_if:nF \l_polyglossia_verbose_bool {
\gdef\@latex@info#1{\relax}% no latex info
\gdef\@font@info#1{\relax}% no latex font info
\gdef\@font@warning#1{\relax}% no latex font warnings
@@ -2318,9 +2568,9 @@
\gdef\xpg@info#1{\relax}% no polyglossia info
}
-\bool_if:nTF \l_polyglossia_localmarks_bool {
+\bool_if:nT \l_polyglossia_localmarks_bool {
\polyglossia@enable@local@marks:
-}{}
+}
% compatibility
\newif\ifsystem@babelshorthands