summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/greek-fontenc/greek-fontenc.sty
blob: 6f8646d793691f1cb6803c9140808cddaaddb08a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
% greek-fontenc: Greek text font encoding setup
% *********************************************
%
% :Copyright: © 2013 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: This package sets up a suitable font encoding and Greek LICR
%            definitions depending on the used TeX engine.
%
%
% :Identification:
%  ::

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{greek-fontenc}
[2013/09/10 v0.1 Greek text font encoding setup]


% Motivation
% ==========
%
% 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.)
%
% However, 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. The package
% xunicode_ defines LICR macros for use with XeTeX but does not support Greek.
%
% 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.
%
% 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.
%
% * Ensure EU1 is the ``\LastDeclaredEncoding``. As fontenc does not load font
%   encoding definition files twice, it may happen that another font encoding
%   is defined after EU1 -- for example the xunicode package (also loaded by
%   fontspec) leaves ``\LastDeclaredEncoding`` at ``T3`` (tipa), because it
%   inputs ``t3enc.def``.
%
% * 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.
%
% ::

\ifdefined\XeTeXrevision
  \usepackage[EU1]{fontenc}
  \renewcommand{\LastDeclaredEncoding}{EU1}
  \input{greek-euenc.def}

% LuaTeX
% ======
%
% Similar actions to XeTeX, but use the font encoding EU2. (The two different
% (pseudo) encodings allow different font setups for XeTeX vs. LuaTeX using
% differently named ``*.fd`` files (see euenc_ for details). ::

\else\ifdefined\luatexversion
  \usepackage[EU2]{fontenc}
  \renewcommand{\LastDeclaredEncoding}{EU1}
  \input{greek-euenc.def}

% 8-bit TeX
% =========
%
% Wit 8-bit TeX (TeX, PDFTeX), we do not know the documents main font
% encoding, so we cannot use ``\usepackage[LGR]{inputenc}``. However, the file
% ``lgrenc.def`` contains code to prevent re-definition if it is already
% loaded, so we can simply input::

\else
  \input{lgrenc.def}
\fi\fi


% References
% ==========
%
% .. [fntguide] LaTeX3 Project Team, `LaTeX 2ε font selection`, 2005.
%    http://mirror.ctan.org/macros/latex/doc/fntguide.pdf
%
% .. _LaTeX Project Public License: http://www.latex-project.org/lppl.txt
% .. _euenc:  http://www.ctan.org/pkg/euenc
% .. _fontenc:  http://www.ctan.org/pkg/fontenc
% .. _xunicode:  http://www.ctan.org/pkg/xunicode
%
%