summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/greek/babel-greek.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/babel-contrib/greek/babel-greek.dtx')
-rw-r--r--macros/latex/contrib/babel-contrib/greek/babel-greek.dtx128
1 files changed, 77 insertions, 51 deletions
diff --git a/macros/latex/contrib/babel-contrib/greek/babel-greek.dtx b/macros/latex/contrib/babel-contrib/greek/babel-greek.dtx
index 0eb7071284..7cf57237f7 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{1648}
+% \CheckSum{1675}
%
% \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/03/17 1.13.1 Greek support for the babel system]
+ [2023-06-01 1.13.2 Greek support for the babel system]
%\iffalse
%% File `babel-greek.dtx'
%% Greek language Definition File
@@ -200,13 +200,6 @@
% \languageattribute{greek}{ancient}\end{verbatim}
% sets the document language to \emph{ancient} Greek.
%
-% Both attributes may also be used as modifiers as in
-% \begin{verbatim}
-% \usepackage[greek.polutoniko,english]{babel}\end{verbatim}
-% and similarly
-% \begin{verbatim}
-% \usepackage[greek.ancient,english]{babel}\end{verbatim}
-%
% The \hyperref[sec:keep-semicolon]{\Lopt{keep-semicolon}} language
% attribute (new in babel-greek 1.13) ensures that a SEMICOLON character (;)
% can be used as input for the similar looking Greek question mark
@@ -217,19 +210,22 @@
%
% \subsection{Modifiers \label{sec:modifiers}}
%
-% Modifiers cannot be set with |\languageattribute|.
-% Misspelled modifiers are ignored without warning!
+% 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
+% |\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 \Lopt{local-LGR-fixes} modifier restricts the re-definitions
-% in section~\ref{sec:lgr-redefinitions} to text parts using the Greek
-% language.
-% The \Lopt{no-LGR-fixes} modifier disables them completely.
-% You may try, e.g.,
+% 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.
+% The \hyperref[sec:lgr-redefinitions]{\Lopt{no-LGR-fixes}} modifier
+% disables them completely. You may try, e.g.,
% \begin{verbatim}
% \usepackage[greek.local-LGR-fixes,english]{babel}\end{verbatim}
% as a last ressort if the workarounds make a document uncompilable
@@ -510,26 +506,18 @@
% The |polutoniko| language attribute selects the ``polytonic'' spelling.
%
% We use an auxiliary function for the setup part used with several
-% attributes.
-% This code adds the expansion of |\extraspolutonikogreek| to
-% |\extrasgreek| to set up support for multi-accented characters
-% and hyphenation patterns for the polytonic orthography.
+% language attributes:
+% Add the expansion of |\extraspolutonikogreek| to |\extrasgreek|
+% to set up support for multi-accented characters and
+% hyphenation patterns for the polytonic orthography
+% and use polytonic spelling for auto-strings (captions and month names).
+% More code is added later (cf. section~\ref{sec:character-codes}).
% \begin{macrocode}
\def\bbl@greek@setup@polytonic{%
\expandafter\addto\expandafter\extrasgreek
- \expandafter{\extraspolutonikogreek}%
-% \end{macrocode}
-% It also uses polytonic spelling for auto-strings
-% (captions and month names) and changes the expansion of the ~ character
-% from ``protected space'' to ``self-insert'' if the |\greekfontencoding|
-% is LGR (for use as perispomeni in the Latin transliteration).
-% \begin{macrocode}
+ \expandafter{\extraspolutonikogreek}%
\let\captionsgreek\captionspolutonikogreek
\let\gr@month\gr@polutoniko@month
- \def\bbl@tempa{LGR}
- \ifx\greekfontencoding\bbl@tempa
- \declare@shorthand{greek}{~}{\bbl@greek@tilde}
- \fi
}
% \end{macrocode}
% Now declare the option. For backwards compatibility,
@@ -624,6 +612,27 @@
}
% \end{macrocode}
%
+% \subsection{Report 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,}
+\addto\bbl@greek@modifiers{local-LGR-fixes,no-LGR-fixes,}
+\ifx\BabelModifiers\relax\else
+ \bbl@foreach\BabelModifiers{%
+ \@expandtwoargs\in@{,#1,}{\bbl@greek@modifiers}
+ \ifin@\else
+ \bbl@warning
+ {Unknown/misspelled modifier '#1' in '\CurrentOption'.
+ See "babel-greek.pdf" for valid modifiers.}
+ \fi}%
+\fi
+
+% \end{macrocode}
+%
% \subsection{Font setup \label{sec:font-setup}}
%
% \subsubsection{Greek font encoding \label{sec:greekfontencoding}}
@@ -914,7 +923,7 @@
% default Greek font encoding (cf.\ section~\ref{sec:greekfontencoding}).
%
% As an emergency measure, the \Lopt{local-LGR-fixes} or \Lopt{no-LGR-fixes}
-% modifiers (cf.\ section \ref{sec:modifiers}) can be used to restrict
+% \hyperref[sec:modifiers]{modifiers} can be used to restrict
% the ``roman'' redefinitions to text parts using the Greek language or skip
% them completely.
%
@@ -1495,18 +1504,25 @@
% \end{macro}
%
%
-% \subsection{Character codes}
+% \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.
-% The file \file{greek-euenc.def} from \pkg{greek-fontenc}
+%
+% 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}.
%
-% If the Greek font encoding is LGR, character code changes are done here
-% because they must be restricted to text parts using the LGR encoding.
+% 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).}
@@ -1587,13 +1603,11 @@
\lccode223=244% GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
}
% \end{macrocode}
-%
-% In order to drop diacritics (eccept dialytika and sub-iota) in
-% UPPERCASE also with the ``input ligatures'' the |\uccode| of the
-% relevant characters is set to a dummy character.
-% This is only done, if LaTeX is older than 2022/06/01 because
-% the |\MakeUppercase| implementation introduced in this version ignores
-% uccodes and fails with the ``dummy'' character 0x9f.
+% 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.
% \changes{greek-1.1b}{1997/03/06}{Added setting of \cs{uccode}s
% (after \file{kdgreek.sty})}
% \changes{greek-1.1e}{1997/10/12}{Added uppercase code for special
@@ -1612,7 +1626,19 @@
% because other languages might make the caret active.}
% \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}{
+% Use \cs{DeclareUppercaseMapping} to drop diacritics.}
% \begin{macrocode}
+ \ifdefined\DeclareUppercaseMapping % new in 2023
+ \DeclareUppercaseMapping[el]{"1FBE}{\prosgegrammeni}%
+ \DeclareUppercaseMapping[el]{"0027}{}% '
+ \addto\bbl@greek@setup@polytonic{
+ \DeclareUppercaseMapping[el]{"003C}{}% <
+ \DeclareUppercaseMapping[el]{"003E}{}% >
+ \DeclareUppercaseMapping[el]{"0060}{}% `
+ \DeclareUppercaseMapping[el]{"007E}{}% ~
+ }
+ \fi
% fallback for for LaTeX versions older than 2020-10-01
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
\IfFormatAtLeastTF{2022/06/01}%
@@ -1630,7 +1656,7 @@
\babel@savevariable{\uccode`\`}\uccode`\`=159%
}
% \end{macrocode}
-% To avoid \pkg{inputenc} errors if the tilde is used as perispomeni
+% To avoid errors if the tilde is used as perispomeni
% (in polytonic or ancient Greek), we need to declare an expansion for
% the ``dummy'' character~0x9f = 159.\footnote{
% Since UTF-8 became the default encoding (cf.\
@@ -1676,7 +1702,7 @@
\DeclareTextCompositeCommand{\`}{LGR}{^^9f}{\LGR@accdropped}
% \end{macrocode}
% If Unicode fonts are loaded together with LGR, we must also care for
-% |\"'| and |\"`| in TU, because the \" is kept when upcasing.
+% |\"'| and |\"`| in TU, because the |\"| is kept when upcasing.
% \begin{macrocode}
\ifdefined\UnicodeEncodingName % set by XeTeX/LuaTeX
\DeclareTextCompositeCommand{\"}{TU}{^^9f}{\accdialytika}
@@ -1689,10 +1715,7 @@
% 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''
-% (in |\extraspolutonikogreek|).
-%
-% Let the tilde character expand to a tilde with category code 12.
+% 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}.}
@@ -1700,10 +1723,13 @@
% 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.}
+% \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}