diff options
author | Karl Berry <karl@freefriends.org> | 2020-12-08 22:04:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-12-08 22:04:48 +0000 |
commit | 50911a5d21723effb8f23757a309ee5993ccfd11 (patch) | |
tree | 1b98e4db5a2aceb1acf93531c8e41605ddcdad42 /Master/texmf-dist/source | |
parent | aed1181dbd8c3dbcc38758e26eecea1bf39b1a22 (diff) |
polyglossia (7dec20)
git-svn-id: svn://tug.org/texlive/trunk@57098 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx | 219 |
1 files changed, 196 insertions, 23 deletions
diff --git a/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx b/Master/texmf-dist/source/latex/polyglossia/polyglossia.dtx index bcc694b3bc7..12ab0b4ce0e 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.50a +# THE POLYGLOSSIA PACKAGE v1.51 ## Multilingual typesetting with XeLaTeX and LuaLaTeX This package provides an alternative to Babel for users of XeLaTeX and LuaLaTeX. @@ -1350,6 +1350,13 @@ to track the issues and follow progress. % \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 \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}). +% 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{czech}\label{czech} @@ -1467,7 +1474,7 @@ to track the issues and follow progress. % enabled, spacing in typewriter context is the same as with roman and sans % serif font, depending on the \xpgvalue{autospacing} and % \xpgvalue{autospaceguillemets} settings (note that this was the default up -% to v.~1.44). +% to v.~1.44). % \item \xpgboolkeyfalse{frenchfootnote} % If \xpgvalue{true}, footnotes start with a non-superscripted number % followed by a dot, as common in French typography. Note that this might @@ -1479,6 +1486,14 @@ to track the issues and follow progress. % in French typography. Note that this option is only functional (by % design) if French is the main language. Also, it might interfere with % list packages such as \pkg{enumitem}. +% \item \xpgboolkeytrue[1.51]{frenchpart} +% By default, \pkg{polyglossia} modifies part headings to match French conventions +% (\emph{Première partie} rather than \emph{Partie I}). Next to the standard classes, +% specifics of \pkg{KOMA-script}, \pkg{memoir} and the \pkg{titlesec} package are +% taken into account. With other classes or packages, redefinition might fail if these +% have particular part settings. +% In such case, or if you don't want the redefinition, you can switch off the feature +% by passing \textit{false} to this option. % \item \xpgcodekey[1.46]{itemlabels}¦\textemdash¦ % If \emph{frenchitemlabels} is true, you can customize here the used item % label of all levels. @@ -2686,7 +2701,7 @@ to track the issues and follow progress. % \subsection{polyglossia.sty} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{polyglossia}[2020/10/15 v1.50a +\ProvidesPackage{polyglossia}[2020/12/08 v1.51 Modern multilingual typesetting with XeLaTeX and LuaLaTeX] \RequirePackage{etoolbox} \RequirePackage{makecmds} @@ -2697,19 +2712,23 @@ to track the issues and follow progress. \RequirePackage{expl3} \RequirePackage{l3keys2e} \RequirePackage{xparse} -\RequirePackage{filehook} + +% fontspec now uses LaTeX3 packages such as expl3, so we need this: +\ExplSyntaxOn + +% 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}}% +} % correct a bug in tracklang -\AtBeginOfPackageFile*{tracklang}{ +\xpg@at@package{tracklang}{file/after/tracklang.sty}{% \@ifpackagelater{tracklang}{2019/08/30}{}{\global\def\AddTrackedLangage{\AddTrackedLanguage}} } -% fontspec now uses LaTeX3 packages such as expl3, so we need this: -\ExplSyntaxOn - %% This is for compatibility with Babel-aware package: -\cslet{ver@babel.sty}{\@empty} % this "fakes" babel \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 @@ -2855,7 +2874,7 @@ to track the issues and follow progress. {}% {\xpg@error{Unknown~ language~ direction~ #1 ~(base~ wrapper)}}% } -\AtEndOfPackageFile*{bidi}{% +\xpg@at@package{bidi}{package/after/bidi}{% \ExplSyntaxOn% \cs_gset_nopar:Nn{\polyglossia@setpardirection:n}{% \str_case_e:nnTF{#1}{% @@ -2875,7 +2894,7 @@ to track the issues and follow progress. }% \ExplSyntaxOff% } -\AtEndOfPackageFile*{luabidi}{% +\xpg@at@package{luabidi}{package/after/luabidi}{% \ExplSyntaxOn% \cs_gset_nopar:Nn{\polyglossia@setpardirection:n}{% \str_case_e:nnTF{#1}{% @@ -3840,6 +3859,16 @@ to track the issues and follow progress. \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}% { \polyglossia_load_lang_definition:nn{#1}{#2} @@ -8408,7 +8437,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages \def\prefacename{Parathenia}% \def\chaptername{Kapitulli}% \def\appendixname{Shtesa}% - \def\contentsname{Përmbajta}% + \def\contentsname{Përmbajtja}% \def\listfigurename{Figurat}% \def\listtablename{Tabelat}% \def\indexname{Indeksi}% @@ -10720,12 +10749,18 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages % BCP-47 compliant aliases \setlanguagealias*{croatian}{hr} +\ifluatex + \RequirePackage{luavlna} +\fi + \define@boolkey{croatian}[croatian@]{babelshorthands}[true]{} \define@boolkey{croatian}[croatian@]{disableligatures}[true]{} +\define@boolkey{croatian}[croatian@]{splithyphens}[true]{} + % Register default options -\xpg@initialize@gloss@options{croatian}{babelshorthands=false,disableligatures=false} +\xpg@initialize@gloss@options{croatian}{babelshorthands=false,disableligatures=false,splithyphens=true} \ifsystem@babelshorthands \setkeys{croatian}{babelshorthands=true} @@ -10739,6 +10774,19 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages \shorthandoff{"}% }{} +\def\croatian@@splhyphen#1{% + \ifnum\hyphenchar \font>0% + \kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}% + \nobreak\hskip\z@% + \else% + #1% + \fi% +} + +\def\croatian@splhyphen{% + \croatian@@splhyphen{-}% +} + \def\croatian@shorthands{% \bbl@activate{"}% \def\language@group{croatian}% @@ -10768,6 +10816,32 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}% } +\ifxetex + % splithyphens + \newXeTeXintercharclass\croatian@hyphen % - + \newXeTeXintercharclass\croatian@nonsyllabicpreposition% +\fi + +\def\croatian@hyphens{% + \ifluatex + \AfterPreamble{\enablesplithyphens{croatian}}% + \else + \XeTeXinterchartokenstate=1 + \XeTeXcharclass `\- \croatian@hyphen + \XeTeXinterchartoks \z@ \croatian@hyphen = {\croatian@@splhyphen}% "-" -> "\croatian@@splhyphen-" + % necessary if used together with vlna: + \XeTeXinterchartoks \croatian@nonsyllabicpreposition \croatian@hyphen = {\croatian@@splhyphen}% "-" -> "\croatian@@splhyphen-" + \fi% +} + +\def\nocroatian@hyphens{% + \ifluatex + \AfterPreamble{\disablesplithyphens{croatian}}% + \else + \XeTeXcharclass `\- \z@ + \fi% +} + \newcommand*\hr@charifavailable[2]{% \ifcroatian@disableligatures \bgroup#2\egroup% @@ -10872,14 +10946,17 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages \def\noextras@croatian{% \ifcroatian@babelshorthands\nocroatian@shorthands\fi% + \nocroatian@hyphens% } \def\blockextras@croatian{% \ifcroatian@babelshorthands\croatian@shorthands\fi% + \ifcroatian@splithyphens\croatian@hyphens\else\nocroatian@hyphens\fi% } \def\inlineextras@croatian{% \ifcroatian@babelshorthands\croatian@shorthands\fi% + \ifcroatian@splithyphens\croatian@hyphens\else\nocroatian@hyphens\fi% } % \end{macrocode} @@ -12595,6 +12672,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages \define@boolkey{french}[french@]{autospacing}[true]{} \french@autospacingtrue +\define@boolkey{french}[french@]{frenchpart}[true]{} +\french@frenchparttrue + \newif\iffrench@autospaceguillemets \define@boolkey{french}[french@]{autospaceguillemets}[true]{} \french@autospaceguillemetstrue @@ -12694,7 +12774,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages \let\ttfamily\french@ttfamilyORI } -\def\xpg@french@thinsp{\kern 0.5\fontdimen2\font} +\def\xpg@french@thinsp{\kern 0.5\fontdimen2\font\nobreak\hskip\z@skip} \def\french@punctuation{% \lccode"2019="2019 @@ -12817,14 +12897,11 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages \def\indexname{Index}% \def\figurename{\textsc{Fig.}}% \def\tablename{\textsc{Tab.}}% - \def\@Fpt{\ifcase\value{part}\or Première\or Deuxième\or - Troisième\or Quatrième\or Cinquième\or Sixième\or - Septième\or Huitième\or Neuvième\or Dixième\or Onzième\or - Douzième\or Treizième\or Quatorzième\or Quinzième\or - Seizième\or Dix-septième\or Dix-huitième\or Dix-neuvième\or - Vingtième\fi\space}% - \def\thepart{\@Fpt partie}% - \def\partname{}% + \iffrench@frenchpart + \def\partname{partie}% + \else + \def\partname{Partie}% + \fi% \def\pagename{page}% \def\seename{\emph{voir}}% \def\alsoname{\emph{voir aussi}}% @@ -12844,9 +12921,83 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages décembre\fi \space \number\year}} +\def\xpg@french@part{\ifcase\value{part}\or Première\or Deuxième\or% + Troisième\or Quatrième\or Cinquième\or Sixième\or% + Septième\or Huitième\or Neuvième\or Dixième\or Onzième\or% + Douzième\or Treizième\or Quatorzième\or Quinzième\or% + Seizième\or Dix-septième\or Dix-huitième\or Dix-neuvième\or% + Vingtième\fi}% + +\def\french@capsformat{% + % Change part heading + % With titlesec + \ifcsdef{titleformat}{% + \ifcsdef{@part}{% + \let\xpg@save@part@format\@part% + \patchcmd{\@part}% + {\partname\nobreakspace\thepart}% + {\xpg@french@part\nobreakspace\partname}% + {}% + {\xpg@warning{Failed to patch part for French}}% + }{}% + }{% (not \ifdefined\titleformat) + % With KOMA + \ifcsdef{sectionformat}{% + \ifcsdef{partformat}{% + \let\xpg@save@part@format\partformat% + \renewcommand{\partformat}{\xpg@french@part~\partname}% + }{}% + }{% (not \ifdefined\sectionformat) + % With memoir + \ifcsdef{@memptsize}{% + \ifcsdef{@part}{% + \let\xpg@save@part@format\@part% + \patchcmd{\@part}{\printpartname \partnamenum \printpartnum}% + {\partnamefont\xpg@french@part\partnamenum\printpartname}% + {}% + {\xpg@warning{Failed to patch part for French}}% + }{}% + }{% (not \ifdefined\@memptsize) + % With standard classes + \ifcsdef{@part}{% + \let\xpg@save@part@format\@part% + \patchcmd{\@part}% + {\partname\nobreakspace\thepart}% + {\xpg@french@part\nobreakspace\partname}% + {}% + {\xpg@warning{Failed to patch part for French}}% + }{}% (end \ifdefined\@part) + }% (end \ifdefined\@memptsize) + }% (end \ifdefined\sectionformat) + }% (end \ifdefined\titleformat) +} + +\def\nofrench@capsformat{% + % Reset chapter and part heading + \ifcsdef{titleformat}{% + % With titlesec + \ifcsdef{xpg@save@part@format}{% + \let\@part\xpg@save@part@format + }{}% + }{% (not \ifdefined\titleformat) + \ifcsdef{sectionformat}{% + % With KOMA + \ifcsdef{xpg@save@part@format}{% + \let\partformat\xpg@save@part@format + }{}% + }{% + % With memoir and standard classes + \ifcsdef{xpg@save@part@format}{% + \let\@part\xpg@save@part@format + }{}% + }% (end \ifdefined\sectionformat) + }% (end \ifdefined\titleformat) +} + \def\noextras@french{% \nofrench@punctuation% \nofrench@fontsetup% + \nofrench@capsformat% } \def\blockextras@french{% @@ -12854,6 +13005,9 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages \french@punctuation% \fi \french@fontsetup% + \iffrench@frenchpart + \french@capsformat% + \fi% } \def\inlineextras@french{% @@ -14383,7 +14537,7 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages % Bidi inserts an RTL mark (0x200f) between number and number separator (- .), % forcing numbers to RTL. This is wrong for Hebrew. % So we defunc the respective command. - \renewcommand*{\DigitsDotDashInterCharToks}{} + \renewcommand*{\DigitsDotDashInterCharToks}{}% \fi% } @@ -24997,6 +25151,25 @@ polyglossia.newloader_loaded_languages = newloader_loaded_languages % % \iffalse %<*Changelog> +1.51 (08-12-2020) + +New features: + * New option "frenchpart" for French (#458). + * New option "splithyphens" for Croatian (#454). + +Bug fixes: + + * Use new LaTeX core hooks rather than filehook package. This fixes + a recent breakage of filehook with other external packages (#453). + * Remove very old code that pretends polyglossia is babel (#455). + * Fix spelling of Albanian contentsname (#456). + * Fix part heading modification in French (#458). + * Fix extra space in Hebrew (#459). + * Register main polyglossia language earlier (#461). + * Allow for hyphenations in words following opening guillemet in French + with XeTeX (#462). + + 1.50a (15-10-2020) Bug fixes: |