summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/lgrx/textalpha-test.tex
blob: c3a33e248dde47d3790386db2c3b932586bf1bf5 (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
\documentclass{article}
\usepackage{cmap} % fix search and cut-and-paste in PDF
\usepackage{lmodern}
\usepackage{parskip}
\usepackage{textcomp}
\usepackage{textalpha}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
\hypersetup{unicode=true}
\usepackage{bookmark}

\newcommand{\LGR}{\fontencoding{LGR}\selectfont}
\newcommand{\Latin}{\fontencoding{T1}\selectfont}

\providecommand{\greektext}{%
  \fontencoding{LGR}\selectfont\def\encodingdefault{LGR}%
}
\providecommand*{\textgreek}[1]{\leavevmode{\greektext #1}}

\DeclareTextCommand{\TextGreek}{LGR}[1]{#1}
\DeclareTextCommandDefault{\TextGreek}[1]{\textgreek{#1}}

\pagestyle{empty}
\setcounter{secnumdepth}{0}

\begin{document}

\subsection{Greek alphabet}

Greek letters via Latin transscription in LGR font encoding:

\LGR 
\MakeUppercase{a b g d e z h j i k l m n x o p r s t u f q y w}

a b g d e z h j i k l m n x o p r s c t u f q y w

\Latin
Greek letters via default macros in other font encoding (here T1):

\textAlpha{} \textBeta{} \textGamma{} \textDelta{} \textEpsilon{}
\textZeta{} \textEta{} \textTheta{} \textIota{} \textKappa{}
\textLambda{} \textMu{} \textNu{} \textXi{} \textOmicron{} \textPi{}
\textRho{} \textSigma{} \textTau{} \textUpsilon{} \textPhi{}
\textChi{} \textPsi{} \textOmega{}


\textalpha{} \textbeta{} \textgamma{} \textdelta{} \textepsilon{}
\textzeta{} \texteta{} \texttheta{} \textiota{} \textkappa{}
\textlambda{} \textmu{} \textnu{} \textxi{} \textomicron{} \textpi{}
\textrho{} \textsigma{} \textvarsigma{} \texttau{} \textupsilon{}
\textphi{} \textchi{} \textpsi{} \textomega{}

So you can easily write a single Greek symbol (like \textPsi{} or
\textmu{}) or
\textlambda\textomicron\textgamma\textomicron\textvarsigma{} in
non-Greek text or ISO-conforming formulas with an upright pi symbol
like $A = \mbox{\textpi} r^2$ instead of $A = \pi r^2$.

However, kerning is broken in other font encodings: compare
\textgreek{AUA} (LGR) to \textAlpha\textUpsilon\textAlpha (T1).
Because of this (and for proper hyphenation), use of babel and correct
language setting is recommended for Greek quotes.

\subsection{\textlambda\textomicron\textgamma\textomicron\textvarsigma{},
            λογος and \TextGreek{logos}}

The subsection title above uses: text* macros, Unicode input and the LGR
transcription for the Greek word \TextGreek{logos}. The last variant (Latin
transscription) is written in Latin letters in the PDF bookmark.

On 2010-11-05, Heiko Oberdiek wrote in comp.text.tex:

\begin{quote}
   \textbackslash pdfstringdef (converting TeX code to PDF strings for
   bookmarks) supports NFSS2 and needs active characters. Encoding
   stuff based on the internal font machinery of TeX (letters with
   catcode 11 or 12, ligatures) does not work, because the strings
   don't reach TeX's stomach.
\end{quote}
  
\subsection{Diacritics}

In LGR encoding, shortcuts as well as named macros are set up for use with
the Latin transcription. 

Composition of diacritics (like \verb+\Dasia\Tonos+) fails in other
font encodings. Long names (like \verb+\DasiaOxia+) work, however they
do not select precomposed characters (the difference becomes obvious
if you drag-and-drop text from the PDF version of this document):
%
LGR: \LGR \<'a \Dasia\Tonos a \DasiaOxia a \DasiaOxia\textalpha \Latin \\
Latin: \DasiaOxia\textalpha

Diacritics (except the dialytika) should placed
before capital letters and dropped with MakeUppercase:

\LGR 
\<{\textalpha} \>{\textepsilon} \"'{\textiota} \`>{\texteta}
\'<{\textomicron} \~<{\textupsilon} \~>{\textomega}
\\
\<{\textAlpha} \>{\textEpsilon} \"'{\textIota} \`>{\textEta}
\'<{\textOmicron} \~<{\textUpsilon} \~>{\textOmega}
\\
\MakeUppercase{%
 \<{\textalpha} \>{\textepsilon} \"'{\textiota} \`>\texteta{}
 \'<{\textomicron} \~<{\textupsilon} \~>{\textomega}
}

\Latin However, in other font encodings, this does not work:

No kerning: (\textgreek{ΑΥΑ} vs. ΑΥΑ), misplaced multiple (\textgreek{ἅ} vs.
ἅ) or Titlecase accents (\textgreek{Ά Έ Ή Ί} vs. Ά Έ Ή Ί) and errors with
MakeUppercase.

Therefore, we would need to define macros for all Unicode characters
that we want to access without explicit font-encoding change.

Alternative: A \verb+\TextGreek+ TextCommandDefault that wraps the argument in
the equivalent of Babel's \verb+\textgreek+ with an LGR TextCommand that
just passes the argument. This is done in the preamble of this document.

This works with the Babel transscription (\TextGreek{logos}), 
keeps kerning (if the kerning pair is inside the argument,
\TextGreek{\textAlpha\textUpsilon\textAlpha}),
and allows iterative accent macros where pre-composed characters are
selected (\TextGreek{\DasiaOxia\textalpha} or
\TextGreek{\Dasia\Tonos\textalpha}).

TODO: Use this definition for multi-macro definitions in the Unicode
definition file?

\end{document}