summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-09-13 22:08:33 +0000
committerKarl Berry <karl@freefriends.org>2013-09-13 22:08:33 +0000
commit85c6a8aa9952fa244dac588d1e2a036ecd7ca772 (patch)
tree6e994248b566a58d83b1ac450e5fcd34f6401fa5 /Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty
parent55ecfa6fbf846c1437ea75881c6fead2cf945736 (diff)
greek-fontenc (13sep13)
git-svn-id: svn://tug.org/texlive/trunk@31645 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.sty359
1 files changed, 359 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty b/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty
new file mode 100644
index 00000000000..dcac9f746b6
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/greek-fontenc/textalpha.sty
@@ -0,0 +1,359 @@
+% textalpha: 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 letters
+% outside math.
+%
+% :Identification:
+% ::
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{textalpha}
+[2013/09/11 v0.5 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
+% 2013-05-03 0.3 new accent macro names with ``lgrxenc.def`` 0.7
+% 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.
+% ========== ===== =========================================================
+%
+% 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 does a simple test (based on the
+% ``\ifdefined`` command provided by the e-TeX_ extension) and does "the right
+% thing" to set up Greek text font support for the detected engine.
+%
+% For 8-bit TeX, this package also declares the LGR font encoding as default
+% for Greek LICR macros (cf. fntguide_ section 5.3):
+%
+% * Symbols from a Greek text font (e.g. the `CB fonts`_) can be accessed
+% without the need for an explicite font-encoding switch.
+%
+% * In combination with ``\usepackage[utf8]{inputenc}`` and ``lgrenc.dfu``
+% from greek-inputenc_, Unicode input of Greek characters is supported in
+% any font encoding.
+%
+% .. Attention::
+% The macros work well in any font encoding for single symbols.
+% However, with 8-bit TeX, 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 proper hyphenation.
+%
+%
+% Usage
+% =====
+%
+% .. code:: latex
+%
+% \usepackage{textalpha}
+%
+% For details see `<textalpha-test.tex>`_ and `<textalpha-test.pdf>`_ (8-bit
+% TeX) as well as `<test-euenc.tex>`_ and `<test-euenc.pdf>`_ (XeTeX/LuaTeX).
+%
+%
+% Implementation
+% ==============
+%
+%
+% Requirements
+% ------------
+%
+% With XeTeX or LuaTeX, there is one common input and font encoding --
+% Unicode. 8-bit TeX font encodings should generally not be used. For
+% compatibility with the LaTeX font selection system, the package euenc_
+% defines the (pseudo) font encodings EU1 and EU2 for XeTeX and LuaTeX
+% respectively. However euenc does not (yet) define LICR macros. We therefore
+% explicitely load Greek LICR definitions for XeTeX/LuaTeX from greek-fontenc_.
+%
+% XeTeX
+% """""
+%
+% Use the EU1 font encoding. This is the only font encoding used with XeTeX,
+% so loading it with fontenc_ cannot mix up the default font encoding::
+
+\ifdefined\XeTeXrevision
+ \usepackage[EU1]{fontenc}
+
+% Load the Greek LICR definitions for XeTeX/LuaTeX. In an ideal world, this
+% should be done in the eu1enc.def file of the euenc_ package.
+%
+% Before that, we must ensure EU1 is the ``\LastDeclaredEncoding``: Beacause
+% fontenc loads font encoding definition files only once, it may happen that
+% another font encoding is defined after EU1 --- for example fontspec_
+% declares EU1 but leaves ``\LastDeclaredEncoding`` at ``T3`` (tipa), because
+% it later inputs the xunicode_ package which in turn loads ``t3enc.def``. ::
+
+ \renewcommand{\LastDeclaredEncoding}{EU1}
+ \input{greek-euenc.def}
+
+% No other action is required with Unicode-aware TeX engines::
+
+ \expandafter\endinput % "return"
+\fi
+
+
+% LuaTeX
+% """"""
+%
+% Similar actions to XeTeX, but use the font encoding EU2: [#EU]_ ::
+
+\ifdefined\luatexversion
+ \usepackage[EU2]{fontenc}
+ \renewcommand{\LastDeclaredEncoding}{EU2}
+ \input{greek-euenc.def}
+ \expandafter\endinput % "return"
+\fi
+
+% .. [#EU] The two different (pseudo) font encodings allow different font setups for
+% XeTeX vs. LuaTeX using differently named ``*.fd`` files (see euenc_ for
+% details).
+%
+%
+% 8-bit TeX
+% """""""""
+%
+% With 8-bit TeX, you usually pass the font encoding name(s) as option to
+% fontenc_ which then loads the corresponding ``*.def`` file(s). The last
+% option indicates the document's default font encoding. (See [fntguide]_ for
+% details and `<lgrenc-test.tex>`_ for an example.) Therefore, we do not know
+% the documents main font encoding and hence cannot use
+% ``\usepackage[LGR]{inputenc}``. We load ``lgrenc.def`` directly, if it is
+% not already done and re-set ``\LastDeclaredEncoding`` else.
+%
+% .. note:: The use of ``\@ifundefined`` has the side-effect that the tested
+% macro becomes defined and set to ``\relax`` (polluting the namespace and
+% interfering with tests via eTeX's ``\ifdefined``). However, in this case
+% no harm is done as the macro is defined by ``lgrenc.def`` anyway.
+%
+% ::
+
+\@ifundefined{ver@lgrenc.def}
+ {\input{lgrenc.def}}
+ {\renewcommand{\LastDeclaredEncoding}{EU1}}
+
+
+% 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.
+%
+% ensuregreek
+% """""""""""
+%
+% The ``\ensuregreek`` command can be used to ensure that its argument is set in
+% a font encoding with support for Greek. We define LGR as default encoding for
+% Greek text::
+
+\DeclareTextCommandDefault{\ensuregreek}[1]{{\fontencoding{LGR}\selectfont #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-test.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``.
+%
+% .. Do this for PU here? ``\DeclareTextCommand{\ensuregreek}{PU}[1]{#1}``
+%
+% Can lead to infinite recursion (``TeX capacity exeeded``) without the
+% ``unicode=true`` hyperref option.
+% (How about a test whether the PU font encoding is defined?).
+%
+%
+% Greek Alphabet
+% """"""""""""""
+%
+% Define the ``text*`` marcos as default for all font encodings::
+
+\DeclareTextSymbolDefault{\textAlpha}{LGR}
+\DeclareTextSymbolDefault{\textBeta}{LGR}
+\DeclareTextSymbolDefault{\textGamma}{LGR}
+\DeclareTextSymbolDefault{\textDelta}{LGR}
+\DeclareTextSymbolDefault{\textEpsilon}{LGR}
+\DeclareTextSymbolDefault{\textZeta}{LGR}
+\DeclareTextSymbolDefault{\textEta}{LGR}
+\DeclareTextSymbolDefault{\textTheta}{LGR}
+\DeclareTextSymbolDefault{\textIota}{LGR}
+\DeclareTextSymbolDefault{\textKappa}{LGR}
+\DeclareTextSymbolDefault{\textLambda}{LGR}
+\DeclareTextSymbolDefault{\textMu}{LGR}
+\DeclareTextSymbolDefault{\textNu}{LGR}
+\DeclareTextSymbolDefault{\textXi}{LGR}
+\DeclareTextSymbolDefault{\textOmicron}{LGR}
+\DeclareTextSymbolDefault{\textPi}{LGR}
+\DeclareTextSymbolDefault{\textRho}{LGR}
+\DeclareTextSymbolDefault{\textSigma}{LGR}
+\DeclareTextSymbolDefault{\textTau}{LGR}
+\DeclareTextSymbolDefault{\textUpsilon}{LGR}
+\DeclareTextSymbolDefault{\textPhi}{LGR}
+\DeclareTextSymbolDefault{\textChi}{LGR}
+\DeclareTextSymbolDefault{\textPsi}{LGR}
+\DeclareTextSymbolDefault{\textOmega}{LGR}
+%
+\DeclareTextSymbolDefault{\textalpha}{LGR}
+\DeclareTextSymbolDefault{\textbeta}{LGR}
+\DeclareTextSymbolDefault{\textgamma}{LGR}
+\DeclareTextSymbolDefault{\textdelta}{LGR}
+\DeclareTextSymbolDefault{\textepsilon}{LGR}
+\DeclareTextSymbolDefault{\textzeta}{LGR}
+\DeclareTextSymbolDefault{\texteta}{LGR}
+\DeclareTextSymbolDefault{\texttheta}{LGR}
+\DeclareTextSymbolDefault{\textiota}{LGR}
+\DeclareTextSymbolDefault{\textkappa}{LGR}
+\DeclareTextSymbolDefault{\textlambda}{LGR}
+\DeclareTextSymbolDefault{\textmu}{LGR}
+\DeclareTextSymbolDefault{\textnu}{LGR}
+\DeclareTextSymbolDefault{\textxi}{LGR}
+\DeclareTextSymbolDefault{\textomicron}{LGR}
+\DeclareTextSymbolDefault{\textpi}{LGR}
+\DeclareTextSymbolDefault{\textrho}{LGR}
+\DeclareTextSymbolDefault{\textsigma}{LGR}
+\DeclareTextSymbolDefault{\textvarsigma}{LGR}
+\DeclareTextSymbolDefault{\textfinalsigma}{LGR} % alias for \textvarsigma
+\DeclareTextSymbolDefault{\textautosigma}{LGR} % char 115 in LGR
+\DeclareTextSymbolDefault{\texttau}{LGR}
+\DeclareTextSymbolDefault{\textupsilon}{LGR}
+\DeclareTextSymbolDefault{\textphi}{LGR}
+\DeclareTextSymbolDefault{\textchi}{LGR}
+\DeclareTextSymbolDefault{\textpsi}{LGR}
+\DeclareTextSymbolDefault{\textomega}{LGR}
+
+% 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
+\DeclareTextSymbolDefault{\textpentehekaton}{LGR} % GREEK ACROPHONIC ATTIC FIVE HUNDRED
+\DeclareTextSymbolDefault{\textpenteqilioi}{LGR} % GREEK ACROPHONIC ATTIC FIVE THOUSAND
+\DeclareTextSymbolDefault{\textpentemurioi}{LGR} % GREEK ACROPHONIC ATTIC FIFTY THOUSAND
+
+% Archaic letters::
+
+\DeclareTextSymbolDefault{\textstigma}{LGR} % ϛ
+\DeclareTextSymbolDefault{\textstigmagreek}{LGR} % ϛ (puenc.def)
+\DeclareTextSymbolDefault{\textvarstigma}{LGR} % stigma variant
+\DeclareTextSymbolDefault{\textkoppa}{LGR} % ϟ (greek small letter koppa)
+\DeclareTextSymbolDefault{\textkoppagreek}{LGR} % ϟ (puenc.def)
+\DeclareTextSymbolDefault{\textqoppa}{LGR} % ϙ (archaic koppa)
+\DeclareTextSymbolDefault{\textQoppa}{LGR} % Ϙ (archaic Koppa)
+\DeclareTextSymbolDefault{\textStigma}{LGR} % Ϛ ϹΤ ligature in some fonts
+\DeclareTextSymbolDefault{\textStigmagreek}{LGR} % Ϛ (puenc.def)
+\DeclareTextSymbolDefault{\textSampi}{LGR} % Ϡ
+\DeclareTextSymbolDefault{\textSampigreek}{LGR} % Ϡ (puenc.def)
+\DeclareTextSymbolDefault{\textsampi}{LGR} % ϡ
+\DeclareTextSymbolDefault{\textsampigreek}{LGR} % ϡ (puenc.def)
+\DeclareTextSymbolDefault{\textanoteleia}{LGR} % ·
+\DeclareTextSymbolDefault{\texterotimatiko}{LGR} % ; (003B is the preferred character)
+\DeclareTextSymbolDefault{\textdigamma}{LGR} % ϝ
+\DeclareTextSymbolDefault{\textDigamma}{LGR} % Ϝ
+\DeclareTextSymbolDefault{\textdigammagreek}{LGR} % ϝ (puenc.def)
+\DeclareTextSymbolDefault{\textDigammagreek}{LGR} % Ϝ (puenc.def)
+
+% numeral signs: http://en.wikipedia.org/wiki/Greek_numerals ::
+
+\DeclareTextSymbolDefault{\textnumeralsigngreek}{LGR} % (puenc.def)
+\DeclareTextSymbolDefault{\textnumeralsignlowergreek}{LGR} % (puenc.def)
+
+% Diacritics
+% """"""""""
+%
+% Greek diacritics via "named" macros::
+
+\DeclareTextAccentDefault{\accdasia}{LGR}
+\DeclareTextAccentDefault{\accpsili}{LGR}
+\DeclareTextAccentDefault{\acctonos}{LGR}
+\DeclareTextAccentDefault{\accvaria}{LGR}
+\DeclareTextAccentDefault{\accperispomeni}{LGR}
+\DeclareTextAccentDefault{\accdialytika}{LGR}
+\DeclareTextAccentDefault{\<}{LGR}
+\DeclareTextAccentDefault{\>}{LGR}
+%
+\DeclareTextAccentDefault{\accdasiaoxia}{LGR}
+\DeclareTextAccentDefault{\accdasiavaria}{LGR}
+\DeclareTextAccentDefault{\accdasiaperispomeni}{LGR}
+\DeclareTextAccentDefault{\accpsilioxia}{LGR}
+\DeclareTextAccentDefault{\accpsilivaria}{LGR}
+\DeclareTextAccentDefault{\accpsiliperispomeni}{LGR}
+\DeclareTextAccentDefault{\accdialytikatonos}{LGR}
+\DeclareTextAccentDefault{\accdialytikavaria}{LGR}
+\DeclareTextAccentDefault{\accdialytikaperispomeni}{LGR}
+
+% Postfix accents::
+
+\DeclareTextSymbolDefault{\ypogegrammeni}{LGR} % "small" sub-iota
+\DeclareTextSymbolDefault{\prosgegrammeni}{LGR} % "capital" sub-iota
+
+% Other accents in LGR::
+
+\DeclareTextAccentDefault{\accinvertedbrevebelow}{LGR} % INVERTED BREVE BELOW
+\DeclareTextAccentDefault{\textsubarch}{LGR} % tipa, Teubner name: ut
+\DeclareTextAccentDefault{\accbrevebelow}{LGR} % BREVE BELOW
+
+
+% Auxiliary macros
+% """"""""""""""""
+%
+% ``\MakeUppercase`` requires two internal commands::
+
+\DeclareTextAccentDefault{\LGR@hiatus}{LGR}
+\DeclareTextAccentDefault{\LGR@Dialytika}{LGR}
+
+
+% .. References
+% ----------
+% .. _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
+% .. _fntguide: http://www.ctan.org/tex-archive/macros/latex/doc/fntguide.pdf
+% .. _greek-fontenc: http://www.ctan.org/pkg/greek-fontenc
+% .. _greek-inputenc: http://www.ctan.org/pkg/greek-inputenc
+% .. _polyglossia: http://www.ctan.org/pkg/polyglossia
+% .. _textgreek: http://www.ctan.org/pkg/textgreek
+% .. _xunicode: http://www.ctan.org/pkg/xunicode