diff options
author | Karl Berry <karl@freefriends.org> | 2014-12-29 23:24:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-12-29 23:24:17 +0000 |
commit | 9a0f0d057b7f36dcc8f060ed5efdcdf0408ad201 (patch) | |
tree | fc17e9fd17d0395d4b5b7b6b0a77803cf38824d1 /Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty | |
parent | e8520f340f5558c580fc5f6cc601cc4361ad5970 (diff) |
greek-fontenc (25dec14)
git-svn-id: svn://tug.org/texlive/trunk@35920 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty | 168 |
1 files changed, 103 insertions, 65 deletions
diff --git a/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty b/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty index 7d123b8b3f3..61932d7d5fc 100644 --- a/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty +++ b/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty @@ -2,31 +2,31 @@ % +++++++++++++ % Greek symbols in text % ********************* -% +% % :Copyright: © 2010 Günter Milde % :Licence: This work may be distributed and/or modified under the % conditions of the `LaTeX Project Public License`_, either % version 1.3 of this license or any later version. -% +% % :Abstract: Provide a set of ``\text*`` macros for Greek characters % in text mode. -% +% % :Identification: % :: \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{textalpha} -[2013/11/28 v0.11 macros for Greek letters in text] +[2014/12/12 v0.12 macros for Greek letters in text] % .. note:: -% +% % The package was renamed from `textgreek` to `textalpha` to prevent % confusion with the textgreek_ package by Leonard Michlmayr. -% -% +% +% % Changelog: % .. class:: borderless -% +% % ========== ===== ========================================================= % 2010-06-16 0.1 initial version % 2012-06-27 0.2 support for compound Unicode definitions outside LGR @@ -34,77 +34,79 @@ % 2013-05-28 0.4 use ``lgrenc.def`` from greek-fontenc. % 2013-09-11 0.5 move to greek-fontenc_, % .. support XeTeX/LuaTeX, add breve below accents. -% 2013-11-28 0.11 Compatibility with Xe/LuaTeX in 8-bit mode. +% 2013-11-28 0.11 compatibility with Xe/LuaTeX in 8-bit mode. +% 2014-12-12 0.12 fix auxiliary macro names, +% define symbol macros for breathing accents. % ========== ===== ========================================================= -% +% % Motivation % ========== -% +% % By default, TeX macros for Greek letters are only valid in mathematical % mode. This package sets up a suitable font encoding and Greek LICR % definitions (``\textalpha`` -- ``\textOmega``). -% +% % To allow documents using Greek LICR macros without worrying about the TeX % 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. vie ``fontspec``) the package provides % Greek LICR definitions for them. -% +% % * If the LGR font encoding is declared before loading this package, it is % set as default for Greek LICR macros (cf. fntguide_ section 5.3). -% +% % With XeTeX or LuaTex, Unicode fonts and LGR encoded 8-bit fonts can be % used in the same document (see greek-euenc-doc.tex_). -% +% % Advantages: -% +% % * Symbols from a Greek text font (e.g. the `CB fonts`_) can be accessed % without the need for an explicite font-encoding switch anywhere in the % text. -% -% * Unicode input of Greek characters is supported -% +% +% * Unicode input of Greek characters is supported +% % + via ``\usepackage[utf8]{inputenc}`` and ``lgrenc.dfu`` from % 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_). -% +% % .. Attention:: The macros work well in any font encoding for single symbols. % However, with 8-bit TeX engines, the automatic font-encoding switches % behind the doors interfere with kerning between letters and replacement % of accent+character with a pre-composed character. -% +% % Therefore, Greek text should be written with the help of babel_ or % polyglossia_ (setting the language to ``greek``) or wrapped in the % provided ``ensuregreek`` macro. Using babel_ or polyglossia_ also helps % to ensure correct hyphenation of Greek text. -% -% +% +% % Usage % ===== -% +% % .. code:: latex -% +% % \usepackage{textalpha} -% +% % 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 % Unicode fonts). -% -% +% +% % Implementation % ============== -% +% % Requirements % ------------ -% +% % 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 @@ -113,25 +115,25 @@ % define 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 <greek-fontenc.def.html>`_. -% +% % With 8-bit LaTeX, the LGR font encoding is used for Greek characters. If no % Greek-supporting font encoding (EU1, EU2, or LGR) is declared, LGR is loaded % and set up as default Greek font encoding by this package. -% +% % To give ``textalpha.sty`` a chance of finding out which font encodings are % used, load it after fontspec_ and/or fontenc_. -% +% % Font encodings % """""""""""""" -% +% % Ensure a Greek-supporting font encoding exists and supports Greek LICR % macros: -% +% % Load the Greek LICR definitions for Unicode if font encoding EU1 (XeTeX) or % EU2 (LuaTeX) is detected. [#EU]_ In an ideal world, this would be done in % the ``eu1enc.def`` (or ``eu2enc.def``) file of the euenc_ package. If none % of EU1, EU2, and LGR is declared, load ``lgrenc.def``: -% +% % Re-set the ``\LastDeclaredEncoding``: Because fontenc loads font % encoding definition files only once, it may happen that another font % encoding is defined afterwards --- for example fontspec_ leaves @@ -157,8 +159,7 @@ % .. [#EU] The two different (pseudo) font encodings allow different font setups for % XeTeX vs. LuaTeX using differently named ``*.fd`` files (see euenc_ for % details). -% -% +% % The package hyperref_ defines the PU font encoding which also supports % (monotonic) Greek. It currently misses polytonic greek and the % ``\greekscript`` and ``\ensuregreek`` TextCommands:: @@ -168,27 +169,61 @@ \ProvideTextCommand{\ensuregreek}{PU}[1]{#1}} {} +% 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 EU1 or EU2, we define the +% macros for both, LGR and Unicode font encodings (if they are defined):: + +\@ifl@aded{def}{lgrenc}{ + \DeclareTextCommand{\<}{LGR}{\accdasia} + \DeclareTextCommand{\>}{LGR}{\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} +}{} + +\@ifl@aded{def}{greek-euenc}{ % XeTeX (EU1) or LuaTeX (EU2) + \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} +}{} + % Default declarations % -------------------- -% +% % The following definitions ensure that the Greek LICR macros can be used % anywhere in the document also with 8-bit TeX by declaring LGR as their -% default font encoding. Abort here, if another Greek-supporting -% font encoding is used instead of LGR:: +% default font encoding. Abort here, if the LGR font encoding is not defined:: - \@ifl@aded{def}{lgrenc} - {\renewcommand{\LastDeclaredEncoding}{LGR}} - {\expandafter\endinput} % "return" +\@ifl@aded{def}{lgrenc} + {} +% else return: + {\expandafter\endinput} % greekscript, ensuregreek % """""""""""""""""""""""" -% +% % 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). -% -% +% +% % We define LGR as default encoding for Greek text. We use % ``\ProvideTextCommandDefault`` to enable the author or other packages to use % an alternative definition (see [fntguide_]):: @@ -201,26 +236,26 @@ \ProvideTextCommandDefault{\ensuregreek}[1]{\leavevmode{\greekscript #1}} % .. The [fntguide_] writes -% +% % Note that ``\DeclareTextAccentDefault`` can be used on any % one-argument encoding-specific command, not just those defined with % ``\DeclareTextAccent``. -% +% % However, the simpler alternative % ``\DeclareTextAccentDefault{\ensuregreek}{LGR}`` fails with the table of % Unicode characters in the test document `<textalpha-doc.tex>`__: -% +% % ``! You can't use a prefix with `end-group character }'.`` -% +% % Eventually, all font encodings supporting Greek script (e.g. LGI, PU, EU1, % EU2) 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``. -% -% +% +% % Greek Alphabet % """""""""""""" -% +% % Define the ``text*`` marcos as default for all font encodings:: \DeclareTextSymbolDefault{\textAlpha}{LGR} @@ -278,9 +313,9 @@ % Additional Greek symbols % '''''''''''''''''''''''' -% +% % Including alias names for compatibility with hyperref's puenc.def. -% +% % Ancient Greek Numbers (Athenian Numerals):: \DeclareTextSymbolDefault{\textpentedeka}{LGR} % GREEK ACROPHONIC ATTIC FIFTY @@ -317,7 +352,7 @@ % Diacritics % """""""""" -% +% % Greek diacritics via "named" macros:: \DeclareTextAccentDefault{\accdasia}{LGR} @@ -326,8 +361,6 @@ \DeclareTextAccentDefault{\accvaria}{LGR} \DeclareTextAccentDefault{\accperispomeni}{LGR} \DeclareTextAccentDefault{\accdialytika}{LGR} -\DeclareTextAccentDefault{\<}{LGR} -\DeclareTextAccentDefault{\>}{LGR} % \DeclareTextAccentDefault{\accdasiaoxia}{LGR} \DeclareTextAccentDefault{\accdasiavaria}{LGR} @@ -339,6 +372,11 @@ \DeclareTextAccentDefault{\accdialytikavaria}{LGR} \DeclareTextAccentDefault{\accdialytikaperispomeni}{LGR} +% Symbol macros for the breathings:: + +\DeclareTextAccentDefault{\<}{LGR} +\DeclareTextAccentDefault{\>}{LGR} + % Postfix accents:: \DeclareTextSymbolDefault{\ypogegrammeni}{LGR} % "small" sub-iota @@ -353,12 +391,12 @@ % Auxiliary macros % """""""""""""""" -% -% ``\MakeUppercase`` requires two internal commands:: +% +% ``\MakeUppercase`` requires three internal commands:: +\DeclareTextAccentDefault{\LGR@accdropped}{LGR} +\DeclareTextAccentDefault{\LGR@accDialytika}{LGR} \DeclareTextAccentDefault{\LGR@hiatus}{LGR} -\DeclareTextAccentDefault{\LGR@Dialytika}{LGR} - % .. References % ---------- |