diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/greek-fontenc/textalpha.sty.html')
-rw-r--r-- | Master/texmf-dist/doc/latex/greek-fontenc/textalpha.sty.html | 184 |
1 files changed, 103 insertions, 81 deletions
diff --git a/Master/texmf-dist/doc/latex/greek-fontenc/textalpha.sty.html b/Master/texmf-dist/doc/latex/greek-fontenc/textalpha.sty.html index 49876aeabe7..14574d9a88f 100644 --- a/Master/texmf-dist/doc/latex/greek-fontenc/textalpha.sty.html +++ b/Master/texmf-dist/doc/latex/greek-fontenc/textalpha.sty.html @@ -24,7 +24,7 @@ version 1.3 of this license or any later version.</p> <dt>Identification</dt> <dd><pre class="literal-block">\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{textalpha} -[2013/09/11 v0.5 macros for Greek letters in text] +[2013/11/28 v0.11 macros for Greek letters in text] </pre> </dd> </dl> @@ -72,6 +72,10 @@ confusion with the <a class="reference external" href="http://www.ctan.org/pkg/t <td> </td> <td><p>support XeTeX/LuaTeX, add breve below accents.</p></td> </tr> +<tr><td><p>2013-11-28</p></td> +<td><p>0.11</p></td> +<td><p>Compatibility with Xe/LuaTeX in 8-bit mode.</p></td> +</tr> </tbody> </table> </dd> @@ -82,28 +86,45 @@ confusion with the <a class="reference external" href="http://www.ctan.org/pkg/t mode. This package sets up a suitable font encoding and Greek LICR definitions (<tt class="literal">\textalpha</tt> – <tt class="literal">\textOmega</tt>).</p> <p>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 -<tt class="literal">\ifdefined</tt> command provided by the <a class="reference external" href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=etex">e-TeX</a> extension) and does “the right -thing” to set up Greek text font support for the detected engine.</p> -<p>For 8-bit TeX, this package also declares the LGR font encoding as default -for Greek LICR macros (cf. <a class="reference external" href="http://www.ctan.org/tex-archive/macros/latex/doc/fntguide.pdf">fntguide</a> section 5.3):</p> +engine used to compile them, this package tests the declared font encodings +and does “the right thing” to set up Greek text font support:</p> +<ul> +<li><p>If the Unicode font encodings EU1 (XeTeX) or EU2 (LuaTeX) are declared, +before loading this package (e.g. vie <tt class="literal">fontspec</tt>) the package provides +Greek LICR definitions for them.</p></li> +<li><p>If the LGR font encoding is declared before loading this package, it is +set as default for Greek LICR macros (cf. <a class="reference external" href="http://www.ctan.org/tex-archive/macros/latex/doc/fntguide.pdf">fntguide</a> section 5.3).</p> +<p>With XeTeX or LuaTex, Unicode fonts and LGR encoded 8-bit fonts can be +used in the same document (see <a class="reference external" href="test-euenc.tex">test-euenc.tex</a>).</p> +</li> +</ul> +<p>Advantages:</p> <ul class="simple"> <li><p>Symbols from a Greek text font (e.g. the <a class="reference external" href="http://www.ctan.org/pkg/cbgreek-complete">CB fonts</a>) can be accessed -without the need for an explicite font-encoding switch.</p></li> -<li><p>In combination with <tt class="literal"><span class="pre">\usepackage[utf8]{inputenc}</span></tt> and <tt class="literal">lgrenc.dfu</tt> -from <a class="reference external" href="http://www.ctan.org/pkg/greek-inputenc">greek-inputenc</a>, Unicode input of Greek characters is supported in -any font encoding.</p></li> +without the need for an explicite font-encoding switch anywhere in the +text.</p></li> +<li><p>Unicode input of Greek characters is supported</p> +<ul> +<li><p>via <tt class="literal"><span class="pre">\usepackage[utf8]{inputenc}</span></tt> and <tt class="literal">lgrenc.dfu</tt> from +<a class="reference external" href="http://www.ctan.org/pkg/greek-inputenc">greek-inputenc</a> for 8-bit TeX or XeTeX/LuaTeX in 8-bit compatibility +mode in any font encoding (see <a class="reference external" href="textalpha-test.tex">textalpha-test.tex</a>).</p></li> +<li><p>natively by XeTeX/LuaTeX for Unicode fonts. As <a class="reference external" href="http://www.ctan.org/pkg/inputenc">inputenc</a> does not work +with these engines, text input can be done via the Latin transcription +or LICR but <em>not via literal Unicode characters</em> for 8-bit font encodings +like LGR (see <a class="reference external" href="test-euenc.tex">test-euenc.tex</a>).</p></li> +</ul> +</li> </ul> <div class="attention"> <p class="admonition-title">Attention!</p> <p>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.</p> +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.</p> <p>Therefore, Greek text should be written with the help of <a class="reference external" href="http://www.ctan.org/pkg/babel">babel</a> or <a class="reference external" href="http://www.ctan.org/pkg/polyglossia">polyglossia</a> (setting the language to <tt class="literal">greek</tt>) or wrapped in the provided <tt class="literal">ensuregreek</tt> macro. Using <a class="reference external" href="http://www.ctan.org/pkg/babel">babel</a> or <a class="reference external" href="http://www.ctan.org/pkg/polyglossia">polyglossia</a> also helps -to ensure proper hyphenation.</p> +to ensure correct hyphenation of Greek text.</p> </div> </div> <div class="section" id="usage"> @@ -111,49 +132,55 @@ to ensure proper hyphenation.</p> <pre class="code latex literal-block"><span class="keyword">\usepackage</span><span class="name builtin">{</span>textalpha<span class="name builtin">}</span> </pre> <p>For details see <a class="reference external" href="textalpha-test.tex">textalpha-test.tex</a> and <a class="reference external" href="textalpha-test.pdf">textalpha-test.pdf</a> (8-bit -TeX) as well as <a class="reference external" href="test-euenc.tex">test-euenc.tex</a> and <a class="reference external" href="test-euenc.pdf">test-euenc.pdf</a> (XeTeX/LuaTeX).</p> +TeX and XeTeX/LuaTeX in 8-bit compatibility mode) as well as +<a class="reference external" href="test-euenc.tex">test-euenc.tex</a> and <a class="reference external" href="test-euenc.pdf">test-euenc.pdf</a> (XeTeX/LuaTeX with Unicode +fonts).</p> </div> <div class="section" id="implementation"> <h1>Implementation</h1> <div class="section" id="requirements"> <h2>Requirements</h2> <p>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 <a class="reference external" href="http://www.ctan.org/pkg/euenc">euenc</a> -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 <a class="reference external" href="http://www.ctan.org/pkg/greek-fontenc">greek-fontenc</a>.</p> -<div class="section" id="xetex"> -<h3>XeTeX</h3> -<p>Use the EU1 font encoding. This is the only font encoding used with XeTeX, -so loading it with <a class="reference external" href="http://www.ctan.org/pkg/fontenc">fontenc</a> cannot mix up the default font encoding:</p> -<pre class="literal-block">\ifdefined\XeTeXrevision - \usepackage[EU1]{fontenc} -</pre> -<p>Load the Greek LICR definitions for XeTeX/LuaTeX. In an ideal world, this -should be done in the eu1enc.def file of the <a class="reference external" href="http://www.ctan.org/pkg/euenc">euenc</a> package.</p> -<p>Before that, we must ensure EU1 is the <tt class="literal">\LastDeclaredEncoding</tt>: Beacause -fontenc loads font encoding definition files only once, it may happen that -another font encoding is defined after EU1 — for example <a class="reference external" href="http://www.ctan.org/pkg/fontspec">fontspec</a> -declares EU1 but leaves <tt class="literal">\LastDeclaredEncoding</tt> at <tt class="literal">T3</tt> (tipa), because -it later inputs the <a class="reference external" href="http://www.ctan.org/pkg/xunicode">xunicode</a> package which in turn loads <tt class="literal">t3enc.def</tt>.</p> -<pre class="literal-block">\renewcommand{\LastDeclaredEncoding}{EU1} -\input{greek-euenc.def} -</pre> -<p>No other action is required with Unicode-aware TeX engines:</p> -<pre class="literal-block"> \expandafter\endinput % "return" -\fi -</pre> -</div> -<div class="section" id="luatex"> -<h3>LuaTeX</h3> -<p>Similar actions to XeTeX, but use the font encoding EU2:<a class="footnote-reference" href="#eu" id="id1"><sup>1</sup></a></p> -<pre class="literal-block">\ifdefined\luatexversion - \usepackage[EU2]{fontenc} - \renewcommand{\LastDeclaredEncoding}{EU2} +Unicode. 8-bit TeX font encodings are only used in compatibility mode or for +fonts not available otherwise. For compatibility with the LaTeX font +selection system, the package <a class="reference external" href="http://www.ctan.org/pkg/euenc">euenc</a> 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 <a class="reference external" href="greek-euenc.def.html">greek-euenc.def</a> which in turn +includes <a class="reference external" href="greek-fontenc.def.html">greek-fontenc.def</a>.</p> +<p>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.</p> +<p>To give <tt class="literal">textalpha.sty</tt> a chance of finding out which font encodings are +used, load it after <a class="reference external" href="http://www.ctan.org/pkg/fontspec">fontspec</a> and/or <a class="reference external" href="http://www.ctan.org/pkg/fontenc">fontenc</a>.</p> +<div class="section" id="font-encodings"> +<h3>Font encodings</h3> +<p>Ensure a Greek-supporting font encoding exists and supports Greek LICR +macros:</p> +<p>Load the Greek LICR definitions for Unicode if font encoding EU1 (XeTeX) or +EU2 (LuaTeX) is detected.<a class="footnote-reference" href="#eu" id="id1"><sup>1</sup></a> In an ideal world, this would be done in +the <tt class="literal">eu1enc.def</tt> (or <tt class="literal">eu2enc.def</tt>) file of the <a class="reference external" href="http://www.ctan.org/pkg/euenc">euenc</a> package. If none +of EU1, EU2, and LGR is declared, load <tt class="literal">lgrenc.def</tt>:</p> +<p>Re-set the <tt class="literal">\LastDeclaredEncoding</tt>: Because fontenc loads font +encoding definition files only once, it may happen that another font +encoding is defined afterwards — for example <a class="reference external" href="http://www.ctan.org/pkg/fontspec">fontspec</a> leaves +<tt class="literal">\LastDeclaredEncoding</tt> at <tt class="literal">T3</tt> (tipa), because it inputs the <a class="reference external" href="http://www.ctan.org/pkg/xunicode">xunicode</a> +package which in turn loads <tt class="literal">t3enc.def</tt>.</p> +<pre class="literal-block">\@ifl@aded{def}{eu1enc}{ + \renewcommand{\LastDeclaredEncoding}{EU1} \input{greek-euenc.def} - \expandafter\endinput % "return" -\fi +}{% else + \@ifl@aded{def}{eu2enc}{ + \renewcommand{\LastDeclaredEncoding}{EU2} + \input{greek-euenc.def} + }{% else + \@ifl@aded{def}{lgrenc}{ + % LGR already declared and set up + }{ + \input{lgrenc.def} + } + } +} </pre> <dl class="footnote"><dt class="label"><a class="fn-backref" href="#id1">1</a></dt> <dd id="eu"> @@ -162,26 +189,13 @@ XeTeX vs. LuaTeX using differently named <tt class="literal">*.fd</tt> files (se details).</p> </dd> </dl> -</div> -<div class="section" id="bit-tex"> -<h3>8-bit TeX</h3> -<p>With 8-bit TeX, you usually pass the font encoding name(s) as option to -<a class="reference external" href="http://www.ctan.org/pkg/fontenc">fontenc</a> which then loads the corresponding <tt class="literal">*.def</tt> file(s). The last -option indicates the document’s default font encoding. (See <a class="citation-reference" href="#" id="id2">[fntguide]</a> for -details and <a class="reference external" href="lgrenc-test.tex">lgrenc-test.tex</a> for an example.) Therefore, we do not know -the documents main font encoding and hence cannot use -<tt class="literal"><span class="pre">\usepackage[LGR]{inputenc}</span></tt>. We load <tt class="literal">lgrenc.def</tt> directly, if it is -not already done and re-set <tt class="literal">\LastDeclaredEncoding</tt> else.</p> -<div class="note"> -<p class="admonition-title">Note</p> -<p>The use of <tt class="literal">\@ifundefined</tt> has the side-effect that the tested -macro becomes defined and set to <tt class="literal">\relax</tt> (polluting the namespace and -interfering with tests via eTeX’s <tt class="literal">\ifdefined</tt>). However, in this case -no harm is done as the macro is defined by <tt class="literal">lgrenc.def</tt> anyway.</p> -</div> -<pre class="literal-block">\@ifundefined{ver@lgrenc.def} - {\input{lgrenc.def}} - {\renewcommand{\LastDeclaredEncoding}{EU1}} +<p>The package <a class="reference external" href="http://www.ctan.org/pkg/hyperref">hyperref</a> defines the PU font encoding which also supports +(monotonic) Greek. It currently misses polytonic greek and the +<tt class="literal">\greekscript</tt> and <tt class="literal">\ensuregreek</tt> TextCommands:</p> +<pre class="literal-block">\@ifl@aded{def}{puenc} + {\ProvideTextCommand{\greekscript}{PU}{} + \ProvideTextCommand{\ensuregreek}{PU}[1]{#1}} + {} </pre> </div> </div> @@ -189,13 +203,26 @@ no harm is done as the macro is defined by <tt class="literal">lgrenc.def</tt> a <h2>Default declarations</h2> <p>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.</p> -<div class="section" id="ensuregreek"> -<h3>ensuregreek</h3> +default font encoding. Abort here, if another Greek-supporting +font encoding is used instead of LGR:</p> +<pre class="literal-block">\@ifl@aded{def}{lgrenc} + {\renewcommand{\LastDeclaredEncoding}{LGR}} + {\expandafter\endinput} % "return" +</pre> +<div class="section" id="greekscript-ensuregreek"> +<h3>greekscript, ensuregreek</h3> +<p>The <tt class="literal">\greekscript</tt> declaration ensures the current font encoding supports +the Greek script. <tt class="literal"><span class="pre">greek-fontenc.def</span></tt> sets this to the empty declaration +for font encodings that do so. This is currently used by <tt class="literal">lgrenc.def</tt> +(LGR) and <tt class="literal"><span class="pre">greek-euenc.def</span></tt> (Greek LICR macros for EU1 and EU2).</p> +<p>We define LGR as default encoding for Greek text. We use +<tt class="literal">\ProvideTextCommandDefault</tt> to enable the author or other packages to use +an alternative definition (see [<a class="reference external" href="http://www.ctan.org/tex-archive/macros/latex/doc/fntguide.pdf">fntguide</a>]):</p> +<pre class="literal-block">\ProvideTextCommandDefault{\greekscript}{\fontencoding{LGR}\selectfont} +</pre> <p>The <tt class="literal">\ensuregreek</tt> 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:</p> -<pre class="literal-block">\DeclareTextCommandDefault{\ensuregreek}[1]{{\fontencoding{LGR}\selectfont #1}} +a font encoding with support for Greek. Again the default is LGR:</p> +<pre class="literal-block">\ProvideTextCommandDefault{\ensuregreek}[1]{\leavevmode{\greekscript #1}} </pre> <!-- The [fntguide_] writes @@ -212,11 +239,6 @@ Unicode characters in the test document `<textalpha-test.tex>`__: EU2) will declare <tt class="literal">\ensuregreek</tt> as text command that passes the argument unchanged. This way, kerning and selection of precomposed glyphs would work also for cases like <tt class="literal"><span class="pre">\ensuregreek{\'A}U</span></tt>.</p> -<!-- 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?). --> </div> <div class="section" id="greek-alphabet"> <h3>Greek Alphabet</h3> |