How to use EMACS with Unicode Greek

(polytonic Greek (multiaccented) included)

and LaTeX


1. Make sure that you have a recent version of Emacs (version 21.3 and later works) and the emacs-leim package is installed.


2. Locate the file greek.elc in your system and replace it with this:

greek.elc

(the source is greek.el (you do not need this unless you want to modify it))
These files will soon be part of the Emacs distribution. The lisence is GPL.

3. Put the following code in your .emacs file (located in your home directory)

(prefer-coding-system 'greek-iso-8bit)
(prefer-coding-system 'utf-8)
(load "/path/to/the/file/greek.elc")
(setq default-input-method "el_GR")

This way your files will be saved in Unicode and your default greek keyboard will be the Greek keyboard.

Important: If you open a file written in the iso-8859-7 standard and you save it to Unicode then you can get it back to iso-8859-7
by setting the encoding as follows:

C-x RET f and then type iso-8859-7 RET 

where "C-" stands for "keep the control key pressed" and "RET" stands for the Return key.

For switching a file from iso-8859-7 to Unicode do:      C-x RET and then type utf-8 RET

Emacs Fonts

The standard fontset is the easiest way to see Greek on screen. Start emacs with this:

emacs -fn fontset-standard

The next versions of Emacs should include antialising which will enable the use of scalable fonts. For the moment
scalable fonts look ugly in Emacs and it is better to stay with the standard fontset.


Keyboard change


Now lets see how to write Greek. You change the keyboard from latin to Greek by C-\ You get back to latin with C-\ as well.

As you do this, Emacs switches to el_GR keyboard and back. el_GR support for Greek is very complete. The table at the end of  this article explains the conventions.

However there is a drawback. Not all operating systems and programs have unicode support. What if you want to write a file with the iso-8859-7 encoding using monotonic Greek? Unfortunately you can not easily convert such a file written with the el_GR keyboard from utf-8 to iso-8859-7. If you try
C-x RET f and then type iso-8859-7 RET and then try to save it, Emacs will complain that you have to choose another encoding and not the iso-8859-7 one.

Until everyone has switched to unicode most people will want to write Greek as follows:
In order to do this one more keyboard under the name el_7GR is provided. It's differences from el_GR can be found at the lowercase accented Greek letters. Unicode provides for two possibilities for each vowel. In (monotonic) Greek an accented vowel is either the vowel with "tonos" or the vowel with "oxia". In modern Greece tonos and oxia are considered the same. The el_7GR produces vowels with tonos but the el_GR vowels with oxia. The "vowels with tonos" are  practically the same with what the iso-8859-7 standard uses, so  Emacs can  convert these  from utf-8 to iso-8859-7 as described above.

Remark: A simple way to convert a monotonic text from utf-8 to iso-8859-7 written with the el_GR keyboard is to use "query-replace" in Emacs and change all vowels with oxia to vowels with tonos; and then save to
iso-8859-7.

el_7GR is for the moment  my choice for writting Greek in Emacs. To  use this as the default change the line in your .emacs file from

(setq default-input-method "el_GR")
to
(setq default-input-method "el_7GR")

Note that you can always change between the two keyboards with C-x RET C-\ and type el_GR or el_7GR

You may also prefer to have the iso-8859-7 encoding as the default. For this, change the line in your .emacs file from

(prefer-coding-system 'utf-8)
to
(prefer-coding-system 'iso-8859-7)

Note that you can always change between the two encodings with C-x RET f and type utf-8 or iso-8859-7.



Greek Spell Checking in Emacs

On the fly spell check for Greek is not yet available by default in Emacs. However, if set up properly it works fine.

All necessary information can be found here (thanks to Nick Patavalis)

LaTeX

\usepackage[greek]{babel}
\usepackage[iso-8859-7]{inputenc}


\usepackage[greek]{babel}
\usepackage{ucs}
\usepackage[utf8]{inputenc}
 


Important: If you write monotonic greek in the utf-8 encoding you should use the latter comands in the preample. Not the former!! The solution still uses Babel! Consequently language changes inside a document (for example in case you want to write a latin word need the language changing commands of Babel (\textlatin, \textgreek etc). If you do not like this you have to abandon TeX and use Omega (the unicode version of TeX). Omega is still under heavy development and it is not available for all platforms. If however you want to give it a try here is the recipe: Save your file in utf-8 and make sure that in the preample you have the following lines:

\documentclass{article}
\usepackage{omega}
\ocp\mygreek=inutf8
\ocplist\mygreeklist=
        \addbeforeocplist 1 \mygreek
        \nullocplist
\pushocplist\mygreeklist


\begin{document} etc

On this file you run lambda (instead of latex), you preview it with oxdvi and you get the PostScript file with odvips (instead of dvips).



For more information on Omega you may check the book

A. Syropoulos, A. Tsolomitis, N. Sofroniou
Digital Typography Using LaTeX
Springer Verlag.

Enjoy!

A. Tsolomitis.
25/01/2004.

atsol  [a t]  aegean [dot] gr
fire.png
column.png



  Thanks: I want to thank Vasilis Vasaitis for his very usefull suggestions.


For the next section you need to have unicode fonts with greek support installed on your system. Most probably Mozilla will be able to render the following tables correctly.

 

el_GR conventions

The alphabet

a A
b B
g G
d D
e E
z Z
h H
u U
i I
k K
l L
m M
n N
j J
o O
p P
r R
s S
w
t T
y Y
f F
x X
c C
v V
α Α
β Β
γ Γ
δ Δ
ε Ε
ζ Ζ
η Η
θ Θ
ι Ι
κ Κ
λ Λ
μ Μ
ν Ν
ξ Ξ
ο Ο
π Π
ρ Ρ
σ Σ
ς
τ Τ
υ Υ
φ Φ
χ Χ
ψ Ψ
ω Ω


Additional letters and symbols

;.
;<
;>
;g
;G
--
---
E$
G$
;b
;p
;f
;u
;k
;r
;;k
;U
;w
;s
;S
;j
!e
!!e
#6
##6
#90
##90
#900
##900
:.
·
«
»
ϝ
Ϝ




ϐ
ϖ
ϕ
ϑ
ϰ
ϱ
ϗ
ϴ
ϲ
ϲ
Ϲ
ϳ
ϵ
϶
ϛ
Ϛ
ϟ
Ϟ
ϡ
Ϡ
·

(In the above order: ano teleia, left quotes, right quotes, digamma, Digamma, endash, emdash, Euro, Drachma, beta alternative, pi alternative, phi alternative, theta alternative, kappa alternative, rho alternative, kai symbol, Theta symbol, sigma lunate, sigma lunate, Sigma lunate, yot, epsilon alternative, epsilon alternative reversed, stigma, Stigma, qoppa, Qoppa, sampi, Sampi, middle dot.)


Accents

key
result
example
;
oxia
;a gives ά
:
dialytika :i gives ϊ
;: or :;
oxia dialytika
;:i gives ΐ
>
psili
>a gives ἀ
<
dasia
<a gives ἁ
>;
oxia psiln
>;a gives ἄ
<;
oxia dasia
<;a gives ἅ
`
baria
`a gives ὰ
:` or `:
baria dialytika
:`i gives ῒ
>`
baria psiln
`>a gives ἂ
<`
baria dasia
`<a gives ἃ
~
perispomeni
~a gives ᾶ
~: or :~
perispomeni dialytika
~:i gives ῗ
>~
perispomeni psili
~>a gives ἆ
<~
perispomeni dasia
~<a gives ἇ
|
ypogegrameni
>~v| gives ᾦ
;-
macron
;-i gives ῑ
;^
braxy
;^y gives ῠ