summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/lgrx/README
blob: cb4a68cee1e2df98f0459f929ffc46e5a59fc336 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
.. -*- rst-mode -*-

.. sectnum::
   :depth: 1

Greek text with the `LGR` font encoding
***************************************

: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: The LGRx bundle provides packages and definitions for typesetting
           Greek text with fonts in the LGR encoding, the de-facto standard
           set by babel. It includes a comprehensive font definition file,
           support for Unicode input and macros for Greek letters in
           non-Greek text.

.. contents::

State of the Art
================

Up to now, there is no agreement on a Greek standard font encoding
(reserved name `T7`) because the restrictions for general text encodings
are too severe for typesetting polytonic Greek.

The `LGR` font encoding is the de-facto standard for typesetting Greek with
(8-bit) LaTeX. Fonts in this encoding include the `CB fonts`_ (matching CM),
grtimes_ (Greek Times), Kerkis_ (matching URW Bookman), and the `GFS font
collection`_. Setup of these fonts as Greek variant to matching Latin fonts
is facilitated by the substitutefont_ package.

The `LGR` font encoding generates Greek characters via an ASCII
transliteration. This enables simple input with a Latin keyboard.
Characters with diacritics are selected by ligature definitions in the
font (see greek-usage.pdf__, teubner-doc.pdf__, or
`The CB Greek fonts`__).

__ http://www.tug.org/texlive/Contents/live/texmf-dist/doc/generic/babel/greek-usage.pdf
__ http://www.ctan.org/tex-archive/macros/latex/contrib/teubner/teubner-doc.pdf
__ http://www.eutypon.gr/eutypon/pdf/e2008-21/e21-a01.pdf

.. compound::

  The name `LGR` does not reflect status of this font encoding due to
  historical reasons. The encguide_ classifies encodings starting with `L`
  as "local". Indeed, `LGR` started as a local encoding for the `CB Greek
  fonts` by Claudio Beccari. Later, Apostolos Syropoulos advanced it to the
  default font encoding for the `Babel`_ package's ``greek`` option.  The
  correct name would be ``OT7``:

  * It is an 'old' encoding.
  * It implements a Latin transscription for a non-Latin script like the
    ``OT2`` encoding.
  * It is not confined to 128 bit but ``OT4`` shows that this is no
    absolute requirement for an `OT` encoding.

  However, due to the fact that this font encoding has been used under its
  current name for a long time, the name will not change for compatibility
  reasons.


Problems
========

1. Ligatures with prefix notation prevent kerning (see the examples
   linked below or the `LGR` documentation linked above).

2. Sub-optimal results with the standard accent macros:

   * no combined accents,
   * accents above (instead of before) capital letters,
   * pre-composed characters are not used.

