diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/lgrx/alphabeta.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/lgrx/alphabeta.sty | 278 |
1 files changed, 190 insertions, 88 deletions
diff --git a/Master/texmf-dist/tex/latex/lgrx/alphabeta.sty b/Master/texmf-dist/tex/latex/lgrx/alphabeta.sty index 637a3c0a27f..8d687ac6c49 100644 --- a/Master/texmf-dist/tex/latex/lgrx/alphabeta.sty +++ b/Master/texmf-dist/tex/latex/lgrx/alphabeta.sty @@ -1,74 +1,90 @@ % alphabeta: Greek symbols in text and math % ***************************************** -% +% % :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: Use ``\alpha, \beta, ...`` for Greek letters in text and math. -% +% +% :Abstract: Use ``\alpha, \beta, ...`` for Greek letters in text and math +% mode. +% % :Identification: % :: \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{alphabeta} -[2013/05/03 v0.2 macros for Greek letters in text and math] +[2013/05/28 v0.3 macros for Greek letters in text and math] % This package is part of the lgrx_ bundle. -% +% % Changelog: % .. class:: borderless -% +% % ========== ===== ========================================================= % 2012-06-26 0.1 initial version -% 2013-05-03 0.2 new accent macro names with lgrxenc.def 0.7 +% 2013-05-03 0.2 new accent macro names with ``lgrxenc.def`` 0.7 +% 2013-05-28 0.3 use ``lgrenc.def`` from greek-fontenc, +% .. enable Unicode input in math mode % ========== ===== ========================================================= -% +% % Motivation % ========== -% +% % By default, the ``\alpha, \beta, ...`` macros for Greek letters % are only valid in mathematical mode. -% -% The `textalpha` package provides a set of macros that can be used to -% access Greek symbols from a font in LGR encoding (e.g. the `CB fonts`_) -% without the need for an explicite font-encoding switch under the names -% ``\textalpha, \textbeta``, ..., ``\textOmega``. -% +% % With this package, the math macros are redefined to work in both, text and % math mode, so that Greek letters can be specified with the established -% command names in text, too. -% +% command names in text, too. +% +% If used together with the ``utf8`` option of inputenc_, literal Unicode +% characters can be used for Greek symbols in mathematical formulas. +% % Attention -% While the macros work reasonably well for single letters, the automatic -% font-encoding switches behind the doors interferes with the kerning -% between the letters and replacement of accent+character with a -% pre-composed character. -% -% Therefore, Greek text should be written with the help of babel_, setting -% the language to either ``greek`` or ``polutonikogreek`` or wrapped in the -% provided ``\ensuregreek`` macro. -% -% +% The macros work well in any font encoding for single symbols. +% +% However, 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 wrapped in the +% provided ``\ensuregreek`` macro or written with the help of babel_, +% setting the language to ``greek``. +% +% % Implementation % ============== -% -% This package extends the `textalpha` package:: +% +% Requirements +% ------------ +% +% This package extends the `textalpha <textalpha.sty.html>`_ package:: \RequirePackage{textalpha} +% `textalpha` depends on greek-fontenc_ and recommends greek-inputenc_. +% +% This package requires the e-TeX_ extensions (i.e. a not too old TeX +% distribution) for the ``\ifdefined`` test. +% % It uses the ``\TextOrMath`` test from the fixltx2e_ standard LaTeX % package:: \RequirePackage{fixltx2e} % .. _fixltx2e: http://www.ctan.org/pkg/fixltx2e -% -% +% +% +% Postpone the re-definitions +% --------------------------- +% +% To prevent other packages overwriting the re-defined commands we postpone +% the next steps until the start of the document body:: + +\AtBeginDocument{ + % Save math macros % ---------------- -% +% % Provide an alias for the standard math commands:: \let\mathGamma\Gamma @@ -107,73 +123,95 @@ \let\mathchi\chi \let\mathpsi\psi \let\mathomega\omega +% ``\digamma`` is defined by amsmath, provide a fallback +\providecommand*{\digamma}{\textit{\textdigamma}} +\let\mathdigamma\digamma + % Commands to access Greek letters by name % ---------------------------------------- -% +% % For letters defined in math mode, the commands work in both, text and math. -% +% % Some Greek letters look identic to Latin letters and can therefore not be % used as variable symbols in math formulas. These letters are not defined in -% TeX's math mode, we define just an alias to the corrsponding ``\text...`` +% TeX's math mode, we provide an alias to the corrsponding ``\text...`` % command. % :: -\newcommand{\Alpha}{\textAlpha} -\newcommand{\Beta}{\textBeta} -\renewcommand{\Gamma}{\TextOrMath{\textGamma}{\mathGamma}} -\renewcommand{\Delta}{\TextOrMath{\textDelta}{\mathDelta}} -\newcommand{\Epsilon}{\textEpsilon} -\newcommand{\Zeta}{\textZeta} -\newcommand{\Eta}{\textEta} -\renewcommand{\Theta}{\TextOrMath{\textTheta}{\mathTheta}} -\newcommand{\Iota}{\textIota} -\newcommand{\Kappa}{\textKappa} -\renewcommand{\Lambda}{\TextOrMath{\textLambda}{\mathLambda}} -\newcommand{\Mu}{\textMu} -\newcommand{\Nu}{\textNu} -\renewcommand{\Xi}{\TextOrMath{\textXi}{\mathXi}} -\newcommand{\Omicron}{\textOmicron} -\renewcommand{\Pi}{\TextOrMath{\textPi}{\mathPi}} -\newcommand{\Rho}{\textRho} -\renewcommand{\Sigma}{\TextOrMath{\textSigma}{\mathSigma}} -\newcommand{\Tau}{\textTau} -\renewcommand{\Upsilon}{\TextOrMath{\textUpsilon}{\mathUpsilon}} -\renewcommand{\Phi}{\TextOrMath{\textPhi}{\mathPhi}} -\newcommand{\Chi}{\textChi} -\renewcommand{\Psi}{\TextOrMath{\textPsi}{\mathPsi}} -\renewcommand{\Omega}{\TextOrMath{\textOmega}{\mathOmega}} +\providecommand*{\Alpha}{\textAlpha} +\providecommand*{\Beta}{\textBeta} +\renewcommand*{\Gamma}{\TextOrMath{\textGamma}{\mathGamma}} +\renewcommand*{\Delta}{\TextOrMath{\textDelta}{\mathDelta}} +\providecommand*{\Epsilon}{\textEpsilon} +\providecommand*{\Zeta}{\textZeta} +\providecommand*{\Eta}{\textEta} +\renewcommand*{\Theta}{\TextOrMath{\textTheta}{\mathTheta}} +\providecommand*{\Iota}{\textIota} +\providecommand*{\Kappa}{\textKappa} +\renewcommand*{\Lambda}{\TextOrMath{\textLambda}{\mathLambda}} +\providecommand*{\Mu}{\textMu} +\providecommand*{\Nu}{\textNu} +\renewcommand*{\Xi}{\TextOrMath{\textXi}{\mathXi}} +\providecommand*{\Omicron}{\textOmicron} +\renewcommand*{\Pi}{\TextOrMath{\textPi}{\mathPi}} +\providecommand*{\Rho}{\textRho} +\renewcommand*{\Sigma}{\TextOrMath{\textSigma}{\mathSigma}} +\providecommand*{\Tau}{\textTau} +\renewcommand*{\Upsilon}{\TextOrMath{\textUpsilon}{\mathUpsilon}} +\renewcommand*{\Phi}{\TextOrMath{\textPhi}{\mathPhi}} +\providecommand*{\Chi}{\textChi} +\renewcommand*{\Psi}{\TextOrMath{\textPsi}{\mathPsi}} +\renewcommand*{\Omega}{\TextOrMath{\textOmega}{\mathOmega}} % -\renewcommand{\alpha}{\TextOrMath{\textalpha}{\mathalpha}} -\renewcommand{\beta}{\TextOrMath{\textbeta}{\mathbeta}} -\renewcommand{\gamma}{\TextOrMath{\textgamma}{\mathgamma}} -\renewcommand{\delta}{\TextOrMath{\textdelta}{\mathdelta}} -\renewcommand{\epsilon}{\TextOrMath{\textepsilon}{\mathepsilon}} -\renewcommand{\zeta}{\TextOrMath{\textzeta}{\mathzeta}} -\renewcommand{\eta}{\TextOrMath{\texteta}{\matheta}} -\renewcommand{\theta}{\TextOrMath{\texttheta}{\maththeta}} -\renewcommand{\iota}{\TextOrMath{\textiota}{\mathiota}} -\renewcommand{\kappa}{\TextOrMath{\textkappa}{\mathkappa}} -\renewcommand{\lambda}{\TextOrMath{\textlambda}{\mathlambda}} -\renewcommand{\mu}{\TextOrMath{\textmu}{\mathmu}} -\renewcommand{\nu}{\TextOrMath{\textnu}{\mathnu}} -\renewcommand{\xi}{\TextOrMath{\textxi}{\mathxi}} -\newcommand{\omicron}{\textomicron} -\renewcommand{\pi}{\TextOrMath{\textpi}{\mathpi}} -\renewcommand{\rho}{\TextOrMath{\textrho}{\mathrho}} -\renewcommand{\sigma}{\TextOrMath{\textsigma}{\mathsigma}} -\renewcommand{\varsigma}{\TextOrMath{\textvarsigma}{\mathvarsigma}} -\renewcommand{\tau}{\TextOrMath{\texttau}{\mathtau}} -\renewcommand{\upsilon}{\TextOrMath{\textupsilon}{\mathupsilon}} -\renewcommand{\phi}{\TextOrMath{\textphi}{\mathphi}} -\renewcommand{\chi}{\TextOrMath{\textchi}{\mathchi}} -\renewcommand{\psi}{\TextOrMath{\textpsi}{\mathpsi}} -\renewcommand{\omega}{\TextOrMath{\textomega}{\mathomega}} +\renewcommand*{\alpha}{\TextOrMath{\textalpha}{\mathalpha}} +\renewcommand*{\beta}{\TextOrMath{\textbeta}{\mathbeta}} +\renewcommand*{\gamma}{\TextOrMath{\textgamma}{\mathgamma}} +\renewcommand*{\delta}{\TextOrMath{\textdelta}{\mathdelta}} +\renewcommand*{\epsilon}{\TextOrMath{\textepsilon}{\mathepsilon}} +\renewcommand*{\zeta}{\TextOrMath{\textzeta}{\mathzeta}} +\renewcommand*{\eta}{\TextOrMath{\texteta}{\matheta}} +\renewcommand*{\theta}{\TextOrMath{\texttheta}{\maththeta}} +\renewcommand*{\iota}{\TextOrMath{\textiota}{\mathiota}} +\renewcommand*{\kappa}{\TextOrMath{\textkappa}{\mathkappa}} +\renewcommand*{\lambda}{\TextOrMath{\textlambda}{\mathlambda}} +\renewcommand*{\mu}{\TextOrMath{\textmu}{\mathmu}} +\renewcommand*{\nu}{\TextOrMath{\textnu}{\mathnu}} +\renewcommand*{\xi}{\TextOrMath{\textxi}{\mathxi}} +\providecommand*{\omicron}{\textomicron} +\renewcommand*{\pi}{\TextOrMath{\textpi}{\mathpi}} +\renewcommand*{\rho}{\TextOrMath{\textrho}{\mathrho}} +\renewcommand*{\sigma}{\TextOrMath{\textsigma}{\mathsigma}} +\renewcommand*{\varsigma}{\TextOrMath{\textvarsigma}{\mathvarsigma}} +\providecommand*{\finalsigma}{\varsigma} +\renewcommand*{\tau}{\TextOrMath{\texttau}{\mathtau}} +\renewcommand*{\upsilon}{\TextOrMath{\textupsilon}{\mathupsilon}} +\renewcommand*{\phi}{\TextOrMath{\textphi}{\mathphi}} +\renewcommand*{\chi}{\TextOrMath{\textchi}{\mathchi}} +\renewcommand*{\psi}{\TextOrMath{\textpsi}{\mathpsi}} +\renewcommand*{\omega}{\TextOrMath{\textomega}{\mathomega}} + + +% Archaic letters +% ''''''''''''''' +% +% :: + +\renewcommand*{\digamma}{\TextOrMath{\textdigamma}{\mathdigamma}} % ϝ +\providecommand*{\Digamma}{\textDigamma} % Ϝ +\providecommand*{\stigma}{\textstigma} % ϛ +\providecommand*{\varstigma}{\textvarstigma} % stigma variant (CB.enc, teubner) +\providecommand*{\koppa}{\textkoppa} % ϟ (greek small letter koppa) +\providecommand*{\qoppa}{\textqoppa} % ϙ (archaic koppa) +\providecommand*{\Qoppa}{\textQoppa} % Ϙ (archaic Koppa) +\providecommand*{\Stigma}{\textStigma} % Ϛ (in some fonts ϹΤ ligature) +\providecommand*{\Sampi}{\textSampi} % Ϡ +\providecommand*{\sampi}{\textsampi} % ϡ % TextCompositeCommands for the generic macros % -------------------------------------------- -% +% % The NFSS TextComposite mechanism looks for the next token without expanding % it. In order to let compositions like ``\TextGreek{\'\Alpha}`` or % ``\TextGreek{\>"\alpha}`` work as expected we define TextComposites with the @@ -323,14 +361,78 @@ \DeclareTextCompositeCommand{\accvaria}{LGR}{\Omega}{`W} \DeclareTextComposite{\accdialytika}{LGR}{\Iota}{219} \DeclareTextComposite{\accdialytika}{LGR}{\Upsilon}{223} -\DeclareTextCompositeCommand{\@hiatus}{LGR}{\Alpha}{\A@hiatus} -\DeclareTextCompositeCommand{\@hiatus}{LGR}{\Epsilon}{\E@hiatus} +\DeclareTextCompositeCommand{\LGR@hiatus}{LGR}{\Alpha}{\LGR@A@hiatus} +\DeclareTextCompositeCommand{\LGR@hiatus}{LGR}{\Epsilon}{\LGR@E@hiatus} + + +% Re-definition for Greek Unicode input in math mode +% -------------------------------------------------- +% +% Check with ``\ifdefined`` for the definition of +% ``\DeclareUnicodeCharacter``. In contrast to ``\@ifdefined``, this works +% without side-effects. It makes, however, the package dependent on the `e-TeX` +% extensions. Alternatively, we could provide a dummy definition +% +% .. code:: latex +% +% \providecommand*{\DeclareUnicodeCharacter}[2]{} +% +% Map Greek characters that are also defined in math mode to the generic +% macros:: + +\ifdefined\DeclareUnicodeCharacter + \DeclareUnicodeCharacter{0393}{\Gamma} % Γ + \DeclareUnicodeCharacter{0394}{\Delta} % Δ + \DeclareUnicodeCharacter{0398}{\Theta} % Θ + \DeclareUnicodeCharacter{039B}{\Lambda} % Λ + \DeclareUnicodeCharacter{039E}{\Xi} % Ξ + \DeclareUnicodeCharacter{03A0}{\Pi} % Π + \DeclareUnicodeCharacter{03A3}{\Sigma} % Σ + \DeclareUnicodeCharacter{03A5}{\Upsilon} % Υ + \DeclareUnicodeCharacter{03A6}{\Phi} % Φ + \DeclareUnicodeCharacter{03A8}{\Psi} % Ψ + \DeclareUnicodeCharacter{03A9}{\Omega} % Ω + + \DeclareUnicodeCharacter{03B1}{\alpha} % α + \DeclareUnicodeCharacter{03B2}{\beta} % β + \DeclareUnicodeCharacter{03B3}{\gamma} % γ + \DeclareUnicodeCharacter{03B4}{\delta} % δ + \DeclareUnicodeCharacter{03B5}{\epsilon} % ε + \DeclareUnicodeCharacter{03B6}{\zeta} % ζ + \DeclareUnicodeCharacter{03B7}{\eta} % η + \DeclareUnicodeCharacter{03B8}{\theta} % θ + \DeclareUnicodeCharacter{03B9}{\iota} % ι + \DeclareUnicodeCharacter{03BA}{\kappa} % κ + \DeclareUnicodeCharacter{03BB}{\lambda} % λ + \DeclareUnicodeCharacter{03BC}{\mu} % μ + \DeclareUnicodeCharacter{03BD}{\nu} % ν + \DeclareUnicodeCharacter{03BE}{\xi} % ξ + \DeclareUnicodeCharacter{03C0}{\pi} % π + \DeclareUnicodeCharacter{03C1}{\rho} % ρ + \DeclareUnicodeCharacter{03C2}{\varsigma} % ς + \DeclareUnicodeCharacter{03C3}{\sigma} % σ + \DeclareUnicodeCharacter{03C4}{\tau} % τ + \DeclareUnicodeCharacter{03C5}{\upsilon} % υ + \DeclareUnicodeCharacter{03C6}{\phi} % φ + \DeclareUnicodeCharacter{03C7}{\chi} % χ + \DeclareUnicodeCharacter{03C8}{\psi} % ψ + \DeclareUnicodeCharacter{03C9}{\omega} % ω + + \DeclareUnicodeCharacter{03DD}{\digamma} % ϝ +\fi + +% :: +} % close the \AtBeginDocument macro % .. 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/cgi-bin/ctanPackageInformation.py?id=babel +% .. _e-TeX: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=etex +% .. _greek-fontenc: http://www.ctan.org/pkg/greek-fontenc +% .. _greek-inputenc: http://www.ctan.org/pkg/greek-inputenc +% .. _inputenc: http://www.ctan.org/pkg/inputenc % .. _lgrx: http://www.ctan.org/pkg/lgrx % .. _fixltx2e: http://www.ctan.org/pkg/fixltx2e |