diff options
Diffstat (limited to 'language/greek/greek-fontenc/textalpha.sty')
-rw-r--r-- | language/greek/greek-fontenc/textalpha.sty | 106 |
1 files changed, 46 insertions, 60 deletions
diff --git a/language/greek/greek-fontenc/textalpha.sty b/language/greek/greek-fontenc/textalpha.sty index dda4d29ca1..e99f65e666 100644 --- a/language/greek/greek-fontenc/textalpha.sty +++ b/language/greek/greek-fontenc/textalpha.sty @@ -16,7 +16,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{textalpha} -[2019/07/11 v0.13.4 macros for Greek letters in text] +[2020/02/28 v0.14 macros for Greek letters in text] % .. note:: % @@ -43,6 +43,9 @@ % 0.13.2 2016-02-05 Support for standard Unicode text font encoding "TU" % (new in fontspec v2.5a). % 0.13.4 2019-07-11 Auxiliary command for subscript iota. +% 0.14 2020-02-28 Update test for Unicode fonts. +% Rename ``greek-euenc`` to ``tuenc-greek``. +% Don't use ``\LastDeclaredEncoding``. % ====== ========== ========================================================= % % .. contents:: @@ -59,9 +62,8 @@ % engine used to compile them, this package tests the declared font encodings % and does "the right thing" to set up Greek text font support: % -% * If the Unicode font encodings EU1 (XeTeX) or EU2 (LuaTeX) are declared, -% before loading this package (e.g. via ``fontspec``) the package provides -% Greek LICR definitions for them. +% * If an Unicode font encoding is declared by ``fontspec``, add Greek LICR +% definitions. % % * Otherwise, the `LGR font encoding`_ is set as `default font encoding` % (cf. fntguide_ section 5.3) for Greek. @@ -78,10 +80,11 @@ % greek-inputenc_ for 8-bit TeX or XeTeX/LuaTeX in 8-bit compatibility % mode in any font encoding (see textalpha-doc.tex_). % -% + natively by XeTeX/LuaTeX for Unicode fonts. As inputenc_ does not work -% with these engines, text input can be done via the Latin transcription -% or LICR but *not via literal Unicode characters* for 8-bit font encodings -% like LGR (see greek-euenc-doc.tex_). +% + natively by XeTeX/LuaTeX for Unicode fonts. +% +% If 8-bit font encodings like LGR are used alongside Unicode fonts, text +% input can be done via the Latin transcription or LICR but *not via +% literal Unicode characters* (see tuenc-greek-doc.tex_). % % .. Attention:: The macros work well in any font encoding for single symbols. % However, with 8-bit TeX engines, the automatic font-encoding switches @@ -123,11 +126,11 @@ % % For detailled examples see `<textalpha-doc.tex>`_ and `<textalpha-doc.pdf>`_ % (8-bit TeX and XeTeX/LuaTeX in 8-bit compatibility mode) as well as -% `<greek-euenc-doc.tex>`_ and `<greek-euenc-doc.pdf>`_ (XeTeX/LuaTeX with +% `<tuenc-greek-doc.tex>`_ and `<tuenc-greek-doc.pdf>`_ (XeTeX/LuaTeX with % Unicode fonts). % % With XeTeX or LuaTex, Unicode fonts and LGR encoded 8-bit fonts can be used -% in the same document (see greek-euenc-doc.tex_). +% in the same document (see tuenc-greek-doc.tex_). % % % Implementation @@ -199,9 +202,9 @@ % fonts not available otherwise. For compatibility with the LaTeX font % selection system, fontspec_ defines the TU font encoding or the (pseudo) % font encodings EU1 and EU2 for XeTeX and LuaTeX respectively. However -% `fontspec` does not (yet) define Greek LICR macros. We therefore explicitely -% load Greek LICR definitions for XeTeX/LuaTeX from `greek-euenc.def -% <greek-euenc.def.html>`_ which in turn includes `greek-fontenc.def +% `fontspec` does not define Greek LICR macros. We therefore explicitely +% load Greek LICR definitions for XeTeX/LuaTeX from `tuenc-greek.def +% <tuenc-greek.def.html>`_ which in turn includes `greek-fontenc.def % <greek-fontenc.def.html>`_. % % .. _LGR font encoding: README.html#lgr @@ -209,34 +212,21 @@ % Ensure a Greek-supporting font encoding exists and supports Greek LICR % macros: % -% * Load the Greek LICR definitions for Unicode if the font encoding TU, EU1 -% (XeTeX) or EU2 (LuaTeX) is detected. -% * Re-set ``\LastDeclaredEncoding`` (used in some included font-encoding files). +% * Load the Greek LICR definitions for Unicode if the font encoding TU, EU1, +% or EU2 is detected. % * If none of TU, EU1, EU2, or LGR is declared, load ``lgrenc.def``. % % :: -\@ifl@aded{def}{tuenc}{ - \renewcommand{\LastDeclaredEncoding}{TU} - \input{greek-euenc.def} -}{% else - \@ifl@aded{def}{eu1enc}{ - \renewcommand{\LastDeclaredEncoding}{EU1} - \input{greek-euenc.def} - }{% else - \@ifl@aded{def}{eu2enc}{ - \renewcommand{\LastDeclaredEncoding}{EU2} - \input{greek-euenc.def} - }{% else - \@ifl@aded{def}{lgrenc}{ - % LGR already declared and set up - \renewcommand{\LastDeclaredEncoding}{LGR} - }{ - \input{lgrenc.def} - } - } +\ifdefined \UTFencname % set by "fontspec.sty" + \input{tuenc-greek.def} +\else + \@ifl@aded{def}{lgrenc}{ + % LGR already declared and set up + }{ + \input{lgrenc.def} } -} +\fi % The package hyperref_ defines the PU font encoding which also supports % (monotonic) Greek. It currently misses polytonic greek and the @@ -244,7 +234,9 @@ \@ifl@aded{def}{puenc} {\ProvideTextCommand{\greekscript}{PU}{} - \ProvideTextCommand{\ensuregreek}{PU}[1]{#1}} + \ProvideTextCommand{\ensuregreek}{PU}[1]{#1} + \pdfstringdefDisableCommands{\let\TextOrMath\@firstoftwo} + } {} @@ -255,35 +247,30 @@ % Psili) are input as < and >. We provide the corresponding NFSS macro accents % (moved here from `greek-fontenc.def`_). % -% As Xe/LuaTeX may use LGR in combination with EU1 or EU2, we define the +% As Xe/LuaTeX may use LGR in combination with TU, we define the % macros twice, for LGR and Unicode font encodings (if they are defined):: -\@ifl@aded{def}{lgrenc}{ - \DeclareTextCommand{\<}{LGR}{\accdasia} - \DeclareTextCommand{\>}{LGR}{\accpsili} +\newcommand{\textalpha@define@breathings}[1]{ + \DeclareTextCommand{\<}{#1}{\accdasia} + \DeclareTextCommand{\>}{#1}{\accpsili} % Composite accents starting with the new-defined shortcuts: - \DeclareTextCompositeCommand{\>}{LGR}{'}{\accpsilioxia} - \DeclareTextCompositeCommand{\>}{LGR}{`}{\accpsilivaria} - \DeclareTextCompositeCommand{\>}{LGR}{~}{\accpsiliperispomeni} - \DeclareTextCompositeCommand{\<}{LGR}{'}{\accdasiaoxia} - \DeclareTextCompositeCommand{\<}{LGR}{`}{\accdasiavaria} - \DeclareTextCompositeCommand{\<}{LGR}{~}{\accdasiaperispomeni} + \DeclareTextCompositeCommand{\>}{#1}{'}{\accpsilioxia} + \DeclareTextCompositeCommand{\>}{#1}{`}{\accpsilivaria} + \DeclareTextCompositeCommand{\>}{#1}{~}{\accpsiliperispomeni} + \DeclareTextCompositeCommand{\<}{#1}{'}{\accdasiaoxia} + \DeclareTextCompositeCommand{\<}{#1}{`}{\accdasiavaria} + \DeclareTextCompositeCommand{\<}{#1}{~}{\accdasiaperispomeni} +} + +\@ifl@aded{def}{lgrenc}{ + \textalpha@define@breathings{LGR} % Hiatus feature (see greek-fontenc.def and babel-greek (greek.ldf)) \DeclareTextCompositeCommand{\<}{LGR}{^^9f}{\LGR@hiatus} \DeclareTextCompositeCommand{\>}{LGR}{^^9f}{\LGR@hiatus} - }{} -\@ifl@aded{def}{greek-euenc}{ % XeTeX or LuaTeX with Unicode fonts - \DeclareTextCommand{\<}{\LastDeclaredEncoding}{\accdasia} - \DeclareTextCommand{\>}{\LastDeclaredEncoding}{\accpsili} - % Composite accents starting with the new-defined shortcuts: - \DeclareTextCompositeCommand{\>}{\LastDeclaredEncoding}{'}{\accpsilioxia} - \DeclareTextCompositeCommand{\>}{\LastDeclaredEncoding}{`}{\accpsilivaria} - \DeclareTextCompositeCommand{\>}{\LastDeclaredEncoding}{~}{\accpsiliperispomeni} - \DeclareTextCompositeCommand{\<}{\LastDeclaredEncoding}{'}{\accdasiaoxia} - \DeclareTextCompositeCommand{\<}{\LastDeclaredEncoding}{`}{\accdasiavaria} - \DeclareTextCompositeCommand{\<}{\LastDeclaredEncoding}{~}{\accdasiaperispomeni} +\@ifl@aded{def}{tuenc-greek}{ % XeTeX or LuaTeX with Unicode fonts + \textalpha@define@breathings{\UTFencname} }{} @@ -306,7 +293,7 @@ % The ``\greekscript`` declaration ensures the current font encoding supports % the Greek script. ``greek-fontenc.def`` sets this to the empty declaration % for font encodings that do so. This is currently used by ``lgrenc.def`` -% (LGR) and ``greek-euenc.def`` (Greek LICR macros for EU1 and EU2). +% (LGR) and ``tuenc-greek.def`` (Greek LICR macros for TU, EU1, or EU2). % % % We define LGR as default encoding for Greek text. We use @@ -541,7 +528,6 @@ % .. _LaTeX Project Public License: http://www.latex-project.org/lppl.txt % .. _CB fonts: http://www.ctan.org/pkg/cbgreek-complete % .. _babel: http://www.ctan.org/pkg/babel -% .. _euenc: http://www.ctan.org/pkg/euenc % .. _e-TeX: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=etex % .. _fontenc: http://www.ctan.org/pkg/fontenc % .. _fontspec: http://www.ctan.org/pkg/fontspec |