diff options
author | Karl Berry <karl@freefriends.org> | 2023-10-13 20:50:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-10-13 20:50:32 +0000 |
commit | 8590a940b4664473691cf2e7c0133bdf7855a067 (patch) | |
tree | ad56cdcb82ecb3e222e1cd50ad85216c5863ed20 /Master/texmf-dist/source/generic | |
parent | c45b87421086b64f7d64052b4c2eb42f7490a272 (diff) |
babel-greek (13oct23)
git-svn-id: svn://tug.org/texlive/trunk@68532 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic')
-rw-r--r-- | Master/texmf-dist/source/generic/babel-greek/babel-greek.dtx | 157 |
1 files changed, 91 insertions, 66 deletions
diff --git a/Master/texmf-dist/source/generic/babel-greek/babel-greek.dtx b/Master/texmf-dist/source/generic/babel-greek/babel-greek.dtx index bc3060207e9..05ac6693f18 100644 --- a/Master/texmf-dist/source/generic/babel-greek/babel-greek.dtx +++ b/Master/texmf-dist/source/generic/babel-greek/babel-greek.dtx @@ -26,7 +26,7 @@ % and covered by LPPL is defined by the unpacking script (babel-greek.ins) % which is part of the package. % \fi -% \CheckSum{1701} +% \CheckSum{1694} % % \iffalse % Tell the \LaTeX\ system who we are and write an entry on the @@ -37,7 +37,7 @@ %<code>\ProvidesLanguage{greek} %\fi %\ProvidesFile{babel-greek.dtx} - [2023/08/18 1.14 Greek support for the babel system] + [2023/10/13 1.15 Greek support for the babel system] %\iffalse %% File `babel-greek.dtx' %% Greek language Definition File @@ -210,8 +210,11 @@ % % \changes{babel-greek-1.12}{2023/03/04}{ % New modifiers \Lopt{local-LGR-fixes} and \Lopt{no-LGR-fixes}.} -% \changes{babel-greek-1.14}{2023-08-18}{ +% \changes{babel-greek-1.14}{2023/08/18}{ % New modifier \Lopt{local-MakeUppercase-fixes}.} +% \changes{babel-greek-1.15}{2023/10/13}{ +% Rename modifier \Lopt{local-MakeUppercase-fixes} to +% \Lopt{no-MakeUppercase-fixes}.} % % All language attributes may also be used as modifiers, e.g. % \begin{verbatim} @@ -231,7 +234,7 @@ % Check for problems with enumerations in Greek text parts and with % Roman and Greek numerals everywhere (especially in the ToC). % -% The \hyperref[sec:MakeUppercase-fixes]{\Lopt{local-MakeUppercase-fixes}} +% The \hyperref[sec:MakeUppercase-fixes]{\Lopt{no-MakeUppercase-fixes}} % modifier skips the mapping of standard accents to ``capital'' accents % in section~\ref{sec:MakeUppercase-fixes}. % @@ -433,6 +436,11 @@ % \begin{macrocode} \addto\extrasgreek{\languageshorthands{greek}} % \end{macrocode} +% An auxiliary macro allows to test whether a macro holds the string `LGR' +% with |\ifx|: +% \begin{macrocode} +\def\bbl@greek@LGR{LGR} +% \end{macrocode} % % % \subsection{Hyphenation patterns \label{sec:hyphenation-patterns}} @@ -608,8 +616,7 @@ % active and inserts an \emph{erotimatiko} also with LGR encoded fonts: % \begin{macrocode} \bbl@declare@ttribute{greek}{keep-semicolon}{% - \def\bbl@tempa{LGR} - \ifx\greekfontencoding\bbl@tempa + \ifx\greekfontencoding\bbl@greek@LGR \ProvideTextCommandDefault{\textsemicolon}{;} \ProvideTextCommand{\textsemicolon}{LGR}{\texterotimatiko} \initiate@active@char{;} @@ -622,14 +629,14 @@ % % \subsection{Report unsupported modifiers} % -% \changes{babel-greek-1.13.2}{2023-06-01}{Warn of unsupported modifiers.} +% \changes{babel-greek-1.13.2}{2023/06/01}{Warn of unsupported modifiers.} % % Test for unsupported (or misspelled) \hyperref[sec:modifiers]{modifiers} % (code contributed by Javier Bezos). % \begin{macrocode} \def\bbl@greek@modifiers{,% polutoniko,polytonic,ancient,keep-semicolon,% - local-LGR-fixes,no-LGR-fixes,local-MakeUppercase-fixes,} + local-LGR-fixes,no-LGR-fixes,no-MakeUppercase-fixes,} \ifx\BabelModifiers\relax\else \bbl@foreach\BabelModifiers{% \@expandtwoargs\in@{,#1,}{\bbl@greek@modifiers} @@ -687,31 +694,35 @@ \else \providecommand*{\greekfontencoding}{LGR} \providecommand*{\bbl@greek@fontencdef}{lgrenc} - % TODO the more generic version fails :( - % \edef\bbl@greek@fontencdef{\lowercase{\greekfontencoding}enc} \fi % \end{macrocode} +% TODO: Why does the more generic version\\ +% | \edef\bbl@greek@fontencdef{\lowercase{\greekfontencoding}.enc}|\\ +% fail when used in |\ifl@aded|? % \end{macro} % % \subsubsection{Ensure loading of Greek font encoding definitions. % \label{load-greek-font-encoding-definitions}} % % If the \emph{encoding definition file} for |\greekfontencoding| is not yet -% loaded, do this now: +% loaded, do this now. +% (Using |\RequirePackage| fails as we are in an ``Options Section''.) +% TODO: set with |\AtEndOfPackage|? +% (All definitions requiring the font encoding must be delayed as well!) % \begin{macrocode} -\@ifl@aded{def}{\bbl@greek@fontencdef}{} -{% else - \InputIfFileExists{\bbl@greek@fontencdef .def}{} - {% else - \bbl@error{Font support for the Greek script missing.\\ - babel-greek can't typeset Greek.\\ - Install the "greek-fontenc" package\\ - or use XeTeX/LuaTeX with polyglossia.} - {I can't find the \bbl@greek@fontencdef .def file - for the Greek fonts (encoding \greekfontencoding)} - \@@end +\@ifl@aded{def}{\bbl@greek@fontencdef} + {} + {\InputIfFileExists{\bbl@greek@fontencdef .def} + {} + {\bbl@error{Font support for the Greek script missing.\\ + babel-greek can't typeset Greek.\\ + Install the "greek-fontenc" package\\ + or use XeTeX/LuaTeX with polyglossia.} + {I can't find the \bbl@greek@fontencdef .def file + for the Greek fonts (encoding \greekfontencoding)} + \@@end + } } -} % \end{macrocode} % If the PU font encoding is defined (by \pkgref{hyperref}), load extended % Greek support for it. Do this in the |\AtBeginDocument| hook because @@ -734,8 +745,8 @@ \makeatletter \InputIfFileExists{puenc-greek.def}% {}% - {\bbl@warning{I cannot find the "puenc" Greek fixes - from "greek-fontenc".}% + {\bbl@warning{I cannot find the Greek fixes for PDF strings + ("punec-greek.def" from "greek-fontenc").}% }% \RestoreAtCatcode }% @@ -745,6 +756,22 @@ % \end{macrocode} % % \subsubsection{Font encoding switches \label{sec:font-encoding-switches}} +% +% Add font encoding switches (see below) to the language hooks +% (cf.\ section~\ref{sec:language-hooks}) to ensure a font encoding +% supporting the Greek script is used in Greek text parts: +% \changes{greek-1.5}{2013/06/21}{LGR not used with XeTeX/LuaTeX.} +% \changes{babel-greek-1.08}{2013/11/27}{ +% Use EU1 or EU2 for Latin script if available} +% \changes{babel-greek-1.11}{2020/11/20}{Save/restore previous font encoding +% instead of switching to \cs{latinencoding} when leaving Greek.} +% \begin{macrocode} +\addto\extrasgreek{% + \let\BabelGreekPreviousFontEncoding\encodingdefault + \greekscript} +\addto\noextrasgreek{\BabelGreekRestoreFontEncoding} +% \end{macrocode} +% % \begin{macro}{\greekscript} % The TextCommand\footnote{See % \href{https://www.latex-project.org/help/documentation/fntguide.pdf} @@ -775,12 +802,14 @@ % \end{macro} % \begin{macro}{\BabelGreekRestoreFontEncoding} % The declaration |\BabelGreekRestoreFontEncoding| changes the font encoding -% to the value it had before the switch to the Greek language. It does -% nothing, if the language switch did not trigger a font encoding switch. +% to the value of |\encodingdefault| before the switch to the Greek language. +% It does nothing, if there was no font encoding change when entering Greek. % \changes{babel-greek-1.12}{2023/03/04}{New macro.} +% \changes{babel-greek-1.15}{2023/10/13}{ +% Do not ``restore'' LGR when leaving Greek.} % \begin{macrocode} \def\BabelGreekRestoreFontEncoding{% - \ifx\cf@encoding\BabelGreekPreviousFontEncoding + \ifx\encodingdefault\BabelGreekPreviousFontEncoding \else \let\encodingdefault\BabelGreekPreviousFontEncoding \fontencoding{\encodingdefault}\selectfont @@ -788,21 +817,18 @@ } % \end{macrocode} % \end{macro} -% Add font encoding switches to the language hooks -% (cf.\ section~\ref{sec:language-hooks}) to ensure a font encoding -% supporting the Greek script is used in Greek text parts: -% \changes{greek-1.5}{2013/06/21}{LGR not used with XeTeX/LuaTeX.} -% \changes{babel-greek-1.08}{2013/11/27}{ -% Use EU1 or EU2 for Latin script if available} -% \changes{babel-greek-1.11}{2020/11/20}{Save/restore previous font encoding -% instead of switching to \cs{latinencoding} when leaving Greek.} -% \changes{babel-greek-1.12}{2023/03/04}{Save previous font encoding -% in \cs{BabelGreekPreviousFontEncoding}.} +% Exception: don't keep LGR if it was the initial encoding +% as it is clearly unsuited for non-Greek texts. +% If Greek is the main language, |\extrasgreek| is called before +% |\begin{document}| --- we can check the saved value of the previous +% font encoding and replace LGR with the default generic text font encoding. +% ^^A TODO: Use the font encoding detection from \cs{ensureascii}? % \begin{macrocode} -\addto\extrasgreek{% - \let\BabelGreekPreviousFontEncoding\cf@encoding - \greekscript} -\addto\noextrasgreek{\BabelGreekRestoreFontEncoding} +\AtBeginDocument{ + \ifx\BabelGreekPreviousFontEncoding\bbl@greek@LGR + \let\BabelGreekPreviousFontEncoding\latinencoding + \fi +} % \end{macrocode} % % \subsubsection{Additional commands for the LGR font encoding} @@ -912,11 +938,15 @@ % \begin{macrocode} \ProvideTextCommandDefault{\EnsureStandardFontEncoding}{\@firstofone} \ProvideTextCommand{\EnsureStandardFontEncoding}{LGR}[1]{% - \ensureascii{#1}} - \AtBeginDocument{\@ifpackageloaded{hyperref} - {\pdfstringdefDisableCommands{% - \let\EnsureStandardFontEncoding\@firstofone}} - {}} + \ensureascii{#1} + } + \AtBeginDocument{% + \@ifpackageloaded{hyperref} + {\pdfstringdefDisableCommands{% + \let\EnsureStandardFontEncoding\@firstofone} + } + {} + } % \end{macrocode} % \end{macro} % End the LGR additions block: @@ -966,8 +996,7 @@ % Let it use the new defined \emph{TextCommand} |\textampersand| % in text mode. % \begin{macrocode} -\def\bbl@tempa{LGR} -\ifx\greekfontencoding\bbl@tempa +\ifx\greekfontencoding\bbl@greek@LGR \def\bbl@greek@roman#1{\expandafter\EnsureStandardFontEncoding% \expandafter{\romannumeral#1}} \def\bbl@greek@Roman#1{\expandafter\EnsureStandardFontEncoding% @@ -1548,8 +1577,7 @@ % without it becoming a $\varsigma$. % Because of this we make sure its lowercase code is not changed. % \begin{macrocode} -\def\bbl@tempa{LGR} -\ifx\greekfontencoding\bbl@tempa +\ifx\greekfontencoding\bbl@greek@LGR \addto\extrasgreek{% \babel@savevariable{\lccode`v}\lccode`v=`v% \babel@savevariable{\lccode`\'}\lccode`\'=`\'% @@ -1640,10 +1668,12 @@ % are now in greek-euenc.def (the polyglossia version has bugs).} % \changes{babel-greek-1.12}{2023/03/04}{ % Only change uccodes if LaTeX is older than 2022/06/01.} -% \changes{babel-greek-1.13.2}{2023-06-01}{ +% \changes{babel-greek-1.13.2}{2023/06/01}{ % \cs{MakeUppercase} fix for transliteration input.} -% \changes{babel-greek-1.14}{2023-08-18}{ +% \changes{babel-greek-1.14}{2023/08/18}{ % \cs{MakeUppercase} fix for standard accent macros.} +% \changes{babel-greek-1.15}{2023/10/13}{ +% Fix standard accent macros also with pre-2022 \cs{MakeUppercase}.} % In Greek typographical praxis, % letters drop accents (eccept dialytika) and breathings in % UPPERCASE. This is not cared for by the Unicode standard. @@ -1658,21 +1688,17 @@ % macros. % Font-encoding specific definitions for the ``capital'' accent macros % in \pkgref{greek-fontenc}~$\ge 2.4$ suppress them on Greek letters. -% The \Lopt{local-MakeUppercase-fixes} modifier can be used to skip this step +% The \Lopt{no-MakeUppercase-fixes} modifier can be used to skip this step % (cf. section~\ref{sec:modifiers}). % \begin{macrocode} -\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} % new in 2020 -\bbl@xin@{,local-MakeUppercase-fixes,}{,\BabelModifiers,}% +\bbl@xin@{,no-MakeUppercase-fixes,}{,\BabelModifiers,}% \ifin@ \else - \IfFormatAtLeastTF{2022/06/01} - {\ProvideTextCommandDefault{\accACUTE}{\@tabacckludge'} - \ProvideTextCommandDefault{\accGRAVE}{\@tabacckludge`} - \ProvideTextCommandDefault{\accTILDE}{\@tabacckludge~} - \ProvideTextCommandDefault{\accDIAERESIS}{\@tabacckludge"} - \addto\@uclclist{\'\accACUTE \`\accGRAVE \~\accTILDE \"\accDIAERESIS}% - } - {} + \ProvideTextCommandDefault{\accACUTE}{\@tabacckludge'} + \ProvideTextCommandDefault{\accGRAVE}{\@tabacckludge`} + \ProvideTextCommandDefault{\accTILDE}{\@tabacckludge~} + \ProvideTextCommandDefault{\accDIAERESIS}{\@tabacckludge"} + \addto\@uclclist{\'\accACUTE \`\accGRAVE \~\accTILDE \"\accDIAERESIS}% \fi % \end{macrocode} % Drop diacritics also with ``input ligatures'' defined in LGR fonts: @@ -1684,8 +1710,7 @@ % The optional ``locale'' argument |[el]| restricts the mapping to Greek % text parts. % \begin{macrocode} -\def\bbl@tempa{LGR} -\ifx\greekfontencoding\bbl@tempa +\ifx\greekfontencoding\bbl@greek@LGR \ifdefined\DeclareUppercaseMapping % new in 2023 % \DeclareUppercaseMapping[el]{"1FBE}{\prosgegrammeni}% \DeclareUppercaseMapping[el]{"0027}{}% ' |