From 34dc36f097263085a30929dbedfaaf184c145708 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 4 Nov 2020 21:35:25 +0000 Subject: greek-fontenc (4nov20) git-svn-id: svn://tug.org/texlive/trunk@56851 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/greek-fontenc/textalpha.sty | 129 ++++++++++++--------- 1 file changed, 71 insertions(+), 58 deletions(-) (limited to 'Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty') diff --git a/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty b/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty index 9bf8fa2a12c..e7ac61e763b 100644 --- a/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty +++ b/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty @@ -16,7 +16,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{textalpha} -[2020/09/25 1.0 macros for Greek letters in text] +[2020/10/30 2.0 macros for Greek letters in text] % .. note:: % @@ -47,6 +47,8 @@ % Rename ``greek-euenc`` to ``tuenc-greek``. % Don't use ``\LastDeclaredEncoding``. % 1.0 2020-09-25 Also set ``\encodingdefault`` with ``\greekscript``. +% 2.0 2020-10-30 Load ``tuenc-greek.def`` with Xe/LuaTeX by default. +% .. Load ``puenc-greek.def`` if used with `hyperref`_. % ====== ========== ========================================================= % % .. contents:: @@ -85,7 +87,7 @@ % % 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_). +% literal Unicode characters* (see test-tuenc-greek.tex_). % % .. Attention:: The macros work well in any font encoding for single symbols. % However, with 8-bit TeX engines, the automatic font-encoding switches @@ -127,11 +129,11 @@ % % For detailled examples see ``_ and ``_ % (8-bit TeX and XeTeX/LuaTeX in 8-bit compatibility mode) as well as -% ``_ and ``_ (XeTeX/LuaTeX with +% ``_ and ``_ (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 tuenc-greek-doc.tex_). +% in the same document (see test-tuenc-greek.tex_). % % % Implementation @@ -191,18 +193,36 @@ % .. _font encoding: % +% Symbol macros for breathings +% ---------------------------- +% +% In the Latin transcription provided by LGR, breathing accents (Dasia and +% Psili) are input as < and >. Provide the corresponding NFSS macro accents. +% (Used below for LGR, TU, and PU, if these font encodings are defined):: + +\newcommand{\textalpha@define@breathings}[1]{ + \DeclareTextCommand{\<}{#1}{\accdasia} + \DeclareTextCommand{\>}{#1}{\accpsili} + % Composite accents starting with the new-defined shortcuts: + \DeclareTextCompositeCommand{\>}{#1}{'}{\accpsilioxia} + \DeclareTextCompositeCommand{\>}{#1}{`}{\accpsilivaria} + \DeclareTextCompositeCommand{\>}{#1}{~}{\accpsiliperispomeni} + \DeclareTextCompositeCommand{\<}{#1}{'}{\accdasiaoxia} + \DeclareTextCompositeCommand{\<}{#1}{`}{\accdasiavaria} + \DeclareTextCompositeCommand{\<}{#1}{~}{\accdasiaperispomeni} +} + % Font encodings % -------------- % % With 8-bit LaTeX, the `LGR font encoding`_ is used for Greek characters. If -% no Greek-supporting font encoding (TU, EU1, EU2, or LGR) is declared, LGR is +% no Greek-supporting font encoding (TU or LGR) is declared, LGR is % loaded and set up as default Greek font encoding by this package. % % With XeTeX or LuaTeX, there is one common input and font encoding -- % Unicode. 8-bit TeX font encodings are only used in compatibility mode or for % 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 +% selection system, fontspec_ defines the TU font encoding. However % `fontspec` does not define Greek LICR macros. We therefore explicitely % load Greek LICR definitions for XeTeX/LuaTeX from `tuenc-greek.def % `_ which in turn includes `greek-fontenc.def @@ -213,55 +233,29 @@ % 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, -% or EU2 is detected. -% * If none of TU, EU1, EU2, or LGR is declared, load ``lgrenc.def``. +% * Load the Greek LICR definitions for Unicode if the font encoding TU +% is detected. +% * If none of TU or LGR is declared, load ``tuenc.def`` with +% Xe/LuaTeX and ``lgrenc.def`` else. % % :: -\ifdefined \UTFencname % set by "fontspec.sty" +\ifdefined \UnicodeEncodingName % set by LaTeX for Unicode-aware engines \input{tuenc-greek.def} + \textalpha@define@breathings{\UnicodeEncodingName} \else - \@ifl@aded{def}{lgrenc}{ - % LGR already declared and set up - }{ + \@ifl@aded{def}{lgrenc}{}{% else \input{lgrenc.def} } + \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} \fi -% The package hyperref_ defines the PU font encoding which also supports -% (monotonic) Greek. It currently misses polytonic greek and the -% ``\greekscript`` and ``\ensuregreek`` TextCommands:: - -\@ifl@aded{def}{puenc} - {\ProvideTextCommand{\greekscript}{PU}{} - \ProvideTextCommand{\ensuregreek}{PU}[1]{#1} - \pdfstringdefDisableCommands{\let\TextOrMath\@firstoftwo} - } - {} - - -% Symbol macros for breathings -% ---------------------------- -% -% In the Latin transcription provided by LGR, breathing accents (Dasia and -% 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 TU, we define the -% macros twice, for LGR and Unicode font encodings (if they are defined):: - -\newcommand{\textalpha@define@breathings}[1]{ - \DeclareTextCommand{\<}{#1}{\accdasia} - \DeclareTextCommand{\>}{#1}{\accpsili} - % Composite accents starting with the new-defined shortcuts: - \DeclareTextCompositeCommand{\>}{#1}{'}{\accpsilioxia} - \DeclareTextCompositeCommand{\>}{#1}{`}{\accpsilivaria} - \DeclareTextCompositeCommand{\>}{#1}{~}{\accpsiliperispomeni} - \DeclareTextCompositeCommand{\<}{#1}{'}{\accdasiaoxia} - \DeclareTextCompositeCommand{\<}{#1}{`}{\accdasiavaria} - \DeclareTextCompositeCommand{\<}{#1}{~}{\accdasiaperispomeni} -} +% LGR may also be used in a document compiled with Xe/LuaTeX +% (enables use of 8-bit TeX fonts and input via the Latin transcription). +% Add setup for breathings:: \@ifl@aded{def}{lgrenc}{ \textalpha@define@breathings{LGR} @@ -270,10 +264,29 @@ \DeclareTextCompositeCommand{\>}{LGR}{^^9f}{\LGR@hiatus} }{} -\@ifl@aded{def}{tuenc-greek}{ % XeTeX or LuaTeX with Unicode fonts - \textalpha@define@breathings{\UTFencname} -}{} +% The package hyperref_ defines the PU font encoding which also supports +% (monotonic) Greek. It currently misses polytonic greek, archaic symbols, +% and the ``\greekscript`` and ``\ensuregreek`` TextCommands:: + +\AtBeginDocument{ + \@ifl@aded{def}{puenc}{ + \makeatletter % required inside \AtBeginDocument + \input{puenc-greek.def} + \textalpha@define@breathings{PU} + \pdfstringdefDisableCommands{\let\TextOrMath\@firstoftwo} + \makeatother + }{} +} +% The package textcomp defines the TS1 font encoding with the MICRO SIGN +% named ``\texmu``. Provide the alias ``\textmicro``:: + +\AtBeginDocument{ + \@ifl@aded{def}{ts1enc}{ + \DeclareTextSymbol{\textmicro}{TS1}{181} % micro sign + \DeclareTextSymbolDefault{\textmicro}{TS1} + }{} +} % Default declarations % -------------------- @@ -282,10 +295,9 @@ % anywhere in the document also with 8-bit TeX by declaring LGR as their % default font encoding. Abort here, if the LGR font encoding is not defined:: -\@ifl@aded{def}{lgrenc} - {} -% else return: - {\expandafter\endinput} +\@ifl@aded{def}{lgrenc}{}{ % else return: + \expandafter\endinput +} % greekscript, ensuregreek @@ -322,8 +334,8 @@ % % ``! You can't use a prefix with `end-group character }'.`` % -% Eventually, all font encodings supporting Greek script (e.g. LGI, PU, TU, -% EU1, EU2) will declare ``\ensuregreek`` as text command that passes the +% Eventually, all font encodings supporting Greek script (e.g. LGI, PU, TU) +% will declare ``\ensuregreek`` as text command that passes the % argument unchanged. This way, kerning and selection of precomposed glyphs % would work also for cases like ``\ensuregreek{\'A}U``. % @@ -402,9 +414,10 @@ \DeclareTextSymbolDefault{\textstigma}{LGR} % ϛ \DeclareTextSymbolDefault{\textstigmagreek}{LGR} % ϛ (puenc.def) -\DeclareTextSymbolDefault{\textvarstigma}{LGR} % stigma variant -\DeclareTextSymbolDefault{\textkoppa}{LGR} % ϟ (greek small letter koppa) +\DeclareTextSymbolDefault{\textvarstigma}{LGR} % stigma variant (no separate Unicode character) +\DeclareTextSymbolDefault{\textkoppa}{LGR} % ϟ Greek small letter koppa \DeclareTextSymbolDefault{\textkoppagreek}{LGR} % ϟ (puenc.def) +\DeclareTextSymbolDefault{\textKoppa}{LGR} % ϟ Greek letter koppa (numeral koppa) \DeclareTextSymbolDefault{\textqoppa}{LGR} % ϙ (archaic koppa) \DeclareTextSymbolDefault{\textQoppa}{LGR} % Ϙ (archaic Koppa) \DeclareTextSymbolDefault{\textStigma}{LGR} % Ϛ ϹΤ ligature in some fonts -- cgit v1.2.3