3. The tilde character ``~`` is used for a non-breaking space by
   default. Therefore the transliteration for the *perispomeni* accent is
   not available without re-definition of this character. [#tildehack]_

4. The ``polutonikogreek`` `Babel` option redefines both, ``~`` and ``\~``
   to produce accents via input ligatures (restricted to the language
   setting instead of the font encoding). This prevents the placing of a
   tilde-accent on non-supported characters like in *niño* if the language
   is set to polytonic Greek, even if ``\textlatin`` is used. [#poluhack]_

5. There is no Unicode support with `inputenc`_'s ``utf8`` option.

   The `ucs` package contributed by Dominique Unruh provides Unicode
   support with the ``utf8x`` option. A `babel patch`_ by Werner Lemberg
   for Greek Unicode support never got applied.)

6. The LGR transliteration does not work for PDF bookmarks.


.. _babel patch: http://www.eutypon.gr/eutypon/pdf/e2008-20/e20-a03.pdf


.. [#tildehack] Problem 3 can be solved by the simple one-liner ::

    \DeclareTextSymbol{\~}{LGR}{126}

  which results in ``\~`` inserting a plain tilde character if the
  font encoding is `LGR`.

  Drawback: you cannot place a ~-accent on Greek characters except the
  ones supported by an input ligature.

.. [#poluhack] Fortunately, LaTeX saves copies of the accent macros: ``\~``
   is an alias of ``\a~`` (which is an alias of ``\@tabacckludge~``), so it
   can be restored after loading `Babel` with::

      \addto\extraspolutonikogreek{\renewcommand*{\~}{\a~}}
      \addto\extrasgreek{\renewcommand*{\~}{\a~}}

   With this addition, both the comprehensive font encoding definitions and
   the workaround [#tildehack]_ also work with the ``polutonikogreek``
   `Babel` option.


lgrxenc.def: Comprehensive font encoding definitions
====================================================

``lgrxenc.def`` is an alternative to the rudimentary `LGR` font
definition file ``lgrenc.def`` which comes with Babel_'s Greek
support. It defines accent macros for the `LGR` font encoding that
select pre-composed glyphs if possible and places the diacritics
according to Greek typesetting rules else. Combined accents can be
specified as backslash + transliteration (``\~>a``) or iteratively
(``\~\>{a}``).

:Source:   `<lgrxenc.def>`_, `<lgrxenc.def.html>`__
:Doc:      `<lgrxenc.tex>`__, `<lgrxenc.pdf>`__
:Tests:    `<lgrxenc-test.tex>`__, `<lgrxenc-test.pdf>`__

Usage
-----

To prevent confusion with Babel_'s ``lgrenc.def``, this file is named
``lgrxenc.def``. Load it by calling fontenc_ with the ``LGRx`` option.

Example:
  Select font encodings `T1` (as default) and `LGR` (with the comprehensive
  font encoding definitions)

    ``\usepackage[LGRx,T1]{fontenc}``

.. Attention:: The name of the font encoding defined by the option ``LGRx``
   is **not** `LGRx` but `LGR`. Therefore, ``LGRx`` may not be the
   last option (as fontenc uses the last option to select the default font
   encoding). To set `LGR` as as default font encoding specify both,
   `LGRx` and `LGR`, e.g.

      ``\usepackage[LGRx,T1,LGR]{fontenc}``


lgrenc.dfu: Greek Unicode support
=================================

Standards-compatible UTF-8 support for Greek based on the comprehensive
font encoding definitions.

Cooperates with hyperref_ to enable Greek characters in section headers and
PDF bookmarks without the need for ``\texorpdfstring``.

:Source:   `<lgrenc.dfu>`__, `<lgrenc.dfu.html>`__
:Example:  `<greek-unicode.tex>`__, `<greek-unicode.pdf>`__

Usage
-----

Requires comprehensive font encoding definitions from ``lgrxenc.def``:

  ``\usepackage[LGRx,T1]{fontenc}`` % define LGR and T1 encodings
  ``\usepackage[utf8]{inputenc}``   % standard UTF-8 input encoding

Unless combined with the textalpha_ package, text containing Greek Unicode
characters must be marked as requiring the LGR font encoding (either
directly or by setting the language to ``greek`` or ``polutonikogreek``).
This is a feature of inputenc_'s standard utf8 support, similar to the
behaviour for, e.g., Cyrillic characters.


.. _textalpha:

textalpha.sty: Macros for Greek in text
=======================================

Macros for Greek letters in text that work in any font encoding (see the
example below for limitations) and alias macros for compatibility with
existing packages.

Cooperates with hyperref_ and bookmark_ to enable Greek characters in
section headers and PDF bookmarks without the need for ``\texorpdfstring``.

.. note::

   The package was renamed from `textgreek` to `textalpha` to prevent
   confusion with the textgreek_ package by Leonard Michlmayr.

:Source:      `<textalpha.sty>`__, `<textalpha.sty.html>`__
:Example:    `<textalpha-test.tex>`__, `<textalpha-test.pdf>`__
:Bookmarks: `<greekhyperref.tex>`__, `<greekhyperref.pdf>`__


.. References
   ==========

.. _LaTeX Project Public License: http://www.latex-project.org/lppl.txt
.. _CB Fonts: http://www.ctan.org/pkg/cbgreek-complete
.. _grtimes: http://www.ctan.org/pkg/grtimes
.. _GFS font collection: http://www.ctan.org/pkg/gfs
.. _Kerkis: http://www.ctan.org/pkg/kerkis
.. _substitutefont: http://www.ctan.org/pkg/substitutefont
.. _encguide: http://tug.ctan.org/tex-archive/macros/latex/doc/encguide.pdf
.. _Babel: http://www.ctan.org/pkg/babel
.. _fontenc:  http://www.ctan.org/pkg/fontenc
.. _inputenc: http://www.ctan.org/pkg/inputenc
.. _textgreek: http://www.ctan.org/pkg/textgreek
.. _hyperref: http://www.ctan.org/pkg/hyperref
.. _bookmark: http://www.ctan.org/pkg/bookmark