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.dtx154
1 files changed, 98 insertions, 56 deletions
diff --git a/macros/latex/contrib/babel-contrib/greek/babel-greek.dtx b/macros/latex/contrib/babel-contrib/greek/babel-greek.dtx
index 328aee6de2..3d75104121 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{1651}
+% \CheckSum{1648}
%
% \iffalse
% Tell the \LaTeX\ system who we are and write an entry on the
@@ -37,12 +37,12 @@
%<code>\ProvidesLanguage{greek}
%\fi
%\ProvidesFile{babel-greek.dtx}
- [2023/03/04 1.12 Greek support for the babel system]
+ [2023/03/15 1.13 Greek support for the babel system]
%\iffalse
%% File `babel-greek.dtx'
%% Greek language Definition File
%% Copyright © 1997, 2005 Apostolos Syropoulos, Johannes Braams
-%% Copyright © 2013 -- 2020 Günter Milde
+%% Copyright © 2013 -- 2023 Günter Milde
%
%% Please report errors to: Günter Milde <milde@users.sf.net>
%
@@ -84,13 +84,10 @@
% \changes{greek-1.4}{2013/05/17}{new maintainer}
% \changes{greek-1.5}{2013/06/21}{bugfixes,
% change some symbol macros to aliases,
-% LGR fixes via DeclareTextCommand instead of
+% LGR fixes via \cs{DeclareTextCommand} instead of
% extrasgreek/noextrasgreek definitions,
% LICR macros in string definitions,
% LGR font encoding not used with XeTeX/LuaTeX.}
-% \changes{greek-1.5a}{2013/06/27}{``extraspolutonikogreek'' definition
-% was missing with Xe/LuaTeX.
-% Replaced non-printable literal character with ^^-notation.}
% \changes{greek-1.6}{2013/07/18}{fix \cs{@roman} and \cs{@Roman}
% redefinition (thanks to Enrico Gregorio and Claudio Beccari),
% load LICR macro definitions for Xe/LuaTeX.}
@@ -184,9 +181,10 @@
%
% \subsection{Language attributes}
%
-% The attributes \Lopt{monotoniko}, \Lopt{polutoniko}^^A
+% The attributes \hyperref[sec:polutoniko]{\Lopt{polutoniko}}^^A
% \footnote{with the alias \Lopt{polytonic}},
-% and \Lopt{ancient} allow the specification of the used orthography.
+% and \hyperref[sec:ancient]{\Lopt{ancient}} allow the specification
+% of the used orthography.
% The language variant affects automatic hyphenation, spelling of
% auto-generated strings and support for multi-accented letters.
%
@@ -209,22 +207,28 @@
% \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
+% (\emph{erotimatiko}).
+% By default, the LGR font encoding uses the QUESTION MARK (?)
+% as input for the \emph{erotimatiko} and maps the SEMICOLON
+% to an \emph{ano teleia} (·).
%
% \subsection{Modifiers \label{sec:modifiers}}
%
+% Modifiers cannot be set with |\languageattribute|.
+% Misspelled modifiers are ignored without warning!
+%
% \changes{babel-greek-1.12}{2023/03/04}{
% New modifiers \Lopt{local-LGR-fixes} and \Lopt{no-LGR-fixes}.}
%
-% The following modifiers cannot be set with |\languageattribute|.
-% Misspelled modifiers are ignored without warning!
-% \medskip
-%
% Some workarounds for the non-standard LGR font encoding may have
% serious side-effects.
-% The \texttt{local-LGR-fixes} \emph{modifier} restricts the re-definitions
+% The \Lopt{local-LGR-fixes} modifier restricts the re-definitions
% in section~\ref{sec:lgr-redefinitions} to text parts using the Greek
% language.
-% The \texttt{no-LGR-fixes} \emph{modifier} disables them completely.
+% The \Lopt{no-LGR-fixes} modifier disables them completely.
% You may try, e.g.,
% \begin{verbatim}
% \usepackage[greek.local-LGR-fixes,english]{babel}\end{verbatim}
@@ -232,7 +236,6 @@
% 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).
-%
% These modifiers are provisional, naming and behaviour may change.
%
% \subsection{Language hooks \label{sec:language-hooks}}
@@ -257,9 +260,11 @@
%
% There are several alternatives to write Greek text.
% \begin{itemize}
-% \item Literal input using the UTF-8 encoding is the standard input
-% method. With 8-bit TeX, this requires the package
-% \pkgref{greek-inputenc}.
+% \item Literal input using the UTF-8 encoding is the standard input method.
+% With 8-bit TeX, this requires the package \pkgref{greek-inputenc}
+% and special handling for Latin letters and some symbols
+% (consider using the \hyperref[sec:keep-semicolon]{\Lopt{keep-semicolon}}
+% attribute).
%
% With the packages \pkgref{inputenc} and \pkgref{greek-inputenc},
% literal Greek characters can also be input using the legacy encodings
@@ -287,7 +292,7 @@
%
% \DescribeMacro\greekscript
% The \emph{TextCommand}\footnote{For a discussion of TextCommands, see
-% the \emph{LaTeX font guide}, too.}
+% the \emph{LaTeX font guide}.}
% |\greekscript| switches to a font encoding
% supporting the Greek script.
% \DescribeMacro\greektext
@@ -420,6 +425,14 @@
% \begin{macrocode}
\gdef\CurrentOption{greek}
% \end{macrocode}
+% Set up the Babel shorthands feature. It is used later to insert literal
+% |~| characters with polytonic Greek and LGR and to prevent LGR converting
+% a literal semicolon |;| to an \emph{ano teleia} |·|.
+% \changes{babel-greek-1.13}{2023/03/15}{
+% Setup \cs{languageshorthands} for all language variants.}
+% \begin{macrocode}
+\addto\extrasgreek{\languageshorthands{greek}}
+% \end{macrocode}
%
%
% \subsection{Hyphenation patterns \label{sec:hyphenation-patterns}}
@@ -462,7 +475,7 @@
% ^^A TODO: Move the |\let\l@greek=...| definitions to the language
% ^^A attribute functions (as we only have one language variant per document)
% ^^A or use the hooks to allow more than one language variant?
-% \changes{greek-1.5a}{2013/06/27}{provide ``extraspolutonikogreek'' also
+% \changes{greek-1.5a}{2013/06/27}{provide \cs{extraspolutonikogreek} also
% for Xe/LuaTeX.}
% \begin{macrocode}
\addto\extrasgreek{\let\l@greek=\bbl@monogreek}
@@ -482,7 +495,7 @@
% \end{macro}
%
%
-% \subsection{Language variants \label{sec:language-variants}}
+% \subsection{Language attributes}
%
% The Babel core provides the command |\bbl@declare@ttribute| for the
% declaration of language attributes in language definition files.
@@ -492,24 +505,35 @@
% If the language attribute is selected, the third argument is executed
% after reading the *.ldf file.
%
-% \subsubsection{\Lopt{polutoniko}}
+% \label{sec:language-variants}
+% \subsubsection{\Lopt{polutoniko}\label{sec:polutoniko}}
% 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.
% \begin{macrocode}
-\bbl@declare@ttribute{greek}{polutoniko}{%
+\def\bbl@greek@setup@polytonic{%
\expandafter\addto\expandafter\extrasgreek
- \expandafter{\extraspolutonikogreek}%
+ \expandafter{\extraspolutonikogreek}%
% \end{macrocode}
% It also uses polytonic spelling for auto-strings
-% (captions and month names).
+% (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}
\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}
-%
-% For backwards compatibility, ``polytonic'' spelling can also be
+% Now declare the option. For backwards compatibility,
+% 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.
@@ -519,6 +543,8 @@
% Added some code to make older documents work.}
% \changes{greek-1.3g}{2000/02/04}{\cs{noextraspolutonikogreek} was missing.}
% \begin{macrocode}
+\bbl@declare@ttribute{greek}{polutoniko}{%
+ \bbl@greek@setup@polytonic
\let\l@polutonikogreek\l@greek
\let\datepolutonikogreek\dategreek
\let\extraspolutonikogreek\extrasgreek
@@ -536,14 +562,11 @@
% variant in \pkg{polyglossia} and Babel |*.ini| files.
% \begin{macrocode}
\bbl@declare@ttribute{greek}{polytonic}{%
- \expandafter\addto\expandafter\extrasgreek
- \expandafter{\extraspolutonikogreek}%
- \let\captionsgreek\captionspolutonikogreek
- \let\gr@month\gr@polutoniko@month
+ \bbl@greek@setup@polytonic
}
% \end{macrocode}
%
-% \subsubsection{\Lopt{ancient}}
+% \subsubsection{\Lopt{ancient}\label{sec:ancient}}
%
% \changes{babel-greek-1.09}{2014/07/20}{Add support for ancient Greek.}
%
@@ -553,8 +576,7 @@
% multi-accented characters and ancient hyphenation patterns.
% \begin{macrocode}
\bbl@declare@ttribute{greek}{ancient}{%
- \expandafter\addto\expandafter\extrasgreek
- \expandafter{\extraspolutonikogreek}% multi-accented letters
+ \bbl@greek@setup@polytonic
\expandafter\addto\expandafter\extrasgreek
\expandafter{\extrasancientgreek}%
% \end{macrocode}
@@ -563,7 +585,6 @@
% sets of month names and no common calendar in ancient Greece).
% \begin{macrocode}
\let\captionsgreek\captionsancientgreek
- \let\gr@month\gr@polutoniko@month % (modern) polytonic month names
% \end{macrocode}
% Classicists tend to use the Q-like ``archaic'' koppa for the number 90.
% Thus, for classical Greek, we set the default to the ``archaic'' koppa
@@ -575,6 +596,32 @@
% \end{macrocode}
%
%
+% \subsubsection{\Lopt{keep-semicolon}\label{sec:keep-semicolon}}
+%
+% \changes{babel-greek-1.13}{2023/03/15}{
+% New language attribute \Lopt{keep-semicolon}.}
+% The LGR font encoding uses the Latin question mark as input for
+% the Greek question mark (\emph{erotimatiko}) and maps the semicolon
+% to a middle dot (\emph{ano teleia}).
+% As a result, Unicode-encoded texts that use the semicolon (;) as
+% \emph{erotimatiko} end up with an \emph{ano teleia} (·) in its place!
+%
+% With the \texttt{keep-semicolon} language attribute, 003B SEMICOLON is made
+% 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
+ \ProvideTextCommandDefault{\textsemicolon}{;}
+ \ProvideTextCommand{\textsemicolon}{LGR}{\TextOrMath{\texterotimatiko}{;}}
+ \initiate@active@char{;}
+ \addto\extrasgreek{\bbl@activate{;}}
+ \addto\noextrasgreek{\bbl@deactivate{;}}
+ \declare@shorthand{greek}{;}{\textsemicolon}
+ \fi
+}
+% \end{macrocode}
+%
% \subsection{Font setup \label{sec:font-setup}}
%
% \subsubsection{Greek font encoding \label{sec:greekfontencoding}}
@@ -776,7 +823,7 @@
% encoding change local}
% \changes{greek-1.3k}{2003/03/19}{Added \cs{leavevmode} as was done
% with \cs{latintext}}
-% \changes{babel-greek-1.12}{2023/03/04}{^^A
+% \changes{babel-greek-1.12}{2023/03/04}{
% Simplified implementation using \cs{\DeclareTextFontCommand}.
% Name changed from \cs{textgreek} to \cs{lgrfont}.}
% \begin{macrocode}
@@ -1432,7 +1479,7 @@
% \changes{greek-1.1a}{1997/03/03}{
% removed two superfluous @'s which made \cs{@alph} undefined}
% \changes{babel-greek-1.12}{2023/03/04}{
-% Save/restore previous expansion of \cs{\@alph} and \cs{\@Alph}
+% Save/restore expansion of \cs{\@alph} and \cs{\@Alph}
% with every switch to/from Greek.}
% \begin{macrocode}
\addto\extrasgreek{%
@@ -1462,7 +1509,7 @@
% \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 LGR is the \cs{greekfontencoding}.}
+% Only change uc/lccodes if \cs{greekfontencoding} is LGR.}
% \begin{macrocode}
\def\bbl@tempa{LGR}
\ifx\greekfontencoding\bbl@tempa
@@ -1562,7 +1609,7 @@
% \changes{greek-1.3j}{2001/02/03}{Don't use the double caret notation here,
% because other languages might make the caret active.}
% \changes{babel-greek-1.12}{2023/03/04}{
-% Don't change uccodes if LaTeX is from 2022/06/01 or newer.}
+% Only change uccodes if LaTeX is older than 2022/06/01.}
% \begin{macrocode}
% fallback for for LaTeX versions older than 2020-10-01
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
@@ -1599,8 +1646,8 @@
% \changes{greek-1.3j}{2001/02/03}{
% Use the tilde as an alias for character 159}
% \changes{babel-greek-1.12}{2023/03/04}{
-% Declare char 159 expansion similar to the way it is done
-% in \pkg{inputenc} to avoid ``inputenc error''.}
+% Declare char 159 expansion similar to
+% \pkg{inputenc} to avoid ``inputenc error''.}
% \begin{macrocode}
\bgroup
\uccode`\~159%
@@ -1612,13 +1659,13 @@
% 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).
-% \changes{greek-1.4}{2013/05/17}{Add TextCompositeCommands for
-% ``uppercase diacritics''.}
+% \changes{greek-1.4}{2013/05/17}{
+% Add TextCompositeCommands for ``uppercase diacritics''.}
% \changes{greek-1.5}{2013/05/27}{Bugfix: @hiatus->LGR@hiatus}
% \changes{greek-1.5a}{2013/07/02}{Replaced non-printable literal character
-% with ^^-notation (thanks to Heiko Oberdiek for the hint).}
-% \changes{babel-greek-1.09}{2014/07/20}{The |^^|-notation seems to require
-% lower case letters. |^^9F| failed.}
+% with \textasciicircum-notation (tip by Heiko Oberdiek).}
+% \changes{babel-greek-1.09}{2014/07/20}{The \textasciicircum-notation seems
+% to require lower case letters.}
% \changes{babel-greek-1.09h}{2019/07/11}{Move breathing composite commands
% to textalpha.}
% \begin{macrocode}
@@ -1635,7 +1682,7 @@
}% end of the \IfFormatAtLeastTF else block
% \end{macrocode}
%
-% \begin{macro}{\greek@tilde}
+% \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.
@@ -1651,15 +1698,10 @@
% 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}
- \begingroup
- \@ifundefined{active@char\string!}{}{\catcode`!=12\relax}
- \catcode`\~=12%
- \lccode`\!=`\~%
- \lowercase{\def\x{\endgroup
- \def\greek@tilde{!}}\x}
- \addto\extraspolutonikogreek{\languageshorthands{greek}}
- \declare@shorthand{greek}{~}{\greek@tilde}
+ \DeclareTextSymbol{\bbl@greek@tilde}{LGR}{126}
% \end{macrocode}
% \end{macro}
% \begin{macrocode}