summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lgreek/lgreekuse.tex
blob: 7f70dc0e951d0c486bc249cab9a0c73acd724413 (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
221
222
223
224
225
226
227
228
229
230
231
\documentclass[a4paper]{article}
\usepackage[delims]{lgreek}
\usepackage{doc}
\MakeShortVerb\|
\newenvironment{TeXystuff}%
  {\small\renewcommand{\baselinestretch}{0.9}\smallskip}%
  {\par\smallskip}

\title{Using Greek Fonts with \LaTeX}
\author{Silvio Levy\\
  Princeton University \\
  Fine Hall, Washington Road\\
  Princeton, NJ, 08544\\
  (\texttt{levy@princeton.edu})\\[5pt]
  \emph{modified for \LaTeX2e by}\\[5pt]
  Timothy Murphy\\
  School of Mathematics\\
  Trinity College Dublin\\
  (\texttt{tim@maths.tcd.ie})}

\begin{document}

\maketitle

\begin{abstract}
In this document I hope to show that typesetting Greek in \LaTeX\
using the |lgreek| package (and the |gr| fonts)
can be as easy as typesetting English text, 
and leads to equally good results.
This is meant to be a tutorial, not an exhaustive discussion;
some \TeX nical remarks that should be useful after the reader
has acquired some familiarity with the fonts are printed in fine
print.
\end{abstract}

\section{The Alphabet}

In order to typeset Greek text, you need to go into ``Greek mode.''
This is achieved by typing |\begin{greek}| anywhere in your document;
Greek mode will remain in effect until you type a matching |\end{greek}|.
While in Greek mode, the letters `a' to `z' and `A' to `Z' come out
as Greek letters, according to the following code:

\begin{center}
\setlength{\tabcolsep}{3pt}
\begin{tabular}{cccccccccccccccccccccccc}
$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|&|t|&|u|&|f|&|q|&|y|&|w|
\end{tabular}
\end{center}

There is no digamma yet.  The same character `s' will print as
`$c$' or `$s$', depending on its position in a word.

\begin{TeXystuff}
The system does this by accessing a ligature of `s' with any other
letter that follows it.  If, for some reason, you want to print
an initial/medial sigma by itself (as in the table above), or
at the end of a word, you should type `c'.
\end{TeXystuff}

Try to typeset some simple text now.  Create a file
containing the following lines:

\begin{quote}
\begin{verbatim}
\documentclass{article}
\usepackage{lgreek}
\begin{document}
This is English text.
\begin{greek}
This is Greek text.
\end{greek}
\end{document}
\end{verbatim}
\end{quote}

When you \TeX\ this file, you get the following gibberish:
\begin{quote}
%\hbox{
This is English text.
\begin{greek}
This is Greek text.
\end{greek}
%}
\end{quote}

If you give the |delims| option for the package then
the character |$| can be used
in place of both |\begin{greek}| and |\end{greek}|,
as eg
\begin{quote}
\begin{verbatim}
This is English text.
$This is Greek text.$
\end{verbatim}
\end{quote}

The control sequences |\(|\dots|\)| are still available
for in-text math.

\section{Accents and Breathings}

To get an acute, grave or circumflex accent over a vowel,
type |'|, |`| or |~|, respectively, before the vowel.
To get a rough or smooth breathing, type |<| or |>| before
the vowel (or rho) and any accent that it may have.  To get an iota
subscript, type \verb"|" \emph{after} the vowel.  A diaeresis is
represented by |"|, and if accompanied by an accent it can come
before or after the accent.

For example, \hbox{\verb">en >arq\~h| >\~hn <o l'ogos"}
gives \hbox{$>en >arq~h| >~hn <o l'ogos$}.
Neat, ain't it?

\begin{TeXystuff}
Accents and breathings, too, are typeset by means of ligatures: a
vowel with a breathing, an accent and iota subscript, for example,
is realized as a four-character ligature.  The only exception is
when a breathing is followed by a grave accent, in which case the
breathing\({}+{}\)accent combination is typeset as a \TeX\ |\accent|
over the vowel.  This means that words containing such combinations
cannot be hyphenated in (standard) \TeX; but this is not a problem
because, with the exception of very rare cases of crasis, all such words
are monosyllables.
\end{TeXystuff}

\section{Punctuation}

Here's the table of correspondences for punctuation:

\begin{center}
\setlength{\tabcolsep}{4pt}
\begin{tabular}{ccccccccc}
$.$&$,$&$;$&$:$&$!$&$?$&$''$&$(($&$))$\\
|.|&|,|&|;|&|:|&|!|&|?|&|''|&|((|&|))|
\end{tabular}
\end{center}

The last three entries represent the apostrophe and quotations marks.
The other available non-letters are the ten digits, parentheses,
brackets, hyphen, em- and en-dashes, slash, percent sign, asterisk,
plus and equal signs.  All of these are accessible in the usual way.
In a future release there will be tick marks for
numbers (\(\hbox{$a$}'=1\), \({}_\prime\hbox{$a$}=1000\)).

\section{Hyphenation}

A hyphenation table for both modern and ancient Greek is currently
being debugged.  For now one can use the usual (English)
hyphenation table, which gives the right results about 90\% of the
time (amazing, isn't it?).  Be sure to proofread your text carefully,
unless you've turned hyphenation off.

\section{Interaction with other macros}

While in Greek mode you can do just about everything that you can
outside: go into math mode, create boxes, alignments, and so on.
The file |greekmacros.tex| sets things up so that in Greek mode
the control sequences |\tt| and |\bf| switch to a
typewriter and a bold Greek font, respectively: thus
|\texttt{s''>agap\~w}| gives \hbox{$\texttt{s''>agap~w}$}.  (Try it.)
On the other hand, there are no ``italic'' or slanted Greek fonts,
so |\it| and |\sl| will give you the same fonts as outside
Greek mode.  The various constructions under
%\AMSTeX\ and \LaTeX\ for increasing or decreasing point sizes don't
\LaTeX\ for increasing or decreasing point sizes don't
work yet; they will in a future release.

The characters that form diacritics (|<|, |>|,
|'|, |`|, |\~|, |"| and \verb"|") are treated differently
depending on whether or not you're in Greek mode.  More exactly,
under plain \TeX\ these characters (with the exception of
|\~|) have a |\catcode| of 12: they print as themselves, 
and they cannot appear in control words.  But in Greek mode
|'|, |`|, |\~|, |"| and \verb"|" are ``letters'', that is,
they have a |\catcode| of 11, while |<| and |>| are
active, with a |\catcode| of 13.  This may be important even
for beginners because it means that |'|, for example, can be taken
as part of a control word.  Thus the sequence
\begin{verbatim}
  \begin{greek}
  wm'ega\hfil'alfa
  \end{greek}
\end{verbatim}
\noindent
will cause an error message about an
undefined control sequence |\hfil'alfa|, instead of printing
\begin{quote}
\begin{greek}
wm'ega\hfil 'alfa
\end{greek}
\end{quote}
as you might expect.  (I hope classicists will forgive this use
of the modern Greek one-accent system.) The solution, of course,
is to remember to add a blank after the |\hfil|.

\begin{TeXystuff}
A more subtle problem arises when you use Greek text in macro
arguments, if the arguments are scanned while you're outside Greek
mode.  This is because \TeX\ assigns |\catcode|s to tokens
as it first reads them, so when the argument is plugged into
the body of the macro the characters above have the wrong 
|\catcode|.  If the legendary Jonathan Horatio Quick were
to write
\begin{quote}
\begin{verbatim}
\def\hellenize#1{\begin{greek}#1\end{greek}}
\hellenize{d'uo >`h tre~is,}
\end{verbatim}
\end{quote}
he would be unpleasantly surprised by the following output:
\begin{quote}
\def\hellenize#1{\begin{greek}#1\end{greek}}
\hellenize{d'uo >`h tre~is,}
\end{quote}
\enlargethispage{24pt}
which can be explained as follows: the |\~|, which should be
a letter, is seen as an active character, and expands to a blank
as in plain \TeX; while the breathing, which should be active,
is not, and in particular it doesn't do the right thing when
next to the grave accent.  Solutions to this problem require a
bit of wizardry, and will not be discussed here; see, for example,
Reinhard Wonneberger's article in the October, 1986 issue of
{\it TUGboat}, especially pages 179--180.
\end{TeXystuff}

\end{document}