diff options
Diffstat (limited to 'macros/latex/contrib/babel-contrib/greek/babel-greek.dtx')
-rw-r--r-- | macros/latex/contrib/babel-contrib/greek/babel-greek.dtx | 257 |
1 files changed, 145 insertions, 112 deletions
diff --git a/macros/latex/contrib/babel-contrib/greek/babel-greek.dtx b/macros/latex/contrib/babel-contrib/greek/babel-greek.dtx index 7cf57237f7..bc3060207e 100644 --- a/macros/latex/contrib/babel-contrib/greek/babel-greek.dtx +++ b/macros/latex/contrib/babel-contrib/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{1675} +% \CheckSum{1701} % % \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-06-01 1.13.2 Greek support for the babel system] + [2023/08/18 1.14 Greek support for the babel system] %\iffalse %% File `babel-greek.dtx' %% Greek language Definition File @@ -105,8 +105,6 @@ % \cs{textlatin} and fixed \cs{latinencoding}.} % \changes{babel-greek-1.09i}{2020/02/28}{ % Fix accent in \cs{seename} and \cs{alsoname}.} -% \changes{babel-greek-1.12}{2023/03/04}{ -% Update and restructure documentation.} % % \title{Babel support for the Greek language} % \author{Apostolos Syropoulos, Günter Milde} @@ -114,7 +112,7 @@ % % Babel-greek is a contributed package providing support for the Greek % language and script via the \pkgref{babel} system. -% See the \href{README.html}{README} file for an overwiew of the +% See \href{babel-greek-doc.html}{babel-greek-doc} for an overwiew of the % \pkg{babel-greek} package and links to requirements and related packages. % % The file \file{\filename}\footnote{ @@ -210,17 +208,17 @@ % % \subsection{Modifiers \label{sec:modifiers}} % +% \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}{ +% New modifier \Lopt{local-MakeUppercase-fixes}.} +% % All language attributes may also be used as modifiers, e.g. % \begin{verbatim} % \usepackage[greek.polutoniko,english]{babel}\end{verbatim} -% In addition, there are two modifiers that cannot be set with +% In addition, there are modifiers that cannot be set with % |\languageattribute|. % -% \changes{babel-greek-1.12}{2023/03/04}{ -% New modifiers \Lopt{local-LGR-fixes} and \Lopt{no-LGR-fixes}.} -% -% Some workarounds for the non-standard LGR font encoding may have -% serious side-effects. % The \hyperref[sec:lgr-redefinitions]{\Lopt{local-LGR-fixes}} modifier % restricts the re-definitions in section~\ref{sec:lgr-redefinitions} % to text parts using the Greek language. @@ -232,8 +230,14 @@ % and using Xe/LuaTeX with Unicode fonts is not an option. % 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}} +% modifier skips the mapping of standard accents to ``capital'' accents +% in section~\ref{sec:MakeUppercase-fixes}. +% % These modifiers are provisional, naming and behaviour may change. % +% % \subsection{Language hooks \label{sec:language-hooks}} % % \DescribeMacro\extrasgreek @@ -524,7 +528,11 @@ % modern Greek with ``polytonic'' spelling can also be % selected via the dummy language \Lopt{polutonikogreek}. % However, it is not possible to use both options, -% \Lopt{greek} and \Lopt{polutonikogreek} in one document. +% \Lopt{greek} and \Lopt{polutonikogreek} in one document.^^A +% \footnote{Use of more than one Greek orthograpies in one document +% is possible with \cs{babelprovide}. +% However, there are side-effects. +% See the example in \file{test-greek.tex}.} % We also define aliases to allow language switching commands using % the language name |polutonikogreek|: % \changes{greek-1.3f}{1999/09/29}{ @@ -619,8 +627,9 @@ % 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,} -\addto\bbl@greek@modifiers{local-LGR-fixes,no-LGR-fixes,} +\def\bbl@greek@modifiers{,% + polutoniko,polytonic,ancient,keep-semicolon,% + local-LGR-fixes,no-LGR-fixes,local-MakeUppercase-fixes,} \ifx\BabelModifiers\relax\else \bbl@foreach\BabelModifiers{% \@expandtwoargs\in@{,#1,}{\bbl@greek@modifiers} @@ -1228,7 +1237,7 @@ % % \begin{macro}{\dategreek} % The macro |\dategreek| redefines the command |\today| to -% produce greek dates. The name of the month is produced +% produce Greek dates. The name of the month is produced % by the macro |\gr@month| since it is also needed in the definition % of the macro |\Grtoday|. % \changes{greek-1.1a}{1997/03/03}{Fixed typo, \texttt{Oktwbr'iou} @@ -1245,9 +1254,10 @@ % % \begin{macro}{\Grtoday} % \changes{greek-1.1}{1996/10/28}{Added macro \cs{Grtoday}} -% The macro |\Grtoday| produces the current date, only that the -% month and the day are shown as greek numerals instead of arabic -% as it is usually the case. +% The macro |\Grtoday| produces the current date, only that the +% month and the day are shown as greek numerals instead of arabic +% as it is usually the case. (The \pkgref{teubner} package defines +% a matching lowercase version \cs{grtoday}.) % \begin{macrocode} \def\Grtoday{% \expandafter\Greeknumeral\expandafter{\the\day}\space @@ -1506,34 +1516,24 @@ % % \subsection{Character codes \label{sec:character-codes}} % -% Greek letters drop diacritics (eccept dialytika and sub-iota) in -% UPPERCASE. This is not cared for by the Unicode standard. -% -% Up to the June 2022 LaTeX release, this could be corrected by -% defining |\lccode| and |\uccode| values. The June 2023 release introduced -% the |\DeclareUppercaseMapping| command as a replacement configuration -% option. -% -% The file \file{tuenc-greek.def} from \pkg{greek-fontenc} -% contains the required |\lccode| and |\uccode| corrections from the -% \pkgref{xgreek} package by Apostolos Syropoulos. It is loaded if the -% Greek font encoding is TU (i.e. with XeTeX/LuaTeX), -% see section~\ref{load-greek-font-encoding-definitions}. +% \changes{greek-1.1c}{1997/04/30}{fixed two typos} +% \changes{greek-1.1e}{1997/10/12}{Added lowercase code for v} +% \changes{greek-1.2}{1997/10/28}{Definitions for ``modern'' Greek are +% now the definitions of ``polutoniko'' Greek} +% \changes{greek-1.2}{1997/10/28}{Added lowercase codes for ``modern'' +% greek} +% \changes{greek-1.3e}{1999/09/24}{\cs{extrasgreek} and +% \cs{extraspolutonikogreek} should be complementary} +% \changes{babel-greek-1.09}{2014/07/20}{Added lc codes for chars 128 to 255} +% \changes{babel-greek-1.09b}{2014/09/18}{Remove spurious whitespace from +% `extrasgreek' definition (report Eike Schmidt).} +% \changes{babel-greek-1.09e}{2015/11/27}{Fix bug in lccode-setting loop +% (patch by Enrico Gregorio).} +% \changes{babel-greek-1.12}{2023/03/04}{ +% Only change uc/lccodes if \cs{greekfontencoding} is LGR.} % -% If the Greek font encoding is LGR, configuration is done here because -% character code changes must be restricted to text parts using the -% LGR encoding. -% \changes{greek-1.5}{2013/06/21}{Support XeTeX/LuaTeX.} -% \changes{babel-greek-1.09d}{2015/07/06}{uc-/lccode corrections from xgreek -% are now in greek-euenc.def (the polyglossia version has bugs).} -% \changes{babel-greek-1.12}{2023/03/04}{% -% Only change uc/lccodes if \cs{greekfontencoding} is LGR.} -% \begin{macrocode} -\def\bbl@tempa{LGR} -\ifx\greekfontencoding\bbl@tempa -% \end{macrocode} % In order to get correct hyphenation we need to set the lower case -% code of a number of characters. +% code for all characters that can be part of a word. % % In LGR encoded fonts, diacritics can be obtained using Knuth's % ligature mechanism (see usage.pdf). This means that the characters @@ -1547,18 +1547,9 @@ % ligature mechanism so that it is possible to typeset an isolated $\sigma$ % without it becoming a $\varsigma$. % Because of this we make sure its lowercase code is not changed. -% \changes{greek-1.1c}{1997/04/30}{fixed two typos} -% \changes{greek-1.1e}{1997/10/12}{Added lowercase code for v} -% \changes{greek-1.2}{1997/10/28}{Definitions for ``modern'' Greek are -% now the definitions of ``polutoniko'' Greek} -% \changes{greek-1.2}{1997/10/28}{Added lowercase codes for ``modern'' -% greek} -% \changes{greek-1.3e}{1999/09/24}{\cs{extrasgreek} and -% \cs{extraspolutonikogreek} should be complementary} -% \changes{babel-greek-1.09}{2014/07/20}{Added lc codes for chars 128 to 255} -% \changes{babel-greek-1.09b}{2014/09/18}{Remove spurious whitespace from -% `extrasgreek' definition (report Eike Schmidt).} % \begin{macrocode} +\def\bbl@tempa{LGR} +\ifx\greekfontencoding\bbl@tempa \addto\extrasgreek{% \babel@savevariable{\lccode`v}\lccode`v=`v% \babel@savevariable{\lccode`\'}\lccode`\'=`\'% @@ -1573,15 +1564,12 @@ \babel@savevariable{\lccode`\`}\lccode`\`=`\`% } % \end{macrocode} -% In order to process the suitable characters and in such a way that -% hyphenation patterns work also with precomposed characters, it is -% necessary to declare the lc code for all characters that can be part -% of a word. We do this in |\extrasgreek| because this is a feature of +% Also set the lc code for the precomposed characters in the upper half +% of the code table. +% We do this in |\extrasgreek| because this is a feature of % the LGR font encoding (used in all language variants). % This means that multi-accented characters are regarded parts of a word -% (and not non-word characters) also in monotonic spelling. -% \changes{babel-greek-1.09e}{2015/11/27}{Fix bug in lccode-setting loop -% (patch by Enrico Gregorio).} +% also in monotonic spelling. % \begin{macrocode} \addto\extrasgreek{% % ``high bit characters'': set in a loop and correct exceptions @@ -1603,34 +1591,103 @@ \lccode223=244% GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA } % \end{macrocode} -% Drop diacritics (except dialytika and sub-iota) in UPPERCASE also with -% ``input ligatures''. (The optional ``locale'' argument |[el]| restricts -% this change to Greek text parts.) -% If LaTeX is older than 2022/06/01, set the |\uccode| of the -% relevant characters to a dummy character instead. +% +% \begin{macro}{\bbl@greek@tilde} +% \changes{greek-1.0c}{1997/02/19}{Added command} +% \changes{greek-1.1b}{1997/03/06}{Made tilde expand to a tilde with +% \cs{catcode 12}.} +% \changes{greek-1.3k}{2003/04/10}{Make sure the character `!' is not +% active during the definition of \cs{greek@tilde}} +% \changes{greek-1.4}{2013/05/17}{Do not re-define the tilde accent macro: +% it works as expected with \file{lgrenc.def} from \pkg{greek-fontenc}.} +% \changes{babel-greek-1.13}{2023/03/15}{ +% Renamed from \cs{greek@tilde}. Simplified definition.} +% +% By default, the tilde produces an unbreakable space in text mode. +% For the variants ``polutoniko'' and ``ancient'', we change its meaning +% to allow using |~| in the Latin transliteration of characters with +% perispomeni and in composite diacritics. +% \begin{macrocode} + \DeclareTextSymbol{\bbl@greek@tilde}{LGR}{126} + \addto\bbl@greek@setup@polytonic{ + \declare@shorthand{greek}{~}{\bbl@greek@tilde} + } +\fi % End of LGR-specific code. +% \end{macrocode} +% \end{macro} +% +% +% \subsection{MakeUppercase fixes \label{sec:MakeUppercase-fixes}} +% % \changes{greek-1.1b}{1997/03/06}{Added setting of \cs{uccode}s -% (after \file{kdgreek.sty})} +% (after \file{kdgreek.sty})} % \changes{greek-1.1e}{1997/10/12}{Added uppercase code for special -% letter ``v''. Uppercase code for accents is now \texttt{9f}, -% instead of \texttt{ff}} +% letter ``v''. Uppercase code for accents is now \texttt{9f}, +% instead of \texttt{ff}} % \changes{greek-1.2}{1997/10/28}{Added uppercase codes for ``modern'' -% Greek. The old codes are now for ``Polutoniko'' Greek} +% Greek. The old codes are now for ``Polutoniko'' Greek} % \changes{greek-1.3e}{1999/09/24}{\cs{extrasgreek} and -% \cs{extraspolutonikogreek} should be complementary} +% \cs{extraspolutonikogreek} should be complementary} % {\catcode`|=12\relax\gdef\indexbar{\cs{|}}} % \changes{greek-1.3g}{1999/11/17}{uc code of \indexbar{} is now just -% \indexbar{} to reflect recent changes in the cb fonts} +% \indexbar{} to reflect recent changes in the cb fonts} % \changes{greek-1.3i}{2000/10/02}{uc code of `v' is switched to V -% so that mixed text appears correctly in headers.} +% so that mixed text appears correctly in headers.} % \changes{greek-1.3j}{2001/02/03}{Don't use the double caret notation here, -% because other languages might make the caret active.} +% because other languages might make the caret active.} +% \changes{greek-1.5}{2013/06/21}{Support XeTeX/LuaTeX.} +% \changes{babel-greek-1.09d}{2015/07/06}{uc-/lccode corrections from xgreek +% 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.} +% Only change uccodes if LaTeX is older than 2022/06/01.} % \changes{babel-greek-1.13.2}{2023-06-01}{ -% Use \cs{DeclareUppercaseMapping} to drop diacritics.} +% \cs{MakeUppercase} fix for transliteration input.} +% \changes{babel-greek-1.14}{2023-08-18}{ +% \cs{MakeUppercase} fix for standard accent macros.} +% In Greek typographical praxis, +% letters drop accents (eccept dialytika) and breathings in +% UPPERCASE. This is not cared for by the Unicode standard. +% For Unicode literals, |\MakeUppercase| implements locale-specific +% corrections.\footnote{ +% The pre-2022 implementation is corrected by character code definitions +% in \file{tuenc-greek.def} from \pkgref{greek-fontenc}, +% cf. section~\ref{load-greek-font-encoding-definitions}.} +% +% To fix the behaviour of the 2022 |\MakeUppercase| implementation with +% standard accent macros, we define and use ``capital'' accent +% 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 +% (cf. section~\ref{sec:modifiers}). +% \begin{macrocode} +\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} % new in 2020 +\bbl@xin@{,local-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}% + } + {} +\fi +% \end{macrocode} +% Drop diacritics also with ``input ligatures'' defined in LGR fonts: +% +% Since 2023/06, we can set up character mappings to be used on the argument +% of |\MakeUppercase|.\footnote{cf. +% \href{https://www.latex-project.org/news/latex2e-news/ltnews37.pdf} +% {LaTeX News~37}} +% The optional ``locale'' argument |[el]| restricts the mapping to Greek +% text parts. % \begin{macrocode} +\def\bbl@tempa{LGR} +\ifx\greekfontencoding\bbl@tempa \ifdefined\DeclareUppercaseMapping % new in 2023 - \DeclareUppercaseMapping[el]{"1FBE}{\prosgegrammeni}% + % \DeclareUppercaseMapping[el]{"1FBE}{\prosgegrammeni}% \DeclareUppercaseMapping[el]{"0027}{}% ' \addto\bbl@greek@setup@polytonic{ \DeclareUppercaseMapping[el]{"003C}{}% < @@ -1639,11 +1696,14 @@ \DeclareUppercaseMapping[el]{"007E}{}% ~ } \fi - % fallback for for LaTeX versions older than 2020-10-01 - \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} - \IfFormatAtLeastTF{2022/06/01}% - {} - {% else +% \end{macrocode} +% If LaTeX is older than 2022/06, +% we set the |\uccode| of the relevant characters to a dummy character +% (|\uccode| changes are ignored by |\MakeUppercase| since 2022). +% To minimize side-effects, the re-definition is limited to Greek text parts. +% \begin{macrocode} + \IfFormatAtLeastTF{2022/06/01}{} + {% else (LaTeX format older than 2022/06/01) \addto\extrasgreek{% \babel@savevariable{\uccode`\"}\uccode`\"=`\"% \babel@savevariable{\uccode`\'}\uccode`\'=159% 159 == ^^9f @@ -1652,7 +1712,6 @@ \babel@savevariable{\uccode`\~}\uccode`\~=159% \babel@savevariable{\uccode`\>}\uccode`\>=159% \babel@savevariable{\uccode`\<}\uccode`\<=159% - \babel@savevariable{\uccode`\|}\uccode`\|=`\|% \babel@savevariable{\uccode`\`}\uccode`\`=159% } % \end{macrocode} @@ -1685,8 +1744,8 @@ } % \end{macrocode} % Add composite commands, so that the dialytika is kept or put on the -% following character of a diphthong with |\MakeUppercase| -% (see lgrdef.enc from the the greek-fontenc package for details). +% following character of a diphthong with |\MakeUppercase| (see +% \file{lgrdef.enc} from the \pkgref{greek-fontenc} package for details). % \changes{greek-1.4}{2013/05/17}{ % Add TextCompositeCommands for ``uppercase diacritics''.} % \changes{greek-1.5}{2013/05/27}{Bugfix: @hiatus->LGR@hiatus} @@ -1708,35 +1767,9 @@ \DeclareTextCompositeCommand{\"}{TU}{^^9f}{\accdialytika} \fi }% end of the \IfFormatAtLeastTF else block -% \end{macrocode} -% -% \begin{macro}{\bbl@greek@tilde} -% By default, the tilde produces an unbreakable space in text mode. -% In polytonic and ancient Greek, we change its meaning to allow -% using |~| in the Latin transliteration of characters with perispomeni. -% As the perispomeni is not required with monotonic Greek, this is -% only done for the variants ``polutoniko'' and ``ancient''. -% \changes{greek-1.0c}{1997/02/19}{Added command} -% \changes{greek-1.1b}{1997/03/06}{Made tilde expand to a tilde with -% \cs{catcode 12}.} -% \changes{greek-1.3k}{2003/04/10}{Make sure the character `!' is not -% active during the definition of \cs{greek@tilde}} -% \changes{greek-1.4}{2013/05/17}{Do not re-define the tilde accent macro: -% it works as expected with \file{lgrenc.def} from \pkg{greek-fontenc}.} -% \changes{babel-greek-1.13}{2023/03/15}{ -% Renamed from \cs{greek@tilde}. Simplify definition.} -% \begin{macrocode} - \DeclareTextSymbol{\bbl@greek@tilde}{LGR}{126} - \addto\bbl@greek@setup@polytonic{ - \declare@shorthand{greek}{~}{\bbl@greek@tilde} - } -% \end{macrocode} -% \end{macro} -% \begin{macrocode} \fi % End of LGR-specific code. % \end{macrocode} % -% % \subsection{Symbol name aliases} % For backwards compatibility, we keep aliases for a few symbols. % \changes{greek-1.1c}{1997/03/10}{Added a couple of symbols, needed |